One of my clients wanted to be able to enable/disable the 'Featured Products' box (we have it on the homepage), without commenting out code in tpl's. Thought i'd share what i've done with other XC folk. So...
Here's a simple mod to allow you to control the 'Featured Products' dialog from the modules page in admin
Notes:
- BACKUP all files and take a dump of your xcart_modules data before changing anything just to be safe...
- I haven't tested this too much
- This isn't strictly a module, - it just uses the 'module' page in admin
Step 1:
Run this query:
Code:
INSERT INTO `xcart_modules` ( `moduleid` , `module_name` , `module_descr` , `active` )
VALUES (
'100', 'Featured_Products', 'Enable/Disable Featured Products dialog', 'Y'
);
I don't know if there's any logic to the 'moduleid' - i've just used the value '100' as this isn't currently being used...
Step 2:
Wherever you have the featured products dialog appearing (we have it being called from customer/main/welcome.tpl), replace this:
Code:
{include file="customer/main/featured.tpl" f_products=$f_products}
With this:
Code:
{if $active_modules.Featured_Products ne ""}
{include file="customer/main/featured.tpl" f_products=$f_products}
{/if}
Step 3:
- Log into your admin and goto 'modules'
- You should have a new 'module' called 'Featured Products'
- If you don't want it, switch it off!
Comments welcome,
Cheers