CMSMadeSimple upgrade to Smarty Templating – unexpected attribute-Collection of common programming errors

I’m new to CMSMS and taking an older installation through a painful upgrade path to get it to the current version. One of the major changes involves using Smarty 3 for it’s templating engine. This change has broken a couple of the existing templates.

The related CMSMS module is called “Product and Inventory Manager” which looks like it’s part of “Calguys Module Extensions”

Here’s the error message I’m getting:

Syntax Error in template "module_db_tpl:ProductsWithLocation;summary_default"  on line 26 "

GetHierarchyInfo($products_parent)} {assign var='products_path_ids' value='.'|explode:$products_hier_info.hierarchy} {assign var='products_path_names' value=' | '|explode:$products_hier_info.long_name} {if !empty($products_parent) }

 Browsing 
{foreach from=$products_path_ids  key='key' item='tmp' }
 {if !$smarty.foreach.default.last}
{module_action_link module='ProductsWithLocation' action='hierarchy' text=$products_path_names.$key page=$page_alias parent=$tmp|ltrim:'0' pagelimit=$products_pagelimit}

{else}

 

{$entry->product_name}More information about {$entry->product_name} {* accessing all of the fields in a list *} {if isset($entry->fields)} {foreach from=$entry->fields key='name' item='field'} {if isset($field->value)} {if $field->type == 'checkbox' or $field->type == 'image' && isset($field->thumbnail)} {else} {/if} {if $field->type == 'image' && isset($field->thumbnail)} More information about {$entry->product_name}{$field-value} {/if} {/if} {/foreach} {/if} {assign var='hinfo' value=$ProductsWithLocation->GetHierarchyInfo($entry->hierarchy_id)} Stone Type: Cambria Quartz Collection: {module_action_link module=ProductsWithLocation action=default hierarchyid=$entry->hierarchy_id text=$hinfo.name} {else}

  • {$entry->product_name}More information about {$entry->product_name} {* accessing all of the fields in a list *} {if isset($entry->fields)} {foreach from=$entry->fields key='name' item='field'} {if isset($field->value) && $field->name != 'GalleryFolder'} {if $field->type == 'checkbox' or $field->type == 'image' && isset($field->thumbnail)} {else} {$name} {if is_array($field->value)} {if !empty($field->value) } {foreach from=$field->value item='val'} {if $field->type == 'image' && isset($field->thumbnail)} {else} {module_action_link module=$mod->GetName() action=default fieldid=$field->id fieldval=$val text=$val} {/if} {/foreach} {/if} {else} {if $field->type == 'image' && isset($field->thumbnail)} {else} {module_action_link module=$mod->GetName() action=default fieldid=$field->id fieldval=$field->value text=$field->value} {/if} {/if} {/if} {if $field->type == 'image' && isset($field->thumbnail)} More information about {$entry->product_name}{$field-value} {/if} {/if} {/foreach} {/if} {assign var='hinfo' value=$ProductsWithLocation->GetHierarchyInfo($entry->hierarchy_id)} Stone Type: {module_action_link module=ProductsWithLocation action=default hierarchyid=$entry->hierarchy_id text=$hinfo.name}
  •  
    
    {/if}
    
    
    {/foreach}
    {/if}
    

    Here's the relevant snip of that template where the error occurs:

    {$products_path_names.$key parent=$tmp|ltrim:'-1'}
    

    From what I understand we’re calling a custom function with a name based on products we have in our database. We’re sending it an attribute “parent” which it’s not expecting. If I remove that attribute the error goes away but the output gets weird.

    Short of a magic bullet I think any clues where to look for this function being defined would help me. I’m also baffled by the use of what appears to be ltrim(“-1”) so any explanation of that would also be nice. Maybe I can replace this line with a longer if block to correct the function call?

    Edit – Here’s some sample values for the variables:

    $products_path_names.$key holds string ‘Granite’

    $tmp holds string 00017

    Thanks!