Version Notes
version 1.0
Download this release
Release Info
Developer | Mage Solution |
Extension | MGS_AdvancedContact |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/MGS/Contactpro/Block/Contactpro.php +56 -0
- app/code/local/MGS/Contactpro/Block/Fieldform.php +266 -0
- app/code/local/MGS/Contactpro/Helper/Data.php +20 -0
- app/code/local/MGS/Contactpro/Model/Contactprofield.php +10 -0
- app/code/local/MGS/Contactpro/Model/Mysql4/Contactprofield.php +10 -0
- app/code/local/MGS/Contactpro/Model/Mysql4/Contactprofield/Collection.php +10 -0
- app/code/local/MGS/Contactpro/Model/Observers.php +71 -0
- app/code/local/MGS/Contactpro/Model/System/Config/Source/Identity.php +26 -0
- app/code/local/MGS/Contactpro/Model/System/Config/Source/Listpage.php +14 -0
- app/code/local/MGS/Contactpro/Model/System/Config/Source/Staticblock.php +23 -0
- app/code/local/MGS/Contactpro/controllers/CaptchaController.php +35 -0
- app/code/local/MGS/Contactpro/controllers/IndexController.php +145 -0
- app/code/local/MGS/Contactpro/etc/adminhtml.xml +25 -0
- app/code/local/MGS/Contactpro/etc/config.xml +134 -0
- app/code/local/MGS/Contactpro/etc/system.xml +104 -0
- app/code/local/MGS/Contactpro/sql/contactpro_setup/mysql4-install-0.1.0.php +21 -0
- app/code/local/MGS/Mgscore/Block/System/Config/About.php +75 -0
- app/code/local/MGS/Mgscore/Helper/Data.php +6 -0
- app/code/local/MGS/Mgscore/etc/config.xml +75 -0
- app/code/local/MGS/Mgscore/etc/system.xml +29 -0
- app/design/frontend/default/default/layout/contactpro.xml +16 -0
- app/design/frontend/default/default/template/contactpro/contactpro.phtml +155 -0
- app/etc/modules/MGS_Contactpro.xml +9 -0
- app/etc/modules/MGS_Mgscore.xml +9 -0
- app/locale/en_US/template/email/contact_pro.html +38 -0
- app/locale/en_US/template/email/contact_pro_admin.html +48 -0
- media/contactpro/fonts/captcha.ttf +0 -0
- package.xml +27 -0
- skin/frontend/default/default/css/contactpro.css +30 -0
- skin/frontend/default/default/images/ajax-loader-tr.gif +0 -0
app/code/local/MGS/Contactpro/Block/Contactpro.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MGS_Contactpro_Block_Contactpro extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
7 |
+
$headBlock->setTitle($this->__('Contact us'));
|
8 |
+
return parent::_prepareLayout();
|
9 |
+
}
|
10 |
+
public function getFields(){
|
11 |
+
$collection = Mage::getModel('contactpro/contactprofield')
|
12 |
+
->getCollection()
|
13 |
+
->setOrder('position', 'asc')
|
14 |
+
->addFilter('status', 1)
|
15 |
+
->load();
|
16 |
+
return $collection;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getFullName(){
|
20 |
+
if($this->helper('customer')->isLoggedIn()){
|
21 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
22 |
+
return $customer->getName();
|
23 |
+
}
|
24 |
+
return '';
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getEmail(){
|
28 |
+
if($this->helper('customer')->isLoggedIn()){
|
29 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
30 |
+
return $customer->getEmail();
|
31 |
+
}
|
32 |
+
return '';
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getAction(){
|
36 |
+
$url = Mage::getUrl('contactpro/index/post',array('_store' => (int)Mage::app()->getStore()));
|
37 |
+
return $url;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getStaticBlock(){
|
41 |
+
$staticBlockIdentifier = Mage::getStoreConfig('contactpro/settings/static_block',Mage::app()->getStore());
|
42 |
+
if($staticBlockIdentifier == ''){
|
43 |
+
return '';
|
44 |
+
}else{
|
45 |
+
return $this->getLayout()->createBlock('cms/block')->setBlockId($staticBlockIdentifier)->toHtml();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
public function getGmap(){
|
49 |
+
$gmap = Mage::getStoreConfig('contactpro/settings/gmap',Mage::app()->getStore());
|
50 |
+
if($gmap == ''){
|
51 |
+
return '';
|
52 |
+
}else{
|
53 |
+
return $gmap;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/local/MGS/Contactpro/Block/Fieldform.php
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_GoogleCheckout
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class MGS_Contactpro_Block_Fieldform
|
28 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
29 |
+
{
|
30 |
+
protected $_addRowButtonHtml = array();
|
31 |
+
protected $_removeRowButtonHtml = array();
|
32 |
+
|
33 |
+
protected $_fields = array();
|
34 |
+
|
35 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
36 |
+
{
|
37 |
+
$this->setElement($element);
|
38 |
+
|
39 |
+
$html = '';
|
40 |
+
$html .= '<style type="text/css">
|
41 |
+
#row_contactpro_items_field_items table.form-list{
|
42 |
+
margin-bottom:15px;
|
43 |
+
padding-bottom:10px;
|
44 |
+
border-bottom:3px solid #6F8992!important;
|
45 |
+
}
|
46 |
+
#row_contactpro_items_field_items td.label{
|
47 |
+
display:none;
|
48 |
+
}
|
49 |
+
#row_contactpro_items_field_items td.value td.label{
|
50 |
+
display:block;
|
51 |
+
}
|
52 |
+
#row_contactpro_items_field_items td.value,
|
53 |
+
#row_contactpro_items_field_items td.label{
|
54 |
+
padding:2px 5px!important;
|
55 |
+
}
|
56 |
+
#row_contactpro_items_field_items td.value{
|
57 |
+
width:700px!important;
|
58 |
+
}
|
59 |
+
#row_contactpro_items_field_items td.value td.value {
|
60 |
+
width: 530px!important;
|
61 |
+
}';
|
62 |
+
|
63 |
+
$html .= '</style>';
|
64 |
+
$html .= '<div id="field-template" style="display:none">';
|
65 |
+
$html .= $this->_getRowTemplateHtml();
|
66 |
+
$html .= '</div>';
|
67 |
+
|
68 |
+
//echo '<pre>';print_r($this->getFieldsForm());die();
|
69 |
+
$html .= '<ul id="field-items">';
|
70 |
+
if (count($this->getFieldsForm())) {
|
71 |
+
$i = 1;
|
72 |
+
foreach ($this->getFieldsForm() as $field) {
|
73 |
+
$html .= $this->_getRowTemplateHtml($field->getContactProFieldId());
|
74 |
+
}
|
75 |
+
}
|
76 |
+
$html .= '</ul>';
|
77 |
+
$html .= $this->_getAddRowButtonHtml('field-items',
|
78 |
+
'field-template', $this->__('Add Field'));
|
79 |
+
return $html;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function _getRowTemplateHtml($i=0)
|
83 |
+
{
|
84 |
+
$html = '<li>';
|
85 |
+
|
86 |
+
$html .= '<table cellspacing="0" class="form-list">';
|
87 |
+
|
88 |
+
$html .= $this->_getId($i);
|
89 |
+
$html .= $this->_getLabel($i);
|
90 |
+
$html .= $this->_getRequired($i);
|
91 |
+
$html .= $this->_getPosition($i);
|
92 |
+
$html .= $this->_getStatus($i);
|
93 |
+
|
94 |
+
$html .= '<td class="label">';
|
95 |
+
$html .= '<label for="name"></label>';
|
96 |
+
$html .= '</td>';
|
97 |
+
|
98 |
+
$html .= '<td class="value">';
|
99 |
+
$html .= $this->_getRemoveRowButtonHtml();
|
100 |
+
$html .= '</td>';
|
101 |
+
|
102 |
+
$html .= '</table>';
|
103 |
+
$html .= '</div>';
|
104 |
+
$html .= '</li>';
|
105 |
+
|
106 |
+
return $html;
|
107 |
+
}
|
108 |
+
|
109 |
+
protected function _getAddRowButtonHtml($container, $template, $title='Add')
|
110 |
+
{
|
111 |
+
if (!isset($this->_addRowButtonHtml[$container])) {
|
112 |
+
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
|
113 |
+
->setType('button')
|
114 |
+
->setClass('add ')
|
115 |
+
->setLabel($this->__($title))
|
116 |
+
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
|
117 |
+
->toHtml();
|
118 |
+
}
|
119 |
+
return $this->_addRowButtonHtml[$container];
|
120 |
+
}
|
121 |
+
|
122 |
+
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Remove this field')
|
123 |
+
{
|
124 |
+
if (!$this->_removeRowButtonHtml) {
|
125 |
+
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
126 |
+
->setType('button')
|
127 |
+
->setClass('delete v-middle ')
|
128 |
+
->setLabel($this->__($title))
|
129 |
+
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
|
130 |
+
->toHtml();
|
131 |
+
}
|
132 |
+
return $this->_removeRowButtonHtml;
|
133 |
+
}
|
134 |
+
|
135 |
+
//==========================================================
|
136 |
+
protected function getFieldsForm(){
|
137 |
+
$model = Mage::getModel('contactpro/contactprofield')->getCollection()->load();
|
138 |
+
$fields = array();
|
139 |
+
$i=1;
|
140 |
+
foreach ($model as $field) {
|
141 |
+
$fields[$i++] = $field;
|
142 |
+
}
|
143 |
+
$this->_fields = $fields;
|
144 |
+
return $this->_fields;
|
145 |
+
}
|
146 |
+
|
147 |
+
//==========================================================
|
148 |
+
protected function _getId($i=0){
|
149 |
+
$field = Mage::getModel('contactpro/contactprofield')->load($i);
|
150 |
+
|
151 |
+
$html = '';
|
152 |
+
|
153 |
+
$html .= '<tr style="display:none;">';
|
154 |
+
|
155 |
+
$html .= '<td class="contactprofieldid">';
|
156 |
+
$html .= '</td>';
|
157 |
+
|
158 |
+
$html .= '<td class="value">';
|
159 |
+
$html .= '<input type="hidden" class="input-text" value="'.$field->getContactProFieldId().'" name="contactprofieldid[]" id="contactprofieldid'.$i.'"/>';
|
160 |
+
$html .= '</td>';
|
161 |
+
|
162 |
+
$html .= '</tr>';
|
163 |
+
return $html;
|
164 |
+
}
|
165 |
+
|
166 |
+
protected function _getLabel($i=0){
|
167 |
+
$field = Mage::getModel('contactpro/contactprofield')->load($i);
|
168 |
+
$select = (int)$field->getLabel();
|
169 |
+
|
170 |
+
|
171 |
+
$html = '';
|
172 |
+
$html .= '<tr>';
|
173 |
+
|
174 |
+
$html .= '<td class="label">';
|
175 |
+
$html .= '<label for="label">'.$this->__("Field Label").'</label>';
|
176 |
+
$html .= '</td>';
|
177 |
+
|
178 |
+
$html .= '<td class="value">';
|
179 |
+
$html .= '<input type="text" class="input-text" value="'.$field->getLabel().'" name="label[]" id="label'.$i.'"/>';
|
180 |
+
$html .= '</td>';
|
181 |
+
|
182 |
+
$html .= '</tr>';
|
183 |
+
return $html;
|
184 |
+
}
|
185 |
+
|
186 |
+
protected function _getRequired($i=0){
|
187 |
+
$field = Mage::getModel('contactpro/contactprofield')->load($i);
|
188 |
+
|
189 |
+
$select = (int)$field->getRequired();
|
190 |
+
$select1 = '';
|
191 |
+
$select2 = '';
|
192 |
+
|
193 |
+
if($select == 1){
|
194 |
+
$select1 = "selected=\"selected\"";
|
195 |
+
}elseif($select == 2){
|
196 |
+
$select2 = "selected=\"selected\"";
|
197 |
+
}
|
198 |
+
|
199 |
+
$html = '';
|
200 |
+
$html .= '<tr>';
|
201 |
+
|
202 |
+
$html .= '<td class="label">';
|
203 |
+
$html .= '<label for="required">'.$this->__("Required").'</label>';
|
204 |
+
$html .= '</td>';
|
205 |
+
|
206 |
+
$html .= '<td class="value">';
|
207 |
+
$html .= '<select class="required select" name="required[]" id="required'.$i.'">';
|
208 |
+
$html .= '<option '. $select2 .' value="2">' . $this->__("No").'</option>';
|
209 |
+
$html .= '<option '. $select1 .' value="1">' . $this->__("Yes").'</option>';
|
210 |
+
$html .= '</select>';
|
211 |
+
$html .= '</td>';
|
212 |
+
|
213 |
+
$html .= '</tr>';
|
214 |
+
return $html;
|
215 |
+
}
|
216 |
+
|
217 |
+
protected function _getPosition($i=0){
|
218 |
+
$field = Mage::getModel('contactpro/contactprofield')->load($i);
|
219 |
+
$select = (int)$field->getPosition();
|
220 |
+
|
221 |
+
$html = '';
|
222 |
+
$html .= '<tr>';
|
223 |
+
|
224 |
+
$html .= '<td class="label">';
|
225 |
+
$html .= '<label for="position">'.$this->__("Position").'</label>';
|
226 |
+
$html .= '</td>';
|
227 |
+
|
228 |
+
$html .= '<td class="value">';
|
229 |
+
$html .= '<input type="text" class="input-text" value="'.$field->getPosition().'" name="position[]" id="position'.$i.'"/>';
|
230 |
+
$html .= '</td>';
|
231 |
+
|
232 |
+
$html .= '</tr>';
|
233 |
+
return $html;
|
234 |
+
}
|
235 |
+
|
236 |
+
protected function _getStatus($i=0){
|
237 |
+
$field = Mage::getModel('contactpro/contactprofield')->load($i);
|
238 |
+
|
239 |
+
$select = (int)$field->getStatus();
|
240 |
+
$select1 = '';
|
241 |
+
$select2 = '';
|
242 |
+
|
243 |
+
if($select == 1){
|
244 |
+
$select1 = "selected=\"selected\"";
|
245 |
+
}elseif($select == 2){
|
246 |
+
$select2 = "selected=\"selected\"";
|
247 |
+
}
|
248 |
+
|
249 |
+
$html = '';
|
250 |
+
$html .= '<tr>';
|
251 |
+
|
252 |
+
$html .= '<td class="label">';
|
253 |
+
$html .= '<label for="status">'.$this->__("Status").'</label>';
|
254 |
+
$html .= '</td>';
|
255 |
+
|
256 |
+
$html .= '<td class="value">';
|
257 |
+
$html .= '<select class="status select" name="status[]" id="status'.$i.'">';
|
258 |
+
$html .= '<option '. $select1 .' value="1">' . $this->__("Enabled").'</option>';
|
259 |
+
$html .= '<option '. $select2 .' value="2">' . $this->__("Disabled").'</option>';
|
260 |
+
$html .= '</select>';
|
261 |
+
$html .= '</td>';
|
262 |
+
|
263 |
+
$html .= '</tr>';
|
264 |
+
return $html;
|
265 |
+
}
|
266 |
+
}
|
app/code/local/MGS/Contactpro/Helper/Data.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Helper_Data extends MGS_Mgscore_Helper_Data
|
4 |
+
{
|
5 |
+
public function getCode($str){
|
6 |
+
$str = strtolower($str);
|
7 |
+
$str = str_ireplace(" ", "-", $str);
|
8 |
+
return $str;
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getEnable(){
|
12 |
+
$enable = Mage::getStoreConfig('contactpro/settings/enable',Mage::app()->getStore());
|
13 |
+
|
14 |
+
if($enable == 1){
|
15 |
+
return true;
|
16 |
+
}else{
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
app/code/local/MGS/Contactpro/Model/Contactprofield.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Model_Contactprofield extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('contactpro/contactprofield');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/MGS/Contactpro/Model/Mysql4/Contactprofield.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Model_Mysql4_Contactprofield extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the contactpro_id refers to the key field in your database table.
|
8 |
+
$this->_init('contactpro/contactprofield', 'contact_pro_field_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/MGS/Contactpro/Model/Mysql4/Contactprofield/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Model_Mysql4_Contactprofield_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('contactpro/contactprofield');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/MGS/Contactpro/Model/Observers.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Model_Observers extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected $_data ;
|
6 |
+
|
7 |
+
public function saveconfig()
|
8 |
+
{
|
9 |
+
$collection = Mage::getModel('contactpro/contactprofield')->getCollection()->load();
|
10 |
+
$data = Mage::app()->getRequest()->getPost();
|
11 |
+
$this->_data = $data;
|
12 |
+
//echo "<pre>";print_r($data); die('dsfds');
|
13 |
+
foreach($this->_data['contactprofieldid'] as $index => $item){
|
14 |
+
if($index == 0 ) continue;
|
15 |
+
|
16 |
+
$this->saveItem($index);
|
17 |
+
}
|
18 |
+
foreach($collection as $field){
|
19 |
+
$delete = true;
|
20 |
+
foreach($data['contactprofieldid'] as $id){
|
21 |
+
if($field->getContactProFieldId() == $id){
|
22 |
+
$delete = false;
|
23 |
+
break;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
if($delete){
|
27 |
+
$this->deleteField($field->getContactProFieldId());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function saveItem($index){
|
33 |
+
$model = Mage::getModel('contactpro/contactprofield');
|
34 |
+
$id = (int)$this->_data['contactprofieldid'][$index];
|
35 |
+
$data = array();
|
36 |
+
$data['label'] = (string)$this->_data['label'][$index];
|
37 |
+
$data['required'] = (int)$this->_data['required'][$index];
|
38 |
+
$data['position'] = (int)$this->_data['position'][$index];
|
39 |
+
$data['status'] = (int)$this->_data['status'][$index];
|
40 |
+
if($data['label']== ''){
|
41 |
+
if($id>0){
|
42 |
+
$this->deleteField($id);
|
43 |
+
}else{
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
if($id!=0){
|
48 |
+
$model->load($id)->addData($data);
|
49 |
+
try{
|
50 |
+
$model->setId($id)->save();
|
51 |
+
} catch (Exception $e){
|
52 |
+
}
|
53 |
+
}else{
|
54 |
+
$model->setData($data);
|
55 |
+
try{
|
56 |
+
$model->save();
|
57 |
+
} catch (Exception $e){
|
58 |
+
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
public function deleteField($id){
|
64 |
+
$model = Mage::getModel('contactpro/contactprofield');
|
65 |
+
try {
|
66 |
+
$model->setId($id)->delete();
|
67 |
+
} catch (Exception $e){
|
68 |
+
//echo $e->getMessage();
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
app/code/local/MGS/Contactpro/Model/System/Config/Source/Identity.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Contactpro_Model_System_Config_Source_Identity
|
4 |
+
{
|
5 |
+
protected $_options = null;
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
if (is_null($this->_options)) {
|
9 |
+
$this->_options = array();
|
10 |
+
$config = Mage::getSingleton('adminhtml/config')->getSection('trans_email')->groups->children();
|
11 |
+
foreach ($config as $node) {
|
12 |
+
//echo "<pre>"; print_r($config);die();
|
13 |
+
$nodeName = $node->getName();
|
14 |
+
$label = (string) $node->label;
|
15 |
+
$sortOrder = (int) $node->sort_order;
|
16 |
+
$this->_options[$sortOrder] = array(
|
17 |
+
'value' => preg_replace('#^ident_(.*)$#', '$1', $nodeName),
|
18 |
+
'label' => Mage::helper('adminhtml')->__($label)
|
19 |
+
);
|
20 |
+
}
|
21 |
+
ksort($this->_options);
|
22 |
+
}
|
23 |
+
|
24 |
+
return $this->_options;
|
25 |
+
}
|
26 |
+
}
|
app/code/local/MGS/Contactpro/Model/System/Config/Source/Listpage.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MGS_Contactpro_Model_System_Config_Source_Listpage
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$pages = Mage::getModel('cms/page')->getCollection()->load();
|
7 |
+
|
8 |
+
$pageSelect = array();
|
9 |
+
foreach($pages as $page){
|
10 |
+
$pageSelect[] = array('value'=>$page->getIdentifier(), 'label'=>$page->getTitle());
|
11 |
+
}
|
12 |
+
return $pageSelect;
|
13 |
+
}
|
14 |
+
}
|
app/code/local/MGS/Contactpro/Model/System/Config/Source/Staticblock.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MGS_Contactpro_Model_System_Config_Source_Staticblock
|
3 |
+
{
|
4 |
+
public function toOptionArray(){
|
5 |
+
|
6 |
+
$result = array();
|
7 |
+
|
8 |
+
$result[] = array('value' => '',
|
9 |
+
'label' => Mage::helper('contactpro')->__(' --- Select static block --- ')
|
10 |
+
);
|
11 |
+
|
12 |
+
$blocks = Mage::getModel('cms/block')->getCollection()->load();
|
13 |
+
foreach ($blocks as $block) {
|
14 |
+
if($block && $block->getIsActive()){
|
15 |
+
$result[] = array('value' => $block->getIdentifier(),
|
16 |
+
'label' => $block->getTitle()
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
return $result;
|
22 |
+
}
|
23 |
+
}
|
app/code/local/MGS/Contactpro/controllers/CaptchaController.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
Zend_Session::start();
|
3 |
+
class MGS_Contactpro_CaptchaController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function renderAction()
|
6 |
+
{
|
7 |
+
$path = Mage::getBaseDir('media') . DS . 'contactpro' . DS ;
|
8 |
+
$url = Mage::getUrl('media',array('_store' => (int)Mage::app()->getStore())) . 'contactpro/captcha/';
|
9 |
+
|
10 |
+
$captcha = new Zend_Captcha_Image();
|
11 |
+
$captcha->setImgDir($path . 'captcha' . DS);
|
12 |
+
$captcha->setImgUrl($url);
|
13 |
+
$captcha->setFont($path . 'fonts' . DS . 'captcha.ttf');
|
14 |
+
$captcha->setWidth(255);
|
15 |
+
$captcha->setHeight(100);
|
16 |
+
$captcha->setWordlen(6);
|
17 |
+
$captcha->setFontSize(60);
|
18 |
+
$captcha->setLineNoiseLevel(3);
|
19 |
+
$captcha->generate();
|
20 |
+
|
21 |
+
Mage::getSingleton('core/session')->setCaptchaWord($captcha->getWord());
|
22 |
+
echo $captcha->render($this, null);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function checkAction(){
|
26 |
+
$word = (string)Mage::getSingleton('core/session')->getCaptchaWord();
|
27 |
+
$data = Mage::app()->getRequest()->getPost();
|
28 |
+
if($data['captcha'] == $word){
|
29 |
+
$result = array('result' => 1);
|
30 |
+
}else{
|
31 |
+
$result = array('result' => 0);
|
32 |
+
}
|
33 |
+
echo json_encode($result);
|
34 |
+
}
|
35 |
+
}
|
app/code/local/MGS/Contactpro/controllers/IndexController.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MGS_Contactpro_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
protected $_data;
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$helper = Mage::helper('contactpro');
|
8 |
+
if(!$helper->getEnable()){
|
9 |
+
$this->_redirect('/');
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
|
13 |
+
// $emailSender = (string)Mage::getStoreConfig('contactpro/settings/sender_email',$this->_getStore());
|
14 |
+
// $emailSenderName = (string)Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/name', $this->_getStore());
|
15 |
+
// $emailSenderEmail = (string)Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/email', $this->_getStore());
|
16 |
+
|
17 |
+
// echo $emailSenderName . '<br/>' .$emailSenderEmail;die();
|
18 |
+
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getStore(){
|
24 |
+
$store = Mage::app()->getStore();
|
25 |
+
return $store;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function postAction(){
|
29 |
+
|
30 |
+
$session = Mage::getSingleton('core/session');
|
31 |
+
$data = Mage::app()->getRequest()->getPost();
|
32 |
+
$this->_data = $data;
|
33 |
+
|
34 |
+
$validate = $this->validate();
|
35 |
+
if($validate === true){
|
36 |
+
$session->addSuccess($this->__('Contact has been accepted for moderation.'));
|
37 |
+
$this->sendEmail();
|
38 |
+
$pageThanks = Mage::getStoreConfig('contactpro/settings/page_thanks',$this->_getStore());
|
39 |
+
$this->_redirect($pageThanks);
|
40 |
+
}else{
|
41 |
+
if (is_array($validate)) {
|
42 |
+
foreach ($validate as $errorMessage) {
|
43 |
+
$session->addError($errorMessage);
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
$session->addError($this->__('Unable to post the contact.'));
|
47 |
+
}
|
48 |
+
$this->_redirect('contactpro');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
public function validate(){
|
53 |
+
$errors = array();
|
54 |
+
$helper = Mage::helper('contactpro');
|
55 |
+
|
56 |
+
//Check validate Full Name
|
57 |
+
if (!Zend_Validate::is($this->_data['full-name'], 'NotEmpty')) {
|
58 |
+
$errors[] = $helper->__('Full Name can\'t be empty');
|
59 |
+
}
|
60 |
+
|
61 |
+
//Check validate Email
|
62 |
+
if(!Zend_Validate::is((string)$this->_data['email'], 'EmailAddress'))
|
63 |
+
{
|
64 |
+
$errors[] = $helper->__('Email not validate');
|
65 |
+
}
|
66 |
+
|
67 |
+
//Check validate Option
|
68 |
+
if(count($this->getFields())){
|
69 |
+
foreach($this->getFields() as $field){
|
70 |
+
if($field->getRequired() == 1){
|
71 |
+
if(!Zend_Validate::is((string)$this->_data[$helper->getCode($field->getLabel())], 'NotEmpty'))
|
72 |
+
{
|
73 |
+
$errors[] = $helper->__($field->getLabel() . ' can\'t be empty');
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
//Check validate Comment
|
80 |
+
if (!Zend_Validate::is((string)$this->_data['comment'], 'NotEmpty')) {
|
81 |
+
$errors[] = $helper->__('Comment can\'t be empty');
|
82 |
+
}
|
83 |
+
|
84 |
+
if(empty($errors)) {
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
return $errors;
|
88 |
+
}
|
89 |
+
|
90 |
+
protected function getFields(){
|
91 |
+
$collection = Mage::getModel('contactpro/contactprofield')
|
92 |
+
->getCollection()
|
93 |
+
->setOrder('position', 'asc')
|
94 |
+
->addFilter('status', 1)
|
95 |
+
->load();
|
96 |
+
return $collection;
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
protected function sendEmail(){
|
101 |
+
$helper = Mage::helper('contactpro');
|
102 |
+
$emailAdmin = (string)Mage::getStoreConfig('contactpro/settings/send_email_to',$this->_getStore());
|
103 |
+
$emailSender = (string)Mage::getStoreConfig('contactpro/settings/sender_email',$this->_getStore());
|
104 |
+
$emailSenderName = (string)Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/name', $this->_getStore());
|
105 |
+
$emailSenderEmail = (string)Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/email', $this->_getStore());
|
106 |
+
|
107 |
+
$options = '';
|
108 |
+
if(count($this->getFields())){
|
109 |
+
foreach($this->getFields() as $field){
|
110 |
+
$options .= '<li style="list-style:none inside; padding:0 0 0 10px;"> '. $field->getLabel() . ': '. $this->_data[$helper->getCode($field->getLabel())] . '</li>';
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
$emailTemplateVariables = array();
|
115 |
+
$emailTemplateVariables['fullname'] = $this->_data['full-name'];
|
116 |
+
$emailTemplateVariables['emailaddress'] = $this->_data['email'];
|
117 |
+
$emailTemplateVariables['options'] = $options;
|
118 |
+
$emailTemplateVariables['comment'] = $this->_data['comment'];
|
119 |
+
$emailTemplateVariables['store'] = Mage::getUrl();
|
120 |
+
$emailTemplateVariables['storename'] = Mage::getStoreConfig('design/head/default_title',$this->_getStore());
|
121 |
+
$emailTemplateVariables['subjectmail'] = (string)Mage::getStoreConfig('contactpro/settings/subject_mail',$this->_getStore());
|
122 |
+
$emailTemplateVariables['nameadmin'] = $emailSenderName;
|
123 |
+
|
124 |
+
//send mail customer
|
125 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('contact_pro');
|
126 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
127 |
+
|
128 |
+
$emailTemplate->setSenderName($emailSenderName);
|
129 |
+
$emailTemplate->setSenderEmail($emailSenderEmail);
|
130 |
+
|
131 |
+
$emailTemplate->send($this->_data['email'],'hello',$emailTemplateVariables);
|
132 |
+
|
133 |
+
//send mail admin
|
134 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('contact_pro_admin');
|
135 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
136 |
+
|
137 |
+
$emailTemplate->setSenderName($emailTemplateVariables['storename']);
|
138 |
+
$emailTemplate->setSenderEmail($this->_data['email']);
|
139 |
+
|
140 |
+
$emailAdmin = explode(";",$emailAdmin);
|
141 |
+
foreach($emailAdmin as $email){
|
142 |
+
$emailTemplate->send(trim($email),'',$emailTemplateVariables);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
app/code/local/MGS/Contactpro/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<adminhtml>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<contactpro>
|
15 |
+
<title>Allow Everything</title>
|
16 |
+
</contactpro>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</adminhtml>
|
app/code/local/MGS/Contactpro/etc/config.xml
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MGS_Contactpro>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</MGS_Contactpro>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<contactpro>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>MGS_Contactpro</module>
|
14 |
+
<frontName>contactpro</frontName>
|
15 |
+
</args>
|
16 |
+
</contactpro>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<contactpro>
|
21 |
+
<file>contactpro.xml</file>
|
22 |
+
</contactpro>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<contactpro>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>MGS_Contactpro</module>
|
32 |
+
<frontName>contact-us</frontName>
|
33 |
+
</args>
|
34 |
+
</contactpro>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<mgscore module="mgscore">
|
40 |
+
<children>
|
41 |
+
<contactpro module="contactpro">
|
42 |
+
<title>Contactpro</title>
|
43 |
+
<sort_order>71</sort_order>
|
44 |
+
<children>
|
45 |
+
<config module="contactpro">
|
46 |
+
<title>Configuration</title>
|
47 |
+
<sort_order>2</sort_order>
|
48 |
+
<action>adminhtml/system_config/edit/section/contactpro</action>
|
49 |
+
</config>
|
50 |
+
</children>
|
51 |
+
</contactpro>
|
52 |
+
</children>
|
53 |
+
</mgscore>
|
54 |
+
</menu>
|
55 |
+
<layout>
|
56 |
+
<updates>
|
57 |
+
<contactpro>
|
58 |
+
<file>contactpro.xml</file>
|
59 |
+
</contactpro>
|
60 |
+
</updates>
|
61 |
+
</layout>
|
62 |
+
</adminhtml>
|
63 |
+
<global>
|
64 |
+
<template>
|
65 |
+
<email>
|
66 |
+
<contact_pro module="contactpro">
|
67 |
+
<label>Contact Pro Mail MGS</label>
|
68 |
+
<file>contact_pro.html</file>
|
69 |
+
<type>html</type>
|
70 |
+
</contact_pro>
|
71 |
+
<contact_pro_admin module="contactpro">
|
72 |
+
<label>Contact Pro Mail MGS Admin</label>
|
73 |
+
<file>contact_pro_admin.html</file>
|
74 |
+
<type>html</type>
|
75 |
+
</contact_pro_admin>
|
76 |
+
</email>
|
77 |
+
</template>
|
78 |
+
<events>
|
79 |
+
<admin_system_config_changed_section_contactpro>
|
80 |
+
<observers>
|
81 |
+
<MGS_contactpro_observers>
|
82 |
+
<type>singleton</type>
|
83 |
+
<class>contactpro/observers</class>
|
84 |
+
<method>saveconfig</method>
|
85 |
+
</MGS_contactpro_observers>
|
86 |
+
</observers>
|
87 |
+
</admin_system_config_changed_section_contactpro>
|
88 |
+
</events>
|
89 |
+
<models>
|
90 |
+
<contactpro>
|
91 |
+
<class>MGS_Contactpro_Model</class>
|
92 |
+
<resourceModel>contactpro_mysql4</resourceModel>
|
93 |
+
</contactpro>
|
94 |
+
<contactpro_mysql4>
|
95 |
+
<class>MGS_Contactpro_Model_Mysql4</class>
|
96 |
+
<entities>
|
97 |
+
<contactprofield>
|
98 |
+
<table>contact_pro_field</table>
|
99 |
+
</contactprofield>
|
100 |
+
</entities>
|
101 |
+
</contactpro_mysql4>
|
102 |
+
</models>
|
103 |
+
<resources>
|
104 |
+
<contactpro_setup>
|
105 |
+
<setup>
|
106 |
+
<module>MGS_Contactpro</module>
|
107 |
+
</setup>
|
108 |
+
<connection>
|
109 |
+
<use>core_setup</use>
|
110 |
+
</connection>
|
111 |
+
</contactpro_setup>
|
112 |
+
<contactpro_write>
|
113 |
+
<connection>
|
114 |
+
<use>core_write</use>
|
115 |
+
</connection>
|
116 |
+
</contactpro_write>
|
117 |
+
<contactpro_read>
|
118 |
+
<connection>
|
119 |
+
<use>core_read</use>
|
120 |
+
</connection>
|
121 |
+
</contactpro_read>
|
122 |
+
</resources>
|
123 |
+
<blocks>
|
124 |
+
<contactpro>
|
125 |
+
<class>MGS_Contactpro_Block</class>
|
126 |
+
</contactpro>
|
127 |
+
</blocks>
|
128 |
+
<helpers>
|
129 |
+
<contactpro>
|
130 |
+
<class>MGS_Contactpro_Helper</class>
|
131 |
+
</contactpro>
|
132 |
+
</helpers>
|
133 |
+
</global>
|
134 |
+
</config>
|
app/code/local/MGS/Contactpro/etc/system.xml
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<contactpro module="contactpro">
|
5 |
+
<label>ContactPro</label>
|
6 |
+
<tab>mgscore</tab>
|
7 |
+
<sort_order>1001</sort_order>
|
8 |
+
<show_in_default>1</show_in_default>
|
9 |
+
<show_in_website>1</show_in_website>
|
10 |
+
<show_in_store>1</show_in_store>
|
11 |
+
<groups>
|
12 |
+
<settings translate="label">
|
13 |
+
<label>Settings Contact Pro</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>0</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<enable translate="label">
|
21 |
+
<label>Enable</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
</enable>
|
29 |
+
<send_email_to translate="label">
|
30 |
+
<label>Send Emails To</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>2</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
</send_email_to>
|
37 |
+
<subject_mail translate="label">
|
38 |
+
<label>Subject Mail</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>3</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</subject_mail>
|
45 |
+
<sender_email translate="label">
|
46 |
+
<label>Email Sender</label>
|
47 |
+
<frontend_type>select</frontend_type>
|
48 |
+
<source_model>contactpro/system_config_source_identity</source_model>
|
49 |
+
<sort_order>4</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</sender_email>
|
54 |
+
<page_thanks translate="label">
|
55 |
+
<label>Page Thanks</label>
|
56 |
+
<frontend_type>select</frontend_type>
|
57 |
+
<source_model>contactpro/system_config_source_listpage</source_model>
|
58 |
+
<sort_order>5</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</page_thanks>
|
63 |
+
<static_block translate="label">
|
64 |
+
<label>Static Block</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>contactpro/system_config_source_staticblock</source_model>
|
67 |
+
<sort_order>6</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</static_block>
|
72 |
+
<gmap translate="label">
|
73 |
+
<label>Gmap</label>
|
74 |
+
<frontend_type>textarea</frontend_type>
|
75 |
+
<sort_order>7</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
</gmap>
|
80 |
+
</fields>
|
81 |
+
</settings>
|
82 |
+
<items>
|
83 |
+
<label>Field Manage</label>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<sort_order>100</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
<fields>
|
90 |
+
<field_items translate="label">
|
91 |
+
<label>Field</label>
|
92 |
+
<frontend_model>contactpro/fieldform</frontend_model>
|
93 |
+
<backend_model>adminhtml/system_config_backend_serialized</backend_model>
|
94 |
+
<sort_order>1</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</field_items>
|
99 |
+
</fields>
|
100 |
+
</items>
|
101 |
+
</groups>
|
102 |
+
</contactpro>
|
103 |
+
</sections>
|
104 |
+
</config>
|
app/code/local/MGS/Contactpro/sql/contactpro_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('contact_pro_field')};
|
10 |
+
CREATE TABLE {$this->getTable('contact_pro_field')} (
|
11 |
+
`contact_pro_field_id` int(11) NOT NULL AUTO_INCREMENT,
|
12 |
+
`label` varchar(50) NOT NULL,
|
13 |
+
`required` tinyint(4) NOT NULL,
|
14 |
+
`position` tinyint(4) NOT NULL,
|
15 |
+
`status` tinyint(4) NOT NULL,
|
16 |
+
PRIMARY KEY (`contact_pro_field_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
+
|
19 |
+
");
|
20 |
+
|
21 |
+
$installer->endSetup();
|
app/code/local/MGS/Mgscore/Block/System/Config/About.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Mgscore_Block_System_Config_About extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
|
9 |
+
$feed = curl_init('http://magesolution.com/MGS_Feed.xml');
|
10 |
+
|
11 |
+
if($feed === false){
|
12 |
+
throw new Exception('Error loading module info feed.'); }
|
13 |
+
|
14 |
+
curl_setopt($feed, CURLOPT_RETURNTRANSFER, true);
|
15 |
+
curl_setopt($feed, CURLOPT_HEADER, 0);
|
16 |
+
$xml = curl_exec($feed);
|
17 |
+
curl_close($feed);
|
18 |
+
|
19 |
+
if($xml === false){
|
20 |
+
throw new Exception('Error loading module info XML.'); }
|
21 |
+
|
22 |
+
$result = new SimpleXMLElement($xml);
|
23 |
+
|
24 |
+
if (!$result || !$result->channel->item) {
|
25 |
+
throw new Exception('No info in module info XML.'); }
|
26 |
+
|
27 |
+
|
28 |
+
$htmlFeed = curl_init('http://magesolution.com/about/index.html');
|
29 |
+
|
30 |
+
if($htmlFeed === false){
|
31 |
+
throw new Exception('Error loading about section HTML.'); }
|
32 |
+
|
33 |
+
curl_setopt($htmlFeed, CURLOPT_RETURNTRANSFER, true);
|
34 |
+
curl_setopt($htmlFeed, CURLOPT_HEADER, 0);
|
35 |
+
$html = curl_exec($htmlFeed);
|
36 |
+
curl_close($htmlFeed);
|
37 |
+
|
38 |
+
if($html === false || $html == ''){
|
39 |
+
throw new Exception('Error loading about section HTML or there is no content.'); }
|
40 |
+
|
41 |
+
if(count($result->channel->item)>0){
|
42 |
+
$html.='<div class="grid-extension"><ul>';
|
43 |
+
$i=0;
|
44 |
+
foreach ($result->channel->item as $item) {
|
45 |
+
$i++;
|
46 |
+
$html.='<li';
|
47 |
+
if($i%5==0){
|
48 |
+
$html.=' class="last"';
|
49 |
+
}
|
50 |
+
$html.='>';
|
51 |
+
$html.='<div class="product-img">';
|
52 |
+
$html.='<a href="'.$item->link.'" title="'.$item->name.'"><img src="'.$item->img.'" alt="'.$item->name.'"/></a>';
|
53 |
+
$html.='</div>';
|
54 |
+
$html.='<h4>'.$item->name.'</h4>';
|
55 |
+
$html.='<div class="price-container">';
|
56 |
+
if(isset($item->old_price)){
|
57 |
+
$html.='<span class="old-price">'.$item->old_price.'</span>';
|
58 |
+
}
|
59 |
+
$html.='<span class="final-price">'.$item->price.'</span>';
|
60 |
+
$html.='</div>';
|
61 |
+
$html.='</li>';
|
62 |
+
}
|
63 |
+
$html.='</ul></div>';
|
64 |
+
}
|
65 |
+
|
66 |
+
unset($feed, $xml, $result);
|
67 |
+
|
68 |
+
return $html;
|
69 |
+
|
70 |
+
} catch (Exception $e) {
|
71 |
+
|
72 |
+
return $e->getMessage();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
app/code/local/MGS/Mgscore/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGS_Mgscore_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/MGS/Mgscore/etc/config.xml
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MGS_Mgscore>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</MGS_Mgscore>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<adminhtml>
|
10 |
+
<menu>
|
11 |
+
<mgscore module="mgscore">
|
12 |
+
<title>Mage Solutions</title>
|
13 |
+
<sort_order>99</sort_order>
|
14 |
+
<children>
|
15 |
+
<about module="mgscore">
|
16 |
+
<title>About Us</title>
|
17 |
+
<sort_order>0</sort_order>
|
18 |
+
<action>adminhtml/system_config/edit/section/mgscore_about</action>
|
19 |
+
</about>
|
20 |
+
</children>
|
21 |
+
</mgscore>
|
22 |
+
</menu>
|
23 |
+
<acl>
|
24 |
+
<resources>
|
25 |
+
<admin>
|
26 |
+
<children>
|
27 |
+
<mgscore module="mgscore">
|
28 |
+
<title>Mage Solutions</title>
|
29 |
+
<sort_order>99</sort_order>
|
30 |
+
<children>
|
31 |
+
<about module="mgscore">
|
32 |
+
<title>About Us</title>
|
33 |
+
<sort_order>0</sort_order>
|
34 |
+
</about>
|
35 |
+
</children>
|
36 |
+
</mgscore>
|
37 |
+
<system>
|
38 |
+
<children>
|
39 |
+
<config>
|
40 |
+
<children>
|
41 |
+
<mgscore_about translate="title">
|
42 |
+
<title>Mage Solutions</title>
|
43 |
+
<sort_order>888</sort_order>
|
44 |
+
</mgscore_about>
|
45 |
+
</children>
|
46 |
+
</config>
|
47 |
+
</children>
|
48 |
+
</system>
|
49 |
+
</children>
|
50 |
+
</admin>
|
51 |
+
</resources>
|
52 |
+
</acl>
|
53 |
+
<layout>
|
54 |
+
<updates>
|
55 |
+
<tabs>
|
56 |
+
<file>mgscore.xml</file>
|
57 |
+
</tabs>
|
58 |
+
</updates>
|
59 |
+
</layout>
|
60 |
+
</adminhtml>
|
61 |
+
|
62 |
+
<global>
|
63 |
+
<helpers>
|
64 |
+
<mgscore>
|
65 |
+
<class>MGS_Mgscore_Helper</class>
|
66 |
+
</mgscore>
|
67 |
+
</helpers>
|
68 |
+
|
69 |
+
<blocks>
|
70 |
+
<mgscore>
|
71 |
+
<class>MGS_Mgscore_Block</class>
|
72 |
+
</mgscore>
|
73 |
+
</blocks>
|
74 |
+
</global>
|
75 |
+
</config>
|
app/code/local/MGS/Mgscore/etc/system.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<mgscore translate="label">
|
5 |
+
<label>Mage Solutions</label>
|
6 |
+
<sort_order>6</sort_order>
|
7 |
+
</mgscore>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<mgscore_about translate="label">
|
11 |
+
<label>About Us</label>
|
12 |
+
<tab>mgscore</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<about translate="label" >
|
20 |
+
<frontend_model>mgscore/system_config_about</frontend_model>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
</about>
|
26 |
+
</groups>
|
27 |
+
</mgscore_about>
|
28 |
+
</sections>
|
29 |
+
</config>
|
app/design/frontend/default/default/layout/contactpro.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
</default>
|
5 |
+
<contactpro_index_index>
|
6 |
+
<reference name="head">
|
7 |
+
<action method="addItem"><type>skin_css</type><name>css/contactpro.css</name><params/></action>
|
8 |
+
</reference>
|
9 |
+
<reference name="root">
|
10 |
+
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
|
11 |
+
</reference>
|
12 |
+
<reference name="content">
|
13 |
+
<block type="contactpro/contactpro" name="contactpro" template="contactpro/contactpro.phtml" />
|
14 |
+
</reference>
|
15 |
+
</contactpro_index_index>
|
16 |
+
</layout>
|
app/design/frontend/default/default/template/contactpro/contactpro.phtml
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $helper = Mage::helper('contactpro');?>
|
2 |
+
<?php if($helper->getEnable()):?>
|
3 |
+
<div class="contactproform">
|
4 |
+
<div class="page-title">
|
5 |
+
<h1><?php echo $this->__('Contact Us');?></h1>
|
6 |
+
</div>
|
7 |
+
<form method="post" id="contactpro" action="<?php echo $this->getAction();?>">
|
8 |
+
<div class="fieldset">
|
9 |
+
<h2 class="legend">Contact Information</h2>
|
10 |
+
<div class="2columns">
|
11 |
+
<?php if(($this->getStaticBlock() != '') || $this->getGmap() != ''):?>
|
12 |
+
<div class="column-right">
|
13 |
+
<?php echo $this->getStaticBlock();?>
|
14 |
+
<?php echo $this->getGmap();?>
|
15 |
+
</div>
|
16 |
+
<?php endif;?>
|
17 |
+
<div class="column-left">
|
18 |
+
<ul class="form-list">
|
19 |
+
<li class="fields">
|
20 |
+
<div class="input-box">
|
21 |
+
<label class="required" for="full-name"><em>*</em><?php echo $this->__('Full Name');?></label>
|
22 |
+
<input type="text" class="input-text required-entry" value="<?php echo $this->getFullName();?>" title="<?php echo $this->__('Full Name');?>" id="full-name" name="full-name"/>
|
23 |
+
</div>
|
24 |
+
</li>
|
25 |
+
<li>
|
26 |
+
<label class="required" for="email"><em>*</em><?php echo $this->__('Email');?></label>
|
27 |
+
<div class="input-box">
|
28 |
+
<input type="text" class="input-text required-entry validate-email" value="<?php echo $this->getEmail();?>" title="<?php echo $this->__('Email');?>" id="email" name="email"/>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
|
32 |
+
<?php if(count($this->getFields())):?>
|
33 |
+
<?php foreach($this->getFields() as $field):?>
|
34 |
+
<?php if($field->getRequired() == 1):?>
|
35 |
+
<?php $label = '<em>*</em>'. $field->getLabel();?>
|
36 |
+
<?php $classRequired = ' required-entry';?>
|
37 |
+
<?php $classRequiredLabel = ' required';?>
|
38 |
+
<?php else:?>
|
39 |
+
<?php $label = $field->getLabel();?>
|
40 |
+
<?php $classRequired = '';?>
|
41 |
+
<?php $classRequiredLabel = '';?>
|
42 |
+
<?php endif;?>
|
43 |
+
<li>
|
44 |
+
<label class='<?php echo $classRequiredLabel;?>' for="<?php echo $helper->getCode($field->getLabel());?>"><?php echo $label;?></label>
|
45 |
+
<div class="input-box">
|
46 |
+
<input type="text" class="input-text <?php echo $classRequired;?>" value="" title="<?php echo $field->getLabel();?>" id="<?php echo $helper->getCode($field->getLabel());?>" name="<?php echo $helper->getCode($field->getLabel());?>"/>
|
47 |
+
</div>
|
48 |
+
</li>
|
49 |
+
<?php endforeach;?>
|
50 |
+
<?php endif;?>
|
51 |
+
|
52 |
+
<li>
|
53 |
+
<label></label>
|
54 |
+
<div class="input-box">
|
55 |
+
<div id="captcha-view"></div>
|
56 |
+
<button class="button" id="reload" title="<?php echo $this->__('Reload');?>" type="button">
|
57 |
+
<span><span><?php echo $this->__('Reload');?></span></span>
|
58 |
+
</button>
|
59 |
+
</div>
|
60 |
+
</li>
|
61 |
+
<li>
|
62 |
+
<label class="required" for="captcha"><em>*</em><?php echo $this->__('Captcha');?></label>
|
63 |
+
<div class="input-box">
|
64 |
+
<input type="text" class="input-text required-entry" value="" title="<?php echo $this->__('Captcha');?>" id="captcha" name="captcha"/>
|
65 |
+
</div>
|
66 |
+
</li>
|
67 |
+
</ul>
|
68 |
+
</div>
|
69 |
+
<div style="height:0;clear:both"> </div>
|
70 |
+
<ul class="form-list">
|
71 |
+
<li class="wide">
|
72 |
+
<label class="required" for="comment"><em>*</em><?php echo $this->__('Comment');?></label>
|
73 |
+
<div class="input-box">
|
74 |
+
<textarea rows="3" cols="5" class="required-entry input-text" title="<?php echo $this->__('Comment');?>" id="comment" name="comment"></textarea>
|
75 |
+
</div>
|
76 |
+
</li>
|
77 |
+
</ul>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<div class="buttons-set">
|
82 |
+
<p class="required"><?php echo $this->__('* Required Fields');?></p>
|
83 |
+
<button class="button" id="button-submit" title="<?php echo $this->__('Submit');?>" type="button">
|
84 |
+
<span><span><?php echo $this->__('Submit');?></span></span>
|
85 |
+
</button>
|
86 |
+
</div>
|
87 |
+
</form>
|
88 |
+
<div style="display:none" id="loading-mask">
|
89 |
+
<p id="loading_mask_loader" class="loader">
|
90 |
+
<img alt="<?php echo $this->__('Loading...');?>" src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif');?>">
|
91 |
+
<br>Please wait...
|
92 |
+
</p>
|
93 |
+
</div>
|
94 |
+
<script type="text/javascript">
|
95 |
+
//<![CDATA[
|
96 |
+
Event.observe(window, 'load',function(){
|
97 |
+
var contactpro = new VarienForm('contactpro', true);
|
98 |
+
|
99 |
+
renderCaptcha();
|
100 |
+
|
101 |
+
$('reload').observe('click',function(){
|
102 |
+
renderCaptcha();
|
103 |
+
});
|
104 |
+
|
105 |
+
$('contactpro').observe('keydown',function(event){
|
106 |
+
if(event.keyCode == 13){
|
107 |
+
submitForm();
|
108 |
+
}
|
109 |
+
});
|
110 |
+
|
111 |
+
$('button-submit').observe('click',function(){
|
112 |
+
submitForm();
|
113 |
+
});
|
114 |
+
|
115 |
+
function submitForm(){
|
116 |
+
var submit = false;
|
117 |
+
if(contactpro.validator && contactpro.validator.validate()){
|
118 |
+
submit = true;
|
119 |
+
}
|
120 |
+
|
121 |
+
url = '<?php echo $this->getUrl('contactpro/captcha/check');?>';
|
122 |
+
if(submit){
|
123 |
+
new Ajax.Request(url, {
|
124 |
+
method: 'post',
|
125 |
+
parameters: {captcha: $('captcha').value},
|
126 |
+
onSuccess: function(transport){
|
127 |
+
var data = transport.responseText.evalJSON();
|
128 |
+
if(data.result == 1){
|
129 |
+
contactpro.submit();
|
130 |
+
}else{
|
131 |
+
$('captcha').value = '';
|
132 |
+
contactpro.validator.validate();
|
133 |
+
}
|
134 |
+
}
|
135 |
+
});
|
136 |
+
}
|
137 |
+
};
|
138 |
+
|
139 |
+
function renderCaptcha(){
|
140 |
+
$('loading-mask').show();
|
141 |
+
var url = '<?php echo $this->getUrl('contactpro/captcha/render');?>';
|
142 |
+
new Ajax.Request(url, {
|
143 |
+
method: 'post',
|
144 |
+
onSuccess: function(transport){
|
145 |
+
$('captcha-view').update(transport.responseText);
|
146 |
+
$('loading-mask').hide();
|
147 |
+
}
|
148 |
+
});
|
149 |
+
}
|
150 |
+
});
|
151 |
+
|
152 |
+
//]]>
|
153 |
+
</script>
|
154 |
+
</div>
|
155 |
+
<?php endif; ?>
|
app/etc/modules/MGS_Contactpro.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MGS_Contactpro>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</MGS_Contactpro>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/MGS_Mgscore.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MGS_Mgscore>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</MGS_Mgscore>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/contact_pro.html
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var storename}}: {{var subjectmail}} @-->
|
2 |
+
|
3 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
4 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
5 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
6 |
+
<tr>
|
7 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
8 |
+
<!-- [ header starts here] -->
|
9 |
+
<table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
10 |
+
<tr>
|
11 |
+
<td valign="top">
|
12 |
+
<a href="{{var store}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}}" alt="{{var storename}}" style="margin-bottom:10px;" border="0"/></a></td>
|
13 |
+
</tr>
|
14 |
+
<!-- [ middle starts here] -->
|
15 |
+
<tr>
|
16 |
+
<td valign="top">
|
17 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{var fullname}},</h1>
|
18 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Thanks you!</p>
|
19 |
+
<ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
|
20 |
+
<li style="list-style:none inside; padding:0 0 0 10px;"> Full Name : {{var fullname}}</li>
|
21 |
+
<li style="list-style:none inside; padding:0 0 0 10px;"> Email : {{var emailaddress}}</li>
|
22 |
+
{{var options}}
|
23 |
+
</ul>
|
24 |
+
<p>
|
25 |
+
{{var comment}}
|
26 |
+
</p>
|
27 |
+
<p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a>.</p>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
<tr>
|
31 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong><a href="{{var store}}">{{var storename}}</a></strong></p></center></td>
|
32 |
+
</tr>
|
33 |
+
</table>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
</table>
|
37 |
+
</div>
|
38 |
+
</body>
|
app/locale/en_US/template/email/contact_pro_admin.html
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var storename}}: New Contact form ({{var emailaddress}}) @-->
|
2 |
+
|
3 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
4 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
5 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
6 |
+
<tr>
|
7 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
8 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
9 |
+
<!-- [ header starts here] -->
|
10 |
+
<tr>
|
11 |
+
<td valign="top">
|
12 |
+
<a href="{{var store}}">
|
13 |
+
<img src="{{skin url='images/logo_email.gif' _area='frontend'}}" alt="{{var storename}}" style="margin-bottom:10px;" border="0"/>
|
14 |
+
</a>
|
15 |
+
</td>
|
16 |
+
</tr>
|
17 |
+
<tr>
|
18 |
+
<td>
|
19 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;"></h2>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
<tr>
|
23 |
+
<td>
|
24 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
25 |
+
<tbody>
|
26 |
+
<tr>
|
27 |
+
<td valign="top">
|
28 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{var nameadmin}},</h1>
|
29 |
+
<ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
|
30 |
+
<li style="list-style:none inside; padding:0 0 0 10px;"> Full Name : {{var fullname}}</li>
|
31 |
+
<li style="list-style:none inside; padding:0 0 0 10px;"> Email : {{var emailaddress}}</li>
|
32 |
+
{{var options}}
|
33 |
+
</ul>
|
34 |
+
<p>
|
35 |
+
{{var comment}}
|
36 |
+
</p>
|
37 |
+
</td>
|
38 |
+
</tr>
|
39 |
+
</tbody>
|
40 |
+
</table>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</table>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</table>
|
47 |
+
</div>
|
48 |
+
</body>
|
media/contactpro/fonts/captcha.ttf
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MGS_AdvancedContact</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Allow administrator to add custom fields to magento contact form.</summary>
|
10 |
+
<description><ul>
|
11 |
+
<li>Allow admin to add new custom fields which are defined as mandatory or optional</li>
|
12 |
+
<li>Allow admin to establish the position for the newly added fields</li>
|
13 |
+
<li>Allow admin to add First name and Last name fields to the default Name field</li>
|
14 |
+
<li>Allow admin to Insert map code to the form with Gmap or Yahoo Map</li>
|
15 |
+
<li>Support Catpcha code to prevent spam messages</li>
|
16 |
+
<li>Allow admin to configure From email and To email which are different from the default configuration</li>
|
17 |
+
<li>Admin can update for Intro text from static block</li>
|
18 |
+
<li>HTML &amp; CSS and W3C validation</li>
|
19 |
+
</ul></description>
|
20 |
+
<notes>version 1.0</notes>
|
21 |
+
<authors><author><name>Mage Solution</name><user>mage_solution</user><email>info@magesolution.com</email></author></authors>
|
22 |
+
<date>2013-12-20</date>
|
23 |
+
<time>03:35:58</time>
|
24 |
+
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="MGS_Mgscore.xml" hash="f8ac0e98f4c28786cd4b615090676e1f"/><file name="MGS_Contactpro.xml" hash="8a30d4dea23d1b7185df62e2fdae31fb"/></dir></dir><dir name="code"><dir name="local"><dir name="MGS"><dir name="Contactpro"><dir name="Block"><file name="Contactpro.php" hash="1dd0310e1203a95579ad6827e61d5166"/><file name="Fieldform.php" hash="b99317a440fabb7549bc6e2859d6b89d"/></dir><dir name="Helper"><file name="Data.php" hash="4beac0241d060f31952afc2e004ab532"/></dir><dir name="Model"><file name="Contactprofield.php" hash="d5a02a92ba853fe0bb564be5edc0f7e1"/><dir name="Mysql4"><dir name="Contactprofield"><file name="Collection.php" hash="16d39b6784da4dc691cc356b4cfeb84d"/></dir><file name="Contactprofield.php" hash="d26668eb0556a90d7868ab1fcec22b77"/></dir><file name="Observers.php" hash="d49af798de3718a782ff524cbe704997"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Identity.php" hash="75e24ff4a02a5ebfdecadadf17a27494"/><file name="Listpage.php" hash="9329672a8dde2a6bf468fb78e721d7f6"/><file name="Staticblock.php" hash="5645ea2b5a26fe80b8cac3427d34cae1"/></dir></dir></dir></dir><dir name="controllers"><file name="CaptchaController.php" hash="0c8efa8735619dd1f41bf09eee91f164"/><file name="IndexController.php" hash="151a57546619a2591966d92b5f5b7546"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3d7071b2942515f07cbcf081b0fd0a7d"/><file name="config.xml" hash="8255089eaadc28d512b40356d03f97ba"/><file name="system.xml" hash="2b5af0155290162b88d8306c65cd526a"/></dir><dir name="sql"><dir name="contactpro_setup"><file name="mysql4-install-0.1.0.php" hash="7872023d81c54ac558312e7baf720e93"/></dir></dir></dir><dir name="Mgscore"><dir name="Block"><dir name="System"><dir name="Config"><file name="About.php" hash="e3a6ea60f46dcc1e9f961d60d1eaca1f"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e8940e23620e28ed20fe8bb799526230"/></dir><dir name="etc"><file name="config.xml" hash="f15f20b1d2b4ff90c9c289ae273c01ff"/><file name="system.xml" hash="231f2cc3b2d424833cb4ea328bac70f6"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="contactpro.xml" hash="0fea650cec430bd15531a5c4748dc1f1"/></dir><dir name="template"><dir name="contactpro"><file name="contactpro.phtml" hash="7710a2f0dadb9bc9e880ec92f1e23dd8"/></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><file name="contact_pro.html" hash="fe59e818af70b0773a8b46c120e2d590"/><file name="contact_pro_admin.html" hash="41640d612c104555d2afb8e3b58f6669"/></dir></dir></dir></dir></dir><dir name="media"><dir name="contactpro"><dir name="fonts"><file name="captcha.ttf" hash="9ef039cb984b8a88bbcc1b4d90293e8a"/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="contactpro.css" hash="b5af5be3157f52afc2d0860cd7308397"/></dir><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|
skin/frontend/default/default/css/contactpro.css
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#loading-mask {
|
2 |
+
color: #D85909;
|
3 |
+
font-size: 1.1em;
|
4 |
+
font-weight: bold;
|
5 |
+
opacity: 0.8;
|
6 |
+
position: absolute;
|
7 |
+
text-align: center;
|
8 |
+
z-index: 500;
|
9 |
+
}
|
10 |
+
|
11 |
+
#loading-mask .loader {
|
12 |
+
background: none repeat scroll 0 0 #FFF4E9;
|
13 |
+
border: 2px solid #F1AF73;
|
14 |
+
color: #D85909;
|
15 |
+
font-weight: bold;
|
16 |
+
left: 50%;
|
17 |
+
margin-left: -60px;
|
18 |
+
padding: 15px 60px;
|
19 |
+
position: fixed;
|
20 |
+
text-align: center;
|
21 |
+
top: 45%;
|
22 |
+
width: 120px;
|
23 |
+
z-index: 1000;
|
24 |
+
}
|
25 |
+
.contactproform .column-right{
|
26 |
+
float:right;
|
27 |
+
}
|
28 |
+
.contactproform .column-left{
|
29 |
+
float:left;
|
30 |
+
}
|
skin/frontend/default/default/images/ajax-loader-tr.gif
ADDED
Binary file
|