Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2010
    Location
    Ooty, India
    Posts
    40
    Plugin Contributions
    0

    Default Restrict to add only one item in shopping cart

    Hi,


    I need to restrict the items added in shopping cart.

    only one item should be added at a time!!


    is there any fix?

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,022
    Plugin Contributions
    3

    Default Re: Restrict to add only one item in shopping cart

    If you mean you only want your customers to be able to buy one item at a time (I'd be interested in the explanation for that), there's a mod here: http://www.zen-cart.com/index.php?ma...oducts_id=1259 that limits the amount of an order. You might be able to adapt it (or use as is if all your products are the same price).

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

    Default Re: Restrict to add only one item in shopping cart

    Thanks For ur reply!!

    Once when i fix it will update here ASAP!!!

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

    Default Re: Restrict to add only one item in shopping cart

    Quote Originally Posted by stevesh View Post
    If you mean you only want your customers to be able to buy one item at a time (I'd be interested in the explanation for that), there's a mod here: http://www.zen-cart.com/index.php?ma...oducts_id=1259 that limits the amount of an order. You might be able to adapt it (or use as is if all your products are the same price).
    Your mod was to restrict the qty of items.


    But my issue is to restrict no of products added...


    for example, there are 3 prod A,B,C


    The user must be able to checkout only product A.

    If suppose he goes back and selects product B, it should not be added with prod A.

    Instead only product B must be displayed.

    Hope you got my issue!!

    help needed!!

  5. #5
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Restrict to add only one item in shopping cart

    Quote Originally Posted by arunkarthik View Post
    Your mod was to restrict the qty of items.


    But my issue is to restrict no of products added...


    for example, there are 3 prod A,B,C


    The user must be able to checkout only product A.

    If suppose he goes back and selects product B, it should not be added with prod A.

    Instead only product B must be displayed.

    Hope you got my issue!!

    help needed!!
    I constructed that module, based on Andrew Berezin's excellent MINIMUM ORDER VALUE module.

    While it might be possible to add more conditionals to that module, the format you are proposing may be quite a challenge.

    PS: Please don't ask me to do it (I am very busy right now!)

    And while I don't know why you are proposing to set these restrictions, it seems a sure fire way to me to drive customers AWAY from your business.

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

    Default Re: Restrict to add only one item in shopping cart

    Quote Originally Posted by fairestcape View Post
    I constructed that module, based on Andrew Berezin's excellent MINIMUM ORDER VALUE module.

    While it might be possible to add more conditionals to that module, the format you are proposing may be quite a challenge.

    PS: Please don't ask me to do it (I am very busy right now!)

    And while I don't know why you are proposing to set these restrictions, it seems a sure fire way to me to drive customers AWAY from your business.
    Dude thanks for ur reply man!!!

    by d way I'm not running this business!! I just work for ma client...

    anyway will try this n let u know soon...

  7. #7
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Restrict to add only one item in shopping cart

    if you download that module, look in the file called:

    class.maximum_order_amount.php

    You will see:-


    PHP Code:
      function update(&$class$eventID) {
        global 
    $messageStack;
        global 
    $currencies;
        switch (
    $eventID) {
          case 
    'NOTIFIER_CART_GET_PRODUCTS_END':
          case 
    'NOTIFY_HEADER_END_SHOPPING_CART':
            if (
    $_SESSION['cart']->count_contents() > && MAX_ORDER_AMOUNT 0) {
              if(
    $_SESSION['cart']->show_total() > MAX_ORDER_AMOUNT) {
                
    $_SESSION['valid_to_checkout'] = false;
                
    $messageStack->add('shopping_cart'sprintf(TEXT_ORDER_OVER_MAX_AMOUNT$currencies->format(MAX_ORDER_AMOUNT)) . '<br />''caution');
              }
            }
            break;
          case 
    'NOTIFY_HEADER_START_CHECKOUT_SHIPPING':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_PAYMENT':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION':
            if (
    $_SESSION['cart']->count_contents() > && MAX_ORDER_AMOUNT 0) {
              if(
    $_SESSION['cart']->show_total() > MAX_ORDER_AMOUNT) {
                
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
              }
            }
            break; 
    Try doing this to the above section:

    PHP Code:
      function update(&$class$eventID) {
        global 
    $messageStack;
        global 
    $currencies;
        switch (
    $eventID) {
          case 
    'NOTIFIER_CART_GET_PRODUCTS_END':
          case 
    'NOTIFY_HEADER_END_SHOPPING_CART':
            if (
    $_SESSION['cart']->count_contents() != MAX_ORDER_AMOUNT) {
                
    $_SESSION['valid_to_checkout'] = false;
                
    $messageStack->add('shopping_cart'sprintf(TEXT_ORDER_OVER_MAX_AMOUNT, (MAX_ORDER_AMOUNT)) . '<br />''caution');
            }
            break;
          case 
    'NOTIFY_HEADER_START_CHECKOUT_SHIPPING':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_PAYMENT':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION':
            if (
    $_SESSION['cart']->count_contents() !1) {
                
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            }
            break; 
    In your admin configuration Maximum values, you will now set the Maximum Value Allowed to 1 .

    You will also have to adjust your LANGUAGE DEFINES in that module, so that meaningful text appears in the alert messages, etc.

  8. #8
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Restrict to add only one item in shopping cart

    OOPS...

    Small error:

    Here's better code:

    PHP Code:
      function update(&$class$eventID) {
        global 
    $messageStack;
        global 
    $currencies;
        switch (
    $eventID) {
          case 
    'NOTIFIER_CART_GET_PRODUCTS_END':
          case 
    'NOTIFY_HEADER_END_SHOPPING_CART':
            if (
    $_SESSION['cart']->count_contents() != MAX_ORDER_AMOUNT) {
                
    $_SESSION['valid_to_checkout'] = false;
                
    $messageStack->add('shopping_cart'sprintf(TEXT_ORDER_OVER_MAX_AMOUNT, (MAX_ORDER_AMOUNT)) . '<br />''caution');
            }
            break;
          case 
    'NOTIFY_HEADER_START_CHECKOUT_SHIPPING':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_PAYMENT':
          case 
    'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION':
            if (
    $_SESSION['cart']->count_contents() != MAX_ORDER_AMOUNT) {
                
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            }
            break; 

 

 

Similar Threads

  1. How to add discount to item for only one attribute value?
    By Quimbly in forum Setting Up Specials and SaleMaker
    Replies: 10
    Last Post: 6 Dec 2010, 10:08 PM
  2. Replies: 0
    Last Post: 17 Mar 2009, 03:22 AM
  3. Can't Add More Than One Item to My Shopping Cart
    By Sandy83 in forum General Questions
    Replies: 1
    Last Post: 6 Sep 2008, 04:14 PM
  4. How to restrict one order only with one Categorie?
    By paranoia in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 22 Apr 2008, 05:10 AM
  5. Add Additional Shipping Cost to Only One Item
    By gocujo in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 8 Jan 2008, 09:04 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR