Bug on VM 4.2.3 displaying uncategorized childs even if disallowed: fix

Started by Alexb65, September 06, 2023, 16:31:15 PM

Previous topic - Next topic

Alexb65

Hi @Milbo

Something is wrong around line 611 of model/product.php

Uncategorized childrens are displayed even if the corresponding option is uncheckd in configuration.

The condition is not checked if line 576 works so it skips the eleif( $isSite)

I fixed it with a dirty hack adding this code at line 605


604
    605                         if ($isSite) {
    606                                 $DoNotShowUncategorisedParents = !VmConfig::get('show_uncat_parent_products',FALSE);
    607                                 $DoNotShowUncategorisedChildren =  !VmConfig::get('show_uncat_child_products',TRUE);
    608
    609                         if ($DoNotShowUncategorisedChildren) {
    610                                         $joinCategory = TRUE;
    611                                         
    612                                         $where[] = ' ((p.`product_parent_id` = "0" AND `pc`.`virtuemart_category_id` > "0") ) ';
    613                                 }
    614
    615                         }
    616
    617                 }  elseif ($isSite) {

Could you put an eye on this?

With my dirty code it works and honors the configuration set in "do not show uncategorized childrens" both for hiding and showing

Best regards