dynamic - Trying to create rule based static blocks in Magento -


so 1 of clients has request rule based static blocks on home page. page swap out several static blocks others based on perceived gender of person viewing site. data session user in, or data associated users account. basically, if user searches in specific set of categories (men's or women's categories) should swap static blocks out on home page, when user visits site again have more personalized experience. there default set of blocks if user new site.

something (and excuse shabby php):

if($categories = $user->getviewedcategories()){     foreach($categories $category){         switch($category){             case 14: //insert womens category id here                 echo $staticblockwomen                 break;             case 16: //insert mens category id here                 echo $staticblockmen                 break;         }     } } else {     echo $staticblockdefault } 

i know magento tracks users path through site, , know other elements in magento can have rules based on data (the dynamic banners , checkout rules), lost on started.

if point me in right direction, appreciated!

cheers, matthew

i'm assuming know basics of magento (at least how create new blocks , how manage layout using xml).

if need more info that,

you can accomplish need in few steps:

1 - create blocks need (create new module , block classes inside within corresponding .phtml files)

2 - admin panel, select category want add block , navigate "custom design" tab, add in "custom layout update" textarea this:

<reference name="content" >     <block type="mymodule/myblock" name="myblock" /> </reference> 

this way, every time selected category viewed custmer, block of type "mymodule/myblock" added in content area.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -