Problem seems to be that description
, meta_keywords
art not part of flat table ...
Please try this query:
SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`
FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
If this attributes are part of flat tables this should work:
MAGENTO_ROOT/myFile.php
<?php
require_once('./app/Mage.php');
error_reporting(E_ALL);
ini_set('display_errors', 1);
umask(0);
Mage::app();
$attributes = array(
'description',
'meta_keyword'
);
$collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect($attributes)
->addUrlRewrite()
->addMinimalPrice()
->addFinalPrice();
echo $collection->getSelect()->__toString();
Note: you can set this in Manage Attributes -> Use in Product Listing.
If not, you I had to diable flat tables first ...
MAGENTO_ROOT/myFile.php
<?php
require_once('./app/Mage.php');
error_reporting(E_ALL);
ini_set('display_errors', 1);
umask(0);
Mage::app();
$helper = Mage::helper('catalog/product_flat');
$status = $helper->getProcess()->getStatus();
$helper->getProcess()->setStatus(Mage_Index_Model_Process::STATUS_RUNNING);
$attributes = array(
'description',
'meta_keyword'
);
$collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect($attributes)
->addUrlRewrite()
->addMinimalPrice()
->addFinalPrice();
echo $collection->getSelect()->__toString();
$helper->getProcess()->setStatus($status);
To output SQL-query, you can use this:
echo $collection->getSelect()->__toString();
If you want to retrieve product name and product image togheter you have to use this query
select category.product_id, product1.value as name, product2.value as image
from catalog_category_product as category
join catalog_product_entity_varchar as product1 on product1.entity_id=category.product_id and product1.attribute_id=60 and product1.store_id=0
join catalog_product_entity_varchar as product2 on product2.entity_id=category.product_id and product2.attribute_id=74 and product2.store_id=0
where category.category_id=3
order by category.product_id asc
Change 60 and 74 with your attribute id 73 and 88.
Best Answer
SQL QUERY (Magento 2.1 and earlier):
SQL QUERY (Magento 2.2 and later):
As mentioned by Shashank Kumrawat, Sku value is stored in catalog_product_entity and name field value is stored in
catalog_product_entity_varchar