Philo2005 6 Posted October 17 Version 2.3.4 of OS Commerce shows amount of articles in each category. User saw if there are articles in categories easily. With Phoenix Version 1 0 2 5 the amount is no longer shown, so user must check all categories if there are any articles in. refers to. https://www.attias.ch/ishop/index.php/language/en How can i activate the amount of article shown in each categories? Share this post Link to post Share on other sites
kgtee 30 Posted October 17 (edited) You can make the subcat titles show up by editing one line in the file includes/modules/boxes/bm_catagories.php: Quote $OSCOM_CategoryTree->setMaximumLevel(3); To show the quantities, you can edit the file includes/classes/category_tree.php Find: Quote $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level); Edit the line that comes after: Quote $result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ')</a>'; //added to include product counts Edited October 17 by kgtee 1 Philo2005 reacted to this Share this post Link to post Share on other sites
Philo2005 6 Posted October 17 11 hours ago, kgtee said: You can make the subcat titles show up by editing one line in the file includes/modules/boxes/bm_catagories.php: To show the quantities, you can edit the file includes/classes/category_tree.php Find: Edit the line that comes after: @kgtee Thank you very much kgtee for your answer and your help The first part works fine showing subcategories in the boxes (includes/modules/boxes/bm_catagories.php). Good Tip! What would be nice if the subcategories are indent 2 spaces or so. The second part unfortunally does not work even i corrected a Syntax error (missing ')! it seems Phoenix started looping.$result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ') '</a>'; //added to include product counts Any ideas? Share this post Link to post Share on other sites
♥BrockleyJohn 238 Posted October 17 Would it not be better only to show categories that have products available to buy? For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix). here: on the official osc download page Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Share this post Link to post Share on other sites
Philo2005 6 Posted October 17 3 minutes ago, Philo2005 said: @kgtee Thank you very much kgtee for your answer and your help The first part works fine showing subcategories in the boxes (includes/modules/boxes/bm_catagories.php). Good Tip! What would be nice if the subcategories are indent 2 spaces or so. The second part unfortunally does not work even i corrected a Syntax error (missing ')! it seems Phoenix started looping.$result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ') '</a>'; //added to include product counts Any ideas? @kgtee I solved it, i had Problems editing the file $result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ') </a>'; works fine. Share this post Link to post Share on other sites
ArtcoInc 309 Posted October 17 @Philo2005 19 minutes ago, Philo2005 said: What would be nice if the subcategories are indent 2 spaces or so This can be handled with CSS. M 1 Philo2005 reacted to this Get the latest Responsive osCommerce CE (community edition) here . Share this post Link to post Share on other sites
Philo2005 6 Posted October 17 12 minutes ago, ArtcoInc said: @Philo2005 This can be handled with CSS. M @ArtcoInc Yes, but I dont know how to… Can you explan me how? Share this post Link to post Share on other sites
Philo2005 6 Posted October 17 1 hour ago, BrockleyJohn said: Would it not be better only to show categories that have products available to buy? @BrockleyJohn Yes of course, do you have any idea? Share this post Link to post Share on other sites
kgtee 30 Posted October 17 4 hours ago, Philo2005 said: @kgtee I solved it, i had Problems editing the file $result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ') </a>'; works fine. To get the indent, you can add blank spaces or any character you like to the variable $spacer_string. This variable is declared in the beginning of the file category_tree.php. Example : Quote $spacer_string = '<i class="fas fa-caret-right"></i> ', This will add a caret sign in front of every subcat title. Share this post Link to post Share on other sites
kgtee 30 Posted October 17 To hide categories which have no product to sell, you can add a if logic prior to display the categories. Quote if (tep_count_products_in_category($category_id, false) > 0) { // added to show only categories with products to sell if ( ($this->follow_cpath === true) && in_array($category_id, $this->cpath_array) ) { $link_title = $this->cpath_start_string . $category['name'] . $this->cpath_end_string; } else { $link_title = $category['name']; } $result .= '<a class="list-group-item " href="' . tep_href_link('index.php', 'cPath=' . $category_link) . '">'; $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level); $result .= $link_title . ' (' . tep_count_products_in_category($category_id, false) . ')</a>'; //added to include product counts } // end show Share this post Link to post Share on other sites
Philo2005 6 Posted October 18 8 hours ago, Philo2005 said: @BrockleyJohn Yes of course, do you have any idea? @BrockleyJohn user.css .list-group.list-group-flush { padding-left: 0.75em; } solved the Problem to indent the subcategories 1 peterpil19 reacted to this Share this post Link to post Share on other sites
Philo2005 6 Posted October 18 6 hours ago, kgtee said: To hide categories which have no product to sell, you can add a if logic prior to display the categories. @kgtee Thank you very much for your code, works fine. 1 kgtee reacted to this Share this post Link to post Share on other sites
Philo2005 6 Posted October 18 1 hour ago, Philo2005 said: @kgtee Thank you very much for your code, works fine. @kgtee, the Problem i have is that when supressing the categories with 0 articles, the content module (index) shows all categories, i might have to supress them as well, to be full of Integrity. How? Share this post Link to post Share on other sites
kgtee 30 Posted October 18 Try this. In category_tree.php: Quote function buildBranchArray($parent_id, $level = 0, $result = '') { if (empty($result)) { $result = array(); } if (isset($this->_data[$parent_id])) { foreach ($this->_data[$parent_id] as $category_id => $category) { if ($this->breadcrumb_usage == true) { $category_link = $this->buildBreadcrumb($category_id); } else { $category_link = $category_id; } if (tep_count_products_in_category($category_id, false) > 0) { // added to show only categories with products $result[] = array('id' => $category_link, 'image' => $category['image'], 'title' => str_repeat($this->spacer_string, $this->spacer_multiplier * $level) . $category['name']); } // end show if (isset($this->_data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) { if ($this->follow_cpath === true) { if (in_array($category_id, $this->cpath_array)) { $result = $this->buildBranchArray($category_id, $level+1, $result); } } else { $result = $this->buildBranchArray($category_id, $level+1, $result); } } } } Share this post Link to post Share on other sites
Philo2005 6 Posted October 18 10 hours ago, kgtee said: Try this. In category_tree.php: @kgtee Thank you very much, works fine! I assume you had this done before I asked for it? 1 kgtee reacted to this Share this post Link to post Share on other sites
Fredi 31 Posted October 21 A small addition: to make it look pretty, you can change the icon, its color and size. $spacer_string = '<span style="font-size: 1.15em; color: Green;"><i class="fas fa-arrow-alt-circle-right"> </i></span>', 1 ArtcoInc reacted to this Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.Best regards, Fredi Share this post Link to post Share on other sites
burt 3,851 Posted October 21 Bear in mind that this particular count does hammer the database - which will impact on load time. I don't know by how much and would say it would vary slightly server to server, so it may be worth doing a benchmark, before and after... This is a signature that appears on all my posts. IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS Get the latest Responsive osCommerce CE (community edition) here Share this post Link to post Share on other sites
Fredi 31 Posted October 21 (edited) I agree with Burt. Recounting the quantity of goods is impractical. But showing subcategories in the menu is very desirable. They do not need to be hidden. Edited October 21 by Fredi Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.Best regards, Fredi Share this post Link to post Share on other sites
♥JcMagpie 1,430 Posted October 21 I'm sure this has been stock install on official osC for a long time. Testing my site with and without I have not been able to register any diferance. 1 Fredi reacted to this Share this post Link to post Share on other sites
♥peterpil19 116 Posted October 22 8 hours ago, Fredi said: I agree with Burt. Recounting the quantity of goods is impractical. But showing subcategories in the menu is very desirable. They do not need to be hidden. I really like your changes to the menu above. I think it is up to the shopowners if they wish to display numbers or not as for some it would make sense and for others it would serve no practical purpose. I agree it would be much easier for shopowners if that option was available in admin and it would not be too difficult to achieve this. Potentially a candidate for a module for the apps marketplace - or for someone to raise an issue / propose a pull request in GitHub for core? As long as we capture in documentation (whether in this forum, or in the documentation initiatives being worked on) how to apply these changes. Peter 1 Fredi reacted to this PROUDLY PASSIONATE PHOENIX SUPPORTER Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design. Download the latest version of CE Phoenix from gitHub here: Join the Phoenix Club. Become a Phoenix Supporter. Gain access to special codes and modules and help the project thrive. Read here Share this post Link to post Share on other sites
Fredi 31 Posted October 22 I think this small change can be made to the kernel module: includes/modules/boxes/bm_categories.php Add 2 lines to the module configuration after line 63. setMaximumLevel = And a line that sets the format for how the indentation for subcategories will be displayed. This will affect the file: category_tree.php But I think Burt can do it in 5 minutes! This will give great flexibility to boxing categories. Phoenix should be as convenient as possible for the owner of the store and for the user. Unfortunately, this can increase the load time by 0.0001 second, but this is not a problem. Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.Best regards, Fredi Share this post Link to post Share on other sites