Jump to content

[solved]Help with SQL query


Kolopsia

Recommended Posts

Hello,

I need to import products descriptions into products meta descriptions, so i executed this query and it did work

 

UPDATE ps_product_lang
    SET ps_product.meta_description=(SELECT ps_product_lang_description FROM ps_product_lang

 

but i need to strip the description of HTML tags, so what should i add to the query to get only simple text, no html tags?

Any help appreciated


 

 

 

Link to comment
Share on other sites

So what you need is not a SQL query, but a simple csv import.

If you don't know SQL and php, so please refrain to make any manual manipulation on the database. It is not good, if you don't know what exaclty you are doing.

1) Use the native import function on your back-office for to import your csv. If your products are already added to database, than export them from back-office. Before you import the csv again, you simply save it as UTF-8. In this case you will change encoding and strip all HMTL-tags.

Export your products from back-office product site. On right top of site you will find some grey buttons. One is for export. For to reimport the products the only thing what you need is ID, product name and product description.

Take this csv and save it with UTF-8 encoding. You can use the free editor PSPad for this. Simply open your csv with PSPAD, go on top to Format, check UTF-8 and save your file.

After this, import your file with Prestashop native csv import. Back-office Tab "Advanced Parameters -> csv import

 

2) Another possibility is to use an online HTML Stripping tool like this: http://www.striphtml.com/ or

https://www.browserling.com/tools/html-strip

Add your text there and copy the plain text.

Link to comment
Share on other sites

On 4/23/2018 at 3:14 PM, selectshop.at said:

So what you need is not a SQL query, but a simple csv import.

If you don't know SQL and php, so please refrain to make any manual manipulation on the database. It is not good, if you don't know what exaclty you are doing.

1) Use the native import function on your back-office for to import your csv. If your products are already added to database, than export them from back-office. Before you import the csv again, you simply save it as UTF-8. In this case you will change encoding and strip all HMTL-tags.

Export your products from back-office product site. On right top of site you will find some grey buttons. One is for export. For to reimport the products the only thing what you need is ID, product name and product description.

Take this csv and save it with UTF-8 encoding. You can use the free editor PSPad for this. Simply open your csv with PSPAD, go on top to Format, check UTF-8 and save your file.

After this, import your file with Prestashop native csv import. Back-office Tab "Advanced Parameters -> csv import

 

2) Another possibility is to use an online HTML Stripping tool like this: http://www.striphtml.com/ or

https://www.browserling.com/tools/html-strip

Add your text there and copy the plain text.

 

But this method will only strip html tags on products description it will not copy products descriptions into the meta descriptions, right? 

Link to comment
Share on other sites

On metas you are using html-tags ? This make no sense... Did you copied the text from somewhere ? Also for metas the html-tags should be stripped by UTF-8 encondig before you import your new prepared and saved utf-8 encoding csv file.

So you must prepare a file with both.

Link to comment
Share on other sites

12 hours ago, selectshop.at said:

On metas you are using html-tags ? This make no sense... Did you copied the text from somewhere ? Also for metas the html-tags should be stripped by UTF-8 encondig before you import your new prepared and saved utf-8 encoding csv file.

So you must prepare a file with both.

 

I think you misunderstood my question, i dont need to strip products description of html tags but i need to run sql query to import products descriptions into meta-descriptions, because if you see the screenshot, somehow despite having products description on all pages the seo inspector cant find any description on the page and im not sure why so i need to at least have the meta-description on the page but need it without html tags.

 

 

presta.JPG

Link to comment
Share on other sites

Than simply map on your csv the field you have as meta-description to the meta-description field on csv import tool from your back-office.

It's quite simple to import what you need by csv import. Again: If you don't know SQL and php, so please refrain to make any manual manipulation on the database. It is not good, if you don't know what exactly you are doing. You can import these data you need by csv import.You don't need any SQL query for that.

image.thumb.png.0210480ff833d1f0c252cc46a7a725b8.png

Link to comment
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
×
×
  • Create New...