Shakeel Ahmed
Shakeel Ahmed

Reputation: 1848

I want to get all products from opencart

I need a query to get all products from opencart mysql. I am using this query.

"SELECT * FROM `" . DB_PREFIX . "product`";

but I can't get product name or title in this query. Actually I am creating another application and I want to export all products into new DB.

Upvotes: 1

Views: 2896

Answers (1)

Rupak Nepali
Rupak Nepali

Reputation: 759

Real sql

SELECT * FROM oc_product p LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '1' GROUP BY p.product_id ORDER BY pd.name ASC

First take oc_ into consideration as this is DB_PREFIX. Then take pd.language_id='1' into consideration as it retrieves products only having language_id=1. If there are multiple language then you have to find the language_id and change it.

This is to retrieve all

SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)

Upvotes: 3

Related Questions