Post by grgr » Sat Nov 19, 2011 4:56 pm

I get really wound up about poorly formatted addresses so have done this to try and sort out the problem.

Not sure that it is the best way to do it but it suits what I need to do. It's also not perfect but I think it covers most things.

This comes as a vQmod and one extra file.

Works for account creation, editing and guest checkout. Can be rolled into affiliate and returns if you wanted to but didn't seem worth worrying about.

It does the following:

Capitalizes First Letters
Capitalizes Hyphen-Names
Decapitalizes short words so you end up with Burton-on-Trent for example.
Decapitalizes certain name words like 'de la' and 'van der'.
Sorts out surname prefixes like MacDonald.
Capitalizes certain address terms like SW, NE and PO.
Has editable exceptions list so you can define more uppercase or lowercase words.

Not completely tested but I don't think you'll have any problems, suggestions welcomed.

Available in the extension store (free), click on link below.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by spitos » Thu Dec 01, 2011 11:04 pm

Works great, thanks! :good:

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by rph » Thu Dec 01, 2011 11:42 pm

URLs are case sensitive so I would highly recommend keeping them all lower-case all the time.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by grgr » Fri Dec 02, 2011 1:14 am

rph wrote:URLs are case sensitive so I would highly recommend keeping them all lower-case all the time.
URLs? You've lost me! Can you elaborate....

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by rph » Fri Dec 02, 2011 8:55 am

Oops. Thought you were talking about the page address.

Carry on. :bang:

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by terrabyte911 » Sun Oct 21, 2012 6:31 am

This is a great mod as I'm also OCD about addresses and such.

I've rolled this on to Product Names and Category Names as well, add the following to the XML file.

Code: Select all

<file name="admin/model/catalog/product.php">
<operation>
<search position="replace"><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");
]]>	</search>
<add><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . cleanaddress($this->db->escape($value['name']), true) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");
]]></add>
</operation>
</file>
	
<file name="admin/model/catalog/category.php">
<operation>
<search position="replace"><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");
]]>	</search>
<add><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . cleanaddress($this->db->escape($value['name']), true) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");
]]></add>
</operation>
</file>
Great work and thank you.

Newbie

Posts

Joined
Thu May 31, 2012 6:56 am

Post by Nakib » Tue May 13, 2014 6:43 am

Hello Dear admin.
This modification is very essential for me.
I am using custom theme and quick checkout extension.
here is the extension http://www.opencart.com/index.php?route ... 20checkout

I am using sellegance theme from themeforest.

Please let me know how should i get the module work.

I am willing to pay if you please integrate the module for me

Newbie

Posts

Joined
Fri Dec 27, 2013 10:48 am

Post by grgr » Wed May 14, 2014 3:22 pm

The theme will make no difference to this and it should partially work anyway.

At the moment I don't have the time to be doing it for you, but as it is free you can ask someone else to do it for you.

You'll need to go through the controller/model files of the checkout extension and modify in the same way as can be seen in the xml file.

Instances of

= $this->request->post['firstname']
= $this->request->post['address_2']

become:

= cleanaddress($this->request->post['firstname'], true);
= cleanaddress($this->request->post['address_2']);

etc.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by DavJames » Thu May 15, 2014 5:20 pm

Does the extension only work for account creation, editing and guest checkout? What about people already logged in who've already got a saved address in lowercase and then checkout?

New member

Posts

Joined
Tue Dec 03, 2013 9:46 pm

Post by grgr » Thu May 15, 2014 7:53 pm

No, it only works for new addresses, it won't clean up existing stored addresses but it will clean the stored address before it puts the order into the database.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by samaraki » Tue Aug 05, 2014 2:59 pm

It would be nice if someone could help me make this work with SuperCheckout, I will pay, been waiting for months, no-one seem's be able to know how, but supposedly it's simple.

Active Member

Posts

Joined
Fri Jul 26, 2013 2:36 pm

Post by tegelwinkeldenhaag » Mon Nov 24, 2014 10:12 pm

Thanks for this extension. Really very useful. I am running into one error though. When a visitor tries to register, he gets a bunch of errors similar to those that appear in my error folder:

Code: Select all

2014-11-24 11:57:30 - PHP Unknown:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mijn_domein/public_html/system/library/address_cleaner.php on line 31
2014-11-24 11:57:30 - PHP Unknown:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mijn_domein/public_html/system/library/address_cleaner.php on line 39
2014-11-24 11:57:30 - PHP Unknown:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mijn_domein/public_html/system/library/address_cleaner.php on line 25
2014-11-24 11:57:30 - PHP Unknown:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mijn_domein/public_html/system/library/address_cleaner.php on line 34
2014-11-24 11:57:30 - PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/mijn_domein/public_html/index.php:106) in /home/domains/mijn_domein_html/vqmod/vqcache/vq2-system_engine_controller.php on line 28
2014-11-24 11:57:30 - PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/mijn_domein/public_html/index.php:106) in /home/domains/mijn_domein_html/vqmod/vqcache/vq2-system_engine_controller.php on line 29
However, if he uses the back button of the browser to return to the webshop, it shows he has been logged in. He also shows up as a new customer in Admin, and both me and the new account do receive a confirmation e-mail. Strangely enough, the errors do not show up when the visitor registers at the checkout page.
Any help is greatly appreciated.

Tegels en Sanitair Online
https://www.tegelsensanitaironline.nl
Tegelwinkel Den Haag
http://www.tegelwinkeldenhaag.nl



Posts

Joined
Fri Oct 03, 2014 7:34 pm
Location - Nederland

Post by BionicBill » Sun Jan 18, 2015 3:16 am

Having problems with IE11 and the company name if a Company name is say J & J the cleaned name is showing as J &Amp; J

New member

Posts

Joined
Tue Dec 04, 2012 4:08 am

Post by grgr » Wed Feb 04, 2015 6:32 pm

This has been rewritten and should be fine now.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by intelcom » Thu Feb 19, 2015 2:43 am

Hello.

I want to know how we can Capitalize all the letters not only the first letter.

like grgr to GRGR. Street to STREET.

Thanks.

User avatar
New member

Posts

Joined
Wed Apr 11, 2012 4:33 am
Location - Thessaloniki Greece

Post by OSWorX » Thu Feb 19, 2015 3:22 am

intelcom wrote:Hello.

I want to know how we can Capitalize all the letters not only the first letter.

like grgr to GRGR. Street to STREET.

Thanks.
Where and when??
Thanks.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by intelcom » Thu Feb 19, 2015 3:44 am

OSWorX wrote:
intelcom wrote:Hello.

I want to know how we can Capitalize all the letters not only the first letter.

like grgr to GRGR. Street to STREET.

Thanks.
Where and when??
Thanks.
OSWorX Sloppy Address Cleaner Capitalize only the first letter Name, Last name, Address, City, etc.

We want to capitalize the entire letters. Checks if customers register with uppercase or lowercase whatever like (STreeT) and change them to uppercase no just first letter.

Like
jiM WIlLis
TenesI STReet
GreEn TRee 43100
GREECE

To
JIM WILLIS
TENESI STREET 25
GREEN TREE 43100
GREECE

Am I clear now?

User avatar
New member

Posts

Joined
Wed Apr 11, 2012 4:33 am
Location - Thessaloniki Greece

Post by BionicBill » Tue Mar 03, 2015 10:33 pm

Fixed &Amp; problem seems when My site was moved to VPS their default setting for mb_encoding was not UTF8 so I added the following
Before :

Code: Select all

$str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
Add:

Code: Select all

mb_internal_encoding("UTF-8");
Works now.

I have noticed if someones name has example King Charles III it returns King Charles Iii looks to be over looking Roman Numerals.

New member

Posts

Joined
Tue Dec 04, 2012 4:08 am

Post by thbr02 » Thu Jul 02, 2015 11:05 pm

I used the address cleaner for Opencart 1.5.5.1 and was very satisfied with the job it performed. Now I've updated to 2.0.3.1 and unfortunately it seems like the extension won't work properly. Any idea what to do to make it work?

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by grgr » Tue Jul 07, 2015 3:53 pm

Works fine on 2031.

You probably have another mod that is conflicting.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 16 guests