Version Notes
First Preview Release
Download this release
Release Info
Developer | NetGo |
Extension | Netgo_Cod |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- User_Manual.pdf +0 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod.php +31 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit.php +71 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Form.php +41 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Tab/Form.php +110 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Tabs.php +63 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Grid.php +206 -0
- app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Helper/File.php +110 -0
- app/code/community/Netgo/Cod/Block/Cod/View.php +26 -0
- app/code/community/Netgo/Cod/Controller/Adminhtml/Cod.php +49 -0
- app/code/community/Netgo/Cod/Helper/Cod.php +51 -0
- app/code/community/Netgo/Cod/Helper/Data.php +43 -0
- app/code/community/Netgo/Cod/Model/Cod.php +105 -0
- app/code/community/Netgo/Cod/Model/Resource/Cod.php +26 -0
- app/code/community/Netgo/Cod/Model/Resource/Cod/Collection.php +73 -0
- app/code/community/Netgo/Cod/Model/Resource/Setup.php +15 -0
- app/code/community/Netgo/Cod/controllers/Adminhtml/Cod/CodController.php +368 -0
- app/code/community/Netgo/Cod/controllers/CodController.php +40 -0
- app/code/community/Netgo/Cod/etc/adminhtml.xml +57 -0
- app/code/community/Netgo/Cod/etc/config.xml +118 -0
- app/code/community/Netgo/Cod/etc/system.xml +79 -0
- app/code/community/Netgo/Cod/sql/netgo_cod_setup/install-1.0.0.php +69 -0
- app/design/adminhtml/default/default/layout/netgo_cod.xml +48 -0
- app/design/frontend/base/default/layout/netgo_cod.xml +35 -0
- app/design/frontend/base/default/template/netgo_cod/cod/cod.phtml +45 -0
- app/design/frontend/base/default/template/netgo_cod/cod/view.phtml +21 -0
- app/etc/modules/Netgo_Cod.xml +25 -0
- import_zipcode_sample.csv +6 -0
- media/cod/img/ajax-loader-2.gif +0 -0
- package.xml +27 -0
- skin/frontend/base/default/css/cod/img/pr-opt-bg.jpg +0 -0
- skin/frontend/base/default/css/cod/img/van-icon.png +0 -0
- skin/frontend/base/default/css/cod/style.css +96 -0
User_Manual.pdf
ADDED
Binary file
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod extends Mage_Adminhtml_Block_Widget_Grid_Container
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* constructor
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @return void
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
$this->_controller = 'adminhtml_cod';
|
25 |
+
$this->_blockGroup = 'netgo_cod';
|
26 |
+
parent::__construct();
|
27 |
+
$this->_headerText = Mage::helper('netgo_cod')->__('COD');
|
28 |
+
$this->_updateButton('add', 'label', Mage::helper('netgo_cod')->__('Add COD'));
|
29 |
+
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* constructor
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @return void
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
parent::__construct();
|
25 |
+
$this->_blockGroup = 'netgo_cod';
|
26 |
+
$this->_controller = 'adminhtml_cod';
|
27 |
+
$this->_updateButton(
|
28 |
+
'save',
|
29 |
+
'label',
|
30 |
+
Mage::helper('netgo_cod')->__('Save COD')
|
31 |
+
);
|
32 |
+
$this->_updateButton(
|
33 |
+
'delete',
|
34 |
+
'label',
|
35 |
+
Mage::helper('netgo_cod')->__('Delete COD')
|
36 |
+
);
|
37 |
+
$this->_addButton(
|
38 |
+
'saveandcontinue',
|
39 |
+
array(
|
40 |
+
'label' => Mage::helper('netgo_cod')->__('Save And Continue Edit'),
|
41 |
+
'onclick' => 'saveAndContinueEdit()',
|
42 |
+
'class' => 'save',
|
43 |
+
),
|
44 |
+
-100
|
45 |
+
);
|
46 |
+
$this->_formScripts[] = "
|
47 |
+
function saveAndContinueEdit() {
|
48 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
49 |
+
}
|
50 |
+
";
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* get the edit form header
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
* @return string
|
58 |
+
* @author NetGo
|
59 |
+
*/
|
60 |
+
public function getHeaderText()
|
61 |
+
{
|
62 |
+
if (Mage::registry('current_cod') && Mage::registry('current_cod')->getId()) {
|
63 |
+
return Mage::helper('netgo_cod')->__(
|
64 |
+
"Edit COD '%s'",
|
65 |
+
$this->escapeHtml(Mage::registry('current_cod')->getZipcode())
|
66 |
+
);
|
67 |
+
} else {
|
68 |
+
return Mage::helper('netgo_cod')->__('Add COD');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Form.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* prepare form
|
17 |
+
*
|
18 |
+
* @access protected
|
19 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Edit_Form
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
protected function _prepareForm()
|
23 |
+
{
|
24 |
+
$form = new Varien_Data_Form(
|
25 |
+
array(
|
26 |
+
'id' => 'edit_form',
|
27 |
+
'action' => $this->getUrl(
|
28 |
+
'*/*/save',
|
29 |
+
array(
|
30 |
+
'id' => $this->getRequest()->getParam('id')
|
31 |
+
)
|
32 |
+
),
|
33 |
+
'method' => 'post',
|
34 |
+
'enctype' => 'multipart/form-data'
|
35 |
+
)
|
36 |
+
);
|
37 |
+
$form->setUseContainer(true);
|
38 |
+
$this->setForm($form);
|
39 |
+
return parent::_prepareForm();
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* prepare the form
|
17 |
+
*
|
18 |
+
* @access protected
|
19 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Edit_Tab_Form
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
protected function _prepareForm()
|
23 |
+
{
|
24 |
+
$form = new Varien_Data_Form();
|
25 |
+
$form->setHtmlIdPrefix('cod_');
|
26 |
+
$form->setFieldNameSuffix('cod');
|
27 |
+
$this->setForm($form);
|
28 |
+
$fieldset = $form->addFieldset(
|
29 |
+
'cod_form',
|
30 |
+
array('legend' => Mage::helper('netgo_cod')->__('COD'))
|
31 |
+
);
|
32 |
+
$fieldset->addType(
|
33 |
+
'file',
|
34 |
+
Mage::getConfig()->getBlockClassName('netgo_cod/adminhtml_cod_helper_file')
|
35 |
+
);
|
36 |
+
|
37 |
+
$item_id = $this->getRequest()->getParam('id');
|
38 |
+
|
39 |
+
if($item_id != ''){
|
40 |
+
$fieldset->addField(
|
41 |
+
'zipcode',
|
42 |
+
'text',
|
43 |
+
array(
|
44 |
+
'label' => Mage::helper('netgo_cod')->__('Zip Code'),
|
45 |
+
'name' => 'zipcode',
|
46 |
+
)
|
47 |
+
);
|
48 |
+
$fieldset->addField(
|
49 |
+
'days',
|
50 |
+
'text',
|
51 |
+
array(
|
52 |
+
'label' => Mage::helper('netgo_cod')->__('Days'),
|
53 |
+
'name' => 'days',
|
54 |
+
)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
if($item_id == ''){
|
58 |
+
$fieldset->addField(
|
59 |
+
'csvfile',
|
60 |
+
'file',
|
61 |
+
array(
|
62 |
+
'label' => Mage::helper('netgo_cod')->__('File'),
|
63 |
+
'name' => 'csvfile',
|
64 |
+
)
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
if($item_id != ''){
|
69 |
+
$fieldset->addField(
|
70 |
+
'status',
|
71 |
+
'select',
|
72 |
+
array(
|
73 |
+
'label' => Mage::helper('netgo_cod')->__('Status'),
|
74 |
+
'name' => 'status',
|
75 |
+
'values' => array(
|
76 |
+
array(
|
77 |
+
'value' => 1,
|
78 |
+
'label' => Mage::helper('netgo_cod')->__('Enabled'),
|
79 |
+
),
|
80 |
+
array(
|
81 |
+
'value' => 0,
|
82 |
+
'label' => Mage::helper('netgo_cod')->__('Disabled'),
|
83 |
+
),
|
84 |
+
),
|
85 |
+
)
|
86 |
+
);
|
87 |
+
}else{
|
88 |
+
$fieldset->addField(
|
89 |
+
'days',
|
90 |
+
'hidden',
|
91 |
+
array(
|
92 |
+
'label' => Mage::helper('netgo_cod')->__('Days'),
|
93 |
+
'name' => 'status',
|
94 |
+
)
|
95 |
+
);
|
96 |
+
}
|
97 |
+
$formValues = Mage::registry('current_cod')->getDefaultValues();
|
98 |
+
if (!is_array($formValues)) {
|
99 |
+
$formValues = array();
|
100 |
+
}
|
101 |
+
if (Mage::getSingleton('adminhtml/session')->getCodData()) {
|
102 |
+
$formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getCodData());
|
103 |
+
Mage::getSingleton('adminhtml/session')->setCodData(null);
|
104 |
+
} elseif (Mage::registry('current_cod')) {
|
105 |
+
$formValues = array_merge($formValues, Mage::registry('current_cod')->getData());
|
106 |
+
}
|
107 |
+
$form->setValues($formValues);
|
108 |
+
return parent::_prepareForm();
|
109 |
+
}
|
110 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Edit/Tabs.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Initialize Tabs
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @author NetGo
|
20 |
+
*/
|
21 |
+
public function __construct()
|
22 |
+
{
|
23 |
+
parent::__construct();
|
24 |
+
$this->setId('cod_tabs');
|
25 |
+
$this->setDestElementId('edit_form');
|
26 |
+
$this->setTitle(Mage::helper('netgo_cod')->__('COD'));
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* before render html
|
31 |
+
*
|
32 |
+
* @access protected
|
33 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Edit_Tabs
|
34 |
+
* @author NetGo
|
35 |
+
*/
|
36 |
+
protected function _beforeToHtml()
|
37 |
+
{
|
38 |
+
$this->addTab(
|
39 |
+
'form_cod',
|
40 |
+
array(
|
41 |
+
'label' => Mage::helper('netgo_cod')->__('COD'),
|
42 |
+
'title' => Mage::helper('netgo_cod')->__('COD'),
|
43 |
+
'content' => $this->getLayout()->createBlock(
|
44 |
+
'netgo_cod/adminhtml_cod_edit_tab_form'
|
45 |
+
)
|
46 |
+
->toHtml(),
|
47 |
+
)
|
48 |
+
);
|
49 |
+
return parent::_beforeToHtml();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Retrieve cod entity
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return Netgo_Cod_Model_Cod
|
57 |
+
* @author NetGo
|
58 |
+
*/
|
59 |
+
public function getCod()
|
60 |
+
{
|
61 |
+
return Mage::registry('current_cod');
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Grid.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* constructor
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @author NetGo
|
20 |
+
*/
|
21 |
+
public function __construct()
|
22 |
+
{
|
23 |
+
parent::__construct();
|
24 |
+
$this->setId('codGrid');
|
25 |
+
$this->setDefaultSort('entity_id');
|
26 |
+
$this->setDefaultDir('ASC');
|
27 |
+
$this->setSaveParametersInSession(true);
|
28 |
+
$this->setUseAjax(true);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* prepare collection
|
33 |
+
*
|
34 |
+
* @access protected
|
35 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Grid
|
36 |
+
* @author NetGo
|
37 |
+
*/
|
38 |
+
protected function _prepareCollection()
|
39 |
+
{
|
40 |
+
$collection = Mage::getModel('netgo_cod/cod')
|
41 |
+
->getCollection();
|
42 |
+
|
43 |
+
$this->setCollection($collection);
|
44 |
+
return parent::_prepareCollection();
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* prepare grid collection
|
49 |
+
*
|
50 |
+
* @access protected
|
51 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Grid
|
52 |
+
* @author NetGo
|
53 |
+
*/
|
54 |
+
protected function _prepareColumns()
|
55 |
+
{
|
56 |
+
$this->addColumn(
|
57 |
+
'entity_id',
|
58 |
+
array(
|
59 |
+
'header' => Mage::helper('netgo_cod')->__('Id'),
|
60 |
+
'index' => 'entity_id',
|
61 |
+
'type' => 'number'
|
62 |
+
)
|
63 |
+
);
|
64 |
+
$this->addColumn(
|
65 |
+
'zipcode',
|
66 |
+
array(
|
67 |
+
'header' => Mage::helper('netgo_cod')->__('Zip Code'),
|
68 |
+
'align' => 'left',
|
69 |
+
'index' => 'zipcode',
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->addColumn(
|
74 |
+
'status',
|
75 |
+
array(
|
76 |
+
'header' => Mage::helper('netgo_cod')->__('Status'),
|
77 |
+
'index' => 'status',
|
78 |
+
'type' => 'options',
|
79 |
+
'options' => array(
|
80 |
+
'1' => Mage::helper('netgo_cod')->__('Enabled'),
|
81 |
+
'0' => Mage::helper('netgo_cod')->__('Disabled'),
|
82 |
+
)
|
83 |
+
)
|
84 |
+
);
|
85 |
+
$this->addColumn(
|
86 |
+
'days',
|
87 |
+
array(
|
88 |
+
'header' => Mage::helper('netgo_cod')->__('Days'),
|
89 |
+
'index' => 'days',
|
90 |
+
'type'=> 'text',
|
91 |
+
|
92 |
+
)
|
93 |
+
);
|
94 |
+
$this->addColumn(
|
95 |
+
'created_at',
|
96 |
+
array(
|
97 |
+
'header' => Mage::helper('netgo_cod')->__('Created at'),
|
98 |
+
'index' => 'created_at',
|
99 |
+
'width' => '120px',
|
100 |
+
'type' => 'datetime',
|
101 |
+
)
|
102 |
+
);
|
103 |
+
$this->addColumn(
|
104 |
+
'action',
|
105 |
+
array(
|
106 |
+
'header' => Mage::helper('netgo_cod')->__('Action'),
|
107 |
+
'width' => '100',
|
108 |
+
'type' => 'action',
|
109 |
+
'getter' => 'getId',
|
110 |
+
'actions' => array(
|
111 |
+
array(
|
112 |
+
'caption' => Mage::helper('netgo_cod')->__('Edit'),
|
113 |
+
'url' => array('base'=> '*/*/edit'),
|
114 |
+
'field' => 'id'
|
115 |
+
)
|
116 |
+
),
|
117 |
+
'filter' => false,
|
118 |
+
'is_system' => true,
|
119 |
+
'sortable' => false,
|
120 |
+
)
|
121 |
+
);
|
122 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('netgo_cod')->__('CSV'));
|
123 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('netgo_cod')->__('Excel'));
|
124 |
+
$this->addExportType('*/*/exportXml', Mage::helper('netgo_cod')->__('XML'));
|
125 |
+
return parent::_prepareColumns();
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* prepare mass action
|
130 |
+
*
|
131 |
+
* @access protected
|
132 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Grid
|
133 |
+
* @author NetGo
|
134 |
+
*/
|
135 |
+
protected function _prepareMassaction()
|
136 |
+
{
|
137 |
+
$this->setMassactionIdField('entity_id');
|
138 |
+
$this->getMassactionBlock()->setFormFieldName('cod');
|
139 |
+
$this->getMassactionBlock()->addItem(
|
140 |
+
'delete',
|
141 |
+
array(
|
142 |
+
'label'=> Mage::helper('netgo_cod')->__('Delete'),
|
143 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
144 |
+
'confirm' => Mage::helper('netgo_cod')->__('Are you sure?')
|
145 |
+
)
|
146 |
+
);
|
147 |
+
$this->getMassactionBlock()->addItem(
|
148 |
+
'status',
|
149 |
+
array(
|
150 |
+
'label' => Mage::helper('netgo_cod')->__('Change status'),
|
151 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
152 |
+
'additional' => array(
|
153 |
+
'status' => array(
|
154 |
+
'name' => 'status',
|
155 |
+
'type' => 'select',
|
156 |
+
'class' => 'required-entry',
|
157 |
+
'label' => Mage::helper('netgo_cod')->__('Status'),
|
158 |
+
'values' => array(
|
159 |
+
'1' => Mage::helper('netgo_cod')->__('Enabled'),
|
160 |
+
'0' => Mage::helper('netgo_cod')->__('Disabled'),
|
161 |
+
)
|
162 |
+
)
|
163 |
+
)
|
164 |
+
)
|
165 |
+
);
|
166 |
+
return $this;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* get the row url
|
171 |
+
*
|
172 |
+
* @access public
|
173 |
+
* @param Netgo_Cod_Model_Cod
|
174 |
+
* @return string
|
175 |
+
* @author NetGo
|
176 |
+
*/
|
177 |
+
public function getRowUrl($row)
|
178 |
+
{
|
179 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* get the grid url
|
184 |
+
*
|
185 |
+
* @access public
|
186 |
+
* @return string
|
187 |
+
* @author NetGo
|
188 |
+
*/
|
189 |
+
public function getGridUrl()
|
190 |
+
{
|
191 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* after collection load
|
196 |
+
*
|
197 |
+
* @access protected
|
198 |
+
* @return Netgo_Cod_Block_Adminhtml_Cod_Grid
|
199 |
+
* @author NetGo
|
200 |
+
*/
|
201 |
+
protected function _afterLoadCollection()
|
202 |
+
{
|
203 |
+
$this->getCollection()->walk('afterLoad');
|
204 |
+
parent::_afterLoadCollection();
|
205 |
+
}
|
206 |
+
}
|
app/code/community/Netgo/Cod/Block/Adminhtml/Cod/Helper/File.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Adminhtml_Cod_Helper_File extends Varien_Data_Form_Element_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* constructor
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @param array $data
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function __construct($data)
|
23 |
+
{
|
24 |
+
parent::__construct($data);
|
25 |
+
$this->setType('file');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* get element html
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @return string
|
33 |
+
* @author NetGo
|
34 |
+
*/
|
35 |
+
public function getElementHtml()
|
36 |
+
{
|
37 |
+
$html = '';
|
38 |
+
$this->addClass('input-file');
|
39 |
+
$html .= parent::getElementHtml();
|
40 |
+
if ($this->getValue()) {
|
41 |
+
$url = $this->_getUrl();
|
42 |
+
if (!preg_match("/^http\:\/\/|https\:\/\//", $url)) {
|
43 |
+
$url = Mage::helper('netgo_cod/cod')->getFileBaseUrl() . $url;
|
44 |
+
}
|
45 |
+
$html .= '<br /><a href="'.$url.'">'.$this->_getUrl().'</a> ';
|
46 |
+
}
|
47 |
+
$html .= $this->_getDeleteCheckbox();
|
48 |
+
return $html;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* get the delete checkbox HTML
|
53 |
+
*
|
54 |
+
* @access protected
|
55 |
+
* @return string
|
56 |
+
* @author NetGo
|
57 |
+
*/
|
58 |
+
protected function _getDeleteCheckbox()
|
59 |
+
{
|
60 |
+
$html = '';
|
61 |
+
if ($this->getValue()) {
|
62 |
+
$label = Mage::helper('netgo_cod')->__('Delete File');
|
63 |
+
$html .= '<span class="delete-image">';
|
64 |
+
$html .= '<input type="checkbox" name="'.
|
65 |
+
parent::getName().'[delete]" value="1" class="checkbox" id="'.
|
66 |
+
$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' disabled="disabled"': '').'/>';
|
67 |
+
$html .= '<label for="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' class="disabled"' : '').'>';
|
68 |
+
$html .= $label.'</label>';
|
69 |
+
$html .= $this->_getHiddenInput();
|
70 |
+
$html .= '</span>';
|
71 |
+
}
|
72 |
+
return $html;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* get the hidden input
|
77 |
+
*
|
78 |
+
* @access protected
|
79 |
+
* @return string
|
80 |
+
* @author NetGo
|
81 |
+
*/
|
82 |
+
protected function _getHiddenInput()
|
83 |
+
{
|
84 |
+
return '<input type="hidden" name="'.parent::getName().'[value]" value="'.$this->getValue().'" />';
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* get the file url
|
89 |
+
*
|
90 |
+
* @access protected
|
91 |
+
* @return string
|
92 |
+
* @author NetGo
|
93 |
+
*/
|
94 |
+
protected function _getUrl()
|
95 |
+
{
|
96 |
+
return $this->getValue();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* get the name
|
101 |
+
*
|
102 |
+
* @access public
|
103 |
+
* @return string
|
104 |
+
* @author NetGo
|
105 |
+
*/
|
106 |
+
public function getName()
|
107 |
+
{
|
108 |
+
return $this->getData('name');
|
109 |
+
}
|
110 |
+
}
|
app/code/community/Netgo/Cod/Block/Cod/View.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Block_Cod_View extends Mage_Core_Block_Template
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* get the current cod
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @return mixed (Netgo_Cod_Model_Cod|null)
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function getCurrentCod()
|
23 |
+
{
|
24 |
+
return Mage::registry('current_cod');
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Netgo/Cod/Controller/Adminhtml/Cod.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Controller_Adminhtml_Cod extends Mage_Adminhtml_Controller_Action
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* upload file and get the uploaded name
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @param string $input
|
20 |
+
* @param string $destinationFolder
|
21 |
+
* @param array $data
|
22 |
+
* @return string
|
23 |
+
* @author NetGo
|
24 |
+
*/
|
25 |
+
protected function _uploadAndGetName($input, $destinationFolder, $data)
|
26 |
+
{
|
27 |
+
try {
|
28 |
+
if (isset($data[$input]['delete'])) {
|
29 |
+
return '';
|
30 |
+
} else {
|
31 |
+
$uploader = new Varien_File_Uploader($input);
|
32 |
+
$uploader->setAllowRenameFiles(false);
|
33 |
+
$uploader->setFilesDispersion(false);
|
34 |
+
$uploader->setAllowCreateFolders(true);
|
35 |
+
$result = $uploader->save($destinationFolder);
|
36 |
+
return $result['file'];
|
37 |
+
}
|
38 |
+
} catch (Exception $e) {
|
39 |
+
if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
|
40 |
+
throw $e;
|
41 |
+
} else {
|
42 |
+
if (isset($data[$input]['value'])) {
|
43 |
+
return $data[$input]['value'];
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
return '';
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Netgo/Cod/Helper/Cod.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Helper_Cod extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* check if breadcrumbs can be used
|
18 |
+
*
|
19 |
+
* @access public
|
20 |
+
* @return bool
|
21 |
+
* @author NetGo
|
22 |
+
*/
|
23 |
+
public function getUseBreadcrumbs()
|
24 |
+
{
|
25 |
+
return Mage::getStoreConfigFlag('netgo_cod/cod/breadcrumbs');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* get base files dir
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @return string
|
33 |
+
* @author NetGo
|
34 |
+
*/
|
35 |
+
public function getFileBaseDir()
|
36 |
+
{
|
37 |
+
return Mage::getBaseDir('media').DS.'cod'.DS.'file';
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* get base file url
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return string
|
45 |
+
* @author NetGo
|
46 |
+
*/
|
47 |
+
public function getFileBaseUrl()
|
48 |
+
{
|
49 |
+
return Mage::getBaseUrl('media').'cod'.'/'.'file';
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Netgo/Cod/Helper/Data.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Helper_Data extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* convert array to options
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @param $options
|
20 |
+
* @return array
|
21 |
+
* @author NetGo
|
22 |
+
*/
|
23 |
+
public function convertOptions($options)
|
24 |
+
{
|
25 |
+
$converted = array();
|
26 |
+
foreach ($options as $option) {
|
27 |
+
if (isset($option['value']) && !is_array($option['value']) &&
|
28 |
+
isset($option['label']) && !is_array($option['label'])) {
|
29 |
+
$converted[$option['value']] = $option['label'];
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $converted;
|
33 |
+
}
|
34 |
+
public function getConfigData()
|
35 |
+
{
|
36 |
+
$configData = array();
|
37 |
+
$configData['zip_status'] = Mage::getStoreConfig('netgo_cod/cod/zip_status');
|
38 |
+
$configData['suc_msg'] = Mage::getStoreConfig('netgo_cod/cod/suc_msg');
|
39 |
+
$configData['err_msg'] = Mage::getStoreConfig('netgo_cod/cod/err_msg');
|
40 |
+
$configData['emp_msg'] = Mage::getStoreConfig('netgo_cod/cod/emp_msg');
|
41 |
+
return $configData;
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Netgo/Cod/Model/Cod.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Model_Cod extends Mage_Core_Model_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Entity code.
|
17 |
+
* Can be used as part of method name for entity processing
|
18 |
+
*/
|
19 |
+
const ENTITY = 'netgo_cod_cod';
|
20 |
+
const CACHE_TAG = 'netgo_cod_cod';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Prefix of model events names
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
protected $_eventPrefix = 'netgo_cod_cod';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Parameter name in event
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
protected $_eventObject = 'cod';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* constructor
|
38 |
+
*
|
39 |
+
* @access public
|
40 |
+
* @return void
|
41 |
+
* @author NetGo
|
42 |
+
*/
|
43 |
+
public function _construct()
|
44 |
+
{
|
45 |
+
parent::_construct();
|
46 |
+
$this->_init('netgo_cod/cod');
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* before save cod
|
51 |
+
*
|
52 |
+
* @access protected
|
53 |
+
* @return Netgo_Cod_Model_Cod
|
54 |
+
* @author NetGo
|
55 |
+
*/
|
56 |
+
protected function _beforeSave()
|
57 |
+
{
|
58 |
+
parent::_beforeSave();
|
59 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
60 |
+
if ($this->isObjectNew()) {
|
61 |
+
$this->setCreatedAt($now);
|
62 |
+
}
|
63 |
+
$this->setUpdatedAt($now);
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* get the url to the cod details page
|
69 |
+
*
|
70 |
+
* @access public
|
71 |
+
* @return string
|
72 |
+
* @author NetGo
|
73 |
+
*/
|
74 |
+
public function getCodUrl()
|
75 |
+
{
|
76 |
+
return Mage::getUrl('netgo_cod/cod/view', array('id'=>$this->getId()));
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* save cod relation
|
81 |
+
*
|
82 |
+
* @access public
|
83 |
+
* @return Netgo_Cod_Model_Cod
|
84 |
+
* @author NetGo
|
85 |
+
*/
|
86 |
+
protected function _afterSave()
|
87 |
+
{
|
88 |
+
return parent::_afterSave();
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* get default values
|
93 |
+
*
|
94 |
+
* @access public
|
95 |
+
* @return array
|
96 |
+
* @author NetGo
|
97 |
+
*/
|
98 |
+
public function getDefaultValues()
|
99 |
+
{
|
100 |
+
$values = array();
|
101 |
+
$values['status'] = 1;
|
102 |
+
return $values;
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
app/code/community/Netgo/Cod/Model/Resource/Cod.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Model_Resource_Cod extends Mage_Core_Model_Resource_Db_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* constructor
|
18 |
+
*
|
19 |
+
* @access public
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function _construct()
|
23 |
+
{
|
24 |
+
$this->_init('netgo_cod/cod', 'entity_id');
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Netgo/Cod/Model/Resource/Cod/Collection.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Model_Resource_Cod_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
14 |
+
{
|
15 |
+
protected $_joinedFields = array();
|
16 |
+
|
17 |
+
/**
|
18 |
+
* constructor
|
19 |
+
*
|
20 |
+
* @access public
|
21 |
+
* @return void
|
22 |
+
* @author NetGo
|
23 |
+
*/
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
parent::_construct();
|
27 |
+
$this->_init('netgo_cod/cod');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* get cods as array
|
32 |
+
*
|
33 |
+
* @access protected
|
34 |
+
* @param string $valueField
|
35 |
+
* @param string $labelField
|
36 |
+
* @param array $additional
|
37 |
+
* @return array
|
38 |
+
* @author NetGo
|
39 |
+
*/
|
40 |
+
protected function _toOptionArray($valueField='entity_id', $labelField='zipcode', $additional=array())
|
41 |
+
{
|
42 |
+
return parent::_toOptionArray($valueField, $labelField, $additional);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* get options hash
|
47 |
+
*
|
48 |
+
* @access protected
|
49 |
+
* @param string $valueField
|
50 |
+
* @param string $labelField
|
51 |
+
* @return array
|
52 |
+
* @author NetGo
|
53 |
+
*/
|
54 |
+
protected function _toOptionHash($valueField='entity_id', $labelField='zipcode')
|
55 |
+
{
|
56 |
+
return parent::_toOptionHash($valueField, $labelField);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get SQL for get record count.
|
61 |
+
* Extra GROUP BY strip added.
|
62 |
+
*
|
63 |
+
* @access public
|
64 |
+
* @return Varien_Db_Select
|
65 |
+
* @author NetGo
|
66 |
+
*/
|
67 |
+
public function getSelectCountSql()
|
68 |
+
{
|
69 |
+
$countSelect = parent::getSelectCountSql();
|
70 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
71 |
+
return $countSelect;
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Netgo/Cod/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
|
14 |
+
{
|
15 |
+
}
|
app/code/community/Netgo/Cod/controllers/Adminhtml/Cod/CodController.php
ADDED
@@ -0,0 +1,368 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_Adminhtml_Cod_CodController extends Netgo_Cod_Controller_Adminhtml_Cod
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* init the cod
|
17 |
+
*
|
18 |
+
* @access protected
|
19 |
+
* @return Netgo_Cod_Model_Cod
|
20 |
+
*/
|
21 |
+
protected function _initCod()
|
22 |
+
{
|
23 |
+
$codId = (int) $this->getRequest()->getParam('id');
|
24 |
+
$cod = Mage::getModel('netgo_cod/cod');
|
25 |
+
if ($codId) {
|
26 |
+
$cod->load($codId);
|
27 |
+
}
|
28 |
+
Mage::register('current_cod', $cod);
|
29 |
+
return $cod;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* default action
|
34 |
+
*
|
35 |
+
* @access public
|
36 |
+
* @return void
|
37 |
+
* @author NetGo
|
38 |
+
*/
|
39 |
+
public function indexAction()
|
40 |
+
{
|
41 |
+
$this->loadLayout();
|
42 |
+
$this->_title(Mage::helper('netgo_cod')->__('Manage COD'))
|
43 |
+
->_title(Mage::helper('netgo_cod')->__('CODS'));
|
44 |
+
$this->renderLayout();
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* grid action
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @return void
|
52 |
+
* @author NetGo
|
53 |
+
*/
|
54 |
+
public function gridAction()
|
55 |
+
{
|
56 |
+
$this->loadLayout()->renderLayout();
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* edit cod - action
|
61 |
+
*
|
62 |
+
* @access public
|
63 |
+
* @return void
|
64 |
+
* @author NetGo
|
65 |
+
*/
|
66 |
+
public function editAction()
|
67 |
+
{
|
68 |
+
$codId = $this->getRequest()->getParam('id');
|
69 |
+
$cod = $this->_initCod();
|
70 |
+
if ($codId && !$cod->getId()) {
|
71 |
+
$this->_getSession()->addError(
|
72 |
+
Mage::helper('netgo_cod')->__('This cod no longer exists.')
|
73 |
+
);
|
74 |
+
$this->_redirect('*/*/');
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
$data = Mage::getSingleton('adminhtml/session')->getCodData(true);
|
78 |
+
if (!empty($data)) {
|
79 |
+
$cod->setData($data);
|
80 |
+
}
|
81 |
+
Mage::register('cod_data', $cod);
|
82 |
+
$this->loadLayout();
|
83 |
+
$this->_title(Mage::helper('netgo_cod')->__('Manage COD'))
|
84 |
+
->_title(Mage::helper('netgo_cod')->__('CODS'));
|
85 |
+
if ($cod->getId()) {
|
86 |
+
$this->_title($cod->getZipcode());
|
87 |
+
} else {
|
88 |
+
$this->_title(Mage::helper('netgo_cod')->__('Add cod'));
|
89 |
+
}
|
90 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
91 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
92 |
+
}
|
93 |
+
$this->renderLayout();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* new cod action
|
98 |
+
*
|
99 |
+
* @access public
|
100 |
+
* @return void
|
101 |
+
* @author NetGo
|
102 |
+
*/
|
103 |
+
public function newAction()
|
104 |
+
{
|
105 |
+
$this->_forward('edit');
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* save cod - action
|
110 |
+
*
|
111 |
+
* @access public
|
112 |
+
* @return void
|
113 |
+
* @author NetGo
|
114 |
+
*/
|
115 |
+
public function saveAction()
|
116 |
+
{
|
117 |
+
if ($data = $this->getRequest()->getPost('cod')) {
|
118 |
+
try {
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
$cod = $this->_initCod();
|
123 |
+
$cod->addData($data);
|
124 |
+
$csvfileName = $this->_uploadAndGetName(
|
125 |
+
'csvfile',
|
126 |
+
Mage::helper('netgo_cod/cod')->getFileBaseDir(),
|
127 |
+
$data
|
128 |
+
);
|
129 |
+
//$cod->setData('csvfile', $csvfileName);
|
130 |
+
|
131 |
+
$file_handle = fopen(Mage::getBaseDir('media') . DS . 'cod' . DS . 'file' . DS . $csvfileName, "r");
|
132 |
+
|
133 |
+
while (!feof($file_handle) ) {
|
134 |
+
$row = fgetcsv($file_handle, 1024);
|
135 |
+
|
136 |
+
if($row[0] != 'zipcode'){
|
137 |
+
$codObj = Mage::getModel('netgo_cod/cod')->getCollection()->addFieldToFilter('zipcode', $row[0]);
|
138 |
+
$codData = $codObj->getData();
|
139 |
+
|
140 |
+
$codObject = Mage::getModel('netgo_cod/cod');
|
141 |
+
if(count($codObj->getData()) > 0){
|
142 |
+
$codObject->setEntityId($codData[0]['entity_id']);
|
143 |
+
$codObject->setZipcode($row[0]);
|
144 |
+
$codObject->setStatus($row[1]);
|
145 |
+
$codObject->setDays($row[2]);
|
146 |
+
|
147 |
+
$codObject->save();
|
148 |
+
}else{
|
149 |
+
if($row[0] != ''){
|
150 |
+
$codObject->setZipcode($row[0]);
|
151 |
+
$codObject->setStatus($row[1]);
|
152 |
+
$codObject->setDays($row[2]);
|
153 |
+
$codObject->save();
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
//print_r($data);die;
|
159 |
+
fclose($file_handle);
|
160 |
+
if($data['zipcode'] != ''){
|
161 |
+
$cod->save();
|
162 |
+
}
|
163 |
+
//$cod->save();
|
164 |
+
//return;
|
165 |
+
|
166 |
+
|
167 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
168 |
+
Mage::helper('netgo_cod')->__('COD was successfully saved')
|
169 |
+
);
|
170 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
171 |
+
if ($this->getRequest()->getParam('back')) {
|
172 |
+
$this->_redirect('*/*/edit', array('id' => $cod->getId()));
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
$this->_redirect('*/*/');
|
176 |
+
return;
|
177 |
+
} catch (Mage_Core_Exception $e) {
|
178 |
+
if (isset($data['csvfile']['value'])) {
|
179 |
+
$data['csvfile'] = $data['csvfile']['value'];
|
180 |
+
}
|
181 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
182 |
+
Mage::getSingleton('adminhtml/session')->setCodData($data);
|
183 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
184 |
+
return;
|
185 |
+
} catch (Exception $e) {
|
186 |
+
Mage::logException($e);
|
187 |
+
if (isset($data['csvfile']['value'])) {
|
188 |
+
$data['csvfile'] = $data['csvfile']['value'];
|
189 |
+
}
|
190 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
191 |
+
Mage::helper('netgo_cod')->__('There was a problem saving the cod.')
|
192 |
+
);
|
193 |
+
Mage::getSingleton('adminhtml/session')->setCodData($data);
|
194 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
199 |
+
Mage::helper('netgo_cod')->__('Unable to find cod to save.')
|
200 |
+
);
|
201 |
+
$this->_redirect('*/*/');
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* delete cod - action
|
206 |
+
*
|
207 |
+
* @access public
|
208 |
+
* @return void
|
209 |
+
* @author NetGo
|
210 |
+
*/
|
211 |
+
public function deleteAction()
|
212 |
+
{
|
213 |
+
if ( $this->getRequest()->getParam('id') > 0) {
|
214 |
+
try {
|
215 |
+
$cod = Mage::getModel('netgo_cod/cod');
|
216 |
+
$cod->setId($this->getRequest()->getParam('id'))->delete();
|
217 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
218 |
+
Mage::helper('netgo_cod')->__('COD was successfully deleted.')
|
219 |
+
);
|
220 |
+
$this->_redirect('*/*/');
|
221 |
+
return;
|
222 |
+
} catch (Mage_Core_Exception $e) {
|
223 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
224 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
225 |
+
} catch (Exception $e) {
|
226 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
227 |
+
Mage::helper('netgo_cod')->__('There was an error deleting cod.')
|
228 |
+
);
|
229 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
230 |
+
Mage::logException($e);
|
231 |
+
return;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
235 |
+
Mage::helper('netgo_cod')->__('Could not find cod to delete.')
|
236 |
+
);
|
237 |
+
$this->_redirect('*/*/');
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* mass delete cod - action
|
242 |
+
*
|
243 |
+
* @access public
|
244 |
+
* @return void
|
245 |
+
* @author NetGo
|
246 |
+
*/
|
247 |
+
public function massDeleteAction()
|
248 |
+
{
|
249 |
+
$codIds = $this->getRequest()->getParam('cod');
|
250 |
+
if (!is_array($codIds)) {
|
251 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
252 |
+
Mage::helper('netgo_cod')->__('Please select cods to delete.')
|
253 |
+
);
|
254 |
+
} else {
|
255 |
+
try {
|
256 |
+
foreach ($codIds as $codId) {
|
257 |
+
$cod = Mage::getModel('netgo_cod/cod');
|
258 |
+
$cod->setId($codId)->delete();
|
259 |
+
}
|
260 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
261 |
+
Mage::helper('netgo_cod')->__('Total of %d cods were successfully deleted.', count($codIds))
|
262 |
+
);
|
263 |
+
} catch (Mage_Core_Exception $e) {
|
264 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
265 |
+
} catch (Exception $e) {
|
266 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
267 |
+
Mage::helper('netgo_cod')->__('There was an error deleting cods.')
|
268 |
+
);
|
269 |
+
Mage::logException($e);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
$this->_redirect('*/*/index');
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* mass status change - action
|
277 |
+
*
|
278 |
+
* @access public
|
279 |
+
* @return void
|
280 |
+
* @author NetGo
|
281 |
+
*/
|
282 |
+
public function massStatusAction()
|
283 |
+
{
|
284 |
+
$codIds = $this->getRequest()->getParam('cod');
|
285 |
+
if (!is_array($codIds)) {
|
286 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
287 |
+
Mage::helper('netgo_cod')->__('Please select cods.')
|
288 |
+
);
|
289 |
+
} else {
|
290 |
+
try {
|
291 |
+
foreach ($codIds as $codId) {
|
292 |
+
$cod = Mage::getSingleton('netgo_cod/cod')->load($codId)
|
293 |
+
->setStatus($this->getRequest()->getParam('status'))
|
294 |
+
->setIsMassupdate(true)
|
295 |
+
->save();
|
296 |
+
}
|
297 |
+
$this->_getSession()->addSuccess(
|
298 |
+
$this->__('Total of %d cods were successfully updated.', count($codIds))
|
299 |
+
);
|
300 |
+
} catch (Mage_Core_Exception $e) {
|
301 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
302 |
+
} catch (Exception $e) {
|
303 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
304 |
+
Mage::helper('netgo_cod')->__('There was an error updating cods.')
|
305 |
+
);
|
306 |
+
Mage::logException($e);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
$this->_redirect('*/*/index');
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* export as csv - action
|
314 |
+
*
|
315 |
+
* @access public
|
316 |
+
* @return void
|
317 |
+
* @author NetGo
|
318 |
+
*/
|
319 |
+
public function exportCsvAction()
|
320 |
+
{
|
321 |
+
$fileName = 'cod.csv';
|
322 |
+
$content = $this->getLayout()->createBlock('netgo_cod/adminhtml_cod_grid')
|
323 |
+
->getCsv();
|
324 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* export as MsExcel - action
|
329 |
+
*
|
330 |
+
* @access public
|
331 |
+
* @return void
|
332 |
+
* @author NetGo
|
333 |
+
*/
|
334 |
+
public function exportExcelAction()
|
335 |
+
{
|
336 |
+
$fileName = 'cod.xls';
|
337 |
+
$content = $this->getLayout()->createBlock('netgo_cod/adminhtml_cod_grid')
|
338 |
+
->getExcelFile();
|
339 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* export as xml - action
|
344 |
+
*
|
345 |
+
* @access public
|
346 |
+
* @return void
|
347 |
+
* @author NetGo
|
348 |
+
*/
|
349 |
+
public function exportXmlAction()
|
350 |
+
{
|
351 |
+
$fileName = 'cod.xml';
|
352 |
+
$content = $this->getLayout()->createBlock('netgo_cod/adminhtml_cod_grid')
|
353 |
+
->getXml();
|
354 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Check if admin has permissions to visit related pages
|
359 |
+
*
|
360 |
+
* @access protected
|
361 |
+
* @return boolean
|
362 |
+
* @author NetGo
|
363 |
+
*/
|
364 |
+
protected function _isAllowed()
|
365 |
+
{
|
366 |
+
return Mage::getSingleton('admin/session')->isAllowed('netgo_cod/cod');
|
367 |
+
}
|
368 |
+
}
|
app/code/community/Netgo/Cod/controllers/CodController.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_Cod_CodController extends Mage_Core_Controller_Front_Action
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* view cod action
|
17 |
+
*
|
18 |
+
* @access public
|
19 |
+
* @return void
|
20 |
+
* @author NetGo
|
21 |
+
*/
|
22 |
+
public function checkAction()
|
23 |
+
{
|
24 |
+
$msgData = Mage::helper('netgo_cod')->getConfigData();
|
25 |
+
|
26 |
+
$cod = $this->getRequest()->getPost('zipcode');
|
27 |
+
$codObj = Mage::getModel('netgo_cod/cod')->getCollection()->addFieldToFilter('zipcode', trim($cod));
|
28 |
+
$codData = $codObj->getData();
|
29 |
+
|
30 |
+
if($codData[0]['zipcode'] != ''){
|
31 |
+
echo '<span class="cod-suc">'.$msgData['suc_msg'];
|
32 |
+
if($codData[0]['days'] != ''){
|
33 |
+
echo ' within '.$codData[0]['days'].' days ';
|
34 |
+
}
|
35 |
+
echo '.</span>';
|
36 |
+
}else{
|
37 |
+
echo '<span class="cod-error">'.$msgData['err_msg'].'</span>';
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Netgo/Cod/etc/adminhtml.xml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<acl>
|
17 |
+
<resources>
|
18 |
+
<admin>
|
19 |
+
<children>
|
20 |
+
<system>
|
21 |
+
<children>
|
22 |
+
<config>
|
23 |
+
<children>
|
24 |
+
<netgo_cod translate="title" module="netgo_cod">
|
25 |
+
<title>Cod</title>
|
26 |
+
</netgo_cod>
|
27 |
+
</children>
|
28 |
+
</config>
|
29 |
+
</children>
|
30 |
+
</system>
|
31 |
+
<netgo_cod translate="title" module="netgo_cod">
|
32 |
+
<title>Manage COD</title>
|
33 |
+
<children>
|
34 |
+
<cod translate="title" module="netgo_cod">
|
35 |
+
<title>COD</title>
|
36 |
+
<sort_order>0</sort_order>
|
37 |
+
</cod>
|
38 |
+
</children>
|
39 |
+
</netgo_cod>
|
40 |
+
</children>
|
41 |
+
</admin>
|
42 |
+
</resources>
|
43 |
+
</acl>
|
44 |
+
<menu>
|
45 |
+
<netgo_cod translate="title" module="netgo_cod">
|
46 |
+
<title>Manage COD</title>
|
47 |
+
<sort_order>85</sort_order>
|
48 |
+
<children>
|
49 |
+
<cod translate="title" module="netgo_cod">
|
50 |
+
<title>COD</title>
|
51 |
+
<action>adminhtml/cod_cod</action>
|
52 |
+
<sort_order>0</sort_order>
|
53 |
+
</cod>
|
54 |
+
</children>
|
55 |
+
</netgo_cod>
|
56 |
+
</menu>
|
57 |
+
</config>
|
app/code/community/Netgo/Cod/etc/config.xml
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<modules>
|
17 |
+
<Netgo_Cod>
|
18 |
+
<version>1.0.0</version>
|
19 |
+
</Netgo_Cod>
|
20 |
+
</modules>
|
21 |
+
<global>
|
22 |
+
<resources>
|
23 |
+
<netgo_cod_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Netgo_Cod</module>
|
26 |
+
<class>Netgo_Cod_Model_Resource_Setup</class>
|
27 |
+
</setup>
|
28 |
+
</netgo_cod_setup>
|
29 |
+
</resources>
|
30 |
+
<blocks>
|
31 |
+
<netgo_cod>
|
32 |
+
<class>Netgo_Cod_Block</class>
|
33 |
+
</netgo_cod>
|
34 |
+
</blocks>
|
35 |
+
<helpers>
|
36 |
+
<netgo_cod>
|
37 |
+
<class>Netgo_Cod_Helper</class>
|
38 |
+
</netgo_cod>
|
39 |
+
</helpers>
|
40 |
+
<models>
|
41 |
+
<netgo_cod>
|
42 |
+
<class>Netgo_Cod_Model</class>
|
43 |
+
<resourceModel>netgo_cod_resource</resourceModel>
|
44 |
+
</netgo_cod>
|
45 |
+
<netgo_cod_resource>
|
46 |
+
<class>Netgo_Cod_Model_Resource</class>
|
47 |
+
<entities>
|
48 |
+
<cod>
|
49 |
+
<table>netgo_cod_cod</table>
|
50 |
+
</cod>
|
51 |
+
</entities>
|
52 |
+
</netgo_cod_resource>
|
53 |
+
</models>
|
54 |
+
</global>
|
55 |
+
<adminhtml>
|
56 |
+
<layout>
|
57 |
+
<updates>
|
58 |
+
<netgo_cod>
|
59 |
+
<file>netgo_cod.xml</file>
|
60 |
+
</netgo_cod>
|
61 |
+
</updates>
|
62 |
+
</layout>
|
63 |
+
<translate>
|
64 |
+
<modules>
|
65 |
+
<Netgo_Cod>
|
66 |
+
<files>
|
67 |
+
<default>Netgo_Cod.csv</default>
|
68 |
+
</files>
|
69 |
+
</Netgo_Cod>
|
70 |
+
</modules>
|
71 |
+
</translate>
|
72 |
+
</adminhtml>
|
73 |
+
<admin>
|
74 |
+
<routers>
|
75 |
+
<adminhtml>
|
76 |
+
<args>
|
77 |
+
<modules>
|
78 |
+
<Netgo_Cod before="Mage_Adminhtml">Netgo_Cod_Adminhtml</Netgo_Cod>
|
79 |
+
</modules>
|
80 |
+
</args>
|
81 |
+
</adminhtml>
|
82 |
+
</routers>
|
83 |
+
</admin>
|
84 |
+
<frontend>
|
85 |
+
<routers>
|
86 |
+
<netgo_cod>
|
87 |
+
<use>standard</use>
|
88 |
+
<args>
|
89 |
+
<module>Netgo_Cod</module>
|
90 |
+
<frontName>netgo</frontName>
|
91 |
+
</args>
|
92 |
+
</netgo_cod>
|
93 |
+
</routers>
|
94 |
+
<layout>
|
95 |
+
<updates>
|
96 |
+
<netgo_cod>
|
97 |
+
<file>netgo_cod.xml</file>
|
98 |
+
</netgo_cod>
|
99 |
+
</updates>
|
100 |
+
</layout>
|
101 |
+
<translate>
|
102 |
+
<modules>
|
103 |
+
<Netgo_Cod>
|
104 |
+
<files>
|
105 |
+
<default>Netgo_Cod.csv</default>
|
106 |
+
</files>
|
107 |
+
</Netgo_Cod>
|
108 |
+
</modules>
|
109 |
+
</translate>
|
110 |
+
</frontend>
|
111 |
+
<default>
|
112 |
+
<netgo_cod>
|
113 |
+
<cod>
|
114 |
+
<breadcrumbs>1</breadcrumbs>
|
115 |
+
</cod>
|
116 |
+
</netgo_cod>
|
117 |
+
</default>
|
118 |
+
</config>
|
app/code/community/Netgo/Cod/etc/system.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<tabs>
|
17 |
+
<netgo translate="label" module="netgo_cod">
|
18 |
+
<label>Netgo</label>
|
19 |
+
<sort_order>1</sort_order>
|
20 |
+
</netgo>
|
21 |
+
</tabs>
|
22 |
+
<sections>
|
23 |
+
<netgo_cod translate="label" module="netgo_cod">
|
24 |
+
<class>separator-top</class>
|
25 |
+
<label>Manage COD</label>
|
26 |
+
<tab>netgo</tab>
|
27 |
+
<frontend_type>text</frontend_type>
|
28 |
+
<sort_order>1</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>1</show_in_store>
|
32 |
+
<groups>
|
33 |
+
<cod translate="label" module="netgo_cod">
|
34 |
+
<label>COD Setting</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>0</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
<fields>
|
41 |
+
<zip_status translate="label">
|
42 |
+
<label>Module status</label>
|
43 |
+
<frontend_type>select</frontend_type>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<sort_order>10</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
</zip_status>
|
50 |
+
<suc_msg translate="label">
|
51 |
+
<label>Success message</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>20</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</suc_msg>
|
58 |
+
<err_msg translate="label">
|
59 |
+
<label>Failure message</label>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<sort_order>30</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</err_msg>
|
66 |
+
<emp_msg translate="label">
|
67 |
+
<label>Empty message</label>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<sort_order>40</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
</emp_msg>
|
74 |
+
</fields>
|
75 |
+
</cod>
|
76 |
+
</groups>
|
77 |
+
</netgo_cod>
|
78 |
+
</sections>
|
79 |
+
</config>
|
app/code/community/Netgo/Cod/sql/netgo_cod_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
$this->startSetup();
|
14 |
+
$table = $this->getConnection()
|
15 |
+
->newTable($this->getTable('netgo_cod/cod'))
|
16 |
+
->addColumn(
|
17 |
+
'entity_id',
|
18 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
19 |
+
null,
|
20 |
+
array(
|
21 |
+
'identity' => true,
|
22 |
+
'nullable' => false,
|
23 |
+
'primary' => true,
|
24 |
+
),
|
25 |
+
'COD ID'
|
26 |
+
)
|
27 |
+
->addColumn(
|
28 |
+
'zipcode',
|
29 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
30 |
+
array(
|
31 |
+
'nullable' => false,
|
32 |
+
),
|
33 |
+
'Zip Code'
|
34 |
+
)
|
35 |
+
->addColumn(
|
36 |
+
'days',
|
37 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
38 |
+
array(),
|
39 |
+
'Days'
|
40 |
+
)
|
41 |
+
->addColumn(
|
42 |
+
'csvfile',
|
43 |
+
Varien_Db_Ddl_Table::TYPE_TEXT, 255,
|
44 |
+
array(),
|
45 |
+
'File'
|
46 |
+
)
|
47 |
+
->addColumn(
|
48 |
+
'status',
|
49 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
|
50 |
+
array(),
|
51 |
+
'Enabled'
|
52 |
+
)
|
53 |
+
->addColumn(
|
54 |
+
'updated_at',
|
55 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
56 |
+
null,
|
57 |
+
array(),
|
58 |
+
'COD Modification Time'
|
59 |
+
)
|
60 |
+
->addColumn(
|
61 |
+
'created_at',
|
62 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
63 |
+
null,
|
64 |
+
array(),
|
65 |
+
'COD Creation Time'
|
66 |
+
)
|
67 |
+
->setComment('COD Table');
|
68 |
+
$this->getConnection()->createTable($table);
|
69 |
+
$this->endSetup();
|
app/design/adminhtml/default/default/layout/netgo_cod.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<layout>
|
16 |
+
<adminhtml_cod_cod_index>
|
17 |
+
<reference name="menu">
|
18 |
+
<action method="setActive">
|
19 |
+
<menupath>netgo_cod/cod</menupath>
|
20 |
+
</action>
|
21 |
+
</reference>
|
22 |
+
<reference name="content">
|
23 |
+
<block type="netgo_cod/adminhtml_cod" name="cod" />
|
24 |
+
|
25 |
+
</reference>
|
26 |
+
</adminhtml_cod_cod_index>
|
27 |
+
<adminhtml_cod_cod_grid>
|
28 |
+
<block type="core/text_list" name="root" output="toHtml">
|
29 |
+
<block type="netgo_cod/adminhtml_cod_grid" name="cod_grid"/>
|
30 |
+
</block>
|
31 |
+
</adminhtml_cod_cod_grid>
|
32 |
+
<!-- Cod add/edit action -->
|
33 |
+
<adminhtml_cod_cod_edit>
|
34 |
+
<update handle="editor"/>
|
35 |
+
<reference name="menu">
|
36 |
+
<action method="setActive">
|
37 |
+
<menupath>netgo_cod/cod</menupath>
|
38 |
+
</action>
|
39 |
+
</reference>
|
40 |
+
<reference name="content">
|
41 |
+
<block type="netgo_cod/adminhtml_cod_edit" name="cod_edit"></block>
|
42 |
+
</reference>
|
43 |
+
<reference name="left">
|
44 |
+
<block type="netgo_cod/adminhtml_cod_edit_tabs" name="cod_tabs"></block>
|
45 |
+
</reference>
|
46 |
+
</adminhtml_cod_cod_edit>
|
47 |
+
|
48 |
+
</layout>
|
app/design/frontend/base/default/layout/netgo_cod.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<layout>
|
16 |
+
<netgo_cod_cod_view translate="label" module="netgo_cod">
|
17 |
+
<label>COD view page</label>
|
18 |
+
<update handle="page_one_column" />
|
19 |
+
<reference name="content">
|
20 |
+
<block type="netgo_cod/cod_view" name="cod_view" template="netgo_cod/cod/view.phtml" />
|
21 |
+
</reference>
|
22 |
+
</netgo_cod_cod_view>
|
23 |
+
<catalog_product_view>
|
24 |
+
<reference name="head">
|
25 |
+
<action method="addCss"><stylesheet>css/cod/style.css</stylesheet></action>
|
26 |
+
</reference>
|
27 |
+
<reference name="product.info.addtocart">
|
28 |
+
<!--<action type="netgo_cod/cod_view" method="setTemplate" >
|
29 |
+
<template>netgo_cod/cod/cod.phtml</template>
|
30 |
+
</action>-->
|
31 |
+
<block type="netgo_cod/cod_view" name="product.info.codview" template="netgo_cod/cod/cod.phtml" />
|
32 |
+
<action method="append"><block>product.info.codview</block></action>
|
33 |
+
</reference>
|
34 |
+
</catalog_product_view>
|
35 |
+
</layout>
|
app/design/frontend/base/default/template/netgo_cod/cod/cod.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
$msgData = Mage::helper('netgo_cod')->getConfigData();
|
15 |
+
if($msgData['zip_status'] == 1){
|
16 |
+
?>
|
17 |
+
<div class="input-box">
|
18 |
+
<div class="z-btn">
|
19 |
+
<label>Zip Code : </label><input type="text" id="cod" class="product-custom-option" name="cod" value="">
|
20 |
+
<button type="button" onclick="checkCOD();" name="zip-check" title="Check" class="button" id="zip-check"><span><span>Check</span></span></button>
|
21 |
+
</div>
|
22 |
+
<div id="cod_msg"></div>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<script>
|
26 |
+
function checkCOD(){
|
27 |
+
var cod = $('cod').value;
|
28 |
+
if(cod == ''){
|
29 |
+
$('cod_msg').update('<span class="cod-error"><?php echo $msgData['emp_msg']; ?></span>');
|
30 |
+
return
|
31 |
+
}else{
|
32 |
+
$('cod_msg').update('<img src="<?php echo Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB, true ).'media/cod/img/ajax-loader-2.gif';?>">');
|
33 |
+
new Ajax.Request('<?php echo Mage::getBaseUrl().'netgo/cod/check';?>', {
|
34 |
+
method:'post',
|
35 |
+
parameters: {zipcode: cod},
|
36 |
+
onSuccess: function(transport) {
|
37 |
+
var response = transport.responseText || "no response text";
|
38 |
+
$('cod_msg').update(response);
|
39 |
+
},
|
40 |
+
onFailure: function() { alert('Something went wrong...'); }
|
41 |
+
});
|
42 |
+
}
|
43 |
+
}
|
44 |
+
</script>
|
45 |
+
<?php } ?>
|
app/design/frontend/base/default/template/netgo_cod/cod/view.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Cash On Delivery ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_Pricereminder
|
9 |
+
* @author NetGo
|
10 |
+
* @dev netattingomails@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
?>
|
14 |
+
<?php $_cod = $this->getCurrentCod();?>
|
15 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
16 |
+
<div class="page-title cod-title">
|
17 |
+
<h1><?php echo $_cod->getZipcode(); ?></h1>
|
18 |
+
</div>
|
19 |
+
<div class="cod-view">
|
20 |
+
|
21 |
+
</div>
|
app/etc/modules/Netgo_Cod.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Cash On Delivery ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_Pricereminder
|
10 |
+
* @author NetGo
|
11 |
+
* @dev netattingomails@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<modules>
|
17 |
+
<Netgo_Cod>
|
18 |
+
<active>true</active>
|
19 |
+
<codePool>community</codePool>
|
20 |
+
<depends>
|
21 |
+
<Mage_Core />
|
22 |
+
</depends>
|
23 |
+
</Netgo_Cod>
|
24 |
+
</modules>
|
25 |
+
</config>
|
import_zipcode_sample.csv
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
zipcode,status,days
|
2 |
+
110011,1,1
|
3 |
+
110012,1,2
|
4 |
+
110013,1,3
|
5 |
+
110014,1,4
|
6 |
+
110015,1,5
|
media/cod/img/ajax-loader-2.gif
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Netgo_Cod</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension helps customer to check the product availability in a particular area.</summary>
|
10 |
+
<description>This extension provides the facility to check on product detail page whether COD(Cash On Delivery) is available at a specific zipcode or not. Admin can upload a list of zip code where the COD is available and also approximate time in days in which COD is available at a specific zip code. 
|
11 |
+

|
12 |
+
For managing this zip code system, admin needs to create a CSV having three columns zip code, status and days and upload in magento admin by going to -> .
|
13 |
+

|
14 |
+
Features:
|
15 |
+
Check COD availability on Product Page through zip code
|
16 |
+
Can manage approximate days in which COD is available on specific zip code
|
17 |
+
Can set different messages for customer: Success, Failure and Empty.
|
18 |
+
User friendly
|
19 |
+
Admin friendly</description>
|
20 |
+
<notes>First Preview Release</notes>
|
21 |
+
<authors><author><name>NetGo</name><user>NetGo</user><email>netattingomails@gmail.com</email></author></authors>
|
22 |
+
<date>2015-08-13</date>
|
23 |
+
<time>06:23:14</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Netgo"><dir name="Cod"><dir name="Block"><dir name="Adminhtml"><dir name="Cod"><dir name="Edit"><file name="Form.php" hash="f2d17985fb46b851f8347a17872dd162"/><dir name="Tab"><file name="Form.php" hash="2d2e9c4a5e16d75f094571dd7ee1636c"/></dir><file name="Tabs.php" hash="b456e6d2895ca7376918d264c5d70458"/></dir><file name="Edit.php" hash="c837519b35cabf3b0c58c2469cb07fa2"/><file name="Grid.php" hash="02689c69413928556e68888a3e4b6f76"/><dir name="Helper"><file name="File.php" hash="08773ba5ce62a911b38a973cbbe00ef9"/></dir></dir><file name="Cod.php" hash="cae9bedab4f2bda4c4a4a0d2179110c2"/></dir><dir name="Cod"><file name="View.php" hash="b5229257660f0be6cb1093c0a9ee19d1"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="Cod.php" hash="74f7505093b94f4e97da386b18b21403"/></dir></dir><dir name="Helper"><file name="Cod.php" hash="c61200d49fe86fe13daf064e47bfd021"/><file name="Data.php" hash="eee08a4a95c5bf8682c3a90b406a5690"/></dir><dir name="Model"><file name="Cod.php" hash="3b531fd16ce81a0f3fb016c541e6ce88"/><dir name="Resource"><dir name="Cod"><file name="Collection.php" hash="29a1d5ea525857edda0ba611bdec3bc4"/></dir><file name="Cod.php" hash="94c27b91c329b96eaff3f64ddaf46e14"/><file name="Setup.php" hash="3d838f103e45e9da299ba902f052f16f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Cod"><file name="CodController.php" hash="11d226913cdd74759f3eaaab692305d3"/></dir></dir><file name="CodController.php" hash="7f66f86d2bde4bf91a035d8b3175000e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c0aeae52367bdf0c2851f955e0658278"/><file name="config.xml" hash="f138ecac7e8a651fce323063e79d477e"/><file name="system.xml" hash="a6fa062cdc141a970470ea93dab5a4b1"/></dir><dir name="sql"><dir name="netgo_cod_setup"><file name="install-1.0.0.php" hash="f31eafa041ab1504a1e7cafabc3e7556"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="netgo_cod.xml" hash="7598a27f1c098137b542ae5af8c09537"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="netgo_cod.xml" hash="a6e533fa9e579996e1f036f02b7c9011"/></dir><dir name="template"><dir name="netgo_cod"><dir name="cod"><file name="cod.phtml" hash="8ed7c77b5046df7022443fcbbbd2fce7"/><file name="view.phtml" hash="a9cb6b567028fcbde44227b344cfe402"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="User_Manual.pdf" hash="0bd1c1eedc810a7c246ea4a623a0b120"/><file name="import_zipcode_sample.csv" hash="86c4cb210e059748cdae7d42fe022a46"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="cod"><dir name="img"><file name="pr-opt-bg.jpg" hash="e692389efe3d528514ea6b763e4ea76e"/><file name="van-icon.png" hash="73dcc4ad452ec0e4354c6cb78c7d8caa"/></dir><file name="style.css" hash="214fbf5cf65688e1c89dd31a4f5be807"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Netgo_Cod.xml" hash="baeba3bd11974237c54260644cea41c8"/></dir></target><target name="magemedia"><dir name="cod"><dir name="img"><file name="ajax-loader-2.gif" hash="a7cb027c1ed0c4df76e4c38c259853eb"/></dir></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|
skin/frontend/base/default/css/cod/img/pr-opt-bg.jpg
ADDED
Binary file
|
skin/frontend/base/default/css/cod/img/van-icon.png
ADDED
Binary file
|
skin/frontend/base/default/css/cod/style.css
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/***************************************
|
2 |
+
*** Cash On Delivery ***
|
3 |
+
***************************************
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2015
|
6 |
+
* @company NetAttingo Technologies
|
7 |
+
* @package Netgo_Pricereminder
|
8 |
+
* @author NetGo
|
9 |
+
* @dev netattingomails@gmail.com
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
div.product-view .add-to-cart{
|
15 |
+
padding-bottom:15px;
|
16 |
+
}
|
17 |
+
div.product-view .add-to-cart-buttons {
|
18 |
+
float: right;
|
19 |
+
margin-right: 0px;
|
20 |
+
max-width: 100%;
|
21 |
+
width: 82%;
|
22 |
+
}
|
23 |
+
.z-btn label {
|
24 |
+
background: rgba(0, 0, 0, 0) url("img/van-icon.png") no-repeat scroll right 2px top 3px / 96% auto;
|
25 |
+
float: left;
|
26 |
+
font-size: 13px;
|
27 |
+
height: auto;
|
28 |
+
line-height: 28px;
|
29 |
+
text-indent: -9999px;
|
30 |
+
width: 37px;
|
31 |
+
}
|
32 |
+
.z-btn input.product-custom-option {
|
33 |
+
border: 0 none;
|
34 |
+
float: left;
|
35 |
+
height: auto;
|
36 |
+
line-height: 31px;
|
37 |
+
margin-left: 7px;
|
38 |
+
width: auto;
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
.z-btn {
|
43 |
+
background: #ff0000 url("img/pr-opt-bg.jpg") repeat scroll 0 0;
|
44 |
+
border-radius: 5px;
|
45 |
+
color: #fff;
|
46 |
+
float: left;
|
47 |
+
margin-bottom: 0px;
|
48 |
+
padding: 10px 15px 0;
|
49 |
+
width: 100%;
|
50 |
+
}
|
51 |
+
.z-btn button {
|
52 |
+
background: #000 none repeat scroll 0 0;
|
53 |
+
float: left;
|
54 |
+
font-size: 13px;
|
55 |
+
padding: 6px 20px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.input-box > div#cod_msg {
|
59 |
+
display: inline-block;
|
60 |
+
float: left;
|
61 |
+
font-size: 12px;
|
62 |
+
text-align: center;
|
63 |
+
width: 100%;
|
64 |
+
}
|
65 |
+
.cod-suc,.cod-error{
|
66 |
+
-moz-border-bottom-colors: none;
|
67 |
+
-moz-border-left-colors: none;
|
68 |
+
-moz-border-right-colors: none;
|
69 |
+
-moz-border-top-colors: none;
|
70 |
+
background: #fff none repeat scroll 0 0;
|
71 |
+
border-color: -moz-use-text-color #ccc #ccc;
|
72 |
+
border-image: none;
|
73 |
+
border-style: none solid solid;
|
74 |
+
border-width: 0 1px 1px;
|
75 |
+
float: left;
|
76 |
+
margin-bottom: 10px;
|
77 |
+
padding: 2px 11px 3px;
|
78 |
+
position: relative;
|
79 |
+
text-align: center;
|
80 |
+
top: -3px;
|
81 |
+
width: 100%;
|
82 |
+
}
|
83 |
+
#cod_msg img{display:inline-block;float:none;text-align:center;width:3%;}
|
84 |
+
.cod-error {
|
85 |
+
color: #ff0000;
|
86 |
+
}
|
87 |
+
.cod-suc{
|
88 |
+
color: #009036;
|
89 |
+
}
|
90 |
+
|
91 |
+
div.product-view .add-to-cart-buttons button#zip-check.button {
|
92 |
+
line-height: 32px;
|
93 |
+
min-height: auto;
|
94 |
+
width: auto;
|
95 |
+
}
|
96 |
+
|