WebsiteBaker Support (2.8.x) > Bakery Shop
Number of products in menu
(1/1)
D72:
Simple question, maybe a difficult feature...
Does anyone know if it's possible to create the number of products behind the menu item?
--- Code: ---ATB (19)
Crossroad (13)
Electric bikes (136)
Hybride bikes (85)
Kids bikes (273)
Mother bikes (19)
Track bikes (27)
Specials (23)
--- End code ---
Ruud:
--- Quote from: D72 on July 19, 2012, 10:30:07 PM ---Simple question, maybe a difficult feature...
Does anyone know if it's possible to create the number of products behind the menu item?
--- End quote ---
A fun challenge :)
create the following droplet, and name it something like "count":
--- Code: (droplet) ---<?php
if(!isset($p)) return true;
global $database;
$data = $database->get_one("select count(page_id) from ".TABLE_PREFIX."mod_bakery_items where `page_id` = '$p' group by `page_id`");
if($data) return ' ('.$data.')';
return true;
--- End code ---
Next modify your show_menu2 call to something like:
--- Code: ---<?php show_menu2(1, SM2_ROOT, SM2_START+1, SM2_ALL, '[li][a][menu_title] [[count?p=[page_id]]]</a>');?>
--- End code ---
Especially the part
--- Code: ---'[li][a][menu_title] [[count?p=[page_id]]]</a>'
--- End code ---
is where the droplet is inserted in the menu output.
If the link is a bakery-page, it should now add the itemcount to the menu.
Have fun...
Stefek:
Very usefull, even adaptable for the news Module and others!
Regards,
Stefek
D72:
Ruud, never took the time to reply on this topic.
But your droplet works amazing! Besides me, the customer i really happy with it.
All credits to you. Thank you!
Navigation
[0] Message Index
Go to full version