Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Products that can only be purchased once.

    Try this ... paren issues and that , after the products_id in the array ...

    Code:
    // bof: do not allow customer to add to cart if already purchased
    // if not logged in and a free product make login
    
    
    if (!$_SESSION['customer_id'] && in_array((int)$product_id, array(65, 64 )) ) {
      return 'login for free product';
    }
    
    
    if ( in_array((int)$product_id, array(65, 64 )) ) {
      $chk_product_purchased_query = "select distinct op.products_id, o.orders_id
        from " . TABLE_ORDERS_PRODUCTS . " op
        left join " . TABLE_ORDERS . " o on o.orders_id = op.orders_id
        where op.products_id = '". (int)$product_id . "'
        and o.customers_id='" . $_SESSION['customer_id'] . "'";
    
      $chk_product_purchased = $db->Execute($chk_product_purchased_query);
    
      if (!$chk_product_purchased->EOF) {
        return 'You have already received this offer!';
      }
    }
    
    // eof: do not allow customer to add to cart if already purchased
    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!

  2. #12
    Join Date
    Apr 2010
    Posts
    59
    Plugin Contributions
    0

    Default Re: Products that can only be purchased once.

    Thank you once again Ajeh,


    I aspire to achieve your level of understanding of php and generosity.

    Till next time!

  3. #13
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Products that can only be purchased once.

    You are most welcome ... thanks for the update that this is working for you now to only allow the purchase of some products once ...
    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!

  4. #14
    Join Date
    Apr 2010
    Posts
    59
    Plugin Contributions
    0

    Default Re: Products that can only be purchased once.

    Well this is certainly frustrating....

    With either of the codes you've provided, when installed....I can confirm that it does indeed make the selected products a "buy once" feature.

    However, it also causes a blank page to display whenever a user creates a new account or tries to log into an existing one.

    *Launches Distress Flare*

    Any and all assistance is appreciated, this is outside of my knowledge.

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

    Default Re: Products that can only be purchased once.

    If in v1.3.9 ... check your /cache for error logs ...

    If not in v1.3.9 ... get the Debug Tool from the Free Software Add Ons and see what error message you are getting ...
    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 2010
    Posts
    59
    Plugin Contributions
    0

    Default Re: Products that can only be purchased once.

    Problem Solved -

    Initially, I had used your category code twice with different ID's. I did not use an array as suggested.

    The second time I had put the code in the wrong line and therefore caused some syntax errors with php.

    Finally, Using the product ID code with what you wrote worked. I guess I was a bit fatigued yesterday.

    So, for anyone else looking to do the same, listen to Ajeh! and don't try to do your own thing like I did. It will only humble you.

    Thanks Ajeh for your continued patience with me....

    Jonah

  7. #17
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Products that can only be purchased once.

    Glad to hear that this is now working for you ...
    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!

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v155 Also Purchased only shows 56 items once I upgrade to 1.5.5a
    By Kyle Rogers in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 4 Aug 2016, 10:16 PM
  2. v154 Products that can't be purchased with vouchers
    By kalastaja in forum General Questions
    Replies: 3
    Last Post: 15 Mar 2015, 04:54 PM
  3. v151 Options that add on once, even if multiple products added
    By val-ent in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 31 Jan 2013, 08:27 PM
  4. Replies: 0
    Last Post: 14 Nov 2011, 07:49 PM
  5. Limit number of products that can be purchased
    By USONE in forum General Questions
    Replies: 3
    Last Post: 24 Aug 2010, 09:18 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