Hi,
Zen Cart 1.3.8, clean install. Currently only running locally on my development machine.
I have written a shipping mod that uses as part of its calculation the cubic volume of the products in the shopping cart. I couldn't find anywhere to put the volume property so I've added a new field to the products table and changed all the required admin pages so I can maintain these values.
In my mod I'm looping through all the products in my order to get the total volume of the order i.e.
This works fine (if not the smartest way but I couldn't work out how to get the volume into the order) if I'm logged in, but if I'm only a guest I don't have access to the $order->products array.Code:// Get details from the order // Go through products and work out total volume foreach ($order->products as $key => $product) { $product_id = $product['id']; $sql = "SELECT volume FROM " . DB_PREFIX . "products WHERE $product_id = products_id"; $rec = $db->Execute($sql); $total_volume += $product['qty'] * $rec->fields['volume']; }
Anyone have an idea how to get to it, or another option for getting the sum of all the custom fields of the products in the cart?
Thanks,
Anthony.
Bookmarks