Minimum quantity ignored at checkout

  • Posts: 250
  • Thank you received: 7
7 years 6 months ago #250824

-- url of the page with the problem -- : www.artistpapers.co.uk
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- PHP version -- : 7.0.10

Hi,

We have implemented a minimum quantity on some products but it appears this is not respected at checkout. If I set a minimum quantity of 5 on an item, and add 5 of that item to the cart, at checkout I can change the item quantity in the cart to a value less than 5. A worse problem is that the price changes from £1 each to FREE - the item isn't free!

EXAMPLE:

Add five of S401-10 a variant of https://www.artistpapers.co.uk/shop/drawing-and-illustration-paper/drawing-paper/strathmore-400-series-heavyweight-drawing



Go to cart to checkout and it's showing five items at the correct price


Change the quantity to 3 (which I shouldn't be able to do ) and price changes to FREE


An urgent solution to this would be appreciated.

Many thanks,

Ian

Attachments:
Last edit: 7 years 6 months ago by iedwards. Reason: corrected link

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 6 months ago #250825

Hi,

I can only think that there is a problem with the settings of the product/variant as I'm not able to reproduce the issue on my end.
Could you provide screenshots of their settings ?
If you want an easy solution, you can change the "quantity input" setting of the product to be displayed as a dropdown so that only the possible values can be selected in the quantity field.

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

  • Posts: 250
  • Thank you received: 7
7 years 6 months ago #250863

Hi Nicolas,

Thank you for the reply.

Attached are screen shots of the parent product and variant settings.

Ian

Attachments:

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 6 months ago #250868

Hi,

I see that you have several variants for the same values in your variants listing.
That should normally not be possible. It must come from a wrongly written CSV import.
Maybe it is linked to that ?

Try with a clean product where you don't have that.

Otherwise, try after changing the code:

$row->product_quantity_layout = $cart->products[$row->cart_product_parent_id]->product_quantity_layout;
						$row->product_min_per_order = $cart->products[$row->cart_product_parent_id]->product_min_per_order;
						$row->product_max_per_order = $cart->products[$row->cart_product_parent_id]->product_max_per_order;
to:
if(empty($row->product_quantity_layout))
						$row->product_quantity_layout = $cart->products[$row->cart_product_parent_id]->product_quantity_layout;
					if(empty($row->product_min_per_order))
						$row->product_min_per_order = $cart->products[$row->cart_product_parent_id]->product_min_per_order;
					if(empty($row->product_max_per_order))
						$row->product_max_per_order = $cart->products[$row->cart_product_parent_id]->product_max_per_order;
in the file administrator/components/com_hikashop/classes/cart.php

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

  • Posts: 250
  • Thank you received: 7
7 years 6 months ago #250917

Hi Nicolas,

It's not a wrongly written csv import, that is how the products are, I can't change the products!

I'll try the code changes and report back.

Many thanks,

Ian

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

  • Posts: 250
  • Thank you received: 7
7 years 4 months ago #257597

Hi Nicolas,

I had forgotten to implement this but have had the same problem again so I have now made the code changes to cart.php.

It does at least detect the minimum order quantity now but still allows the user to change the quantity below the minimum in the cart. So in the screen shot the minimum order quantity is 5 but the customer is able to change it to 3, and because there isn't a price set for less than five the cart offers it for free.



Ian

Attachments:

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 4 months ago #257599

Hi,

We're currently wrapping up the beta of HikaShop 3 which has a completely new cart system and which should handle that properly. So it would be great if you could try that out with the beta when we release it this week.

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

  • Posts: 250
  • Thank you received: 7
7 years 4 months ago #257689

Hi Nicolas,

I'm certainly looking forward to trying the new version, but it may be a while before that's released ready to put on a live site. Is there any possibility of a fix for this in the current version? The cart does now detect if the quantity is changed below the minimum as it gives the user a warning message, but it still allows the user to proceed with the order, the problem being that they then get the item free as there is no price for quantities below the minimum.

The warning message is fine but I could do with it setting the quantity back to the minimum value again. Can that be done?

Thanks,

Ian

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 4 months ago #257724

Hi,

Then try to change the code:

function check_cart(){
		$cart = $this->initCart();
		if(empty($cart->products) || !is_array($cart->products) || !count($cart->products)){
			$app = JFactory::getApplication();
			$app->redirect( $this->redirect_url, JText::_('CART_EMPTY'));
		}
		return true;
	}
to:
function check_cart(){
		$cart = $this->initCart();
		if(empty($cart->products) || !is_array($cart->products) || !count($cart->products)){
			$app = JFactory::getApplication();
			$app->redirect( $this->redirect_url, JText::_('CART_EMPTY'));
		}

		foreach($cart->products as $i => $row) {
			if(empty($row->cart_product_quantity)) continue;
			if(!empty($row->product_min_per_order)) {
				if($row->product_min_per_order>$row->cart_product_quantity) {
					$app->enqueueMessage(JText::sprintf('YOU_NEED_TO_ORDER_AT_LEAST_X_X',$row->product_min_per_order,$row->product_name));
					return false;
				}
			}
		}
		return true;
	}
in the file components/com_hikashop/controllers/checkout.php

Last edit: 7 years 4 months ago by nicolas.

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

  • Posts: 250
  • Thank you received: 7
7 years 4 months ago #257778

Hi Nicolas,

Thank you for that, it's stopping customers going below the minimum quantity. I'm not seeing the warning message any more though, but I can live with that.

Ian

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

  • Posts: 31
  • Thank you received: 0
  • Hikashop Business
7 years 2 months ago #261020

I am experiencing the same issue. I have certain products with minimum quantity requirements. In the example shown in my screenshots, a minimum of 12 items must be purchased. If the user adds 12 to the cart, everything is fine. However, if a quantity less than 12 is added, the price shows "Free."

Product: avofks.com/ufcw-store/international/oute...lished-knit-hat.html

I attempted the code change found in this post, but I do not have that exact code to replace.
www.hikashop.com/support/forum/checkout/...checkout.html#250868

I did make the code change found in this post.
www.hikashop.com/support/forum/checkout/...checkout.html#257724

However, I still have the same problem. This is a live site so I need to resolve the issue quickly.

Please advise.

Attachments:
Last edit: 7 years 2 months ago by leitzdesign. Reason: Added product link

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

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
7 years 2 months ago #261056

Hi,

Your problem configuration is not good.
Where did you configure the unit price for quantity between 1 and 11 ?
Where did you configure the product to refuse a quantity below 12 ?

www.hikashop.com/support/documentation/2...orm.html#restriction
If you want to force the user to have 12 unit min ; you must configure the product min per order in that way ; not the price.

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: 31
  • Thank you received: 0
  • Hikashop Business
7 years 2 months ago #261128

Jerome,
Thank you for the additional information. I have set the product to refuse a quantity below 12. There is no unit price for quantity between 1 and 11 as quantities below 12 are not allowed. Should that be indicated somewhere or does the cart infer that information?

Now, product forces a quantity of 12 before adding to cart - That's great.

However, once the quantity of 12 (or greater) is added to the cart, the amount can be changed. If the user changes the amount to be less than twelve, the following error is displayed:

"Limit reached. You can't add the product: Embellished Knit Hat: Gold Rhinestone"

This message is incorrect as there is no maximum number; it is set to "unlimited." I feel the error should indicate a minimum amount must be purchased. I have already replaced the code as indicated in this post:
www.hikashop.com/support/forum/checkout/...checkout.html#257724

Please advise.

Attachments:

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

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
7 years 2 months ago #261175

Hi,

Yes, if the customer is trying to modify the quantity outside the limits, the product can be removed.
I have an open task for HikaShop 3 in order to improve the system and provide a more logical approach.
So right now if you update to HikaShop 3 (in a test/pre-production website ; it is a major release you should not perform an update in a live site like that) you will still have the issue but I hope to fix it soon.

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.

Time to create page: 0.109 seconds
Powered by Kunena Forum