News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Product weight multiplied by shipping fee - SOLVED

Started by liquid.ideas, August 15, 2013, 00:42:45 AM

Previous topic - Next topic

liquid.ideas

Hi Guys,

I know there must be a way to do it, I would like to have a little shipping calculator on the fly, so I thought I could call weight <?php echo $product_weight ?> multiplied my shipping fee, but I dont know how to call this, any ideas?

Thanks in advance for anything anyone might come up with!

Maxim Pishnyak

Quote from: LuukDriessen on January 25, 2013, 12:38:32 PM
I did some research.

I found/knew that <?php echo $product->product_weight ?> is used to show the weight of the product.
And did you do some research. Did you check these sticked threads about template overrides in this forum section?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

liquid.ideas

Yup that is where I found how to call the weight from Banquets awesome posts that I always go back to :)

What I want to do on the product page is somehow display weight x shipping dont need it ajax I dont think, basically there are two shipping rates so it would be
weight x shipping
and
weight x shipping + 2% insurance fee

Any ideas?

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

liquid.ideas

Hi Maxim,

thanks foe being so patient with me :) yes I can show the weight I just cant show what the shipping would cost!

Maxim Pishnyak

Quote from: liquid.ideas on August 16, 2013, 13:17:32 PM
... what the shipping would cost!
Thank you!

And how much is the shipping would be?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

liquid.ideas

Hi Maxim,

It would be R70 for the first ten kilograms, and R10 per kilogram thereafter :)

Maxim Pishnyak

Oh come on, it's fair easy to challenge php IF command for this. Try to construct and test something and I'll help you during your probes.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

liquid.ideas

Hi Maxim,

I can do something like this and works:


$result = $this->product->product_weight;
$rshipping = 70 ;
$count =+ 3.5 ;

if ($result <=2) {echo "Shipping Estimate Regional:<br />" .$rshipping;}
elseif ($result++) {echo "Shipping Estimate Regional: <br />" .$rshipping + $count;}


But that only returns "3.5" if the weight is three, I am not sure how to say for example "if result is +1 then add 3.5 to rshipping, I know it is something that is probably blindingly obvious but cant work it out

Maxim Pishnyak

#9
Quote from: liquid.ideas on August 17, 2013, 08:59:35 AM
ten kilograms
if ($result <=10) {echo "Shipping Estimate Regional:<br />" .$rshipping;}
else {echo "Shipping Estimate Regional: <br />" . ($rshipping + 10*($result-10)) ; }
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

liquid.ideas

Thank you Thank you THANK YOU Maxim!!

Yes, this works like a bomb, for anyone else you may get a syntax error just add in a ; before closing bracket

Maxim Pishnyak

Thank you for pointing this, Liquid. And ... you are welcome!
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart