Sold Out Message

  • Posts: 84306
  • Thank you received: 13701
  • MODERATOR
10 years 3 months ago #204612

Hi,

Yes, there is no option to do what you want.

What you can try is to add the code:
<?php $this->config->set('show_out_of_stock', 0); ?>
at the beginning of the file "show" of the view "product" via the menu Display>Views and keep the option turned on in the HikaShop configuration.
That way, you should get the out of stock products displayed, but not the out of stock variants.

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

  • Posts: 966
  • Thank you received: 11
9 years 10 months ago #217641

I don't know what changed but now when an item "SIZE" is sold out, the size is still showing on the page. I would like to do one of two things:

1) Either have a "sold out" message next to or below the size that is sold out OR

2) Remove that size from the page.

I currently have a product where the Large size is sold out but the button is still showing. I don't want users have to click on buttons to know if the item is available or not.

Seems like each time something is change something else doesn't work as expected. :( :(

FYI: I was looking to see if I could add the link privately but don't see the option here. Looks like you can only do that when you create a new post.

Thanks!!

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

  • Posts: 84306
  • Thank you received: 13701
  • MODERATOR
9 years 10 months ago #217671

Hi,

Well, that just depends on how you setup it up.
First, make sure that the "display out of stock products" setting of the HikaShop configuration is turned off. That way, when you have characteristic values that are not used by any variant of your product, the values won't be available in the dropdowns of the product page.
If that doesn't help because you have several characteristics and that you have values combinations which require the values to be displayed even though they are not to be used for all the variants, then you want to change the "characteristic display method" setting of the HikaShop configuration. For example, to "list".

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

  • Posts: 966
  • Thank you received: 11
9 years 10 months ago #217770

I've been really struggling with this for the shop.

This is what I am trying to achieve:
www.hikashop.com/support/forum/product-c...-message.html#204549

This is the reply I got to achieve what I want – but just discovered that it is not working as requested:
www.hikashop.com/support/forum/product-c...-message.html#204612

I don't want the "display out of stock products" to be turned off, otherwise what I am trying to achieve wont work.

With all due respect I don't know why this is so hard to accomplish - well for me it would be 'cause I have no clue when it comes to coding but for your talent it shouldn't be. I don't think I should have to change to a dropdown or list to get this working - why can it not work no matter what Characteristics selection method I choose?

Sorry but the client is really getting on me about this :( :( She said she sees other sites that do this and not sure why hers cannot do it.

To reiterate this is what I am trying to accomplish:

- I would like the size button to NOT show when that product size is sold out.
- But I would like the SOLD out badge to show when ALL sizes of that product are sold out.

Thank you!!

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

  • Posts: 13201
  • Thank you received: 2322
9 years 10 months ago #217946

Hi,

1. To not show the size button when the product size stock is equal to 0, you have to disable the option "Display out of stock products" in Configuration > Display > Products. Then if you use the value "radio button" for the characteristic display option, the button will not be displayed. If it is not the case, you have to check your overrides which are potentially interacting.

2. To show the badges only if all sizes are sold out I invite you to add the following code at the top of the view "product / show_block_img":

if(isset($this->element->variants)){
	$outOfStock = 1;
	foreach($this->element->variants as $variant){
		if($variant->product_quantity != '0')
			$outOfStock = 0;
	}
	if($outOfStock){
		$db = JFactory::getDBO();
		$db->setQuery('SELECT * FROM '.hikashop_table('badge').' WHERE badge_id = XX');
		$emptyBadge = $db->loadObject();
		if(!empty($emptyBadge)){
			if(is_null($this->element->badges))
				$this->element->badges = array($emptyBadge);
			else
				$this->element->badges[] = $emptyBadge;
		}
	}
}
Just replace "XX" by the id of the desired badge, and in the badge settings set the quantity field on "0" and let the quantity of the main product on "unlimited" (-1).

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

Time to create page: 0.073 seconds
Powered by Kunena Forum