Jump to content

Problem with category.php or is it my product-list template?


Recommended Posts

In my shop, I can iterate through the pages of my products perfectly, the SQL used in Category::getProducts is returned correctly, it returns the right products. But the same 10 products are showing no matter what page I switch to and the pagination marker doesn't change.

I have confirmed that the right products are being returned in the getProducts call.

Any ideas?

Link to comment
Share on other sites

After a little more digging.
It looks like the line:

$smarty->assign(array(
           'products' => (isset($cat_products) AND $cat_products) ? $cat_products : NULL,
           'id_category' => intval($category->id),
           'id_category_parent' => intval($category->id_parent),
           'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name)),
           'path' => Tools::getPath(intval($category->id), $category->name)
       ));


in category.php is not working properly.
The smarty variable $products is not set even though $cat_products has the right data in it.
I have a logging routine built into my Tools class where I can log messages to a table in the database and when I try to log
the count($cat_products) it returns 10 but after the smarty assignment, I try logging:
count($smarty->products) it returns 0.

I've done this and it logs the count (10):

Tools::DebugLog(__FILE__."-(".__LINE__.")", "products:".((isset($cat_products) AND $cat_products)?count($cat_products):'nothing'));



Now it looks like Smarty is the culprit because it is not recompiling either the category nor the product-list template.
I was under the impression that Smarty would recompile the template if different DATA was being fed to it, not just that
the code had changed.

I don't want to leave force_compile on, any other ideas?

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...