是magento的新手。如何拥有一个按钮,而不是在产品页面上添加到购物车按钮。该按钮必须在新窗口中打开一个URL,我在一个属性中提到过。每个产品根据产品都有不同的URL。在这个问题上提供帮助
提前致谢。
答案 0 :(得分:0)
要拥有产品页面中的按钮,您必须复制文件:
for 1.9:app/design/rwd/default/template/catalog/product/view/addtocart.phtml
for previous:app/design/base/default/template/catalog/product/view/addtocart.phtml
然后,您可以将其复制到:app/design/[your_package]/[your_theme]/template/catalog/product/view/addtocart.phtml
在此模板文件中,您可以创建按钮HTML并使用
$this->getYourAttributeKey();
例如,如果您在属性中有URL,则可以通过执行以下操作来调用产品中的URL和按钮:
<input type="button" value="Put Your Text Here" onclick="window.location.href='<?php echo $this->getYourAttributeKey(); ?>'" />
注意强>
如果您的属性键类似于&#34; my_attribute_code_here&#34;,当您从模板中调用它时,请删除下划线并将每个字母设为大写。 Magento将使用它的魔法吸气剂&#34;从对象中提取所需的信息。所以:
my_attribute_code_here == $this->getMyAttributeCodeHere();