CGContentUtils and Products

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
User avatar
iturbay
Forum Members
Forum Members
Posts: 85
Joined: Mon Sep 29, 2014 5:38 am

CGContentUtils and Products

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CGContentUtils and Products

Post 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.
User avatar
iturbay
Forum Members
Forum Members
Posts: 85
Joined: Mon Sep 29, 2014 5:38 am

Re: CGContentUtils and Products

Post 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";
    
}
Locked

Return to “Modules/Add-Ons”