All_in_One_Shipping - Version 1.1.0

Version Notes

All in One Shipping Extension is stabled version.

Download this release

Release Info

Developer Synotive Technologies
Extension All_in_One_Shipping
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

Files changed (32) hide show
  1. app/code/community/Synotive/Table/Block/Adminhtml/Method.php +27 -0
  2. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit.php +56 -0
  3. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Form.php +33 -0
  4. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/General.php +56 -0
  5. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/Import.php +49 -0
  6. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/Stores.php +48 -0
  7. app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tabs.php +74 -0
  8. app/code/community/Synotive/Table/Block/Adminhtml/Method/Grid.php +96 -0
  9. app/code/community/Synotive/Table/Block/Adminhtml/Rate/Edit.php +33 -0
  10. app/code/community/Synotive/Table/Block/Adminhtml/Rate/Edit/Form.php +123 -0
  11. app/code/community/Synotive/Table/Block/Adminhtml/Rates.php +138 -0
  12. app/code/community/Synotive/Table/Helper/Data.php +100 -0
  13. app/code/community/Synotive/Table/Model/Carrier/Table.php +160 -0
  14. app/code/community/Synotive/Table/Model/Config/Source/Option.php +19 -0
  15. app/code/community/Synotive/Table/Model/Config/Source/Ziptype.php +35 -0
  16. app/code/community/Synotive/Table/Model/Method.php +33 -0
  17. app/code/community/Synotive/Table/Model/Mysql4/Method.php +23 -0
  18. app/code/community/Synotive/Table/Model/Mysql4/Method/Collection.php +39 -0
  19. app/code/community/Synotive/Table/Model/Mysql4/Rate.php +56 -0
  20. app/code/community/Synotive/Table/Model/Mysql4/Rate/Collection.php +113 -0
  21. app/code/community/Synotive/Table/Model/Mysql4/Setup.php +20 -0
  22. app/code/community/Synotive/Table/Model/Observer.php +36 -0
  23. app/code/community/Synotive/Table/Model/Rate.php +501 -0
  24. app/code/community/Synotive/Table/controllers/Adminhtml/MethodController.php +189 -0
  25. app/code/community/Synotive/Table/controllers/Adminhtml/RateController.php +132 -0
  26. app/code/community/Synotive/Table/etc/adminhtml.xml +57 -0
  27. app/code/community/Synotive/Table/etc/config.xml +163 -0
  28. app/code/community/Synotive/Table/etc/system.xml +135 -0
  29. app/code/community/Synotive/Table/sql/synotivetable_setup/mysql4-install-1.php +56 -0
  30. app/code/community/Synotive/Table/sql/synotivetable_setup/mysql4-upgrade-1-1.1.php +51 -0
  31. app/etc/modules/Synotive_Table.xml +9 -0
  32. package.xml +18 -0
app/code/community/Synotive/Table/Block/Adminhtml/Method.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method extends Mage_Adminhtml_Block_Widget_Grid_Container
18
+ {
19
+ public function __construct()
20
+ {
21
+ $this->_controller = 'adminhtml_method';
22
+ $this->_blockGroup = 'synotivetable';
23
+ $this->_headerText = Mage::helper('synotivetable')->__('All in One Shipping');
24
+ parent::__construct();
25
+ $this->_removeButton('add');
26
+ }
27
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
18
+ {
19
+ public function __construct()
20
+ {
21
+ parent::__construct();
22
+
23
+ $this->_objectId = 'id';
24
+ $this->_blockGroup = 'synotivetable';
25
+ $this->_controller = 'adminhtml_method';
26
+ $this->_removeButton('delete');
27
+
28
+ $this->_addButton('save_and_continue', array(
29
+ 'label' => Mage::helper('synotivetable')->__('Save and Continue Edit'),
30
+ 'onclick' => 'saveAndContinueEdit()',
31
+ 'class' => 'save'
32
+ ), 10);
33
+
34
+ $mid = Mage::registry('synotivetable_method')->getId();
35
+ if ($mid) {
36
+ $this->_addButton('new', array(
37
+ 'label' => Mage::helper('synotivetable')->__('Add New Rate'),
38
+ 'onclick' => 'newRate()',
39
+ 'class' => 'add'
40
+ ),15);
41
+
42
+ $url = $this->getUrl('*/adminhtml_rate/edit', array('mid'=>$mid));
43
+ $this->_formScripts[] = " function newRate(){ setLocation('$url'); } ";
44
+ }
45
+ $this->_formScripts[] = " function saveAndContinueEdit(){ editForm.submit($('edit_form').action + 'continue/edit') }";
46
+ }
47
+
48
+ public function getHeaderText()
49
+ {
50
+ $model = Mage::registry('synotivetable_method');
51
+ if ($model->getId()){
52
+ $header = Mage::helper('synotivetable')->__('Edit Method `%s`', $model->getName());
53
+ }
54
+ return $header;
55
+ }
56
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Form.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ protected function _prepareForm()
20
+ {
21
+ $form = new Varien_Data_Form(array(
22
+ 'id' => 'edit_form',
23
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
24
+ 'method' => 'post',
25
+ 'enctype' => 'multipart/form-data'
26
+ ));
27
+
28
+ $form->setUseContainer(true);
29
+ $this->setForm($form);
30
+
31
+ return parent::_prepareForm();
32
+ }
33
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/General.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ protected function _prepareForm()
20
+ {
21
+ $form = new Varien_Data_Form();
22
+ $this->setForm($form);
23
+
24
+ /* @var $hlp Synotive_Table_Helper_Data */
25
+ $hlp = Mage::helper('synotivetable');
26
+
27
+ $fldInfo = $form->addFieldset('general', array('legend'=> $hlp->__('General')));
28
+ $fldInfo->addField('name', 'text', array(
29
+ 'label' => $hlp->__('Name'),
30
+ 'required' => true,
31
+ 'name' => 'name',
32
+ ));
33
+ $fldInfo->addField('is_active', 'select', array(
34
+ 'label' => Mage::helper('salesrule')->__('Status'),
35
+ 'name' => 'is_active',
36
+ 'options' => $hlp->getStatuses(),
37
+ ));
38
+
39
+
40
+ $fldInfo->addField('pos', 'text', array(
41
+ 'label' => Mage::helper('salesrule')->__('Priority'),
42
+ 'name' => 'pos',
43
+ ));
44
+
45
+ $fldInfo->addField('shipping_cost', 'select', array(
46
+ 'label' => $hlp->__('Shipping Cost Applied'),
47
+ 'name' => 'shipping_cost',
48
+ 'options' => $hlp->getShippingCost(),
49
+ ));
50
+
51
+ //set form values
52
+ $form->setValues(Mage::registry('synotivetable_method')->getData());
53
+
54
+ return parent::_prepareForm();
55
+ }
56
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/Import.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit_Tab_Import extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ protected function _prepareForm()
20
+ {
21
+ //create form structure
22
+ $form = new Varien_Data_Form();
23
+ $this->setForm($form);
24
+
25
+ $hlp = Mage::helper('synotivetable');
26
+
27
+ $fldSet = $form->addFieldset('synotivetable_import', array('legend'=> $hlp->__('Import Rates')));
28
+ $fldSet->addField('import_clear', 'select', array(
29
+ 'label' => $hlp->__('Delete Existing Rates'),
30
+ 'name' => 'import_clear',
31
+ 'values' => array(
32
+ array(
33
+ 'value' => 0,
34
+ 'label' => Mage::helper('catalog')->__('No')
35
+ ),
36
+ array(
37
+ 'value' => 1,
38
+ 'label' => Mage::helper('catalog')->__('Yes')
39
+ ))
40
+ ));
41
+ $fldSet->addField('import_file', 'file', array(
42
+ 'label' => $hlp->__('CSV File'),
43
+ 'name' => 'import_file',
44
+ 'note' => $hlp->__('Example file on zip - demo.csv')
45
+ ));
46
+
47
+ return parent::_prepareForm();
48
+ }
49
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ protected function _prepareForm()
20
+ {
21
+ $form = new Varien_Data_Form();
22
+ $this->setForm($form);
23
+
24
+ /* @var $hlp Synotive_Table_Helper_Data */
25
+ $hlp = Mage::helper('synotivetable');
26
+
27
+ $fldStore = $form->addFieldset('apply_in', array('legend'=> $hlp->__('Visible In')));
28
+ $fldStore->addField('stores', 'multiselect', array(
29
+ 'label' => $hlp->__('Stores'),
30
+ 'name' => 'stores[]',
31
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
32
+ 'note' => $hlp->__('Leave empty if there are no restrictions'),
33
+ ));
34
+
35
+ $fldCust = $form->addFieldset('apply_for', array('legend'=> $hlp->__('Applicable For')));
36
+ $fldCust->addField('cust_groups', 'multiselect', array(
37
+ 'name' => 'cust_groups[]',
38
+ 'label' => $hlp->__('Customer Groups'),
39
+ 'values' => $hlp->getAllGroups(),
40
+ 'note' => $hlp->__('Leave empty if there are no restrictions'),
41
+ ));
42
+
43
+ //set form values
44
+ $form->setValues(Mage::registry('synotivetable_method')->getData());
45
+
46
+ return parent::_prepareForm();
47
+ }
48
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Edit/Tabs.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
18
+ {
19
+ public function __construct()
20
+ {
21
+ parent::__construct();
22
+ $this->setId('methodTabs');
23
+ $this->setDestElementId('edit_form');
24
+ $this->setTitle(Mage::helper('synotivetable')->__('Shipping Methods'));
25
+ }
26
+
27
+ protected function _beforeToHtml()
28
+ {
29
+ $tabs = array(
30
+ 'general' => 'General',
31
+ 'stores' => 'Stores & Customer Groups',
32
+ 'import' => 'Import',
33
+ );
34
+
35
+ foreach ($tabs as $code => $label){
36
+ $label = Mage::helper('synotivetable')->__($label);
37
+ $content = $this->getLayout()->createBlock('synotivetable/adminhtml_method_edit_tab_' . $code)
38
+ ->setTitle($label)
39
+ ->toHtml();
40
+
41
+ $this->addTab($code, array(
42
+ 'label' => $label,
43
+ 'content' => $content,
44
+ ));
45
+ }
46
+
47
+ $this->addTab('rates', array(
48
+ 'label' => Mage::helper('synotivetable')->__('Methods and Rates'),
49
+ 'class' => 'ajax',
50
+ 'url' => $this->getUrl('synotivetable/adminhtml_rate/index', array('_current' => true)),
51
+ ));
52
+
53
+
54
+ $this->_updateActiveTab();
55
+
56
+ return parent::_beforeToHtml();
57
+ }
58
+
59
+ protected function _updateActiveTab()
60
+ {
61
+ $tabId = $this->getRequest()->getParam('tab');
62
+ if ($tabId) {
63
+ $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
64
+ if ($tabId) {
65
+ $this->setActiveTab($tabId);
66
+ }
67
+ }
68
+ else {
69
+ $this->setActiveTab('main');
70
+ }
71
+ }
72
+
73
+
74
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Method/Grid.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Method_Grid extends Mage_Adminhtml_Block_Widget_Grid
18
+ {
19
+ public function __construct()
20
+ {
21
+ parent::__construct();
22
+ $this->setId('methodGrid');
23
+ $this->setDefaultSort('pos');
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ $collection = Mage::getModel('synotivetable/method')->getCollection();
29
+ $this->setCollection($collection);
30
+ return parent::_prepareCollection();
31
+ }
32
+
33
+ protected function _prepareColumns()
34
+ {
35
+ $hlp = Mage::helper('synotivetable');
36
+ $this->addColumn('method_id', array(
37
+ 'header' => $hlp->__('ID'),
38
+ 'align' => 'right',
39
+ 'width' => '50px',
40
+ 'index' => 'method_id',
41
+ ));
42
+
43
+ $this->addColumn('name', array(
44
+ 'header' => $hlp->__('Name'),
45
+ 'index' => 'name',
46
+ ));
47
+
48
+ $this->addColumn('pos', array(
49
+ 'header' => $hlp->__('Priority'),
50
+ 'index' => 'pos',
51
+ ));
52
+
53
+ $this->addColumn('is_active', array(
54
+ 'header' => Mage::helper('salesrule')->__('Status'),
55
+ 'align' => 'left',
56
+ 'width' => '80px',
57
+ 'index' => 'is_active',
58
+ 'type' => 'options',
59
+ 'options' => $hlp->getStatuses(),
60
+ ));
61
+
62
+ $this->addColumn('shipping_cost', array(
63
+ 'header' => $hlp->__('Shipping Cost'),
64
+ 'align' => 'left',
65
+ 'width' => '100px',
66
+ 'index' => 'shipping_cost',
67
+ 'type' => 'options',
68
+ 'options' => $hlp->getShippingCost(),
69
+ ));
70
+
71
+ return parent::_prepareColumns();
72
+ }
73
+
74
+ public function getRowUrl($row)
75
+ {
76
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
77
+ }
78
+
79
+ protected function _prepareMassaction()
80
+ {
81
+ $this->setMassactionIdField('method_id');
82
+ $this->getMassactionBlock()->setFormFieldName('methods');
83
+
84
+ $actions = array(
85
+ 'massActivate' => 'Activate',
86
+ 'massInactivate' => 'Inactivate',
87
+ );
88
+ foreach ($actions as $code => $label){
89
+ $this->getMassactionBlock()->addItem($code, array(
90
+ 'label' => Mage::helper('synotivetable')->__($label),
91
+ 'url' => $this->getUrl('*/*/' . $code),
92
+ ));
93
+ }
94
+ return $this;
95
+ }
96
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Rate/Edit.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Rate_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
18
+ {
19
+ public function __construct()
20
+ {
21
+ parent::__construct();
22
+ $this->_objectId = 'id';
23
+ $this->_blockGroup = 'synotivetable';
24
+ $this->_controller = 'adminhtml_rate';
25
+ $this->_removeButton('back');
26
+ $this->_removeButton('reset');
27
+ }
28
+
29
+ public function getHeaderText()
30
+ {
31
+ return Mage::helper('synotivetable')->__('Rate Configuration');
32
+ }
33
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Rate/Edit/Form.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Block_Adminhtml_Rate_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ protected function _prepareForm()
20
+ {
21
+ //create form structure
22
+ $form = new Varien_Data_Form(array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
25
+ 'method' => 'post',
26
+ ));
27
+
28
+ $form->setUseContainer(true);
29
+ $this->setForm($form);
30
+
31
+ $hlp = Mage::helper('synotivetable');
32
+ $model = Mage::registry('synotivetable_rate');
33
+
34
+ $fldDestination = $form->addFieldset('destination', array('legend'=> $hlp->__('Destination')));
35
+
36
+ $fldDestination->addField('method_id', 'hidden', array(
37
+ 'name' => 'method_id',
38
+ ));
39
+
40
+ $fldDestination->addField('country', 'select', array(
41
+ 'label' => $hlp->__('Country'),
42
+ 'name' => 'country',
43
+ 'options' => Mage::helper('synotivetable')->getCountries(),
44
+ ));
45
+
46
+ $fldDestination->addField('state', 'select', array(
47
+ 'label' => $hlp->__('State'),
48
+ 'name' => 'state',
49
+ 'options' => Mage::helper('synotivetable')->getStates(),
50
+ ));
51
+
52
+ $fldDestination->addField('city', 'text', array(
53
+ 'label' => $hlp->__('City'),
54
+ 'name' => 'city',
55
+ ));
56
+
57
+ $fldDestination->addField('zip_from', 'text', array(
58
+ 'label' => $hlp->__('Zip From'),
59
+ 'name' => 'zip_from',
60
+ ));
61
+
62
+ $fldDestination->addField('zip_to', 'text', array(
63
+ 'label' => $hlp->__('Zip To'),
64
+ 'name' => 'zip_to',
65
+ ));
66
+
67
+ $fldTotals = $form->addFieldset('conditions', array('legend'=> $hlp->__('Conditions')));
68
+ $fldTotals->addField('weight_from', 'text', array(
69
+ 'label' => $hlp->__('Weight From'),
70
+ 'name' => 'weight_from',
71
+ ));
72
+ $fldTotals->addField('weight_to', 'text', array(
73
+ 'label' => $hlp->__('Weight To'),
74
+ 'name' => 'weight_to',
75
+ ));
76
+
77
+ $fldTotals->addField('qty_from', 'text', array(
78
+ 'label' => $hlp->__('Qty From'),
79
+ 'name' => 'qty_from',
80
+ ));
81
+ $fldTotals->addField('qty_to', 'text', array(
82
+ 'label' => $hlp->__('Qty To'),
83
+ 'name' => 'qty_to',
84
+ ));
85
+
86
+ $fldTotals->addField('shipping_type', 'select', array(
87
+ 'label' => $hlp->__('Shipping Type'),
88
+ 'name' => 'shipping_type',
89
+ 'options' => Mage::helper('synotivetable')->getTypes(),
90
+ ));
91
+
92
+ $fldTotals->addField('price_from', 'text', array(
93
+ 'label' => $hlp->__('Price From'),
94
+ 'name' => 'price_from',
95
+ 'note' => $hlp->__('Original product cart price, without discounts.'),
96
+ ));
97
+
98
+ $fldTotals->addField('price_to', 'text', array(
99
+ 'label' => $hlp->__('Price To'),
100
+ 'name' => 'price_to',
101
+ 'note' => $hlp->__('Original product cart price, without discounts.'),
102
+ ));
103
+
104
+
105
+ $fldRate = $form->addFieldset('rate', array('legend'=> $hlp->__('Rate')));
106
+ $fldRate->addField('cost_base', 'text', array(
107
+ 'label' => $hlp->__('Base Rate for the Order'),
108
+ 'name' => 'cost_base',
109
+ ));
110
+
111
+ //set form values
112
+ $data = Mage::getSingleton('adminhtml/session')->getFormData();
113
+ if ($data) {
114
+ $form->setValues($data);
115
+ Mage::getSingleton('adminhtml/session')->setFormData(null);
116
+ }
117
+ elseif ($model) {
118
+ $form->setValues($model->getData());
119
+ }
120
+
121
+ return parent::_prepareForm();
122
+ }
123
+ }
app/code/community/Synotive/Table/Block/Adminhtml/Rates.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Synotive_Table_Block_Adminhtml_Rates extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('synotivetableRates');
24
+ $this->setUseAjax(true);
25
+ }
26
+
27
+ protected function _prepareCollection()
28
+ {
29
+ $id = $this->getRequest()->getParam('id');
30
+
31
+ $collection = Mage::getResourceModel('synotivetable/rate_collection')
32
+ ->addFieldToFilter('method_id', $id);
33
+
34
+ $this->setCollection($collection);
35
+ return parent::_prepareCollection();
36
+ }
37
+
38
+ protected function _prepareColumns()
39
+ {
40
+ $this->addColumn('country', array(
41
+ 'header' => Mage::helper('synotivetable')->__('Country'),
42
+ 'index' => 'country',
43
+ 'type' => 'options',
44
+ 'options' => Mage::helper('synotivetable')->getCountries(),
45
+ ));
46
+
47
+ $this->addColumn('state', array(
48
+ 'header' => Mage::helper('synotivetable')->__('State'),
49
+ 'index' => 'state',
50
+ 'type' => 'options',
51
+ 'options' => Mage::helper('synotivetable')->getStates(),
52
+ ));
53
+
54
+ $this->addColumn('city', array(
55
+ 'header' => Mage::helper('synotivetable')->__('City'),
56
+ 'index' => 'city',
57
+ ));
58
+
59
+ $this->addColumn('zip_from', array(
60
+ 'header' => Mage::helper('synotivetable')->__('Zip From'),
61
+ 'index' => 'zip_from',
62
+ ));
63
+
64
+ $this->addColumn('zip_to', array(
65
+ 'header' => Mage::helper('synotivetable')->__('Zip To'),
66
+ 'index' => 'zip_to',
67
+ ));
68
+
69
+ $this->addColumn('price_from', array(
70
+ 'header' => Mage::helper('synotivetable')->__('Price From'),
71
+ 'index' => 'price_from',
72
+ ));
73
+
74
+ $this->addColumn('price_to', array(
75
+ 'header' => Mage::helper('synotivetable')->__('Price To'),
76
+ 'index' => 'price_to',
77
+ ));
78
+
79
+ $this->addColumn('weight_from', array(
80
+ 'header' => Mage::helper('synotivetable')->__('Weight From'),
81
+ 'index' => 'weight_from',
82
+ ));
83
+
84
+ $this->addColumn('weight_to', array(
85
+ 'header' => Mage::helper('synotivetable')->__('Weight To'),
86
+ 'index' => 'weight_to',
87
+ ));
88
+
89
+ $this->addColumn('qty_from', array(
90
+ 'header' => Mage::helper('synotivetable')->__('Qty From'),
91
+ 'index' => 'qty_from',
92
+ ));
93
+
94
+ $this->addColumn('qty_to', array(
95
+ 'header' => Mage::helper('synotivetable')->__('Qty To'),
96
+ 'index' => 'qty_to',
97
+ ));
98
+
99
+ $this->addColumn('shipping_type', array(
100
+ 'header' => Mage::helper('synotivetable')->__('Shipping Type'),
101
+ 'index' => 'shipping_type',
102
+ 'type' => 'options',
103
+ 'options' => Mage::helper('synotivetable')->getTypes(),
104
+ ));
105
+
106
+ $this->addColumn('cost_base', array(
107
+ 'header' => Mage::helper('synotivetable')->__('Rate'),
108
+ 'index' => 'cost_base',
109
+ ));
110
+
111
+ $this->addColumn('action', array(
112
+ 'header' => Mage::helper('catalog')->__('Action'),
113
+ 'width' => '50px',
114
+ 'type' => 'action',
115
+ 'getter' => 'getId',
116
+ 'actions' => array(
117
+ array(
118
+ 'caption' => Mage::helper('catalog')->__('Delete'),
119
+ 'url' => array('base'=>'*/*/delete'),
120
+ 'field' => 'id'
121
+ )
122
+ ),
123
+ 'filter' => false,
124
+ 'sortable' => false,
125
+ 'is_system' => true,
126
+ ));
127
+
128
+ $this->addExportType('*/*/exportCsv', Mage::helper('synotivetable')->__('CSV'));
129
+
130
+ return parent::_prepareColumns();
131
+ }
132
+
133
+ public function getRowUrl($row)
134
+ {
135
+ return $this->getUrl('*/adminhtml_rate/edit', array('id' => $row->getId()));
136
+ }
137
+
138
+ }
app/code/community/Synotive/Table/Helper/Data.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Helper_Data extends Mage_Core_Helper_Abstract
18
+ {
19
+ public function getAllGroups()
20
+ {
21
+ $customerGroups = Mage::getResourceModel('customer/group_collection')
22
+ ->load()->toOptionArray();
23
+
24
+ $found = false;
25
+ foreach ($customerGroups as $group) {
26
+ if ($group['value']==0) {
27
+ $found = true;
28
+ }
29
+ }
30
+ if (!$found) {
31
+ array_unshift($customerGroups, array('value'=>0, 'label'=>Mage::helper('salesrule')->__('NOT LOGGED IN')));
32
+ }
33
+
34
+ return $customerGroups;
35
+ }
36
+
37
+ public function getStatuses()
38
+ {
39
+ return array(
40
+ '0' => $this->__('Inactive'),
41
+ '1' => $this->__('Active'),
42
+ );
43
+ }
44
+
45
+ public function getShippingCost()
46
+ {
47
+ return array(
48
+ 'Per Order' => $this->__('Per Order'),
49
+ 'Per Product' => $this->__('Per Product'),
50
+ );
51
+ }
52
+
53
+ public function getStates()
54
+ {
55
+ $hash = array();
56
+ $hashCountry = $this->getCountries();
57
+
58
+ $collection = Mage::getResourceModel('directory/region_collection')->getData();
59
+
60
+ foreach ($collection as $state){
61
+ $hash[$state['region_id']] = $hashCountry[$state['country_id']] ."/".$state['default_name'];
62
+ }
63
+ asort($hash);
64
+ $hashAll['0'] = 'All';
65
+ $hash = $hashAll + $hash;
66
+ return $hash;
67
+ }
68
+
69
+ public function getCountries()
70
+ {
71
+ $hash = array();
72
+ $countries = Mage::getModel('directory/country')->getCollection()->toOptionArray();
73
+
74
+ foreach ($countries as $country){
75
+ if($country['value']){
76
+ $hash[$country['value']] = $country['label'];
77
+ }
78
+ }
79
+ asort($hash);
80
+ $hashAll['0'] = 'All';
81
+ $hash = $hashAll + $hash;
82
+ return $hash;
83
+ }
84
+
85
+ public function getTypes()
86
+ {
87
+ $hash = array();
88
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'synotive_shipping_type');
89
+ if ($attribute->usesSource()) {
90
+ $options = $attribute->getSource()->getAllOptions(false);
91
+ }
92
+ foreach ($options as $option){
93
+ $hash[$option['value']] = $option['label'];
94
+ }
95
+ asort($hash);
96
+ $hashAll['0'] = 'All';
97
+ $hash = $hashAll + $hash;
98
+ return $hash;
99
+ }
100
+ }
app/code/community/Synotive/Table/Model/Carrier/Table.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Carrier_Table extends Mage_Shipping_Model_Carrier_Abstract
18
+ {
19
+ protected $_code = 'synotivetable';
20
+
21
+ /**
22
+ * Collect rates for this shipping method based on information in $request
23
+ *
24
+ * @param Mage_Shipping_Model_Rate_Request $data
25
+ * @return Mage_Shipping_Model_Rate_Result
26
+ */
27
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
28
+ {
29
+ if (!$this->getConfigData('active')) {
30
+ return false;
31
+ }
32
+
33
+ $result = Mage::getModel('shipping/rate_result');
34
+
35
+ $collection = Mage::getResourceModel('synotivetable/method_collection')
36
+ ->addFieldToFilter('is_active', 1)
37
+ ->addStoreFilter($request->getStoreId())
38
+ ->addCustomerGroupFilter($this->getCustomerGroupId($request))
39
+ ->setOrder('pos');
40
+
41
+ $rates = Mage::getModel('synotivetable/rate')->findBy($request, $collection);
42
+ $calculateProductIds = array();
43
+ $ratesNew = array();
44
+ $allValues = array();
45
+ foreach($rates as $key => $value){
46
+ array_push($calculateProductIds,$key);
47
+ $allValues = $value;
48
+ foreach($allValues as $key => $value){
49
+ $ratesNew[$key] += $value;
50
+ }
51
+ }
52
+
53
+ $product_ids = array();
54
+ if ($request->getAllItems()) {
55
+ foreach ($request->getAllItems() as $item) {
56
+ array_push($product_ids,$item->getProductId());
57
+ }
58
+ }
59
+
60
+ $final_prod_ids = array_diff($product_ids,$calculateProductIds);
61
+ $countOfRates = 0;
62
+ $final = array();
63
+ $total = 0;
64
+ $product_wise_rates = array();
65
+ foreach ($collection as $customMethod){
66
+
67
+ if (isset($ratesNew[$customMethod->getId()]))
68
+ {
69
+ $i += floatval($ratesNew[$customMethod->getId()]);
70
+ $final[$i]['carrier'] = $this->_code;
71
+ $final[$i]['carrier_title'] = $this->getConfigData('title');
72
+ $final[$i]['method'] = $this->_code . $customMethod->getId();
73
+ $final[$i]['method_title'] = Mage::helper('synotivetable')->__($customMethod->getName());
74
+ $final[$i]['cost'] = $ratesNew[$customMethod->getId()];
75
+ $final[$i]['price'] += floatval($ratesNew[$customMethod->getId()]);
76
+ array_push($product_wise_rates,$ratesNew[$customMethod->getId()]);
77
+ $total += floatval($ratesNew[$customMethod->getId()]);
78
+ $countOfRates++;
79
+ $j++;
80
+ }
81
+ }
82
+
83
+ if (($this->getConfigData('showmethod') == 1) && ( !empty($final_prod_ids) )){
84
+ foreach($final_prod_ids as $prod_id)
85
+ {
86
+ $productObj = Mage::getModel('catalog/product')->load($prod_id);
87
+ $error = Mage::getModel('shipping/rate_result_error');
88
+ $error->setCarrier($this->_code);
89
+ $error->setCarrierTitle($this->getConfigData('title'));
90
+ $error->setErrorMessage("'".$productObj->getName(). "' - For the product, shipping method is not available. So please remove that product to procced to checkout.");
91
+ $result->append($error);
92
+ }
93
+ }
94
+ else{
95
+ if(($countOfRates != 0) && ($this->getConfigData('showmethod') == 1))
96
+ {
97
+ $test = max(array_keys($final));
98
+ $final_ar = $final[$test];
99
+
100
+ // create new instance of method rate
101
+ $method = Mage::getModel('shipping/rate_result_method');
102
+
103
+ // record carrier information
104
+ $method->setCarrier($final_ar['carrier']);
105
+ $method->setCarrierTitle($final_ar['carrier_title']);
106
+
107
+ // record method information
108
+ $method->setMethod($final_ar['method']);
109
+ //$method->setMethodTitle($final_ar['method_title']);
110
+ $product_wise_rates = array_reverse($product_wise_rates);
111
+ $shippingVal = "(";$j = 0;
112
+ foreach($product_wise_rates as $rate)
113
+ {
114
+ if($j!=0)
115
+ $shippingVal .= " + ";
116
+
117
+ $shippingVal .= " $".$rate;
118
+ $j++;
119
+ }
120
+ $shippingVal .= " )";
121
+ //$product_wise_rates
122
+ $method->setMethodTitle($shippingVal." Total Shipping Costs ");
123
+ $method->setCost($final_ar['cost']);
124
+ $method->setPrice(round($total,2));
125
+
126
+ // add this rate to the result
127
+ $result->append($method);
128
+ }
129
+ }
130
+ return $result;
131
+ }
132
+
133
+
134
+ public function getAllowedMethods()
135
+ {
136
+ $collection = Mage::getResourceModel('synotivetable/method_collection')
137
+ ->addFieldToFilter('is_active', 1)
138
+ ->setOrder('pos');
139
+ $arr = array();
140
+ foreach ($collection as $method){
141
+ $methodCode = 'synotivetable'.$method->getMethodId();
142
+ $arr[$methodCode] = $method->getName();
143
+ }
144
+
145
+ return $arr;
146
+ }
147
+
148
+ public function getCustomerGroupId($request)
149
+ {
150
+ $allItems = $request->getAllItems();
151
+ if (!$allItems){
152
+ return 0;
153
+ }
154
+ foreach ($allItems as $item)
155
+ {
156
+ return $item->getProduct()->getCustomerGroupId();
157
+ }
158
+
159
+ }
160
+ }
app/code/community/Synotive/Table/Model/Config/Source/Option.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Config_Source_Option extends Varien_Object
18
+ {
19
+ }
app/code/community/Synotive/Table/Model/Config/Source/Ziptype.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Config_Source_Ziptype extends Varien_Object
18
+ {
19
+ public function toOptionArray()
20
+ {
21
+ $vals = array(
22
+ '0' => Mage::helper('synotivetable')->__('Numeric'),
23
+ '1' => Mage::helper('synotivetable')->__('String'),
24
+ );
25
+
26
+ $options = array();
27
+ foreach ($vals as $k => $v)
28
+ $options[] = array(
29
+ 'value' => $k,
30
+ 'label' => $v
31
+ );
32
+
33
+ return $options;
34
+ }
35
+ }
app/code/community/Synotive/Table/Model/Method.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Method extends Mage_Core_Model_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ parent::_construct();
22
+ $this->_init('synotivetable/method');
23
+ }
24
+
25
+ public function massChangeStatus ($ids, $status) {
26
+ foreach ($ids as $id) {
27
+ $model = Mage::getModel('synotivetable/method')->load($id);
28
+ $model->setIsActive($status);
29
+ $model->save();
30
+ }
31
+ return $this;
32
+ }
33
+ }
app/code/community/Synotive/Table/Model/Mysql4/Method.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Mysql4_Method extends Mage_Core_Model_Mysql4_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ $this->_init('synotivetable/method', 'method_id');
22
+ }
23
+ }
app/code/community/Synotive/Table/Model/Mysql4/Method/Collection.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Mysql4_Method_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ $this->_init('synotivetable/method');
22
+ }
23
+
24
+ public function addStoreFilter($storeId)
25
+ {
26
+ $storeId = intVal($storeId);
27
+ $this->getSelect()->where('stores="" OR stores LIKE "%,'.$storeId.',%"');
28
+
29
+ return $this;
30
+ }
31
+
32
+ public function addCustomerGroupFilter($groupId)
33
+ {
34
+ $groupId = intVal($groupId);
35
+ $this->getSelect()->where('cust_groups="" OR cust_groups LIKE "%,'.$groupId.',%"');
36
+
37
+ return $this;
38
+ }
39
+ }
app/code/community/Synotive/Table/Model/Mysql4/Rate.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Mysql4_Rate extends Mage_Core_Model_Mysql4_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ $this->_init('synotivetable/rate', 'rate_id');
22
+ }
23
+
24
+ public function batchInsert($methodId, $data)
25
+ {
26
+ $err = '';
27
+
28
+ $sql = '';
29
+ for ($i=0, $n=count($data); $i<$n; ++$i){
30
+ $sql .= ' (NULL,' . $methodId;
31
+ foreach ($data[$i] as $v){
32
+ $sql .= ', "'.$v.'"';
33
+ }
34
+ $sql .= '),';
35
+ }
36
+
37
+ if ($sql){
38
+
39
+ $sql = 'INSERT INTO `' . $this->getMainTable() . '` VALUES ' . substr($sql, 0, -1);
40
+ try {
41
+ $this->_getWriteAdapter()->raw_query($sql);
42
+ }
43
+ catch (Exception $e) {
44
+ $err = $e->getMessage();
45
+ }
46
+ }
47
+
48
+ return $err;
49
+ }
50
+
51
+ public function deleteBy($methodId)
52
+ {
53
+ $this->_getWriteAdapter()->delete($this->getMainTable(), 'method_id=' . intVal($methodId));
54
+ }
55
+
56
+ }
app/code/community/Synotive/Table/Model/Mysql4/Rate/Collection.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Mysql4_Rate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
18
+ {
19
+ public function _construct()
20
+ {
21
+ $this->_init('synotivetable/rate');
22
+ }
23
+
24
+ public function addAddressFilters($request)
25
+ {
26
+ $this->addFieldToFilter('country', array(
27
+ array(
28
+ 'like' => $request->getDestCountryId(),
29
+ ),
30
+ array(
31
+ 'eq' => '0',
32
+ ),
33
+ array(
34
+ 'eq' => '',
35
+ ),
36
+ ));
37
+
38
+ $this->addFieldToFilter('state', array(
39
+ array(
40
+ 'like' => $request->getDestRegionId(),
41
+ ),
42
+ array(
43
+ 'eq' => '0',
44
+ ),
45
+ array(
46
+ 'eq' => '',
47
+ ),
48
+ ));
49
+
50
+ $this->addFieldToFilter('city', array(
51
+ array(
52
+ 'like' => $request->getDestCity(),
53
+ ),
54
+ array(
55
+ 'eq' => '',
56
+ ),
57
+ ));
58
+
59
+ if (Mage::getStoreConfig('carriers/synotivetable/numeric_zip'))
60
+ {
61
+ $this->addFieldToFilter('zip_from', array(
62
+ array(
63
+ 'lteq' => $request->getDestPostcode(),
64
+ ),
65
+ array(
66
+ 'eq' => '',
67
+ ),
68
+ ));
69
+ $this->addFieldToFilter('zip_to', array(
70
+ array(
71
+ 'gteq' => $request->getDestPostcode(),
72
+ ),
73
+ array(
74
+ 'eq' => '',
75
+ ),
76
+ ));
77
+ }
78
+ else
79
+ $this->getSelect()->where("? LIKE zip_from OR zip_from = ''", $request->getDestPostcode());
80
+
81
+ return $this;
82
+ }
83
+
84
+ public function addMethodFilters($methodIds)
85
+ {
86
+ $this->addFieldToFilter('method_id', array('in'=>$methodIds));
87
+
88
+ return $this;
89
+ }
90
+
91
+ public function addTotalsFilters($totals,$shippingType)
92
+ {
93
+ $this->addFieldToFilter('price_from', array('lteq'=>$totals['not_free_price']));
94
+ $this->addFieldToFilter('price_to', array('gteq'=>$totals['not_free_price']));
95
+ $this->addFieldToFilter('weight_from', array('lteq'=>$totals['not_free_weight']));
96
+ $this->addFieldToFilter('weight_to', array('gteq'=>$totals['not_free_weight']));
97
+ $this->addFieldToFilter('qty_from', array('lteq'=>$totals['not_free_qty']));
98
+ $this->addFieldToFilter('qty_to', array('gteq'=>$totals['not_free_qty']));
99
+ $this->addFieldToFilter('shipping_type', array(
100
+ array(
101
+ 'eq' => $shippingType,
102
+ ),
103
+ array(
104
+ 'eq' => '',
105
+ ),
106
+ array(
107
+ 'eq' => '0',
108
+ ),
109
+ ));
110
+ return $this;
111
+
112
+ }
113
+ }
app/code/community/Synotive/Table/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
18
+ {
19
+
20
+ }
app/code/community/Synotive/Table/Model/Observer.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Observer
18
+ {
19
+ /**
20
+ * Append rule product attributes to select by quote item collection
21
+ *
22
+ * @param Varien_Event_Observer $observer
23
+ * @return Mage_SalesRule_Model_Observer
24
+ */
25
+ public function addProductAttributes(Varien_Event_Observer $observer)
26
+ {
27
+ // @var Varien_Object
28
+ $attributesTransfer = $observer->getEvent()->getAttributes();
29
+
30
+ $result = array();
31
+ $result['synotive_shipping_type'] = true;
32
+ $attributesTransfer->addData($result);
33
+
34
+ return $this;
35
+ }
36
+ }
app/code/community/Synotive/Table/Model/Rate.php ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Model_Rate extends Mage_Core_Model_Abstract
18
+ {
19
+ const MAX_LINE_LENGTH = 2000;
20
+ const COL_NUMS = 13;
21
+
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('synotivetable/rate');
26
+ }
27
+
28
+ public function findBy($request, $collection)
29
+ {
30
+ if (!$request->getAllItems()) {
31
+ return array();
32
+ }
33
+
34
+ if($collection->getSize() == 0)
35
+ {
36
+ return array();
37
+ }
38
+
39
+ $methodIds = array();
40
+ foreach ($collection as $method)
41
+ {
42
+ $methodIds[] = $method -> getMethodId();
43
+ $shippingCost[$method -> getMethodId()] = $method->getShippingCost();
44
+ }
45
+ // calculate price and weight
46
+ $allowFreePromo = Mage::getStoreConfig('carriers/synotivetable/allow_promo');
47
+ $ignoreVirtual = Mage::getStoreConfig('carriers/synotivetable/ignore_virtual');
48
+
49
+ $items = $request->getAllItems();
50
+ $shippingTypes = array();
51
+ $shippingTypes[] = 0;
52
+ foreach($items as $item)
53
+ {
54
+ // if attribute isn't load to product
55
+ $product = Mage::getModel('catalog/product')->load($item->getProduct()->getEntityId());
56
+ if ($product->getSynotiveShippingType()){
57
+ $shippingTypes[$product->getId()] = $product->getSynotiveShippingType();
58
+ } else {
59
+ $shippingTypes[$product->getId()] = 0;
60
+ }
61
+ }
62
+ $allCosts = array();
63
+
64
+ $allRates = $this->getResourceCollection();
65
+ $allRates->addMethodFilters($methodIds);
66
+ $ratesTypes = array();
67
+
68
+ foreach ($allRates as $singleRate){
69
+ $ratesTypes[$singleRate->getMethodId()][]= $singleRate->getShippingType();
70
+ }
71
+ $intersectTypes = array();
72
+
73
+ foreach ($ratesTypes as $key => $value){
74
+
75
+ $intersectTypes[$key] = array_intersect($shippingTypes,$value);
76
+ arsort($intersectTypes[$key]);
77
+ $methodIds = array($key);
78
+ $allTotals = $this->calculateTotals($request, $ignoreVirtual, $allowFreePromo,'0');
79
+ $costShipping = $shippingCost[$key];
80
+
81
+ foreach ($intersectTypes[$key] as $key => $shippingType){
82
+ //foreach ($intersectTypes[$key] as $shippingType){
83
+ $productId = $key;
84
+ $totals = $this->calculateTotals($request, $ignoreVirtual, $allowFreePromo,$shippingType,$productId);
85
+
86
+ if ($allTotals['qty'] > 0 && (!Mage::getStoreConfig('carriers/synotivetable/dont_split') || $allTotals['qty'] == $totals['qty'])) {
87
+
88
+ if ($shippingType == 0)
89
+ $totals = $allTotals;
90
+
91
+ $allTotals['not_free_price'] -= $totals['not_free_price'];
92
+ $allTotals['not_free_weight'] -= $totals['not_free_weight'];
93
+ $allTotals['not_free_qty'] -= $totals['not_free_qty'];
94
+ $allTotals['qty'] -= $totals['qty'];
95
+
96
+ $allRates = $this->getResourceCollection();
97
+ $allRates->addAddressFilters($request);
98
+ $allRates->addTotalsFilters($totals,$shippingType);
99
+ $allRates->addMethodFilters($methodIds);
100
+
101
+ foreach($this->calculateCosts($allRates, $totals, $request,$shippingType,$costShipping) as $key => $cost){
102
+ if (!empty($allCosts[$key])){
103
+ $allCosts[$productId][$key] += $cost;
104
+ } else {
105
+ $allCosts[$productId][$key] = $cost;
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return $allCosts;
112
+ }
113
+
114
+ protected function calculateCosts($allRates, $totals, $request, $shippingType, $shippingCost)
115
+ {
116
+ $shippingFlatParams = array('country', 'state', 'city');
117
+ $shippingRangeParams = array('price', 'qty', 'weight');
118
+
119
+ $minCounts = array(); // min empty values counts per method
120
+ $results = array();
121
+
122
+ foreach ($allRates as $rate){
123
+
124
+ $rate = $rate->getData();
125
+
126
+ $emptyValuesCount = 0;
127
+
128
+ if(empty($rate['shipping_type'])){
129
+ $emptyValuesCount++;
130
+ }
131
+
132
+ foreach ($shippingFlatParams as $param){
133
+ if (empty($rate[$param])){
134
+ $emptyValuesCount++;
135
+ }
136
+ }
137
+
138
+ foreach ($shippingRangeParams as $param){
139
+ if ((ceil($rate[$param . '_from'])== 0) && (ceil($rate[$param . '_to'])== 999999)) {
140
+ $emptyValuesCount++;
141
+ }
142
+ }
143
+
144
+ if (empty($rate['zip_from']) && empty($rate['zip_to']) ){
145
+ $emptyValuesCount++;
146
+ }
147
+
148
+ if (!$totals['not_free_price'] && !$totals['not_free_qty'] && !$totals['not_free_weight']){
149
+ $cost = 0;
150
+ }
151
+ else {
152
+ if($shippingCost == "Per Order")
153
+ $cost = $rate['cost_base'];
154
+ else
155
+ $cost = $totals['not_free_qty'] * $rate['cost_base'];
156
+ }
157
+
158
+ $id = $rate['method_id'];
159
+ if ((empty($minCounts[$id]) && empty($results[$id])) || ($minCounts[$id] > $emptyValuesCount) || (($minCounts[$id] == $emptyValuesCount) && ($cost > $results[$id]))){
160
+ $minCounts[$id] = $emptyValuesCount;
161
+ $results[$id] = $cost;
162
+ }
163
+
164
+ }
165
+ return $results;
166
+ }
167
+
168
+ protected function calculateTotals($request, $ignoreVirtual, $allowFreePromo,$shippingType,$productId)
169
+ {
170
+ $totals = $this->initTotals();
171
+ $newItems = array();
172
+ //reload child items
173
+ $isCalculateLater = array();
174
+
175
+ foreach ($request->getAllItems() as $item) {
176
+ // if attribute isn't load to product
177
+ $product = Mage::getModel('catalog/product')->load($item->getProduct()->getEntityId());
178
+
179
+ if (/*($product->getSynotiveShippingType() != $shippingType) &&*/ ($shippingType != 0) && ($productId != $product->getId()))
180
+ continue;
181
+
182
+ if ($item->getParentItemId())
183
+ continue;
184
+
185
+ if ($ignoreVirtual && $item->getProduct()->isVirtual())
186
+ continue;
187
+
188
+ if ($item->getHasChildren()) {
189
+ $qty = 0;
190
+ $notFreeQty =0;
191
+ $price = 0;
192
+ $weight = 0;
193
+ foreach ($item->getChildren() as $child) {
194
+
195
+ $qty += $child->getQty();
196
+ $notFreeQty += ($qty - $this->getFreeQty($child, $allowFreePromo));
197
+ $price += $child->getPrice() * $child->getQty();
198
+ $weight += $child->getWeight() * $qty;
199
+ $totals['tax_amount'] += $child->getBaseTaxAmount() + $child->getBaseHiddenTaxAmount();
200
+ $totals['discount_amount'] += $child->getBaseDiscountAmount();
201
+ }
202
+
203
+ if ($item->getProductType() == 'bundle'){
204
+ $qty = $item->getQty();
205
+
206
+ if ($item->getProduct()->getWeightType() == 1){
207
+ $weight = $item->getWeight();
208
+ }
209
+
210
+ if ($item->getProduct()->getPriceType() == 1){
211
+ $price = $item->getPrice();
212
+ }
213
+
214
+ if ($item->getProduct()->getSkuType() == 1){
215
+ $totals['tax_amount'] += $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount();
216
+ $totals['discount_amount'] += $item->getBaseDiscountAmount();
217
+ }
218
+
219
+ $notFreeQty = ($qty - $this->getFreeQty($item, $allowFreePromo));
220
+ $totals['qty'] += $qty;
221
+ $totals['not_free_qty'] += $notFreeQty;
222
+ $totals['not_free_price'] += $price * $notFreeQty;
223
+ $totals['not_free_weight'] += $weight * $notFreeQty;
224
+
225
+ }
226
+
227
+ if ($item->getProductType() == 'configurable'){
228
+ $qty = $item->getQty();
229
+ $price = $item->getPrice();
230
+ $weight = $item->getWeight();
231
+ $notFreeQty = ($qty - $this->getFreeQty($item, $allowFreePromo));
232
+ $totals['qty'] += $qty;
233
+ $totals['not_free_qty'] += $notFreeQty;
234
+ $totals['not_free_price'] += $price * $notFreeQty;
235
+ $totals['not_free_weight'] += $weight * $notFreeQty;
236
+ $totals['tax_amount'] += $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount();
237
+ $totals['discount_amount'] += $item->getBaseDiscountAmount();
238
+ }
239
+
240
+ } else {
241
+ $qty = $item->getQty();
242
+ $notFreeQty = ($qty - $this->getFreeQty($item, $allowFreePromo));
243
+ $totals['not_free_price'] += $item->getBasePrice(); /** $notFreeQty*/
244
+ $totals['not_free_weight'] += $item->getWeight(); /** $notFreeQty*/
245
+ $totals['qty'] += $qty;
246
+ $totals['not_free_qty'] += $notFreeQty;
247
+ $totals['tax_amount'] += $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount();
248
+ $totals['discount_amount'] += $item->getBaseDiscountAmount();
249
+ }
250
+ }// foreach
251
+
252
+ // fix magento bug
253
+ if ($totals['qty'] != $totals['not_free_qty'])
254
+ $request->setFreeShipping(false);
255
+
256
+ $afterDiscount = Mage::getStoreConfig('carriers/synotivetable/after_discount');
257
+ $includingTax = Mage::getStoreConfig('carriers/synotivetable/including_tax');
258
+
259
+ if ($afterDiscount)
260
+ $totals['not_free_price'] -= $totals['discount_amount'];
261
+
262
+ if($includingTax)
263
+ $totals['not_free_price'] += $totals['tax_amount'];
264
+
265
+ if ($totals['not_free_price'] < 0)
266
+ $totals['not_free_price'] = 0;
267
+
268
+ if ($request->getFreeShipping() && $allowFreePromo)
269
+ $totals['not_free_price'] = $totals['not_free_weight'] = $totals['not_free_qty'] = 0;
270
+
271
+ return $totals;
272
+ }
273
+
274
+ public function getFreeQty($item, $allowFreePromo)
275
+ {
276
+ $freeQty = 0;
277
+
278
+ if ($item->getFreeShipping() && $allowFreePromo)
279
+ $freeQty = ((is_numeric($item->getFreeShipping())) && ($item->getFreeShipping() <= $item->getQty())) ? $item->getFreeShipping() : $item->getQty();
280
+
281
+ return $freeQty;
282
+ }
283
+
284
+ public function import($methodId, $fileName)
285
+ {
286
+ $err = array();
287
+
288
+ $fp = fopen($fileName, 'r');
289
+ if (!$fp){
290
+ $err[] = Mage::helper('synotivetable')->__('Can not open file %s .', $fileName);
291
+ return $err;
292
+ }
293
+ $methodId = intval($methodId);
294
+ if (!$methodId){
295
+ $err[] = Mage::helper('synotivetable')->__('Specify a valid method ID.');
296
+ return $err;
297
+ }
298
+
299
+ $countryCodes = $this->getCountries();
300
+ $stateCodes = $this->getStates();
301
+ $countryNames = $this->getCountriesName();
302
+ $stateNames = $this->getStatesName();
303
+ $typeLabels = Mage::helper('synotivetable')->getTypes();
304
+
305
+ $data = array();
306
+ $dataIndex = 0;
307
+
308
+ $currLineNum = 0;
309
+ while (($line = fgetcsv($fp, self::MAX_LINE_LENGTH, ',', '"')) !== false) {
310
+ $currLineNum++;
311
+
312
+ if (count($line) == 1)
313
+ {
314
+ continue;
315
+ }
316
+
317
+ if (count($line) != self::COL_NUMS){
318
+ $err[] = 'Line #' . $currLineNum . ': skipped, expected number of columns is ' . self::COL_NUMS;
319
+ continue;
320
+ }
321
+
322
+ for ($i = 0; $i < self::COL_NUMS; $i++) {
323
+ $line[$i] = str_replace(array("\r", "\n", "\t", "\\" ,'"', "'", "*"), '', $line[$i]);
324
+ }
325
+
326
+ $countries = array('');
327
+ if ($line[0]){
328
+ $countries = explode(',', $line[0]);
329
+ } else {
330
+ $line[0] = '0';
331
+ }
332
+ $states = array('');
333
+ if ($line[1]){
334
+ $states = explode(',', $line[1]);
335
+ }
336
+
337
+ $types = array('');
338
+ if ($line[11]){
339
+ $types = explode(',', $line[11]);
340
+ }
341
+
342
+ $zips = array('');
343
+ if ($line[3]){
344
+ $zips = explode(',', $line[3]);
345
+ }
346
+
347
+ if(!$line[6]) $line[6] = 999999;
348
+ if(!$line[8]) $line[8] = 999999;
349
+ if(!$line[10]) $line[10] = 999999;
350
+
351
+ foreach ($types as $type){
352
+ if ($type == 'All'){
353
+ $type = 0;
354
+ }
355
+ if ($type && empty($typeLabels[$type])) {
356
+ if (in_array($type, $typeLabels)){
357
+ $typeLabels[$type] = array_search($type, $typeLabels);
358
+ } else {
359
+ $err[] = 'Line #' . $currLineNum . ': invalid type code ' . $type;
360
+ continue;
361
+ }
362
+
363
+ }
364
+ $line[11] = $type ? $typeLabels[$type] : '';
365
+ }
366
+
367
+ foreach ($countries as $country){
368
+ if ($country == 'All'){
369
+ $country = 0;
370
+ }
371
+
372
+ if ($country && empty($countryCodes[$country])) {
373
+ if (in_array($country, $countryNames)){
374
+ $countryCodes[$country] = array_search($country, $countryNames);
375
+ } else {
376
+ $err[] = 'Line #' . $currLineNum . ': invalid country code ' . $country;
377
+ continue;
378
+ }
379
+
380
+ }
381
+ $line[0] = $country ? $countryCodes[$country] : '';
382
+
383
+ foreach ($states as $state){
384
+
385
+ if ($state == 'All'){
386
+ $state = '';
387
+ }
388
+
389
+ if ($state && empty($stateCodes[$state][$country])) {
390
+ if (in_array($state, $stateNames)){
391
+ $stateCodes[$state][$country] = array_search($state, $stateNames);
392
+ } else {
393
+ $err[] = 'Line #' . $currLineNum . ': invalid state code ' . $state;
394
+ continue;
395
+ }
396
+
397
+ }
398
+ $line[1] = $state ? $stateCodes[$state][$country] : '';
399
+
400
+ foreach ($zips as $zip){
401
+ $line[3] = $zip;
402
+
403
+
404
+ $data[$dataIndex] = $line;
405
+ $dataIndex++;
406
+
407
+ if ($dataIndex > 5000){
408
+ $err2 = $this->getResource()->batchInsert($methodId, $data);
409
+ if ($err2){
410
+ $err[] = 'Line #' . $currLineNum . ': duplicated conditions before this line have been skipped';
411
+ }
412
+ $data = array();
413
+ $dataIndex = 0;
414
+ }
415
+ }
416
+ }// states
417
+ }// countries
418
+ } // end while read
419
+ fclose($fp);
420
+
421
+ if ($dataIndex){
422
+ $err2 = $this->getResource()->batchInsert($methodId, $data);
423
+
424
+ if ($err2){
425
+ $err[] = 'Line #' . $currLineNum . ': duplicated conditions before this line have been skipped';
426
+ }
427
+ }
428
+
429
+ return $err;
430
+ }
431
+
432
+ public function getCountries()
433
+ {
434
+ $hash = array();
435
+
436
+ $collection = Mage::getResourceModel('directory/country_collection');
437
+ foreach ($collection as $item){
438
+ $hash[$item->getIso3Code()] = $item->getCountryId();
439
+ $hash[$item->getIso2Code()] = $item->getCountryId();
440
+ }
441
+
442
+ return $hash;
443
+ }
444
+
445
+ public function getStates()
446
+ {
447
+ $hash = array();
448
+
449
+ $collection = Mage::getResourceModel('directory/region_collection');
450
+ foreach ($collection as $state){
451
+ $hash[$state->getCode()][$state->getCountryId()] = $state->getRegionId();
452
+ }
453
+
454
+ return $hash;
455
+ }
456
+ public function getCountriesName()
457
+ {
458
+ $hash = array();
459
+ $collection = Mage::getResourceModel('directory/country_collection');
460
+ foreach ($collection as $item){
461
+ $country_name=Mage::app()->getLocale()->getCountryTranslation($item->getIso2Code());
462
+ $hash[$item->getCountryId()] = $country_name;
463
+
464
+ }
465
+ return $hash;
466
+ }
467
+
468
+
469
+ public function getStatesName()
470
+ {
471
+ $hash = array();
472
+
473
+ $collection = Mage::getResourceModel('directory/region_collection');
474
+ $countryHash = $this->getCountriesName();
475
+ foreach ($collection as $state){
476
+ $string = $countryHash[$state->getCountryId()].'/'.$state->getDefaultName();
477
+ $hash[$state->getRegionId()] = $string;
478
+ }
479
+ return $hash;
480
+ }
481
+
482
+ public function initTotals()
483
+ {
484
+ $totals = array(
485
+ // 'price' => 0,
486
+ 'not_free_price' => 0,
487
+ // 'weight' => 0,
488
+ 'not_free_weight' => 0,
489
+ 'qty' => 0,
490
+ 'not_free_qty' => 0,
491
+ 'tax_amount' => 0,
492
+ 'discount_amount' => 0,
493
+ );
494
+ return $totals;
495
+ }
496
+
497
+ public function deleteBy($methodId)
498
+ {
499
+ return $this->getResource()->deleteBy($methodId);
500
+ }
501
+ }
app/code/community/Synotive/Table/controllers/Adminhtml/MethodController.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Adminhtml_MethodController extends Mage_Adminhtml_Controller_Action
18
+ {
19
+ protected $_title = 'All in One Shipping';
20
+ protected $_modelName = 'method';
21
+
22
+ protected function _setActiveMenu($menuPath)
23
+ {
24
+ $this->getLayout()->getBlock('menu')->setActive($menuPath);
25
+ $this->_title($this->__('Sales'))->_title($this->__($this->_title));
26
+ return $this;
27
+ }
28
+
29
+ public function indexAction()
30
+ {
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('sales/synotivetable/' . $this->_modelName . 's');
33
+ $this->_addContent($this->getLayout()->createBlock('synotivetable/adminhtml_' . $this->_modelName));
34
+ $this->renderLayout();
35
+ }
36
+
37
+ public function newAction()
38
+ {
39
+ $this->editAction();
40
+ }
41
+
42
+ public function editAction()
43
+ {
44
+ $id = (int) $this->getRequest()->getParam('id');
45
+ $model = Mage::getModel('synotivetable/' . $this->_modelName)->load($id);
46
+
47
+ if ($id && !$model->getId()) {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('synotivetable')->__('Record does not exist'));
49
+ $this->_redirect('*/*/');
50
+ return;
51
+ }
52
+
53
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
54
+ if (!empty($data)) {
55
+ $model->setData($data);
56
+ }
57
+ else {
58
+ $this->prepareForEdit($model);
59
+ }
60
+
61
+ Mage::register('synotivetable_' . $this->_modelName, $model);
62
+
63
+ $this->loadLayout();
64
+
65
+ $this->_setActiveMenu('sales/synotivetable/' . $this->_modelName . 's');
66
+ $this->_title($this->__('Edit'));
67
+
68
+ $this->_addContent($this->getLayout()->createBlock('synotivetable/adminhtml_' . $this->_modelName . '_edit'));
69
+ $this->_addLeft($this->getLayout()->createBlock('synotivetable/adminhtml_' . $this->_modelName . '_edit_tabs'));
70
+
71
+ $this->renderLayout();
72
+ }
73
+
74
+ public function saveAction()
75
+ {
76
+ $id = $this->getRequest()->getParam('id');
77
+ $model = Mage::getModel('synotivetable/' . $this->_modelName);
78
+ $data = $this->getRequest()->getPost();
79
+ if ($data) {
80
+ $model->setData($data);
81
+ $model->setId($id);
82
+ try {
83
+ $this->prepareForSave($model);
84
+
85
+ $model->save();
86
+
87
+ if ($model->getData('import_clear')){
88
+ Mage::getModel('synotivetable/rate')->deleteBy($model->getId());
89
+ }
90
+
91
+ // import files
92
+ if (!empty($_FILES['import_file']['name'])){
93
+ $fileName = $_FILES['import_file']['tmp_name'];
94
+ ini_set('auto_detect_line_endings', 1);
95
+
96
+ $errors = Mage::getModel('synotivetable/rate')->import($model->getId(), $fileName);
97
+ foreach ($errors as $err){
98
+ Mage::getSingleton('adminhtml/session')->addError($err);
99
+ }
100
+ }
101
+
102
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
103
+
104
+ $msg = Mage::helper('synotivetable')->__('Shipping rates have been successfully saved');
105
+ Mage::getSingleton('adminhtml/session')->addSuccess($msg);
106
+ if ($this->getRequest()->getParam('continue')){
107
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
108
+ }
109
+ else {
110
+ $this->_redirect('*/*');
111
+ }
112
+ }
113
+ catch (Exception $e) {
114
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
115
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
116
+ $this->_redirect('*/*/edit', array('id' => $id));
117
+ }
118
+ return;
119
+ }
120
+
121
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('synotivetable')->__('Unable to find a record to save'));
122
+ $this->_redirect('*/*');
123
+ }
124
+
125
+ public function massActivateAction()
126
+ {
127
+ return $this->_modifyStatus(1);
128
+ }
129
+
130
+ public function massInactivateAction()
131
+ {
132
+ return $this->_modifyStatus(0);
133
+ }
134
+
135
+ protected function _modifyStatus($status)
136
+ {
137
+ $ids = $this->getRequest()->getParam('methods');
138
+ if ($ids && is_array($ids)){
139
+ try {
140
+ Mage::getModel('synotivetable/' . $this->_modelName)->massChangeStatus($ids, $status);
141
+ $message = $this->__('Total of %d record(s) have been updated.', count($ids));
142
+ $this->_getSession()->addSuccess($message);
143
+ }
144
+ catch (Exception $e) {
145
+ $this->_getSession()->addError($e->getMessage());
146
+ }
147
+ }
148
+ else {
149
+ $this->_getSession()->addError($this->__('Please select method(s).'));
150
+ }
151
+
152
+ return $this->_redirect('*/*');
153
+ }
154
+
155
+ public function prepareForSave($model)
156
+ {
157
+ $fields = array('stores', 'cust_groups');
158
+ foreach ($fields as $f){
159
+ // convert data from array to string
160
+ $val = $model->getData($f);
161
+ $model->setData($f, '');
162
+ if (is_array($val)){
163
+ // need commas to simplify sql query
164
+ $model->setData($f, ',' . implode(',', $val) . ',');
165
+ }
166
+ }
167
+ return true;
168
+ }
169
+
170
+ public function prepareForEdit($model)
171
+ {
172
+ $fields = array('stores', 'cust_groups');
173
+ foreach ($fields as $f){
174
+ $val = $model->getData($f);
175
+ if (!is_array($val)){
176
+ $model->setData($f, explode(',', $val));
177
+ }
178
+ }
179
+ return true;
180
+ }
181
+
182
+ protected function _title($text = null, $resetIfExists = true)
183
+ {
184
+ /* if (Mage::helper('synotivebase')->isVersionLessThan(1,4)){
185
+ return $this;
186
+ }*/
187
+ return parent::_title($text, $resetIfExists);
188
+ }
189
+ }
app/code/community/Synotive/Table/controllers/Adminhtml/RateController.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Synotive
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Synotive
13
+ * @package Synotive_Table
14
+ * @copyright Copyright (c) 2015 Synotive.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Synotive_Table_Adminhtml_RateController extends Mage_Adminhtml_Controller_Action
18
+ {
19
+ public function indexAction()
20
+ {
21
+ $html = $this->getLayout()->createBlock('synotivetable/adminhtml_rates')->toHtml();
22
+ $this->getResponse()->setBody($html);
23
+ }
24
+
25
+ public function exportCsvAction()
26
+ {
27
+ $content = $this->getLayout()->createBlock('synotivetable/adminhtml_rates')
28
+ ->getCsvFile();
29
+ $this->_prepareDownloadResponse('shippingrates.csv', $content);
30
+ }
31
+
32
+ public function editAction()
33
+ {
34
+ $id = (int) $this->getRequest()->getParam('id');
35
+ $model = Mage::getModel('synotivetable/rate')->load($id);
36
+ $mid = (int) $this->getRequest()->getParam('mid');
37
+
38
+ if (!$mid && !$model->getId()) {
39
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('synotivetable')->__('Record #%d does not exist', $id));
40
+ $this->_redirect('synotivetable/adminhtml_method/index');
41
+ return;
42
+ }
43
+
44
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
45
+ if (!empty($data)) {
46
+ $model->setData($data);
47
+ }
48
+
49
+ if ($mid && !$model->getId()){
50
+ $model->setMethodId($mid);
51
+ $model->setWeightFrom('0');
52
+ $model->setQtyFrom('0');
53
+ $model->setPriceFrom('0');
54
+ $model->setWeightTo('999999');
55
+ $model->setQtyTo('999999');
56
+ $model->setPriceTo('999999');
57
+ }
58
+
59
+ Mage::register('synotivetable_rate', $model);
60
+
61
+ $this->loadLayout();
62
+
63
+ $this->_setActiveMenu('sales/synotivetable');
64
+ $this->_addContent($this->getLayout()->createBlock('synotivetable/adminhtml_rate_edit'));
65
+
66
+ $this->renderLayout();
67
+ }
68
+
69
+ public function saveAction()
70
+ {
71
+ $id = $this->getRequest()->getParam('id');
72
+ $mid = $this->getRequest()->getParam('mid');
73
+ $model = Mage::getModel('synotivetable/rate')->load($id);
74
+
75
+ $data = $this->getRequest()->getPost();
76
+ if (!$data) {
77
+ Mage::getSingleton('adminhtml/session')->addError(
78
+ Mage::helper('synotivetable')->__('Unable to find a rate to save'));
79
+ $this->_redirect('synotivetable/adminhtml_method/index');
80
+ return;
81
+ }
82
+
83
+ try {
84
+
85
+ $methodId = $model->getMethodId();
86
+ if (!$methodId)
87
+ {
88
+ $methodId = $data['method_id'];
89
+ }
90
+ $model->setData($data)->setId($id);
91
+ $model->save();
92
+
93
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
94
+
95
+ $msg = Mage::helper('synotivetable')->__('Rate has been successfully saved');
96
+ Mage::getSingleton('adminhtml/session')->addSuccess($msg);
97
+
98
+ $this->_redirect('synotivetable/adminhtml_method/edit', array('id'=> $methodId, 'tab'=>'rates'));
99
+
100
+ }
101
+ catch (Exception $e) {
102
+ Mage::getSingleton('adminhtml/session')->addError('This rate already exist!');
103
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
104
+ $this->_redirect('*/*/edit', array('id' => $id, 'mid'=> $methodId));
105
+ }
106
+ }
107
+
108
+ public function deleteAction()
109
+ {
110
+ $id = $this->getRequest()->getParam('id');
111
+ if (!$id) {
112
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('synotivetable')->__('Unable to find a rate to delete'));
113
+ $this->_redirect('synotivetable/adminhtml_method/index');
114
+ return;
115
+ }
116
+
117
+ try {
118
+ $rate = Mage::getModel('synotivetable/rate')->load($id);
119
+ $methodId = $rate->getMethodId();
120
+
121
+ $rate->delete();
122
+
123
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('synotivetable')->__('Rate has been deleted'));
124
+ $this->_redirect('synotivetable/adminhtml_method/edit', array('id'=>$methodId, 'tab'=>'rates'));
125
+ }
126
+ catch (Exception $e) {
127
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
128
+ $this->_redirect('synotivetables/adminhtml_method/index');
129
+ }
130
+ }
131
+
132
+ }
app/code/community/Synotive/Table/etc/adminhtml.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <menu>
5
+ <sales>
6
+ <children>
7
+ <synotivetable translate="title" module="synotivetable">
8
+ <title>All in One Shipping</title>
9
+ <sort_order>850</sort_order>
10
+ <action>synotivetable/adminhtml_method</action>
11
+ </synotivetable>
12
+ </children>
13
+ </sales>
14
+ </menu>
15
+ <acl>
16
+ <resources>
17
+ <all>
18
+ <title>Allow Everything</title>
19
+ </all>
20
+ <admin>
21
+ <children>
22
+ <sales>
23
+ <children>
24
+ <synotivetable>
25
+ <title>All in One Shipping</title>
26
+ </synotivetable>
27
+ </children>
28
+ </sales>
29
+ <system>
30
+ <children>
31
+ <config>
32
+ <children>
33
+ <carriers>
34
+ <children>
35
+ <synotivetable>
36
+ <title>All in One Shipping</title>
37
+ </synotivetable>
38
+ </children>
39
+ </carriers>
40
+ </children>
41
+ </config>
42
+ </children>
43
+ </system>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+ <translate>
49
+ <modules>
50
+ <Synotive_Table>
51
+ <files>
52
+ <default>Synotive_Table.csv</default>
53
+ </files>
54
+ </Synotive_Table>
55
+ </modules>
56
+ </translate>
57
+ </config>
app/code/community/Synotive/Table/etc/config.xml ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Synotive_Table>
5
+ <version>1.1.0</version>
6
+ </Synotive_Table>
7
+ </modules>
8
+
9
+ <admin>
10
+ <routers>
11
+ <synotivetable>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Synotive_Table</module>
15
+ <frontName>synotivetable</frontName>
16
+ </args>
17
+ </synotivetable>
18
+ </routers>
19
+ </admin>
20
+
21
+ <global>
22
+ <models>
23
+ <synotivetable>
24
+ <class>Synotive_Table_Model</class>
25
+ <resourceModel>synotivetable_mysql4</resourceModel>
26
+ </synotivetable>
27
+ <synotivetable_mysql4>
28
+ <class>Synotive_Table_Model_Mysql4</class>
29
+ <entities>
30
+ <method>
31
+ <table>synotive_table_method</table>
32
+ </method>
33
+ <rate>
34
+ <table>synotive_table_rate</table>
35
+ </rate>
36
+ </entities>
37
+ </synotivetable_mysql4>
38
+ </models>
39
+
40
+ <resources>
41
+ <synotivetable_setup>
42
+ <setup>
43
+ <module>Synotive_Table</module>
44
+ <class>Synotive_Table_Model_Mysql4_Setup</class>
45
+ </setup>
46
+ <connection>
47
+ <use>core_setup</use>
48
+ </connection>
49
+ </synotivetable_setup>
50
+
51
+ <synotivetable_write>
52
+ <connection>
53
+ <use>core_write</use>
54
+ </connection>
55
+ </synotivetable_write>
56
+
57
+ <synotivetable_read>
58
+ <connection>
59
+ <use>core_read</use>
60
+ </connection>
61
+ </synotivetable_read>
62
+ </resources>
63
+
64
+ <blocks>
65
+ <synotivetable>
66
+ <class>Synotive_Table_Block</class>
67
+ </synotivetable>
68
+ </blocks>
69
+
70
+ <helpers>
71
+ <synotivetable>
72
+ <class>Synotive_Table_Helper</class>
73
+ </synotivetable>
74
+ </helpers>
75
+
76
+ <events>
77
+ <sales_quote_config_get_product_attributes>
78
+ <observers>
79
+ <synotivetable>
80
+ <class>synotivetable/observer</class>
81
+ <method>addProductAttributes</method>
82
+ </synotivetable>
83
+ </observers>
84
+ </sales_quote_config_get_product_attributes>
85
+ </events>
86
+ </global>
87
+
88
+ <adminhtml>
89
+ <menu>
90
+ <sales>
91
+ <children>
92
+ <synotivetable translate="title" module="synotivetable">
93
+ <title>All in One Shipping</title>
94
+ <sort_order>850</sort_order>
95
+ <action>synotivetable/adminhtml_method</action>
96
+ </synotivetable>
97
+ </children>
98
+ </sales>
99
+ </menu>
100
+ <acl>
101
+ <resources>
102
+ <all>
103
+ <title>Allow Everything</title>
104
+ </all>
105
+ <admin>
106
+ <children>
107
+ <sales>
108
+ <children>
109
+ <synotivetable>
110
+ <title>All in One Shipping</title>
111
+ </synotivetable>
112
+ </children>
113
+ </sales>
114
+ <system>
115
+ <children>
116
+ <config>
117
+ <children>
118
+ <carriers>
119
+ <children>
120
+ <synotivetable>
121
+ <title>All in One Shipping</title>
122
+ </synotivetable>
123
+ </children>
124
+ </carriers>
125
+ </children>
126
+ </config>
127
+ </children>
128
+ </system>
129
+ </children>
130
+ </admin>
131
+ </resources>
132
+ </acl>
133
+ <translate>
134
+ <modules>
135
+ <Synotive_Table>
136
+ <files>
137
+ <default>Synotive_Table.csv</default>
138
+ </files>
139
+ </Synotive_Table>
140
+ </modules>
141
+ </translate>
142
+ </adminhtml>
143
+
144
+ <default>
145
+ <carriers>
146
+ <synotivetable>
147
+ <active>0</active>
148
+ <title>All in One Shipping</title>
149
+ <sort_order>100</sort_order>
150
+ <sallowspecific>0</sallowspecific>
151
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
152
+ <model>synotivetable/carrier_table</model>
153
+ <allow_promo>1</allow_promo>
154
+ <numeric_zip>1</numeric_zip>
155
+ <ignore_virtual>1</ignore_virtual>
156
+ <after_discount>0</after_discount>
157
+ <including_tax>0</including_tax>
158
+ <dont_split>0</dont_split>
159
+ <showmethod>0</showmethod>
160
+ </synotivetable>
161
+ </carriers>
162
+ </default>
163
+ </config>
app/code/community/Synotive/Table/etc/system.xml ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <carriers>
5
+ <groups>
6
+ <synotivetable translate="label">
7
+ <label>All in One Shipping</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>1</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <sallowspecific translate="label">
32
+ <label>Ship to applicable countries</label>
33
+ <frontend_type>select</frontend_type>
34
+ <sort_order>90</sort_order>
35
+ <frontend_class>shipping-applicable-country</frontend_class>
36
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ </sallowspecific>
41
+ <specificcountry translate="label">
42
+ <label>Ship to Specific countries</label>
43
+ <frontend_type>multiselect</frontend_type>
44
+ <sort_order>95</sort_order>
45
+ <source_model>adminhtml/system_config_source_country</source_model>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>0</show_in_store>
49
+ </specificcountry>
50
+ <specificerrmsg translate="label">
51
+ <label>Displayed Error Message</label>
52
+ <frontend_type>textarea</frontend_type>
53
+ <sort_order>110</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
+ </specificerrmsg>
58
+ <allow_promo translate="label comment">
59
+ <label>Allow Free Shipping Promotions</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>120</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </allow_promo>
67
+ <ignore_virtual translate="label comment">
68
+ <label>Ignore Price and Quantity of Virtual Products</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>adminhtml/system_config_source_yesno</source_model>
71
+ <sort_order>130</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </ignore_virtual>
76
+ <numeric_zip translate="label comment">
77
+ <label>Numeric Zip</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <sort_order>140</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </numeric_zip>
85
+ <after_discount translate="label comment">
86
+ <label>Use price AFTER discount</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>150</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </after_discount>
94
+ <including_tax translate="label comment">
95
+ <label>Use price INCLUDING tax</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <sort_order>160</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </including_tax>
103
+ <sort_order translate="label">
104
+ <label>Sort order</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>170</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </sort_order>
111
+ <dont_split translate="label">
112
+ <label>Use only one shipping type for shipping method</label>
113
+ <frontend_type>select</frontend_type>
114
+ <source_model>adminhtml/system_config_source_yesno</source_model>
115
+ <sort_order>180</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </dont_split>
120
+ <showmethod translate="label">
121
+ <label>Show Method if Not Applicable</label>
122
+ <frontend_type>select</frontend_type>
123
+ <sort_order>200</sort_order>
124
+ <frontend_class>shipping-skip-hide</frontend_class>
125
+ <source_model>adminhtml/system_config_source_yesno</source_model>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </showmethod>
130
+ </fields>
131
+ </synotivetable>
132
+ </groups>
133
+ </carriers>
134
+ </sections>
135
+ </config>
app/code/community/Synotive/Table/sql/synotivetable_setup/mysql4-install-1.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this; //Getting Installer Class Object In A Variable
3
+ $installer->startSetup();
4
+ $installer->run("
5
+
6
+ CREATE TABLE `{$this->getTable('synotivetable/method')}` (
7
+ `method_id` mediumint(8) unsigned NOT NULL auto_increment,
8
+ `is_active` tinyint(1) unsigned NOT NULL default '0',
9
+ `pos` mediumint unsigned NOT NULL default '0',
10
+ `name` varchar(255) default '',
11
+ `stores` varchar(255) NOT NULL default '',
12
+ `cust_groups` varchar(255) NOT NULL default '',
13
+ `shipping_cost` ENUM( 'Per Order', 'Per Product' ) NULL default 'Per Order',
14
+ PRIMARY KEY (`method_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+ INSERT INTO `{$this->getTable('synotivetable/method')}` (`is_active`, `pos`, `name`, `stores`, `cust_groups`, `shipping_cost`) VALUES ('0','1','Free Shipping Method','1','0,1,2,3','Per Order');
18
+ INSERT INTO `{$this->getTable('synotivetable/method')}` (`is_active`, `pos`, `name`, `stores`, `cust_groups`, `shipping_cost`) VALUES ('0','2','Flat Rate Shipping Method','1','0,1,2,3','Per Order');
19
+ INSERT INTO `{$this->getTable('synotivetable/method')}` (`is_active`, `pos`, `name`, `stores`, `cust_groups`, `shipping_cost`) VALUES ('0','3','Based on Zip/Postal Code Shipping Method','1','0,1,2,3','Per Order');
20
+ INSERT INTO `{$this->getTable('synotivetable/method')}` (`is_active`, `pos`, `name`, `stores`, `cust_groups`, `shipping_cost`) VALUES ('0','4','Based on Price Shipping Method','1','0,1,2,3','Per Order');
21
+ INSERT INTO `{$this->getTable('synotivetable/method')}` (`is_active`, `pos`, `name`, `stores`, `cust_groups`, `shipping_cost`) VALUES ('0','5','Based on Weight Shipping Method','1','0,1,2,3','Per Order');
22
+
23
+ CREATE TABLE `{$this->getTable('synotivetable/rate')}` (
24
+ `rate_id` int(10) unsigned NOT NULL auto_increment,
25
+ `method_id` mediumint(8) unsigned NOT NULL,
26
+
27
+ `country` varchar(4) NOT NULL default '',
28
+ `state` int(10) NOT NULL default '0',
29
+ `city` varchar(12) NOT NULL default '',
30
+
31
+ `zip_from` varchar(10) NOT NULL default '',
32
+ `zip_to` varchar(10) NOT NULL default '',
33
+
34
+ `price_from` decimal(12,2) unsigned NOT NULL default '0',
35
+ `price_to` decimal(12,2) unsigned NOT NULL default '0',
36
+
37
+ `weight_from` decimal(12,4) unsigned NOT NULL default '0',
38
+ `weight_to` decimal(12,4) unsigned NOT NULL default '0',
39
+
40
+ `qty_from` int(10) unsigned NOT NULL default '0',
41
+ `qty_to` int(10) unsigned NOT NULL default '0',
42
+
43
+ `cost_base` decimal(12,2) unsigned NOT NULL default '0',
44
+
45
+ PRIMARY KEY (`rate_id`),
46
+ UNIQUE KEY(`method_id`, `country`, `state` , `city`, `zip_from`, `zip_to`, `price_from`, `price_to`, `weight_from`, `weight_to`, `qty_from`, `qty_to`)
47
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
48
+
49
+ ALTER TABLE `{$this->getTable('synotivetable/rate')}` ADD `shipping_type` INT( 10 ) NOT NULL DEFAULT '0' AFTER `qty_to`;
50
+
51
+ ALTER TABLE `{$this->getTable('synotivetable/rate')}` DROP INDEX `method_id` ,
52
+ ADD UNIQUE `method_id` ( `method_id` , `country` , `state` , `city` , `zip_from` , `zip_to` , `price_from` , `price_to` , `weight_from` , `weight_to` , `qty_from` , `qty_to` , `shipping_type` );
53
+
54
+ ");
55
+
56
+ $installer->endSetup();
app/code/community/Synotive/Table/sql/synotivetable_setup/mysql4-upgrade-1-1.1.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
4
+ $installer->startSetup();
5
+
6
+ /**
7
+ * ADDING ATTRIBUTE
8
+ */
9
+ $setup->addAttribute('catalog_product', 'synotive_shipping_type', array(
10
+ 'type' => 'varchar',
11
+ 'backend' => 'eav/entity_attribute_backend_array',
12
+ 'frontend' => '',
13
+ 'label' => 'Shipping Type',
14
+ 'input' => 'select',
15
+ 'class' => '',
16
+ 'source' => '',
17
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
18
+ 'visible' => true,
19
+ 'required' => false,
20
+ 'user_defined' => true,
21
+ 'default' => '0',
22
+ 'searchable' => false,
23
+ 'filterable' => false,
24
+ 'comparable' => false,
25
+ 'visible_on_front' => false,
26
+ 'unique' => false,
27
+ 'apply_to' => '',
28
+ 'is_configurable' => false,
29
+ ));
30
+ $attributeId = $installer->getAttributeId('catalog_product', 'synotive_shipping_type');
31
+
32
+ foreach ($installer->getAllAttributeSetIds('catalog_product') as $attributeSetId)
33
+ {
34
+ try {
35
+ $attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, 'General');
36
+ } catch (Exception $e) {
37
+ $attributeGroupId = $installer->getDefaultAttributeGroupId('catalog_product', $attributeSetId);
38
+ }
39
+ $installer->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
40
+ }
41
+
42
+ $option['attribute_id'] = $attributeId;
43
+ $option['value']['Free Shipping'][0] = 'Free Shipping';
44
+ $option['value']['Flat Rate'][0] = 'Flat Rate';
45
+ $option['value']['Based on Zip/Postal Code'][0] = 'Based on Zip/Postal Code';
46
+ $option['value']['Based on Price'][0] = 'Based on Price';
47
+ $option['value']['Based on Weight'][0] = 'Based on Weight';
48
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
49
+ $setup->addAttributeOption($option);
50
+
51
+ $installer->endSetup();
app/etc/modules/Synotive_Table.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Synotive_Table>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Synotive_Table>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>All_in_One_Shipping</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>All in One Shipping Extension helps you to make different shipping method calculation and configuration easily.</summary>
10
+ <description>All in One Shipping Extension helps you to make different shipping method calculation and configuration easily.</description>
11
+ <notes>All in One Shipping Extension is stabled version. </notes>
12
+ <authors><author><name>Synotive Technologies</name><user>Synotive</user><email>magento@synotive.com</email></author></authors>
13
+ <date>2015-01-27</date>
14
+ <time>09:55:22</time>
15
+ <contents><target name="magecommunity"><dir name="Synotive"><dir name="Table"><dir name="Block"><dir name="Adminhtml"><dir name="Method"><dir name="Edit"><file name="Form.php" hash="6c36e8b3abafa067741c864bfd6c8aab"/><dir name="Tab"><file name="General.php" hash="52db3ea2595b528aec71a28d0506e60b"/><file name="Import.php" hash="a398344950ba80d759730f5f640c2a61"/><file name="Stores.php" hash="08742aabadb2891cf0abbcf22ea645c9"/></dir><file name="Tabs.php" hash="8d351496bdbf68662c0b721bcb6d5550"/></dir><file name="Edit.php" hash="5543d3cd6f321e1dfde42a6d7028bfb5"/><file name="Grid.php" hash="739082d10a861015b830f155656b2f1a"/></dir><file name="Method.php" hash="e5451b0de16b6d6055a90196820e3b62"/><dir name="Rate"><dir name="Edit"><file name="Form.php" hash="1a2746be8fe4a9cfced1bdb2334d157a"/></dir><file name="Edit.php" hash="33cee06bf557e44fd39d04a2a5d24021"/></dir><file name="Rates.php" hash="b69f78ef77eb616cbce984c41a829860"/></dir></dir><dir name="Helper"><file name="Data.php" hash="27611f87f4dda22db1e5b6c8af4ba428"/></dir><dir name="Model"><dir name="Carrier"><file name="Table.php" hash="d3b340f2a867a0486972c24d5dc8779c"/></dir><dir name="Config"><dir name="Source"><file name="Option.php" hash="4a949551be55afee833353eb02dfdabe"/><file name="Ziptype.php" hash="9f5be1e8c2b6856abf2a64930dfd452f"/></dir></dir><file name="Method.php" hash="05ca7e6a1c9e41d0fb97b7db07b17f7f"/><dir name="Mysql4"><dir name="Method"><file name="Collection.php" hash="a46243dbf73a28b0d24d95e4255dc45f"/></dir><file name="Method.php" hash="a022cb893a91e01f5a835bff88ef6f13"/><dir name="Rate"><file name="Collection.php" hash="9e41d962197c50c0137c0ee13a3a542f"/></dir><file name="Rate.php" hash="5178e939efef974105b4136da812d650"/><file name="Setup.php" hash="13406fe5c7f9ec267815a95d6d012e67"/></dir><file name="Observer.php" hash="aab7cb6f4c2013425d63010972e0d35d"/><file name="Rate.php" hash="58cdb6a05fbf964156ce35b6eb687056"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MethodController.php" hash="f1e5b89fce1ea8dac3da27244697b1ab"/><file name="RateController.php" hash="0f279fa1adc9a269af2d61b239a05259"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9f8eaaef726e66f36d0166495fd071e5"/><file name="config.xml" hash="26ae4885184c1ae76b95c24fc4f7378c"/><file name="system.xml" hash="13da9bfbc2ceec40bd4c10a5e52932c9"/></dir><dir name="sql"><dir name="synotivetable_setup"><file name="mysql4-install-1.php" hash="0161673a3ec6162c9dd93660bc0e069c"/><file name="mysql4-upgrade-1-1.1.php" hash="0638516e63fe6ec9011029fcb681b49c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Synotive_Table.xml" hash="f6bf958a995cbfea601d45a8bcb8e7de"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.5.0</max></php></required></dependencies>
18
+ </package>