Hi can any body help me with the following code on shopping cart?
I want shipping price increase/multiply with the product quantity.
I set a shipping price to a product. When the product quantity increases the shipping price should also be increased. (shipping price x product quantity) and this should be added to the Grand Total.
here is the code;
$cart_sub_total = 0;
$cart_total = 0;
$cart_shipping = 0;
foreach($cart_products as $product_id => $product){
$quantity = max(1,(int)$product[‘quantity’]);
$product_total = $product[‘price’] * $quantity;
$cart_sub_total += $product_total;
if(isset($product[‘product_settings’][‘shipping’]) && $product[‘product_settings’][‘shipping’]>0){
$cart_shipping += $product[‘product_settings’][‘shipping’];
}
}
$cart_total = $cart_sub_total + $cart_shipping;
$member = isset($_SESSION[’_cart_member_data’]) ? $_SESSION[’_cart_member_data’] : array();
Thanks in advance.
nrkar