creters Posted December 26, 2016 Share Posted December 26, 2016 Was wondering if there was a way to include product counts for each category which would show in the header. Thought maybe it would be in Admin Panel somewhere but could not locate unless I am looking in the wrong place. Also checked the forum. Found some solutions but seem to be for older versions of CubeCart since files and lines referenced do not match current version (6.1.1). Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 26, 2016 Share Posted December 26, 2016 I searched for those conversations but couldn't find them. Please remind us where they are and we can try to get it coded for CC611. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted December 26, 2016 Share Posted December 26, 2016 I looked on the 3rd party forum, too, and didn't see anything that looked pertinent. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 26, 2016 Share Posted December 26, 2016 Let's try this. Two small edits. There isn't a hook nearby we can use, so an edit to the core code is what we will do. In /classes/catalogue.class.php, near line 749, find: $result = array( 'name' => (isset($this->_category_translations[$category['cat_id']]) && !empty($this->_category_translations[$category['cat_id']])) ? $this->_category_translations[$category['cat_id']] : $category['cat_name'], 'cat_id' => $category['cat_id'], 'cat_level' => $level ); Change to: $result = array( 'name' => (isset($this->_category_translations[$category['cat_id']]) && !empty($this->_category_translations[$category['cat_id']])) ? $this->_category_translations[$category['cat_id']] : $category['cat_name'], 'cat_id' => $category['cat_id'], 'cat_level' => $level, 'count' => $products, ); In the skin template, element.navigation_tree.php, find: <a href="{$BRANCH.url}" title="{$BRANCH.name}">{$BRANCH.name}</a> Change to: <a href="{$BRANCH.url}" title="{$BRANCH.name}">{$BRANCH.name} ({$BRANCH.count})</a> The problem remains that the entire finished/rendered Navigation Tree template is cached. So, if the number of products change, this will not be reflected in the navigation. We must prevent this from being cached. In /clases/gui.class.php, near line 1034, find: $GLOBALS['cache']->write($content, $cache_id, '', $serialize); Change to: // $GLOBALS['cache']->write($content, $cache_id, '', $serialize); Be aware there is a reason for caching this - it could take a (relatively) long time to build it for every page load. Quote Link to comment Share on other sites More sharing options...
creters Posted December 26, 2016 Author Share Posted December 26, 2016 Will try fixes mentioned above. For the record, post I found in regard to category count is as follows A few versions ago and no correlating files from what I can tell so was a little difficult to see where modifications could be made in the newer version.s Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 26, 2016 Share Posted December 26, 2016 That was for either CC3 or CC4. Totally incompatible for CC5 and CC6. Quote Link to comment Share on other sites More sharing options...
creters Posted December 27, 2016 Author Share Posted December 27, 2016 The edits seem to have done the job. Now see count for categories. As far as the caching/speed concern, the store (eventually) shouldn't change constantly and would rather have speed if I had a preference. I would assume entering/exiting site would clear the cache anyway. As always, thanks for the direction and help! Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 27, 2016 Share Posted December 27, 2016 "I would assume entering/exiting site would clear the cache anyway." Actually, no. The only automatic clearing is any cached SQL query, then only if exiting the admin - where, presumably, you have made changes that would show in query responses. And also when quantities change when products are sold. But the Navigation Tree is not a database query response, so it is not cleared between storefront pageloads, but is when the admin makes changes to the category hierarchy in admin. Quote Link to comment Share on other sites More sharing options...
creters Posted December 27, 2016 Author Share Posted December 27, 2016 Not sure if this is an issue related to changing the cache setting in gui.class.php as suggested above or something unrelated: Did the change and didn't navigate around the site too much. Came back, went into the Admin Panel and noticed the font size for the dashboard was larger (about twice the size); so much so the page went off the screen slightly. While in the Panel also noticed same thing happending with product page, customer list, statistics. Not sure if it is happening elsewhere. On the store side of things, seems the "home" icon in the category box is now in upper left hand corner of box and the Featured, Latest, Sale columns at the bottom "bleed" into the footer. Only thing I have done in the last few days other than this fix and one to show Featured, Latest, Sale on the bottom is to increase the size the "more" button on the product pages when there is more than 15 items in a category. I reversed my "more" change thinking that had something to do with it, but things mentioned above persist. Also thought maybe it was browser problem. Switched browsers with same results. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 27, 2016 Share Posted December 27, 2016 We can best help with this kind of situation if we can visit your site. Please remind us of your web address. One thing I recently did was to change the <!DOCTYPE> declaration on the main.php skin template to a version prior to the HTML5 syntax. This tells the browser to show things and to behave in ways according to HTML4 protocols and earlier. Have you made any changes to the main.php template? Quote Link to comment Share on other sites More sharing options...
creters Posted December 27, 2016 Author Share Posted December 27, 2016 (edited) Site is http://open4biz.biz/gtg Haven't touched main. Did change "tiny" type in config.xml thinking it would help the "more button but when it didn't changed it back to 30. Changed content.category.php to "enlarge" from "tiny" when it came to displaying the "more" button but changed that back as well (although it seemed to do what I wanted it to). Other than that, only changes made were as instructed in previous fixes (category count and allowing Featured, Latest and Sale (FLS) to show at bottom of page when browser would not allow for it on the side). Page does not seem to "bleed" into footer when FLS displays on the side. Not sure why Admin Panel fonts increased as well; haven't touched files specific to admin at all. Edited December 27, 2016 by creters typo Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 27, 2016 Share Posted December 27, 2016 Everything looks good to me. Please check if your various browsers have had their Zoom settings changed, or that something might have changed the default font/size used by the browser if not specified by the HTML/CSS (which Foundation does not set an initial font size). 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.