【问题标题】:Retrieve default product image without product - Magento检索没有产品的默认产品图像 - Magento
【发布时间】:2012-05-22 06:02:54
【问题描述】:

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

谢谢, Krt_马耳他

【问题讨论】:

    标签: magento


    【解决方案1】:

    未经测试,但这应该可以:

    /**
     * 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));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多