Jump to content
Top_Speed

[CONTRIBUTION] Sloppy Words Cleaner

Recommended Posts

Uploaded with the above fix

Sloppy Words Cleaner 3.3.2

Requires Phoenix 1.0.7.7+

 

Changes versus Sloppy Words Cleaner 3.3.1

- updated for Phoenix 1.0.7.7+

- updated code in cfgm_store.php module. Thanks to @artfulweb

Share this post


Link to post
Share on other sites

@raiwa  Rainer

Am I right in saying that if I want the entered City text to be all in capitals when creating an account and when updating the address details I should change

(isset($customer_details['city'])) $customer_details['city'] = $this->RemoveShouting($customer_details['city']);

to

if (isset($customer_details['city'])) $customer_details['city'] = strtoupper($customer_details['city']);

and the same change in the delivery address bit of code.

Cheers


REMEMBER BACKUP, BACKUP AND BACKUP

Share this post


Link to post
Share on other sites

Uploaded new version:

Sloppy Words Cleaner 3.4.0

Requires Phoenix 1.0.7.7+

 

Compatibility:
OSCOM Phoenix CE 1.0.7.7+
Tested with Phoenix 1.0.7.11

PHP: 7.0-7.4

Changes versus Sloppy Words Cleaner 3.3.2
- updated store module to abstract executable module
- added missing hook warning
- updated code to match current core standards

Share this post


Link to post
Share on other sites

Uploaded new version 3.4.1 with an error fix in the store module's config entries.

Sloppy Words Cleaner 3.4.1

Requires Phoenix 1.0.7.7+

 

Compatibility:
OSCOM Phoenix CE 1.0.7.7+
Tested with Phoenix 1.0.7.11

PHP: 7.0-7.4

Changes versus Sloppy Words Cleaner 3.4.0
- fixed error in store module configuration entry. Thanks to @gritsop

Changes versus Sloppy Words Cleaner 3.3.2
- updated store module to abstract executable module
- added missing hook warning
- updated code to match current core standards

Share this post


Link to post
Share on other sites

Rainer

Not updated to the latest version just yet, but have had a few customers sign up with a company name and it does not come out formatted with capitals for every word. The line for the company is

        if (isset($customer_details['company']) && MODULE_STORE_SWCLEANER_CLEAN_COMPANY == 'True') $customer_details['company'] = RemoveShouting($customer_details['company'], 'company');

Should this be capitalising every word in the company name. If not, what changes are required.


REMEMBER BACKUP, BACKUP AND BACKUP

Share this post


Link to post
Share on other sites
4 hours ago, 14steve14 said:

Rainer

Not updated to the latest version just yet, but have had a few customers sign up with a company name and it does not come out formatted with capitals for every word. The line for the company is


        if (isset($customer_details['company']) && MODULE_STORE_SWCLEANER_CLEAN_COMPANY == 'True') $customer_details['company'] = RemoveShouting($customer_details['company'], 'company');

Should this be capitalising every word in the company name. If not, what changes are required.

Hy Steve,

"RemoveShouting" does what it says: it converts all upper case (shouting) to first letter upper and the rest lower case.

To convert it to all upper case just replace "RemoveShouting" with "strtoupper".

But be advised that there are company names which have a specific upper lower case pattern. Like "osCommerce", "WordPress", "YouTube".

I therefore recommend not to touch the Company input at all.

Share this post


Link to post
Share on other sites
25 minutes ago, raiwa said:

To convert it to all upper case just replace "RemoveShouting" with "strtoupper".

I don't think that's what he wants.  I read it as wanting REMOVE SHOUTING to become Remove Shouting.  What is often called Title Cased.  So he may want ucwords to wrap either RemoveShouting or strtolower. 

        if (isset($customer_details['company']) && MODULE_STORE_SWCLEANER_CLEAN_COMPANY == 'True') {
          $customer_details['company'] = ucwords(RemoveShouting($customer_details['company'], 'company'));
        }

I.e. his problem is "INTERNATIONAL BUSINESS MACHINES" is becoming "International business machines" when he wants "International Business Machines".  I guess he's all right with IBM becoming Ibm. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
12 minutes ago, ecartz said:

I don't think that's what he wants.  I read it as wanting REMOVE SHOUTING to become Remove Shouting.  What is often called Title Cased.  So he may want ucwords to wrap either RemoveShouting or strtolower. 


        if (isset($customer_details['company']) && MODULE_STORE_SWCLEANER_CLEAN_COMPANY == 'True') {
          $customer_details['company'] = ucwords(RemoveShouting($customer_details['company'], 'company'));
        }

I.e. his problem is "INTERNATIONAL BUSINESS MACHINES" is becoming "International business machines" when he wants "International Business Machines".  I guess he's all right with IBM becoming Ibm. 

You are right I understood wrong.

This is already done like you say in the RemoveShouting function with more options than ucwords and special character support:

    // captialize all first letters
    $str = mb_convert_case($string, MB_CASE_TITLE, CHARSET);

I do not know why it doesn't work for him.

@14steve14, do you have the setting "MODULE_STORE_SWCLEANER_CLEAN_COMPANY" set to "true"?

Are this accounts created in the store or the data imported from PayPal by PayPAl express?

Share this post


Link to post
Share on other sites
Posted (edited)

@ecartz @raiwa  Sorry been away getting orders out. I should have been a bit clearer.

I have had two customers since Christmas enter a company name and both times the first letter of the company name is capitalised and every other word in the name after that is lower case including one ltd on the end. So its like 'International business machines ltd' when I think it should be 'International Business Machines Ltd'.

Company name setting in admin is set to true even though advice is not too.

I have just uploaded the latest package and after testing with company name set to true everything seems to be working as I would hope.

Edited by 14steve14

REMEMBER BACKUP, BACKUP AND BACKUP

Share this post


Link to post
Share on other sites

Rainer

Bit of another silly question.

Is there a way to remove any spaces in the phone number. We have customers contact us and leave a phone number on the answer machine but no names. We have search added to the telephone number module but some customers have been adding spaces in the numbers which makes searching very difficlt. Wanting no spaces for any new signed up customers as can remove older ones using sql I hope.


REMEMBER BACKUP, BACKUP AND BACKUP

Share this post


Link to post
Share on other sites
Posted (edited)

Phone number is not cleaned in the hook. You can copy any line for example:

        if (isset($customer_details['email_address'])) $customer_details['email_address'] = strtolower($customer_details['email_address']);

Then change "email_address" to "customers_telephone" and for just spaces use that function:

$string = str_replace(' ', '', $string);

 

Edited by raiwa

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

×