Post by ClosedCart » Sat Aug 15, 2015 3:07 pm

I need an extension that would find "ABC" in the description field of ALL or selected products and replace it with "XYZ"
sort of like a find and replace

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by Cue4cheap » Tue Aug 18, 2015 5:05 am

Could you tell me what you are trying to achieve? Are you wanting to do this one time or more then once?

If you wish to change ABC to XYZ in the description you could do that with a sql command through phpmyadmin.

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ClosedCart » Tue Aug 18, 2015 11:23 am

Cue4cheap wrote:Could you tell me what you are trying to achieve? Are you wanting to do this one time or more then once?

If you wish to change ABC to XYZ in the description you could do that with a sql command through phpmyadmin.

Mike
Hey, what I'm trying to achieve exactly is what you're saying.

Finding ABC in EVERY product's description, and changing it to XYZ. If you can give me the SQL command for that it'd be appreciated. Thanks!

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by Cue4cheap » Tue Aug 18, 2015 12:12 pm

Go into phpmyadmin, select your database for your store and run:

UPDATE product_description SET description = replace(description,"ABC","XYZ");

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ClosedCart » Tue Aug 18, 2015 3:20 pm

I'll try it when I get home. Thanks for the great help.
Last edited by ClosedCart on Tue Aug 25, 2015 10:17 pm, edited 1 time in total.

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by ClosedCart » Tue Aug 25, 2015 10:16 pm

Cue4cheap wrote:Go into phpmyadmin, select your database for your store and run:

UPDATE product_description SET description = replace(description,"ABC","XYZ");

Mike
Hey, I have another request if you dont mind. This time, I need to update all product descriptions. For example, find "Free Shipping" in every single title and remove it.

Would it be

Code: Select all

UPDATE oc_product_title SET title = delete(title,"Free Shipping");
? (even though I cant find the oc_product_title on my database list

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by Cue4cheap » Wed Aug 26, 2015 5:10 am

ClosedCart wrote:
Cue4cheap wrote:Go into phpmyadmin, select your database for your store and run:

UPDATE product_description SET description = replace(description,"ABC","XYZ");

Mike
Hey, I have another request if you dont mind. This time, I need to update all product descriptions. For example, find "Free Shipping" in every single title and remove it.

Would it be

Code: Select all

UPDATE oc_product_title SET title = delete(title,"Free Shipping");
? (even though I cant find the oc_product_title on my database list

Ummmm.... I read what you wrote as apples and oranges and confused me a bit....
You write "update all product descriptions" .... and find "Free Shipping" in every title.... Do you mean "Custom title" or is it actually still in the product description that has "Free Shipping"?
If the later then it would be the same code as I put before but:

UPDATE product_description SET description = replace(description,"Free Shipping","");

The warning here is again to back up before you do this AND to see what the pattern is. IF you have a space before and after "Free Shipping" and you run the code like it put it then your descriptions will have two spaces still but no longer "Free Shipping". So maybe:
UPDATE product_description SET description = replace(description," Free Shipping","");

If that isn't what you wanted (i.e. you meant the "Custom tile" to be adjusted) please let me know....
Mike

EDIT: PS Maybe you were referring to "Product Name" as the title you refer to where you want the change?

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ClosedCart » Fri Aug 28, 2015 8:01 am

Cue4cheap wrote:
ClosedCart wrote:
Cue4cheap wrote:Go into phpmyadmin, select your database for your store and run:

UPDATE product_description SET description = replace(description,"ABC","XYZ");

Mike
Hey, I have another request if you dont mind. This time, I need to update all product descriptions. For example, find "Free Shipping" in every single title and remove it.

Would it be

Code: Select all

UPDATE oc_product_title SET title = delete(title,"Free Shipping");
? (even though I cant find the oc_product_title on my database list
Hey sorry for the late reply.

Ummmm.... I read what you wrote as apples and oranges and confused me a bit....
You write "update all product descriptions" .... and find "Free Shipping" in every title.... Do you mean "Custom title" or is it actually still in the product description that has "Free Shipping"?
If the later then it would be the same code as I put before but:

UPDATE product_description SET description = replace(description,"Free Shipping","");

The warning here is again to back up before you do this AND to see what the pattern is. IF you have a space before and after "Free Shipping" and you run the code like it put it then your descriptions will have two spaces still but no longer "Free Shipping". So maybe:
UPDATE product_description SET description = replace(description," Free Shipping","");

If that isn't what you wanted (i.e. you meant the "Custom tile" to be adjusted) please let me know....
Mike

EDIT: PS Maybe you were referring to "Product Name" as the title you refer to where you want the change?
Hey sorry for the late reply. I think what you gave me first solved my problem (finding x and replacing it with y in the description)

My new question was finding x in the products title/name/what it's called and deleting it.

Reason being is that initially I put "free shipping" in all the titles like

"Red colored printed boys shirt free shipping"

But now I'm not offering free shipping, so it would be decieving/not accurate to have free shipping in the name. And I can't manually do it for so much products.

Hope you understand now.

Thanks for the help

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by Cue4cheap » Sun Aug 30, 2015 4:12 am

The product "titles" are actually the "Product name" when you edit the product. You can validate this by going into your store admin and editing a product and you should see your "free shipping" in the "Product Name:" under the general tab. So that being the case, and please verify it before moving forward you can run this sql command in PHPMyadmin:

UPDATE product_description SET name = replace(name,"free shipping","");

Two things to remember:
1) back up before doing anything directly on your database
2) This will act on it and will leave a - if you put it in front from "free shipping" or it will leave two spaces if you have "free shipping" in between other words. And IF it wasn't entered in consistently then you will get 'leftovers'.

Examples of the Product Name (made up):
Big green frog statue - free shipping. Running that command you will end up with "Big green frog statue - "

Big green frog statue - free shipping - GREAT for your lawn. Running that command you will end up with "Big green frog statue - - GREAT for your lawn."

Big green frog statue - free shipping for all products. Running that command you will end up with "Big green frog statue - for all products."

So do a check and see how "free shipping" was entered and adjust the SQL command above to adjust.
Using the 2nd example:
Big green frog statue - free shipping - GREAT for your lawn.

The SQL would end up being:
UPDATE product_description SET name = replace(name," - free shipping -","");
That will get rid of the space before and after the -, the -, the words free shipping, and the space before the 2nd dash and the 2nd dash.

IF whoever put in "free shipping" wasn't consistent then you may need to run that command a few times and adjusting it to how free shipping was put in.

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ClosedCart » Mon Sep 07, 2015 7:16 am

Cue4cheap wrote:The product "titles" are actually the "Product name" when you edit the product. You can validate this by going into your store admin and editing a product and you should see your "free shipping" in the "Product Name:" under the general tab. So that being the case, and please verify it before moving forward you can run this sql command in PHPMyadmin:

UPDATE product_description SET name = replace(name,"free shipping","");

Two things to remember:
1) back up before doing anything directly on your database
2) This will act on it and will leave a - if you put it in front from "free shipping" or it will leave two spaces if you have "free shipping" in between other words. And IF it wasn't entered in consistently then you will get 'leftovers'.

Examples of the Product Name (made up):
Big green frog statue - free shipping. Running that command you will end up with "Big green frog statue - "

Big green frog statue - free shipping - GREAT for your lawn. Running that command you will end up with "Big green frog statue - - GREAT for your lawn."

Big green frog statue - free shipping for all products. Running that command you will end up with "Big green frog statue - for all products."

So do a check and see how "free shipping" was entered and adjust the SQL command above to adjust.
Using the 2nd example:
Big green frog statue - free shipping - GREAT for your lawn.

The SQL would end up being:
UPDATE product_description SET name = replace(name," - free shipping -","");
That will get rid of the space before and after the -, the -, the words free shipping, and the space before the 2nd dash and the 2nd dash.

IF whoever put in "free shipping" wasn't consistent then you may need to run that command a few times and adjusting it to how free shipping was put in.

Mike
Hey, suberb reply. Thanks a lot for being concise and super clear, I appreciate it. And sorry for replying late again. That's about all I need now and this thread can now die or live on for whoever else needs help in the future with the asme thing. Everything worked fantastically.

Cheers
-Moe

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm
Who is online

Users browsing this forum: No registered users and 3 guests