product specifications wrong number

  • Posts: 506
  • Thank you received: 21
  • Hikashop Business
10 months 4 weeks ago #352009

-- HikaShop version -- : 4.7.2
-- Joomla version -- : 4.3.1
-- PHP version -- : 8.1

Hi,

On the productpages in the specifications tab the measures are shown wrong. The default dimension symbols are set to cm. In the variant the dimensions are set to f.e. width 30 cm, height 20 cm. But on the productpage specs tab it shows 3 and 2 cm. See screenshots.

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
10 months 4 weeks ago #352011

Hi,

Can you provide the URL of that page so that we can look at the situation ?

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

  • Posts: 506
  • Thank you received: 21
  • Hikashop Business
  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
10 months 4 weeks ago #352019

Hi,

This should not happen unless you've modified the code of the show_block_dimensions view file, or you've changed the type of the dimension columns from decimal to integer in the hikashop_product table in your database.
Supposing you didn't change the show_block_dimensions view file, the code there expects a number with three decimals, as stored in the database, like 10,000. And so it trims the zero decimals so that it would look like 10 on the frontend.
But if you provide it with an integer like 10, then it will trim the zeros on the right because the code doesn't expect an integer.
Can you provide a screenshot of the structure of the hikashop_product table in your database ?

Supposing you've changed the type of the column in the database, you'll have to create a view override of show_block_dimensions to change :
rtrim(rtrim($this->element->product_weight,'0'),',.')
to:
$this->element->product_weight
and same for height, width, length so that it doesn't trim the zeros.

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

  • Posts: 506
  • Thank you received: 21
  • Hikashop Business
10 months 4 weeks ago #352025

Hi,

Well I didn't change the database, but the site has migrated to another server. Maybe something went wrong during the migartion. In did a database check in Hikashop, but no errors. The view show_block_dimensions has no modification.

But indeed all the measures height and width are inserted without decimals. So maybe that's causing the problem.

In the screenshot the product_table.

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
10 months 4 weeks ago #352027

Hi,

The "check database" button checks that the tables are there and that the columns that should be there are there. But it doesn't check the type of the columns.
The default type for these columns should be decimal (12,3) but I can see you have decimal (12,0) and that's why you have that issue.
go in the structure tab in your screenshot, and edit these columns and change the type to decimal (12,3) and it should then display fine.
Or you can do the view override I was talking in my previous message and it should also work fine after that.

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

  • Posts: 506
  • Thank you received: 21
  • Hikashop Business
10 months 3 weeks ago #352049

That's very strange indeed, as I did not change the database settings. Maybe an unexpected consequence from migrating Joomla 3 to 4...

I changed the default type in the database. It all works fine now, thanks.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum