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

Recommended Answers

All 5 Replies

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

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

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

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.

        $shipping_outside= 34.99;
        echo $s_country;
        if(trim($s_country)=='US' || trim($s_country=='United States' )){



        if($s_country=='US'  && $s_state=='IL' || $s_country=='United States'&& $s_state=='IL'|| $state=='IL'){

        elseif($s_country=='US' && $s_state !='IL' || $s_country=='United States'&&  $s_state !='IL' || $state !='IL'){

        $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, learning, and sharing knowledge.