Frontoffice notice when product below certain stoc

  • Posts: 21
  • Thank you received: 0
9 years 3 months ago #209992

-- url of the page with the problem -- : www.setup-pilotage.com
-- HikaShop version -- : 2.5.0

Hi, I have one question, couldn't find anything using Search...

I am looking for one feature : is it possible to display a notice on product listing when a products arrives at a certain stock quantity ?

Example : Be careful, only 2 more available

Thanks !

Last edit: 9 years 3 months ago by Paganikon.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #209996

Hi,

Yes it is possible via view override, the view to edit is "product / listing_xxx" depending on what kind of listing you are using, by default it is "listing_img_title".

And in that view add some php code to display the stock, something like:

<?php echo JText::_('STOCK_AVAILABLE',$this->row->product_quantity;); ?>

And add a translation override:

STOCK_AVAILABLE="Be careful, only %s more available."

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

  • Posts: 21
  • Thank you received: 0
9 years 3 months ago #210097

Hi, thanks a lot !

One more thing, how can I display it only when it reaches 2 products left in stock ?

Something like (sorry don't know much about php lol) : if stock <= 2 {display "be careful, only 2 products in stock"}

Thanks ^^

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #210099

Hi,

Like that:

<?php 
if($this->row->product_quantity <= 2 && $this->row->product_quantity > 0)
    echo JText::_('STOCK_AVAILABLE',$this->row->product_quantity;); 
?>

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

Time to create page: 0.071 seconds
Powered by Kunena Forum