Page 1 of 1

CGContentUtils and Products

Posted: Sat Nov 23, 2019 4:40 pm
by iturbay
Hello! Please help if it is possible to show the list of the hierarchy of the Products module using the CGContentUtils module.
I tried using

Code: Select all

{cms_module|strip_tags module='Products' action='hierarchy' 'hierarchytemplate ='options'}
, but this does not work.

then I created a UDT tag

Code: Select all

$db = cmsms()->GetDb();
$query = "SELECT * FROM  cms_module_products_hierarchy";
$result = $db->Execute($query);
while( $result && $row = $result->FetchRow() ) {
    echo ($row['id']).'|'.($row['name']).'<br>';
}
in the module Calguys Content Utilities created a drop-down list with parameters

Code: Select all

{myudt|strip_tags}
but when editing the page I get only the first record, although udt shows me all the positions of the hierarchy.

Re: CGContentUtils and Products

Posted: Sun Nov 24, 2019 11:39 am
by velden
I ASSUME that CGContentUtilities expects an array. Read the help of the module to be sure.

So your UDT should then build and return an array and not echo some lines of text.

Re: CGContentUtils and Products

Posted: Sun Nov 24, 2019 2:43 pm
by iturbay
Perhaps the code is not correct, I fixed the UDT and it worked!

Code: Select all

$db = cmsms()->GetDb();
$query = "SELECT name FROM  cms_module_products_hierarchy";
$result = $db->Execute($query);
while( $result && $row = $result->FetchRow() ) {
    echo ($row['name']).'|'.($row['name']);
    echo "\n";
    
}