bzfvggigaietjghnkzdfaewrkv Posted December 3, 2018 Share Posted December 3, 2018 I'm trying to add a link to the Gift Cert page under a category heading in our main menu. Does anyone know how to do that? CC5/Kurouto Thanks Link to comment Share on other sites More sharing options...
bsmither Posted December 3, 2018 Share Posted December 3, 2018 We may need to have a better description. There is a link for the Gift Certificates as a "Shop by Category" menu item already. Are you wanting a sub-menu item below (aka 'child of') the GC menu item? Or are you wanting to edit the actual GC page where the customer fills out the form when purchasing the GC? Link to comment Share on other sites More sharing options...
bzfvggigaietjghnkzdfaewrkv Posted December 3, 2018 Author Share Posted December 3, 2018 We've got a temporary category at the top of the menu called 'christmas gift ideas' We do have a GC link but would like to add another one as a sub-item of the above, if possible. Link to comment Share on other sites More sharing options...
bsmither Posted December 3, 2018 Share Posted December 3, 2018 There will be two tasks: create a code snippet, and make an edit to the skin template. There are two assumptions: The sub-item of the Gift Cert menu item will only appear if the Gift Cert menu item is actually there. That is, if Gift Certs are switched off, so also will this sub-item. And, The link is hard-coded and the page must actually exist. Otherwise, CubeCart will try to interpret /special-sub-item.html as a valid CubeCart page - which will not be found and CubeCart will send the index.php page as the default. In admin, Manage Hooks, Code Snippets tab, click Add Snippet. A form will be presented below a list of existing snippets. Enabled: checked Unique ID: [email protected]+ Execution Order: 1 Description: Adds an item to the static URLs of Nav Trigger: class.gui.display_navigation.pre_cache PHP Code: {php} $url['subcert'] = "/subcert.html"; // Destined to be a sub-item of GC, page must actually exist $GLOBALS['smarty']->assign('URL', $url); Edit the skin template as follows: In box.navigation.php, find: <li class="li-nav"><a href="{$URL.certificates}" title="{$LANG.navigation.giftcerts}">{$LANG.navigation.giftcerts}</a></li> Change to: <li class="li-nav"><a href="{$URL.certificates}" title="{$LANG.navigation.giftcerts}">{$LANG.navigation.giftcerts}</a>{if $URL.subcert}<ul><li><a href="{$URL.subcert}">{$URL.subcert}</a></li></ul>{/if}</li> You may need to have CubeCart clear its internal cache. In admin, Maintenance, Rebuild tab, check the Clear Cache box and then Submit. Link to comment Share on other sites More sharing options...
bzfvggigaietjghnkzdfaewrkv Posted December 4, 2018 Author Share Posted December 4, 2018 Here's a shot of our menu - GC link is at the bottom, but what we're hoping to achieve is a drop-down arrow under 'CHRISTMAS GIFT IDEAS' at the top. We want to duplicate the link to /gift-certificates.html at the top, as a temporary feature. I tried the snippet as above but no success so far Link to comment Share on other sites More sharing options...
bsmither Posted December 4, 2018 Share Posted December 4, 2018 As an option, we can certainly move Gift Cards to a spot just after Homepage. Link to comment Share on other sites More sharing options...
bzfvggigaietjghnkzdfaewrkv Posted December 5, 2018 Author Share Posted December 5, 2018 Yeah, looks like this will be what we do. Thanks for your assistance. Link to comment Share on other sites More sharing options...
bsmither Posted December 5, 2018 Share Posted December 5, 2018 I would like to understand why creating the code snippet didn't work for you. Maybe we can explore that later. In the list of snippets, delete that snippet from the list and restore from the edit made to the skin template. We will create this snippet instead: Enabled: checked Unique ID: [email protected]+ Execution Order: 1 Description: Adds a non-cat menu item to a parent cat Trigger: class.gui.display_navigation.make_tree Version: 1.0 Author: https://forums.cubecart.com/topic/54574-add-static-page-to-category-menu/ PHP Code: {php} if ($branch['cat_id'] == 4) { // You must use the cat_id of the parent cat $special = array( 'name'=>$GLOBALS['language']->navigation['giftcerts'], 'cat_level'=>$branch['cat_level']+1, 'url'=>$GLOBALS['seo']->buildURL('certificates',false,'&',false) ); $GLOBALS['smarty']->assign('BRANCH', $special); $special_out = $GLOBALS['smarty']->fetch('templates/element.navigation_tree.php'); $branch['children'] = $special_out . $branch['children']; $GLOBALS['smarty']->assign('BRANCH', $branch); } Note that you must use the actual cat_id of the "Christmas Gifts Ideas" category. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.