Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Contact Form Local…
 
lorenzo01
Sr. Member
 
Avatar
Total Posts:  221
Joined:  2007-09-06
France
 

Hello,
I want to create another contact page , so i’ve created a local mage based on Mage_Contacts...I have a little problem with the file IndexController.php :

public function indexAction()
    
{
        $this
->loadLayout();
        
$this->getLayout()->getBlock('contactreunionForm')
            ->
setFormActionMage::getUrl('*/*/post') );

        
$this->_initLayoutMessages('customer/session');
        
$this->renderLayout();
    
}
This line cause an error (call a non object..) in my local mage
->setFormActionMage::getUrl('*/*/post') );
, What does this function?
i need some help
thanks
 
Magento Community Magento Community
Magento Community
Magento Community
 
lorenzo01
Sr. Member
 
Avatar
Total Posts:  221
Joined:  2007-09-06
France
 

anyone can help me ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

within your module layout.xml you should have smth like this:

<block type="core/template" name="contactreunionForm" template="contactreunion/form.phtml"/>

Within your phtml file which contains the form html you should have smth like this:

<form action="<?=$this->getFormAction();?>" name="contactreunionForm" id="contactreunionForm" method="post">

Here is an example from me. Cart is shown and you can lay back clothes in real stores…

My layout.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>        
    </default>    
    <
shoporder_index_index>        
        <
reference name="root">
            <
action method="setTemplate"><template>page/2columns-right.phtml</template></action>
            <
action method="setHeaderTitle" translate="title" module="shoporder"><title>Shop order</title></action>
        </
reference>
        <
reference name="content">
            <
block type="checkout/cart" name="checkout.cart">
                <
action method="setCartTemplate"><value>shoporder/cart.phtml</value></action>
                <
action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
                <
action method="chooseTemplate"/>                          
            </
block>
            <
block type="core/template" name="shoporderForm" template="shoporder/form.phtml"/>
            <
block type="core/template" name="shoporderThanks" template="shoporder/thanks.phtml"/>
        </
reference>
    </
shoporder_index_index>
     <
shoporder_index_thanks>        
        <
reference name="root">
            <
action method="setTemplate"><template>page/2columns-right.phtml</template></action>
            <
action method="setHeaderTitle" translate="title" module="shoporder"><title>Shop order</title></action>
        </
reference>
        <
reference name="content">            
            <
block type="core/template" name="shoporderThanks" template="shoporder/thanks.phtml"/>
        </
reference>
    </
shoporder_index_thanks>
</
layout>

My .phtml

<div class="page-head">
    <
h3><?=$this->__('Lay away your selection')?></h3>
</
div>
<
form action="<?=$this->getFormAction();?>" name="contactForm" id="contactForm" method="post">
    <
fieldset class="group-select">
        <
h4 class="legend"><?=$this->__('Shop selection')?></h4>
            <
li>
                <
select id="shop" name="shop" class="required-entry validate-shop-select">
                <
option value=""></option>                
                
<?foreach ($this->helper('shoporder')->getShopAvailableTypes() as $_typeCode => $_typeName):?>
                    
<option value="<?=$_typeCode?>"><?=$_typeName?></option>
                
<?endforeach?>
                
</select>
            </
li>
    </
fieldset>
    <
fieldset class="group-select">
        <
h4 class="legend"><?=$this->__('Contact Information')?></h4>
            <
li>
                <
div class="input-box">
                    <
label for="firstname"><?=$this->__('Name')?> <span class="required">*</span></label><br />
                    <
input name="name" id="name" title="<?=$this->__('Name')?>" value="<?=$this->helper('shoporder')->getUserName()?>" class="required-entry input-text" type="text">
                </
div>

                <
div class="input-box">
                    <
label for="firstname"><?=$this->__('Email')?> <span class="required">*</span></label><br />
                    <
input name="email" id="email" title="<?=$this->__('Email')?>" value="<?=$this->helper('shoporder')->getUserEmail()?>" class="required-entry input-text validate-email" type="text">
                </
div>

                <
div class="clear"></div>

                <
div class="input-box">
                    <
label for="firstname"><?=$this->__('Telephone')?></label><br />
                    <
input name="telephone" id="telephone" title="<?=$this->__('Telephone')?>" value="" class="input-text" type="text">
                </
div>

                <
div class="clear"></div>

                <
div class="input-box">
                    <
label for="firstname"><?=$this->__('Comment')?></label><br />
                    <
textarea name="comment" id="comment" title="<?=$this->__('Comment')?>" class="input-text" style="height:150px;width:525px;"></textarea>
                </
div>
            </
li>
    </
fieldset>
    <
div class="button-set">
        <
class="required"><?=$this->__('* Required Fields')?></p>
        <
button class="form-button" type="submit"><span><?=$this->__('Submit')?></span></button>
    </
div>
</
form>
<
script type="text/javascript">
    var 
contactForm = new VarienForm('contactForm'true);
</script>

And at least my indexAction

public function indexAction()
    
{
        $this
->loadLayout();
        
$this->getLayout()->getBlock('shoporderForm')
            ->
setFormActionMage::getUrl('*/*/post') );
        
$this->_initLayoutMessages('customer/session');
        
$this->renderLayout();
    
}

Sorry, also bad english smile

cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

I know this is not exactly the same subject, but I’m looking for changing the sender email from the contact from.

Actually when I receive a message from a customer through Magento contact form, if I try to reply directly, my email software replies to the email contact (that I set in Configuration, like . com), and not the customer email.

Does anyone have an idea to change that ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
roco
Sr. Member
 
Total Posts:  191
Joined:  2008-03-18
 

I would be interested in how to change this as well.  Al of the sales people’s reply’s are coming right to me and not to the customers?

 
Magento Community Magento Community
Magento Community
Magento Community
 
majacore
Member
 
Avatar
Total Posts:  53
Joined:  2008-12-29
 

This does help, but you forgot the step of what happens after the submit, ie how and where to i code my validation of the form ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Invoicera
Jr. Member
 
Total Posts:  16
Joined:  2009-01-13
 

You can change sender email from admin section.

system --> configuration -->contacts --> emails

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top