Forums / Built-in Shipping and Payment Modules / Canada free local ship else flat rate

Canada free local ship else flat rate

Views: 6,478

Results 41 to 60 of 67
2 May 2014, 12:24 AM
#41
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Canada free local ship else flat rate

Just combed through it all again to ensure I hadn't made any mistakes.

FYI the test customer has an addressbook entry for Cornwall, Ottawa(nearby city within Ontario) and Montreal(out of province).

Code is there where you asked...Still doesn't work.

2 May 2014, 2:08 AM
#42
drbyte avatar

drbyte

Sensei

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

Re: Canada free local ship else flat rate

plc613:

To be clear, you're asking me to create a zone definition only and it will therefore show as zone defined but no tax rate?
Yes. To clarify, zones can be used for multiple things, could be for taxes, or shipping, or both, or even other things. Sometimes creating an extra zone definition for a specific purpose can help isolate issues.
Ajeh's suggestion of creating a new zone specific to this free shipping case allows the bulk of the normal code to isolate it to only Ontario as a whole. And then the custom code she offered is intended to check whether the city the customer entered specifically matches "cornwall" regardless of upper/lowercase, and to only activate when that combination occurs.

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

2 May 2014, 2:19 AM
#43
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

I had to clarify because that was one of the first things we did back in page 2. Are we 100% certain that code is right? ....I must be misunderstanding something.

2 May 2014, 12:58 PM
#44
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Let's start with commenting out the code:

// bof: check for CORNWALL
if ($check_flag == true) {
  if (strtoupper($order->delivery['delivery_city']) != 'CORNWALL') {
[B]//[/B]    $check_flag = false;
  }
}
// eof: check for CORNWALL

the comment marks will let the Free Shipping Options freeoptions run for everywhere ...

With that commented out, does it show at the same time as Flat Rate flat?

If so, go to the Zone Definitions and go to the DETAILS ...

What is set on this Zone Definition DETAILS that you have been using for this Zone?

Do you see:
Country: Canada
Zone: Ontario

Next, uncomment the code in Free Shipping Options freeoptions ...

Now create a test customer with the right address ... what are you using for the address?

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!

2 May 2014, 2:29 PM
#45
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Ajeh:

Let's start with commenting out the code:

// bof: check for CORNWALL
if ($check_flag == true) {
if (strtoupper($order->delivery['delivery_city']) != 'CORNWALL') {
[B]//[/B] $check_flag = false;
}
}
// eof: check for CORNWALL

done.

> **Ajeh:**
>
> the comment marks will let the Free Shipping Options freeoptions run for everywhere ...
> 
> With that commented out, does it show at the same time as Flat Rate flat?
> 
> If so, go to the Zone Definitions and go to the DETAILS ...
> 
> What is set on this Zone Definition DETAILS that you have been using for this Zone?
> 
> Do you see:
> Country: Canada
> Zone: Ontario

Correct, yes.

> **Ajeh:**
>
> Next, uncomment the code in Free Shipping Options freeoptions ...
> 
> Now create a test customer with the right address ... what are you using for the address?

Getting Closer. I see both for all of Ontario not just Cornwall. If I choose an out of province address in the addressbook the free option disappears. So we're certainly closer but have not successfully isolated the city.
2 May 2014, 2:51 PM
#46
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Eekks! How totally embarrassing ... :blush:

Could you try this code in Free Shipping Options freeoptions with the City addressed correctly ...

// bof: check for CORNWALL
if ($check_flag == true) {
  if (strtoupper([B]$order->delivery['city'][/B]) != 'CORNWALL') {
    $check_flag = false;
  }
}
// eof: check for CORNWALL

Talk about humbling moments ... :lookaroun

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!

2 May 2014, 3:34 PM
#47
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Not to worry...I've made my fair share of similar mistakes.

The correction didn't seem to change anything though. Free Shipping is still offered to all of Ontario and not just Cornwall.

2 May 2014, 3:35 PM
#48
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Oh...Hold the phone!

2 May 2014, 3:38 PM
#49
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

The eagle has landed! Since there was a correction, I thought your initial instinct was probably correct and you were just second-guessing yourself in post #45:

// $check_flag = false;

So reenabling that now shows the free option solely to residents with a Cornwall address!

2 May 2014, 3:40 PM
#50
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Yes! finally! silly coding issues ... :cool:

Thanks for the update that this is now working correctly for you ... :smile:

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!

2 May 2014, 3:41 PM
#51
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Thank you so much for your dedication in making this work. I appreciate it.

2 May 2014, 3:56 PM
#52
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Remember the Zen Cart Team when you are rich and famous ... :cool:

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!

2 May 2014, 11:18 PM
#53
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Yeah I'm sure that'll happen real soon ;)

I forgot to ask, the freeoptions module doesn't support overrides does it?

3 May 2014, 12:53 AM
#54
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

No the modules do not have override files for the code ...

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!

3 May 2014, 1:02 AM
#55
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

So should I add 'overrides to shipping modules' OR 'per city free shipping toggle in config' to the wish list?

3 May 2014, 1:02 PM
#56
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Nope ... Payment, Shipping and Order Total modules do not get overrides ...

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!

3 May 2014, 1:23 PM
#57
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Fair enough. I imagine there's good reason for that. So it would need to be hardcoded as a variable that would be set via admin.

3 May 2014, 1:40 PM
#58
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

You could hardcode it as a constant if that is something that needs to be changed often, or just edit the file and change it ...

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!

3 May 2014, 1:45 PM
#59
plc613 avatar

plc613

Zen Follower

Join Date:
Apr 2014
Location:
Canada
Posts:
249
Plugin Contributions:
0

Re: Canada free local ship else flat rate

Well, I've git my fix but I'm just thinking if others want the same it would be a good feature to add to admin. Surely others have/will want this?

3 May 2014, 2:11 PM
#60
ajeh avatar

ajeh

Oba-san

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

Re: Canada free local ship else flat rate

Always a possibility ...

If I were to make this an add-on, I would create a clone of Free Shipping Options freeoptions and add a new key to it for something such as clone it to be:
freeoptionscity.php

and add a new key to the module for:
MODULE_SHIPPING_FREEOPTIONSCITY_CITY

but then customize it to be able to have 1 to many cities, as some might want more than one city to have the Free Shipping ...

There are a lot of possibilities ...

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!