Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Disbale COD with shipping

Disbale COD with shipping

Views: 1,076

Results 1 to 7 of 7
21 Oct 2013, 7:05 AM
#1
mpforum avatar

mpforum

New Zenner

Join Date:
Jul 2009
Location:
Coffs Harbour, Australia
Posts:
74
Plugin Contributions:
0

Disbale COD with shipping

Hi all,

Been playing with a bit of code and am more than a little frustrated right at this point.

This is the code that I have added into the cod.php file:

// disable this module if shipping is not walk in

if ($this->order['shipping'] == walk-in) {
	$this->enabled = true;

}

I'm assuming that the problem is 'shipping', but is that's not the correct syntax, can anyone head me in the right direction?

Thanks in advance,
Dean.

22 Oct 2013, 4:05 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Disbale COD with shipping

Edit the file:
/includes/modules/payment/cod.php

and in the function update_status, add the code in RED:

// disable the module if the order only contains virtual products
      if ($this->enabled == true) {
        if ($order->content_type != 'physical') {
          $this->enabled = false;
        }
      }
[B]// bof: disable cod on store pickup
        if (preg_match('#storepickup#i', $_SESSION[shipping][id])) {
          $this->enabled = false;
        }
// eof: disable cod on store pickup
[/B]    }

    function javascript_validation() {
22 Oct 2013, 4:07 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Disbale COD with shipping

Oops ... you said disable if NOT store pickup ... I wrote that backwards ... :lookaroun

Change the IF to read:

// bof: disable cod on store pickup
        if ([B]![/B]preg_match('#storepickup#i', $_SESSION[shipping][id])) {
          $this->enabled = false;
        }
// eof: disable cod on store pickup
7 Jan 2014, 11:39 AM
#4
axeman avatar

axeman

New Zenner

Join Date:
Dec 2013
Location:
Southampton, UK
Posts:
51
Plugin Contributions:
0

Re: Disbale COD with shipping

I have a similar situation only mine is with hiding unecessary shipping options from customers. For example, I am offering UK delivery and yet the Zone Rates delivery option is showing and saying that we are not shipping to the specified country. This is leading to confusion among some of our customers. I refer you to the screenshot:

Attachment 13640

I need to hide the Zone Rates option as this does not apply to UK customers. I have also had to clone the flat rate module 12 times and create 12 new custom local shipping zones in order to accomodate specific areas that my business delivers to using our own delivery service as well as 12 cloned COD modules in order to allow for these zones. I would like the shipping options page to only display the free local delivery to customers that fall into that zone. You can see that the table rate is showing when it is pointless. Who in their right mind is going to pay for a free delivery service? :laugh:

My question is how can I hide the Zone Rate shipping when it does not apply to UK shipping and how can I hide all other shipping for local free delivery customers?

Any help would be very greatly appreciated.

7 Jan 2014, 12:03 PM
#5
axeman avatar

axeman

New Zenner

Join Date:
Dec 2013
Location:
Southampton, UK
Posts:
51
Plugin Contributions:
0

Re: Disbale COD with shipping

I have been looking at the coding of Zone Rate and I have noticed this piece of coding:

// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
}

Can this be used for disabling other Zone Rate shipping if my local delivery option is enabled or am I barking up the wrong tree?

7 Jan 2014, 1:37 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Disbale COD with shipping

What version of Zen Cart are you using?

Could you go to the Modules ... Shipping ... and Click on Zone Rate zones in your Zen Cart Admin and post what your settings are in the right hand panel?

8 Jan 2014, 4:53 PM
#7
axeman avatar

axeman

New Zenner

Join Date:
Dec 2013
Location:
Southampton, UK
Posts:
51
Plugin Contributions:
0

Re: Disbale COD with shipping

Hi Ajey. I am using 1.5.1. A snapshot is included:

Attachment 13648