Saya ingin mendapatkan URL gambar placeholder di Controller. Bagaimana cara mendapatkan URL.?

-2
Nagaraj Juro 13 Desember 2017, 09:08

1 menjawab

Jawaban Terbaik

Jika Anda ingin mendapatkan URL gambar placeholder pada file template Anda, Anda dapat menggunakan

\Magento\Store\Model\StoreManager $storeManager

$this->storeManager = $storeManager;
$path =
catalog/placeholder/thumbnail_placeholder OR
catalog/placeholder/swatch_image_placeholder OR
catalog/placeholder/small_image_placeholder OR
catalog/placeholder/image_placeholder OR

public function getConfig($config_path)
{
    return $this->storeManager->getStore()->getConfig($config_path);
}

<img src = $mediaUrl.'catalog/product/placeholder'.$this->getConfig($path) />
    $mediaUrl = $this ->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA );
0
user3402754 13 Desember 2017, 06:21