News:

Looking for documentation? Take a look on our wiki

Main Menu

total weight calculation & shipping costs

Started by sebcam, February 12, 2010, 18:04:13 PM

Previous topic - Next topic

sebcam

Hi all !
Im running virtuemart 1.1.4 ans Im going crazy with total weight and shipping costs.
In the basket I can display for each product, its own individual weight.
But when I call the total weight, it's blank !
Ive been keeping on searching in the topics, added some codes (ex in basket.php, I added in the loop, total weight calc) but nothing does the job. total weight remains blank.

And the shipping module keeps on dispaying as if total weight was null (or don't even work).
so it seems that there is a real problem of total weight caclulation, and not of display only... Shipping costs cannot be calculated if total weight is blank !

help!

sebcam

here some further information. I inserted this, for trial, within the for loop of cart, in basket.php :

$weight = ps_shipping_method::get_weight($cart[$i]["product_id"]);
$product_rows[$i]['weight'] = ($weight) * $cart[$i]['quantity'] * 1000;
$weight_subtotal = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]['quantity'] * 1000;
$weight_total += $weight_subtotal;

... and it's even worse, no shipping method is even proposed.

If I remove this code, and leave basket.php as is, shipping costs remain as if total order weight is still zero.

sebcam

grrrrrrrr  another trial. Hope that it will help. I fixed $weight_total = 5 in the basket.php, and it works, the weight of the order is 5. So that means the weight calculation code is wrong, somewhere. Any clue ? THANKS !

sebcam

SOLVED.

Thanks to all of you. As there was no reply in this forum, I went on thinking that the problem should be simple, that I should have found the solution by myself.

I thought of all of you looking at this post, thinking: this guy is a stupid newbee, he'd better think before post.

Yes and no. just have to have a closer look to the code, and question about the "*1000".

In fact it was poisonous and had nothing to do here when all units are all the same in the database. It generated too high numbers to refer to any shipment method.
wooooooowww you dont know how happy i am. thanks to all of you ! :)


ncc1701q

Hi there sebcam,

I am also troubled with this problem - is there a chance you could share your solution? I'd be eternally grateful!

Kind regards,

Hugo

blackhatbrigade

If you're having serious issues with the cart totals (and are sure it's not something easy, like not having the weight in the product's information), you could try pulling the weight directly from the product table and just getting quantity information from the cart.

That would be a work around and not a true fix though.  I would double check all of the information on the product in question first.

adrian

hi im having what i think is the same problem ,i dont know how to calculate shipping according to product weight plus  zone any ideas

kevingill

I believe that VM only uses kilos to calculate shipping costs.

I've just put a customers products into VM as grams and then thought I could put down shipping costs in grams too. But VM seemed to add up all the shipping costs rather than choosing just one. ie. i had shipping costs of £3, £4 and £5, so VM decided that it would charge £12 for postage.....
So, I've converted the weights of all my products into kilos (from grams) and then re-entered the shipping costs as kilos.
After doing this, the VM checkout works perfectly.

Hope this helps.