Full service web hosting, great prices and support. Starts at $1.99/month!
Results 1 to 4 of 4

Thread: Limiting one item per customer - narrowed to actions in head

  1. #1
    Anonymous
    Guest


    Default Limiting one item per customer - narrowed to actions in head

    Okay, I've been fighting this all weekend. I only want customers to be able to buy one item at a time. I doing subscriptions through the cart. I have everything set including the nasty PayPal link. My problem is, everywhere else it still says that the customer has ordered more then one item, even if they were only charged for one. I figure if I can limit the solution in the Add and Update functions, it will solve my problem.

    How can I change this code to check to see if there already is an item in the cart and stop if there is. Like if (i>1) kind of thing, but I'm not sure of the variables. I can do the errors and redirects needed, I'm just not sure how to get it to check the cart. Thank you.


    Code:
    // customer wants to update the product quantity in their shopping cart
          case 'update_product' : for ($i=0; $i<sizeof($HTTP_POST_VARS['products_id']);$i++) {
                                    if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
                                      $cart->remove($HTTP_POST_VARS['products_id'][$i]);
                                    } else { // if PHP3, make correction for lack of multidimensional array in PHP3
                                      if (ereg('^3\.', phpversion())) {
                                        reset($HTTP_POST_VARS);
                                        while (list($key, $value) = each($HTTP_POST_VARS)) {
                                          if (is_array($value)) {
                                            while (list($key2, $value2) = each($value)) {
                                              if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
                                                $id2[$var[1]][$var[2]] = $value2;
                                              }
                                            }
                                          }
                                        }
                                        $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
                                      } else {
                                        $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
                                      }
                                      $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes);
                                    }
                                  }
                                  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));
                                  break;
          // customer adds a product from the products page
          case 'add_product' :    if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                                    $cart->add_cart($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
                                  }
                                  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));
                                  break;

  2. #2
    Anonymous
    Guest


    Default

    Instead of looking to disable the cart function after 1 purchase try sending to buy know directly to the checkout

  3. #3
    Anonymous
    Guest


    Default

    That makes sense, but then they could still navigate back. I want to make it final. The reason is because the way the store is set up, they could add a monthly and a yearly and make it through PayPal, and then I would be forced to lose a lot of money. I couldn't go back and negotiate the price. It would be like signing a contract. If I only let them get to PayPal with one item, with coding, that works but then in the email, order history and confirmation page, it shows that they bought two items. Very unprofessional.

  4. #4
    vandiike
    Guest


    Default

    Hi I am trying to do the similar, did you find any good solution?

    Regads

    Mike

Similar Threads

  1. how do you hide item prices until customer has logged in?
    By CLK in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 12-15-2005, 04:57 PM
  2. Login page keeps popping up for certain edit actions
    By mgrooten in forum osCMax v1.7 Installation
    Replies: 9
    Last Post: 10-31-2005, 09:02 AM
  3. Limiting One per Customer
    By Aza in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 09-06-2005, 01:07 PM
  4. limiting UPS shipping options
    By superman in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 11-11-2003, 09:57 AM
  5. How to edit <head>
    By pgowder in forum osCommerce 2.2 Modification Help
    Replies: 5
    Last Post: 01-03-2003, 09:00 AM

Bookmarks

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
  •