Selected number of subcategories wrong in backoffice product associations - PS 1.5.6

Selected number of subcategories wrong in backoffice product associations - PS 1.5.6

Wrong number of selected subcategories displayed next to category name in the backoffice product associations tab. In some cases, the label with the number of selected children is missing at all, althought some of the children are actually selected.

Description:

Wrong number of selected subcategories displayed next to category name in the backoffice product associations tab. In some cases, the label with the number of selected children is missing at all, althought some of the children are actually selected.

 

Affected versions:

Appears in the 1.5.6.2 but not in 1.5.3.1 prestashop versions

 

How to fix:

/classes/helpers/Helper.php :: public function renderCategoryTree

wrong:

if (count($selected_cat) > 0)
{
if (isset($selected_cat[0]))
$html .= ' var selectedCat = '.(int)implode(',', $selected_cat).';'."\n";
else
$html .= ' var selectedCat = '.(int)implode(',', array_keys($selected_cat)).';'."\n";
}

correct:

if (count($selected_cat) > 0)
{
if (isset($selected_cat[0]))
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'";';
else
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'";';
}

webdnes.cz
®2016