Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Can I restrict certain payment methods for certain products?

    Thanks for the update that this is 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: v1.5.5]
    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. #22
    Join Date
    Apr 2008
    Location
    Athlone, Ireland
    Posts
    176
    Plugin Contributions
    5

    Default Re: Can I restrict certain payment methods for certain products?

    ok, i know this is an old thread, but it may be exactly the thing I need.

    I have test the above code and it works like a charm, but the way it is, its not really any use to me. (not on this project anyway, but will be for others)

    What I am wondering is, instead of setting it for one product ID, is it possible to set it for a range of product IDs.

    So instead of this:
    Code:
    if ($_SESSION['cart']->in_cart_check('products_id','12') > 0) {
              $this->enabled = false;
    is it possible to do soemthing like this

    Code:
    if ($_SESSION['cart']->in_cart_check('products_id','1 - 1000') > 0) {
              $this->enabled = false;
    I know thats not the way its done, but thought by givig a visual it might help someone to understand what im looking for, because I know im really bad at explaining things. lol

    Thanks

    DB

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

    Default Re: Can I restrict certain payment methods for certain products?

    $_SESSION['cart']->in_cart_check will check for information from the products table ...

    You can check for the master_categories_id which is useful for a Category of Products where all Products are using the same Category ...

    Can you give more details about what you are trying to do?
    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: v1.5.5]
    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. #24
    Join Date
    Apr 2008
    Location
    Athlone, Ireland
    Posts
    176
    Plugin Contributions
    5

    Default Re: Can I restrict certain payment methods for certain products?

    Quote Originally Posted by Ajeh View Post
    $_SESSION['cart']->in_cart_check will check for information from the products table ...

    You can check for the master_categories_id which is useful for a Category of Products where all Products are using the same Category ...

    Can you give more details about what you are trying to do?
    Disabling a payment module using the master category id has done the trick.

    This is what I have done using the check/money order module as a test point:

    Code:
    // disable if categories  1, 2, 3, 4 if in the cart
          if ($_SESSION['cart']->in_cart_check('master_categories_id',"1") > 0) {
              $this->enabled = false;
          }
    	  
    	  if ($_SESSION['cart']->in_cart_check('master_categories_id',"2") > 0) {
              $this->enabled = false;
          }
    	  
    	  if ($_SESSION['cart']->in_cart_check('master_categories_id',"3") > 0) {
              $this->enabled = false;
          }
    	  
    	  if ($_SESSION['cart']->in_cart_check('master_categories_id',"4") > 0) {
              $this->enabled = false;
          }
    
        }
    It seems to work, but not sure if its a bit long-winded.

  5. #25
    Join Date
    Apr 2008
    Location
    Athlone, Ireland
    Posts
    176
    Plugin Contributions
    5

    Default Re: Can I restrict certain payment methods for certain products?

    Just tried it on the Alertpay payment module and it doesnt work

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

    Default Re: Can I restrict certain payment methods for certain products?

    Where do you have the code?

    You are showing an extra closing bracket but not what it is balanced against ...

    Have you checked your Products to ensure what categories_id is used for the master_categories_id?

    Do you have a:
    global $cart;

    above the testing?
    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: v1.5.5]
    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!

  7. #27
    Join Date
    Apr 2008
    Location
    Athlone, Ireland
    Posts
    176
    Plugin Contributions
    5

    Default Re: Can I restrict certain payment methods for certain products?

    Thanks for the reply Linda, much appreciated.

    I have it working now. I prefer to use the older Alertpay 1.1 payment module because its the only one that doesnt usually through up any problems. But I popped the 1.3 version over to the cart and added the code to it and it worked just fine.. must be just the old module that didnt want to play nice with me. Although, I have looked through it a good bit and still cant see how it would not disable because everything seemd to look just as most other payment modules do for the first part up to about here --if ($check_flag == false) {--.

    Anyway, its working just the way I want now, so big thanks for posting the code back in early 2009. Im sure there are many people who have benifited from it. :)

    All the best, and thanks again for your replies.

    DB

  8. #28
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Can I restrict certain payment methods for certain products?

    Thanks for the update that you have this working now ...
    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: v1.5.5]
    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 3 of 3 FirstFirst 123

Similar Threads

  1. v150 Restrict certain products to certain postcodes
    By mattys in forum General Questions
    Replies: 9
    Last Post: 20 Jul 2013, 07:27 PM
  2. v151 Can I restrict certain shipping modules for certain products?
    By gumboot in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 13 Feb 2013, 05:26 AM
  3. Restrict Payment Types for certain products?
    By cjcraven in forum Managing Customers and Orders
    Replies: 3
    Last Post: 12 May 2011, 03:52 PM
  4. restrict shipping certain products to certain states?
    By airtime in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 18 Jan 2011, 05:11 AM
  5. How to disable certain payment methods for certain products?
    By AccurateOptics in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 29 Mar 2007, 06:53 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