Quantity set to unlimited, max 15 when add to cart

  • Posts: 62
  • Thank you received: 1
8 years 1 week ago #235908

-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4.45
-- Browser(s) name and version -- : Chrome latest
-- Error-message(debug-mod must be tuned on) -- : "Niet genoeg voorraad" which is dutch for not enough in stock (quantity)

For some reason all products with an unlimited quantity (in stock) in Hikashop now have a max limit of 15 for adding to the cart. This happened since the latest update of Joomla (3.5.1) and Hikashop (2.6.2).

The exact error is a javascript alert saying "Niet genoeg voorraad" which is dutch for not enough in stock (quantity). The product configuration however says the stock is unlimited. When I change the stock to a number it works fine.

How can I solve this?

Attachments:
Last edit: 8 years 1 week ago by nuntius.

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
8 years 1 week ago #235915

Hi,

I don't think that it's linked to that setting of your HikaShop configuration.
I think that it comes from the min max settings of each product.
Could you provide a screenshot of the settings of one of your products with the issue ?

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

  • Posts: 62
  • Thank you received: 1
8 years 1 week ago #235957

Ofcourse!
Here is one example. The settings are all the same for the products, except price ofcourse.



Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
8 years 1 week ago #236123

Hi,

Please edit the view "product / show_quantity" and replace:

$max_quantity = ($this->params->get('max_quantity'))?$this->params->get('max_quantity'):(int)$min_quantity * 15;
By:
$max_quantity = $this->params->get('max_quantity','0');

And add the code:
		if(!$max_quantity)
			$max_quantity = (int)$min_quantity * 15;
After:
	case 'show_select':
And:
	case 'show_select_price':

Thank you for this report.

The following user(s) said Thank You: nuntius

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

  • Posts: 21
  • Thank you received: 0
8 years 6 days ago #236524

I do what you say Xavier, and the problem persists, products width a unlimited stock has a limit of 15 to add to cart

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

  • Posts: 62
  • Thank you received: 1
8 years 6 days ago #236525

Make sure you remove any custom view before adding these modifications to make this work. At least that was the case with my webshop.

Cheers,
Teeuwis

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

  • Posts: 21
  • Thank you received: 0
8 years 6 days ago #236527

thanks Nuntius, now its OK ;)

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

  • Posts: 5
  • Thank you received: 0
7 years 11 months ago #238860

Hi
have tried but it does not
try to see the file if it is right


File Attachment:

File Name: product_qu...work.txt
File Size:12 KB

Attachments:
Last edit: 7 years 11 months ago by lyshytten.

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

  • Posts: 13201
  • Thank you received: 2322
7 years 11 months ago #238872

Hi,

Please use that version of the view:

<?php
$i = $this->params->get('i');
$min_quantity = ($this->params->get('min_quantity'))?$this->params->get('min_quantity'):1;
$max_quantity = $this->params->get('max_quantity','0');
$html = $this->params->get('html');

$qLayout = JRequest::getVar('quantitylayout','show_default');
switch($qLayout){
	case 'show_none':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_regrouped">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_regrouped':
?>
		<div class="input-append hikashop_product_quantity_div hikashop_product_quantity_input_div_regrouped">
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
			<div class="add-on hikashop_product_quantity_div hikashop_product_quantity_change_div_regrouped">
				<div class="hikashop_product_quantity_change_div_plus_regrouped">
					<a id="hikashop_product_quantity_field_change_plus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">+</a>
				</div>
				<div class="hikashop_product_quantity_change_div_plus_regrouped">
					<a id="hikashop_product_quantity_field_change_minus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',0,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">&ndash;</a>
				</div>
			</div>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_regrouped">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_select':
		if(!$max_quantity)
			$max_quantity = (int)$min_quantity * 15;
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select">
			<select id="hikashop_product_quantity_select_<?php echo $i; ?>" onchange="var id = this.id.replace('select','field'); document.getElementById(id).value = this.value;">
				<?php
				for($j = $min_quantity; $j <= $max_quantity; $j += $min_quantity){
					echo '<option value="'.$j.'">'.$j.'</option>';
				}
				?>
			</select>
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="hidden" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_select_price':
		if(!$max_quantity)
			$max_quantity = (int)$min_quantity * 15;
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select">
			<select id="hikashop_product_quantity_select_<?php echo $i; ?>" onchange="var id = this.id.replace('select','field'); document.getElementById(id).value = this.value;">
				<?php
				$pricesSet = array();
				foreach($this->row->prices as $price){
					if($price->price_min_quantity == 0)
						$price->price_min_quantity = 1;
					if(in_array($price->price_min_quantity,$pricesSet) || $price->price_min_quantity < $min_quantity || $price->price_min_quantity > $max_quantity)
						continue;
					$pricesSet[] = $price->price_min_quantity;
					echo '<option value="'.$price->price_min_quantity.'">'.$price->price_min_quantity.'</option>';
				}
				if(empty($pricesSet)){
					for($j = $min_quantity; $j <= $max_quantity; $j += $min_quantity){
						echo '<option value="'.$j.'">'.$j.'</option>';
					}
				}
				?>
			</select>
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="hidden" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_simple':
?>
		<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="hidden" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" />
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simple">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_leftright':
?>
		<div class="input-prepend input-append hikashop_product_quantity_div hikashop_product_quantity_change_div_leftright">
			<span class="add-on">
				<a id="hikashop_product_quantity_field_change_plus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">+</a>
			</span>
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
			<span class="add-on">
				<a id="hikashop_product_quantity_field_change_minus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',0,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">&ndash;</a>
			</span>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_leftright">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_simplified':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_simplified">
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simplified">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_default_div':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_default">
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_change_div_default">
			<div class="hikashop_product_quantity_change_div_plus_default">
				<a id="hikashop_product_quantity_field_change_plus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">+</a>
			</div>
			<div class="hikashop_product_quantity_change_div_minus_default">
				<a id="hikashop_product_quantity_field_change_minus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',0,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">&ndash;</a>
			</div>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_default">
			<?php echo $html; ?>
		</div>
<?php
		break;

	case 'show_default':
?>
		<table>
			<tr>
				<td rowspan="2">
					<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
				</td>
				<td>
					<a id="hikashop_product_quantity_field_change_plus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">+</a>
				</td>
				<td rowspan="2">
					<?php echo $html; ?>
				</td>
			</tr>
			<tr>
				<td>
					<a id="hikashop_product_quantity_field_change_minus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',0,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">&ndash;</a>
				</td>
			</tr>
		</table>
<?php
		break;

	default:
		if(substr($qLayout,0,14) == 'show_quantity_'){
			$doc = JFactory::getDocument();
			$app = JFactory::getApplication();
			$quantityDisplayType = hikashop_get('type.quantitydisplay');
			if($quantityDisplayType->check( $qLayout, $app->getTemplate())){
				$controller = new hikashopBridgeController(array('name'=>'product'));
				$viewType	= $doc->getType();
				if(!HIKASHOP_PHP5) {
					$view = & $controller->getView( '', $viewType, '');
				} else {
					$view = $controller->getView( '', $viewType, '');
				}
				$view->setLayout($qLayout);
				echo $view->loadTemplate();
				break;
			}
		}
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_default">
			<input id="hikashop_product_quantity_field_<?php echo $i; ?>" type="text" value="<?php echo JRequest::getInt('quantity',$min_quantity); ?>" class="hikashop_product_quantity_field" name="quantity" onchange="hikashopCheckQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_change_div_default">
			<div class="hikashop_product_quantity_change_div_plus_default">
				<a id="hikashop_product_quantity_field_change_plus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',1,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">+</a>
			</div>
			<div class="hikashop_product_quantity_change_div_minus_default">
				<a id="hikashop_product_quantity_field_change_minus_<?php echo $i; ?>" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange('hikashop_product_quantity_field_<?php echo $i; ?>',0,<?php echo $max_quantity; ?>,<?php echo $min_quantity; ?>);">&ndash;</a>
			</div>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_default">
			<?php echo $html; ?>
		</div>
<?php
		break;
}

If that still does not work, be sure that you are editing the view of the correct template.
www.hikashop.com/support/documentation/1...ize-the-display.html

Last edit: 7 years 11 months ago by Xavier.

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

  • Posts: 33
  • Thank you received: 2
4 years 11 months ago #306006

Team Nicolas,

Is this issue fixed? I have the same issue in the current version.
Not feeling like adapting the code, as I assume this is a bug which would be fixed.

I must say, I could enter order qty above 15 until some days ago. Only difference I made is that over the weekend I changed the global setting of the "Qty input method" to show select.

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
4 years 11 months ago #306015

Hi,

From what I understand from your message, you changed the quantity input into a dropdown instead of an input field. In that case, the quantity dropdown is limited to 15 by default unless you enter a value in the "To" field of the "quantity per order" setting of your product and in that case, the dropdown will go up to that value.
The issue reported on this thread is that even with the input field, you would be limited to 15 by default and that has been fixed 3 years ago.

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

  • Posts: 386
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #312741

Hello,

I reply on this topic.. is in the same question i asume.. I want the default quantity setting in backen see attachment not to be default on unlimited but i like to have this to be set to 1.
how can i get this done??

Thanks.

Attachments:

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
4 years 5 months ago #312742

Hi,

You can edit the file "form" of the view "product" via the menu Display>Views and add such code at the beginning:
<?php if(empty($this->product->product_id)){ $this->product->product_quantity = 1; } ?>

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

  • Posts: 386
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #312751

THanks that did it.. :)

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

Time to create page: 0.148 seconds
Powered by Kunena Forum