Pregunta

I'd like to set up a custom button on the product view page, then once selected, the data is posted to a cms page. On the cms page i'd then use the data posted . I'm mainly looking to post price, name and sku.

Any ideas?

¿Fue útil?

Solución

You can do that. But once you refresh CMS page you will lost that post data again.

See the example I did below, I am taking default about-us page for example.

  <form action="<?php echo $this->getUrl('about-magento-demo-store');?>" method="post">
        <input type="hidden" name="hidden-price" value="price">
        <input type="hidden" name="hidden-sku" value="sku">
        <input type="hidden" name="hidden-name" value="name">
        <button type="submit">Submit</button>
 </form>

You can use above form in your product detail page but outside the add to cart form. This form should not be inside product add to cart form.

Create one phtml file for get the post data. Add below block in cms about us page.

{{block type="core/template" name="handle_post_date" template="page/about-us.phtml"}}

In page/about-us.phtml file you can get post data by

<pre>
    <?php print_r($this->getRequest()->getParams()); ?>
</pre>

Otros consejos

There two process of send value to cms page.

  • Create new <form></form> at view.phtml and use product price, name and sku and hidden fields at this form. and set form action to ur cms page.
  • Create an url and sending product id to this cms page like ::

    echo Mage::getUrl()."YOUR_CMS_PAGE_IDnefire".?pid=$PRODUCT_ID and then using by fetch data product id.and using produce mode is get dat

a

$this->getUrl('about-magento-demo-store') is not working i need to write static URL then after it is working for me

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top