Availability: On Stock / Out of Stock

  • Posts: 344
  • Thank you received: 3
12 years 1 day ago #78733

Hikashop 2.0 Business

Is it possible to have feature in each product

Availability: On Stock / Out of Stock

I do not want to show the number of what I have in stock of each product. But I just want to display if I have the product "in stock" or "Out of Stock"

Does Hikashop 2.0 have this function ?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
12 years 23 hours ago #78759

Hi,

HikaShop does not have this option but it is already possible to do it.
You can override the view "product | quantity" via the menu Display>Views in order to display a text when the product is available instead of displaying the quantity.

Two modifications are required:

          <div class="hikashop_product_stock">
          <?php
            // Just add this line
            echo JText::_('IN_STOCK');
            if(!empty($this->row->has_options)){
And
          <div class="hikashop_product_stock">
          <?php
            // Just add this line
            echo JText::_('IN_STOCK');
            if($this->row->product_quantity==1){
            	if(JText::_('X_ITEM_IN_STOCK')=='X_ITEM_IN_STOCK'){
            		$text = JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity);
            	}else{
            		$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
            	}
            }else{
            	$text = JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity);
            }
            // And comment the next one
            //echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
            if($config->get('button_style','normal')=='css'){

After that, you should create a new translation entry for "IN_STOCK" in your override file.

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.
Last edit: 9 years 10 months ago by nicolas.
The following user(s) said Thank You: river

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

  • Posts: 344
  • Thank you received: 3
12 years 22 hours ago #78783

Thank you for reply this works great.

One thing I am missing:
I need a prefix to the word "in stock"

By this I mean it is displaying like this:

Availability: In stock

How can fix this ?

Tnx

Last edit: 12 years 22 hours ago by river.

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

  • Posts: 2334
  • Thank you received: 403
12 years 21 hours ago #78804

Hi there,

It's just a translation.
You have to edit your language file in Systeme>Configuration>Language and change the translation for IN_STOCK.
However, this translation may be used somewhere else in your website. So you can also change the IN_STOCK in the code given by Jerome with IN_STOCK_FRONTEND and make a new translation for this one.

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

  • Posts: 344
  • Thank you received: 3
12 years 21 hours ago #78813

Thank you this works great

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

  • Posts: 1
  • Thank you received: 0
11 years 11 months ago #80965

what is the directory to these files?

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

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

Hi,

There is no directory for theses files, they are accessible thought the HikaShop backend.
Views are accessible thanks to the menu "Display > Views" and Language thanks to "System > Configuration > Language".

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: 344
  • Thank you received: 3
9 years 11 months ago #184287

How do I implement this function in Hikashop 2.3.4 ?

I have looked into the the file " product | quantity, but it looks like the file has gone trought some changes sine the last time I did this.

Any advice....

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
9 years 11 months ago #184297

Hi,

I've updated the code on Jerome's post:
www.hikashop.com/forum/4-how-to/76154-av...-of-stock.html#78759

The following user(s) said Thank You: river

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

  • Posts: 344
  • Thank you received: 3
9 years 11 months ago #184343

Tnx Nicolas. The updated code works great.

You should make this function a part of Hikashop core. Not every online store wants to display the number of products that they have in stock, only that they have it in stock like me. =)

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

  • Posts: 6
  • Thank you received: 0
9 years 10 months ago #187543

Sorry guys, for I am quite new in this so I need to ask :(

Where do I change the code / what file ?

And if it is "out of stock" can i Change it to "on demand" or something ...


(HIKA SHOP 2.3.5)

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 10 months ago #187544

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.
The following user(s) said Thank You: Temperament

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

  • Posts: 6
  • Thank you received: 0
9 years 10 months ago #187674

why is this code than?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 10 months ago #187681

NO_STOCK ?


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: 2
  • Thank you received: 0
9 years 9 months ago #188764

Buenas tardes noy nuevo en esto y lo estoy probando hace unos días para ver como funciona. Pero me encuentro con este problema. Cual es el archivo que tengo que modificar? que nombre tiene? Me aparecen mas de mil en la parte de vista.

Saludos,
Fernando

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #188768

Hi,

We are not speaking Spanish ; this forum is an English forum.
Please create a new thread in English and explain your issue.

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: 2
  • Thank you received: 0
9 years 9 months ago #188919

Good afternoon I'm new at this and I'm testing a few days ago to see how it works. But I encounter this problem. What is the file you have to modify? what name? I appear in more than one thousand of view.

Regards,
Fernando

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

  • Posts: 193
  • Thank you received: 76
9 years 9 months ago #188958

In Hikashop menu display->Views search for file "quantity" in your template.
Alternatively it's file components\com_hikashop\views\product\tmpl\quantity.php

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

  • Posts: 344
  • Thank you received: 3
7 years 9 months ago #260610

Joomla 3.6.5
Hikashop 3.0

I want the same function on my site using hikashop 3.0

But when I look at the file product | Quantiy its different than before.

Could you please advice my on what code I should use and where to implement it ?

tnx

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
7 years 9 months ago #260613

Hi,

It's now that code which handles that:

	if($this->row->product_quantity > 0)
		echo (($this->row->product_quantity == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $this->row->product_quantity) : JText::sprintf('X_ITEMS_IN_STOCK', $this->row->product_quantity));
	elseif(!$in_stock)
		echo JText::_('NO_STOCK');
That you could change to:
	if($this->row->product_quantity > 0)
		echo 'in stock';
	elseif(!$in_stock)
		echo JText::_('NO_STOCK');

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

Time to create page: 0.137 seconds
Powered by Kunena Forum