Skip to main content

weight calculator/show weight of products in cart

More
13 years 11 months ago #69145 by itye2012
On my site it is important that customers can check the weight of their shopping cart for shipping costs are dependent on weight. Is there a way you can display the current weight of the products in their cart?

price of delivery will vary depending on weight so its crucial that the weight is displayed.

Can anyone advise?

Many Thanks

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

More
13 years 11 months ago #69152 by Eliot
Hi there,

You can display each product weight by adding this:
Code:
echo $row->product_weight;

in the file cart.php (components\views\checkout\tmpl) to display the weight where you want in the product table (for example near to <?php echo $row->product_name; ?> )
If you need the total weight just ask me, I'll give you few more lines of code to do so.

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

More
13 years 11 months ago #69203 by itye2012
many thanks for your reply, would it be possible for you to give me the code to display the total weight in the cart.

many thanks

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

More
13 years 11 months ago #69204 by itye2012
many thanks for your reply, would it be possible for you to give me the code to display the total weight in the cart.

would it also be possible that when a product is added to the cart the current weight is shown similar to showing the current total price. the idea is that a customer will know how much their shopping weighs as each weight is charged at different rates

many thanks

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

More
13 years 11 months ago #69401 by nicolas
You can display the weight of the cart like that:
Code:
$cartClass = hikashop_get('class.cart'); $cart = $cartClass->loadFullCart(true); echo $cart->weight;

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

More
13 years 11 months ago #69531 by itye2012
which file do i need to amend for above code?

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

More
13 years 11 months ago #69623 by itye2012
can someone let me know which file i need to edit to insert above code and where the code goes in the file? ive been waiting nearly 2 days now for the answer

thanks

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

More
13 years 11 months ago #69715 by nicolas
You didn't wait 2 days but 1 day.

You can add it in the same file as Eliot told you already:

in the file cart.php (components\views\checkout\tmpl) to display the weight where you want in the product table


If you're unsure, add it at the end of the file.
The following user(s) said Thank You: itye2012

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

More
13 years 11 months ago #69825 by itye2012
i tried adding those lines but nothing happened..can you help?

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

More
13 years 11 months ago #69827 by itye2012
got it working now to show total weight but can you advise how i can add a label to it as it currently only shows a number, I also need to add a label and enter the weight measurement eg KG or G?

Thanks for your efforts

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

More
13 years 11 months ago #69928 by nicolas
After the code I gave, you can just write your main weight unit:
echo "kg";

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

More
13 years 11 months ago #69974 by itye2012
many thanks for the help, the weight works great on checkout. Any possibility the current total weight can also be displayed in the cart? I mean not just on checkout but on the cart as the user is shopping

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

More
13 years 11 months ago #70120 by nicolas
For the cart module, it's the file 'cart' of the view "product" that you need to modify. The code to add is the same.

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

More
13 years 11 months ago #70123 by itye2012
many thanks, Ill try that

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

More
13 years 11 months ago #70644 by itye2012
sorry not sure of which exact file you mean can you advise the path and file name?

Many Thanks

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

More
13 years 11 months ago #70781 by nicolas
It's the file 'cart' of the view "product" that you need to modify. You can edit it via the menu Display->Views.

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

More
13 years 11 months ago #72046 by itye2012
im still not clear on which file to edit sorry, can you advise ? I need to know how to edit? ie is it through ftp or via back end?

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

More
13 years 11 months ago #72337 by nicolas
It's in the backend.
When you are in HikaShop, go in the menu Display->Views and search for the file 'cart' of the view "product"

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

More
13 years 8 months ago #83547 by itye2012
since i upgraded this is not working for me anymore can you help

i need to display the current total weight in the cart and on checkout

thanks

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

More
13 years 8 months ago #83550 by Mohamed Thelji
Hi,

Is the code that Nicolas and Eliot gave you still in the file 'cart' of the view "product" ?

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

Time to create page: 0.294 seconds
Powered by Kunena Forum