我想要将product.info.media
块从catalog.xml
的左列移到所有产品视图。Magento media.phtml产品<img> has style =“top:”?
为了实现这一目标,我已经添加了两行到我的local.xml
文件:
<catalog_product_view>
<reference name="left">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
</reference>
<reference name="product.info">
<action method="unsetChild"><child>media</child></action>
</reference>
</catalog_product_view>
的media.phtml是相同的二进制从1.7.0.2版本的Magento的默认文件。
奇怪的是,该网页上的产品形象有这样的代码:
<img id="image" src="path/to/image.jpg" alt="" title="" style="position: relative; left: 0px; width: 220px; top: 215px;">
为什么会出现顶级定义的风格?由于这种风格是在元素内部定义的,我甚至不能用css改变它。任何人都可以解释这个magento的行为吗?
在media.phtml这是创建这个看起来像这样的台词:
$_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
他们使我app/code/core/Mage/Catalog/Helper/Output.php
其中productAttribute函数定义。但为什么天啊,这是顶级风格?这根本没有意义。如果我想设置它,我会使用CSS。
在此先感谢。