queenniara Posted September 25, 2013 Share Posted September 25, 2013 I would like to move the breadcrumbs on the category and product page to be under the title. For now anytime I move the breadcrumbs code below to any section in the content.category.php and content.product.php file. It does not show. <div id="breadcrumb"> <ul> <li><a href="{$STORE_URL}">{$LANG.common.home}</a></li> {foreach from=$CRUMBS item=crumb} <li><a href="{$crumb.url}">{$crumb.title}</a></li> {/foreach} </ul> </div> Any help will be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 25, 2013 Share Posted September 25, 2013 When CubeCart uses the statement: Smarty->assign('PLACEHOLDER', $variable); there exists an established target -- a previously specified template file. So, when the data gets assigned to CRUMBS, the target is the main.php template -- that is the scope of CRUMBS. By moving the {$CRUMBS} placeholder to a template that is not in the correct scope, Smarty has no data to display. There may be a way to move the scope of a placeholder to another scope, but I've not explored that possibility and thus, I don't know what Smarty coding would be involved. Quote Link to comment Share on other sites More sharing options...
queenniara Posted September 25, 2013 Author Share Posted September 25, 2013 I currently have the main.php file that has this content: <body> {if isset($SECTION_NAME) && ($SECTION_NAME == "home")} {include scope=parent file="skins/$SKIN_FOLDER/templates/homepage.php"} {elseif isset($SECTION_NAME) && ($SECTION_NAME == "checkout")} {include scope=parent file="skins/$SKIN_FOLDER/templates/checkout.php"} {else} {include scope=parent file="skins/$SKIN_FOLDER/templates/store.php"} {/if} </body> homepage.php, checkout.php and store.php, all have the content that default main.php used to have. Is there something I needed to copy to these files? Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 25, 2013 Share Posted September 25, 2013 I'll experiment with this. In the meantime, look at the pattern: $SECTION_NAME == "home" skins/$SKIN_FOLDER/templates/homepage.php $SECTION_NAME == "checkout")} skins/$SKIN_FOLDER/templates/checkout.php skins/$SKIN_FOLDER/templates/store.php {if isset($SECTION_NAME) && (file_exists("skins/{$SKIN_FOLDER}/templates/{$SECTION_NAME}.php"))} {include scope=parent file="skins/$SKIN_FOLDER/templates/{$SECTION_NAME}.php"} {else} {include scope=parent file="skins/$SKIN_FOLDER/templates/store.php"} {/if} Now, since main.php is effectively replicated n-times, applying updates is also multiplied by n-times. The template object main.php has the breadcrumbs, so that variable will propagate to the included files, which now holds the main HTML. And the main HTML holds the {$PLACEHOLDERS} for the sub-sections. But the sub-sections (content.product.php, for example) are still compiled before main. And it is into these sub-sections that you want the breadcrumbs to appear. I see two solutions: 1. rewrite main.php to include() what are now {$PLACEHOLDERS}, or 2. change the controller code by moving the assign from the GUI class to the Catalogue class. Quote Link to comment Share on other sites More sharing options...
queenniara Posted October 8, 2013 Author Share Posted October 8, 2013 I have no idea how to write the two solutions. It was so much easier with cubecart 4 to move things where I wanted them to be. How do I change the controller code by moving the assign from the GUI class to the Catalogue class? Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 8, 2013 Share Posted October 8, 2013 Try this: In /classes/gui.class.php: Near line 32, change private $_breadcrumb = array(); to public $_breadcrumb = array(); Near line 311, change: $GLOBALS['smarty']->assign('CRUMBS', $this->_breadcrumb); to # $GLOBALS['smarty']->assign('CRUMBS', $this->_breadcrumb); In /classes/catalogue.class.php, around lines 181-324 is the displayProduct() function. Near line 314 is: // Output to main GUI On a line above that, add: $GLOBALS['smarty']->assign('CRUMBS', $GLOBALS['gui']->_breadcrumb); Around lines 117-179 is the displayCategory() function. Near line 172 is: // Sorting On a line above that, add: $GLOBALS['smarty']->assign('CRUMBS', $GLOBALS['gui']->_breadcrumb); Code your skin templates as you described in Post#1. In admin, Maintenance, Rebuild tab, clear the cache so CubeCart will use fresh copies of these templates. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.