1.11M Members

how to sum the price of multiple produts with its different shipping charge

 
0
 

hi all.. pls help me..

i want to sum the price of multiple products with its quantity and shipping charges.
in my products table all the products have different shipping charges.

    for ex: product1 shipping charges.       product2 shipping charges.
              shipping to US = $10.99         shipping to US = $14.99 
            shipping outside US = $20.99      shipping outside US = $34.99

if there is two product1 in the cart and shipping value is US, then it should be
like this total price= (quantity * shipping to US) + (quantity * product price).
how could i do this???

tnx in advnc....

 
0
 

Show the structure of your table(s) and some data.

 
0
 

tnx 4 ur reply pritaeas..
and u mean screenshot of the table????

 
0
 

Screenshot, or sqldump, whichever is easier. If it's clear what you have, it's easier to find a solution.

 
0
 

You seem to have given the calculation yourself. What exactly are you struggling with?

 
0
 

hi pritaeas..& diafol
this is my table product structure..
db

here is some code that i have been done in calculation part and this is working only after getting sum of total price for all the products with the given shipping costs. But actually what i needed is to fetch the shipping costs from the database for the corresponding prod_id's then calculate the total for each product and get total of all.

        $order_total=$_POST['total_payment'];
        $shipping_outside= 34.99;
        $shipping_us=14.95;
        echo $s_country;
        if(trim($s_country)=='US' || trim($s_country=='United States' )){
            $shipping_cost1=$shipping_us;
        }else{
            $shipping_cost1=$shipping_outside;

        }




  $sales_tax=$order_total*10/100;

        if($s_country=='US'  && $s_state=='IL' || $s_country=='United States'&& $s_state=='IL'|| $state=='IL'){
            $totalprice=$order_total+$shipping_cost1+$sales_tax;    

        }
        elseif($s_country=='US' && $s_state !='IL' || $s_country=='United States'&&  $s_state !='IL' || $state !='IL'){
        $totalprice=$order_total+$shipping_cost1;
            }

        else{
        $totalprice=$order_total+$shipping_cost1;
            }   
        $totalprice=number_format($totalprice, 2, '.', '');

pls help.......

Attachments
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article