我需要爲不同的產品添加不同的尺寸圖到我的magento商店。如何在Magento中爲不同的產品使用不同的尺寸圖
有人可以在這裏解釋,如何做到這一點,也給我一個解決方案來做到這一點。
在此先感謝 formygalaxy
我需要爲不同的產品添加不同的尺寸圖到我的magento商店。如何在Magento中爲不同的產品使用不同的尺寸圖
有人可以在這裏解釋,如何做到這一點,也給我一個解決方案來做到這一點。
在此先感謝 formygalaxy
你可以做這樣的連接產品屬性(例如製造商)與靜態塊。
參見此代碼:
$sizeGuideIdentifier = trim($_product->getAttributeText('manufacturer'));
$sizeGuideIdentifier = str_replace(' ','-',strtolower($sizeGuideIdentifier)) .'-size-guide';
if($this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml()):
echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml();
else:
echo $this->getLayout()->createBlock('cms/block')->setBlockId('product-sizeguide')->toHtml();
endif;
它將嘗試回聲出一個例如被稱爲塊「nike-sizeguide」,如果這個塊不存在,它會回落到默認的sizeguide。
歐文您好,感謝一噸的回答是不被接受的OP。如果你向我詳細解釋這一點,這將是非常棒的。例如,在何處安裝此代碼以及如何將此代碼集成到產品頁面等等。提前致謝 – formygalaxy
您可以將此代碼段放在產品視圖模板的任何位置:/ magento/app/design/frontend/[packagename]/[templatename] /catalog/product/view.phtml 之後,創建一個靜態塊並將其命名爲product-sizeguide。 如果您想爲特定品牌使用不同的尺寸導標,請使用標識符nike-sizeguide創建尺寸指南。在後臺轉到您的產品,並將製造商設置爲耐克,並且應該選擇耐克特定尺寸指南。 –
謝謝erwin,我沒有設置任何'製造商',我的男士類別是(/men/formal-shirts/regular.html)和女士(女士/上衣/ blouse.html)。根據這個如何改變你的代碼。 – formygalaxy
yup,這在Magento 1.9CE上完美運行,儘管對於我來說Erwin的解決方案需要插入到「app/design/frontend /.../.../ template/catalog/product/view/type/options /configurable.phtml」。
真的很簡單的解決方案和偉大的結果;我們現在爲每個品牌(製造商)自動彈出一個fancybox尺寸圖圖像,無需編碼,我們的庫存經理不需要考慮它。
真的非常棒 - 非常感謝Erwin Smit。我希望好人緣訪問了你了;)
<dd <?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
<div class="size-box"><?php
$sizeGuideIdentifier = trim($_product->getAttributeText('manufacturer'));
$sizeGuideIdentifier = str_replace(' ','-',strtolower($sizeGuideIdentifier)) .'-size-guide';
if($this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml()):
echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml();
else:
echo $this->getLayout()->createBlock('cms/block')->setBlockId('product-sizeguide')->toHtml();
endif;?>
</div>
</dd>
答案,即使他同意,他得到了解決 –