Page 1 of 1

MyFavorites collision with Products - TIP

Posted: Wed May 30, 2012 2:27 pm
by otsakir
In case anyone tries to use My Favorites module to mark Products, the following issue may come up:
If

Code: Select all

{MyFavorites srcmodule="Products" srcrecord=$entry->id}
is used inside a product details template a 'smarty namespace' variable collision seems to occur. The variable '$category' is produced by both the Products and MyFavorites modules preventing correct rendering of the page.

A quick workaround would be to to "unset" the Products' $category after it is used in the detail template and before invoking {My Favorites ...} tag so that its own version of $category can be freely set.

Here is an example 'clear_assign' UDT to be used for that purpose:

Code: Select all

$smarty = cmsms()->GetSmarty();
$smarty->clear_assign($params['var']);
Before invoking MyFavorites include this UDT like this:
{clear_assign var='category'}