Number of products in menu

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!

Stefek

Very usefull, even adaptable for the news Module and others!

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

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?

A fun challenge :)

create the following droplet, and name it something like "count":

Code (droplet) Select
<?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;


Next modify your show_menu2 call to something like:
<?php show_menu2(1SM2_ROOTSM2_START+1SM2_ALL'[li][a][menu_title] [[count?p=[page_id]]]</a>');?>

Especially the part '[li][a][menu_title] [[count?p=[page_id]]]</a>' 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...
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

D72

Simple question, maybe a difficult feature...
Does anyone know if it's possible to create the number of products behind the menu item?

ATB (19)
Crossroad (13)
Electric bikes (136)
Hybride bikes (85)
Kids bikes (273)
Mother bikes (19)
Track bikes (27)
Specials (23)