Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Conditional shipping option?

Conditional shipping option?

Views: 6,197

Results 41 to 60 of 64
19 Nov 2013, 3:24 PM
#41
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Conditional shipping option?

It does seem to be working, but I noticed a side effect. For a domestic customer, the FedEx option is showing up on the checkout page. It has no price, its just the text that reads " FedEx (1 x 0.66lbs)" FedEx is only used for International shipping and should never appear for Domestic.

I backed out the and $rates[$i]['module'] != 'usps') or $size == 1 change and it persists, so it was apparently introduced with previous changes.

19 Nov 2013, 3:30 PM
#42
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

If you go to Modules ... Shipping ... and look in the right hand panel for FedEx fedexwebservices ... what do you see?

19 Nov 2013, 3:43 PM
#43
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

I see the green enabled circle and a sort value of 10. The only other ship module enabled is USPS and it has a sort value of 20.

19 Nov 2013, 3:50 PM
#44
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

When clicked on the FedEx fedexwebservices, in the right hand column is a long list of settings ... could you post that?

19 Nov 2013, 3:57 PM
#45
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

Enable FedEx Web Services
true

FedEx Account Number
ZZZZZZZZZ

FedEx Meter Number
XXXXXXXX

Weight Units
LB

First line of street address
100 G Steet

Second line of street address

City name
Vegas

State or Province name
TX

Postal code
77777

Phone number
1112223333

Drop off type
1

Enable Express Saver
false

Enable Standard Overnight
false

Enable First Overnight
false

Enable Priority Overnight
false

Enable 2 Day
false

Enable International Priority
true

Enable International Economy
false

Enable Ground
false

Enable International Ground
false

Enable Freight
false

Tax Class
--none--

Handling Fee
1

Shipping Zone
--none--

Sort Order
10

19 Nov 2013, 4:13 PM
#46
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

Here is the checkout page showing the FedEx appearing for Domestic orders

Attachment 13372

19 Nov 2013, 4:18 PM
#47
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

What version of FedEx fedexwebservices are you running>

If you customize the fedexwebservices.php and add the code in RED:

[B]        if (sizeof($methods) == 0) return false;
[/B]        $this->quotes['methods'] = $methods;
        if ($this->tax_class > 0) {

does it fix this issue?

19 Nov 2013, 4:45 PM
#48
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

In looking at the admin panel and the shipping modules page, I noticed the error message:
ERROR: module not loaded due to missing language file:/includes/languages/english/modules/shipping/usps_xx.php

At some point I had renamed the usps.php file to usps_xx.php, as a way to make a copy. Somehow, Zen now thinks that the file is called usps_xx. I'm at a loss to understand how this has happened. I'm sure it is something I did some time ago.
Its may be unrelated to this issue, I'm not sure.

The webservices module does not appear to have a version number. But I believe it is 1.3.2

19 Nov 2013, 4:49 PM
#49
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

When renaming modules, you cannot leave them with the .php extension as those are auto loading directories ... instead ues something like:
usps.php_xx

now it will not auto load ...

19 Nov 2013, 4:49 PM
#50
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

If I had to guess, I would say this problem was introduced when the new rate module was released for USPS

*USPS Module for Zen Cart v1.3.x thru v1.6

  • USPS RateV4 Intl RateV2 - January 28, 2013 Updates to: July 28, 2013 Version J*
19 Nov 2013, 4:51 PM
#51
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

split63:

The webservices module does not appear to have a version number. But I believe it is 1.3.2

The current FedEx from numinix's site is Version: 1.4.5 ... you should really consider upgrading to that ...

19 Nov 2013, 5:05 PM
#52
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

Ajeh:

What version of FedEx fedexwebservices are you running>

If you customize the fedexwebservices.php and add the code in RED:

[B] if (sizeof($methods) == 0) return false;
[/B] $this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {

> 
> does it fix this issue?

Yes, it did fix the issue.
I will look into to updating the webservices modules
19 Nov 2013, 5:12 PM
#53
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

Thanks for the update that this worked for you ...

It was a good catch to run into this in FedEx as I see FedEx needs this extra code for the:

[B]        if (sizeof($methods) == 0) return false;
[/B]        $this->quotes['methods'] = $methods;

as well as UPS ... it only happens when the configuration has settings that result in no quotes such as configuring the shipping module to only show for National or International shipping but not both or when the selected options all result in no quote ...

USPS already has this code in it in the July 28, 2013 J5 release so that one does not run into this issue ...

7 Jan 2014, 3:57 AM
#54
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

Ajeh,

I had not noticed it, but the handling_fee which can be set in fedex webservices is no longer working. Not mater what value I set it to, it adds 0. There is likely an issue in your original suggested code modification. I have reposted it below.

Ajeh:

Try this ...

Customize the file:
/includes/modules/shipping/fedexwebservices.php

with the code in RED:

          $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                             'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime,
                             'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));

[B]$chk_cost = ($cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));
if ($_SESSION['usps_first_class'] == 0 || $chk_cost < $_SESSION['usps_first_class']) {
$_SESSION['usps_first_class'] = $chk_cost;
}
//echo 'FedEx Cost Calc: ' . $chk_cost . ' $_SESSION[usps_first_class]: ' . $_SESSION['usps_first_class'] . '<br><br>';
// bof: check FedEx for > 40.00
[/B]
}
}
}
$this->quotes['methods'] = $methods;

7 Jan 2014, 2:01 PM
#55
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

Could you Zip your files:
/includes/modules/shipping/fedexwebservices.php
/includes/modules/shipping/usps.php

and post them?

I am not seeing the conflict on the handling fee off the top of my head ...

7 Jan 2014, 2:39 PM
#57
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

I do not recognize this version of:
fedexwebservices.php

where and when did you get the original version of this?

7 Jan 2014, 2:48 PM
#58
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Conditional shipping option?

Hard to say. The files are not internally dated or versioned.
I do know that prior to the conditional shipping changes the handling charge was working.

There is a newer version of fedexwebservices, but I have not upgraded to it because the current version has worked fine. Plus I did not want to have to port the changes made to the current file to the new version. It seemed potentially like a lot of pain for no gain.

7 Jan 2014, 4:04 PM
#59
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

I really don't know how this ever worked ...

From the looks of this code, you only have one setting on the Handling Fee and not a number of them, correct?

If so, see what happens if you use this for the $methods[]:

             $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                                 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime,
                                 'cost' => $cost + ( strpos(MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE, '%') ? ($cost * (float)MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE / 100) : (float)MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE) );
8 Jan 2014, 2:05 AM
#60
ajeh avatar

ajeh

Oba-san

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

Re: Conditional shipping option?

I am not sure how that change for USPS affected FedEx, but that fix for the FedEx is an educated guess as I really cannot run that code to test it ... :smile: