Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    Join Date
    Jul 2007
    Posts
    88
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    Quote Originally Posted by Ajeh View Post
    To limit a Product to quantity 1 in the current order you can set the Maximum to 1 ... this is a built in feature of Zen Cart ...
    Thanks very much. I know I can restrict the maximum to 1 when I am adding the product in categories/ products.
    The default in my store however shows as

    Product Qty Minimum: 1
    Product Qty Maximum: 0 0 = Unlimited, 1 = No Qty Boxes
    Product Qty Units: 1

    Product Qty Min/Unit Mix: Yes

    So each product I would need to change the maximum to 1. Is there a way to change this default to 1 ?
    I do have 'Products Quantity Box Shows:' set at No, Do not show Quantity Box by default [set through configuration /product listing] so only the add to cart button shows and no quantity.

  2. #12
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How can I limit one items quanity as one per customer?

    You would need to customize the module in the admin for the:
    collect_info.php

    for the product type you are using ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #13
    Join Date
    Jul 2007
    Posts
    88
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    thank you again I will have a look and play around and see what i can do.

  4. #14
    Join Date
    Jun 2009
    Posts
    69
    Plugin Contributions
    0

    red flag Re: How can I limit one items quanity as one per customer?

    I have just come accross a bug with this and i don't know how hard it is to fix.

    This method (Max Quanitity =1) works when the user is already logged in and within the same session. For example, if the cart has 'product A' and user tries to add that product again, the action is prevented and the following error message appears:
    "The quantity added to your cart has been adjusted because of a restriction on maximum you are allowed. See this item: product A"

    However, if the 'product A' was added to the cart in a previous session, the store allows the user to add a second product A even when the max quantitiy value is set to 1. For example the user is logged out but their account already holds 'product a' in their shopping cart. The user adds another 'product a' while in the visitor's cart and seeks to checkout. They are then prompted with a login request and when complete they now have 2 of 'product a' with the following message:
    "NOTICE: For your convenience, your current shopping cart has been combined with your shopping cart from your last visit. Please review your shopping cart before checking out."

    1. How hard is it to fix this bug? So that the store check's whether product max quantity is reached before merging the visitor cart and the user cart?



    2. I tried adding customer shop status from '0' to '1' or '2' to force a login before they have a chance to add a second 'product a' but that causes more issues. Namely, my customers are directed to the store from my site using a simple form (<form action="http://domain.com/index.php?main_page=product_info&amp;cPath=3&amp;products_id=77&amp;number_of_up loads=0&amp;action=add_product" method="post" enctype="multipart/form-data"> ) which prefills attribute values and chooses the product. Now by forcing a login before adding to the cart, all the form data is lost and the users see a 'Shopping cart empty' message. Is there anyway that the login page doesn't loose all that data?


    I think the first option is in the right direction as it fixes the problem for good. I would appreciate any help in the matter.

    Thanks in advance,
    Shaztesting

  5. #15
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How can I limit one items quanity as one per customer?

    I cannot reproduce this ...

    I login and add a Max 1 product to cart ...

    I logout and add the same Max 1 product to cart ...

    I login and it says it merged cart ... but I still have quantity 1 ...

    What version of Zen Cart are you using?

    If Zen Cart v1.3.8 have you applied the Known Bug Fixes?
    http://www.zen-cart.com/forum/showthread.php?t=82619
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #16
    Join Date
    Apr 2009
    Location
    Chicago, IL
    Posts
    45
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    I know this thread is kind of old, but it's the most relevant to my question, so I'm going to give it a shot:

    I managed to prevent logged in users from adding an item to their cart if they've already purchased the maximum, but if they add the items when they're not signed in and then log in to complete their purchase, they beat the system.

    So my question is: what file would I need to modify to pull items out of the cart when they've already made it to the checkout page?

    I'm using Fast and Easy Checkout if that makes a difference. If someone is on the checkout page when they log in, it brings them right back to where they left off.

    For anyone who needs to just block people from adding an already maxed out item to their cart, this is what I did...

    Since all my products have a download attribute and you have to go through the product info page, I put the booby trap there.

    In the pages/product_info/header_php.php file, I added this toward the top:
    Code:
    $query_max = "select SUM(op.products_quantity) as total_qty 
    		from " . TABLE_ORDERS . " o, " .
                       TABLE_ORDERS_PRODUCTS . " op 
    		where	o.orders_id = op.orders_id
    		and		o.customers_id = '" . $_SESSION['customer_id'] . "'
    		and		op.products_id = '" . (int)$_GET['products_id'] . "'";
    
    $max = $db->Execute($query_max);
    $quantity_purchased = $max->fields['total_qty'];
    And in then on the tpl_products_info_display.php page, in the add to cart section, right after
    Code:
    <?php
    if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
      // do nothing
    } else {
    ?>
    I added this:
    Code:
    <?php if (($products_quantity_order_max != '0') && ($products_quantity_order_max <= $quantity_purchased) && ($products_quantity != '0')) {
    echo zen_image_button(BUTTON_IMAGE_MAXED_OUT, BUTTON_MAXED_OUT_ALT) .'<div class="sorryText">You\'ve already bought the maximum allowed for this deal, but don\'t worry, there are plenty more to enjoy!</div>';
    	} else {
    and don't forget to add an extra one of these bad boys before eof Add to Cart Box
    Code:
    <?php }
    to close the if else statement.

    I'm going to tweak the shopping cart class to update the quantity if someone's trying to make a new purchase where the quantity is within the per session max, but would put them over the per cart max - I'll post that code when I finish.

    I'm using v1.3.8a btw

  7. #17
    Join Date
    Mar 2010
    Location
    Ooty, India
    Posts
    40
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    Thanks a lot zenners this 's wat i was hunting for!!!!!!!!!




  8. #18
    Join Date
    Jan 2011
    Posts
    11
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    Quote Originally Posted by MUtester View Post
    if you go into your catalog, than categories, select the product you want to limit, you will find an option "Product Qty Maximum:"

    If you set this to "1" the customer should only be allowed to buy one of this specific product...
    Is there a way to default this field to "1"? All items on my site are for download, so if they order more than one it would be by mistake.

  9. #19
    Join Date
    Jan 2010
    Posts
    42
    Plugin Contributions
    0

    Default Re: How can I limit one items quanity as one per customer?

    Quote Originally Posted by chrismarie View Post
    I know this thread is kind of old, but it's the most relevant to my question, so I'm going to give it a shot:

    I managed to prevent logged in users from adding an item to their cart if they've already purchased the maximum, but if they add the items when they're not signed in and then log in to complete their purchase, they beat the system.

    So my question is: what file would I need to modify to pull items out of the cart when they've already made it to the checkout page?

    I'm using Fast and Easy Checkout if that makes a difference. If someone is on the checkout page when they log in, it brings them right back to where they left off.

    For anyone who needs to just block people from adding an already maxed out item to their cart, this is what I did...

    Since all my products have a download attribute and you have to go through the product info page, I put the booby trap there.

    In the pages/product_info/header_php.php file, I added this toward the top:
    Code:
    $query_max = "select SUM(op.products_quantity) as total_qty 
    		from " . TABLE_ORDERS . " o, " .
                       TABLE_ORDERS_PRODUCTS . " op 
    		where	o.orders_id = op.orders_id
    		and		o.customers_id = '" . $_SESSION['customer_id'] . "'
    		and		op.products_id = '" . (int)$_GET['products_id'] . "'";
    
    $max = $db->Execute($query_max);
    $quantity_purchased = $max->fields['total_qty'];
    And in then on the tpl_products_info_display.php page, in the add to cart section, right after
    Code:
    <?php
    if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
      // do nothing
    } else {
    ?>
    I added this:
    Code:
    <?php if (($products_quantity_order_max != '0') && ($products_quantity_order_max <= $quantity_purchased) && ($products_quantity != '0')) {
    echo zen_image_button(BUTTON_IMAGE_MAXED_OUT, BUTTON_MAXED_OUT_ALT) .'<div class="sorryText">You\'ve already bought the maximum allowed for this deal, but don\'t worry, there are plenty more to enjoy!</div>';
    	} else {
    and don't forget to add an extra one of these bad boys before eof Add to Cart Box
    Code:
    <?php }
    to close the if else statement.

    I'm going to tweak the shopping cart class to update the quantity if someone's trying to make a new purchase where the quantity is within the per session max, but would put them over the per cart max - I'll post that code when I finish.

    I'm using v1.3.8a btw
    Have you made any progress on this? I tried your code on 1.3.9h without FEC and it does not stop the user from ordering multiple.

    I would like to get this working because I would like to offer a Free Sample per customer on my cart, and to me using a coupon code to do it is a lame and lazy way to do it.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. How to restrict to just one product in the cart per customer?
    By gifro10 in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 28 Apr 2008, 07:49 AM
  2. How can I add more than one image per product
    By Dralion in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 6 Jun 2007, 07:31 AM
  3. Limit one per customer
    By Ripper in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 16 Oct 2006, 02:30 AM
  4. Limit free product to one per customer
    By hhunter in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 7 Sep 2006, 09:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg