VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: doorknob on April 27, 2009, 01:23:16 AM

Title: [FIXED] Bug in product.produrt_product_type.php
Post by: doorknob on April 27, 2009, 01:23:16 AM
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