Round Price in Mass Action Operation

  • Posts: 35
  • Thank you received: 6
6 days 3 hours ago #367029

-- HikaShop version -- : 5.1.6
-- Joomla version -- : 5.3.0
-- PHP version -- : 8.1.32
-- Browser(s) name and version -- : Firefox 138.0.1 (64-bit)

Hello,
due to a percentage based increase in our prices, our price fields in the database have a lot of decimal points.

This has not been an issue for now, but now that we want to display the retail price, it is displayed as such:
"Price: 2,65 € (2,65 €)"

When I manually get rid of the excess decimal points we have the behavior we want:
"Price: 2,65 €"

How can I specify in a Mass Action to cut the decimal points off so only the first two remain?

Thanks in advance

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

  • Posts: 83776
  • Thank you received: 13560
  • MODERATOR
5 days 23 hours ago #367030

Hi,

I don't think that the solution is removing excess decimals.
I think that the price display behavior change comes from you manually saving the product in the backend, not changing the price decimals.
Creating a mass action to remove the decimals can be done with an action "update the values" on the "price_value" column, with the "operation" mode and the value: round(price.price_value,2)
But you might still have the problem after running that mass action.

The following user(s) said Thank You: NTV

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

  • Posts: 35
  • Thank you received: 6
5 days 5 hours ago #367036

Hi nicolas,

the round() function does exactly what I need and the display changed as expected - thank you!

Out of curiosity: How can I see which other functions are available? Do mass actions just use the mysql database functions or do they have their own code?

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

  • Posts: 83776
  • Thank you received: 13560
  • MODERATOR
5 days 5 hours ago #367039

Hi,

It indeed just use the MySQL functions.

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

  • Posts: 35
  • Thank you received: 6
5 days 2 hours ago #367044

So I guess we're getting AI spam then? :unsure:

The following user(s) said Thank You: nicolas

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

Time to create page: 0.062 seconds
Powered by Kunena Forum