Version Notes
Request For Quotation
Download this release
Release Info
Developer | Commerce Pundit |
Extension | CP_Rfq |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq.php +12 -0
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit.php +45 -0
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Form.php +19 -0
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Tab/Form.php +82 -0
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Tabs.php +24 -0
- app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Grid.php +158 -0
- app/code/community/CP/Rfq/Block/Captcha.php +20 -0
- app/code/community/CP/Rfq/Block/Captcha/Zend.php +36 -0
- app/code/community/CP/Rfq/Block/Rfq.php +25 -0
- app/code/community/CP/Rfq/Helper/Data.php +22 -0
- app/code/community/CP/Rfq/Model/Mysql4/Rfq.php +10 -0
- app/code/community/CP/Rfq/Model/Mysql4/Rfq/Collection.php +10 -0
- app/code/community/CP/Rfq/Model/Rfq.php +10 -0
- app/code/community/CP/Rfq/Model/Status.php +15 -0
- app/code/community/CP/Rfq/controllers/Adminhtml/RfqController.php +205 -0
- app/code/community/CP/Rfq/controllers/IndexController.php +171 -0
- app/code/community/CP/Rfq/etc/config.xml +173 -0
- app/code/community/CP/Rfq/etc/system.xml +102 -0
- app/code/community/CP/Rfq/sql/rfq_setup/mysql4-install-1.0.1.php +29 -0
- app/design/adminhtml/default/default/layout/rfq.xml +8 -0
- app/design/frontend/default/default/layout/rfq.xml +36 -0
- app/design/frontend/default/default/template/rfq/rfq.phtml +71 -0
- app/design/frontend/rwd/default/layout/rfq.xml +36 -0
- app/design/frontend/rwd/default/template/rfq/rfq.phtml +71 -0
- app/etc/modules/CP_Rfq.xml +9 -0
- app/locale/en_US/template/email/rfq_answer.html +30 -0
- app/locale/en_US/template/email/rfq_question.html +40 -0
- package.xml +30 -0
app/code/community/CP/Rfq/Block/Adminhtml/Rfq.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class CP_Rfq_Block_Adminhtml_Rfq extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_rfq';
|
7 |
+
$this->_blockGroup = 'rfq';
|
8 |
+
$this->_headerText = Mage::helper('rfq')->__('Item Manager');
|
9 |
+
//$this->_addButtonLabel = Mage::helper('rfq')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Adminhtml_Rfq_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'rfq';
|
11 |
+
$this->_controller = 'adminhtml_rfq';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('rfq')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('rfq')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('rfq_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'rfq_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'rfq_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('rfq_data') && Mage::registry('rfq_data')->getId() ) {
|
40 |
+
return Mage::helper('rfq')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('rfq_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('rfq')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Adminhtml_Rfq_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Adminhtml_Rfq_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset('rfq_form', array('legend'=>Mage::helper('rfq')->__('Item information')));
|
10 |
+
$categoriesArray = Mage::getModel('catalog/category')
|
11 |
+
->getCollection()
|
12 |
+
->addAttributeToSelect('name')
|
13 |
+
->addAttributeToSort(array('position' => 'asc', 'id' => 'asc'))
|
14 |
+
->addFieldToFilter('is_active', array('eq'=>'1'))
|
15 |
+
->load()
|
16 |
+
->toArray();
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
$fieldset->addField('cutomer_email_status', 'hidden', array(
|
23 |
+
'name' => 'cutomer_email_status',
|
24 |
+
));
|
25 |
+
|
26 |
+
|
27 |
+
$fieldset->addField('name', 'text', array(
|
28 |
+
'label' => Mage::helper('rfq')->__('Customer Name'),
|
29 |
+
'class' => 'required-entry',
|
30 |
+
'required' => true,
|
31 |
+
'name' => 'name',
|
32 |
+
));
|
33 |
+
|
34 |
+
$fieldset->addField('email', 'text', array(
|
35 |
+
'label' => Mage::helper('rfq')->__('Customer Email'),
|
36 |
+
'class' => 'required-entry',
|
37 |
+
'required' => true,
|
38 |
+
'name' => 'email',
|
39 |
+
));
|
40 |
+
|
41 |
+
$fieldset->addField('status', 'select', array(
|
42 |
+
'label' => Mage::helper('rfq')->__('Status'),
|
43 |
+
'name' => 'status',
|
44 |
+
'values' => array(
|
45 |
+
array(
|
46 |
+
'value' => 1,
|
47 |
+
'label' => Mage::helper('rfq')->__('Enabled'),
|
48 |
+
),
|
49 |
+
array(
|
50 |
+
'value' => 2,
|
51 |
+
'label' => Mage::helper('rfq')->__('Disabled'),
|
52 |
+
),
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
|
57 |
+
$fieldset->addField('question', 'text', array(
|
58 |
+
'label' => Mage::helper('rfq')->__('Question'),
|
59 |
+
'class' => 'required-entry',
|
60 |
+
'required' => true,
|
61 |
+
'name' => 'question',
|
62 |
+
));
|
63 |
+
|
64 |
+
$fieldset->addField('answer', 'editor', array(
|
65 |
+
'name' => 'answer',
|
66 |
+
'label' => Mage::helper('rfq')->__('Answer'),
|
67 |
+
'title' => Mage::helper('rfq')->__('Answer'),
|
68 |
+
'style' => 'width:700px; height:500px;',
|
69 |
+
'wysiwyg' => false,
|
70 |
+
'required' => true,
|
71 |
+
));
|
72 |
+
|
73 |
+
if ( Mage::getSingleton('adminhtml/session')->getRfqData() )
|
74 |
+
{
|
75 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getRfqData());
|
76 |
+
Mage::getSingleton('adminhtml/session')->setRfqData(null);
|
77 |
+
} elseif ( Mage::registry('rfq_data') ) {
|
78 |
+
$form->setValues(Mage::registry('rfq_data')->getData());
|
79 |
+
}
|
80 |
+
return parent::_prepareForm();
|
81 |
+
}
|
82 |
+
}
|
app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Adminhtml_Rfq_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('rfq_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('rfq')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('rfq')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('rfq')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('rfq/adminhtml_rfq_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/CP/Rfq/Block/Adminhtml/Rfq/Grid.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Adminhtml_Rfq_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('rfqGrid');
|
9 |
+
$this->setDefaultSort('rfq_id');
|
10 |
+
$this->setDefaultDir('DESC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('rfq/rfq')->getCollection();
|
17 |
+
$resource = Mage::getSingleton('core/resource');
|
18 |
+
|
19 |
+
$this->setCollection($collection);
|
20 |
+
return parent::_prepareCollection();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _prepareColumns()
|
24 |
+
{
|
25 |
+
$this->addColumn('rfq_id', array(
|
26 |
+
'header' => Mage::helper('rfq')->__('ID'),
|
27 |
+
'align' =>'left',
|
28 |
+
'index' => 'rfq_id',
|
29 |
+
));
|
30 |
+
|
31 |
+
$this->addColumn('created_time', array(
|
32 |
+
'header' => Mage::helper('rfq')->__('Created Time'),
|
33 |
+
'align' =>'left',
|
34 |
+
'type' => 'datetime',
|
35 |
+
'index' => 'created_time',
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->addColumn('update_time', array(
|
39 |
+
'header' => Mage::helper('rfq')->__('Updated Time'),
|
40 |
+
'align' =>'left',
|
41 |
+
'type' => 'datetime',
|
42 |
+
'index' => 'update_time',
|
43 |
+
));
|
44 |
+
|
45 |
+
$this->addColumn('name', array(
|
46 |
+
'header' => Mage::helper('rfq')->__('Name'),
|
47 |
+
'align' =>'left',
|
48 |
+
'index' => 'name',
|
49 |
+
));
|
50 |
+
$this->addColumn('email', array(
|
51 |
+
'header' => Mage::helper('rfq')->__('Email'),
|
52 |
+
'align' =>'left',
|
53 |
+
'index' => 'email',
|
54 |
+
));
|
55 |
+
$this->addColumn('Company', array(
|
56 |
+
'header' => Mage::helper('rfq')->__('Company'),
|
57 |
+
'align' =>'left',
|
58 |
+
'index' => 'company_name',
|
59 |
+
));
|
60 |
+
$this->addColumn('Website', array(
|
61 |
+
'header' => Mage::helper('rfq')->__('Website'),
|
62 |
+
'align' =>'left',
|
63 |
+
'index' => 'website_name',
|
64 |
+
));
|
65 |
+
$this->addColumn('Avg monthly order', array(
|
66 |
+
'header' => Mage::helper('rfq')->__('Avg monthly order'),
|
67 |
+
'align' =>'left',
|
68 |
+
'index' => 'avg_order',
|
69 |
+
));
|
70 |
+
$this->addColumn('Phone', array(
|
71 |
+
'header' => Mage::helper('rfq')->__('Phone'),
|
72 |
+
'align' =>'left',
|
73 |
+
'index' => 'phone_number',
|
74 |
+
));
|
75 |
+
|
76 |
+
$this->addColumn('question', array(
|
77 |
+
'header' => Mage::helper('rfq')->__('Question'),
|
78 |
+
'align' =>'left',
|
79 |
+
'index' => 'question',
|
80 |
+
));
|
81 |
+
|
82 |
+
$this->addColumn('answer', array(
|
83 |
+
'header' => Mage::helper('rfq')->__('Answer'),
|
84 |
+
'align' =>'left',
|
85 |
+
'index' => 'answer',
|
86 |
+
));
|
87 |
+
|
88 |
+
$this->addColumn('status', array(
|
89 |
+
'header' => Mage::helper('rfq')->__('Status'),
|
90 |
+
'align' => 'left',
|
91 |
+
'index' => 'status',
|
92 |
+
'type' => 'options',
|
93 |
+
'options' => array(
|
94 |
+
1 => 'Enabled',
|
95 |
+
2 => 'Disabled',
|
96 |
+
),
|
97 |
+
));
|
98 |
+
|
99 |
+
$this->addColumn('action',
|
100 |
+
array(
|
101 |
+
'header' => Mage::helper('rfq')->__('Action'),
|
102 |
+
'type' => 'action',
|
103 |
+
'getter' => 'getId',
|
104 |
+
'actions' => array(
|
105 |
+
array(
|
106 |
+
'caption' => Mage::helper('rfq')->__('Edit'),
|
107 |
+
'url' => array('base'=> '*/*/edit'),
|
108 |
+
'field' => 'id'
|
109 |
+
)
|
110 |
+
),
|
111 |
+
'filter' => false,
|
112 |
+
'sortable' => false,
|
113 |
+
'index' => 'stores',
|
114 |
+
'is_system' => true,
|
115 |
+
));
|
116 |
+
|
117 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('rfq')->__('CSV'));
|
118 |
+
$this->addExportType('*/*/exportXml', Mage::helper('rfq')->__('XML'));
|
119 |
+
|
120 |
+
return parent::_prepareColumns();
|
121 |
+
}
|
122 |
+
|
123 |
+
protected function _prepareMassaction()
|
124 |
+
{
|
125 |
+
$this->setMassactionIdField('rfq_id');
|
126 |
+
$this->getMassactionBlock()->setFormFieldName('rfq');
|
127 |
+
|
128 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
129 |
+
'label' => Mage::helper('rfq')->__('Delete'),
|
130 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
131 |
+
'confirm' => Mage::helper('rfq')->__('Are you sure?')
|
132 |
+
));
|
133 |
+
|
134 |
+
$statuses = Mage::getSingleton('rfq/status')->getOptionArray();
|
135 |
+
|
136 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
137 |
+
$this->getMassactionBlock()->addItem('status', array(
|
138 |
+
'label'=> Mage::helper('rfq')->__('Change status'),
|
139 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
140 |
+
'additional' => array(
|
141 |
+
'visibility' => array(
|
142 |
+
'name' => 'status',
|
143 |
+
'type' => 'select',
|
144 |
+
'class' => 'required-entry',
|
145 |
+
'label' => Mage::helper('rfq')->__('Status'),
|
146 |
+
'values' => $statuses
|
147 |
+
)
|
148 |
+
)
|
149 |
+
));
|
150 |
+
return $this;
|
151 |
+
}
|
152 |
+
|
153 |
+
public function getRowUrl($row)
|
154 |
+
{
|
155 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
app/code/community/CP/Rfq/Block/Captcha.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Captcha extends Mage_Captcha_Block_Captcha
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Renders captcha HTML (if required)
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
protected function _toHtml()
|
11 |
+
{
|
12 |
+
|
13 |
+
$blockPath = 'rfq/captcha_zend';
|
14 |
+
$block = $this->getLayout()->createBlock($blockPath);
|
15 |
+
$block->setData($this->getData());
|
16 |
+
return $block->toHtml();
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
?>
|
app/code/community/CP/Rfq/Block/Captcha/Zend.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Block_Captcha_Zend extends Mage_Captcha_Block_Captcha_Zend
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Renders captcha HTML (if required)
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
protected function _toHtml()
|
11 |
+
{
|
12 |
+
$this->getCaptchaModel()->generate();
|
13 |
+
|
14 |
+
if (!$this->getTemplate()) {
|
15 |
+
return '';
|
16 |
+
}
|
17 |
+
$html = $this->renderView();
|
18 |
+
|
19 |
+
return $html;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns URL to controller action which returns new captcha image
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function getRefreshUrl()
|
28 |
+
{
|
29 |
+
return Mage::getUrl(
|
30 |
+
Mage::app()->getStore()->isAdmin() ? 'adminhtml/refresh/refresh' : 'rfq/index/refresh',
|
31 |
+
array('_secure' => Mage::app()->getStore()->isCurrentlySecure())
|
32 |
+
);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
?>
|
app/code/community/CP/Rfq/Block/Rfq.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class CP_Rfq_Block_Rfq extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
protected function _prepareLayout()
|
10 |
+
{
|
11 |
+
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
|
12 |
+
$breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'),'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
|
13 |
+
$breadcrumbs->addCrumb('an_alias', array('label'=>'Rfq', 'title'=>'Rfq'));
|
14 |
+
|
15 |
+
return parent::_prepareLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getPagerHtml()
|
19 |
+
{
|
20 |
+
return $this->getChildHtml('pager');
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
}
|
app/code/community/CP/Rfq/Helper/Data.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getUserName()
|
6 |
+
{
|
7 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
8 |
+
return '';
|
9 |
+
}
|
10 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
11 |
+
return trim($customer->getName());
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getUserEmail()
|
15 |
+
{
|
16 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
17 |
+
return '';
|
18 |
+
}
|
19 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
20 |
+
return $customer->getEmail();
|
21 |
+
}
|
22 |
+
}
|
app/code/community/CP/Rfq/Model/Mysql4/Rfq.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Model_Mysql4_Rfq extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the rfq_id refers to the key field in your database table.
|
8 |
+
$this->_init('rfq/rfq', 'rfq_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/CP/Rfq/Model/Mysql4/Rfq/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Model_Mysql4_Rfq_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('rfq/rfq');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/CP/Rfq/Model/Rfq.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Model_Rfq extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('rfq/rfq');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/CP/Rfq/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('rfq')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('rfq')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/CP/Rfq/controllers/Adminhtml/RfqController.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CP_Rfq_Adminhtml_RfqController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
const XML_PATH_EMAIL_RECIPIENT = 'rfq/rfq/recipient_email';
|
6 |
+
const XML_PATH_EMAIL_SENDER = 'rfq/rfq/sender_email_identity';
|
7 |
+
const XML_PATH_EMAIL2_TEMPLATE = 'rfq/rfq/email2_template';
|
8 |
+
|
9 |
+
protected function _initAction() {
|
10 |
+
$this->loadLayout()
|
11 |
+
->_setActiveMenu('rfq/items')
|
12 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
13 |
+
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function indexAction() {
|
18 |
+
$this->_initAction()
|
19 |
+
->renderLayout();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function editAction() {
|
23 |
+
$id = $this->getRequest()->getParam('id');
|
24 |
+
$model = Mage::getModel('rfq/rfq')->load($id);
|
25 |
+
|
26 |
+
if ($model->getId() || $id == 0) {
|
27 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
28 |
+
if (!empty($data)) {
|
29 |
+
$model->setData($data);
|
30 |
+
}
|
31 |
+
|
32 |
+
Mage::register('rfq_data', $model);
|
33 |
+
|
34 |
+
$this->loadLayout();
|
35 |
+
$this->_setActiveMenu('rfq/items');
|
36 |
+
|
37 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
38 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
39 |
+
|
40 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
41 |
+
|
42 |
+
$this->_addContent($this->getLayout()->createBlock('rfq/adminhtml_rfq_edit'))
|
43 |
+
->_addLeft($this->getLayout()->createBlock('rfq/adminhtml_rfq_edit_tabs'));
|
44 |
+
|
45 |
+
$this->renderLayout();
|
46 |
+
} else {
|
47 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('rfq')->__('Item does not exist'));
|
48 |
+
$this->_redirect('*/*/');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
public function newAction() {
|
53 |
+
$this->_forward('edit');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function saveAction() {
|
57 |
+
if ($data = $this->getRequest()->getPost()) {
|
58 |
+
|
59 |
+
$postObject = new Varien_Object();
|
60 |
+
$postObject->setData($data);
|
61 |
+
|
62 |
+
$model = Mage::getModel('rfq/rfq');
|
63 |
+
$model->setData($data)
|
64 |
+
->setId($this->getRequest()->getParam('id'));
|
65 |
+
|
66 |
+
try {
|
67 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
68 |
+
//$model->setCreatedTime(now())
|
69 |
+
$model->setUpdateTime(now());
|
70 |
+
} else {
|
71 |
+
$model->setUpdateTime(now());
|
72 |
+
}
|
73 |
+
|
74 |
+
//if($data['cutomer_email_status'] != 1){
|
75 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
76 |
+
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
|
77 |
+
->setReplyTo(self::XML_PATH_EMAIL_RECIPIENT)
|
78 |
+
->sendTransactional(
|
79 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL2_TEMPLATE),
|
80 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
|
81 |
+
$data['email'],
|
82 |
+
null,
|
83 |
+
array('data' => $postObject)
|
84 |
+
);
|
85 |
+
$model->setData('cutomer_email_status',1);
|
86 |
+
//}
|
87 |
+
$model->save();
|
88 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('rfq')->__('Item was successfully saved'));
|
89 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
90 |
+
|
91 |
+
if ($this->getRequest()->getParam('back')) {
|
92 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
$this->_redirect('*/*/');
|
96 |
+
return;
|
97 |
+
} catch (Exception $e) {
|
98 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
99 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
100 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('rfq')->__('Unable to find item to save'));
|
105 |
+
$this->_redirect('*/*/');
|
106 |
+
}
|
107 |
+
|
108 |
+
public function deleteAction() {
|
109 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
110 |
+
try {
|
111 |
+
$model = Mage::getModel('rfq/rfq');
|
112 |
+
|
113 |
+
$model->setId($this->getRequest()->getParam('id'))
|
114 |
+
->delete();
|
115 |
+
|
116 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
117 |
+
$this->_redirect('*/*/');
|
118 |
+
} catch (Exception $e) {
|
119 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
120 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
121 |
+
}
|
122 |
+
}
|
123 |
+
$this->_redirect('*/*/');
|
124 |
+
}
|
125 |
+
|
126 |
+
public function massDeleteAction() {
|
127 |
+
$rfqIds = $this->getRequest()->getParam('rfq');
|
128 |
+
if(!is_array($rfqIds)) {
|
129 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
130 |
+
} else {
|
131 |
+
try {
|
132 |
+
foreach ($rfqIds as $rfqId) {
|
133 |
+
$rfq = Mage::getModel('rfq/rfq')->load($rfqId);
|
134 |
+
$rfq->delete();
|
135 |
+
}
|
136 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
137 |
+
Mage::helper('adminhtml')->__(
|
138 |
+
'Total of %d record(s) were successfully deleted', count($rfqIds)
|
139 |
+
)
|
140 |
+
);
|
141 |
+
} catch (Exception $e) {
|
142 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
143 |
+
}
|
144 |
+
}
|
145 |
+
$this->_redirect('*/*/index');
|
146 |
+
}
|
147 |
+
|
148 |
+
public function massStatusAction()
|
149 |
+
{
|
150 |
+
$rfqIds = $this->getRequest()->getParam('rfq');
|
151 |
+
if(!is_array($rfqIds)) {
|
152 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
153 |
+
} else {
|
154 |
+
try {
|
155 |
+
foreach ($rfqIds as $rfqId) {
|
156 |
+
$rfq = Mage::getSingleton('rfq/rfq')
|
157 |
+
->load($rfqId)
|
158 |
+
->setStatus($this->getRequest()->getParam('status'))
|
159 |
+
->setIsMassupdate(true)
|
160 |
+
->save();
|
161 |
+
}
|
162 |
+
$this->_getSession()->addSuccess(
|
163 |
+
$this->__('Total of %d record(s) were successfully updated', count($rfqIds))
|
164 |
+
);
|
165 |
+
} catch (Exception $e) {
|
166 |
+
$this->_getSession()->addError($e->getMessage());
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$this->_redirect('*/*/index');
|
170 |
+
}
|
171 |
+
|
172 |
+
public function exportCsvAction()
|
173 |
+
{
|
174 |
+
$fileName = 'rfq.csv';
|
175 |
+
$content = $this->getLayout()->createBlock('rfq/adminhtml_rfq_grid')
|
176 |
+
->getCsv();
|
177 |
+
|
178 |
+
$this->_sendUploadResponse($fileName, $content);
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportXmlAction()
|
182 |
+
{
|
183 |
+
$fileName = 'rfq.xml';
|
184 |
+
$content = $this->getLayout()->createBlock('rfq/adminhtml_rfq_grid')
|
185 |
+
->getXml();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
191 |
+
{
|
192 |
+
$response = $this->getResponse();
|
193 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
194 |
+
$response->setHeader('Pragma', 'public', true);
|
195 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
196 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
197 |
+
$response->setHeader('Last-Modified', date('r'));
|
198 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
199 |
+
$response->setHeader('Content-Length', strlen($content));
|
200 |
+
$response->setHeader('Content-type', $contentType);
|
201 |
+
$response->setBody($content);
|
202 |
+
$response->sendResponse();
|
203 |
+
die;
|
204 |
+
}
|
205 |
+
}
|
app/code/community/CP/Rfq/controllers/IndexController.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class CP_Rfq_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
const XML_PATH_EMAIL_RECIPIENT = 'rfq/rfq/recipient_email';
|
5 |
+
const XML_PATH_EMAIL_CC = 'rfq/rfq/recipient_cc';
|
6 |
+
const XML_PATH_EMAIL_SENDER = 'rfq/rfq/sender_email_identity';
|
7 |
+
const XML_PATH_EMAIL_TEMPLATE = 'rfq/rfq/email_template';
|
8 |
+
const XML_PATH_ENABLED = 'rfq/rfq/enabled';
|
9 |
+
|
10 |
+
public function preDispatch()
|
11 |
+
{
|
12 |
+
parent::preDispatch();
|
13 |
+
|
14 |
+
if( !Mage::getStoreConfigFlag(self::XML_PATH_ENABLED) ) {
|
15 |
+
$this->norouteAction();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
public function indexAction()
|
20 |
+
{
|
21 |
+
$this->loadLayout();
|
22 |
+
$this->renderLayout();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function postAction()
|
26 |
+
{
|
27 |
+
|
28 |
+
$post = $this->getRequest()->getPost();
|
29 |
+
Mage::getSingleton('core/session')->setRfq($post);
|
30 |
+
$_captcha = Mage::getModel('customer/session')->getData('form-validate-captcha_word');
|
31 |
+
$recaptcha_secret = Mage::getStoreConfig('rfq/rfq/google_secret_key') ;
|
32 |
+
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$post['g-recaptcha-response']);
|
33 |
+
$response = json_decode($response, true);
|
34 |
+
|
35 |
+
if ($response["success"] != true) {
|
36 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('rfq')->__('Please enter valid captcha code.'));
|
37 |
+
$this->_redirect('*/*/');
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( $post ) {
|
42 |
+
$model = Mage::getSingleton('rfq/rfq')->setData($post);
|
43 |
+
}
|
44 |
+
try {
|
45 |
+
$postObject = new Varien_Object();
|
46 |
+
$postObject->setData($post);
|
47 |
+
|
48 |
+
$error = false;
|
49 |
+
|
50 |
+
if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
|
51 |
+
$error = true;
|
52 |
+
}
|
53 |
+
if (!Zend_Validate::is(trim($post['phone_number']) , 'NotEmpty')) {
|
54 |
+
$error = true;
|
55 |
+
}
|
56 |
+
if (!Zend_Validate::is(trim($post['avg_order']) , 'NotEmpty')) {
|
57 |
+
$error = true;
|
58 |
+
}
|
59 |
+
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
|
60 |
+
$error = true;
|
61 |
+
}
|
62 |
+
if ($error) {
|
63 |
+
throw new Exception();
|
64 |
+
}
|
65 |
+
try {
|
66 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
67 |
+
$model->setCreatedTime(now())
|
68 |
+
->setUpdateTime(now());
|
69 |
+
} else {
|
70 |
+
$model->setUpdateTime(now());
|
71 |
+
}
|
72 |
+
$model->setStoreId(Mage::app()->getStore()->getStoreId());
|
73 |
+
$model->save();
|
74 |
+
|
75 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
76 |
+
/* @var $mailTemplate Mage_Core_Model_Email_Template */
|
77 |
+
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
|
78 |
+
->setReplyTo($post['email'])
|
79 |
+
->addBcc(explode(',',Mage::getStoreConfig(self::XML_PATH_EMAIL_CC)))
|
80 |
+
->sendTransactional(
|
81 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
|
82 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
|
83 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
|
84 |
+
null,
|
85 |
+
array('data' => $postObject)
|
86 |
+
);
|
87 |
+
|
88 |
+
if (!$mailTemplate->getSentSuccess()) {
|
89 |
+
throw new Exception();
|
90 |
+
}
|
91 |
+
|
92 |
+
//$translate->setTranslateInline(true);
|
93 |
+
|
94 |
+
Mage::getSingleton('core/session')->addSuccess('Your quotation is submitted successfully and we will be back to you as soon as possible in Email.');
|
95 |
+
Mage::getSingleton('core/session')->setRfq();
|
96 |
+
|
97 |
+
$this->_redirect('*/*/');
|
98 |
+
return;
|
99 |
+
}catch (Exception $e) {
|
100 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
101 |
+
Mage::getSingleton('core/session')->setFormData($data);
|
102 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
} catch (Exception $e) {
|
106 |
+
$translate->setTranslateInline(true);
|
107 |
+
|
108 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('rfq')->__('Unable to submit your request. Please, try again later').$e->getMessage());
|
109 |
+
$this->_redirect('*/*/');
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
public function loginAction()
|
115 |
+
{
|
116 |
+
|
117 |
+
$return_url = $_POST['cur_url'];
|
118 |
+
$session = Mage::getSingleton('customer/session');
|
119 |
+
if ($session->isLoggedIn()) {
|
120 |
+
$this->_redirectUrl($return_url);
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
|
124 |
+
if ($this->getRequest()->isPost())
|
125 |
+
{
|
126 |
+
|
127 |
+
$login_data = $this->getRequest()->getPost('login');
|
128 |
+
if (empty($login_data['username']) || empty($login_data['password'])) {
|
129 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('rfq')->__('Login and password are required.').$e->getMessage());
|
130 |
+
|
131 |
+
}
|
132 |
+
else
|
133 |
+
{
|
134 |
+
try
|
135 |
+
{
|
136 |
+
$session->login($login_data['username'], $login_data['password']);
|
137 |
+
|
138 |
+
$this->_redirectUrl($return_url);
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
catch (Mage_Core_Exception $e)
|
142 |
+
{
|
143 |
+
switch ($e->getCode()) {
|
144 |
+
case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
|
145 |
+
$message = Mage::helper('onepagecheckout')->__('Email is not confirmed. <a href="%s">Resend confirmation email.</a>', Mage::helper('customer')->getEmailConfirmationUrl($login_data['username']));
|
146 |
+
break;
|
147 |
+
default:
|
148 |
+
Mage::getSingleton('core/session')->addError($message.$e->getMessage());
|
149 |
+
}
|
150 |
+
$result['error'] = $message;
|
151 |
+
$session->setUsername($login_data['username']);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
$this->_redirectUrl($return_url);
|
156 |
+
return;
|
157 |
+
//$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
public function refreshAction()
|
162 |
+
{
|
163 |
+
$formId = $this->getRequest()->getPost('formId', false);
|
164 |
+
if ($formId) {
|
165 |
+
$captchaModel = Mage::helper('captcha')->getCaptcha($formId);
|
166 |
+
$this->getLayout()->createBlock('rfq/captcha_zend')->setFormId($formId)->setIsAjax(true)->toHtml();
|
167 |
+
$this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc())));
|
168 |
+
}
|
169 |
+
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
|
170 |
+
}
|
171 |
+
}
|
app/code/community/CP/Rfq/etc/config.xml
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<CP_Rfq>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</CP_Rfq>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<rfq>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>CP_Rfq</module>
|
14 |
+
<frontName>rfq</frontName>
|
15 |
+
</args>
|
16 |
+
</rfq>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<rfq>
|
21 |
+
<file>rfq.xml</file>
|
22 |
+
</rfq>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<rfq>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>CP_Rfq</module>
|
32 |
+
<frontName>rfq</frontName>
|
33 |
+
</args>
|
34 |
+
</rfq>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<rfq module="rfq">
|
40 |
+
<title>RFQ</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<manage_rfq module="rfq">
|
44 |
+
<title>Manage RFQ</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>rfq/adminhtml_rfq</action>
|
47 |
+
</manage_rfq>
|
48 |
+
<item_config module="rfq">
|
49 |
+
<title>Configuration</title>
|
50 |
+
<sort_order>1</sort_order>
|
51 |
+
<action>adminhtml/system_config/edit/section/rfq</action>
|
52 |
+
</item_config>
|
53 |
+
</children>
|
54 |
+
</rfq>
|
55 |
+
</menu>
|
56 |
+
<acl>
|
57 |
+
<resources>
|
58 |
+
<admin>
|
59 |
+
<children>
|
60 |
+
<rfq module="rfq">
|
61 |
+
<title>RFQ Module</title>
|
62 |
+
<sort_order>10</sort_order>
|
63 |
+
<children>
|
64 |
+
<rfq module="rfq">
|
65 |
+
<title>Manage RFQ</title>
|
66 |
+
</rfq>
|
67 |
+
</children>
|
68 |
+
</rfq>
|
69 |
+
</children>
|
70 |
+
</admin>
|
71 |
+
</resources>
|
72 |
+
</acl>
|
73 |
+
<acl>
|
74 |
+
<resources>
|
75 |
+
<admin>
|
76 |
+
<children>
|
77 |
+
<system>
|
78 |
+
<children>
|
79 |
+
<config>
|
80 |
+
<children>
|
81 |
+
<rfq>
|
82 |
+
<title>RFQ</title> <!-- Used in resources tree -->
|
83 |
+
</rfq>
|
84 |
+
</children>
|
85 |
+
</config>
|
86 |
+
</children>
|
87 |
+
</system>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
<layout>
|
93 |
+
<updates>
|
94 |
+
<rfq>
|
95 |
+
<file>rfq.xml</file>
|
96 |
+
</rfq>
|
97 |
+
</updates>
|
98 |
+
</layout>
|
99 |
+
</adminhtml>
|
100 |
+
<global>
|
101 |
+
<models>
|
102 |
+
<rfq>
|
103 |
+
<class>CP_Rfq_Model</class>
|
104 |
+
<resourceModel>rfq_mysql4</resourceModel>
|
105 |
+
</rfq>
|
106 |
+
<rfq_mysql4>
|
107 |
+
<class>CP_Rfq_Model_Mysql4</class>
|
108 |
+
<entities>
|
109 |
+
<rfq>
|
110 |
+
<table>rfq</table>
|
111 |
+
</rfq>
|
112 |
+
</entities>
|
113 |
+
</rfq_mysql4>
|
114 |
+
</models>
|
115 |
+
<resources>
|
116 |
+
<rfq_setup>
|
117 |
+
<setup>
|
118 |
+
<module>CP_Rfq</module>
|
119 |
+
</setup>
|
120 |
+
<connection>
|
121 |
+
<use>core_setup</use>
|
122 |
+
</connection>
|
123 |
+
</rfq_setup>
|
124 |
+
<rfq_write>
|
125 |
+
<connection>
|
126 |
+
<use>core_write</use>
|
127 |
+
</connection>
|
128 |
+
</rfq_write>
|
129 |
+
<rfq_read>
|
130 |
+
<connection>
|
131 |
+
<use>core_read</use>
|
132 |
+
</connection>
|
133 |
+
</rfq_read>
|
134 |
+
</resources>
|
135 |
+
<template>
|
136 |
+
<email>
|
137 |
+
<rfq_rfq_email_template translate="label" module="rfq">
|
138 |
+
<label>RFQ Question Form</label>
|
139 |
+
<file>rfq_question.html</file>
|
140 |
+
<type>html</type>
|
141 |
+
</rfq_rfq_email_template>
|
142 |
+
<rfq_rfq_email2_template translate="label" module="rfq">
|
143 |
+
<label>RFQ Answer Notification</label>
|
144 |
+
<file>rfq_answer.html</file>
|
145 |
+
<type>html</type>
|
146 |
+
</rfq_rfq_email2_template>
|
147 |
+
</email>
|
148 |
+
</template>
|
149 |
+
<blocks>
|
150 |
+
<rfq>
|
151 |
+
<class>CP_Rfq_Block</class>
|
152 |
+
</rfq>
|
153 |
+
</blocks>
|
154 |
+
<helpers>
|
155 |
+
<rfq>
|
156 |
+
<class>CP_Rfq_Helper</class>
|
157 |
+
</rfq>
|
158 |
+
</helpers>
|
159 |
+
</global>
|
160 |
+
<default>
|
161 |
+
<rfq>
|
162 |
+
<rfq>
|
163 |
+
<enabled>1</enabled>
|
164 |
+
<recipient_email>
|
165 |
+
<![CDATA[hello@example.com]]>
|
166 |
+
</recipient_email>
|
167 |
+
<sender_email_identity>custom2</sender_email_identity>
|
168 |
+
<email_template>rfq_rfq_email_template</email_template>
|
169 |
+
<email_template>rfq_rfq_email2_template</email_template>
|
170 |
+
</rfq>
|
171 |
+
</rfq>
|
172 |
+
</default>
|
173 |
+
</config>
|
app/code/community/CP/Rfq/etc/system.xml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<tabs>
|
3 |
+
<cp translate="label">
|
4 |
+
<label>cp Extensions</label>
|
5 |
+
<sort_order>150</sort_order>
|
6 |
+
</cp>
|
7 |
+
</tabs>
|
8 |
+
<sections>
|
9 |
+
<rfq translate="label" module="rfq">
|
10 |
+
<label>RFQ</label>
|
11 |
+
<tab>cp</tab>
|
12 |
+
<sort_order>10</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
<show_in_website>1</show_in_website>
|
15 |
+
<show_in_store>1</show_in_store>
|
16 |
+
<groups>
|
17 |
+
<rfq translate="label">
|
18 |
+
<label>RFQ</label>
|
19 |
+
<frontend_type>text</frontend_type>
|
20 |
+
<sort_order>3</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<fields>
|
25 |
+
<enabled translate="label">
|
26 |
+
<label>Enabled</label>
|
27 |
+
<frontend_type>select</frontend_type>
|
28 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
29 |
+
<sort_order>1</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<comment>Enable RFQ module</comment>
|
34 |
+
</enabled>
|
35 |
+
<google_site_key translate="label">
|
36 |
+
<label>Google Site key for reCAPTCHA</label>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>2</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<comment>https://www.google.com/recaptcha/admin</comment>
|
43 |
+
</google_site_key>
|
44 |
+
<google_secret_key translate="label">
|
45 |
+
<label>Google Secret key for reCAPTCHA</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>3</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
<comment>https://www.google.com/recaptcha/admin</comment>
|
52 |
+
</google_secret_key>
|
53 |
+
<recipient_email translate="label">
|
54 |
+
<label>Send Emails To</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<validate>validate-email</validate>
|
57 |
+
<sort_order>10</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</recipient_email>
|
62 |
+
<recipient_cc translate="label">
|
63 |
+
<label>Send cc Emails To</label>
|
64 |
+
<frontend_type>text</frontend_type>
|
65 |
+
<sort_order>10</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>1</show_in_store>
|
69 |
+
</recipient_cc>
|
70 |
+
<sender_email_identity translate="label">
|
71 |
+
<label>Email Sender</label>
|
72 |
+
<frontend_type>select</frontend_type>
|
73 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
74 |
+
<sort_order>20</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>1</show_in_store>
|
78 |
+
</sender_email_identity>
|
79 |
+
<email_template translate="label">
|
80 |
+
<label>Email Template</label>
|
81 |
+
<frontend_type>select</frontend_type>
|
82 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
83 |
+
<sort_order>30</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</email_template>
|
88 |
+
<email2_template translate="label">
|
89 |
+
<label>Answer Notification Template</label>
|
90 |
+
<frontend_type>select</frontend_type>
|
91 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
92 |
+
<sort_order>31</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</email2_template>
|
97 |
+
</fields>
|
98 |
+
</rfq>
|
99 |
+
</groups>
|
100 |
+
</rfq>
|
101 |
+
</sections>
|
102 |
+
</config>
|
app/code/community/CP/Rfq/sql/rfq_setup/mysql4-install-1.0.1.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('rfq')};
|
10 |
+
CREATE TABLE {$this->getTable('rfq')} (
|
11 |
+
`rfq_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`name` varchar(255) NOT NULL,
|
13 |
+
`email` varchar(100) NOT NULL,
|
14 |
+
`company_name` varchar(255) NOT NULL,
|
15 |
+
`website_name` varchar(255) NOT NULL,
|
16 |
+
`avg_order` varchar(255) NOT NULL,
|
17 |
+
`phone_number` varchar(255) NOT NULL,
|
18 |
+
`question` text NOT NULL,
|
19 |
+
`answer` text NOT NULL,
|
20 |
+
`cutomer_email_status` smallint(6) NOT NULL DEFAULT '2',
|
21 |
+
`status` smallint(6) NOT NULL DEFAULT '2',
|
22 |
+
`created_time` datetime DEFAULT NULL,
|
23 |
+
`update_time` datetime DEFAULT NULL,
|
24 |
+
PRIMARY KEY (`rfq_id`)
|
25 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
26 |
+
|
27 |
+
");
|
28 |
+
|
29 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/rfq.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<rfq_adminhtml_rfq_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="rfq/adminhtml_rfq" name="rfq" />
|
6 |
+
</reference>
|
7 |
+
</rfq_adminhtml_rfq_index>
|
8 |
+
</layout>
|
app/design/frontend/default/default/layout/rfq.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<rfq_index_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="setTitle" translate="title" module="rfq">
|
6 |
+
<title>Quotation</title>
|
7 |
+
</action>
|
8 |
+
<action method="addJs">
|
9 |
+
<file>mage/captcha.js</file>
|
10 |
+
</action>
|
11 |
+
</reference>
|
12 |
+
<reference name="root">
|
13 |
+
<action method="setTemplate">
|
14 |
+
<template>page/2columns-left.phtml</template>
|
15 |
+
</action>
|
16 |
+
</reference>
|
17 |
+
<reference name="content">
|
18 |
+
<block type="rfq/rfq" name="rfq">
|
19 |
+
<action method="setTemplate" ifconfig="catalog/rfq/enabled">
|
20 |
+
<template>rfq/rfq.phtml</template>
|
21 |
+
</action>
|
22 |
+
<block type="rfq/captcha" name="captcha">
|
23 |
+
<action method="setFormId">
|
24 |
+
<id>form-validate-captcha</id>
|
25 |
+
</action>
|
26 |
+
<action method="setImgWidth">
|
27 |
+
<width>300</width>
|
28 |
+
</action>
|
29 |
+
<action method="setImgHeight">
|
30 |
+
<height>40</height>
|
31 |
+
</action>
|
32 |
+
</block>
|
33 |
+
</block>
|
34 |
+
</reference>
|
35 |
+
</rfq_index_index>
|
36 |
+
</layout>
|
app/design/frontend/default/default/template/rfq/rfq.phtml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_jsUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>
|
2 |
+
<script src='https://www.google.com/recaptcha/api.js'></script>
|
3 |
+
|
4 |
+
<a name="quotation_frm"></a>
|
5 |
+
<div id="popupquestion" class="quotation_from">
|
6 |
+
<?php $data = Mage::getSingleton('core/session')->getRfq(); ?>
|
7 |
+
<h1><?php echo $this->__('Request a Quote and get Estimation in email.');?></h1>
|
8 |
+
<form method="post" action="<?php echo $this->getUrl('rfq/index/post/') ?>" id="rfqform">
|
9 |
+
<ul class="form-list">
|
10 |
+
<li>
|
11 |
+
<div class="field">
|
12 |
+
<label class="required"><em>*</em><?php echo $this->__('Name :')?></label>
|
13 |
+
<div class="input-box">
|
14 |
+
<input name="name" id="name" title="<?php echo Mage::helper('rfq')->__('Name') ?>" value="<?php echo $data['name']; ?>" class="input-text required-entry" type="text" />
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
<div class="field">
|
18 |
+
<label class="required"><em>*</em><?php echo $this->__('Email :')?></label>
|
19 |
+
<div class="input-box">
|
20 |
+
<input name="email" id="email" title="<?php echo Mage::helper('rfq')->__('Email') ?>" value="<?php echo $data['email']; ?>" class="input-text required-entry validate-email" type="text" />
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</li>
|
24 |
+
<li>
|
25 |
+
<div class="field">
|
26 |
+
<label class="required"><em>*</em><?php echo $this->__('Company Name :')?></label>
|
27 |
+
<div class="input-box">
|
28 |
+
<input name="company_name" id="company_name" title="<?php echo Mage::helper('rfq')->__('Company Name') ?>" value="<?php echo $data['company_name']; ?>" class="input-text required-entry" type="text" />
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div class="field">
|
32 |
+
<label class="required"><?php echo $this->__('Website name (Optional) :')?></label>
|
33 |
+
<div class="input-box">
|
34 |
+
<input name="website_name" id="website_name" title="<?php echo Mage::helper('rfq')->__('Website Name') ?>" value="<?php echo $data['website_name']; ?>" class="input-text" type="text" />
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<li>
|
39 |
+
<div class="field">
|
40 |
+
<label class="required"><em>*</em><?php echo $this->__('Average monthly order :')?></label>
|
41 |
+
<div class="input-box">
|
42 |
+
<input name="avg_order" id="avg_order" title="<?php echo Mage::helper('rfq')->__('Average monthly order') ?>" value="<?php echo $data['avg_order']; ?>" class="input-text required-entry" type="text" />
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div class="field">
|
46 |
+
<label class="required"><em>*</em><?php echo $this->__('Phone Number :')?></label>
|
47 |
+
<div class="input-box">
|
48 |
+
<input name="phone_number" id="phone_number" title="<?php echo Mage::helper('rfq')->__('Phone Number') ?>" value="<?php echo $data['phone_number']; ?>" class="input-text required-entry" type="text" />
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</li>
|
52 |
+
<li class="wide">
|
53 |
+
<div class="field">
|
54 |
+
<label class="required"><em>*</em><?php echo $this->__('Comment Regarding Quotation')?> </label>
|
55 |
+
<div class="input-box">
|
56 |
+
<textarea cols="53" rows="3" name="question" id="question" title="<?php echo Mage::helper('rfq')->__('Question') ?>" class="input-text required-entry"><?PHP echo $data['question']; ?></textarea>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
</li>
|
60 |
+
<div class="g-recaptcha float_L" data-sitekey="<?php echo Mage::getStoreConfig('catalog/rfq/google_site_key') ?>"></div>
|
61 |
+
</ul>
|
62 |
+
<div class="buttons-set mrg-none float_L">
|
63 |
+
<button type="submit" title="<?php echo Mage::helper('rfq')->__('Post Question') ?>" class="red-btn"><span><span><?php echo Mage::helper('rfq')->__('Post Question') ?></span></span></button>
|
64 |
+
</div>
|
65 |
+
</form>
|
66 |
+
<script type="text/javascript">
|
67 |
+
//<![CDATA[
|
68 |
+
var rfqform = new VarienForm('rfqform', true);
|
69 |
+
//]]>
|
70 |
+
</script>
|
71 |
+
</div>
|
app/design/frontend/rwd/default/layout/rfq.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<rfq_index_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="setTitle" translate="title" module="rfq">
|
6 |
+
<title>Quotation</title>
|
7 |
+
</action>
|
8 |
+
<action method="addJs">
|
9 |
+
<file>mage/captcha.js</file>
|
10 |
+
</action>
|
11 |
+
</reference>
|
12 |
+
<reference name="root">
|
13 |
+
<action method="setTemplate">
|
14 |
+
<template>page/2columns-left.phtml</template>
|
15 |
+
</action>
|
16 |
+
</reference>
|
17 |
+
<reference name="content">
|
18 |
+
<block type="rfq/rfq" name="rfq">
|
19 |
+
<action method="setTemplate" ifconfig="catalog/rfq/enabled">
|
20 |
+
<template>rfq/rfq.phtml</template>
|
21 |
+
</action>
|
22 |
+
<block type="rfq/captcha" name="captcha">
|
23 |
+
<action method="setFormId">
|
24 |
+
<id>form-validate-captcha</id>
|
25 |
+
</action>
|
26 |
+
<action method="setImgWidth">
|
27 |
+
<width>300</width>
|
28 |
+
</action>
|
29 |
+
<action method="setImgHeight">
|
30 |
+
<height>40</height>
|
31 |
+
</action>
|
32 |
+
</block>
|
33 |
+
</block>
|
34 |
+
</reference>
|
35 |
+
</rfq_index_index>
|
36 |
+
</layout>
|
app/design/frontend/rwd/default/template/rfq/rfq.phtml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_jsUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>
|
2 |
+
<script src='https://www.google.com/recaptcha/api.js'></script>
|
3 |
+
|
4 |
+
<a name="quotation_frm"></a>
|
5 |
+
<div id="popupquestion" class="quotation_from">
|
6 |
+
<?php $data = Mage::getSingleton('core/session')->getRfq(); ?>
|
7 |
+
<h1><?php echo $this->__('Request a Quote and get Estimation in email.');?></h1>
|
8 |
+
<form method="post" action="<?php echo $this->getUrl('rfq/index/post/') ?>" id="rfqform">
|
9 |
+
<ul class="form-list">
|
10 |
+
<li>
|
11 |
+
<div class="field">
|
12 |
+
<label class="required"><em>*</em><?php echo $this->__('Name :')?></label>
|
13 |
+
<div class="input-box">
|
14 |
+
<input name="name" id="name" title="<?php echo Mage::helper('rfq')->__('Name') ?>" value="<?php echo $data['name']; ?>" class="input-text required-entry" type="text" />
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
<div class="field">
|
18 |
+
<label class="required"><em>*</em><?php echo $this->__('Email :')?></label>
|
19 |
+
<div class="input-box">
|
20 |
+
<input name="email" id="email" title="<?php echo Mage::helper('rfq')->__('Email') ?>" value="<?php echo $data['email']; ?>" class="input-text required-entry validate-email" type="text" />
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</li>
|
24 |
+
<li>
|
25 |
+
<div class="field">
|
26 |
+
<label class="required"><em>*</em><?php echo $this->__('Company Name :')?></label>
|
27 |
+
<div class="input-box">
|
28 |
+
<input name="company_name" id="company_name" title="<?php echo Mage::helper('rfq')->__('Company Name') ?>" value="<?php echo $data['company_name']; ?>" class="input-text required-entry" type="text" />
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div class="field">
|
32 |
+
<label class="required"><?php echo $this->__('Website name (Optional) :')?></label>
|
33 |
+
<div class="input-box">
|
34 |
+
<input name="website_name" id="website_name" title="<?php echo Mage::helper('rfq')->__('Website Name') ?>" value="<?php echo $data['website_name']; ?>" class="input-text" type="text" />
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<li>
|
39 |
+
<div class="field">
|
40 |
+
<label class="required"><em>*</em><?php echo $this->__('Average monthly order :')?></label>
|
41 |
+
<div class="input-box">
|
42 |
+
<input name="avg_order" id="avg_order" title="<?php echo Mage::helper('rfq')->__('Average monthly order') ?>" value="<?php echo $data['avg_order']; ?>" class="input-text required-entry" type="text" />
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div class="field">
|
46 |
+
<label class="required"><em>*</em><?php echo $this->__('Phone Number :')?></label>
|
47 |
+
<div class="input-box">
|
48 |
+
<input name="phone_number" id="phone_number" title="<?php echo Mage::helper('rfq')->__('Phone Number') ?>" value="<?php echo $data['phone_number']; ?>" class="input-text required-entry" type="text" />
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</li>
|
52 |
+
<li class="wide">
|
53 |
+
<div class="field">
|
54 |
+
<label class="required"><em>*</em><?php echo $this->__('Comment Regarding Quotation')?> </label>
|
55 |
+
<div class="input-box">
|
56 |
+
<textarea cols="53" rows="3" name="question" id="question" title="<?php echo Mage::helper('rfq')->__('Question') ?>" class="input-text required-entry"><?PHP echo $data['question']; ?></textarea>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
</li>
|
60 |
+
<div class="g-recaptcha float_L" data-sitekey="<?php echo Mage::getStoreConfig('catalog/rfq/google_site_key') ?>"></div>
|
61 |
+
</ul>
|
62 |
+
<div class="buttons-set mrg-none float_L">
|
63 |
+
<button type="submit" title="<?php echo Mage::helper('rfq')->__('Post Question') ?>" class="red-btn"><span><span><?php echo Mage::helper('rfq')->__('Post Question') ?></span></span></button>
|
64 |
+
</div>
|
65 |
+
</form>
|
66 |
+
<script type="text/javascript">
|
67 |
+
//<![CDATA[
|
68 |
+
var rfqform = new VarienForm('rfqform', true);
|
69 |
+
//]]>
|
70 |
+
</script>
|
71 |
+
</div>
|
app/etc/modules/CP_Rfq.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<CP_Rfq>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</CP_Rfq>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/rfq_answer.html
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Quotation Answer@-->
|
2 |
+
<!--@vars
|
3 |
+
{"var data.name":"Sender Name",
|
4 |
+
"var data.email":"Sender Email",
|
5 |
+
"var data.question":"Question"}
|
6 |
+
@-->
|
7 |
+
|
8 |
+
{{template config_path="design/email/header"}}
|
9 |
+
{{inlinecss file="email-inline.css"}}
|
10 |
+
<table cellpadding="0" cellspacing="0" border="0">
|
11 |
+
<tr>
|
12 |
+
<td valign="top" colspan="2"> Dear {{var data.name}},
|
13 |
+
</tr>
|
14 |
+
<tr>
|
15 |
+
<td> </td>
|
16 |
+
</tr>
|
17 |
+
<tr>
|
18 |
+
<td valign="top"> Thank you for your Quotation.</td>
|
19 |
+
</tr>
|
20 |
+
<tr>
|
21 |
+
<td> </td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td valign="top">Your Question: {{var data.question}}</td>
|
25 |
+
</tr>
|
26 |
+
<tr>
|
27 |
+
<td valign="top">Our Answer: {{var data.answer}}</td>
|
28 |
+
</tr>
|
29 |
+
</table>
|
30 |
+
{{template config_path="design/email/footer"}}
|
app/locale/en_US/template/email/rfq_question.html
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Quotation@-->
|
2 |
+
<!--@vars
|
3 |
+
{"var data.name":"Sender Name",
|
4 |
+
"var data.email":"Sender Email",
|
5 |
+
"var data.question":"Question"}
|
6 |
+
@-->
|
7 |
+
|
8 |
+
{{template config_path="design/email/header"}}
|
9 |
+
{{inlinecss file="email-inline.css"}}
|
10 |
+
<table cellpadding="0" cellspacing="0" border="0">
|
11 |
+
<tr>
|
12 |
+
<td valign="top">Name: </td>
|
13 |
+
<td valign="top">{{var data.name}}</td>
|
14 |
+
</tr>
|
15 |
+
<tr>
|
16 |
+
<td valign="top">E-mail: </td>
|
17 |
+
<td valign="top">{{var data.email}}</td>
|
18 |
+
</tr>
|
19 |
+
<tr>
|
20 |
+
<td valign="top">Company Name: </td>
|
21 |
+
<td valign="top">{{var data.company_name}}</td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td valign="top">Website name: </td>
|
25 |
+
<td valign="top">{{var data.website_name}}</td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td valign="top">Average monthly order: </td>
|
29 |
+
<td valign="top">{{var data.avg_order}}</td>
|
30 |
+
</tr>
|
31 |
+
<tr>
|
32 |
+
<td valign="top">Phone Number: </td>
|
33 |
+
<td valign="top">{{var data.phone_number}}</td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td valign="top">Question: </td>
|
37 |
+
<td valign="top">{{var data.question}}</td>
|
38 |
+
</tr>
|
39 |
+
</table>
|
40 |
+
{{template config_path="design/email/footer"}}
|
package.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>CP_Rfq</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Request For Quotation</summary>
|
10 |
+
<description>Request For Quotation extension by Commerce Pundit will help you manage your Quotation.Set up your own beautiful and informative RFQ page easily from admin!.<br />
|
11 |
+

|
12 |
+
<b>Overview</b><br/>
|
13 |
+
Many customer request for quotation prior to purchase.Request For Quotation - Allows User to submit Quotation from front to get answer from admin.Customer can easily post quotation with google captcha security.
|
14 |
+
<br /><br />
|
15 |
+
<br />
|
16 |
+
<b>Features</b>
|
17 |
+
<ul>
|
18 |
+
<li>Managing the Quotation's from admin.</li>
|
19 |
+
<li>Admin Managable answeres for quotation</li>
|
20 |
+
<li>Responsive</li>
|
21 |
+
<li>Easy Installation</li>
|
22 |
+
</ul></description>
|
23 |
+
<notes>Request For Quotation</notes>
|
24 |
+
<authors><author><name>Commerce Pundit</name><user>CPExtensions</user><email>support@commercepundit.com</email></author></authors>
|
25 |
+
<date>2015-11-28</date>
|
26 |
+
<time>04:45:11</time>
|
27 |
+
<contents><target name="magecommunity"><dir name="CP"><dir name="Rfq"><dir name="Block"><dir name="Adminhtml"><dir name="Rfq"><dir name="Edit"><file name="Form.php" hash="ebdd6698e754fde0265b3e79666e3302"/><dir name="Tab"><file name="Form.php" hash="945549ab623a98992f8b9f207fd3319d"/></dir><file name="Tabs.php" hash="f49b8b451a3d5eb5042e69fd1a8e7b08"/></dir><file name="Edit.php" hash="bb1e979f83a996115787176cd3de114f"/><file name="Grid.php" hash="07fabe5fcf03c0595f888ecfad771542"/></dir><file name="Rfq.php" hash="c7269c0744d72e75d44657a329e282c1"/></dir><dir name="Captcha"><file name="Zend.php" hash="38bb2ea5930937a34d76ff00c91fbce3"/></dir><file name="Captcha.php" hash="93b49d2d4c46ce6770175be2a97f3e8d"/><file name="Rfq.php" hash="e3a4015c63cb5d0a93845a7ad70fc11c"/></dir><dir name="Helper"><file name="Data.php" hash="ac427d56824b4e3960f855fe2fd7d910"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Rfq"><file name="Collection.php" hash="1fc8861a8f88414a14a34df95c977f05"/></dir><file name="Rfq.php" hash="301745ebb8761c12963de78a5933332e"/></dir><file name="Rfq.php" hash="48c18ae40823e5cf85451666c1018d7d"/><file name="Status.php" hash="44e426b68e876f45909b4cf459116936"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RfqController.php" hash="b3e78c5cb3d676c2605384d46f5b3669"/></dir><file name="IndexController.php" hash="65700ab14b856f293b1fc7d862206cc1"/></dir><dir name="etc"><file name="config.xml" hash="b98d6cefb7045eedcd8e9377f8a4b1a3"/><file name="system.xml" hash="ca4580ef1ff64e571d847334c97723fd"/></dir><dir name="sql"><dir name="rfq_setup"><file name="mysql4-install-1.0.1.php" hash="e11a89f55ef1639cd3e7c59ec3f8c83b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CP_Rfq.xml" hash="c02eb2940c6470ce59c431590961d894"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rfq.xml" hash="687245ed3372d10122f487e0ec8a747d"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="rfq.xml" hash="0bfc875c826219907cf338998c34b757"/></dir><dir name="template"><dir name="rfq"><file name="rfq.phtml" hash="347da0cca3eebeb6881b8af17785320e"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="rfq.xml" hash="0bfc875c826219907cf338998c34b757"/></dir><dir name="template"><dir name="rfq"><file name="rfq.phtml" hash="347da0cca3eebeb6881b8af17785320e"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="rfq_answer.html" hash="7dfafd71dba388d3584d286f06b23ed8"/><file name="rfq_question.html" hash="432340da825c1a9ae5ff9801c3d22e3f"/></dir></dir></dir></target></contents>
|
28 |
+
<compatible/>
|
29 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
+
</package>
|