Wishlist and product quantity

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #233235

Hi,

Reviewing one of my customers wishlist I noticed wrong wording added on product quantity.
If product has quantity of 1 and adding it to wishlist in wishlist page you can see quantity 1 with 1 item in stock, all OK...
However adding same product again will give you quantity of 2 and sold out which is a little bit wrong cause 1 product is for sale?

Is this my template/view customization wrong or this is hikashop by default?
Is there a way to not add more products then there is in stock? Or add another wording if selected quantity is more then available?

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 1 month ago #233250

Hi,

On my end, the message I have is "Not enough in stock" and not "sold out".
So it works both cases.
So either the file "showcart" of the view "cart" has been modified, or there is a translation override for the translation key NOT_ENOUGH_STOCK which changes the text on your website.

The following user(s) said Thank You: kyratn

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

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #233485

Hi,

Are you sure it is working. Cause I tried with default view of showcart and it was same. Adding same variant again with quantity of 1 to wishlist would give not on sale anymore. Looked into code and I see this:

$stockText = "<span class='hikashop_red_color'>".JText::_('NOT_ENOUGH_STOCK')."</span>";
but for unknown reason it dosesnt work for me....I also checked language file and everything is fine, no override and default is: Not enough in stock

I think this is the code responsible for this and it is same as in default hikashop view file:
<?php
			$app = JFactory::getApplication();
			$config =& hikashop_config();
			$i = 1;
			$k = 1;
			$total_quantity = 0;
			if(!empty($this->rows)){
				$productClass = hikashop_get('class.product');
				$group = $this->config->get('group_options',0);
				foreach($this->rows as $cart){
					if($group && $cart->cart_product_option_parent_id) continue;
					if(!@$cart->hide){
						$total_quantity += $cart->cart_product_quantity;
						$productClass->addAlias($cart);
						$quantityLeft = $cart->product_quantity - $cart->cart_product_quantity;
						$inStock = 1;
						if(($cart->product_quantity - $cart->cart_product_quantity) >= 0 || $cart->product_quantity == -1){
							if($cart->product_quantity == -1)
								$stockText = "<span class='hikashop_green_color'>".JText::sprintf('X_ITEMS_IN_STOCK',JText::_('HIKA_UNLIMITED'))."</span>";
							else
								$stockText = "<span class='hikashop_green_color'>".JText::sprintf('X_ITEMS_IN_STOCK',$cart->product_quantity)."</span>";
						}else{
							if($cart->product_code != @$cart->cart_product_code){
								$stockText = "<span class='hikashop_red_color'>".JText::_('HIKA_NOT_SALE_ANYMORE'). "</span>";
							}else{
								$stockText = "<span class='hikashop_red_color'>".JText::_('NOT_ENOUGH_STOCK')."</span>";
							}
							$inStock = 0;
						}
						if($k ==1)$k = 0;else $k =1;
						?>

So what could be the problem?

Regards

Last edit: 8 years 1 month ago by kyratn.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 1 month ago #233512

Hi,

It's indeed that piece of code which handle that. But as you can see there, there is no "sold out" message.
Maybe there is a misunderstanding ? Are you talking about the "Not on sale anymore" message ?

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

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #233540

Hi,

Well yes, i am talking about not on sale anymore message. Which will show if item is sold out. However it will show again when adding 2 products which has stock quantity 1...Shouldnt message be displayed Not enough stock???

Problem is that if customer has 1 product in wishlist and will add it again. In hes wishlist he will see that item is not on sale anymore which is wrong. I hope you understand what i want to say??

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
8 years 1 month ago #233582

Hi,

Yes indeed the message "Not enough stock" should be displayed instead.
In your case the code creating the issue seems to be:

if($cart->product_code != @$cart->cart_product_code){
So please replace it by:
if($cart->product_quantity == 0){

The following user(s) said Thank You: kyratn

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

  • Posts: 1119
  • Thank you received: 114
8 years 1 month ago #233615

Hi,

Thank you Xavier it has fixed the issue.

Best Regards

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

Time to create page: 0.086 seconds
Powered by Kunena Forum