Question

avoir ce code:

$this->helper('catalog/image')->init($_product, 'slider_img')->resize(400,300)

comment vérifier si le 'slider_img' existe?

Était-ce utile?

La solution

c'était facile:

if ($_product->getSliderImg())

Mise à JOUR:

Trouvé une meilleure façon d'éviter toute image exception à l'aide de try/catch:


try {
  $product_img = $this->helper('catalog/image')->init($_product, 'header_slider_img')
}
catch (Exception $e) {
  Mage::log('Image '.$e->getMessage(), null, 'image_exception.log');
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top