Displaying product manufacturer information
You can assign a manufacturer to each product in your catalog. The manufacturer PHP object (Shop_Manufacturer) is accessible through the $manufacturer field of the Shop_Product class (the $product variable). To keep the product page code clean, it is recommended to create a separate partial for displaying products manufacturer information. The following code outputs all manufacturer details.
<? if ($product->manufacturer): ?>
<h4>Manufacturer</h4>
<p>
<?= h($product->manufacturer->name) ?>
</p>
<?= $product->manufacturer->description ?>
<img src="<?= h($product->manufacturer->logo_url(100, 'auto')) ?>"/>
<p>Address: <?= h($product->manufacturer->address) ?><br/>
City: <?= h($product->manufacturer->city) ?><br/>
ZIP: <?= h($product->manufacturer->zip) ?><br/>
Phone: <?= h($product->manufacturer->phone) ?><br/>
Fax: <?= h($product->manufacturer->fax) ?><br/>
Country: <?= h($product->manufacturer->columnValue('country')) ?><br/>
State: <?= h($product->manufacturer->columnValue('state')) ?><br/>
Email: <?= h($product->manufacturer->email) ?><br/>
Website: <?= h($product->manufacturer->url) ?>
</p>
<? endif ?>
Now you can render the partial on the product page. Note that we named the manufacturer partial shop:manufacturer, but of course you can use any name.
<? $this->render_partial('shop:manufacturer') ?>
Next: Displaying product rating and reviews
Previous: Displaying related products
Return to Product page


Comments
No comments posted so far.
Add your comment
Loading form...