Mass action if product has discount

  • Posts: 1079
  • Thank you received: 107
  • Hikashop Business
2 years 9 months ago #258545

Hi,

I have added code below to show my own discount badge:

<!-- show discount on product listing --->
<?php if(!empty($this->row->discount)){
if(bccomp($this->row->discount->discount_flat_amount,0,5)!==0){
						echo '<span class="discount-badge">'.$this->currencyHelper->format(-1*$this->row->discount->discount_flat_amount,$price->price_currency_id),'</span>';
					}elseif(bccomp($this->row->discount->discount_percent_amount,0,5)!==0){
						echo '<span class="discount-badge">'.-1*$this->row->discount->discount_percent_amount.'%','</span>';
					}
}?>
<!-- end discount --->

What i want is to add product to category if that product has discount. Can this be done with mass action? I couldn't find such filter....

Many thanks

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

  • Posts: 23753
  • Thank you received: 3682
  • MODERATOR
2 years 9 months ago #258552

Hi,

Due the fact that a discount can be applied to products and categories, that the information is stored in the discount and not in the product ; there is no possible mass-action for that.
You would be able to do that using a custom plugin ; but it is not something I would recommend.
We more recommend to use discounts on a (unpublished) category and then put the products in the category to apply the discount than the "opposite".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 1079
  • Thank you received: 107
  • Hikashop Business
2 years 9 months ago #258572

Thanks for replay Jerome. I see what you mean.

Have a great New Year evening

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

  • Posts: 1079
  • Thank you received: 107
  • Hikashop Business
2 years 9 months ago #258652

Hi,
1 more Question. Example:
I create discount -5% and publish it. -5% discount will be applied to all my products in the shop automatically.
If i add any product or category then it works fine. Remove it and same result.

Should it be like this?

Many thanks

Last edit: 2 years 9 months ago by kyratn.

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

  • Posts: 67119
  • Thank you received: 9946
  • MODERATOR
2 years 9 months ago #258669

Hi,

Yes that's normal.
If you don't restrict a discount to a product, then it means that you want it to apply to all the products.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum