Reputation: 138
I have to use some variables again and again in different files.
$_product = $this->getProduct();
$_helper = $this->helper('catalog/output');
$_productType = $_product->getTypeID();
$_productName = $_helper->productAttribute($_product, $_product->getName(), 'name');
$_manufacturer = $_product->getAttributeText('manufacturer');
$_decor = $_product->getAttributeText('decor');
$_serie = $_product->getAttributeText('serie');
$originalImageWidth = $this->helper('catalog/image')->init($_product, 'image')->getOriginalWidth();
$originalImageHeight = $this->helper('catalog/image')->init($_product, 'image')->getOriginalHeight();
$originalImageRelation = $originalImageWidth / $originalImageHeight;
All this, I need in /templates/catalog/product/view.phtml
and /templates/catalog/product/type/grouped.phtml
and templates/catalog/product/media.phtml
.
Is there a way to gather this in a central file and reuse it in all this places?
Upvotes: 0
Views: 46