2011-07-29 43 views
0

我是magento的新手。我创建了一个我想在所有产品页面上显示的表单。它只是询问用户电子邮件和价格通知价格变化。它的工作原理,但问题是只有当我的区块位于<reference name="content">选项卡内时才有效。如果我把它放在任何地方,我可以看到它的形式,但它不起作用。这是我的布局文件的代码。我只需要知道,如果有什么我做错了magento块不能在产品页面上工作

<layout> 

<catalog_product_view> 

    <reference name="content"> 
    <!-- <reference name="product.info"> 
      <reference name="alert.urls"> --> 
       <block type="catalog/product_view" before="-" name="ecom_pricenotify.temp" template="ecom_pricenotify/temp.phtml" /> 
     <!--  </reference> 
     </reference> --> 
    </reference> 
</catalog_product_view> 

这里是我的templat一个.phtml代码

<div style="border:0px solid red; margin:0px auto;"> 

<?php $_product = $this->getProduct(); ?> 


<form id="test" action="<?php echo Mage::getUrl('pricenotify/pricenotify/db') ?>" method="post"> 

      <label for="price">Price *</label> 
      <input type="text" id="price" name="price" value="" class="required-entry validate-number"/><br /> 
      <label for="email">Email Address *</label> 
      <input type="text" id="email" name="email" value="" class="required-entry validate-email"/> 
      <input type="hidden" id="id" name="id" value="<?php echo $_product->getId() ?>" /> 
      <input type="hidden" id="propri" name="propri" value="<?php echo $_product->getPrice() ?>" /> 

      <input type="submit" name="submit" value="<?php echo $this->__('Submit') ?>" onclick="if(customForm.validator && customForm.validator.validate()) this.form.request(); return false;" /> 

</form> 

<script type="text/javascript"> 
//< ![CDATA[ 
var customForm = new VarienForm('test',false); 
//]]> 
</script> 

回答

0

在你catalog/product/view.phtml模板,你应该粘贴此代码<?php echo $this->getChildHtml('ecom_pricenotify.temp') ?>需要渲染模板的地方。

+0

是不是编辑核心文件错了。 –

+0

好,是的。你应该创建自己的主题。见[本指南](http://www.magentocommerce.com/design_guide/articles/working-with-magento-themes) – vsushkov

+0

我想利用magento主题来看看它是否工作..我不认为我需要创建一个主题来测试我从 –