Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 47
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    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.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
    Jan 2009
    Posts
    2,123
    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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,123
    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,123
    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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,123
    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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,123
    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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. disable flat rate shipping for paypal only (but enable for googlecheckout)
    By btman in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 14 Jul 2009, 05:51 AM
  2. When I enable Featured products, only one product is displayed.
    By creativearc in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 6 May 2008, 01:30 AM
  3. Product info shifts left when mouse over nav buttons, but only in IE !
    By bigbadbob in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 1 Mar 2008, 08:32 AM
  4. Show quantity in cart only when the product is already in shopping cart
    By e81ny in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 8 Sep 2007, 03:34 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