我需要一个自定义magento
query
,它可以从数据库中获取以下值:
product name,
product link,
product description,
product image,
product price,
product SKU.
答案 0 :(得分:2)
试试这些,
$sku = Mage::getModel('catalog/product')->load($_product->getId())->getName();
$sku = Mage::getModel('catalog/product')->load($_product->getId())->getDescription();
$sku = Mage::getModel('catalog/product')->load($_product->getId())->getPrice();
$sku = Mage::getModel('catalog/product')->load($_product->getId())->getSku();
echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(50,50);
答案 1 :(得分:2)
此SQL将为您提供产品名称。您可以修改此查询,为SKU等添加attribute_id
和entity_type_id
。
SELECT `value` AS product_name
FROM catalog_product_entity_varchar
WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product')
AND attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'))
如果您有多个attribute_id
和entity_type_id
,则使用IN
SQL
个关键字