Only last child category products are shown in the top category view front end

Started by Cococoder, December 04, 2020, 11:38:36 AM

Previous topic - Next topic

Cococoder

PHP 7.3.2
Virtuemart 3.8.6
Joomla 3.9.3

Issue: Only the product of the last child category are shown when browsing any top level category in the front end.
Ex: Top category "Chairs". Subcategories: "Wooden chairs", "metal chairs", "Plastic chairs". Only the product in the sub categories "plastic chairs" are displayed when viewing the "chairs" category. Product in the "chairs" category are also displayed but not the product in the two other subcateogries. 
Expected behavior: All products from all child category for a given category should be shown when "Show products of subcategories" is enabled.
tested with default template vmbeez3, all plugins disabled -> issue persists
Same issue on two sites (production and test site).



Phoenix616

I am experiencing the same issue on the same Virtuemart and Joomla versions.


I looked into the code and found the cause for this. The error is due to this change which resulted in the child categories no longer being appended on line 470 but $cats being set to only the last child category. Using $cats .= $childcat->virtuemart_category_id .','; (with a .= to append) similarly to the previous version instead solves the issue.
Website: phoenix616.dev - GitHub: Phoenix616 - Twitter: @the_moep

jenkinhill

That correction is already included in com_virtuemart.3.8.7.10374 and subsequent test versions.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Cococoder