I created a module using CTLModuleMaker 2.0.4.
Structure of categories:
-brand
--model (with a dropdown field "brand")
-unit
--parts (with a dropdown field "unit")
---part (with a dropdown field "parts" and the field Select "model")
List of units and parts - the same for all models.
Module call:
{cms_module module = "my_module" what = "brand" orderby = "name"}
list template is default_list.
brand_detail template:
{$item=$itemlist[0]}{$item}</br>
{cms_module module="my_module" what="model" where_brand=$item->id->value}
and so on...
how to get the total number of leaf-level products (part) in the category of any level?
For example:
> brand1 (7)
> brand2 (2)
> brand3 (0)
then:
brand1
>model1 (2)
>model2 (1)
>model3 (4) and so on...
And another thing: how to make breadcrumbs in this module?
Can anybody help? =\
[SOLVED] CTLModuleMaker: total number of products in the cat
[SOLVED] CTLModuleMaker: total number of products in the cat
Last edited by Doodeen on Thu Apr 03, 2014 6:21 am, edited 1 time in total.
Re: CTLModuleMaker: total number of products in the category
I solved the problem by UDT like this:
for brands
global $gCms;
$db =& $gCms->Getdb();
$query = "SELECT * FROM (cms_module_myModule_brand INNER JOIN cms_module_myModule_model ON cms_module_myModule_brand.id = cms_module_myModule_model.parent) INNER JOIN cms_module_myModule_part ON cms_module_myModule_model.id = cms_module_myModule_part.model WHERE (cms_module_myModule_brand.id)= ? AND cms_module_myModule_part.active = '1' ";
$dbresult = $db->Execute($query, array('cms_module_myModule_brand.id'=>$params['id']));
if(!$dbresult) {
echo "DB Error: " . $db->ErrorMsg();
} else
echo $dbresult->RecordCount();
for brands
global $gCms;
$db =& $gCms->Getdb();
$query = "SELECT * FROM (cms_module_myModule_brand INNER JOIN cms_module_myModule_model ON cms_module_myModule_brand.id = cms_module_myModule_model.parent) INNER JOIN cms_module_myModule_part ON cms_module_myModule_model.id = cms_module_myModule_part.model WHERE (cms_module_myModule_brand.id)= ? AND cms_module_myModule_part.active = '1' ";
$dbresult = $db->Execute($query, array('cms_module_myModule_brand.id'=>$params['id']));
if(!$dbresult) {
echo "DB Error: " . $db->ErrorMsg();
} else
echo $dbresult->RecordCount();
-
chandra
Re: [SOLVED] CTLModuleMaker: total number of products in the
Use
$gCms = cmsms() ;
instead
global $gCms ;

$gCms = cmsms() ;
instead
global $gCms ;
Re: [SOLVED] CTLModuleMaker: total number of products in the
Even better:chandra wrote:Use
$gCms = cmsms() ;
instead
global $gCms ;
Code: Select all
$db = cmsms()->GetDb();- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: [SOLVED] CTLModuleMaker: total number of products in the
Thanks, I'll use.


