Magento by submitting the product name to the contact form

Hi from a beginner Magento, I am not good at terms and names, but I will try to explain this as clearly as I can.

I am currently working on setting up a Magento contact form to be able to collect some data from users on the Product View Page page .
To be more interesting, the form will also have to send some data about the product on which the page administrator puts it, specifically the Product Name
Not all products will have this form, only products available for delivery in different (currently unavailable) colors and Sizes.
I copied the Magento contact form to mine Layout->Templates->contact->form.phtml. I put it on one of the product pages by inserting: the following xml link:
Magento Admin Panel-Catalog-Menage Categories-OneOfTheProducts-edit-Custom layout update

<reference> 
  <block type="core/template" name="customer_request"  
   template="contacts/form.phtml"/>
</reference>

It is tested and it works, but the administrator has to do this xml placement in many products. Customize the layout update text box, but this is not part of this question.
The Magento form has the following fields: name, email address, phone, comment.
However, I need to send another parameter to the postActionaction Mage_Contacts_IndexController, and this is the product name.

Question
How can I get the product name in the "Contact" form on the "Product" page, can this element of the child block be aware of the contents of the page in which it is embedded? Is there any global function in Magento that I can use, and how to pass this parameter to the controller, should I use a hidden input field, otherwise ...?

+3
2

form.phtml , URL-/ , , "id":

<?php $productId=$this->getRequest()->getParams();   
$model = Mage::getModel('catalog/product');  
$_product = $model->load($productId["id"]);   
echo $_product->getName(); ?>

var to email, , .

+2

- Magento:

$_product = Mage::registry('current_product');

. . .

+1

All Articles