Latest News: (loading..)
Top_Speed

[CONTRIBUTION] Sloppy Words Cleaner

96 posts in this topic

Sorry Dave, been away for a bit. Glad to hear you got it working... maybe you should input what you did here so anybody else with the other combined billing/shipping contrib can eliminate the prob. I personally don't run the combined contrib for the reason that I want to push the shipment to the billing address (if possible for fraud reasons) and I find it's too easy to select the secondary address and some that would get the item(s) shipped to the billing opt out just b/c it's so easy to change it... but I may be weird too ;)

 

BTW- anybody else this "Sloppy Word Cleaner" contrib has been working flawless for my 2 shops, I have a new (updated) function file to be released soon. Any prior (or) future users can simply update (overwrite) the (1) function file and be updated :)

 

Enjoy the clean & standardized looking customer info fields..

 

-KJ

Share this post


Link to post
Share on other sites

Hi Top_Speed,

 

thanks for your great contribution.

 

I've got one question:

 

Is it possible to capitalize only the letter after "-" and "." instead of all special characters?

 

My Problem is:

Master-splinter becomes: Master-Splinter ...that's ok

and p.x.diddi becomes: P.X.Diddi

 

But:

All names with special characters:

 

Céline becomes: CéLine

Sørensen becomes: SøRensen

Ålgård becomes: ÅLgåRd

 

I'm not so familiar with regular expressions... but maybe you've got an idea how to solve that problem with a small change? (maybe this could fix all language problems... german, scandinavian, french etc.)

 

Best regards,

 

Michael

Share this post


Link to post
Share on other sites

Hi and thank you.

Yes this could be changed and I have remarked code lines in the catalog\includes\functions\account_word_cleaner.php (function file). What might be also suggested is the special characters is to set to YOUR correct ISO character set, then add your prefix conditions/exceptions whether it's "-" or "." for the prefix trigger (the letter, character or digits that triggers the Capitol letter after it... see a few posts above on the ISO character sets.

 

Remember when editing the function file that there is 3 functions, the first one (RemoveShouting) is the one that has been rem'd with edit info, just follow suite for the other 2 functions if you need to add or omit special characters there also. Make a backup (as always) of your account_word_cleaner.php before toying around with it ..just in case you have to go back.

 

Cheers

Share this post


Link to post
Share on other sites

Thanks magic

But the call was already documented for catalog/checkout_payment_address.php. I reverted the install.txt file back to the original as you had a duplicate include_once call.

Cheers

KJ

Share this post


Link to post
Share on other sites

Hello KJ,

A very nice contribution here I must say well done.

Im wondering did you get anywhere with the script to clean the existing customers data at all please?

 

Thanks,

James

Share this post


Link to post
Share on other sites

Hi "Master of the sloppy word cleaner" ;)

 

 

can i come back to the german issue?

 

it is a good tool and a lot of typing mistakes wil be removed but for customer where enters the datas correct but use a öäüß they will see that they entry looks strange.

 

e.g. Müller will be stored like MüLler

 

what we can do to make it happen that this kind of entry will be stored correct?

rgds

alfred

Share this post


Link to post
Share on other sites
Hi "Master of the sloppy word cleaner" ;)

 

 

can i come back to the german issue?

 

it is a good tool and a lot of typing mistakes wil be removed but for customer where enters the datas correct but use a öäüß they will see that they entry looks strange.

 

e.g. Müller will be stored like MüLler

 

what we can do to make it happen that this kind of entry will be stored correct?

rgds

alfred

 

As said previously in posts, you would need to change your ISO character set (currently coded in as 128 ASCII, AKA normal English typeset character) to one that accepts the characters (Umlauts, Latin, Chinese, Symbolic etc.) you wish. Then ad the desired characters to the exception list and it will ignore the following (trailing) character and won't try to capitalize. e.g. MüLler will then come out: Müller b/c you have "ü" in as an exception.

Both these changes are (altered) in: catalog\includes\functions\account_word_cleaner.php (function file)

 

I can't clarify it anymore than this (2 easy steps)

__Change the Character set in catalog\includes\functions\account_word_cleaner.php

__Add "your" character exceptions in catalog\includes\functions\account_word_cleaner.php

(make sure they will match up with the set you changed to in the function file above)

Share this post


Link to post
Share on other sites
Hello KJ,

A very nice contribution here I must say well done.

Im wondering did you get anywhere with the script to clean the existing customers data at all please?

 

Thanks,

James

Hi James,

Been so busy since this contrib I actually forgot about that :)

At one of my busiest sites; Go Kart shop I field anywhere from 35 to 100 orders per day (quite busy considering a weekend (monday am) can land upwards of 400 orders) and have found that the few recurring orders that have created accounts a long time ago are few, when this happens I have one the girls in the office correct their accounts at that time.

 

My usage: I had this idea in place for quite sometime before I actually shared this with the community; so I don't have a lot of old records that get re-used that need to be corrected. It's not perfect and I'm not sure with the English language (as crazy as it is) it ever can be perfect.

 

A MYSQL.php file could be wrote and executed to do this database rewrite but I (personally) don't want the trial & error as I deleted my test shop almost a year ago when I changed to a dedicated sever. Hope you understand my position (if it works, hey don't try to fix it).

Cheers All!

KJ

Edited by Top_Speed

Share this post


Link to post
Share on other sites

thanks but where i can change the characterset (what i have to do) and where i can enter the character exceptions

please let me have a smal saples as im not a star in developing

 

thx

alfred

Share this post


Link to post
Share on other sites

Nice mod! Easy install and great performance - thanks for providing this.

 

It might be nice to have this add-on test for two-letter states (such as in the US) which would be all upper-case and other countries which would then be made title case. Right now, all states are upper case, even if they enter "Avon on Green" as the state and all other fields are Title Case. Not a big deal for me, as most of my customers are in the US, but for other countries, it probably looks a little funny to have everything corrected but the state being UPPER CASE.

Share this post


Link to post
Share on other sites

cant fix it by myself- so i must take it out

 

Hello,

 

I had the same problem with german umlauts and spanish accents. Even worse, the add-on didn't do any change on special characters.

So after a huge amount of try and error, I'm not a programmer, I found a solution which maybe is not too elegant, but works.

I uploaded it as version 1.5 here:

 

http://addons.oscommerce.com/info/5550

 

-- v1.5 === Support for special characters like ä,é,ç for german, spanish, french, and skandinavian languages added.

1. New function to convert special characters to lower case added.

2. New function to convert letters following special characters to lower case added (Müller instead of MüLler, Fernández instead of FernáNdez).

3. New function to convert special characters in first letter of words to upper case(Úbeda instead of úbeda).

Special characters for other languages like czech or serbo-croat can be added.

4. Some more details are changed to older versions:

a. RemoveShoutingCN for the company is commented out.

Reason: Company names have a huge amount of possible combinations of upper and lower case which in my opinion can not be included all in the exceptions list.

b. "True" statement added to firstname, lastname "RemoveShouting", this activates the exception lists for names.

c. Some more exceptions added to name and address for german, spanish and french language.

5. Support added for add-ons:

"DHTML State Selection for 2.3.1" http://addons.oscommerce.com/info/8028

"DHTML State Selection" (v2.2) http://addons.oscommerce.com/info/6975

"NIF" http://addons.oscommerce.com/info/1778

 

best regards

Rainer

Share this post


Link to post
Share on other sites

Hi...

 

Thanks for this very nice contribution... I was still in 1.4 and I'm updating...

 

Following question passed then through my mind :

Would it be possible to check the whole database updating names (a kind of script that you can launch, specially after an update so that previously registered user can enjoy their "new name" ^^ ) ?

 

Thanks

Share this post


Link to post
Share on other sites

Hi...

 

Thanks for this very nice contribution... I was still in 1.4 and I'm updating...

 

Following question passed then through my mind :

Would it be possible to check the whole database updating names (a kind of script that you can launch, specially after an update so that previously registered user can enjoy their "new name" ^^ ) ?

 

Thanks

 

 

Hello,

 

I think this is possible, but it goes far over my php programming capacities.

As I corrected before the chaotic entries manually one by one, i didn't worry about this.

Of course it would be nice if someone out there with enough programming skills could add this.

 

Best regards

Rainer

Share this post


Link to post
Share on other sites

I know nothing has been posted here for a while, but I thought I would say thanks for creating this. Even now it seems to work as it should and sorted all the address.

 

I currently spend what seems like ages sorting customers addresses and found this. Well in actual fact I knew it was here and had never used it. Now I am updating the site I thought I would give it a try. Brilliant and well done.

Edited by 14steve14

Share this post


Link to post
Share on other sites

@@14steve14 what version are you running it on? anyone know if it runs on 2.3.4? Used to use this on 2.2 stores and I agree it is a great mod.

Share this post


Link to post
Share on other sites

Heather I have it installed on the latest BS version and it seems ok. Site is only being developed but testing looks fine.

Share this post


Link to post
Share on other sites

Can anyone help me to upgrade this obsolete function?

// captialize all first letters
   $str = preg_replace('/\\b(\\w)/e', 'mb_strtoupper("$1")', mb_strtolower(trim($str)));

// captialize all first accent letters
   $str = preg_replace("/\\B($specials_first)\\b/e", 'mb_strtoupper("$1")', $str);

   if ($all_uppercase) {
// capitalize acronymns and initialisms i.e. PO
       $str = preg_replace("/\\b($all_uppercase)\\b/e", 'mb_strtoupper("$1")', $str);

PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in

 

I'm looking on google and php.net but my english is so poor and I'm not a php programer :(

 

Thanks in advance

Share this post


Link to post
Share on other sites

Can anyone help me to upgrade this obsolete function?

// captialize all first letters
   $str = preg_replace('/\\b(\\w)/e', 'mb_strtoupper("$1")', mb_strtolower(trim($str)));

// captialize all first accent letters
   $str = preg_replace("/\\B($specials_first)\\b/e", 'mb_strtoupper("$1")', $str);

   if ($all_uppercase) {
// capitalize acronymns and initialisms i.e. PO
       $str = preg_replace("/\\b($all_uppercase)\\b/e", 'mb_strtoupper("$1")', $str);

PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in

 

I'm looking on google and php.net but my english is so poor and I'm not a php programer :(

 

Thanks in advance

 

Delete the e at the end of \\b/e"

 

 

I believe that's it. you might have to remove the /e. try it out. I remember running into this with a server upgrade to PHP 5.5

Share this post


Link to post
Share on other sites

Installed the latest version (21 Nov 2015 by @@raiwa) and its working great - thank you :)

 

I would like to take this a step further as follows:

 

I use Create account and Manual order maker, to allow me to input telephone orders, counter sales, and transfer over ebay sales for invoicing etc. In a lot of instances this involves cutting and pasting address, name etc.

 

This mod has its own create_account.php located in the admin folder, which links to an admin/create_account_process.php

 

Im pretty sure that this can be modified in a similar way to the catalog/create_account.php without much effort.

 

My question is will I also need to add the file account_word_cleaner.php to the functions folder within admin.

 

Many Thanks

Share this post


Link to post
Share on other sites

Posted (edited)

Hello,

Following up the thread about the new updated BS version:

sloppy words cleaner header tag versus hook

I have now prepared a beta test version which solves all the examples posted there by gary and frankl.

It is hooked and all settings, functions and installation scripts are packed into a store module. The minimal no invasive core file changes are automatic done on store moduel installation.

@burt, @frankl, @14steve14, @Mort-lemur, @PiLLaO and others,

If you have a time and interest, there are 2 ways of testing:

1. on my demo store:
demo account:
user:demo
passw: demodemo
play in account/address book: https://www.oscaddons.com/demostore/address_book.php

2. download the beta package and install on any 2.3.4 EDGE
Easiest installation:
copy all files  in "upload" folder
install: admin -> modules -> store -> Sloppy Words Cleaner
NOTE: No file changes, hook register and call is auto added to relevant files on module installation and removed on module uninstall:-)
See the included provisional doc "check_report" for detailed info. No instructions included for now.

 

Some observations and known flaws:

Firstname: MACDONALD -> Macdonald

Firstname: macdonald -> Macdonald

Surname: MACDONALD -> MacDonald

Surname: macdonald -> MacDonald

Surname: Macdonald -> Macdonald => correct spell match first letter upper all other lower -> no conversion. It’s supposed, knowing about his exceptional spelling, a “Macdonald” will take care to type his surname correct. :wink:

Surname: DE QUINCEY -> de Quincey

Note: "de" is in the all lower list, De Quincey needs to be added to the exception list

It’s supposed, knowing about his exceptional spelling, a “De Quincey” will take care to type his surname correct. :wink:

Surname: degennaro -> DeGennaro

Note: several of these italian names are added to Word conversión list, adding to prefix list would break other all lower conversions like “der, die”  and other terms beginning with “De, Di”

Surname: lavecchia -> LaVecchia

Note: Same problem like for Macdonald/MacDonald, both variants exist: Laveccia/LaVecchia

 

 

Thank you for your time
rgds
Rainer

 

Sloppy Words Cleaner 3.0 BS.zip

Edited by raiwa
PiLLaO likes this

Share this post


Link to post
Share on other sites

I can't download the file

 

Quote

Sorry, there is a problem

We could not locate the item you are trying to view.

Error code: 2S328/1

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now