weight calculator/show weight of products in cart

  • Posts: 115
  • Thank you received: 0
11 years 10 months ago #83551

thanks for the reply , sorry its working now ,was a while since i changed it and realised you need to add the code in between <?php and ?>

Please Log in or Create an account to join the conversation.

  • Posts: 115
  • Thank you received: 0
11 years 10 months ago #83557

actually is it possible to add additional weight onto the total weight shown in cart by the code above. For example the weight shown by the code above is a total weight of all the products, however I need to add the weight of the packaging onto the final weight figure used to calculate the shipping

how can i do this?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 10 months ago #83559

Hi again,

If the weight of your packaging is 6 for example, the code that you'll need to add will be :

$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart(true);
$final_weight = $cart->weight + 6;
echo $final_weight;

Please Log in or Create an account to join the conversation.

  • Posts: 115
  • Thank you received: 0
11 years 10 months ago #84082

thanks for that , where do i need to place this code?

Many Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #84360

Hi,

I think that you will have to add the code in the plugin file of your payment methods (plugins\hikashopshipping\methodname.php), in the function "onShippingDisplay()"
Some PHP knowledge are required.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
11 years 8 months ago #93182

I have this working, but my weight shows up in Kilograms instead of pounds. For instance one of my products weighs 4 pounds, but shows up as 1.81436948 KG. Is there a way to change this?

Thank You

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93290

What is working ?
Several different things have been posted on that thread so I don't know about which one you're talking.
If you're using pounds and that you see a weight in KG, it's probably because your main weight unit in the configuration is KG and not the pound. Change that and that should display you the weights in pound (the first one of the units in the list is the main one).

The following user(s) said Thank You: MikeC

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
11 years 8 months ago #93314

Sorry....

I entered this text to display the weights in checkout:

echo $row->product_weight;

You say the "main weight unit in the configuration". I have looked all over for the setting for this. Can you point me in the right direction?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93477

It's at the bottom of the main tab of the configuration

Attachments:
The following user(s) said Thank You: MikeC

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum