Forums / Built-in Shipping and Payment Modules / I want No PAYPAL for PARCEL POST shipping option.

I want No PAYPAL for PARCEL POST shipping option.

Locked

Views: 1,548

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
18 May 2008, 7:00 AM
#1
janks avatar

janks

New Zenner

Join Date:
May 2006
Posts:
30
Plugin Contributions:
1

I want No PAYPAL for PARCEL POST shipping option.

Hi Everyone,
Was wondering if someone could help me out with a small problem i cant work out.

I want to disable paypal for one shipping type only.
Is there a way to do this simply or will i have to mod some php??

https://www.glossi.com.au

Also some constructive criticism always goes a long way.

-Jai

18 May 2008, 7:14 AM
#2
janks avatar

janks

New Zenner

Join Date:
May 2006
Posts:
30
Plugin Contributions:
1

Re: I want No PAYPAL for PARCEL POST shipping option.

The line i'm looking at in the paypal module is

$this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);

just a little unsure what to do with it

18 May 2008, 9:45 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: I want No PAYPAL for PARCEL POST shipping option.

In that same file, a few lines lower, is a function for update_status(). Add your shipping-module check there by adding the new code shown:```
function update_status() {
global $order, $db;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
  $check_flag = false;
  $check_query = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  while (!$check_query->EOF) {
    if ($check_query->fields['zone_id'] < 1) {
      $check_flag = true;
      break;
    } elseif ($check_query->fields['zone_id'] == $order->billing['zone_id']) {
      $check_flag = true;
      break;
    }
    $check_query->MoveNext();
  }

[B] // disable for certain shipping module only:
if ($_SESSION['shipping'] == 'name_of_code_from_shipping_module') $check_flag = false;
[/B]
if ($check_flag == false) {
$this->enabled = false;
}
}
}

Granted, if your shipping module generates various different $_SESSION['shipping'] values depending on which offered service the customer selects, you may have to alter the logic in that "if" statement to accomodate.

.
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.

18 May 2008, 10:42 AM
#4
janks avatar

janks

New Zenner

Join Date:
May 2006
Posts:
30
Plugin Contributions:
1

Re: I want No PAYPAL for PARCEL POST shipping option.

Thanks for the reply DrByte.

I am slightly understanding these functions, and this is the following code i have.

  
    function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
      $check_flag = false;
      $check_query = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
      while (!$check_query->EOF) {
        if ($check_query->fields['zone_id'] < 1) {
          $check_flag = true;
          break;
        } elseif ($check_query->fields['zone_id'] == $order->billing['zone_id']) {
          $check_flag = true;
          break;
        }
        $check_query->MoveNext();
      }

      // disable for certain shipping module only:
      if ($_SESSION['shipping'] == 'auspost') $check_flag = false;

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }

But for some reason, the paypal module is still showing up after i click continue with "auspost" selected.