Null values ​​in Mass Actions

  • Posts: 135
  • Thank you received: 6
5 days 5 hours ago #369811

I want to increase the price by 40% on the price column. To do this, I used the tutorial in this link:
https://www.hikashop.com/forum/mass-actions/861153-change-price-of-all-products-by-percentage.htmlhttps://www.hikashop.com/forum/mass-actions/861153-change-price-of-all-products-by-percentage.html


This method works well on products that do not have variants, but if you have a product that has variants, it sets the price of the variant product to zero. That is, it writes the number 0 in the price column. Therefore, variant products cannot inherit the price from the main product.
As far as I know, in the backend product management of Hikashop, we cannot give a product a zero price, but an empty price column means that it is zero. (Although it would be nice if we could have a zero value and a null value for variant products so that those that are zero are free and those that are null inherit the price from the main product).
Therefore, the correct value 0 should not be written there. I think this is implemented incorrectly.
How can I change the price of variant products that are not null and also the price of the main products by 40%, but leave the variant products whose price is null unchanged and the zero value in their price column not calculated?

Attachments:

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

  • Posts: 84868
  • Thank you received: 13820
  • MODERATOR
4 days 14 hours ago #369814

Hi,

When a product or variant doesn't have a price, the mass action will create it for you. This is useful and how we meant it to be.
For example, suppose that you have a category with products without a price at all and you want to set the price of all of them to 10€ at once. With the "update the values" action on these products' price_value column, you'll be able to add these prices all at once.

The filter in your mass action should indeed discard products or variants without a price. However, the "is not null" is somewhat tricky to apply in some cases. I remember we already fix an issue like this in the past with "is not null". You didn't say which version you have so maybe it comes from that ?
What I would recommend is to change your filter to price_value > 0
This should work better to skip products and variants without prices set in them.

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

  • Posts: 135
  • Thank you received: 6
4 days 8 hours ago #369822

I use hikashop 5.1.0

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

  • Posts: 84868
  • Thank you received: 13820
  • MODERATOR
4 days 3 hours ago #369823

Hi,

Oh, then that's probably why. If you can't update, then try with the > 0 as I said in my message. It should work properly.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum