Show stock available in a product list

  • Posts: 209
  • Thank you received: 18
11 years 10 months ago #84303

Hi, I have a standard Joomla menu item which is a Hikashop "product listing" type showing all the product within a specific category. The Hikashop options for this menu are:
Type of content = product
Type of layout = list
Display 'Add to cart' button = No
Link to the product page = No

I have two questions in relation to display that I can't find answers to:

  1. Is there a way to show the stock available in a product list?
  2. Is it possible to display a link from the product in a list to the product page as a button rather than a hyperlink on the title?For number 2, I can't use the standard "add to cart" button as there are custom fields that need to be filled for each product and the "add to cart" button bypasses these fields. Can't seem to find anyway around this. The table view of the products is not what I want.

I have looked at the display > views but can't find which one of the php files controls the product listing view.

Ideally I want to show a listing of the products in a given category as follows:

Product name, product price, quantity available, link to product page button

Thanks!

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #84404

Hi,

You can edit the view "product / listing_list" and change the order of the displayed values to have your wanted order of elements.
You can change the link to the product page into a button, just some html is required.

To add the product quantity, you can add some code like:

<?php if($this->row->product_quantity != '-1') echo $this->row->product_quantity ?>

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

  • Posts: 209
  • Thank you received: 18
11 years 10 months ago #84444

Thanks Xavier, I had looked at just about every display except that one!

I'm almost there with what I need now, but I need a little help with the button link. I have put this code into listing_list but it breaks the page:

<?php if($this->row->product_quantity != '-1') echo JText::_('NO_STOCK'); ?>
<?php if($this->row->product_quantity != '0') <input type="button" onclick="window.location='<?php echo $link; ?>';" class="button" value=" Available "/> ; ?>

I just want the button to show ONLY if there is stock available.

Thanks heaps.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 10 months ago #84446

Hi,

Your code fixed (without PHP errors):

<?php if($this->row->product_quantity != '-1') echo JText::_('NO_STOCK'); ?>
<?php if($this->row->product_quantity != '0') echo '<input type="button" onclick="window.location=\''. $link .'\';" class="button" value=" Available "/>'; ?>

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: 209
  • Thank you received: 18
11 years 10 months ago #84450

Totally awesome as always! Thanks so much!

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

Time to create page: 0.072 seconds
Powered by Kunena Forum