Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * - - 2 votes

[CONTRIBUTION] Sloppy Words Cleaner


63 replies to this topic

#41 tfrischholz

  • Community Member
  • 10 posts
  • Real Name:Tobias Frischholz

Posted 11 December 2007, 20:53

e.g. BläTtermann instead of Blättermann

#42 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 12 December 2007, 15:06

My knowledge of German Umlauts is very limited. I know basics like Alt-0196 (on your keyboard) = Ä etc.

The problem lies in the utf8 formatted text that you use (and I don't). I know there are wrote functions that "convert" the text to actual text etc. ...This is not what you want (I know you want the Umlauts preserved) the below code will convert the accent words ;(
$txt = strtr($txt,
 "\xe1\xc1\xe0\xc0\xe2\xc2\xe4\xc4\xe3\xc3\xe5\xc5".
 "\xaa\xe7\xc7\xe9\xc9\xe8\xc8\xea\xca\xeb\xcb\xed".
 "\xcd\xec\xcc\xee\xce\xef\xcf\xf1\xd1\xf3\xd3\xf2".
 "\xd2\xf4\xd4\xf6\xd6\xf5\xd5\x8\xd8\xba\xf0\xfa".
 "\xda\xf9\xd9\xfb\xdb\xfc\xdc\xfd\xdd\xff\xe6\xc6\xdf",
 "aAaAaAaAaAaAacCeEeEeEeEiIiIiIiInNoOoOoOoOoOoOoouUuUuUuUyYyaAs")

So with my limited knowledge of German Umlauts (and accent letters) I may need a lot of Trial & Error BUT... right now I'm in the holiday shopping rush with my own online shops. When I can dedicate to this I will, till then I hope somebody with the German Umlauts (utf8) or the (European) accent letters experience jumps in and adds it to the function file.

Happy Holidays!
KJ
define('PROJECTS', 'Something that goes on forever!');

#43 sapphal

  • Community Member
  • 42 posts
  • Real Name:Howard

Posted 08 January 2008, 13:04

Great contrib.

people who have Purchase Without Account installed need to edit the order_info.php in the same way as create_account.php. Works Great.

Howard

#44 babba

  • Community Member
  • 16 posts
  • Real Name:Dieter Haude
  • Location:Wiesbaden/Germany

Posted 10 January 2008, 15:19

Hello KJ - great contribution - I like it very much.

Unfortunately I got also hit bei the German-Umlaute problem and I wonder if you meanwhile have gotten an idea how to 'tackle' this small problem?

best regards

Dieter from germany

#45 lefty78

  • Community Member
  • 23 posts
  • Real Name:Rob

Posted 26 January 2008, 16:07

OK. I searched and hope I just didnt miss it.

Anyway, great contribution. It works great and saves us a ton of time.

What we are looking for is the possibility for this to fix issues like my example below:

Customer Enters:
Joe Shmoe
123ValleyRoad
Austin, Texas51515

Corrected:
Joe Shmoe
123 Valley Road
Austin, Texas 51515

Any help or direction would be appreciated!

#46 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 28 January 2008, 14:46

View Postlefty78, on Jan 26 2008, 11:07 AM, said:

OK. I searched and hope I just didnt miss it.

Anyway, great contribution. It works great and saves us a ton of time.

What we are looking for is the possibility for this to fix issues like my example below:

Customer Enters:
Joe Shmoe
123ValleyRoad
Austin, Texas51515

Corrected:
Joe Shmoe
123 Valley Road
Austin, Texas 51515

Any help or direction would be appreciated!

Hi lefty
Thanks for the compliment. I have looked at this problem before and here is what I have got so far:

THe above can be coded in "if" customer inputs an uppercase letter before the supposedly line break. Well that pretty much shoots up the contrib b/c it's for people who can't or don't know when to use upper/lowercase correctly.

Catch 22 basically and here's an (using your) example (we'll take out the city, state, zip as it's another input line)

Customer Enters:
Joe Shmoe
123ValleyRoad
Austin, Texas51515

making line breaks (spaces) at uppercase would make as you said
Joe Shmoe
123 Valley Road
Austin, Texas 51515


NOW... what about if he enters:
Joe Shmoe
123valleyroad
Austin, Texas51515

We could target off a numeric entry and then make a space but we could never decide about the combined word, so it really could be "Valleyroad" sometimes.

So the bottom line is I guess input users (your customers) have to be somewhat responsible for entering their personal info b/c a program or "computer" as everybody calls it just can't be human :(



Contrib's "taskbar":
--------------------------------------------------
I've had a few PM's asking about how my contrib handles names with an ' --->Another words name entered as lisa D'antonio (or whatever mix) "will it be correctly formatted?" YES! It will be shown as Lisa D'Antonio
--------------------------------------------------
German Umlauts? I'm hoping somebody who uses German jumps in and writes in the Umlauts into the exception lists as I don't know the correct usages and phrases for them... I apologize to all of our German user/friends!
--------------------------------------------------
Also had requests for EZ-Mod install compatibility. Yes I can make the change to the install.txt quite easily but there are a few lines that may not be in everybody's osc snapshot. The install is very easy and I think keeping it as such is probably less confusing considering how the shop owner wants each line effected [e.g.] shopowner may not want "EMAIL@email.com" lowercased as "email@email.com" so he can just ommit that line in the install.txt!)
--------------------------------------------------
No reported lockups or "fubars" (hehe... an old computer programming term). But as always BACKUP all effected files before installing this (or any) contrib!

[img]http://www.gokartsrus.com/go-kart_forum/images/smiles/KJ.gif[/img]
define('PROJECTS', 'Something that goes on forever!');

#47 AndreD

  • Community Member
  • 149 posts
  • Real Name:André Kjellstrup

Posted 31 January 2008, 17:13

Hi.
Thanks for the contribution - it was needed.

is there a way to make it understand Scandinavian characters ?
like workds like "HÅKHØYVEIEN " and "SÆTER" are not correctly lower-cased.

Thank you.

#48 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 23 February 2008, 16:23

View PostAndreD, on Jan 31 2008, 12:13 PM, said:

Hi.
Thanks for the contribution - it was needed.

is there a way to make it understand Scandinavian characters ?
like workds like "HÅKHØYVEIEN " and "SÆTER" are not correctly lower-cased.

Thank you.

Hi AndreD
Yes, you can change the standard ISO unicode character set within the contribs function file.
It is set to standard ISO (it's base vocabulary is for english and a bunch of other languages) but what ASCII didn't contain was accented characters (àéñ) and Scandinavian letters (åäöæøðþ). In a quick search I found ISO 8859-1 to include these. As said edit the character set line, then you have the task of changing or adding the exceptions (which as the German umlauts I have no knowledge of correct usages and short phrases that may be "CAPPED" or ""Not in addresses, names etc., sorry but it should be an easy change-over to include these characters to the function file for your (Scandinavian) native accent words/terminology since you know and use these in a everyday inviorment.

Cheers and please post your function file when done for other Scandinavians :)
define('PROJECTS', 'Something that goes on forever!');

#49 stubbsy

  • Community Member
  • 537 posts
  • Real Name:dave stubbs
  • Gender:Male
  • Location:Lyme Regis

Posted 09 April 2008, 21:29

Hi there,

This is a great contibution, esp to format order information correctly so that it can be uploaded in a csv to generate shipping labels into 3rd party systems without throwing up any errors!

So far I have it working fine on the billing address but i'm struggling to get it to work on the shipping address. The problem I have is that i'm trying to get this to work on a combined billing/shipping address page as used in Fast Easy Checkout. It works great on fixing the billing address but I cannot figure how to get it to correct the shipping address.

Here is the page, I must be missing something simple, any ideas?

Thanks

Dave

#50 stubbsy

  • Community Member
  • 537 posts
  • Real Name:dave stubbs
  • Gender:Male
  • Location:Lyme Regis

Posted 04 May 2008, 06:59

In case anyone was bothered ... I solved it ;)

Edited by stubbsy, 04 May 2008, 07:00.


#51 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 19 May 2008, 13:01

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
define('PROJECTS', 'Something that goes on forever!');

#52 sfxMichael

  • Community Member
  • 3 posts
  • Real Name:Michael

Posted 11 June 2008, 13:12

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

#53 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 13 June 2008, 13:42

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
define('PROJECTS', 'Something that goes on forever!');

#54 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 13 June 2008, 14:02

As an add on, depending on your decoding

You may want to experiment with the special characters in ASCII format
define('PROJECTS', 'Something that goes on forever!');

#55 magicandmischief182

  • Community Member
  • 180 posts
  • Real Name:Jeffrey Rosen.

Posted 14 May 2009, 13:35

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

#56 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 30 June 2009, 14:46

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
define('PROJECTS', 'Something that goes on forever!');

#57 Jamez

  • Community Member
  • 108 posts
  • Real Name:James

Posted 30 June 2009, 15:55

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

#58 stragami

  • Community Member
  • 72 posts
  • Real Name:Alfred
  • Gender:Male
  • Location:Germany

Posted 08 July 2009, 12:24

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

#59 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 09 July 2009, 13:35

View Poststragami, on Jul 8 2009, 08:24 AM, said:

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)
define('PROJECTS', 'Something that goes on forever!');

#60 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 09 July 2009, 13:52

Jamez, on Jun 30 2009, 10:46 AM, said:

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, 09 July 2009, 13:56.

define('PROJECTS', 'Something that goes on forever!');