Jump to content

category name query


Recommended Posts

So I am trying to extract a csv file with every product id and category name (not id) only.

I am new to prestashop (and sql for that matter) and I was wondering if anyone could help me write a query for this purpose: product id and category name for each product id.

I found the  _category_lang  file where are located the columns I am intersested in: link_rewrite (eg. wholesale-clothing) and meta_title (eg. Wholesaleclothing » Wholesale Cheap Clothes » etc.).

These are the two columns that I need as the category name columns.

Edited by andreiven (see edit history)
Link to comment
Share on other sites

Try this, in back office go to Advanced Parametars > SQL Manager.

Add new SQL query, add  name and following code

SELECT p.id_product as ID, cl.name as CategoryName
FROM ps_product p 
LEFT JOIN  ps_category_lang  cl ON p.id_category_default = cl.id_category
WHERE cl.id_lang = 1

Asnd save. You can export or veiw query after.

Note this will have two columns, product id and categor name, and that name will be for language with id 1.

So change that if language you want to export have other id.

 

Also similar SQL query you can add in this free module 

https://www.prestashop.com/forums/topic/506060-big-data-the-datas-csv-easy-for-all/

whith bit more options and display of data.

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...