Post by Cue4cheap » Fri Sep 29, 2023 10:33 am

rotaryracer wrote:
Thu Sep 28, 2023 8:27 pm
Naturally...spoke too soon. Bizarrely, this works perfect in my test environment which is a close (but not exact) copy of my production environment. When I make the same changes in production, the option for USPS Ground Advantage doesn't show up in the admin screen at all. Not sure if I have another extension or XML suppressing adding options, but I've gone through all domestic and international (just in case) options and it resolutely refuses to show itself. :) I'll play around a bit more...may consider nuking Parcel Post (since that's no longer a thing) and replacing with Ground Advantage to see if that changes anything. If not, I might end up having to suck it up and buy a module, which would be frustrating because I know Mike's tips can work. :)

Any thoughts on why it may not display in the admin screen? Debug is showing correct responses with "1058" data, and the edits made in production are exactly the same as before.

Thanks...

Jason

UPDATE - Tried replacing all instances of 'Parcel Post' (CLASSID=4) with 'USPS Ground Advantage', including changing the class from 4 to 1058. If I go back into the admin screen, the line for Parcel Post is completely blanked out with no text, although the checkbox is still there. If I select the blank checkbox, it still does not show Ground Advantage in the checkout. There must be something goofy with this module being "protected" from changes (or another XML causing havoc) on the production side, as it works with no issues at all in the testing site.
Sounds like for the blank after the checkbox the admin language file isn't updated, or updated properly.
For why it doesn't show up on the cart side I'd say something also isn't completely updated.
Are you SURE the line in catalog/model/extension/shipping/usps.php
looks like:
$allowed = array(0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 16, 17, 18, 19, 22, 23, 25, 27, 28,1058);

If you turn on debug in the module you should log entry that has something like

Code: Select all

<Postage CLASSID="1058"><MailService>USPS Ground Advantage</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="2058"><MailService>USPS Ground Advantage Hold For Pickup</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="6058"><MailService>USPS Ground Advantage Parcel Locker</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>5.42</Rate></Postage><Postage CLASSID="6076"><MailService>Media Mail Parcel Parcel Locker</MailService><Rate>5.42</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>5.14</Rate></Postage><Postage CLASSID="6075"><MailService>Library Mail Parcel Parcel Locker</MailService><Rate>5.14</Rate></Postage>
If it does have rates reported in the error log, then there is something wrong in the catalog/model/extension/shipping/usps.php file.
If it isn't there in the error log, AND you have debug turned on & ran a test to get rates, then is something wrong in the admin files.

Lastly did you ensure you cleared caches to make sure?
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by rotaryracer » Sat Sep 30, 2023 4:52 am

Cue4cheap wrote:
Fri Sep 29, 2023 10:33 am
Sounds like for the blank after the checkbox the admin language file isn't updated, or updated properly.
For why it doesn't show up on the cart side I'd say something also isn't completely updated.
Are you SURE the line in catalog/model/extension/shipping/usps.php
looks like:
$allowed = array(0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 16, 17, 18, 19, 22, 23, 25, 27, 28,1058);

If you turn on debug in the module you should log entry that has something like

Code: Select all

<Postage CLASSID="1058"><MailService>USPS Ground Advantage</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="2058"><MailService>USPS Ground Advantage Hold For Pickup</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="6058"><MailService>USPS Ground Advantage Parcel Locker</MailService><Rate>15.85</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>5.42</Rate></Postage><Postage CLASSID="6076"><MailService>Media Mail Parcel Parcel Locker</MailService><Rate>5.42</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>5.14</Rate></Postage><Postage CLASSID="6075"><MailService>Library Mail Parcel Parcel Locker</MailService><Rate>5.14</Rate></Postage>
If it does have rates reported in the error log, then there is something wrong in the catalog/model/extension/shipping/usps.php file.
If it isn't there in the error log, AND you have debug turned on & ran a test to get rates, then is something wrong in the admin files.

Lastly did you ensure you cleared caches to make sure?
Mike
Hey Mike - thank you again for the help. I did not clear the caches after completion previously, but re-entered all the data, cleared caches, and it works! The USPS data was appearing in the log file when debug was enabled, and I would swear I had entered all the edits correctly, so maybe it was the cache? In any event, Ground Advantage showed as an option in the admin screen and is showing up perfectly in the shopping cart as an option. My customers and I thank you very much for your help and knowledge!

Best,

Jason

New member

Posts

Joined
Tue Oct 16, 2012 7:45 pm

Post by YarniaPDX » Thu Oct 05, 2023 11:44 pm

Thank you for walking us through this! I followed your instructions below, but Ground Advantage is still not showing up as an option when I test this on my end. Am I understanding correctly that the code you gave us below should be ADDED to each of these files, and not replacing anything? Added anywhere in specific or just at the bottom of the file is fine?

I also noticed that while you told us all 4 of these files would need to be modified:

admin/language/en-gb/extension/shipping/usps.php
admin/controller/extension/shipping/usps.php
admin/view/template/extension/shipping/usps.tpl
catalog/model/extension/shipping/usps.php

You only added code for #1, #2, and #4 (I don't see any code additions for admin/view/template/extension/shipping/usps.tpl.

Please let me know if I'm missing something, or if there is more we can troubleshoot here.

Thank you!

Cue4cheap wrote:
Thu Sep 28, 2023 10:45 am
rotaryracer wrote:
Wed Sep 27, 2023 10:05 pm
Cue4cheap wrote:
Fri Sep 15, 2023 7:31 am
If you turn on debug mode and get some shipping rates, look in the error log for what USPS returns and if you know what to look for you can update the following files:
admin/language/en-gb/extension/shipping/usps.php
admin/controller/extension/shipping/usps.php
admin/view/template/extension/shipping/usps.tpl

catalog/model/extension/shipping/usps.php

Use the examples in the files for what to duplicate/change.

And you can add in whichever classid you wish to offer. I suspect most will only need classid 1058.
Mike
Hi Mike - thanks for the tips! I used your tips to update the relevant files in my test system and can now see USPS Ground Advantage in the extension admin panel. The challenge is that when I select that option, I still don't see it appearing as an option when estimating shipping in the shopping cart. I've gone back through the files a few times to ensure I've added or changed the relevant data. The only thing I can find different is I am running 3.0.3.2 and have /admin/view/template/extension/shipping/usps.twig vs usps.tpl per your note above. Not sure if that's something that's changed in subsequent versions and perhaps the .twig extension will prevent this fix from working? The included USPS extension has been working fine for 11 years, so if I can get this fixed, it should continue to do the job.

Thanks for your help...

Jason
Give me a bit and I'll relook at it. I am currently away and have limited access but that should be the files to update. And yes should be twig for the 3.x version.
Mike

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by rotaryracer » Fri Oct 06, 2023 2:46 am

Hi YarniaPDX - the usps.tpl file is actually named usps.twig, which is why you might've missed it. Here's Mike's entries for that file....I just added it after the last shipping_usps_domestic_28 entry.

If you make these additions, I bet it will pop right up as a clickable option (all the way at the end of the shipping options to select in the admin screen).

admin/view/template/extension/shipping/usps.twig
add:

Code: Select all

                <div class="checkbox">
                  <label>
                    {% if shipping_usps_domestic_1058 %}
                    <input type="checkbox" name="shipping_usps_domestic_1058" value="1" checked="checked" />
                    {{ text_domestic_1058 }}
                    {% else %}
                    <input type="checkbox" name="shipping_usps_domestic_1058" value="1" />
                    {{ text_domestic_1058 }}
                    {% endif %}
                  </label>
                </div>
   

New member

Posts

Joined
Tue Oct 16, 2012 7:45 pm

Post by YarniaPDX » Wed Oct 18, 2023 6:22 am

So actually, when I go to my Extensions-->Shipping to try to enable that option, this error message pops up (see screenshot). Here's a screenshot of the code with the new option inserted. Does everything look right here? Why else might I be seeing this error message?

https://urbancraftuprising.com/wp-conte ... ot-150.png
https://urbancraftuprising.com/wp-conte ... ot-149.png

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by Cue4cheap » Wed Oct 18, 2023 8:07 am

YarniaPDX wrote:
Wed Oct 18, 2023 6:22 am
So actually, when I go to my Extensions-->Shipping to try to enable that option, this error message pops up (see screenshot). Here's a screenshot of the code with the new option inserted. Does everything look right here? Why else might I be seeing this error message?

https://urbancraftuprising.com/wp-conte ... ot-150.png
https://urbancraftuprising.com/wp-conte ... ot-149.png
What does the code look like in admin/controller/extension/shipping/usps.php ?
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by YarniaPDX » Thu Nov 02, 2023 1:12 am

I've attached my usps.php file here. Thank you!
Cue4cheap wrote:
Wed Oct 18, 2023 8:07 am
YarniaPDX wrote:
Wed Oct 18, 2023 6:22 am
So actually, when I go to my Extensions-->Shipping to try to enable that option, this error message pops up (see screenshot). Here's a screenshot of the code with the new option inserted. Does everything look right here? Why else might I be seeing this error message?

https://urbancraftuprising.com/wp-conte ... ot-150.png
https://urbancraftuprising.com/wp-conte ... ot-149.png
What does the code look like in admin/controller/extension/shipping/usps.php ?
Mike

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by Cue4cheap » Thu Jan 16, 2025 7:45 am

I KNOW this is old but I had to assist someone else who asked me about this post... I forgot:
in admin/controller/extension/shipping/
Also needed

Code: Select all

		$data['text_domestic_1058'] = $this->language->get('text_domestic_1058');
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am
Who is online

Users browsing this forum: No registered users and 19 guests