I'm currently working on a Backend-like Page for special Customers within our shop. Theese special customers should be able to export product-data for a predefinied Shopsystem and other internal (shop related) stuff.
I was able to create a query with a thousands while
statements but it looks pretty bad and is hard to understand / edit for someone with no understanding.
I road about MYSQL inner join
statements and stuff like that but got never into it.
Has anyone a query
to get the following data?
- Product Name
- Product SKU
- Product Price
- Short-description
- Description
- Main & Thumbnail image
- Additional images
- Product Categories
Or could explain / link ressources to get to a result like this ?
EDIT – 08/09/2017
I road a few documentaions and learned some new stuff. My query currently looks like this:
SELECT
catalog_product_entity.entity_id AS id,
catalog_product_entity.type_id AS type,
catalog_product_entity.attribute_set_id AS attribute_id,
catalog_product_entity.sku AS sku,
catalog_product_entity_varchar.value AS name,
catalog_product_entity_decimal.value AS price
FROM catalog_product_entity
LEFT JOIN catalog_product_entity_varchar ON catalog_product_entity.entity_id = catalog_product_entity_varchar.entity_id
LEFT JOIN catalog_product_entity_decimal ON catalog_product_entity.entity_id = catalog_product_entity_decimal.entity_id
WHERE
catalog_product_entity_varchar.attribute_id = "71" AND
catalog_product_entity_varchar.store_id = "0" AND
catalog_product_entity_decimal.attribute_id = "75";
So far so good, everything works like i want it to be. The only part I dont understand ist the part where i have to select a new entry from catalog_product_entity_varchar
to get the description and other attributes
Anything i can read about that ? Anyone who can help ?
Best Answer
First, it is not that simple, Magento database modeling is in eav (entity,attribute,value) so it requires a lot of JOINS
I recommand doing this by passing through Magento collections (in php script)
But anyway here is the MySQL query that responds to your need :
Try it and let me know if it helped you.