PHP warning - undefined array in a foreach loop VirtueMart 3.6.10 10211

Started by welrachid, December 11, 2019, 12:53:29 PM

Previous topic - Next topic

welrachid

PHP 7.2.13
J! 3.9.10
VirtueMart 3.6.10 10211


Hi guys
I'm getting warning on the last line here:
/components/com_virtuemart/views/category/view.html.php on line 287
if($legacy) {
if($this->showproducts){
$opt = array('products');
}
} else {
$opt = array('featured', 'discontinued', 'latest', 'topten', 'recent');
if($this->showproducts and empty($this->keyword)){
$opt[] = 'products';
}
}
foreach( $opt as $o ) {

Its the last line in this codesnippet.
Its happening because $opt is not defined if we are using legacy and the is no showproducts.

Best regards
wel
Best regards,
Wel