开发者

magento block does not work on product page

i am new to magento. I have created a a form that i want to display on all product pages. it just ask user the email and price for notification if price changes. It works but the problem is it only works if my block is inside the <reference name="content"> tab. if i place it any where else i can see it there the form but it does not work. Here is my code for the layout file. i just need to know if there is anything i am doing wrong

<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>

here is my t开发者_StackOverflow社区emplat .phtml code

<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>   


In your catalog/product/view.phtml template you should paste this code <?php echo $this->getChildHtml('ecom_pricenotify.temp') ?> in the place where your template has to be rendered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜