Version Notes
This is the initial release of EWT Product Inquiry extension
Download this release
Release Info
Developer | Yathavan |
Extension | EWTExtensions_Inquiry_1_0_0 |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry.php +14 -0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit.php +44 -0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Form.php +19 -0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Tab/Form.php +83 -0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Tabs.php +22 -0
- app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Grid.php +136 -0
- app/code/local/ETWExtensions/Inquiry/Block/Inquiry.php +16 -0
- app/code/local/ETWExtensions/Inquiry/Helper/Data.php +5 -0
- app/code/local/ETWExtensions/Inquiry/Model/Inquiry.php +10 -0
- app/code/local/ETWExtensions/Inquiry/Model/Mysql4/Inquiry.php +10 -0
- app/code/local/ETWExtensions/Inquiry/Model/Mysql4/Inquiry/Collection.php +10 -0
- app/code/local/ETWExtensions/Inquiry/Model/Status.php +17 -0
- app/code/local/ETWExtensions/Inquiry/controllers/Adminhtml/InquiryController.php +147 -0
- app/code/local/ETWExtensions/Inquiry/controllers/IndexController.php +50 -0
- app/code/local/ETWExtensions/Inquiry/etc/config.xml +137 -0
- app/code/local/ETWExtensions/Inquiry/sql/inquiry_setup/mysql4-install-1.0.0.php +23 -0
- app/design/adminhtml/default/default/layout/inquiry.xml +8 -0
- app/design/frontend/base/default/layout/inquiry.xml +18 -0
- app/design/frontend/base/default/template/inquiry/form/inquiry.phtml +52 -0
- app/design/frontend/rwd/default/layout/inquiry.xml +18 -0
- app/design/frontend/rwd/default/template/inquiry/form/inquiry.phtml +52 -0
- app/etc/modules/ETWExtensions_Inquiry.xml +9 -0
- app/locale/en_US/template/email/inquiry_notification_admin.html +35 -0
- package.xml +24 -0
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
$this->_controller = 'adminhtml_inquiry';
|
7 |
+
$this->_blockGroup = 'inquiry';
|
8 |
+
$this->_headerText = Mage::helper('inquiry')->__('Inquiry');
|
9 |
+
$this->setTemplate('widget/grid/container.phtml'); // use for disable add new button
|
10 |
+
//$this->_addButtonLabel = Mage::helper('inquiry')->__('Add Item');
|
11 |
+
//parent::__construct(); //comment for not display Add new Button
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$this->_objectId = 'id';
|
9 |
+
$this->_blockGroup = 'inquiry';
|
10 |
+
$this->_controller = 'adminhtml_inquiry';
|
11 |
+
|
12 |
+
$this->_updateButton('save', 'label', Mage::helper('inquiry')->__('Save'));
|
13 |
+
$this->_updateButton('delete', 'label', Mage::helper('inquiry')->__('Delete'));
|
14 |
+
|
15 |
+
$this->_addButton('saveandcontinue', array(
|
16 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
17 |
+
'onclick' => 'saveAndContinueEdit()',
|
18 |
+
'class' => 'save',
|
19 |
+
), -100);
|
20 |
+
|
21 |
+
$this->_formScripts[] = "
|
22 |
+
function toggleEditor() {
|
23 |
+
if (tinyMCE.getInstanceById('inquiry_content') == null) {
|
24 |
+
tinyMCE.execCommand('mceAddControl', false, 'inquiry_content');
|
25 |
+
} else {
|
26 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'inquiry_content');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
function saveAndContinueEdit(){
|
31 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
32 |
+
}
|
33 |
+
";
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getHeaderText() {
|
37 |
+
if (Mage::registry('inquiry_data') && Mage::registry('inquiry_data')->getId()) {
|
38 |
+
return Mage::helper('inquiry')->__("Edit Item", $this->htmlEscape(Mage::registry('inquiry_data')->getTitle()));
|
39 |
+
} else {
|
40 |
+
// return Mage::helper('inquiry')->__('Add Item');
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$form = new Varien_Data_Form(array(
|
7 |
+
'id' => 'edit_form',
|
8 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
9 |
+
'method' => 'post',
|
10 |
+
'enctype' => 'multipart/form-data'
|
11 |
+
)
|
12 |
+
);
|
13 |
+
|
14 |
+
$form->setUseContainer(true);
|
15 |
+
$this->setForm($form);
|
16 |
+
return parent::_prepareForm();
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$form = new Varien_Data_Form();
|
7 |
+
$this->setForm($form);
|
8 |
+
$fieldset = $form->addFieldset('inquiry_form', array('legend' => Mage::helper('inquiry')->__('Enquiry Status')));
|
9 |
+
|
10 |
+
$fieldset->addField('status', 'select', array(
|
11 |
+
'label' => Mage::helper('inquiry')->__('Status'),
|
12 |
+
'name' => 'status',
|
13 |
+
'values' => array(
|
14 |
+
array(
|
15 |
+
'value' => 'OPEN',
|
16 |
+
'label' => Mage::helper('inquiry')->__('Open'),
|
17 |
+
),
|
18 |
+
array(
|
19 |
+
'value' => 'HOLD',
|
20 |
+
'label' => Mage::helper('inquiry')->__('Hold'),
|
21 |
+
),
|
22 |
+
array(
|
23 |
+
'value' => 'CLOSED',
|
24 |
+
'label' => Mage::helper('inquiry')->__('Closed'),
|
25 |
+
),
|
26 |
+
),
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('inquiry_id', 'text', array(
|
30 |
+
'label' => Mage::helper('inquiry')->__('Enquiry ID'),
|
31 |
+
'required' => false,
|
32 |
+
'name' => 'inquiry_id',
|
33 |
+
'disabled' => 'disabled',
|
34 |
+
));
|
35 |
+
|
36 |
+
$fieldset->addField('customer_id', 'text', array(
|
37 |
+
'label' => Mage::helper('inquiry')->__('Customer ID'),
|
38 |
+
'required' => false,
|
39 |
+
'name' => 'customer_id',
|
40 |
+
'disabled' => 'disabled',
|
41 |
+
));
|
42 |
+
|
43 |
+
$fieldset->addField('customer_name', 'text', array(
|
44 |
+
'label' => Mage::helper('inquiry')->__('Name'),
|
45 |
+
'required' => false,
|
46 |
+
'name' => 'customer_name',
|
47 |
+
'disabled' => 'disabled',
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('customer_email', 'text', array(
|
51 |
+
'label' => Mage::helper('inquiry')->__('Email'),
|
52 |
+
'required' => false,
|
53 |
+
'name' => 'customer_email',
|
54 |
+
'disabled' => 'disabled',
|
55 |
+
));
|
56 |
+
|
57 |
+
$fieldset->addField('sku', 'text', array(
|
58 |
+
'label' => Mage::helper('inquiry')->__('SKU'),
|
59 |
+
'required' => false,
|
60 |
+
'name' => 'sku',
|
61 |
+
'disabled' => 'disabled',
|
62 |
+
));
|
63 |
+
|
64 |
+
$fieldset->addField('comment', 'editor', array(
|
65 |
+
'name' => 'comment',
|
66 |
+
'label' => Mage::helper('inquiry')->__('Comment'),
|
67 |
+
'title' => Mage::helper('inquiry')->__('Comment'),
|
68 |
+
'style' => 'width:700px; height:500px;',
|
69 |
+
'wysiwyg' => false,
|
70 |
+
'required' => false,
|
71 |
+
'disabled' => 'disabled',
|
72 |
+
));
|
73 |
+
|
74 |
+
if (Mage::getSingleton('adminhtml/session')->getWebData()) {
|
75 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebData());
|
76 |
+
Mage::getSingleton('adminhtml/session')->setWebData(null);
|
77 |
+
} elseif (Mage::registry('inquiry_data')) {
|
78 |
+
$form->setValues(Mage::registry('inquiry_data')->getData());
|
79 |
+
}
|
80 |
+
return parent::_prepareForm();
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Edit/Tabs.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('inquiry_tabs');
|
8 |
+
$this->setDestElementId('edit_form');
|
9 |
+
$this->setTitle(Mage::helper('inquiry')->__('Item Information'));
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _beforeToHtml() {
|
13 |
+
$this->addTab('form_section', array(
|
14 |
+
'label' => Mage::helper('inquiry')->__('Item Information'),
|
15 |
+
'title' => Mage::helper('inquiry')->__('Item Information'),
|
16 |
+
'content' => $this->getLayout()->createBlock('inquiry/adminhtml_inquiry_edit_tab_form')->toHtml(),
|
17 |
+
));
|
18 |
+
|
19 |
+
return parent::_beforeToHtml();
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Adminhtml/Inquiry/Grid.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Adminhtml_Inquiry_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('inquiryGrid');
|
8 |
+
$this->setDefaultSort('inquiry_id');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection() {
|
14 |
+
$collection = Mage::getModel('inquiry/inquiry')->getCollection();
|
15 |
+
$this->setCollection($collection);
|
16 |
+
return parent::_prepareCollection();
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareColumns() {
|
20 |
+
$this->addColumn('inquiry_id', array(
|
21 |
+
'header' => Mage::helper('inquiry')->__('ID'),
|
22 |
+
'align' => 'right',
|
23 |
+
'width' => '60px',
|
24 |
+
'index' => 'inquiry_id',
|
25 |
+
));
|
26 |
+
|
27 |
+
$this->addColumn('customer_id', array(
|
28 |
+
'header' => Mage::helper('inquiry')->__('Customer ID'),
|
29 |
+
'align' => 'left',
|
30 |
+
'width' => '100px',
|
31 |
+
'index' => 'customer_id',
|
32 |
+
));
|
33 |
+
|
34 |
+
$this->addColumn('customer_name', array(
|
35 |
+
'header' => Mage::helper('inquiry')->__('Name'),
|
36 |
+
'align' => 'left',
|
37 |
+
'width' => '200px',
|
38 |
+
'index' => 'customer_name',
|
39 |
+
));
|
40 |
+
|
41 |
+
$this->addColumn('customer_email', array(
|
42 |
+
'header' => Mage::helper('inquiry')->__('Email'),
|
43 |
+
'align' => 'left',
|
44 |
+
'width' => '200px',
|
45 |
+
'index' => 'customer_email',
|
46 |
+
));
|
47 |
+
|
48 |
+
$this->addColumn('sku', array(
|
49 |
+
'header' => Mage::helper('inquiry')->__('SKU'),
|
50 |
+
'align' => 'left',
|
51 |
+
'index' => 'sku',
|
52 |
+
));
|
53 |
+
|
54 |
+
$this->addColumn('comment', array(
|
55 |
+
'header' => Mage::helper('inquiry')->__('Questions'),
|
56 |
+
'index' => 'comment',
|
57 |
+
));
|
58 |
+
|
59 |
+
$this->addColumn('created_time', array(
|
60 |
+
'header' => Mage::helper('inquiry')->__('Date'),
|
61 |
+
'width' => '130px',
|
62 |
+
'index' => 'created_time',
|
63 |
+
));
|
64 |
+
|
65 |
+
$this->addColumn('status', array(
|
66 |
+
'header' => Mage::helper('inquiry')->__('Status'),
|
67 |
+
'align' => 'left',
|
68 |
+
'width' => '80px',
|
69 |
+
'index' => 'status',
|
70 |
+
'type' => 'options',
|
71 |
+
'options' => array(
|
72 |
+
'OPEN' => 'Open',
|
73 |
+
'HOLD' => 'Hold',
|
74 |
+
'CLOSED' => 'Closed'
|
75 |
+
),
|
76 |
+
));
|
77 |
+
|
78 |
+
$this->addColumn('action', array(
|
79 |
+
'header' => Mage::helper('inquiry')->__('Action'),
|
80 |
+
'width' => '50px',
|
81 |
+
'align' => 'center',
|
82 |
+
'type' => 'action',
|
83 |
+
'getter' => 'getId',
|
84 |
+
'actions' => array(
|
85 |
+
array(
|
86 |
+
'caption' => Mage::helper('inquiry')->__('Edit'),
|
87 |
+
'url' => array('base' => '*//*/edit'),
|
88 |
+
'field' => 'id'
|
89 |
+
)
|
90 |
+
),
|
91 |
+
'filter' => false,
|
92 |
+
'sortable' => false,
|
93 |
+
'index' => 'stores',
|
94 |
+
'is_system' => true,
|
95 |
+
));
|
96 |
+
|
97 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('inquiry')->__('CSV'));
|
98 |
+
$this->addExportType('*/*/exportXml', Mage::helper('inquiry')->__('XML'));
|
99 |
+
|
100 |
+
return parent::_prepareColumns();
|
101 |
+
}
|
102 |
+
|
103 |
+
protected function _prepareMassaction() {
|
104 |
+
$this->setMassactionIdField('inquiry_id');
|
105 |
+
$this->getMassactionBlock()->setFormFieldName('inquiry');
|
106 |
+
|
107 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
108 |
+
'label' => Mage::helper('inquiry')->__('Delete'),
|
109 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
110 |
+
'confirm' => Mage::helper('inquiry')->__('Are you sure?')
|
111 |
+
));
|
112 |
+
|
113 |
+
$statuses = Mage::getSingleton('inquiry/status')->getOptionArray();
|
114 |
+
|
115 |
+
array_unshift($statuses, array('label' => '', 'value' => ''));
|
116 |
+
$this->getMassactionBlock()->addItem('status', array(
|
117 |
+
'label' => Mage::helper('inquiry')->__('Change status'),
|
118 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
|
119 |
+
'additional' => array(
|
120 |
+
'visibility' => array(
|
121 |
+
'name' => 'status',
|
122 |
+
'type' => 'select',
|
123 |
+
'class' => 'required-entry',
|
124 |
+
'label' => Mage::helper('inquiry')->__('Status'),
|
125 |
+
'values' => $statuses
|
126 |
+
)
|
127 |
+
)
|
128 |
+
));
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getRowUrl($row) {
|
133 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Block/Inquiry.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Block_Inquiry extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function _prepareLayout() {
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getWeb() {
|
10 |
+
if (!$this->hasData('inquiry')) {
|
11 |
+
$this->setData('inquiry', Mage::registry('inquiry'));
|
12 |
+
}
|
13 |
+
return $this->getData('inquiry');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Model/Inquiry.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Model_Inquiry extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('inquiry/inquiry');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Model/Mysql4/Inquiry.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Model_Mysql4_Inquiry extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
// Note that the web_id refers to the key field in your database table.
|
7 |
+
$this->_init('inquiry/inquiry', 'inquiry_id');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Model/Mysql4/Inquiry/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Model_Mysql4_Inquiry_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('inquiry/inquiry');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/ETWExtensions/Inquiry/Model/Status.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Model_Status extends Varien_Object {
|
4 |
+
|
5 |
+
const STATUS_OPEN = "OPEN";
|
6 |
+
const STATUS_HOLD = "HOLD";
|
7 |
+
const STATUS_CLOSED = "CLOSED";
|
8 |
+
|
9 |
+
static public function getOptionArray() {
|
10 |
+
return array(
|
11 |
+
self::STATUS_OPEN => Mage::helper('inquiry')->__('Open'),
|
12 |
+
self::STATUS_HOLD => Mage::helper('inquiry')->__('Hold'),
|
13 |
+
self::STATUS_CLOSED => Mage::helper('inquiry')->__('Closed')
|
14 |
+
);
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/local/ETWExtensions/Inquiry/controllers/Adminhtml/InquiryController.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_Adminhtml_InquiryController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
protected function _initAction() {
|
6 |
+
$this->loadLayout()
|
7 |
+
->_setActiveMenu('inquiry/items')
|
8 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Inquiry Manager'), Mage::helper('adminhtml')->__('Inquiry Manager'));
|
9 |
+
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function indexAction() {
|
14 |
+
$this->_initAction()
|
15 |
+
->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function editAction() {
|
19 |
+
$id = $this->getRequest()->getParam('id');
|
20 |
+
$model = Mage::getModel('inquiry/inquiry')->load($id);
|
21 |
+
|
22 |
+
if ($model->getId() || $id == 0) {
|
23 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
24 |
+
if (!empty($data)) {
|
25 |
+
$model->setData($data);
|
26 |
+
}
|
27 |
+
|
28 |
+
Mage::register('inquiry_data', $model);
|
29 |
+
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->_setActiveMenu('inquiry/items');
|
32 |
+
|
33 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
34 |
+
|
35 |
+
$this->_addContent($this->getLayout()->createBlock('inquiry/adminhtml_inquiry_edit'))
|
36 |
+
->_addLeft($this->getLayout()->createBlock('inquiry/adminhtml_inquiry_edit_tabs'));
|
37 |
+
|
38 |
+
$this->renderLayout();
|
39 |
+
} else {
|
40 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('inquiry')->__('No Data exist'));
|
41 |
+
$this->_redirect('*/*/');
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function newAction() {
|
46 |
+
$this->_forward('edit');
|
47 |
+
}
|
48 |
+
|
49 |
+
public function saveAction() {
|
50 |
+
if ($data = $this->getRequest()->getPost()) {
|
51 |
+
$model = Mage::getModel('inquiry/inquiry');
|
52 |
+
$model->setData($data)
|
53 |
+
->setId($this->getRequest()->getParam('id'));
|
54 |
+
|
55 |
+
try {
|
56 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
57 |
+
$model->setCreatedTime(now())
|
58 |
+
->setUpdateTime(now());
|
59 |
+
} else {
|
60 |
+
$model->setUpdateTime(now());
|
61 |
+
}
|
62 |
+
|
63 |
+
$model->save();
|
64 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('inquiry')->__('Item was successfully saved'));
|
65 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
66 |
+
|
67 |
+
if ($this->getRequest()->getParam('back')) {
|
68 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
$this->_redirect('*/*/');
|
72 |
+
return;
|
73 |
+
} catch (Exception $e) {
|
74 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
75 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
76 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('inquiry')->__('Unable to find item to save'));
|
81 |
+
$this->_redirect('*/*/');
|
82 |
+
}
|
83 |
+
|
84 |
+
public function deleteAction() {
|
85 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
86 |
+
try {
|
87 |
+
$model = Mage::getModel('inquiry/inquiry');
|
88 |
+
|
89 |
+
$model->setId($this->getRequest()->getParam('id'))
|
90 |
+
->delete();
|
91 |
+
|
92 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
93 |
+
$this->_redirect('*/*/');
|
94 |
+
} catch (Exception $e) {
|
95 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
96 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
97 |
+
}
|
98 |
+
}
|
99 |
+
$this->_redirect('*/*/');
|
100 |
+
}
|
101 |
+
|
102 |
+
public function massDeleteAction() {
|
103 |
+
$webIds = $this->getRequest()->getParam('inquiry');
|
104 |
+
if (!is_array($webIds)) {
|
105 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
106 |
+
} else {
|
107 |
+
try {
|
108 |
+
foreach ($webIds as $webId) {
|
109 |
+
$web = Mage::getModel('inquiry/inquiry')->load($webId);
|
110 |
+
$web->delete();
|
111 |
+
}
|
112 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
113 |
+
Mage::helper('adminhtml')->__(
|
114 |
+
'Total of %d record(s) were successfully deleted', count($webIds)
|
115 |
+
)
|
116 |
+
);
|
117 |
+
} catch (Exception $e) {
|
118 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
119 |
+
}
|
120 |
+
}
|
121 |
+
$this->_redirect('*/*/index');
|
122 |
+
}
|
123 |
+
|
124 |
+
public function massStatusAction() {
|
125 |
+
$webIds = $this->getRequest()->getParam('inquiry');
|
126 |
+
if (!is_array($webIds)) {
|
127 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
128 |
+
} else {
|
129 |
+
try {
|
130 |
+
foreach ($webIds as $webId) {
|
131 |
+
$web = Mage::getSingleton('inquiry/inquiry')
|
132 |
+
->load($webId)
|
133 |
+
->setStatus($this->getRequest()->getParam('status'))
|
134 |
+
->setIsMassupdate(true)
|
135 |
+
->save();
|
136 |
+
}
|
137 |
+
$this->_getSession()->addSuccess(
|
138 |
+
$this->__('Total of %d record(s) were successfully updated', count($webIds))
|
139 |
+
);
|
140 |
+
} catch (Exception $e) {
|
141 |
+
$this->_getSession()->addError($e->getMessage());
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$this->_redirect('*/*/index');
|
145 |
+
}
|
146 |
+
|
147 |
+
}
|
app/code/local/ETWExtensions/Inquiry/controllers/IndexController.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ETWExtensions_Inquiry_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function postAction() {
|
11 |
+
$post = $this->getRequest()->getPost();
|
12 |
+
if (!empty($post['customer_email']) && filter_var($post['customer_email'], FILTER_VALIDATE_EMAIL)) {
|
13 |
+
$request_model = Mage::getModel('inquiry/inquiry');
|
14 |
+
$request_model->setData($post);
|
15 |
+
$request_model->setCreatedTime(now());
|
16 |
+
$request_model->save();
|
17 |
+
$this->notifyAdmin($post);
|
18 |
+
$message = 'We thank you for forwarding your inquiry. We would touch base at the earliest.';
|
19 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('inquiry')->__($message));
|
20 |
+
} else {
|
21 |
+
$message = 'Please enter a valid email address.';
|
22 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('inquiry')->__($message));
|
23 |
+
}
|
24 |
+
$wbrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
25 |
+
$wcrl = str_ireplace($wbrl,"",$post['wcrl']);
|
26 |
+
$this->_redirect($wcrl);
|
27 |
+
}
|
28 |
+
|
29 |
+
private function notifyAdmin($post) {
|
30 |
+
$mailSubject = 'Product Inquiry';
|
31 |
+
$adminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
|
32 |
+
$adminName = Mage::getStoreConfig('trans_email/ident_general/name');
|
33 |
+
$storeName = Mage::app()->getStore()->getName();
|
34 |
+
$vars = array('customerName' => $post['customer_name'],
|
35 |
+
'customerEmail' => $post['customer_email'],
|
36 |
+
'sku' => $post['sku'],
|
37 |
+
'comment' => $post['comment'],
|
38 |
+
'adminName' => $adminName,
|
39 |
+
'storeName' => $storeName
|
40 |
+
);
|
41 |
+
|
42 |
+
$emailTemplate = Mage::getModel('core/email_template');
|
43 |
+
$emailTemplate->loadDefault('inquiry_notification_admin');
|
44 |
+
$emailTemplate->setTemplateSubject($mailSubject);
|
45 |
+
$emailTemplate->setSenderName($post['customer_name']);
|
46 |
+
$emailTemplate->setSenderEmail($post['customer_email']);
|
47 |
+
$emailTemplate->send($adminEmail, $storeName, $vars);
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/local/ETWExtensions/Inquiry/etc/config.xml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ETWExtensions_Inquiry>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</ETWExtensions_Inquiry>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<inquiry>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>ETWExtensions_Inquiry</module>
|
14 |
+
<frontName>inquiry</frontName>
|
15 |
+
</args>
|
16 |
+
</inquiry>
|
17 |
+
<inquiry>
|
18 |
+
<args>
|
19 |
+
<modules>
|
20 |
+
<ETWExtensions_Inquiry before="Mage_Inquiry">ETWExtensions_Inquiry</ETWExtensions_Inquiry>
|
21 |
+
</modules>
|
22 |
+
</args>
|
23 |
+
</inquiry>
|
24 |
+
</routers>
|
25 |
+
<layout>
|
26 |
+
<updates>
|
27 |
+
<inquiry>
|
28 |
+
<file>inquiry.xml</file>
|
29 |
+
</inquiry>
|
30 |
+
</updates>
|
31 |
+
</layout>
|
32 |
+
</frontend>
|
33 |
+
<admin>
|
34 |
+
<routers>
|
35 |
+
<inquiry>
|
36 |
+
<use>admin</use>
|
37 |
+
<args>
|
38 |
+
<module>ETWExtensions_Inquiry</module>
|
39 |
+
<frontName>inquiry</frontName>
|
40 |
+
</args>
|
41 |
+
</inquiry>
|
42 |
+
</routers>
|
43 |
+
</admin>
|
44 |
+
<adminhtml>
|
45 |
+
<menu>
|
46 |
+
<inquiry module="inquiry">
|
47 |
+
<title>Inquiry</title>
|
48 |
+
<sort_order>71</sort_order>
|
49 |
+
<!-- <children>
|
50 |
+
<items module="inquiry">
|
51 |
+
<title>Inquiry</title>
|
52 |
+
<sort_order>0</sort_order>
|
53 |
+
<action>inquiry/adminhtml_inquiry</action>
|
54 |
+
</items>
|
55 |
+
</children> -->
|
56 |
+
<action>inquiry/adminhtml_inquiry</action>
|
57 |
+
</inquiry>
|
58 |
+
</menu>
|
59 |
+
<acl>
|
60 |
+
<resources>
|
61 |
+
<all>
|
62 |
+
<title>Allow Everything</title>
|
63 |
+
</all>
|
64 |
+
<admin>
|
65 |
+
<children>
|
66 |
+
<ETWExtensions_Inquiry>
|
67 |
+
<title>Inquiry Module</title>
|
68 |
+
<sort_order>10</sort_order>
|
69 |
+
</ETWExtensions_Inquiry>
|
70 |
+
</children>
|
71 |
+
</admin>
|
72 |
+
</resources>
|
73 |
+
</acl>
|
74 |
+
<layout>
|
75 |
+
<updates>
|
76 |
+
<inquiry>
|
77 |
+
<file>inquiry.xml</file>
|
78 |
+
</inquiry>
|
79 |
+
</updates>
|
80 |
+
</layout>
|
81 |
+
</adminhtml>
|
82 |
+
<global>
|
83 |
+
<models>
|
84 |
+
<inquiry>
|
85 |
+
<class>ETWExtensions_Inquiry_Model</class>
|
86 |
+
<resourceModel>inquiry_mysql4</resourceModel>
|
87 |
+
</inquiry>
|
88 |
+
<inquiry_mysql4>
|
89 |
+
<class>ETWExtensions_Inquiry_Model_Mysql4</class>
|
90 |
+
<entities>
|
91 |
+
<inquiry>
|
92 |
+
<table>etw_inquiries</table>
|
93 |
+
</inquiry>
|
94 |
+
</entities>
|
95 |
+
</inquiry_mysql4>
|
96 |
+
</models>
|
97 |
+
<resources>
|
98 |
+
<inquiry_setup>
|
99 |
+
<setup>
|
100 |
+
<module>ETWExtensions_Inquiry</module>
|
101 |
+
</setup>
|
102 |
+
<connection>
|
103 |
+
<use>core_setup</use>
|
104 |
+
</connection>
|
105 |
+
</inquiry_setup>
|
106 |
+
<inquiry_write>
|
107 |
+
<connection>
|
108 |
+
<use>core_write</use>
|
109 |
+
</connection>
|
110 |
+
</inquiry_write>
|
111 |
+
<inquiry_read>
|
112 |
+
<connection>
|
113 |
+
<use>core_read</use>
|
114 |
+
</connection>
|
115 |
+
</inquiry_read>
|
116 |
+
</resources>
|
117 |
+
<blocks>
|
118 |
+
<inquiry>
|
119 |
+
<class>ETWExtensions_Inquiry_Block</class>
|
120 |
+
</inquiry>
|
121 |
+
</blocks>
|
122 |
+
<helpers>
|
123 |
+
<inquiry>
|
124 |
+
<class>ETWExtensions_Inquiry_Helper</class>
|
125 |
+
</inquiry>
|
126 |
+
</helpers>
|
127 |
+
<template>
|
128 |
+
<email>
|
129 |
+
<inquiry_notification_admin module="ETWExtensions_Inquiry">
|
130 |
+
<label>Inquiry Notification Admin</label>
|
131 |
+
<file>inquiry_notification_admin.html</file>
|
132 |
+
<type>html</type>
|
133 |
+
</inquiry_notification_admin>
|
134 |
+
</email>
|
135 |
+
</template>
|
136 |
+
</global>
|
137 |
+
</config>
|
app/code/local/ETWExtensions/Inquiry/sql/inquiry_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('etw_inquiries')};
|
10 |
+
CREATE TABLE {$this->getTable('etw_inquiries')} (
|
11 |
+
`inquiry_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`customer_id` int(11) NULL,
|
13 |
+
`customer_name` varchar(200) NOT NULL default '',
|
14 |
+
`customer_email` varchar(200) NOT NULL default '',
|
15 |
+
`sku` varchar(100) NOT NULL,
|
16 |
+
`comment` text NOT NULL default '',
|
17 |
+
`created_time` datetime NOT NULL default CURRENT_TIMESTAMP,
|
18 |
+
`status` varchar(10) NOT NULL default 'OPEN',
|
19 |
+
PRIMARY KEY (`inquiry_id`)
|
20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/inquiry.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<inquiry_adminhtml_inquiry_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="inquiry/adminhtml_inquiry" name="inquiry" />
|
6 |
+
</reference>
|
7 |
+
</inquiry_adminhtml_inquiry_index>
|
8 |
+
</layout>
|
app/design/frontend/base/default/layout/inquiry.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<!--
|
4 |
+
Product view
|
5 |
+
-->
|
6 |
+
<catalog_product_view>
|
7 |
+
<reference name="product.info">
|
8 |
+
<block type="inquiry/inquiry" name="product.inquiry" as="inquiry" template="inquiry/form/inquiry.phtml" after="reviews">
|
9 |
+
<action method="addToParentGroup">
|
10 |
+
<group>detailed_info</group>
|
11 |
+
</action>
|
12 |
+
<action method="setTitle" translate="value">
|
13 |
+
<value>Inquiry</value>
|
14 |
+
</action>
|
15 |
+
</block>
|
16 |
+
</reference>
|
17 |
+
</catalog_product_view>
|
18 |
+
</layout>
|
app/design/frontend/base/default/template/inquiry/form/inquiry.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="inquiry_form">
|
2 |
+
<style type="text/css">
|
3 |
+
#inquiry-form{width: 60%; max-width: 500px;}
|
4 |
+
#inquiry-form label{ width: 100%; max-width: 100px;}
|
5 |
+
#inquiry-form input, #inquiry-form textarea{ margin-bottom: 10px; width: 100%; max-width: 500px; padding: 5px;}
|
6 |
+
#inquiry-form button{float: right;}
|
7 |
+
</style>
|
8 |
+
<div class="page-title">
|
9 |
+
<h4><?php echo $this->__('Inquiry Form') ?></h4>
|
10 |
+
</div>
|
11 |
+
<div class="inquiry_form_wrap" >
|
12 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
13 |
+
<form action="<?php echo Mage::getBaseUrl() . 'inquiry/index/post/'; ?>" method="post" id="inquiry-form">
|
14 |
+
<?php
|
15 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
16 |
+
$product = Mage::registry('current_product');
|
17 |
+
?>
|
18 |
+
<input type="hidden" name="sku" value="<?php echo $product->getData('sku'); ?>" />
|
19 |
+
<input type="hidden" name="customer_id" value="<?php
|
20 |
+
if (!empty($customer)) {
|
21 |
+
echo $customer->getId();
|
22 |
+
}
|
23 |
+
?>" />
|
24 |
+
<input type="hidden" name="wcrl" value="<?php echo Mage::helper('core/url')->getCurrentUrl(); ?>" />
|
25 |
+
<div>
|
26 |
+
<label for="product_name">Product</label><br />
|
27 |
+
<input type="text" name="product_name" value="<?php echo $product->getData('name'); ?>" readonly />
|
28 |
+
</div>
|
29 |
+
<div>
|
30 |
+
<label for="customer_name">Name</label><br />
|
31 |
+
<input type="text" name="customer_name" value="<?php
|
32 |
+
if (!empty($customer)) {
|
33 |
+
echo $customer->getName();
|
34 |
+
}
|
35 |
+
?>" />
|
36 |
+
</div>
|
37 |
+
<div>
|
38 |
+
<label for="customer_email">Email</label><br />
|
39 |
+
<input type="text" name="customer_email" value="<?php
|
40 |
+
if (!empty($customer)) {
|
41 |
+
echo $customer->getEmail();
|
42 |
+
}
|
43 |
+
?>" />
|
44 |
+
</div>
|
45 |
+
<div>
|
46 |
+
<label for="comment">Questions</label><br />
|
47 |
+
<textarea name="comment" /></textarea>
|
48 |
+
</div>
|
49 |
+
<div><button type="submit" class="button" title="<?php echo $this->__('Send Inquiry') ?>" name="send_inquiry" id="send_inquiry"><span><span><?php echo $this->__('Send Inquiry') ?></span></span></button></div>
|
50 |
+
</form>
|
51 |
+
</div>
|
52 |
+
</div>
|
app/design/frontend/rwd/default/layout/inquiry.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<!--
|
4 |
+
Product view
|
5 |
+
-->
|
6 |
+
<catalog_product_view>
|
7 |
+
<reference name="product.info">
|
8 |
+
<block type="inquiry/inquiry" name="product.inquiry" as="inquiry" template="inquiry/form/inquiry.phtml" after="reviews">
|
9 |
+
<action method="addToParentGroup">
|
10 |
+
<group>detailed_info</group>
|
11 |
+
</action>
|
12 |
+
<action method="setTitle" translate="value">
|
13 |
+
<value>Inquiry</value>
|
14 |
+
</action>
|
15 |
+
</block>
|
16 |
+
</reference>
|
17 |
+
</catalog_product_view>
|
18 |
+
</layout>
|
app/design/frontend/rwd/default/template/inquiry/form/inquiry.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="inquiry_form">
|
2 |
+
<style type="text/css">
|
3 |
+
#inquiry-form{width: 60%; max-width: 500px;}
|
4 |
+
#inquiry-form label{ width: 100%; max-width: 100px;}
|
5 |
+
#inquiry-form input, #inquiry-form textarea{ margin-bottom: 10px; width: 100%; max-width: 500px; padding: 5px;}
|
6 |
+
#inquiry-form button{float: right;}
|
7 |
+
</style>
|
8 |
+
<div class="page-title">
|
9 |
+
<h4><?php echo $this->__('Inquiry Form') ?></h4>
|
10 |
+
</div>
|
11 |
+
<div class="inquiry_form_wrap" >
|
12 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
13 |
+
<form action="<?php echo Mage::getBaseUrl() . 'inquiry/index/post/'; ?>" method="post" id="inquiry-form">
|
14 |
+
<?php
|
15 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
16 |
+
$product = Mage::registry('current_product');
|
17 |
+
?>
|
18 |
+
<input type="hidden" name="sku" value="<?php echo $product->getData('sku'); ?>" />
|
19 |
+
<input type="hidden" name="customer_id" value="<?php
|
20 |
+
if (!empty($customer)) {
|
21 |
+
echo $customer->getId();
|
22 |
+
}
|
23 |
+
?>" />
|
24 |
+
<input type="hidden" name="wcrl" value="<?php echo Mage::helper('core/url')->getCurrentUrl(); ?>" />
|
25 |
+
<div>
|
26 |
+
<label for="product_name">Product</label><br />
|
27 |
+
<input type="text" name="product_name" value="<?php echo $product->getData('name'); ?>" readonly />
|
28 |
+
</div>
|
29 |
+
<div>
|
30 |
+
<label for="customer_name">Name</label><br />
|
31 |
+
<input type="text" name="customer_name" value="<?php
|
32 |
+
if (!empty($customer)) {
|
33 |
+
echo $customer->getName();
|
34 |
+
}
|
35 |
+
?>" />
|
36 |
+
</div>
|
37 |
+
<div>
|
38 |
+
<label for="customer_email">Email</label><br />
|
39 |
+
<input type="text" name="customer_email" value="<?php
|
40 |
+
if (!empty($customer)) {
|
41 |
+
echo $customer->getEmail();
|
42 |
+
}
|
43 |
+
?>" />
|
44 |
+
</div>
|
45 |
+
<div>
|
46 |
+
<label for="comment">Questions</label><br />
|
47 |
+
<textarea name="comment" /></textarea>
|
48 |
+
</div>
|
49 |
+
<div><button type="submit" class="button" title="<?php echo $this->__('Send Inquiry') ?>" name="send_inquiry" id="send_inquiry"><span><span><?php echo $this->__('Send Inquiry') ?></span></span></button></div>
|
50 |
+
</form>
|
51 |
+
</div>
|
52 |
+
</div>
|
app/etc/modules/ETWExtensions_Inquiry.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ETWExtensions_Inquiry>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</ETWExtensions_Inquiry>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/inquiry_notification_admin.html
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Product Inquiry @-->
|
2 |
+
<!--@styles
|
3 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
4 |
+
@-->
|
5 |
+
|
6 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
7 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
8 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
9 |
+
<tr>
|
10 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
11 |
+
<!-- [ header starts here] -->
|
12 |
+
<table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
13 |
+
<tr>
|
14 |
+
<td valign="top">
|
15 |
+
<a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a>
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
<!-- [ middle starts here] -->
|
19 |
+
<tr>
|
20 |
+
<td valign="top">
|
21 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{var adminName}},</h1>
|
22 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 8px 0;"><b>{{var customerName}}</b>, <b>{{var customerEmail}}</b>, sent the following inquiry about product SKU <b>{{var sku}}</b></p>
|
23 |
+
<p><b>Questions:</b></p>
|
24 |
+
<p style="font-size:12px; line-height:16px; margin:0;">{{var comment}}<p>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;"><strong>{{var storeName}}</strong></p></center></td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
</table>
|
34 |
+
</div>
|
35 |
+
</body>
|
package.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>EWTExtensions_Inquiry_1_0_0</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.gnu.org/licenses/gpl.html">GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension enable customers to send inquiry about products. Store admin will got notified via email.</summary>
|
10 |
+
<description><p>This extension enables customers to send inquiry about products.</p>
|
11 |
+
<h2>*Features*</h2>
|
12 |
+
<ul>
|
13 |
+
<li>Inquiry form on product page</li>
|
14 |
+
<li>Auto identify logedin customer</li>
|
15 |
+
<li>Notify admin via email</li>
|
16 |
+
<li>Save and display inquiries in admin panel</li></description>
|
17 |
+
<notes>This is the initial release of EWT Product Inquiry extension</notes>
|
18 |
+
<authors><author><name>Yathavan</name><user>yathavan</user><email>yathavan7@gmail.com</email></author></authors>
|
19 |
+
<date>2014-08-06</date>
|
20 |
+
<time>15:39:07</time>
|
21 |
+
<contents><target name="magelocal"><dir name="ETWExtensions"><dir name="Inquiry"><dir name="Block"><dir name="Adminhtml"><dir name="Inquiry"><dir name="Edit"><file name="Form.php" hash="d96f220c7fc5ae069bc15fdfed7ee610"/><dir name="Tab"><file name="Form.php" hash="789fe0037afea2f54fb4d4929c984161"/></dir><file name="Tabs.php" hash="c12171a0ab4867c7601e6080f0aceb03"/></dir><file name="Edit.php" hash="fbe9f620a7b4fd26279c2658cbe25a5c"/><file name="Grid.php" hash="acdef9eba3c09f6b37fb8c6f2ee04300"/></dir><file name="Inquiry.php" hash="ac9017de0b4f5a8e7e36eb62c3337cda"/></dir><file name="Inquiry.php" hash="b7836625caa4ed29f37be5ad97279c25"/></dir><dir name="Helper"><file name="Data.php" hash="415423f915cd21d678b0fb2d8ad3de0d"/></dir><dir name="Model"><file name="Inquiry.php" hash="208e7a90c34febba91293770c057ab53"/><dir name="Mysql4"><dir name="Inquiry"><file name="Collection.php" hash="45dc86749e34f06a33fb7430be333ead"/></dir><file name="Inquiry.php" hash="38a40b48fd584c918bebd9d15b37ce0c"/></dir><file name="Status.php" hash="bc3a704dffcf2d4ced98297f51d16fd2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="InquiryController.php" hash="27987ed3f82025301e59cf10c87ccc82"/></dir><file name="IndexController.php" hash="201f30f0e4dfb03a8dd6069029510a31"/></dir><dir name="etc"><file name="config.xml" hash="6d205a6fb1a39327f788c73e4a9522c5"/></dir><dir name="sql"><dir name="inquiry_setup"><file name="mysql4-install-1.0.0.php" hash="195cb85e7fe0b7dc312485221426838c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="inquiry.xml" hash="fe0f26fff24722f164f9d5012d28a484"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="inquiry.xml" hash="0fc62b1d7ab7399fc5ff8dcbd9d7a97a"/></dir><dir name="template"><dir name="inquiry"><dir name="form"><file name="inquiry.phtml" hash="d98b09b2e586fb4698d10480f702efec"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="inquiry.xml" hash="0fc62b1d7ab7399fc5ff8dcbd9d7a97a"/></dir><dir name="template"><dir name="inquiry"><dir name="form"><file name="inquiry.phtml" hash="d98b09b2e586fb4698d10480f702efec"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ETWExtensions_Inquiry.xml" hash="5d48044792f8f238eb51526d671fab44"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="inquiry_notification_admin.html" hash="65b4036bc8eb24067214b1bf47b271d6"/></dir></dir></dir></target></contents>
|
22 |
+
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.4.0</min><max>5.5.14</max></php></required></dependencies>
|
24 |
+
</package>
|