News:

Looking for documentation? Take a look on our wiki

Main Menu

[FIXED] Bug in product.produrt_product_type.php

Started by doorknob, April 27, 2009, 01:23:16 AM

Previous topic - Next topic

doorknob

If an attempt is made to add a product type to a product by clicking the toolbar button on the product edit form, an error is generated with the message:
"Warning: Invalid argument supplied for foreach() in [site root]/administrator/components/com_virtuemart/html/product.product_product_type_form.php on line 85"

This is because the program expects to process an array but when called from the product edit form, the value is passed as an integer.

I fixed the problem by replacing lines 85 to 87
foreach($product_id as $prod_id) {
$formObj->hiddenField( 'product_id[]', $prod_id );
}

with
if( is_array($product_id) ) {
foreach($product_id as $prod_id) {
$formObj->hiddenField( 'product_id[]', $prod_id );
}
} else {
$formObj->hiddenField( 'product_id[]', $product_id );
}


J1.5.10, vm 1.1.3 (build 1723)

Phil