Skip to content

Commit b79df3c

Browse files
committed
Merge pull request #9 from amarroni/before-production
Updated email es_ES
2 parents 8cc99cd + 57e38c0 commit b79df3c

34 files changed

+2541
-334
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: gringo
5+
* Date: 09/11/15
6+
* Time: 12:42 AM
7+
*/
8+
class RG_Contacts_Helper_Data extends Mage_Core_Helper_Abstract {
9+
10+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
require_once(Mage::getModuleDir('controllers','Mage_Contacts').DS.'IndexController.php');
4+
5+
class RG_Contacts_IndexController extends Mage_Contacts_IndexController
6+
{
7+
public function indexAction()
8+
{
9+
$this->loadLayout();
10+
$this->getLayout()->getBlock('contactForm')
11+
->setFormAction( Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())) );
12+
13+
$this->_initLayoutMessages('customer/session');
14+
$this->_initLayoutMessages('catalog/session');
15+
$this->renderLayout();
16+
}
17+
18+
public function postAction()
19+
{
20+
$post = $this->getRequest()->getPost();
21+
if ( $post ) {
22+
$translate = Mage::getSingleton('core/translate');
23+
/* @var $translate Mage_Core_Model_Translate */
24+
$translate->setTranslateInline(false);
25+
try {
26+
$postObject = new Varien_Object();
27+
$postObject->setData($post);
28+
29+
$error = false;
30+
31+
if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
32+
$error = true;
33+
}
34+
35+
if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) {
36+
$error = true;
37+
}
38+
39+
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
40+
$error = true;
41+
}
42+
43+
if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
44+
$error = true;
45+
}
46+
47+
if ($error) {
48+
throw new Exception();
49+
}
50+
$mailTemplate = Mage::getModel('core/email_template');
51+
/* @var $mailTemplate Mage_Core_Model_Email_Template */
52+
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
53+
->setReplyTo($post['email'])
54+
->sendTransactional(
55+
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
56+
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
57+
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
58+
null,
59+
array('data' => $postObject)
60+
);
61+
62+
if (!$mailTemplate->getSentSuccess()) {
63+
throw new Exception();
64+
}
65+
66+
$translate->setTranslateInline(true);
67+
68+
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
69+
$this->_redirectReferer();
70+
71+
return;
72+
} catch (Exception $e) {
73+
$translate->setTranslateInline(true);
74+
75+
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
76+
$this->_redirectReferer();
77+
return;
78+
}
79+
80+
} else {
81+
$this->_redirectReferer();
82+
}
83+
}
84+
85+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<config>
3+
<modules>
4+
<RG_Contacts>
5+
<version>0.1.0</version>
6+
</RG_Contacts>
7+
</modules>
8+
<global>
9+
<helpers>
10+
<rg_contacts>
11+
<class>RG_Contacts_Helper</class>
12+
</rg_contacts>
13+
</helpers>
14+
</global>
15+
<frontend>
16+
<routers>
17+
<contacts>
18+
<args>
19+
<modules>
20+
<rg_contacts before="Mage_Contacts">RG_Contacts</rg_contacts>
21+
</modules>
22+
</args>
23+
</contacts>
24+
</routers>
25+
</frontend>
26+
</config>

0 commit comments

Comments
 (0)