Post by shamanicconnection » Tue Dec 02, 2014 3:37 am

shamanicconnection wrote:I see the delivery times have been briefly touched on but no real solutions. It doesn't matter if the display button is on or off I am not getting estimated times. I've played a littled in the usps.php file and in the xml files to see if I could hard code them into the descriptions. I'm obviously not getting them in the right place.

I'd just like to hard code so it shows "First Class Mail Parcel (2-5 days)" etc.

Can you tell me where I would go about this (file and line # if possible)?

Thanks a lot.

BTW - otherwise everything is great and gets a thumbs up!
Jeffrodh - still looking for some advice here. I'm launching this week and would love to have this fixed.
Thanks


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by JeffroDH » Tue Dec 02, 2014 4:09 am

shamanicconnection wrote:
shamanicconnection wrote:I see the delivery times have been briefly touched on but no real solutions. It doesn't matter if the display button is on or off I am not getting estimated times. I've played a littled in the usps.php file and in the xml files to see if I could hard code them into the descriptions. I'm obviously not getting them in the right place.

I'd just like to hard code so it shows "First Class Mail Parcel (2-5 days)" etc.

Can you tell me where I would go about this (file and line # if possible)?

Thanks a lot.

BTW - otherwise everything is great and gets a thumbs up!
Jeffrodh - still looking for some advice here. I'm launching this week and would love to have this fixed.
Thanks
You cannot hard code them into the descriptions that the customer will see in the shop. What you can do is modify the name on the fly after it has been returned by the USPS API.

The following code removes the delivery estimates from the customer display entirely, and is included in the mod.

Code: Select all

$result = str_replace(' 1-Day', '', $result);
$result = str_replace(' 2-Day', '', $result);
$result = str_replace(' 2-3 Days', '', $result);
I recommend leaving the previous code as it is, because USPS doesn't return accurate or reliable info. Using a similar function, you could do something like this:

Code: Select all

 $result = str_replace('Priority Mail', 'Priority Mail (2-3 Days)', $result);
which would replace the first string with the second string. Simply follow the coding conventions and insert your new line underneath the existing functions in the mod.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by shamanicconnection » Tue Dec 02, 2014 8:08 am

Capture.PNG

Capture.PNG (16.23 KiB) Viewed 3146 times

Thanks for the reply. I almost have it, but am having trouble with the first class mail parcel not showing. Here's what I have in the xml file now.

Code: Select all

        <operation>
        	<search position="replace" offset="1"><![CDATA[$result = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $result);]]></search>
        	<add><![CDATA[$result = str_replace('&lt;sup&gt;&#174;&lt;/sup&gt;', '&#174;', $result);
				$result = str_replace('&lt;sup&gt;&#8482;&lt;/sup&gt;', '&#8482;', $result);
				$result = str_replace(' 1-Day', '', $result);
				$result = str_replace(' 2-Day', '', $result);
[highlight] $result = str_replace('Priority Mail', 'Priority Mail (2-3 Days)', $result);
 $result = str_replace('Standard Post', 'Standard Post (2-9 Days)', $result);
$result = str_replace('First-Class Mail Parcel', 'First-Class Mail Parcel (2-5 Days)', $result);[/highlight]]]></add>
        </operation>
Here's what's showing in the cart.http://forum.opencart.com/download/file ... w&id=22858

The Priority Express is putting the 2-3 days in automatically from somewhere. It's close enough to leave as is.

Any ideas about the first class parcel? I thought I was naming it wrong, but can't find where it's called anything else.

Thanks.


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by JeffroDH » Tue Dec 02, 2014 11:28 am

I've corrected your code, and added a few comments to help you sort out what you're doing. When you wrote the code to search for First-Class, you left out the HTML entity code, which I think was causing your problems.

Code: Select all

        <operation>
        	<search position="replace" offset="1"><![CDATA[$result = str_replace('&lt;sup&gt;&amp;reg;&lt;/sup&gt;', '', $result);]]></search>
        	<add><![CDATA[$result = str_replace('&lt;sup&gt;&#174;&lt;/sup&gt;', '&#174;', $result);
				$result = str_replace('&lt;sup&gt;&#8482;&lt;/sup&gt;', '&#8482;', $result);
//This line and the next 2 remove the strings from the API 
				$result = str_replace(' 1-Day', '', $result); 
				$result = str_replace(' 2-Day', '', $result);
				$result = str_replace(' 2-3 Days', '', $result);
//The next 4 lines search for the service names, and replace them with the modified version
				$result = str_replace('Priority Mail&#8482;', 'Priority Mail&#8482; (2-3 Days)', $result);
				$result = str_replace('Priority Mail Express&#8482;', 'Priority Mail Express&#8482; (1-2 Days)', $result);
				$result = str_replace('Standard Post&#174;', 'Standard Post&#174; (2-9 Days)', $result);
				$result = str_replace('First-Class Mail Parcel&#174;', 'First-Class Mail Parcel&#174; (2-5 Days)', $result);]]></add>
        </operation>

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by shamanicconnection » Wed Dec 03, 2014 12:22 am

Thanks for your help Jeffro. I appreciate the commenting in the code. I'm not a developer, just working with some basic knowledge on my own site. When I make code changes, I keep lots of documentation AND copies of the original files, but having it in the code helps too.

We're still not pulling the (2-5 Days) on First Class. Everything else looks great!

I've looked in all the usps files to see if there is another term used, and can't find one. Any more ideas?


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by JeffroDH » Wed Dec 03, 2014 12:30 am

shamanicconnection wrote:Thanks for your help Jeffro. I appreciate the commenting in the code. I'm not a developer, just working with some basic knowledge on my own site. When I make code changes, I keep lots of documentation AND copies of the original files, but having it in the code helps too.

We're still not pulling the (2-5 Days) on First Class. Everything else looks great!

I've looked in all the usps files to see if there is another term used, and can't find one. Any more ideas?
Enable debugging in the USPS module, and then search the USPS API response for the First Class method. The name to use will be there.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by shamanicconnection » Wed Dec 03, 2014 2:47 am

I've checked the log and copied the name shown there of First-Class Mail&#174; Parcel. I've tweaked and re-tweaked with no luck. The line looks just like all the others, but it is not doing the replacement.

Code: Select all

//The next 4 lines search for the service names, and replace them with the modified version
            $result = str_replace('Priority Mail&#8482;', 'Priority Mail&#8482; (2-3 Days)', $result);
            $result = str_replace('Priority Mail Express&#8482;', 'Priority Mail Express&#8482; (1-3 Days)', $result);
            $result = str_replace('Standard Post&#174;', 'Standard Post&#174; (2-9 Days)', $result);
            $result = str_replace('First-Class Mail&#174; Parcel;', 'First-Class Mail&#174; (2-5 Days)', $result);]]></add>
I'm wondering if it has something to do with your array at line 11

Code: Select all

   	<add><![CDATA[$firstclasses = array (
						'First-Class Mail&#174; Parcel',
						'First-Class Mail&#174; Large Envelope',
						'First-Class Mail&#174; Letter',
						'First-Class Mail&#174; Postcards'
					);]]></add>
I have tried using this name for the replacement as well with no luck. I even tried to get it to replace just with using all First-Class Mail like with Priority Mail, but then it won't return the price at all.


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by JeffroDH » Wed Dec 03, 2014 3:08 am

shamanicconnection wrote:I've checked the log and copied the name shown there of First-Class Mail&#174; Parcel. I've tweaked and re-tweaked with no luck. The line looks just like all the others, but it is not doing the replacement.

Code: Select all

//The next 4 lines search for the service names, and replace them with the modified version
            $result = str_replace('Priority Mail&#8482;', 'Priority Mail&#8482; (2-3 Days)', $result);
            $result = str_replace('Priority Mail Express&#8482;', 'Priority Mail Express&#8482; (1-3 Days)', $result);
            $result = str_replace('Standard Post&#174;', 'Standard Post&#174; (2-9 Days)', $result);
            $result = str_replace('First-Class Mail&#174; Parcel;', 'First-Class Mail&#174; (2-5 Days)', $result);]]></add>
I'm wondering if it has something to do with your array at line 11

Code: Select all

   	<add><![CDATA[$firstclasses = array (
						'First-Class Mail&#174; Parcel',
						'First-Class Mail&#174; Large Envelope',
						'First-Class Mail&#174; Letter',
						'First-Class Mail&#174; Postcards'
					);]]></add>
I have tried using this name for the replacement as well with no luck. I even tried to get it to replace just with using all First-Class Mail like with Priority Mail, but then it won't return the price at all.
I bet it does. Let me play with that over the next day or so and get back to you.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by shamanicconnection » Wed Dec 03, 2014 3:25 am

Thanks. I really appreciate all your help figuring this out.


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by miabellaoriginals » Thu Dec 04, 2014 1:05 pm

It appears that your two updates crashed my site. Unfortunately, I'm getting an error when I load my site. Any help would be appreciate. I also updated the USPS & Free Shipping api along with this one. If you go to the site below, you will see the error that is coming up.

http://www.miabellaorignals.com

Any assistance would be appreciated!

Thanks,
Roseann


Posts

Joined
Thu Dec 04, 2014 1:04 pm

Post by JeffroDH » Thu Dec 04, 2014 10:29 pm

miabellaoriginals wrote:It appears that your two updates crashed my site. Unfortunately, I'm getting an error when I load my site. Any help would be appreciate. I also updated the USPS & Free Shipping api along with this one. If you go to the site below, you will see the error that is coming up.

http://www.miabellaorignals.com

Any assistance would be appreciated!

Thanks,
Roseann
The issue you're having is not with the USPS API update. Let's keep this thread on topic, please.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by shamanicconnection » Wed Dec 10, 2014 1:40 am

JeffroDH wrote:
shamanicconnection wrote:I'm wondering if it has something to do with your array at line 11

Code: Select all

   	<add><![CDATA[$firstclasses = array (
						'First-Class Mail&#174; Parcel',
						'First-Class Mail&#174; Large Envelope',
						'First-Class Mail&#174; Letter',
						'First-Class Mail&#174; Postcards'
					);]]></add>
I have tried using this name for the replacement as well with no luck. I even tried to get it to replace just with using all First-Class Mail like with Priority Mail, but then it won't return the price at all.
I bet it does. Let me play with that over the next day or so and get back to you.
Any luck??? Wondering the status. Thanks.


Posts

Joined
Tue Nov 25, 2014 2:15 am

Post by ross_badger » Wed Dec 10, 2014 9:30 am

Hello - I've been using this USPS API Update Mod extension for some time now, and have recently upgraded to OpenCart ver 2.0.1. When will you have support for this latest version?

Thanks, Ross

Newbie

Posts

Joined
Wed Dec 10, 2014 9:26 am

Post by JeffroDH » Thu Dec 11, 2014 6:09 am

ross_badger wrote:Hello - I've been using this USPS API Update Mod extension for some time now, and have recently upgraded to OpenCart ver 2.0.1. When will you have support for this latest version?

Thanks, Ross
Thanks for using the mod!

I'm working on 2.0 and 2.0.1 right now.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by ross_badger » Thu Dec 11, 2014 8:26 am

Awesome! Thanks for making these great Mods!! They are VERY helpful!!

Ross

Newbie

Posts

Joined
Wed Dec 10, 2014 9:26 am

Post by JeffroDH » Thu Dec 11, 2014 2:10 pm

ross_badger wrote:Awesome! Thanks for making these great Mods!! They are VERY helpful!!

Ross
Really appreciate the kudos. 2.0.x compatibility should by finished by the end of the weekend. I'm working on getting the extension to work with the new OCMod "feature" which looks really slick. Unfortunately, because it doesn't seem to cache the changes in the filesystem (and instead stores stuff in the DB), and likewise doesn't provide any useful error messages, I may abandon it altogether and just insist on VQMod being installed. Also, it doesn't seem to bloody work.

Thoughts on this?

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by kimbo » Thu Dec 11, 2014 10:40 pm

Vqmod, JeffroDh.
Your mod is great.

kimbo
The Chloelina All Natural Soap Co.
chloelina.com


Active Member

Posts

Joined
Thu Aug 29, 2013 10:02 pm

Post by ross_badger » Sun Dec 14, 2014 3:00 am

I think most of us use VQMod....so I would just go with it. ;D

Newbie

Posts

Joined
Wed Dec 10, 2014 9:26 am

Post by JeffroDH » Tue Dec 16, 2014 10:59 am

2.x compatible release has been published.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am

Post by JeffroDH » Wed Dec 17, 2014 12:55 am

shamanicconnection wrote:
JeffroDH wrote:
shamanicconnection wrote:I'm wondering if it has something to do with your array at line 11

Code: Select all

   	<add><![CDATA[$firstclasses = array (
						'First-Class Mail&#174; Parcel',
						'First-Class Mail&#174; Large Envelope',
						'First-Class Mail&#174; Letter',
						'First-Class Mail&#174; Postcards'
					);]]></add>
I have tried using this name for the replacement as well with no luck. I even tried to get it to replace just with using all First-Class Mail like with Priority Mail, but then it won't return the price at all.
I bet it does. Let me play with that over the next day or so and get back to you.
Any luck??? Wondering the status. Thanks.

Code: Select all

<!-- Optional Code for adding shipping estimates to First Class methods -->        
        <operation>
        	<search position="after" offset="13"><![CDATA[} elseif ($this->config->get('usps_domestic_' . $classid)) {]]></search>
        	<add><![CDATA[											if($quote_data[$classid]['title'] == 'First-Class Mail&#174; Parcel') {
												$quote_data[$classid]['title'] = 'First-Class Mail&#174; Parcel (2-5 Days)';
											}]]></add>
        </operation>
        <operation>
        	<search position="after" offset="13"><![CDATA[if (($this->config->get('usps_domestic_' . $classid))) {]]></search>
        	<add><![CDATA[											if($quote_data[$classid]['title'] == 'First-Class Mail&#174; Parcel') {
												$quote_data[$classid]['title'] = 'First-Class Mail&#174; Parcel (2-5 Days)';
											}]]></add>
        </operation>
This isn't particularly elegant, but it seems to work. If you want to modify more of the methods in the $firstclasses array, just add more if statements within these code blocks.

Active Member

Posts

Joined
Thu Jul 11, 2013 8:29 am
Who is online

Users browsing this forum: No registered users and 3 guests