-
USPS Question
Hey guys,
I just have one quick question!
I made a store for someone in the US and I'm located in Ireland. They use UPS for all US orders and USPS for everyone else. When I check how much it is to ship to Ireland its always $25.95 no matter what weight. This is using flat rate envelope. Is this due to zen-cart knowing if they'll actually fit. If so should I disable using this carrier method?
Thanks!
-
Re: USPS Question
That is the same quote USPS gives ... up to about 65 or so pounds ...
However, there is nothing in Zen Cart to manage dimensions ... so that can be an issue ...
-
Re: USPS Question
Thanks for the reply Linda! (nice irish name btw :smile: )
Just one more question. Is there any code I can add to the usps module that checks if there is a product from I.D 11 and 12 (in my case) and automatically gets rid of Express Mail International flat rate envelope from the list of available shipping methods?
I tried one from this site but it didnt work.
Thanks a million!
-
Re: USPS Question
A products_id 11 and 12 or something from a categories_id 11 and 12 and if a categories_id are those the master_categories_id?
-
Re: USPS Question
It's the top categories.
http://img96.imageshack.us/img96/6953/65440192.jpg
Here's a picture to help!
Thanks
-
Re: USPS Question
You would add the code to:
Code:
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
global $cart;
// $chk_cats = $_SESSION['cart']->in_cart_check('master_categories_id','11') + $_SESSION['cart']->in_cart_check('master_categories_id','12');
echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
if ($type == 'Express Mail International (EMS) Flat-Rate Envelope' && $chk_cats > 0) {
// skip shipping
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
}
The commented echo is if you need to see the name of the shipping type for testing other settings ... just uncomment and it will display on the shipping ... note: it will look pretty ugly but it is helpful ... :smile:
-
Re: USPS Question
I'm a PHP retard so excuse the stupidity! When I put the code into usps.php this came up on top of the site.
shipping Global Express Guaranteed chk_cats:
shipping Express Mail International (EMS) chk_cats:
shipping Express Mail International (EMS) Flat-Rate Envelope chk_cats:
shipping Priority Mail International chk_cats:
shipping Priority Mail International Flat-Rate Envelope chk_cats:
shipping First Class Mail International Large Envelope chk_cats:
I thought it only comes up if I remove the // from the code?
Thanks again!
-
Re: USPS Question
sorry ... that was me ... :blink:
change where the // comment mark is ... silly me ... :cool:
Code:
$chk_cats = $_SESSION['cart']->in_cart_check('master_categories_id','11') + $_SESSION['cart']->in_cart_check('master_categories_id','12');
// echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
-
Re: USPS Question
Thanks for this Ajeh.
Just one more question. The code is fine the way it is but is there any way to get rid of Express Mail International (EMS) Flat-Rate Envelope and Priority Mail International Flat-Rate Envelope for all products in ID 11 and 12 like the photo and First Class Mail International Package for ID 42 (when click ID 11) and ID 43 when you click ID 12?
Hope I make sense!
Thanks a million for all your help!!!!
-
Re: USPS Question
Instead of master_categories_id check for products_id ...
-
Re: USPS Question
Hi Ajeh,
The product ID's for Express Mail International (EMS) Flat-Rate Envelope and Priority Mail International Flat-Rate Envelope are 15,42,16,43. And for First Class Mail International Package 42 and 43.
Hope this is right!
Cheers! :smile:
-
Re: USPS Question
Now adapt the code in #6 to use them ... :smile:
-
Re: USPS Question
To be honest I'm not sure what to do. Can I just put that same code in twice. One for the 4 products and again for the two?
I am really really bad at PHP!
-
Re: USPS Question
This gave you the total of what is in the cart for categories based on the master_categories_id when set to 11 or 12 ...
Code:
$chk_cats = $_SESSION['cart']->in_cart_check('master_categories_id','11') + $_SESSION['cart']->in_cart_check('master_categories_id','12');
This would work for products:
Code:
$chk_prods = $_SESSION['cart']->in_cart_check('products_id','11') + $_SESSION['cart']->in_cart_check('products_id','12');
have more than 2 products_id values to check, keep adding them on ...
Now you want to check how many products are in the cart you have $chk_prods ...
You want to check the $type for the shipping method ...
Not sure what the shipping method is, then do an echo on it by uncommenting the:
Code:
// echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
NOTE: you can also add to that echo the $chk_prods to see the results ...
-
Re: USPS Question
Last question!!
Would this work?
PHP Code:
global $cart;
$chk_cats = $_SESSION['cart']->in_cart_check('products_id','15') + $_SESSION['cart']->in_cart_check('products_id','16' + $_SESSION['cart']->in_cart_check('products_id','42' + $_SESSION['cart']->in_cart_check('products_id','43');
// echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
if ($type == 'Express Mail International (EMS) Flat-Rate Envelope' && $chk_cats > 0) {
if ($type == 'Priority Mail International Flat-Rate Envelope' && $chk_cats > 0) {
$chk_cats = $_SESSION['cart']->in_cart_check('products_id','42') + $_SESSION['cart']->in_cart_check('products_id','43');
// echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
if ($type == 'First Class Mail International Package' && $chk_cats > 0) {
// skip shipping
} else {
-
Re: USPS Question
Not if you are trying to add them all up ...
Can you type out slowly what it is you want this to do in detail ...
You have Category issues with shipping types ...
You have Product issues with shipping types ...
You need to break these out carefully so that each shipping type that needs to be tested is using the correct testing ...
-
Re: USPS Question
Hi Ajeh,
I want products 15,16,42,43 to ship by everything but Express Mail International (EMS) Flat-Rate Envelope and Priority Mail International Flat-Rate Envelope. I also want products 42 and 43, as well as not being shipped using the above two shipping types but also First Class Mail International Package.
Thanks a million!
-
Re: USPS Question
Ajeh, would you please help me!
-
Re: USPS Question
I have not had the time to rewrite the code for you ... when I get some time I will try to look into this further ...
Hopefully there is enough information in this thread to show you how to count the number of products in the cart based on master_categories_id or products_id etc. and how to find the $type for the shipping method to try coding this for yourself ...
-
Re: USPS Question
Trust me. I have tried! If you get a chance that would be great.
-
Re: USPS Question
You could use the code:
Code:
global $cart;
$chk_products15 = $_SESSION['cart']->in_cart_check('products_id','15');
$chk_products16 = $_SESSION['cart']->in_cart_check('products_id','16');
$chk_products42 = $_SESSION['cart']->in_cart_check('products_id','42');
$chk_products43 = $_SESSION['cart']->in_cart_check('products_id','43');
$skip_type = false;
if ( ($type == 'Express Mail International (EMS) Flat-Rate Envelope' || $type == 'Priority Mail International Flat-Rate Envelope') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43) > 0) {
$skip_type = true;
}
if ( ($type == 'First Class Mail International Package' ) && ($chk_products42 + $chk_products43) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
-
Re: USPS Question
Thanks a million! Works a charm!
-
Re: USPS Question
Thanks for the update that this customized code works for you ... remember us when you are rich and famous ... :cool:
-
Re: USPS Question
I've tried to change the code somewhat and it still displays the shipping options ive excluded. Any help would be appreciated!
I'm using the newest version of zen-cart and USPS module.
PHP Code:
global $cart;
$chk_products15 = $_SESSION['cart']->in_cart_check('products_id','15');
$chk_products16 = $_SESSION['cart']->in_cart_check('products_id','16');
$chk_products42 = $_SESSION['cart']->in_cart_check('products_id','42');
$chk_products43 = $_SESSION['cart']->in_cart_check('products_id','43');
$chk_products73 = $_SESSION['cart']->in_cart_check('products_id','73');
$chk_products74 = $_SESSION['cart']->in_cart_check('products_id','74');
$chk_products76 = $_SESSION['cart']->in_cart_check('products_id','76');
$chk_products77 = $_SESSION['cart']->in_cart_check('products_id','77');
$chk_products81 = $_SESSION['cart']->in_cart_check('products_id','81');
$chk_products82 = $_SESSION['cart']->in_cart_check('products_id','82');
$chk_products83 = $_SESSION['cart']->in_cart_check('products_id','83');
$chk_products84 = $_SESSION['cart']->in_cart_check('products_id','84');
$skip_type = false;
if ( ($type == 'First-Class Mail International Large Envelope' ||$type == 'First-Class Mail International Package' ||$type == 'Priority Mail International Flat Rate Envelope' ||$type == 'Priority Mail International Small Flat Rate Box' ||$type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 +$chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + + $chk_products77 + $chk_products81 + $chk_products82 $chk_products83 + $chk_products84 +) > 0) {
$skip_type = true;
}
if ( ($type == 'Priority Mail International Medium Flat Rate Box' ) && ($chk_products42 + $chk_products43 + $chk_products74 + $chk_products77 + $chk_products83 + $chk_products84 ) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
-
Re: USPS Question
Fix this IF statement:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) {
then ... check what the $type is by adding above the two IF statements the line:
Code:
echo 'I SEE TYPE: ' . $type . '<br>';
Make sure that you are testing for the correct spellings ...
-
Re: USPS Question
What's wrong with the IF statement? This is what I did!
PHP Code:
$skip_type = false;
echo 'I SEE TYPE: ' . $type . '<br>';
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) { $skip_type = true;
}
echo 'I SEE TYPE: ' . $type . '<br>';
if ( ($type == 'Priority Mail International Medium Flat Rate Box' ) && ($chk_products42 + $chk_products43 + $chk_products74 + $chk_products77 + $chk_products83 + $chk_products84 ) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
Is this what you mean? nothing happened! Most likely its something I did I'd say!
-
Re: USPS Question
Your IF:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' ||$type == 'First-Class Mail International Package' ||$type == 'Priority Mail International Flat Rate Envelope' ||$type == 'Priority Mail International Small Flat Rate Box' ||$type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 +$chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + + $chk_products77 + $chk_products81 + $chk_products82 $chk_products83 + $chk_products84 +) > 0) {
My IF:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) {
You have extra + signs and missing + signs ...
-
Re: USPS Question
Oops... I see my mistakes! :blush: I changed the IF statement but still no change?
-
Re: USPS Question
Have you an URL to your site that we could perhaps peek at? :smile:
-
Re: USPS Question
You are using the New USPS shipping module for January 4, 2010 correct?
http://www.zen-cart.com/forum/showthread.php?t=144992
-
Re: USPS Question
Yep, I just updated to the new USPS module today. Realized there was an update and I didnt know!
Yup its, store.wphlive.tv
Thanks again!
-
Re: USPS Question
Do you have any Zones setup on USPS?
Did you do a REMOVE ... INSTALL and reconfigure when you loaded the new version?
-
Re: USPS Question
I have two zones. One for the US and another for all other countries. I've it set so the US ships by UPS and all other countries by USPS.
Yep, I removed the module and installed it again.
I'll try it again.
-
Re: USPS Question
Any luck Ajeh? It's really confusing! It worked before the update and not now :unsure:
-
Re: USPS Question
I can get it to work with some products ...
You may want to check the products you are testing and make sure that they are not marked as Always Free Shipping or 0 weight if 0 weight is marked as Free Shipping ...
-
Re: USPS Question
I think only four of them are marked as always free shipping. It's ok now! I went for something else that worked and keeps me happy :D
Thanks for your help!
I'll remember you when I'm rich and famous!
-
Re: USPS Question
Glad that you have things working ... thanks for the update ...
Are you rich yet?! :cool: