wrong product_weight_unit in checkout

  • Posts: 200
  • Thank you received: 9
  • Hikashop Multisite
2 months 1 week 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: 4519
  • Thank you received: 612
  • MODERATOR
2 months 1 week 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: 2 months 1 week ago by Philip.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
2 months 1 week 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
  • Hikamarket Multivendor
2 months 22 hours 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: 81540
  • Thank you received: 13071
  • MODERATOR
2 months 3 hours 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
  • Hikamarket Multivendor
2 months 1 hour 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