Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Minimum order quantity by product not working
Author « Topic »  

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/20/2020 :  15:25:16  
Hi, I have a few products for which I need to set a minimum order quantity of 6. After a bit of searching, I found how to do this via the 'quick entry' of the product admin.

What happens now is that if I add less than the required number of the product to the cart, a message displays on cart.php (not in the soft cart) saying 'The product xxxx has a minimum quantity of 6' BUT it does not stop me from adding it to the cart and then checking out.

Am I missing something? If I set a minimum order quantity, I would not expect to be able to receive an order of less than that quantity of the product.

I tried putting $minpurchasequantity=6; into includes.php as a test, of course this applied to all products which I don't want, but it did prevent me checking out with less than 6 items.

Any ideas please? This website is still in development so I'd prefer not to post a link, but can PM anyone who is able to take a look.

Thank you
Ellen

Vince
Administrator

42874 Posts

Posted - 02/21/2020 :  01:22:43  
Hi Ellen
You are correct and it's a bit of a bug I'm afraid. I've fixed it now and added the changes to the updater. You just need a new copy of the inccart.php script and that should sort this out.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/21/2020 :  02:45:00  
Hi Vince, that's great thank you for the super quick fix! I'll get the updater done shortly.

Just another question following on from this. For most of the products in the store, we don't want the 'quantity' box, only on these few which have the minimum quantity. I was looking for a way to pick up which products have the quantity set, and display quantity box only for them, but I couldn't find a variable which would do this for me. I was thinking something like this in proddetail.php (my includes $detailpagelayout does not have 'quantity' in it)

<?php if ($pMinQuant > 1)
{
$detailpagelayout="navigation, checkoutbutton, productimage, productname, discounts, description, options, listprice, price, currency,quantity, addtocart, contentregion3, instock, socialmedia, previousnext";

} ?>

However $pMinQuant did not work, is there another variable I could use please?

Thanks
Ellen

Edited by - EllenD on 02/21/2020 02:55:00

Vince
Administrator

42874 Posts

Posted - 02/21/2020 :  14:15:11  

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/21/2020 :  14:52:38  
Hi Vince,

Is the fix already added to the updater? I just ran it but no difference, I can still add to cart & checkout with less than the minimum quantity. The warning message still appears on cart.php but checkout button is clickable anyway.

I also tried $rs['pMinQuant'] but that was only available after the <?php include "vsadmin/inc/incproddetail.php" ?> line, by which time I realised it was too late to influence the output of the proddetail page. Any other ideas that I could try here please?

Thanks for your help
Ellen

Edited by - EllenD on 02/21/2020 14:53:31

Vince
Administrator

42874 Posts

Posted - 02/22/2020 :  08:45:07  
Hi Ellen
The only file you need to fix the problem is the inccart.php file. Can you check that the modified date of that in the updater is Friday's date and that the date of that file on your server has been updated too. Yes, the fix should be there.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/24/2020 :  03:32:22  
Hi Vince

Thank you my mistake - I had expected the checkout button to be hidden if below the minimum quantity, whereas the message only appears when I click the checkout button. No matter though, it serves the same function to prevent the order, so thank you very much for the fix.

Ellen

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/24/2020 :  04:03:12  
Just in case anyone else want to show the quantity box only on products with a minimum quantity set, I ended up with this solution.

includes.php - have 'quantity' in the list of items in $detailpagelayout

proddetail.php - hide quantity box with JavaScript if no minimum quantity is set

<?php include "vsadmin/inc/incproddetail.php" ?>
<?php if ($rs['pMinQuant'] == 0)
{
echo '<script type="text/javascript">',
'var elements = document.getElementsByClassName("detailquantity");',
'elements[0].className += " no_show";',
'</script>';
} ?>

In ectstyle.css or your stylesheet:

.no_show{display:none!important}

Edited by - EllenD on 02/24/2020 04:04:39

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 02/24/2020 :  05:30:54  
One (hopefully!) final thing on this. I noticed that when cloning a product with a minimum quantity set, the minimum quantity does not get carried over to the new product. Could this be added please?
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000