Quote:
Originally Posted by cflsystems
That's way I had the code added inside the foreach loop so it will execute only if the foreach executes - so only if the added product has this extra field value
|
Man, it's so close but still adds this charge for all items including item that does not have this extra field.
This is the code again (keeping $subtotal inside foreach loop:
PHP Code:
$int_hdl = func_query_first("SELECT * FROM $sql_tbl[extra_field_values] WHERE fieldid=1 AND productid=$product[productid]");
if (!empty($int_hdl["value"])) {
foreach ($int_hdl as $handling_special) {
$handling_special = $int_hdl['value'];
$subtotal += $handling_special;
}
}
This is placed just before the closing bracket of the code: foreach($products as $k=>$product) { - as instructed by the author of this post even tho he states it is in "In Function: func_calculate_shippings" but in xcart 4.4.2 code is a lot different, so maybe this code needs to go in different place??
Or some of the code in other places (as he instructs to put) needs also foreach loop???
I really appreciate all you help Steve.