Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2009
    Posts
    23
    Plugin Contributions
    0

    Default How do I disable paypal if another shipping method is selected?

    Hi all!

    Can you please tell me what code i need to insert into some files (im using zencart 1.38a, paypal website standards) if i want to
    Disable paypal from paying methods if the user chooses CASH ON DELIVERY... ?!

    Its quite embarassing that when somebody choose COD he has to pay with paypal, because they want to pay at the post office.

    Please help!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How to disable paypal if another shipping method is selected?!

    No link so I am guessing - -

    Enable the Cash on Delivery method in admin > modules > payment

  3. #3
    Join Date
    Mar 2009
    Posts
    23
    Plugin Contributions
    0

    Default Re: How to disable paypal if another shipping method is selected?!

    Lol thanks.... i had to rewrite a shipping method to COD because somehow i didnt uploaded my COD modul. thanks!

  4. #4
    Join Date
    Mar 2009
    Posts
    23
    Plugin Contributions
    0

    Default Disable Paypal

    Hello!

    I noticed that 17 people read my article and no one could hep so i try to solve the problem in another way.

    I've found in an article that i can disable paypal payment if a customer reaches a certain amount, so i think i can disable paypal if a customer selects a certain shipping method like, item,table and other shipping methods by changing the $_SESSION['cart']->total > 900 to the variable name of the shipping method

    paypal.php
    Code:
    if (IS_ADMIN_FLAG === false && $_SESSION['cart']->total > 900) {
          $this->enabled = false;
    Now i only want to know what are the variable names for the shipping methods. My code should look like:

    Code:
    if (IS_ADMIN_FLAG === false && $_SESSION['shipping_method'] == "freeoptions" || $_SESSION['shipping_method'] == "table" || $_SESSION['shipping_method'] == "item") {
          $this->enabled = false;
    please somebody give me the variable names, or give me where can i look after them.

  5. #5
    Join Date
    Mar 2009
    Posts
    23
    Plugin Contributions
    0

    Default Disable Paypal for certain Shipping method

    Hello!

    I noticed that 17 people read my article and no one could hep so i try to solve the problem in another way.

    I've found in an article that i can disable paypal payment if a customer reaches a certain amount, so i think i can disable paypal if a customer selects a certain shipping method like, item,table and other shipping methods by changing the code in paypal.php


    paypal.php


    Code:
    if (IS_ADMIN_FLAG === false && $_SESSION['cart']->total > 900) {
          $this->enabled = false;
    The code above is working, so i only need to replace the $_SESSION['cart']->total > 900 to the right variable
    like $_SESSION['shipping_method']->title == "item" or $_SESSION['shipping_metgod'] == "perunit"


    my code should look like this

    Code:
    if (IS_ADMIN_FLAG === false && $_SESSION['shipping_method'] == "freeoptions" || $_SESSION['shipping_method'] == "table" || $_SESSION['shipping_method'] == "item") {
          $this->enabled = false;

    please tell me the variable names for shipping methods!

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

    Default Re: How to disable paypal if another shipping method is selected?!

    Using the:
    $_SESSION['shipping']['id']

    will give you the shipping ...

    Do a test and echo that out on the checkout_payment page for the various methods as you will find that the names will be a tad odd ...

    /includes/modules/order_total/ot_cod_fee.php

    shows the use of this for many of the shipping methods but again watch for how it is used to identify them ...

    Specific shipping methods for things like USPS and UPS are even more fun ...
    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!

  7. #7
    Join Date
    Mar 2009
    Posts
    23
    Plugin Contributions
    0

    Default Re: How to disable paypal if another shipping method is selected?!

    WOW!!! IT worked !!!! Thank you very much!!

    For people who don't understand:

    go to includes/modules/pages/checkout_payment/header_php.php

    then you will find some line:

    Code:
    // Load the selected shipping module(needed to calculate tax correctly)
    require(DIR_WS_CLASSES . 'shipping.php');
    $shipping_modules = new shipping($_SESSION['shipping']);
    require(DIR_WS_CLASSES . 'order_total.php');
    $order_total_modules = new order_total;
    $order_total_modules->collect_posts();
    $order_total_modules->pre_confirmation_check();
    put this code after the above code:

    Code:
    echo $_SESSION['shipping']['id'];
    and go to your page make a checkout and you can see the ID of the shipping method at the top of your page, after you saved the ids you can delete this

    then go to paypal.php and edit the code to:

    Code:
    if (PROJECT_VERSION_MAJOR != '1' && substr(PROJECT_VERSION_MINOR, 0, 3) != '3.8') $this->enabled = false;
    	//This is where you disable paypal
    	if (IS_ADMIN_FLAG === false && $_SESSION['shipping']['id'] == "HERE_COMES_THE_ID_LIKE: FLAT_FLAT" || $_SESSION['shipping']['id'] == "storepickup_storepickup" ) {
          $this->enabled = false;
        }
    And it works! THanks!:) <3

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

    Default Re: How do I disable paypal if another shipping method is selected?

    Thanks for the update that this worked for you and for posting the step by step on the testing and helping to understand that concept ...

    The "echo" can be your best friend ...
    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!

  9. #9
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,840
    Plugin Contributions
    31

    Default Re: How do I disable paypal if another shipping method is selected?

    Hi,
    firstly very useful post.

    An observation for the nit pickers is that adding the code
    echo $_SESSION['shipping']['id'];
    causes the font size on that payment options page to "go large" in all browsers except Firefox. Why would it do that?

    regards
    Steve

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

    Default Re: How do I disable paypal if another shipping method is selected?

    You are tossing out an echo with no regard to html/css format and making a mess ... such is the life of an elf ...
    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!

 

 

Similar Threads

  1. v151 Disable a payment method for a chosen shipping method?
    By chowyungunz in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 12 Jun 2015, 12:56 PM
  2. Set default selected shipping method
    By DigitalShadow in forum General Questions
    Replies: 9
    Last Post: 31 Oct 2013, 03:24 AM
  3. Disable shipping table on selected products
    By Nick1973 in forum Addon Shipping Modules
    Replies: 3
    Last Post: 22 Aug 2012, 03:57 PM
  4. No shipping method selected notification
    By moosesoom in forum Addon Shipping Modules
    Replies: 3
    Last Post: 15 Feb 2012, 12:18 AM
  5. How to allow selection of another shipment method when shipping is free?
    By ronwong in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 9 Jun 2006, 06:41 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