0

我想检索 Magento 中的默认产品缩略图,以将其应用于产品以外的其他东西,因此我无权访问 $product。这有没有可能?

谢谢, Krt_Malta

4

1 回答 1

0

未经测试,但这应该有效:

/**
 * Get the resource model
 */
$resource = Mage::getSingleton('core/resource');

/**
 * Retrieve the read connection
 */
$readConnection = $resource->getConnection('core_read');

$query = 'SELECT thumbnail FROM ' . $resource->getTableName('catalog/product_flat') . ' WHERE sku = "(insert your product SKU here)"'; // Insert SKU here

/**
 * Execute the query and store the results in $results
 */
$results = $readConnection->fetchAll($query);

/**
 * Print out the results
 */
echo sprintf('<pre>%s</pre>' print_r($results, true));
于 2012-05-21T22:02:54.883 回答