[英]How to Add Custom Attribute on product Grid in magento 1.9.2 community edition
[英]How to add different size-guide in different product in magento 1.9.2?
如何在magento 1.9.2的不同产品中添加不同尺寸的指南?
我正在由magento建立的电子商务商店。 在产品中,我们有一个尺寸表,其中详细显示了男性和女性的尺寸。
创建属性属性代码:'select_size_guide_table',范围:全局,商店的目录输入类型:下拉菜单,商店所有者的目录输入类型:下拉菜单,唯一值:否,必填值:否,商店所有者的输入验证:无,应用于:所有类型的产品,用于创建可配置产品:否,用于快速搜索:否,用于快速搜索:否,用于高级搜索:否,前端可比性:否,用于分层导航:否搜索结果分层导航:否,用于促销规则条件:否位置:0允许在前端使用HTML标签:是,在前端的产品查看页面上可见:否,用于产品清单:否,用于对产品清单进行排序:否
下一个
在文本字段中管理标签/选项:选择尺寸指南表在文本字段中管理选项:女性-底部-全尺寸
下一个
转到静态块->添加新->块标题:尺寸指南-底部满女性,->标识符:底部完整女性,->添加内容或图像(您想要哪个)
下一个
app \\ design \\ frontend \\ yourtheme \\ template \\ catalog \\ product \\ view \\ type \\ options \\ configurable.phtml在下面替换
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<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>
</dd>
<?php if(strlen(strstr($_attribute->getLabel(),'Size'))>0) : ?>
<?php
$sizeGuideTableAttribute = $_product->getResource()->getAttribute('select_size_guide_table');
if($sizeGuideTableAttribute):
$sizeGuideTableAttributeValue = $sizeGuideTableAttribute->getFrontend()->getValue($_product);
if ($sizeGuideTableAttributeValue != 'No') :
?>
<a href="#" class="size-guide-link" id="popup" onclick="div_show()">
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/indianink/images/catalog/product/size-chart.jpg" alt="size guide"/>
Size Guide
</a>
<script>
//function to display Popup
function div_show(){
document.getElementById('size_guide').style.display = "block";
}
//function to hide Popup
function div_hide(){
document.getElementById('size_guide').style.display = "none";
}
</script>
<style>
#size_guide{
width: 100%;
height: 100%;
display: none;
position: fixed;
background-color: #313131;
overflow:auto;
top: 0;
left: 0;
z-index: 9999;
overflow: hidden;
}
img#close{
position: absolute;
right: -14px;
top: -14px;
cursor: pointer;
}
div#popupContact{
width: 40%;
margin-left: 29%;
margin-top: 5%;
background: #fff;
}
.validation-passed{float: right;}
.close{float: right;}
</style>
<div id="size_guide" style="display: none;">
<!-- Popup div starts here -->
<div id="popupContact">
<!--<img src="3.png" id="close" onclick="div_hide()">-->
<div class="modal fade" id="size-guide-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onclick="div_hide()">X</button>
</div>
<div class="modal-body">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideTableAttributeValue)->toHtml(); ?>
</div>
</div>
</div>
</div>
</div>
<!-- Popup div ends here -->
</div>
<?php endif; //$sizeGuideTableAttributeValue
endif; //$sizeGuideTableAttribute
?>
<?php endif; //strlen ?>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
</script>
<?php endif;?>
最好的方法是使用3rd party扩展名,因为Magento并未提供此功能。 我建议使用来自Averun公司扩展尺寸表- https://averun.com/magento-size-chart.html 。 您将能够为不同的产品或类别添加不同的尺寸指南。 该扩展名包含包装盒中的几套国际尺寸。 另外,您的客户将建议您选择正确的尺寸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.