Re: Conditional shipping option?
To change the USPS shipping module to show for ALL of the Ship To US and filter on the FedEx conditions, change the IF to read:
Code:
if ($this->usps_countries == 'US' || preg_match('#Priority Mail International#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40) {
Re: Conditional shipping option?
Quote:
Originally Posted by
Ajeh
To change the USPS shipping module to show for ALL of the Ship To US and filter on the FedEx conditions, change the IF to read:
Code:
if ($this->usps_countries == 'US' || preg_match('#Priority Mail International#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40) {
Ajeh,
I replaced the if statement in usps.php with the statement above and the USPS First Class is never displayed and no error is displayed.
Also, in the fedexwebservices.php, there is an extra } after the added code.
Re: Conditional shipping option?
I think I mis-understood you on what your were saying on Priority ...
If you want USPS International First Class only when FedEx is > 40.00 and for Domestic to show all USPS that you have selected, then use:
Code:
if ($this->usps_countries == 'US' || (preg_match('#(first-class)#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40)) {
I am not understanding what you are saying about the extra } in the FedEx code ... :lookaroun
Re: Conditional shipping option?
It seems to be working now. Thanks for hanging on with me here.
On the other issue:
Quote:
the message for USPS is:
United States Postal Service (First-Class Package International Service™)
How can I change this to:
United States Postal Service (First-Class 7-20 days)
Can a hyperlink be inserted into that text?
I just want a fixed text string as shown. The USPS international estimation is never right, since once it leaves the US, it takes on a whole new schedule governed by the destination country
Re: Conditional shipping option?
If you have the days set to Custom, you can set your own number of days for it on the First Class ...
Re: Conditional shipping option?
Quote:
Originally Posted by
Ajeh
You could use the CUSTOM setting:
and show the days by turning on the:
Then, in the function parseIntlTransitTimeResults($Package, $service) you will see where the days can be customized ...
Oddly enough it is already set to Custom and the "Display Transit time" is checked.
I searched and found the function mentioned in the usps.php file. But it was not obvious how to customize it.
Code:
function parseIntlTransitTimeResults($Package, $service) {
global $logfilename;
if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs') {
$fp = @fopen($logfilename, 'a');
}
if (isset($this->transittime[$service]) && $this->transittime[$service] == '' && preg_match('#(GXG|International)#i' , $service)) {
$time = $Package['SvcCommitments'];
$time = preg_replace('/Weeks$/', MODULE_SHIPPING_USPS_TEXT_WEEKS, $time);
$time = preg_replace('/Days$/', MODULE_SHIPPING_USPS_TEXT_DAYS, $time);
$time = preg_replace('/Day$/', MODULE_SHIPPING_USPS_TEXT_DAY, $time);
$this->transittime[$service] = $time == '' ? '' : ' (' . $time . ')';
}
// do logging if the file was opened earlier by the config switch
if ($fp) {
fwrite($fp, date('M d Y G:i:s') . ' -- Transit Time (Intl)' . "\nService: " . $service . "\nSvcCommitments (from USPS): " . $Package['SvcCommitments'] . "\n" . '$time (calculated): ' . $time . "\nTranslation: " . $this->transittime[$service] . "\n\n");
fclose($fp);
}
}
What is odd, is that the Priority mail transit time is shown, but the first class is not shown.
Re: Conditional shipping option?
Found this section. It does not seem to differentiate between Domestic and International.
First Class International shows no estimate.
Code:
/********************* CUSTOM START: IF YOU HAVE CUSTOM TRANSIT TIMES ENTER THEM HERE ***************/
switch (TRUE) {
case (preg_match('#Priority Mail Express#i', $service)):
$time = '1 - 2 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#Priority MailTM#i', $service)):
$time = '2 - 3 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#Standard PostRM#i', $service)):
$time = '4 - 7 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#First\-Class#i', $service)):
$time = '2 - 5 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#Media MailRM#i', $service)):
default:
$time = '';
/********************* CUSTOM END: IF YOU HAVE CUSTOM TRANSIT TIMES ENTER THEM HERE ***************/
Re: Conditional shipping option?
You might look for the International function for the displayed days:
function parseIntlTransitTimeResults($Package, $service) {
Re: Conditional shipping option?
I could be wrong, but maybe the problem is that there is no international equivalent of the custom replacement above.
The closest thing I could find is this, and I'm at a loss to understand what this even does.
Code:
if (isset($this->transittime[$service]) && $this->transittime[$service] == '' && preg_match('#(GXG|International)#i' , $service)) {
$time = $Package['SvcCommitments'];
$time = preg_replace('/Weeks$/', MODULE_SHIPPING_USPS_TEXT_WEEKS, $time);
$time = preg_replace('/Days$/', MODULE_SHIPPING_USPS_TEXT_DAYS, $time);
$time = preg_replace('/Day$/', MODULE_SHIPPING_USPS_TEXT_DAY, $time);
$this->transittime[$service] = $time == '' ? '' : ' (' . $time . ')';
}
Re: Conditional shipping option?
And if you just add the text in RED what happens:
Code:
switch (TRUE) {
/********************* CUSTOM START: IF YOU HAVE CUSTOM TRANSIT TIMES ENTER THEM HERE ***************/
case (preg_match('#Priority Mail Express#i', $service)):
$time = '3 - 5 business ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#Priority Mail#i', $service)):
$time = '6 - 10 business ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#Global Express Guaranteed#i', $service)):
$time = '1 - 3 business ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#USPS GXG.* Envelopes#i', $service)):
$time = '1 - 3 business ' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
case (preg_match('#First\-Class#i', $service)):
$time = 'Varies by destination 7-12 days'; // '' . MODULE_SHIPPING_USPS_TEXT_DAYS;
break;
default:
$time = '';