Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 47
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,672
    Plugin Contributions
    6

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    See post #15 for how to do this ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  2. #22
    Join Date
    Jan 2009
    Posts
    2,076
    Plugin Contributions
    0

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    If you're still watching this Ajeh, I have a quick question for you.

    This works a treat when I just want PayPal to show when only product ID 1395 is in the cart and nothing else:
    PHP Code:
    if (!IS_ADMIN_FLAG) {
      
    // disable, (even when admin has it switched on):
      
    $this->enabled false;
      global 
    $cart;
      if (
    $_SESSION['cart']->in_cart_check('products_id','1395') > && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')) {
        
    $this->enabled true;
      }

    How would I tweak this code so that PayPal becomes an option when product ID 1395 is in the cart and any other product is also in the cart alongside it?

  3. #23
    Join Date
    Jan 2004
    Posts
    58,246
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    Quote Originally Posted by limelites View Post
    If you're still watching this Ajeh, I have a quick question for you.

    This works a treat when I just want PayPal to show when only product ID 1395 is in the cart and nothing else:
    PHP Code:
    if (!IS_ADMIN_FLAG) {
      
    // disable, (even when admin has it switched on):
      
    $this->enabled false;
      global 
    $cart;
      if (
    $_SESSION['cart']->in_cart_check('products_id','1395') > && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')) {
        
    $this->enabled true;
      }

    How would I tweak this code so that PayPal becomes an option when product ID 1395 is in the cart and any other product is also in the cart alongside it?
    This part, when added in conjunction with the first half of the conditions, forces that the ONLY thing in the cart is that product number; so remove it if you don't care what else is in the cart with it:
    Code:
    && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #24
    Join Date
    Jan 2009
    Posts
    2,076
    Plugin Contributions
    0

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    I think I may have figured it out. I just changed this:
    PHP Code:
      if ($_SESSION['cart']->in_cart_check('products_id','1395') > && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')) { 
    To this:
    PHP Code:
      if ($_SESSION['cart']->in_cart_check('products_id','1395') > ) { 

  5. #25
    Join Date
    Jan 2009
    Posts
    2,076
    Plugin Contributions
    0

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    I'd like to take this in a slightly different direction by changing the logic to a customer ID instead of a product ID. What would I need to change this to?

    if ($_SESSION['cart']->in_cart_check('products_id','6251') > 0 ) {

  6. #26
    Join Date
    Jan 2004
    Posts
    58,246
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    The logged-in customer number is in $_SESSION['customer_id']. Check against that.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #27
    Join Date
    Jan 2009
    Posts
    2,076
    Plugin Contributions
    0

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    Quote Originally Posted by DrByte View Post
    The logged-in customer number is in $_SESSION['customer_id']. Check against that.
    Thank you Dr. Byte. I'm afraid the syntax and the general terms just let me down every time. I've no idea how to write it. This would probably just white screen the site:

    if ($_SESSION['cart']->in_cart_check('customer_id','') = 4959 ) {


    What do you change 'cart' to and what do you change ->in_cart_check to and I'm guessing the ('customer_id','') = 4959 is probably wrong too? I don't know how you gurus just know all that stuff :)

  8. #28
    Join Date
    Jan 2004
    Posts
    58,246
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    Forget any of the previous code posted. Instead, please write in english the logic you want turned into code. What do you want to do and why?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #29
    Join Date
    Jan 2009
    Posts
    2,076
    Plugin Contributions
    0

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    If user ID (or is it customer ID) is logged into her account then enable the PayPal payment module for her. Her customer ID is 4959

    We don't like to take PayPal but on special request we will take it. So, if a customer asks us to take PayPal then it's good to be able to switch it on for them only.

  10. #30
    Join Date
    Jan 2004
    Posts
    58,246
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Enable PayPal but Only when Product ID 1234 is in cart?

    Then change this (from your previous post awhile back):
    Code:
     if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 ) {  


    to this:

    PHP Code:
       if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0  || $_SESSION['customer_id'] == 4959) { 
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Can't Enable PayPal Express
    By pinksparklegirl in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 21 Aug 2011, 11:10 AM
  2. How to enable Paypal IPN for several zones?
    By cocolala in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 26 Dec 2010, 06:30 AM
  3. Paypal express won't enable
    By Javalin in forum Basic Configuration
    Replies: 3
    Last Post: 2 Sep 2010, 05:14 AM
  4. Add to end of order number ie 1234 - 2010
    By dropbop in forum General Questions
    Replies: 2
    Last Post: 6 Jan 2010, 12:23 AM
  5. Howto 1234 [Next>>] links at bottom of page
    By zoot in forum Customization from the Admin
    Replies: 3
    Last Post: 11 Nov 2006, 12:42 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
  •