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....

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

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

Member Avatar for diafol

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

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.......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.