Claudia M Posted July 19, 2016 Share Posted July 19, 2016 Hi, I would like to place a previous button on each product page at the top left under the title line and a next button on each product page at the top right under the title line. This way a shopper can continue browsing items in a category without having to go back to the category page. Here's an example of what one of my product pages looks like: https://www.claudiasbargains.com/set-of-vintage-treadle-sewing-machine-drawers-in-case-2.html I'd want it under the line under the title. Thanks in advance for any and all help! Claudia Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 19, 2016 Share Posted July 19, 2016 There is this:http://www.cubecartforums.org/index.php?showtopic=18747 We will just need to verify it works with CC6 (it should) and place the links accordingly. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 19, 2016 Author Share Posted July 19, 2016 Thanks Brian, I'll try it out and let you know! Claudia Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 19, 2016 Author Share Posted July 19, 2016 I was looking at the instructions for this and I think I remembered why I couldn't use it for my cc5 store. I can't go by product IDs. Mine are in no set order as I do not list items in a set order. EX: one incense burner could have a product ID of 5. Then I list a vintage telephone giving it a product ID of 6. Then I list another incense burner, giving it a product ID of 7. See where I'm going? My incense burners will stop having a product ID in order pretty quick. There's no way I can list items so each catepory will have consecutive product IDs. Is there anyway this could go by Product Codes? I do have them in order. Example of my vintage advertising ashtrays: VATA010M, VATA015M, VATA020M, VATA025M. Note they are spaced by 5 in case I want to add a product between them. 10 - 15- 20 - 25. Or, better yet, can I use the custom sort number generated from my Custom Product Sort mod by SemperFi - I love that mod! It just goes by the above numbers without the letters. Thanks, Claudia Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 19, 2016 Share Posted July 19, 2016 "I cannot create items so each category will have consecutive product IDs." Understood. I read the mod description such that the Prev/Next will stay in the category the initial product was found in. So, if you are saying the telephone and the burner are in the same category, I can see where this may prove interesting -- and it would be interesting to know what that category is called. I have no doubt that the mod can use whatever product property that may be available to sort by. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 19, 2016 Author Share Posted July 19, 2016 No they are not in the same category LOL That would be some weird category. What I'm asking, would there be a problem if: Product number 1 of a category had ID say 120 the second item 135 .... Product number of a DIFFERENT category has ID 122, or any number between 120 and 135 Claudia Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 20, 2016 Share Posted July 20, 2016 The mod was designed to stay in the same category that had been entered. Thus, when the current item is shown (like, 120), the next item will be in the same category (like, 135). Products in a different category (like, 122) will not be shown. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 20, 2016 Author Share Posted July 20, 2016 I can't get the prev::next mod to work for CC6. I mean nothing is showing up at all. Most of the code from the CC5 version fits in the CC6 coding but I'm having problems with the following: Thanks in advance for your help /classes/catalogue.class.php This is what the getCategoryProducts() function changes to make looks like in your CC5 mod: Was: $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } return (isset($productList) && is_array($productList)) ? $productList : false; } Now: $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } $GLOBALS['session']->set('last_visited_category',$category_id,'client',true); $GLOBALS['session']->set('last_visited_category_product_ids',$list,'client',true); return (isset($productList) && is_array($productList)) ? $productList : false; } This is what getCategoryProducts() function looks like in CC6.0.12: public function getCategoryProducts($category_id, $page = 1, $per_page = 10, $hidden = false) { if (strtolower($page) == 'all') { $per_page = false; $page = false; } $where2 = $this->outOfStockWhere(false, 'INV', true); if (($result = $GLOBALS['db']->query('SELECT I.product_id FROM `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_category_index` as I, `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_inventory` as INV WHERE I.cat_id = '.$category_id.' AND I.product_id = INV.product_id AND INV.status = 1'.$where2)) !== false) { $this->_category_count = $GLOBALS['db']->numrows(); if (isset($_GET['sort']) && is_array($_GET['sort'])) { foreach ($_GET['sort'] as $field => $direction) { $order[$field] = (strtolower($direction) == 'asc') ? 'ASC' : 'DESC'; break; } } else { $order_column = $GLOBALS['config']->get('config', 'product_sort_column'); $order_direction = $GLOBALS['config']->get('config', 'product_sort_direction'); $order[$order_column] = $order_direction; } foreach ($result as $product) { $list[] = $product['product_id']; } foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list') as $hook) include $hook; $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; return (isset($productList) && is_array($productList)) ? $productList : false; } There are now more lines between where the changes go so where do I put the new changes? I tried this: foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list') as $hook) include $hook; $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } $GLOBALS['session']->set('last_visited_category',$category_id,'client',true); $GLOBALS['session']->set('last_visited_category_product_ids',$list,'client',true); foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; return (isset($productList) && is_array($productList)) ? $productList : false; } This is what my /main.php Breadcrumb code looks like: <div class="row bgwhite"> <div class="small-12 small-collapse thinmarg-top"> {include file='templates/element.breadcrumb.php'} </div> </div> and this is what my elements.breadcrumbs.php file looks like: <div id="element-breadcrumbs"> {if $CRUMBS} <ul class="breadcrumbs" style="margin-bottom: 0.250rem"> <li><a href="{$STORE_URL}"><span class="show-for-small-only"><i class="fa fa-home"></i></span><span class="show-for-medium-up">{$LANG.common.home}</a></span></li> {foreach from=$CRUMBS item=crumb} <li><a href="{$crumb.url}">{$crumb.title}</a></li> {/foreach} </ul> {else} <!-- <div class="thickpad-top"></div> --> {/if} </div> Where do I put the changes from the CC5 mod? <div id="breadcrumb"> <div id="prev_next" style="float:right;"> {if $PRODUCT.previous} <a href="{$PRODUCT.previous}">Prev</a> {/if} {if $PRODUCT.previous && $PRODUCT.next}::{/if} {if $PRODUCT.next} <a href="{$PRODUCT.next}">Next</a>{/if} </div> Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 20, 2016 Share Posted July 20, 2016 In elements.breadcrumb.php: From: <div id="element-breadcrumbs"> {if $CRUMBS} <ul class="breadcrumbs"> To: <div id="element-breadcrumbs"> {if $CRUMBS} <ul class="breadcrumbs"> <div id="prev_next" style="float:right;"> {if $PRODUCT.previous} <a href="{$PRODUCT.previous}">Prev</a> {/if} {if $PRODUCT.previous && $PRODUCT.next}::{/if} {if $PRODUCT.next} <a href="{$PRODUCT.next}">Next</a>{/if} </div> I will look at the other edits. Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 20, 2016 Share Posted July 20, 2016 The other edits are working fine. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 20, 2016 Author Share Posted July 20, 2016 so it doesn't matter if this line in the getCategoryProducts() function gets deleted? foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; CC6 Code foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list') as $hook) include $hook; $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; return (isset($productList) && is_array($productList)) ? $productList : false; } Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 20, 2016 Author Share Posted July 20, 2016 I have checked and rechecked and still this will not work for me. I followed the directions from the download file and made the change to element.breadcrumb you showed above, but it will not even show up. Any suggestions? Claudia Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 21, 2016 Share Posted July 21, 2016 /classes/catalogue.class.php, at the bottom of the getCategoryProducts() function, after the edits made earlier in this file, now near near line 663: Was: $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; return (isset($productList) && is_array($productList)) ? $productList : false; } Now: $productList = $this->getProductData($list, 1, $order, $per_page, $page, true); } $GLOBALS['session']->set('last_visited_category',$category_id,'client',true); $GLOBALS['session']->set('last_visited_category_product_ids',$list,'client',true); foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list_return') as $hook) include $hook; return (isset($productList) && is_array($productList)) ? $productList : false; } In the template file, where this line has been added: <div id="prev_next" style="float:right;"> After that, on the same line, add: Test The complete line now looks like: <div id="prev_next" style="float:right;">Test You should now see the word Test, as it has been hard-coded into the template and will be displayed regardless of any other edits. If Test does not appear, then the template rendering engine is using a previously rendered cached copy of the template - and not making a new rendering from the edited template. If this is the case, then in admin, Maintenance, Rebuild tab, check Clear Cache and Submit. This will force the template engine to use fresh templates. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted July 21, 2016 Author Share Posted July 21, 2016 I made the changes from you last post. Test did show up, but I cleared the cache anyway. Still doesn't show the prev::next This is baffling! my site is www.claudiasbargains.com if you want to look at the page source. Quote Link to comment Share on other sites More sharing options...
zombiesbyte Posted August 29, 2016 Share Posted August 29, 2016 Claudia M Just to confirm: I can see "Previous Item :: Next Item" shown at the top right of each of the product pages. I would try perhaps opening a different browser or using the private/incognito tab (I believe this doesn't use cache). Cheers James 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.