wrong product_weight_unit in checkout

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
9 months 2 days ago #359214

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 3

Hi,

I have something strange:
My client uses "Doos" as product_weight_unit in the backend


it is set in the settings


it is also fine in the database

in the frontend (listing) it's fine


But when i add this product to the cart it shows / kg


When i var_dump the product in cart it shows kg as product_weight_unit


Can you see what's going wrong here?
Kind regards,
Jeroen Moolenschot

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
9 months 2 days ago #359216

Hello,

We will need these elements to progress on your suject :
- An Url link to your administrator (backend)
-Backend user references (with maximum ACL)
Note : Use our Contact us form to provide these elements, and don't forget to add an Url link to this topic.
Regards

Last edit: 9 months 2 days ago by Philip.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 months 1 day ago #359241

Hi,

The first weight unit in the list of the configuration becomes the main one of your shop.
So you configured "kg" as the main one.
On the product page, you see Doos because the page is relative to this product.
However, once the product is in the cart, the weight of all the products are converted to the main weight unit so that the total weight of the cart can be calculated for the shipping methods.
And since HikaShop doesn't know how to convert a doos to a kilo, it just use the same value.
If you scroll down on your var_dump, you should see an attribute product_weight_unit_orig which contains the weight unit before the conversion, as well as a product_weight_orig with the weight before the conversion.

It seems that you've customized product / listing_price to display product_weight_unit after the product price. So you'll need to amend your code to display product_weight_unit_orig if available and if not product_weight_unit so that you can get the display you want.

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

  • Posts: 8
  • Thank you received: 1
8 months 3 weeks ago #359375

I tried to change the code but when i look in the var_dump it says:

public 'product_weight_unit_orig' => string 'Kg' (length=2)

While the original unit is "Doos", so this also doesn't shows the right information.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 months 3 weeks ago #359386

Hi,

I see what the problem is.
Change the code:

				$product->product_weight_orig = $product->product_weight;
				$product->product_weight_unit_orig = $product->product_weight_unit;
to:
				if(!isset($product->product_weight_orig))
					$product->product_weight_orig = $product->product_weight;
				if(!isset($product->product_weight_unit_orig))
					$product->product_weight_unit_orig = $product->product_weight_unit;
in the file administrator/components/com_hikashop/classes/cart.php and it should be fine.
We'll make that change on our end too for the next version of HikaShop.

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

  • Posts: 8
  • Thank you received: 1
8 months 3 weeks ago #359397

Great! This works.

Thank you.

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

Time to create page: 0.103 seconds
Powered by Kunena Forum