Iweb_Dropshipper - Version 1.0.0

Version Notes

This Module is used to assign item to dropshipper.When order get Placed then admin can send Dropshipper mail from admin or can send mail automatically by selecting option from admin To Notify Dropshipper That Your item has been Placed with Shiping Info.

Download this release

Release Info

Developer sujit
Extension Iweb_Dropshipper
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (37) hide show
  1. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper.php +18 -0
  2. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit.php +39 -0
  3. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Form.php +24 -0
  4. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Ajax/Serializer.php +47 -0
  5. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Form.php +77 -0
  6. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Product.php +216 -0
  7. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tabs.php +89 -0
  8. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Grid.php +127 -0
  9. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Sales/Order/View/Tab/Dropshipper.php +73 -0
  10. app/code/local/Iweb/Dropshipper/Block/Adminhtml/Widget/Grid/Column/Renderer/Input.php +62 -0
  11. app/code/local/Iweb/Dropshipper/Helper/Data.php +14 -0
  12. app/code/local/Iweb/Dropshipper/Model/Dropshipper.php +30 -0
  13. app/code/local/Iweb/Dropshipper/Model/Observer.php +119 -0
  14. app/code/local/Iweb/Dropshipper/Model/Order.php +22 -0
  15. app/code/local/Iweb/Dropshipper/Model/Product.php +75 -0
  16. app/code/local/Iweb/Dropshipper/Model/Resource/Dropshipper.php +16 -0
  17. app/code/local/Iweb/Dropshipper/Model/Resource/Dropshipper/Collection.php +16 -0
  18. app/code/local/Iweb/Dropshipper/Model/Resource/Order.php +54 -0
  19. app/code/local/Iweb/Dropshipper/Model/Resource/Order/Collection.php +16 -0
  20. app/code/local/Iweb/Dropshipper/Model/Resource/Product.php +78 -0
  21. app/code/local/Iweb/Dropshipper/Model/Resource/Product/Collection.php +16 -0
  22. app/code/local/Iweb/Dropshipper/Model/Status.php +20 -0
  23. app/code/local/Iweb/Dropshipper/Model/System/Config/Source/Order/Status.php +37 -0
  24. app/code/local/Iweb/Dropshipper/controllers/Adminhtml/DropshipperController.php +271 -0
  25. app/code/local/Iweb/Dropshipper/controllers/Adminhtml/OrderController.php +145 -0
  26. app/code/local/Iweb/Dropshipper/etc/adminhtml.xml +37 -0
  27. app/code/local/Iweb/Dropshipper/etc/config.xml +186 -0
  28. app/code/local/Iweb/Dropshipper/etc/system.xml +92 -0
  29. app/code/local/Iweb/Dropshipper/sql/iweb_dropshipper_setup/mysql4-install-0.0.1.php +135 -0
  30. app/design/adminhtml/default/default/layout/iweb-dropshipper.xml +24 -0
  31. app/design/adminhtml/default/default/template/dropshipper/order/view/products.phtml +81 -0
  32. app/design/frontend/base/default/layout/iweb-dropshipper.xml +12 -0
  33. app/design/frontend/base/default/template/dropshipper/email/items.phtml +19 -0
  34. app/design/frontend/base/default/template/dropshipper/email/items/default.phtml +59 -0
  35. app/etc/modules/Iweb_Dropshipper.xml +17 -0
  36. app/locale/en_US/template/email/sales/dropshipper.html +83 -0
  37. package.xml +19 -0
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ $this->_controller = 'adminhtml_dropshipper';
13
+ $this->_blockGroup = 'iweb_dropshipper';
14
+ $this->_headerText = Mage::helper('iweb_dropshipper')->__('Dropshipper Manager');
15
+ $this->_addButtonLabel = Mage::helper('iweb_dropshipper')->__('Add');
16
+ parent::__construct();
17
+ }
18
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'iweb_dropshipper';
16
+ $this->_controller = 'adminhtml_dropshipper';
17
+
18
+ $this->_addButton('saveandcontinue', array(
19
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
20
+ 'onclick' => 'saveAndContinueEdit()',
21
+ 'class' => 'save',
22
+ ), -100);
23
+
24
+ $this->_formScripts[] = "
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry('dropshipper_data') && Mage::registry('dropshipper_data')->getId() ) {
34
+ return Mage::helper('iweb_dropshipper')->__("Edit Dropshipper '%s'", $this->htmlEscape(Mage::registry('dropshipper_data')->getName()));
35
+ } else {
36
+ return Mage::helper('iweb_dropshipper')->__('Add Dropshipper');
37
+ }
38
+ }
39
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Form.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+ protected function _prepareForm()
11
+ {
12
+ $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ )
18
+ );
19
+
20
+ $form->setUseContainer(true);
21
+ $this->setForm($form);
22
+ return parent::_prepareForm();
23
+ }
24
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Ajax/Serializer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit_Tab_Ajax_Serializer extends Mage_Core_Block_Template
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate('catalog/product/edit/serializer.phtml');
14
+ return $this;
15
+ }
16
+
17
+ public function getProductsJSON()
18
+ {
19
+ $result = array();
20
+ if ($this->getProducts()) {
21
+ $isEntityId = $this->getIsEntityId();
22
+ foreach ($this->getProducts() as $product) {
23
+ $id = $isEntityId ? $product->getEntityId() : $product->getId();
24
+ $result[$id] = $product->toArray($this->getAttributes());
25
+ }
26
+ }
27
+
28
+ return $result ? Zend_Json_Encoder::encode($result) : '{}';
29
+ }
30
+
31
+ /**
32
+ * Initialize grid block under the "Related Products", "Up-sells", "Cross-sells" sections
33
+ *
34
+ * @param string $blockName
35
+ * @param string $getProductFunction
36
+ * @param string $inputName
37
+ */
38
+ public function initSerializerBlock($blockName, $getProductFunction, $inputName,$attributes)
39
+ {
40
+ if ($block = $this->getLayout()->getBlock($blockName)) {
41
+ $this->setGridBlock($block)
42
+ ->setProducts($getProductFunction)
43
+ ->setInputElementName($inputName)
44
+ ->setAttributes($attributes);
45
+ }
46
+ }
47
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Form.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+
11
+ protected function _prepareForm()
12
+ {
13
+ $form = new Varien_Data_Form();
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('dropshipper_form', array('legend'=>Mage::helper('iweb_dropshipper')->__('Dropshipper information')));
16
+
17
+ $fieldset->addField('name', 'text', array(
18
+ 'label' => Mage::helper('iweb_dropshipper')->__('Supplier Name'),
19
+ 'class' => 'required-entry',
20
+ 'required' => true,
21
+ 'name' => 'supplier_name'
22
+ ));
23
+
24
+ $fieldset->addField('email', 'text', array(
25
+ 'label' => Mage::helper('iweb_dropshipper')->__('Email'),
26
+ 'class' => 'required-entry',
27
+ 'required' => true,
28
+ 'name' => 'email',
29
+ ));
30
+
31
+ $fieldset->addField('address', 'text', array(
32
+ 'label' => Mage::helper('iweb_dropshipper')->__('Address'),
33
+ 'name' => 'address',
34
+ ));
35
+
36
+ $fieldset->addField('city', 'text', array(
37
+ 'label' => Mage::helper('iweb_dropshipper')->__('City'),
38
+ 'name' => 'city',
39
+ ));
40
+
41
+ $fieldset->addField('state', 'text', array(
42
+ 'label' => Mage::helper('iweb_dropshipper')->__('State'),
43
+ 'name' => 'state',
44
+ ));
45
+
46
+ $fieldset->addField('country', 'text', array(
47
+ 'label' => Mage::helper('iweb_dropshipper')->__('Country'),
48
+ 'name' => 'country',
49
+ ));
50
+
51
+ $fieldset->addField('status', 'select', array(
52
+ 'label' => Mage::helper('iweb_dropshipper')->__('Status'),
53
+ 'name' => 'status',
54
+ 'values' => array(
55
+ array(
56
+ 'value' => 1,
57
+ 'label' => Mage::helper('iweb_dropshipper')->__('Enabled'),
58
+ ),
59
+
60
+ array(
61
+ 'value' => 2,
62
+ 'label' => Mage::helper('iweb_dropshipper')->__('Disabled'),
63
+ ),
64
+ ),
65
+ ));
66
+
67
+
68
+ if ( Mage::getSingleton('adminhtml/session')->getDropshipperData() )
69
+ {
70
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getDropshipperData());
71
+ Mage::getSingleton('adminhtml/session')->setDropshipperData(null);
72
+ } elseif ( Mage::registry('dropshipper_data') ) {
73
+ $form->setValues(Mage::registry('dropshipper_data')->getData());
74
+ }
75
+ return parent::_prepareForm();
76
+ }
77
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tab/Product.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ * @category Iweb
5
+ * @package Iweb_Dropshipper
6
+ */
7
+
8
+ /**
9
+ * Product in Dropshipper from
10
+ *
11
+ * @category Iweb
12
+ * @package Iweb_Dropshipper
13
+ */
14
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit_Tab_Product extends Mage_Adminhtml_Block_Widget_Grid
15
+ {
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('dropshipper_products');
26
+ $this->setDefaultSort('entity_id');
27
+ $this->setUseAjax(true);
28
+ if ($this->getDropshipper()->getId()) {
29
+ $this->setDefaultFilter(array('in_products' => 1));
30
+ }
31
+ if ($this->isReadonly()) {
32
+ $this->setFilterVisibility(false);
33
+ }
34
+ }
35
+
36
+ public function getDropshipper()
37
+ {
38
+ return Mage::registry('dropshipper_data');
39
+ }
40
+
41
+ protected function _addColumnFilterToCollection($column)
42
+ {
43
+ // Set custom filter for in product flag
44
+ if ($column->getId() == 'in_products') {
45
+ $productIds = $this->_getSelectedProducts();
46
+ if (empty($productIds)) {
47
+ $productIds = 0;
48
+ }
49
+ if ($column->getFilter()->getValue()) {
50
+ $this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
51
+ } else {
52
+ if($productIds) {
53
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
54
+ }
55
+ }
56
+ } else {
57
+ parent::_addColumnFilterToCollection($column);
58
+ }
59
+ return $this;
60
+ }
61
+ protected function _prepareCollection()
62
+ {
63
+ $store = $this->_getStore();
64
+ $collection = Mage::getModel('catalog/product')->getCollection()
65
+ ->addAttributeToSelect('name')
66
+ ->addAttributeToSelect('sku')
67
+ ->addAttributeToSelect('price')
68
+ ->addAttributeToSelect('cost')
69
+ ->addAttributeToFilter('type_id',Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
70
+ ->addStoreFilter($this->getRequest()->getParam('store'));
71
+
72
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
73
+ $collection->joinField('qty',
74
+ 'cataloginventory/stock_item',
75
+ 'qty',
76
+ 'product_id=entity_id',
77
+ '{{table}}.stock_id=1',
78
+ 'left');
79
+ }
80
+
81
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId());
82
+
83
+ if ($this->isReadonly()) {
84
+ $productIds = $this->_getSelectedProducts();
85
+ if (empty($productIds)) {
86
+ $productIds = array(0);
87
+ }
88
+ $collection->addFieldToFilter('entity_id', array('in' => $productIds));
89
+ }
90
+
91
+ $this->setCollection($collection);
92
+ return parent::_prepareCollection();
93
+ }
94
+
95
+ /**
96
+ * Checks when this block is readonly
97
+ *
98
+ * @return boolean
99
+ */
100
+ public function isReadonly()
101
+ {
102
+ return false;
103
+ }
104
+ protected function _prepareColumns()
105
+ {
106
+ if (!$this->isReadonly()) {
107
+ $this->addColumn('in_products', array(
108
+ 'header_css_class' => 'a-center',
109
+ 'type' => 'checkbox',
110
+ 'name' => 'in_products',
111
+ 'values' => $this->_getSelectedProducts(),
112
+ 'align' => 'center',
113
+ 'index' => 'entity_id'
114
+ ));
115
+ }
116
+
117
+ $this->addColumn('entity_id', array(
118
+ 'header' => Mage::helper('iweb_dropshipper')->__('ID'),
119
+ 'sortable' => true,
120
+ 'width' => '60',
121
+ 'index' => 'entity_id'
122
+ ));
123
+
124
+ $this->addColumn('name', array(
125
+ 'header' => Mage::helper('iweb_dropshipper')->__('Name'),
126
+ 'index' => 'name'
127
+ ));
128
+ $this->addColumn('sku', array(
129
+ 'header' => Mage::helper('iweb_dropshipper')->__('SKU'),
130
+ 'width' => '80',
131
+ 'index' => 'sku'
132
+ ));
133
+ $this->addColumn('type',
134
+ array(
135
+ 'header'=> Mage::helper('iweb_dropshipper')->__('Type'),
136
+ 'width' => '60px',
137
+ 'index' => 'type_id',
138
+ 'type' => 'options',
139
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray()
140
+ ));
141
+
142
+ $this->addColumn('visibility',
143
+ array(
144
+ 'header'=> Mage::helper('catalog')->__('Visibility'),
145
+ 'width' => '70px',
146
+ 'index' => 'visibility',
147
+ 'type' => 'options',
148
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
149
+ ));
150
+
151
+ $this->addColumn('price', array(
152
+ 'header' => Mage::helper('iweb_dropshipper')->__('Price'),
153
+ 'type' => 'currency',
154
+ 'width' => '1',
155
+ 'renderer' => 'Iweb_Dropshipper_Block_Adminhtml_Widget_Grid_Column_Renderer_Input',
156
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
157
+ 'index' => 'price'
158
+ ));
159
+
160
+ $this->addColumn('cost', array(
161
+ 'header' => Mage::helper('iweb_dropshipper')->__('Cost'),
162
+ 'type' => 'currency',
163
+ 'width' => '1',
164
+ 'renderer' => 'Iweb_Dropshipper_Block_Adminhtml_Widget_Grid_Column_Renderer_Input',
165
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
166
+ 'index' => 'cost'
167
+ ));
168
+
169
+ $this->addColumn('qty', array(
170
+ 'header' => Mage::helper('iweb_dropshipper')->__('STOCK'),
171
+ 'renderer' => 'Iweb_Dropshipper_Block_Adminhtml_Widget_Grid_Column_Renderer_Input',
172
+ 'width' => '1',
173
+ 'index' => 'qty',
174
+ ));
175
+
176
+ return parent::_prepareColumns();
177
+ }
178
+
179
+ public function getGridUrl()
180
+ {
181
+ return $this->getUrl('*/*/productGrid', array('_current'=>true));
182
+ }
183
+
184
+ protected function _getSelectedProducts()
185
+ {
186
+ $products = $this->getProductsSelected();
187
+ return $products;
188
+ }
189
+
190
+ protected function getProductsSelected()
191
+ {
192
+
193
+ if(Mage::registry('dropshipper_data')->getDshipper_id()){
194
+ $products = Mage::getModel('catalog/product')->getCollection();
195
+ $dshipper_id = Mage::registry('dropshipper_data')->getDshipper_id();
196
+ $products->addAttributeToFilter('visibility',array('neq'=>1));
197
+ $products->getSelect()
198
+ ->join(
199
+ array('dshipproduct'=> $products->getTable('iweb_dropshipper/product')),
200
+ 'e.entity_id = dshipproduct.product_id AND dshipproduct.dshipper_id = '.$dshipper_id
201
+ );
202
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
203
+
204
+ $products = $products->getAllIds();
205
+
206
+ }else{
207
+ $products = null;
208
+ }
209
+
210
+ return $products;
211
+ }
212
+
213
+
214
+
215
+ }
216
+
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Edit/Tabs.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setId('dropshipper_tabs');
15
+ $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('iweb_dropshipper')->__('Dropshipper Information'));
17
+ }
18
+
19
+ protected function _prepareLayout()
20
+ {
21
+ $this->getLayout()->getBlock('head')
22
+ ->addItem('skin_js', 'dropshipper/product.js');
23
+ parent::_prepareLayout();
24
+ }
25
+ protected function _beforeToHtml()
26
+ {
27
+ $this->addTab('form_section', array(
28
+ 'label' => Mage::helper('iweb_dropshipper')->__('General'),
29
+ 'title' => Mage::helper('iweb_dropshipper')->__('General'),
30
+ 'content' => $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit_tab_form')->toHtml(),
31
+ ));
32
+
33
+ $blocks = $this->getOutputBlock();
34
+ $this->addTab('products', array(
35
+ 'label' => Mage::helper('iweb_dropshipper')->__('Products'),
36
+ 'content' => $this->_outputBlocks($blocks['gridBlock'], $blocks['serializerBlock']),
37
+ ));
38
+
39
+ return parent::_beforeToHtml();
40
+ }
41
+
42
+ protected function _createSerializerBlock($inputName, Mage_Adminhtml_Block_Widget_Grid $gridBlock, $productsArray)
43
+ {
44
+ return $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit_tab_ajax_serializer')
45
+ ->setGridBlock($gridBlock)
46
+ ->setProducts($productsArray)
47
+ ->setInputElementName($inputName)
48
+ ->setAttributes(array('status'));
49
+ }
50
+
51
+ /**
52
+ * Output specified blocks as a text list
53
+ */
54
+ protected function _outputBlocks()
55
+ {
56
+ $blocks = func_get_args();
57
+ $output = $this->getLayout()->createBlock('adminhtml/text_list');
58
+ foreach ($blocks as $block) {
59
+ $output->insert($block, '', true);
60
+ }
61
+ return $output->toHtml();
62
+ }
63
+
64
+ protected function getOutputBlock()
65
+ {
66
+ if(Mage::registry('dropshipper_data')->getDshipper_id()){
67
+ $dshipper_id = Mage::registry('dropshipper_data')->getDshipper_id();
68
+ $dropshipper_product = Mage::getModel('catalog/product')->getCollection();
69
+ $dropshipper_product ->addAttributeToFilter('visibility',array('neq'=>1));
70
+
71
+
72
+ $dropshipper_product->getSelect()
73
+ ->join(
74
+ array('dshipproduct'=> $dropshipper_product->getTable('iweb_dropshipper/product')),
75
+ 'e.entity_id = dshipproduct.product_id AND dshipproduct.dshipper_id = '.$dshipper_id
76
+ );
77
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($dropshipper_product);
78
+ }else{
79
+ $dropshipper_product = null;
80
+ }
81
+
82
+ $gridBlock = $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit_tab_product')
83
+ ->setGridUrl($this->getUrl('*/*/productGrid', array('_current' => true)));
84
+ // holds the selected rows ids
85
+ $serializerBlock = $this->_createSerializerBlock('products', $gridBlock, $dropshipper_product);
86
+ return array('gridBlock'=>$gridBlock,'serializerBlock'=>$serializerBlock);
87
+ }
88
+
89
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Dropshipper/Grid.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Block_Adminhtml_Dropshipper_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('dropshipperGrid');
14
+ $this->setDefaultSort('dshipper_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $collection = Mage::getModel('iweb_dropshipper/dropshipper')->getCollection();
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn('dshipper_id', array(
29
+ 'header' => Mage::helper('iweb_dropshipper')->__('ID'),
30
+ 'align' =>'right',
31
+ 'width' => '50px',
32
+ 'index' => 'dshipper_id',
33
+ ));
34
+
35
+ $this->addColumn('name', array(
36
+ 'header' => Mage::helper('iweb_dropshipper')->__('Dropshipper'),
37
+ 'align' =>'left',
38
+ 'index' => 'name',
39
+ ));
40
+
41
+ $this->addColumn('status', array(
42
+ 'header' => Mage::helper('iweb_dropshipper')->__('Status'),
43
+ 'align' => 'left',
44
+ 'width' => '80px',
45
+ 'index' => 'status',
46
+ 'type' => 'options',
47
+ 'options' => array(
48
+ 1 => 'Enabled',
49
+ 2 => 'Disabled',
50
+ ),
51
+ ));
52
+
53
+ $this->addColumn('action',
54
+ array(
55
+ 'header' => Mage::helper('iweb_dropshipper')->__('Action'),
56
+ 'width' => '100',
57
+ 'type' => 'action',
58
+ 'getter' => 'getId',
59
+ 'actions' => array(
60
+ array(
61
+ 'caption' => Mage::helper('iweb_dropshipper')->__('Edit'),
62
+ 'url' => array('base'=> '*/*/edit'),
63
+ 'field' => 'id'
64
+ )
65
+ ),
66
+ 'filter' => false,
67
+ 'sortable' => false,
68
+ 'index' => 'stores',
69
+ 'is_system' => true,
70
+ ));
71
+
72
+ $this->addExportType('*/*/exportCsv', Mage::helper('iweb_dropshipper')->__('CSV'));
73
+ $this->addExportType('*/*/exportXml', Mage::helper('iweb_dropshipper')->__('XML'));
74
+
75
+ return parent::_prepareColumns();
76
+ }
77
+
78
+ protected function _prepareMassaction()
79
+ {
80
+ $this->setMassactionIdField('dshipper_id');
81
+ $this->getMassactionBlock()->setFormFieldName('dropshipper');
82
+
83
+ $this->getMassactionBlock()->addItem('delete', array(
84
+ 'label' => Mage::helper('iweb_dropshipper')->__('Delete'),
85
+ 'url' => $this->getUrl('*/*/massDelete'),
86
+ 'confirm' => Mage::helper('iweb_dropshipper')->__('Are you sure?')
87
+ ));
88
+
89
+ $statuses = Mage::getSingleton('iweb_dropshipper/status')->getOptionArray();
90
+
91
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
92
+ $this->getMassactionBlock()->addItem('status', array(
93
+ 'label'=> Mage::helper('iweb_dropshipper')->__('Change status'),
94
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
95
+ 'additional' => array(
96
+ 'visibility' => array(
97
+ 'name' => 'status',
98
+ 'type' => 'select',
99
+ 'class' => 'required-entry',
100
+ 'label' => Mage::helper('iweb_dropshipper')->__('Status'),
101
+ 'values' => $statuses
102
+ )
103
+ )
104
+ ));
105
+
106
+ $this->getMassactionBlock()->addItem('update_price', array(
107
+ 'label'=> Mage::helper('iweb_dropshipper')->__('Update Price'),
108
+ 'url' => $this->getUrl('*/*/massUpdatePrice', array('_current'=>true)),
109
+ 'additional' => array(
110
+ 'percent_price' => array(
111
+ 'name' => 'percent',
112
+ 'type' => 'text',
113
+ 'class' => 'required-entry',
114
+ 'label' => Mage::helper('iweb_dropshipper')->__('Percentage')
115
+ )
116
+ )
117
+ ));
118
+
119
+ return $this;
120
+ }
121
+
122
+ public function getRowUrl($row)
123
+ {
124
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
125
+ }
126
+
127
+ }
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Sales/Order/View/Tab/Dropshipper.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+
9
+ class Iweb_Dropshipper_Block_Adminhtml_Sales_Order_View_Tab_Dropshipper extends Mage_Adminhtml_Block_Sales_Order_Abstract implements Mage_Adminhtml_Block_Widget_Tab_Interface
10
+ {
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setTemplate('dropshipper/order/view/products.phtml');
15
+ }
16
+
17
+ public function getOrder()
18
+ {
19
+ return Mage::registry('current_order');
20
+ }
21
+
22
+ public function getConnection()
23
+ {
24
+ return Mage::getSingleton('core/resource')->getConnection('catalog_write');
25
+ }
26
+
27
+ public function getDropshippersOrderedItems()
28
+ {
29
+ $order = $this->getOrder();
30
+ $order = Mage::getModel('sales/order')->load($order->getId());
31
+ $items = $order->getItemsCollection(array(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE));
32
+ return $items;
33
+ }
34
+
35
+ public function getSource()
36
+ {
37
+ return $this->getOrder();
38
+ }
39
+
40
+
41
+ public function getTabLabel()
42
+ {
43
+ return Mage::helper('sales')->__('Dropshippers');
44
+ }
45
+
46
+ public function getTabTitle()
47
+ {
48
+ return Mage::helper('sales')->__('Dropshippers');
49
+ }
50
+
51
+ public function canShowTab()
52
+ {
53
+ return true;
54
+ }
55
+
56
+ public function isHidden()
57
+ {
58
+ return false;
59
+ }
60
+
61
+ public function getLocation()
62
+ {
63
+ return $this->getUrl('dropshipper/adminhtml_order/saveorder', array('order_id'=> $this->getRequest()->getParam('order_id')));
64
+ }
65
+
66
+ public function sendMailAction()
67
+ {
68
+ return $this->getUrl('dropshipper/adminhtml_order/sendmail', array('order_id'=> $this->getRequest()->getParam('order_id')));
69
+ }
70
+
71
+
72
+ }
73
+
app/code/local/Iweb/Dropshipper/Block/Adminhtml/Widget/Grid/Column/Renderer/Input.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ * @category Iweb
5
+ * @package Iweb_Dropshipper
6
+ */
7
+
8
+ /**
9
+ * Product in Dropshipper from
10
+ *
11
+ * @category Iweb
12
+ * @package Iweb_Dropshipper
13
+ */
14
+ class Iweb_Dropshipper_Block_Adminhtml_Widget_Grid_Column_Renderer_Input extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
15
+ {
16
+ public function render(Varien_Object $row)
17
+ {
18
+ $productId = $row->getData('entity_id');
19
+ $dropshippersId = $row->getData('dshipper_id');
20
+
21
+ $val = '';$class = '';
22
+ switch ($this->getColumn()->getId()) {
23
+ case 'price':
24
+ $class = $this->getColumn()->getInlineCss(). ' required-entry validate-zero-or-greater required-entry input-text';
25
+ $val = number_format($row->getData($this->getColumn()->getIndex()), 2, '.', '');
26
+
27
+ $html = '<input type="text" ';
28
+ $html .= 'name="update_data[' . $this->getColumn()->getId() . ']['.$productId.']" ';
29
+ $html .= 'value="' . $val . '"';
30
+ $html .= 'maxlength="10"';
31
+ $html .= 'class="' . $class . '"/>';
32
+
33
+ break;
34
+ case 'cost':
35
+ $class = $this->getColumn()->getInlineCss(). ' required-entry validate-zero-or-greater required-entry input-text';
36
+ $val = number_format($row->getData($this->getColumn()->getIndex()), 2, '.', '');
37
+
38
+ $html = '<input type="text" ';
39
+ $html .= 'name="update_data[' . $this->getColumn()->getId() . ']['.$productId.']" ';
40
+ $html .= 'value="' . $val . '"';
41
+ $html .= 'maxlength="10"';
42
+ $html .= 'class="' . $class . '"/>';
43
+
44
+ break;
45
+
46
+ case 'qty':
47
+ $class = $this->getColumn()->getInlineCss(). ' validate-number input-text';
48
+ $decimals = strstr($row->getData($this->getColumn()->getIndex()), '.');
49
+ $val = ($decimals > 0) ? number_format($row->getData($this->getColumn()->getIndex()),2,'.', '') : number_format($row->getData($this->getColumn()->getIndex()),0,'.', '');
50
+
51
+ $html = '<input type="text" ';
52
+ $html .= 'id="' . $this->getColumn()->getId() . '-' . $row->getData('id').'" ';
53
+ $html .= 'name="update_data[' . $this->getColumn()->getId() . ']['.$productId.']" ';
54
+ $html .= 'value="' . $val . '"';
55
+ $html .= 'class="' . $class . '"/>';
56
+
57
+ break;
58
+ }
59
+
60
+ return $html;
61
+ }
62
+ }
app/code/local/Iweb/Dropshipper/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ public function isActiveDropshipper()
11
+ {
12
+ return Mage::getStoreConfig('dropshipper/general/enabled');
13
+ }
14
+ }
app/code/local/Iweb/Dropshipper/Model/Dropshipper.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Dropshipper extends Mage_Core_Model_Abstract
9
+ {
10
+ protected $_attributeOptionCollection = null;
11
+ protected $_attribute = null;
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('iweb_dropshipper/dropshipper');
16
+ }
17
+
18
+ protected function _afterSave()
19
+ {
20
+ if($this->getProducts())
21
+ $this->getProductInstance()->saveProductRelations($this);
22
+
23
+ return parent::_afterSave();
24
+ }
25
+
26
+ protected function getProductInstance()
27
+ {
28
+ return Mage::getModel('iweb_dropshipper/product');
29
+ }
30
+ }
app/code/local/Iweb/Dropshipper/Model/Observer.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Observer extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ const XML_PATH_EMAIL_DROPSHIPPER_TEMPLATE = 'iweb_dropshipper_email/dropshipper/iweb_dropshipper_template';
11
+ const XML_PATH_EMAIL_DROPSHIPPER_SENDER = 'trans_email/ident_dropshipper/email';
12
+ const XML_PATH_EMAIL_DROPSHIPPER_SENDER_NAME = 'trans_email/ident_dropshipper/name';
13
+ const DROPSHIPPER_EMAIL_OPTION = 'dropshipper/general/send_mail';
14
+ const DROPSHIPPER_ORDER_STATUS = 'dropshipper/general/order_status';
15
+
16
+ public function addDropshipperItem(Varien_Event_Observer $observer)
17
+ {
18
+ if(Mage::helper("iweb_dropshipper")->isActiveDropshipper()){
19
+ $order = $observer->getEvent()->getOrder();
20
+ if($order)
21
+ {
22
+ $items = $order->getAllItems();
23
+ foreach($items as $val)
24
+ {
25
+ $id = $val->getProductId();
26
+ $_product = Mage::getModel('catalog/product')->load($id);
27
+ $dropshipper = Mage::getModel('iweb_dropshipper/product')->getDropshipper($_product);
28
+ if($_product ->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $dropshipper)
29
+ {
30
+ $data['dshipper_id'] = $dropshipper->getDshipperId();
31
+ $data['item_id'] = $val->getId();
32
+ $model = Mage::getModel('iweb_dropshipper/order');
33
+ $model->setData($data);
34
+ $model->save();
35
+ }
36
+ }
37
+ }
38
+ else
39
+ {
40
+ $orders = $observer->getEvent()->getOrders();
41
+ foreach($orders as $_order)
42
+ {
43
+ $items = $_order->getAllItems();
44
+ foreach($items as $val)
45
+ {
46
+ $id = $val->getProductId();
47
+ $_product = Mage::getModel('catalog/product')->load($id);
48
+ $dropshipper = Mage::getModel('iweb_dropshipper/product')->getDropshipper($_product);
49
+ if($_product ->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $dropshipper)
50
+ {
51
+ $data['dshipper_id'] = $dropshipper->getDshipperId();
52
+ $data['item_id'] = $val->getId();
53
+ $model = Mage::getModel('iweb_dropshipper/order');
54
+ $model->setData($data);
55
+ $model->save();
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ public function sendMail(Varien_Event_Observer $observer)
64
+ {
65
+ if(Mage::helper("iweb_dropshipper")->isActiveDropshipper()){
66
+
67
+ $order = $observer->getEvent()->getOrder();
68
+ $orderStatus = $order->getStatus();
69
+
70
+ $dropshipperOrderStatus = Mage::getStoreConfig(self::DROPSHIPPER_ORDER_STATUS);
71
+ $dropshipperMailOption = Mage::getStoreConfig(self::DROPSHIPPER_EMAIL_OPTION);
72
+
73
+ if($orderStatus == $dropshipperOrderStatus && $dropshipperMailOption)
74
+ {
75
+ $dropShipperOrderResource = Mage::getResourceModel('iweb_dropshipper/order');
76
+ $shipping_address = $order->getShippingAddress();
77
+ $storeId = Mage::app()->getStore()->getId();
78
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_TEMPLATE, $storeId);
79
+ $orderItems = $order->getAllItems();
80
+ $itemIds = array();
81
+ foreach($orderItems as $_item){
82
+ if($_item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
83
+ $itemIds[] = $_item->getId();
84
+ }
85
+
86
+ //send mail to other dropshippers
87
+
88
+ $_allDropShippers = $dropShipperOrderResource->getItemsOthersDropShipper($itemIds);
89
+
90
+ if(!empty($_allDropShippers)){
91
+ foreach($_allDropShippers as $_dropshipper){
92
+ $items = explode(', ',$_dropshipper['items']);
93
+ $_itemCollection = Mage::getResourceModel('sales/order_item_collection')
94
+ ->addFieldToFilter('item_id',array('in'=>$items))
95
+ ->setOrderFilter($order);
96
+
97
+ $mailTemplate = Mage::getModel('core/email_template');
98
+ $mailTemplate ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
99
+ ->sendTransactional(
100
+ $templateId,
101
+ array('email'=>Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_SENDER),'name'=>Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_SENDER_NAME)),
102
+ $_dropshipper['email'],
103
+ $_dropshipper['name'],
104
+ array(
105
+ 'order' => $order,
106
+ 'items' => $_itemCollection,
107
+ 'dropshipper_name' => $_dropshipper['name'],
108
+ 'shipping_address' => $shipping_address,
109
+ )
110
+ );
111
+ if ($mailTemplate->getSentSuccess()) {
112
+ $dropShipperOrderResource->updateMailStatus($items);
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
app/code/local/Iweb/Dropshipper/Model/Order.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Order extends Mage_Core_Model_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('iweb_dropshipper/order');
14
+ }
15
+
16
+ public function getDropshipperByItem($itemId)
17
+ {
18
+ $dropshipper = Mage::getModel('iweb_dropshipper/order')->getCollection();
19
+ $dropshipper = $dropshipper->getItemByColumnValue('item_id',$itemId);
20
+ return $dropshipper;
21
+ }
22
+ }
app/code/local/Iweb/Dropshipper/Model/Product.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Product extends Mage_Core_Model_Abstract
9
+ {
10
+ protected $_allowAttributes = array(
11
+ 'price','cost','qty'
12
+ );
13
+
14
+ public function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->_init('iweb_dropshipper/product');
18
+ }
19
+
20
+ public function saveProductRelations($dropshipper)
21
+ {
22
+ $this->getResource()->saveProductRelations($dropshipper);
23
+ }
24
+
25
+ public function updateProducts($object)
26
+ {
27
+ $productData = $object['update_data'];
28
+
29
+ $newProductArray = array();
30
+ foreach($productData as $key=>$value)
31
+ {
32
+ foreach($value as $id=>$_val)
33
+ {
34
+ $newProductArray[$id][$key] = $_val;
35
+ }
36
+ }
37
+
38
+ foreach($newProductArray as $productId=>$val)
39
+ {
40
+ $product = Mage::getModel('catalog/product');
41
+ $product->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)
42
+ ->load($productId);
43
+
44
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
45
+
46
+ foreach($this->_allowAttributes as $_attribute)
47
+ {
48
+ if($val[$_attribute] != '')
49
+ {
50
+ if($_attribute == 'qty')
51
+ {
52
+ $stockItem->setData('qty', $val[$_attribute]);
53
+ $stockItem->save();
54
+ }else{
55
+ $func = 'set'.ucfirst($_attribute);
56
+ $product->$func($val[$_attribute]);
57
+ $product->save();
58
+ }
59
+
60
+
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ public function getDropshipper($product){
67
+ $dropShipperData = Mage::getModel('iweb_dropshipper/product')->load($product->getId(), 'product_id');
68
+ return $dropShipperData;
69
+ }
70
+
71
+ public function updateProductPrice($dropshipperId,$percentage)
72
+ {
73
+ $this->getResource()->updateProductPrice($dropshipperId,$percentage);
74
+ }
75
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Dropshipper.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Dropshipper extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ // Note that the dshipper_id refers to the key field in your database table.
14
+ $this->_init('iweb_dropshipper/dropshipper', 'dshipper_id');
15
+ }
16
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Dropshipper/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Dropshipper_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('iweb_dropshipper/dropshipper');
14
+ }
15
+
16
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Order.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ // Note that the dshipper_id refers to the key field in your database table.
14
+ $this->_init('iweb_dropshipper/order', 'dshipper_item_id');
15
+ }
16
+
17
+ public function getItemsOthersDropShipper($items = array())
18
+ {
19
+ $dropShipperTable = $this->getTable('dropshipper');
20
+ $dropShipperOrderTable = $this->getTable('order');
21
+
22
+ if(!empty($items)){
23
+ $select = $this->_getReadAdapter()->select();
24
+ $select ->from(array('order'=>$dropShipperOrderTable),array(''))
25
+ ->columns(
26
+ array(
27
+ 'items' => "GROUP_CONCAT(order.item_id SEPARATOR ', ')",
28
+ )
29
+ )
30
+ ->join(
31
+ array('dropshipper'=>$dropShipperTable),
32
+ 'order.dshipper_id = dropshipper.dshipper_id',
33
+ array('name','email')
34
+ )
35
+ ->where('order.item_id in(?)',$items)
36
+ ->group('dropshipper.dshipper_id');
37
+ $data = $this->_getReadAdapter()->fetchAll($select);
38
+ return $data;
39
+ }
40
+ return null;
41
+ }
42
+
43
+ public function updateMailStatus($items = array())
44
+ {
45
+ $dropShipperOrderTable = $this->getTable('order');
46
+
47
+ if(!empty($items)){
48
+ $whereCond = array('item_id in(?)' => $items);
49
+ $this->_getWriteAdapter()->update($dropShipperOrderTable,array('mail_status'=>1),$whereCond);
50
+ }
51
+ return $this;
52
+
53
+ }
54
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Order/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('iweb_dropshipper/order');
14
+ }
15
+
16
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Product.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Product extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ // Note that the dshipper_id refers to the key field in your database table.
14
+ $this->_init('iweb_dropshipper/product', 'dshipper_product_id');
15
+ }
16
+
17
+ public function saveProductRelations($dropshipper)
18
+ {
19
+ $productTable = $this->getTable('iweb_dropshipper/product');
20
+ $readAdapter = $this->_getReadAdapter();
21
+ $writeAdapter = $this->_getWriteAdapter();
22
+ $products = array_keys($dropshipper->getProducts());
23
+ $dropshipper_Id = $dropshipper->getDshipperId();
24
+
25
+ $select = $readAdapter->select()
26
+ ->from(
27
+ array('product_table'=>$productTable),
28
+ array('dshipper_product_id')
29
+ )
30
+ ->where('product_table.dshipper_id = ?',$dropshipper_Id);
31
+ if(count($products))
32
+ $select->where('product_table.product_id NOT IN(?)',$products);
33
+
34
+ $oldProduct = $readAdapter->fetchCol($select);
35
+ if(count($oldProduct)){
36
+ $writeAdapter->delete(
37
+ $this->getTable('iweb_dropshipper/product'),
38
+ array(
39
+ 'dshipper_product_id IN (?)' => $oldProduct,
40
+ )
41
+ );
42
+ }
43
+
44
+ foreach($products as $key=>$productId){
45
+ $data = array();
46
+ $data['product_id'] = $productId;
47
+ $data['dshipper_id'] = $dropshipper_Id;
48
+ $writeAdapter->insertOnDuplicate($productTable,$data);
49
+ }
50
+
51
+ return true;
52
+ }
53
+
54
+ public function updateProductPrice($dropshipperId,$percentage)
55
+ {
56
+ $productTable = $this->getTable('iweb_dropshipper/product');
57
+ $readAdapter = $this->_getReadAdapter();
58
+ $select = $readAdapter->select()
59
+ ->from(
60
+ array('product_table'=>$productTable),
61
+ array('dshipper_product_id')
62
+ )
63
+ ->where('product_table.dshipper_id = ?',$dropshipperId);
64
+
65
+ $products = $readAdapter->fetchCol($select);
66
+ foreach($products as $productId)
67
+ {
68
+ $product = Mage::getModel('catalog/product')->load($productId);
69
+ if($product->getCost())
70
+ {
71
+ $changePrice = ($product->getCost())+(($product->getCost())*$percentage/100);
72
+ $product->setPrice($changePrice);
73
+ $product->save();
74
+ }
75
+
76
+ }
77
+ }
78
+ }
app/code/local/Iweb/Dropshipper/Model/Resource/Product/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Resource_Product_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('iweb_dropshipper/product');
14
+ }
15
+
16
+ }
app/code/local/Iweb/Dropshipper/Model/Status.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_Status extends Varien_Object
9
+ {
10
+ const STATUS_ENABLED = 1;
11
+ const STATUS_DISABLED = 2;
12
+
13
+ static public function getOptionArray()
14
+ {
15
+ return array(
16
+ self::STATUS_ENABLED => Mage::helper('iweb_dropshipper')->__('Enabled'),
17
+ self::STATUS_DISABLED => Mage::helper('iweb_dropshipper')->__('Disabled')
18
+ );
19
+ }
20
+ }
app/code/local/Iweb/Dropshipper/Model/System/Config/Source/Order/Status.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Model_System_Config_Source_Order_Status
9
+ {
10
+ // set null to enable all possible
11
+ protected $_stateStatuses = array(
12
+ Mage_Sales_Model_Order::STATE_PROCESSING,
13
+ Mage_Sales_Model_Order::STATE_COMPLETE,
14
+ );
15
+
16
+ public function toOptionArray()
17
+ {
18
+ if ($this->_stateStatuses) {
19
+ $statuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->_stateStatuses);
20
+ }
21
+ else {
22
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
23
+ }
24
+ $options = array();
25
+ $options[] = array(
26
+ 'value' => '',
27
+ 'label' => Mage::helper('adminhtml')->__('-- Please Select --')
28
+ );
29
+ foreach ($statuses as $code=>$label) {
30
+ $options[] = array(
31
+ 'value' => $code,
32
+ 'label' => $label
33
+ );
34
+ }
35
+ return $options;
36
+ }
37
+ }
app/code/local/Iweb/Dropshipper/controllers/Adminhtml/DropshipperController.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Adminhtml_DropshipperController extends Mage_Adminhtml_Controller_action
9
+ {
10
+ protected function _initAction() {
11
+
12
+ $this->loadLayout()
13
+ ->_setActiveMenu('catalog/dropshipper')
14
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Dropshipper Manager'), Mage::helper('adminhtml')->__('Dropshipper Manager'));
15
+
16
+ return $this;
17
+ }
18
+ protected function _initDropshipper()
19
+ {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('iweb_dropshipper/dropshipper')->load($id);
22
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
23
+ if (!empty($data)) {
24
+ $model->setData($data);
25
+ }
26
+ Mage::register('dropshipper_data', $model);
27
+ }
28
+
29
+ public function indexAction() {
30
+ $this->_initAction()
31
+ ->renderLayout();
32
+ }
33
+ public function editAction() {
34
+
35
+ $this->_initDropshipper();
36
+
37
+ $model = Mage::registry('dropshipper_data');
38
+ if ($model->getId() || $id == 0) {
39
+ $this->loadLayout();
40
+ $this->_setActiveMenu('catalog/dropshipper');
41
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Dropshipper Item Manager'), Mage::helper('adminhtml')->__('Dropshipper Item Manager'));
42
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Dropshipper Item News'), Mage::helper('adminhtml')->__('Dropshipper Item News'));
43
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
44
+ $this->_addContent($this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit'))
45
+ ->_addLeft($this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit_tabs'));
46
+ $this->renderLayout();
47
+ } else {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('iweb_dropshipper')->__('Item does not exist'));
49
+ $this->_redirect('*/*/');
50
+ }
51
+ }
52
+
53
+ public function newAction() {
54
+ $this->_forward('edit');
55
+ }
56
+
57
+ public function saveAction()
58
+ {
59
+ if ($data = $this->getRequest()->getPost()) {
60
+
61
+ $data['name'] = $data['supplier_name'];
62
+ $errors = $this->validate($data);
63
+ if(!empty($errors)){
64
+ foreach($errors as $error){
65
+ Mage::getSingleton('adminhtml/session')->addError($error);
66
+ }
67
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
68
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
69
+ return;
70
+ }
71
+ $dropshipper_products = $this->_decodeInput($data['products']);
72
+ $data['products'] = $dropshipper_products;
73
+
74
+ if($data['update_data'])
75
+ Mage::getModel('iweb_dropshipper/product')->updateProducts($data);
76
+
77
+ $model = Mage::getModel('iweb_dropshipper/dropshipper');
78
+ $model->setData($data)
79
+ ->setId($this->getRequest()->getParam('id'));
80
+ try {
81
+ $model->save();
82
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('iweb_dropshipper')->__('Dropshipper was successfully saved'));
83
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
84
+
85
+ if ($this->getRequest()->getParam('back')) {
86
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
87
+ return;
88
+ }
89
+ $this->_redirect('*/*/');
90
+ return;
91
+ } catch (Exception $e) {
92
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
93
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
94
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
95
+ return;
96
+ }
97
+ }
98
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('iweb_dropshipper')->__('Unable to find item to save'));
99
+ $this->_redirect('*/*/');
100
+ }
101
+
102
+ public function deleteAction() {
103
+ if( $this->getRequest()->getParam('id') > 0 ) {
104
+ try {
105
+ $model = Mage::getModel('iweb_dropshipper/dropshipper');
106
+
107
+ $model->setId($this->getRequest()->getParam('id'))
108
+ ->delete();
109
+
110
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
111
+ $this->_redirect('*/*/');
112
+ } catch (Exception $e) {
113
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
114
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
115
+ }
116
+ }
117
+ $this->_redirect('*/*/');
118
+ }
119
+
120
+ public function massDeleteAction() {
121
+ $dropshipperIds = $this->getRequest()->getParam('dropshipper');
122
+ if(!is_array($dropshipperIds)) {
123
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
124
+ } else {
125
+ try {
126
+ foreach ($dropshipperIds as $dropshipperId) {
127
+ $dropshipper = Mage::getModel('iweb_dropshipper/dropshipper')->load($dropshipperId);
128
+ $dropshipper->delete();
129
+ }
130
+ Mage::getSingleton('adminhtml/session')->addSuccess(
131
+ Mage::helper('adminhtml')->__(
132
+ 'Total of %d item(s) were successfully deleted', count($dropshipperIds)
133
+ )
134
+ );
135
+ } catch (Exception $e) {
136
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
137
+ }
138
+ }
139
+ $this->_redirect('*/*/index');
140
+ }
141
+
142
+ public function massStatusAction()
143
+ {
144
+ $dropshipperIds = $this->getRequest()->getParam('dropshipper');
145
+ if(!is_array($dropshipperIds)) {
146
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
147
+ } else {
148
+ try {
149
+ foreach ($dropshipperIds as $dropshipperId) {
150
+ $dropshipper = Mage::getSingleton('iweb_dropshipper/dropshipper')
151
+ ->load($dropshipperId)
152
+ ->setStatus($this->getRequest()->getParam('status'))
153
+ ->setIsMassupdate(true)
154
+ ->save();
155
+ }
156
+ $this->_getSession()->addSuccess(
157
+ $this->__('Total of %d dropshipper(s) were successfully updated', count($dropshipperIds))
158
+ );
159
+ } catch (Exception $e) {
160
+ $this->_getSession()->addError($e->getMessage());
161
+ }
162
+ }
163
+ $this->_redirect('*/*/index');
164
+ }
165
+
166
+ public function massUpdatePriceAction()
167
+ {
168
+ $dropshipperIds = $this->getRequest()->getParam('dropshipper');
169
+ $percentage = $this->getRequest()->getParam('percent');
170
+
171
+ if(!is_array($dropshipperIds)) {
172
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
173
+ } else {
174
+ try {
175
+ if($percentage && is_numeric($percentage)==true && is_integer($percentage)==false)
176
+ {
177
+ foreach ($dropshipperIds as $dropshipperId) {
178
+ Mage::getModel('iweb_dropshipper/product')->updateProductPrice($dropshipperId,$percentage);
179
+ }
180
+ $this->_getSession()->addSuccess(
181
+ $this->__('Total of %d dropshipper(s) were successfully updated', count($dropshipperIds))
182
+ );
183
+ }
184
+ else
185
+ {
186
+ $this->_getSession()->addError(
187
+ $this->__('Please add percentage')
188
+ );
189
+ }
190
+
191
+ } catch (Exception $e) {
192
+ $this->_getSession()->addError($e->getMessage());
193
+ }
194
+ }
195
+ $this->_redirect('*/*/index');
196
+ }
197
+
198
+ public function exportCsvAction()
199
+ {
200
+ $fileName = 'dropshipper.csv';
201
+ $content = $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_grid')
202
+ ->getCsv();
203
+
204
+ $this->_sendUploadResponse($fileName, $content);
205
+ }
206
+
207
+ public function exportXmlAction()
208
+ {
209
+ $fileName = 'dropshipper.xml';
210
+ $content = $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_grid')
211
+ ->getXml();
212
+
213
+ $this->_sendUploadResponse($fileName, $content);
214
+ }
215
+
216
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
217
+ {
218
+ $response = $this->getResponse();
219
+ $response->setHeader('HTTP/1.1 200 OK','');
220
+ $response->setHeader('Pragma', 'public', true);
221
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
222
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
223
+ $response->setHeader('Last-Modified', date('r'));
224
+ $response->setHeader('Accept-Ranges', 'bytes');
225
+ $response->setHeader('Content-Length', strlen($content));
226
+ $response->setHeader('Content-type', $contentType);
227
+ $response->setBody($content);
228
+ $response->sendResponse();
229
+ die;
230
+ }
231
+ protected function validate($data)
232
+ {
233
+ $errors = array();
234
+ $helper = Mage::helper('iweb_dropshipper');
235
+
236
+ if (!Zend_Validate::is( trim($data['name']) , 'NotEmpty')) {
237
+ $errors[] = $helper->__('Name cannot be empty.');
238
+ }
239
+ if (!Zend_Validate::is( trim($data['email']) , 'NotEmpty')) {
240
+ $errors[] = $helper->__('Email cannot be empty.');
241
+ }
242
+
243
+ return $errors;
244
+ }
245
+
246
+ /**
247
+ * Grid Action
248
+ * Display list of products related to document
249
+ *
250
+ * @return void
251
+ */
252
+ public function productGridAction()
253
+ {
254
+ $this->_initDropshipper();
255
+ $this->getResponse()->setBody(
256
+ $this->getLayout()->createBlock('iweb_dropshipper/adminhtml_dropshipper_edit_tab_product', 'dropshipper.product.grid')
257
+ ->toHtml()
258
+ );
259
+ }
260
+
261
+ protected function _decodeInput($encoded)
262
+ {
263
+ $data = array();
264
+ parse_str($encoded, $data);
265
+ foreach($data as $key=>$value) {
266
+ parse_str(base64_decode($value), $data[$key]);
267
+ }
268
+ return $data;
269
+ }
270
+ }
271
+
app/code/local/Iweb/Dropshipper/controllers/Adminhtml/OrderController.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ class Iweb_Dropshipper_Adminhtml_OrderController extends Mage_Adminhtml_Controller_action
9
+ {
10
+ const XML_PATH_EMAIL_DROPSHIPPER_TEMPLATE = 'iweb_dropshipper_email/dropshipper/iweb_dropshipper_template';
11
+ const XML_PATH_EMAIL_DROPSHIPPER_SENDER = 'trans_email/ident_dropshipper/email';
12
+ const XML_PATH_EMAIL_DROPSHIPPER_SENDER_NAME = 'trans_email/ident_dropshipper/name';
13
+ const XML_PATH_DROPSHIPPER_EMAIL_OPTION = 'dropshipper/general/send_mail';
14
+
15
+ public function saveorderAction(){
16
+ if( $data = $this->getRequest()->getParams()){
17
+ try{
18
+ foreach($data['dropshipper'] as $key=>$_dropshipper){
19
+ if($_dropshipper['id'] && $_dropshipper['item_id']){
20
+ $dropshipper = Mage::getModel('iweb_dropshipper/order')->getCollection()
21
+ ->getItemByColumnValue('item_id',$_dropshipper['item_id']);
22
+ if(!$dropshipper){
23
+ $newData = array();
24
+ $newData['dshipper_id'] = $_dropshipper['id'];
25
+ $newData['item_id'] = $_dropshipper['item_id'];
26
+ $model = Mage::getModel('iweb_dropshipper/order');
27
+ $model->setData($newData);
28
+ $model->save();
29
+ }
30
+ else{
31
+ $dropshipper ->setDshipperId($_dropshipper['id'])
32
+ ->save();
33
+ }
34
+ }
35
+ }
36
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('iweb_dropshipper')->__('Dropshipper successfully saved'));
37
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
38
+ }
39
+ catch (Exception $e) {
40
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
41
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
42
+ return $this->_redirect('adminhtml/sales_order/view', array('order_id'=> $this->getRequest()->getParam('order_id'),'_current'=>true,'tab'=>'sales_order_view_tabs_dropshipper'));
43
+ }
44
+
45
+ }
46
+ return $this->_redirect('adminhtml/sales_order/view', array('order_id'=> $this->getRequest()->getParam('order_id'),'_current'=>true,'tab'=>'sales_order_view_tabs_dropshipper'));
47
+
48
+ }
49
+
50
+ public function sendmailAction()
51
+ {
52
+ if ($data = $this->getRequest()->getPost())
53
+ {
54
+
55
+ //Assignment of Dropshipper
56
+
57
+ foreach($data['dropshipper'] as $key=>$_dropshipper){
58
+ if($_dropshipper['id'] && $_dropshipper['item_id']){
59
+ $dropshipper = Mage::getModel('iweb_dropshipper/order')->getCollection()
60
+ ->getItemByColumnValue('item_id',$_dropshipper['item_id']);
61
+ if(!$dropshipper){
62
+ $newData = array();
63
+ $newData['dshipper_id'] = $_dropshipper['id'];
64
+ $newData['item_id'] = $_dropshipper['item_id'];
65
+ $model = Mage::getModel('iweb_dropshipper/order');
66
+ $model->setData($newData);
67
+ $model->save();
68
+ }
69
+ else{
70
+ $dropshipper ->setDshipperId($_dropshipper['id'])
71
+ ->save();
72
+ }
73
+ }
74
+ }
75
+
76
+ //End
77
+
78
+ $dropShipperOrderResource = Mage::getResourceModel('iweb_dropshipper/order');
79
+ $order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
80
+ $shipping_address = $order->getShippingAddress();
81
+
82
+ $storeId = Mage::app()->getStore()->getId();
83
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_TEMPLATE, $storeId);
84
+
85
+
86
+ $itemIds = array();
87
+ foreach($data['dropshipper'] as $key=>$_dropshipper){
88
+ if($_dropshipper['id']){
89
+ $itemIds[] = $_dropshipper['item_id'];
90
+ }
91
+ }
92
+
93
+ try{
94
+
95
+ $dropshipperMailOption = Mage::getStoreConfig(self::XML_PATH_DROPSHIPPER_EMAIL_OPTION);
96
+ if($dropshipperMailOption)
97
+ {
98
+ //send mail to other dropshippers
99
+
100
+ $_allDropShippers = $dropShipperOrderResource->getItemsOthersDropShipper($itemIds);
101
+ if(!empty($_allDropShippers)){
102
+ foreach($_allDropShippers as $_dropshipper){
103
+ $items = explode(', ',$_dropshipper['items']);
104
+ $_itemCollection = Mage::getResourceModel('sales/order_item_collection')
105
+ ->addFieldToFilter('item_id',array('in'=>$items))
106
+ ->setOrderFilter($order);
107
+
108
+ $mailTemplate = Mage::getModel('core/email_template');
109
+ $mailTemplate ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
110
+ ->sendTransactional(
111
+ $templateId,
112
+ array('email'=>Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_SENDER),'name'=>Mage::getStoreConfig(self::XML_PATH_EMAIL_DROPSHIPPER_SENDER_NAME)),
113
+ $_dropshipper['email'],
114
+ $_dropshipper['name'],
115
+ array(
116
+ 'order' => $order,
117
+ 'items' => $_itemCollection,
118
+ 'dropshipper_name' => $_dropshipper['name'],
119
+ 'shipping_address' => $shipping_address,
120
+ )
121
+ );
122
+ if ($mailTemplate->getSentSuccess()) {
123
+ $dropShipperOrderResource->updateMailStatus($items);
124
+ }
125
+ }
126
+ }
127
+
128
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('iweb_dropshipper')->__('Dropshipper Mail successfully sent'));
129
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
130
+ return $this->_redirect('adminhtml/sales_order/view', array('order_id'=> $this->getRequest()->getParam('order_id'),'_current'=>true,'tab'=>'sales_order_view_tabs_dropshipper'));
131
+
132
+ }else{
133
+ Mage::throwException('Email Communication Disabled For Dropshipper');
134
+ }
135
+ }catch (Exception $e) {
136
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
137
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
138
+ $this->_redirect('adminhtml/sales_order/view', array('order_id'=> $this->getRequest()->getParam('order_id'),'_current'=>true,'tab'=>'sales_order_view_tabs_dropshipper'));
139
+ return;
140
+ }
141
+ }
142
+ }
143
+
144
+ }
145
+
app/code/local/Iweb/Dropshipper/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Iweb
7
+ * @package Iweb_Dropshipper
8
+ */
9
+ -->
10
+ <config>
11
+ <menu>
12
+ <catalog>
13
+ <children>
14
+ <dropshipper translate="title" module="iweb_dropshipper">
15
+ <title>Dropshipper</title>
16
+ <action>dropshipper/adminhtml_dropshipper/index</action>
17
+ <sort_order>180</sort_order>
18
+ </dropshipper>
19
+ </children>
20
+ </catalog>
21
+ </menu>
22
+ <acl>
23
+ <resources>
24
+ <admin>
25
+ <children>
26
+ <catalog>
27
+ <children>
28
+ <dropshipper translate="title" module="iweb_dropshipper">
29
+ <title>Dropshipper</title>
30
+ </dropshipper>
31
+ </children>
32
+ </catalog>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/local/Iweb/Dropshipper/etc/config.xml ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Iweb
7
+ * @package Iweb_Dropshipper
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Iweb_Dropshipper>
13
+ <version>0.0.1</version>
14
+ </Iweb_Dropshipper>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <iweb_dropshipper>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Iweb_Dropshipper</module>
22
+ <frontName>dropshipper</frontName>
23
+ </args>
24
+ </iweb_dropshipper>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <iweb_dropshipper>
29
+ <file>iweb-dropshipper.xml</file>
30
+ </iweb_dropshipper>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <admin>
35
+ <routers>
36
+ <iweb_dropshipper>
37
+ <use>admin</use>
38
+ <args>
39
+ <module>Iweb_Dropshipper</module>
40
+ <frontName>dropshipper</frontName>
41
+ </args>
42
+ </iweb_dropshipper>
43
+ </routers>
44
+ </admin>
45
+ <adminhtml>
46
+ <layout>
47
+ <updates>
48
+ <iweb_dropshipper>
49
+ <file>iweb-dropshipper.xml</file>
50
+ </iweb_dropshipper>
51
+ </updates>
52
+ </layout>
53
+
54
+ <acl>
55
+ <resources>
56
+ <all>
57
+ <title>Allow Everything</title>
58
+ </all>
59
+ <admin>
60
+ <children>
61
+ <system>
62
+ <children>
63
+ <config>
64
+ <children>
65
+ <dropshipper>
66
+ <title>Dropshipper Option</title>
67
+ </dropshipper>
68
+ </children>
69
+ </config>
70
+ </children>
71
+ </system>
72
+ </children>
73
+ </admin>
74
+ </resources>
75
+ </acl>
76
+ </adminhtml>
77
+ <global>
78
+ <blocks>
79
+ <iweb_dropshipper>
80
+ <class>Iweb_Dropshipper_Block</class>
81
+ </iweb_dropshipper>
82
+ </blocks>
83
+ <models>
84
+ <iweb_dropshipper>
85
+ <class>Iweb_Dropshipper_Model</class>
86
+ <resourceModel>iweb_dropshipper_resource</resourceModel>
87
+ </iweb_dropshipper>
88
+
89
+ <iweb_dropshipper_resource>
90
+ <class>Iweb_Dropshipper_Model_Resource</class>
91
+ <entities>
92
+ <dropshipper>
93
+ <table>iweb_dropshipper</table>
94
+ </dropshipper>
95
+ <order>
96
+ <table>iweb_dropshipper_order</table>
97
+ </order>
98
+ <product>
99
+ <table>iweb_dropshipper_product</table>
100
+ </product>
101
+ </entities>
102
+ </iweb_dropshipper_resource>
103
+ </models>
104
+ <helpers>
105
+ <iweb_dropshipper>
106
+ <class>Iweb_Dropshipper_Helper</class>
107
+ </iweb_dropshipper>
108
+ </helpers>
109
+ <resources>
110
+ <iweb_dropshipper_setup>
111
+ <setup>
112
+ <module>Iweb_Dropshipper</module>
113
+ <class>Mage_Catalog_Model_Resource_Setup</class>
114
+ </setup>
115
+ <connection>
116
+ <use>core_setup</use>
117
+ </connection>
118
+ </iweb_dropshipper_setup>
119
+ <iweb_dropshipper_write>
120
+ <connection>
121
+ <use>core_write</use>
122
+ </connection>
123
+ </iweb_dropshipper_write>
124
+ <iweb_dropshipper_read>
125
+ <connection>
126
+ <use>core_read</use>
127
+ </connection>
128
+ </iweb_dropshipper_read>
129
+ </resources>
130
+
131
+ <events>
132
+ <checkout_submit_all_after>
133
+ <observers>
134
+ <iweb_dropshipper_additem>
135
+ <class>iweb_dropshipper/observer</class>
136
+ <method>addDropshipperItem</method>
137
+ </iweb_dropshipper_additem>
138
+ </observers>
139
+ </checkout_submit_all_after>
140
+
141
+ <sales_order_save_after>
142
+ <observers>
143
+ <iweb_dropshipper_sendmail>
144
+ <class>iweb_dropshipper/observer</class>
145
+ <method>sendMail</method>
146
+ </iweb_dropshipper_sendmail>
147
+ </observers>
148
+ </sales_order_save_after>
149
+ </events>
150
+
151
+ <template>
152
+ <email>
153
+ <iweb_dropshipper_email_order_dropshipper_template translate="label" module="iweb_dropshipper">
154
+ <label>Dropshipper Mail</label>
155
+ <file>sales/dropshipper.html</file>
156
+ <type>html</type>
157
+ </iweb_dropshipper_email_order_dropshipper_template>
158
+ </email>
159
+ </template>
160
+
161
+ </global>
162
+
163
+ <default>
164
+ <iweb_dropshipper_email>
165
+ <dropshipper>
166
+ <enabled>1</enabled>
167
+ <iweb_dropshipper_template>iweb_dropshipper_email_order_dropshipper_template</iweb_dropshipper_template>
168
+ <identity>dropshipper</identity>
169
+ </dropshipper>
170
+ </iweb_dropshipper_email>
171
+
172
+ <trans_email>
173
+ <ident_dropshipper>
174
+ <email><![CDATA[test@test.com]]></email>
175
+ <name>dropshipper</name>
176
+ </ident_dropshipper>
177
+ </trans_email>
178
+
179
+ <dropshipper>
180
+ <general>
181
+ <send_mail>1</send_mail>
182
+ </general>
183
+ </dropshipper>
184
+
185
+ </default>
186
+ </config>
app/code/local/Iweb/Dropshipper/etc/system.xml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <dropshipper translate="label" module="iweb_dropshipper">
4
+ <label>Dropshipper</label>
5
+ <sort_order>110</sort_order>
6
+ </dropshipper>
7
+ </tabs>
8
+ <sections>
9
+ <dropshipper translate="label" module="iweb_dropshipper">
10
+ <label>Dropshipper Option</label>
11
+ <tab>dropshipper</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <general translate="label">
19
+ <label>General</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled translate="label">
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </enabled>
35
+ <send_mail translate="label comment">
36
+ <label>Send Mail Option</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>0</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </send_mail>
44
+ <order_status translate="label">
45
+ <label>Order status After which You want to send Mail</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>iweb_dropshipper/system_config_source_order_status</source_model>
48
+ <sort_order>40</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </order_status>
53
+ </fields>
54
+ </general>
55
+ </groups>
56
+ </dropshipper>
57
+ <trans_email translate="label" module="core">
58
+ <groups>
59
+ <ident_dropshipper translate="label">
60
+ <label>Dropshipper Email</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>6</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
+ <fields>
67
+ <email translate="label">
68
+ <label>Sender email</label>
69
+ <frontend_type>text</frontend_type>
70
+ <backend_model>adminhtml/system_config_backend_email_address</backend_model>
71
+ <validate>validate-email</validate>
72
+ <sort_order>2</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </email>
77
+ <name translate="label">
78
+ <label>Sender name</label>
79
+ <frontend_type>text</frontend_type>
80
+ <backend_model>adminhtml/system_config_backend_email_sender</backend_model>
81
+ <validate>validate-emailSender</validate>
82
+ <sort_order>1</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </name>
87
+ </fields>
88
+ </ident_dropshipper>
89
+ </groups>
90
+ </trans_email>
91
+ </sections>
92
+ </config>
app/code/local/Iweb/Dropshipper/sql/iweb_dropshipper_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Iweb
6
+ * @package Iweb_Dropshipper
7
+ */
8
+ $installer = $this;
9
+ $installer->startSetup();
10
+
11
+ /**
12
+ * Create table iweb_dropshipper/dropshipper
13
+ */
14
+
15
+ $table = $installer->getConnection()
16
+ ->newTable($installer->getTable('iweb_dropshipper/dropshipper'))
17
+ ->addColumn('dshipper_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
+ 'identity' => true,
19
+ 'unsigned' => true,
20
+ 'nullable' => false,
21
+ 'primary' => true,
22
+ ), 'Auto Increment ID')
23
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
24
+ 'unsigned' => true,
25
+ 'nullable' => false,
26
+ ), 'Name')
27
+ ->addColumn('email', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
28
+ 'unsigned' => true,
29
+ 'nullable' => false,
30
+ ), 'Dropshipper Email')
31
+ ->addColumn('address', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
32
+ 'unsigned' => true,
33
+ 'nullable' => false,
34
+ ), 'Address')
35
+ ->addColumn('city', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
36
+ 'unsigned' => true,
37
+ 'nullable' => false,
38
+ ), 'City')
39
+ ->addColumn('state', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
40
+ 'unsigned' => true,
41
+ 'nullable' => false,
42
+ ), 'State')
43
+ ->addColumn('country', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
44
+ 'unsigned' => true,
45
+ 'nullable' => false,
46
+ ), 'Country')
47
+ ->addColumn('zip', Varien_Db_Ddl_Table::TYPE_VARCHAR, 20, array(
48
+ 'unsigned' => true,
49
+ 'nullable' => false,
50
+ ), 'Zip')
51
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
52
+ 'unsigned' => true,
53
+ 'nullable' => false,
54
+ 'default' => '2',
55
+ ), 'Status')
56
+ ->setComment('Dropshipper Main Table');
57
+
58
+ $installer->getConnection()->createTable($table);
59
+
60
+ /**
61
+ * Create table iweb_dropshipper/product
62
+ */
63
+ $table = $installer->getConnection()
64
+ ->newTable($installer->getTable('iweb_dropshipper/product'))
65
+ ->addColumn('dshipper_product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
66
+ 'identity' => true,
67
+ 'unsigned' => true,
68
+ 'nullable' => false,
69
+ 'primary' => true,
70
+ ), 'Auto Increment ID')
71
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
72
+ 'unsigned' => true,
73
+ 'nullable' => false,
74
+ ), 'Product Id')
75
+ ->addColumn('dshipper_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
76
+ 'unsigned' => true,
77
+ 'nullable' => false,
78
+ ), 'Reference of Dropshipper ID')
79
+ ->addIndex(
80
+ 'UNIQUE_PRODUCT_DROPSHIPPER',
81
+ array('product_id', 'dshipper_id'),
82
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
83
+ ->addForeignKey(
84
+ 'FK_PRODUCT_DROPSHIPPER_ID',
85
+ 'dshipper_id', $installer->getTable('iweb_dropshipper/dropshipper'), 'dshipper_id',
86
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
87
+ ->addForeignKey(
88
+ 'FK_CATALOG_PRODUCT_DROPSHIPPER',
89
+ 'product_id', $installer->getTable('catalog/product'), 'entity_id',
90
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
91
+ ->setComment('DROPSHIPPER Product Table');
92
+
93
+ $installer->getConnection()->createTable($table);
94
+
95
+ /**
96
+ * Create table iweb_dropshipper/order
97
+ */
98
+
99
+ $table = $installer->getConnection()
100
+ ->newTable($installer->getTable('iweb_dropshipper/order'))
101
+ ->addColumn('dshipper_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
102
+ 'identity' => true,
103
+ 'unsigned' => true,
104
+ 'nullable' => false,
105
+ 'primary' => true,
106
+ ), 'Auto Increment ID')
107
+ ->addColumn('item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
108
+ 'unsigned' => true,
109
+ 'nullable' => false,
110
+ ), 'Item Id')
111
+ ->addColumn('dshipper_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
112
+ 'unsigned' => true,
113
+ 'nullable' => false,
114
+ ), 'Dropshipper Id')
115
+ ->addColumn('mail_status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
116
+ 'unsigned' => true,
117
+ 'nullable' => false,
118
+ ), 'Mail Status')
119
+ ->addIndex(
120
+ 'UNIQUE_ORDER_DROPSHIPPER',
121
+ array('item_id', 'dshipper_id'),
122
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
123
+ ->addForeignKey(
124
+ 'FK_ORDER_DROPSHIPPER_ID',
125
+ 'dshipper_id', $installer->getTable('iweb_dropshipper/dropshipper'), 'dshipper_id',
126
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
127
+ ->addForeignKey(
128
+ 'FK_SALES_ORDER_ITEM_DROPSHIPPER',
129
+ 'item_id', $installer->getTable('sales/order_item'), 'item_id',
130
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
131
+ ->setComment('Dropshipper order Table');
132
+ $installer->getConnection()->createTable($table);
133
+
134
+ $installer->endSetup();
135
+
app/design/adminhtml/default/default/layout/iweb-dropshipper.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Iweb
7
+ * @package Iweb_Dropshipper
8
+ */
9
+ -->
10
+ <layout>
11
+ <iweb_dropshipper_adminhtml_dropshipper_index>
12
+ <reference name="content">
13
+ <block type="iweb_dropshipper/adminhtml_dropshipper" name="dropshipper" />
14
+ </reference>
15
+ </iweb_dropshipper_adminhtml_dropshipper_index>
16
+
17
+ <adminhtml_sales_order_view>
18
+ <reference name="sales_order_tabs">
19
+ <block type="iweb_dropshipper/adminhtml_sales_order_view_tab_dropshipper" name="tab_dropshipper"></block>
20
+ <action method="addTab"><name>dropshipper</name><block>tab_dropshipper</block></action>
21
+ </reference>
22
+ </adminhtml_sales_order_view>
23
+
24
+ </layout>
app/design/adminhtml/default/default/template/dropshipper/order/view/products.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $order = $this->getOrder(); ?>
2
+ <form id="drop_order_form" name="drop_order_form" action="<?php echo $this->getLocation() ?>" method="post" enctype="multipart/form-data">
3
+ <input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" />
4
+ <div align="right" style="margin-bottom:18px">
5
+ <table cellspacing="0" class="grid-header">
6
+ <tr>
7
+ <td class="a-right">
8
+
9
+ <button type="button" class="scalable save" type="button" onclick="sendMail('<?php echo $this->sendMailAction() ?>')"><span><?php echo $this->__('Save and Send Mail');?></span></button>
10
+
11
+ <button type="submit" class="scalable save" type="button"><span><?php echo $this->__('Save');?></span></button>
12
+
13
+ </td>
14
+ </tr>
15
+ </table>
16
+ </div>
17
+ <div class="grid">
18
+ <table class="data" cellspacing="0" id="dropshipper-table">
19
+ <col width="1" />
20
+ <col />
21
+ <col width="150" />
22
+ <col width="150" />
23
+ <thead>
24
+ <tr class="headings">
25
+ <th></th>
26
+ <th class="a-left"><?php echo $this->__('Dropshipper Name');?></th>
27
+ <th class="a-left"><?php echo $this->__('Product Name');?></th>
28
+ <th class="a-left"><?php echo $this->__('Status');?></th>
29
+ </tr>
30
+ </thead>
31
+ <?php $items = $this->getDropshippersOrderedItems(); ?>
32
+ <?php $_dropshippers = Mage::getModel('iweb_dropshipper/dropshipper')->getCollection();?>
33
+ <?php $i = 0; ?>
34
+ <tbody>
35
+ <?php if(count($items)):?>
36
+ <?php foreach($items as $_item):?>
37
+ <?php if (!$_item->isDeleted()):?>
38
+ <?php $_origDropshipper = Mage::getModel('iweb_dropshipper/order')->getDropshipperByItem($_item->getId()); ?>
39
+ <tr>
40
+ <td><input type="checkbox" name="dropshipper[<?php echo $i; ?>][item_id]" value="<?php echo $_item->getId()?>" /></td>
41
+ <td class="a-left">
42
+ <?php if(count($_dropshippers)): ?>
43
+ <select class='required-entry' name="dropshipper[<?php echo $i; ?>][id]" >
44
+ <option value=""><?php echo $this->__('Dropshipper Not Assigned'); ?></option>
45
+ <?php foreach ($_dropshippers as $_dropshipper): ?>
46
+ <option <?php if($_origDropshipper && $_origDropshipper->getDshipperId() == $_dropshipper->getDshipperId()):?> selected="selected" <?php endif;?> value="<?php echo $_dropshipper->getDshipperId();?>"><?php echo $_dropshipper->getName();?></option>
47
+ <?php endforeach;?>
48
+ </select>
49
+ <?php endif;?>
50
+ </td>
51
+ <td class="a-left"><?php echo $_item->getName(); ?></td>
52
+ <td class="a-left"> <?php echo $_origDropshipper && $_origDropshipper->getMailStatus() ? $this->__("Mail sent") : $this->__("Mail Not sent");?></td>
53
+ </tr>
54
+ <?php $i++; endif;?>
55
+ <?php endforeach;?>
56
+ <?php else:?>
57
+ <tr>
58
+ <td colspan="3" class="a-center"><?php echo $this->__('No Records.');?></td>
59
+ </tr>
60
+ <?php endif;?>
61
+ </tbody>
62
+ </table>
63
+ <script type="text/javascript">decorateTable('dropshipper-table')</script>
64
+ </div>
65
+ </form>
66
+
67
+ <script type="text/javascript" language="javascript">
68
+ function sendMail(action)
69
+ {
70
+ $('drop_order_form').action = action;
71
+ $('drop_order_form').submit();
72
+ }
73
+ <?php if($this->getRequest()->getParam('tab')=='sales_order_view_tabs_dropshipper') : ?>
74
+ Event.observe(window, 'load', function() {
75
+ setTimeout(function(){
76
+ someNode = $('sales_order_view_tabs_dropshipper');
77
+ sales_order_view_tabsJsTabs.showTabContent(someNode);
78
+ },100);
79
+ });
80
+ <?php endif; ?>
81
+ </script>
app/design/frontend/base/default/layout/iweb-dropshipper.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+
5
+ <iweb_dropshipper_email_items>
6
+ <block type="sales/order_email_items" name="items" template="dropshipper/email/items.phtml">
7
+ <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>dropshipper/email/items/default.phtml</template></action>
8
+ <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>dropshipper/email/items/default.phtml</template></action>
9
+ </block>
10
+ </iweb_dropshipper_email_items>
11
+
12
+ </layout>
app/design/frontend/base/default/template/dropshipper/email/items.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_items = $this->getItems(); ?>
2
+ <table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
3
+ <thead>
4
+ <tr>
5
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
6
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('SKU') ?></th>
7
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
8
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Product Option') ?></th>
9
+ </tr>
10
+ </thead>
11
+ <?php $i=0; foreach ($_items as $_item): ?>
12
+ <?php //if($_item->getParentItem()) continue; else $i++; ?>
13
+ <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
14
+ <?php echo $this->getItemHtml($_item) ?>
15
+ </tbody>
16
+ <?php endforeach; ?>
17
+ </table>
18
+
19
+
app/design/frontend/base/default/template/dropshipper/email/items/default.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_item = $this->getItem() ?>
2
+ <tr>
3
+ <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
4
+ <strong style="font-size:11px;"><?php echo $this->htmlEscape($_item->getName()) ?></strong>
5
+ </td>
6
+ <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
7
+ <strong style="font-size:11px;"><?php echo $this->htmlEscape($_item->getSku()) ?></strong>
8
+ </td>
9
+ <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQtyOrdered()*1 ?></td>
10
+
11
+ <td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
12
+ <?php
13
+
14
+ $options_qty = $_item->getProductOptions();
15
+
16
+ if($_item->getParentItemId())
17
+ {
18
+ $parentItemId = $_item->getParentItemId();
19
+ $parentItem = Mage::getModel('sales/order_item')->load($parentItemId);
20
+ $options = $parentItem->getProductOptions();
21
+
22
+ $product_options = $options['attributes_info'];
23
+
24
+ foreach($product_options as $_option)
25
+ {
26
+ $product_options_str .= $_option['label']."=>".$_option['value']."<br />";
27
+ }
28
+
29
+ if($options['options'])
30
+ {
31
+ $custom_options = $options['options'];
32
+ foreach($custom_options as $_customoption)
33
+ {
34
+ $product_options_str .= $_customoption['label']."=>".$_customoption['value']."<br />";
35
+ }
36
+ }
37
+
38
+ }
39
+ else
40
+ {
41
+ $options = $_item->getProductOptions();
42
+ $custom_options = $options['options'];
43
+ if($custom_options)
44
+ {
45
+ foreach($custom_options as $_customoption)
46
+ {
47
+ $product_options_str .= $_customoption['label']."=>".$_customoption['value']."<br />";
48
+ }
49
+ }
50
+ else
51
+ {
52
+ $product_options_str = '';
53
+ }
54
+
55
+ }
56
+ echo $product_options_str;
57
+ ?>
58
+ </td>
59
+ </tr>
app/etc/modules/Iweb_Dropshipper.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Iweb
7
+ * @package Iweb_Dropshipper
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Iweb_Dropshipper>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Iweb_Dropshipper>
16
+ </modules>
17
+ </config>
app/locale/en_US/template/email/sales/dropshipper.html ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Shipping Info for Order #{{var order.increment_id}} @-->
2
+
3
+ <!--@styles
4
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
5
+ @-->
6
+
7
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
8
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
9
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
10
+ <tr>
11
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
12
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
13
+ <tr>
14
+ <td valign="top">
15
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="100%">
16
+ <tr>
17
+ <td align="left" valign="middle"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ <td width="300" align="right" valign="top" style="font-size:12px; color:#444; font-family:Verdana, Arial; line-height:18PX;"><strong style="font-size:14px; color:#222;">{{config path="general/store_information/address"}}</td>
19
+ </tr>
20
+ </table> </td>
21
+ </tr>
22
+ <tr>
23
+ <td height="6" valign="top" bgcolor="#e0e0e0" style="margin:0; padding:0; height:6px;"></td>
24
+ </tr>
25
+ <tr>
26
+ <td height="1" valign="top" bgcolor="#97c6e2" style="margin:0; padding:0; height:1px;"></td>
27
+ </tr>
28
+ <tr>
29
+ <td valign="top">
30
+ <table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
31
+ <tr>
32
+ <td><p><b><u>SUPPLIER INFORMATION ONLY - NOT CUSTOMER</u></b> <br />
33
+ <br />
34
+ <strong style="font-size:13px">Hello {{var dropshipper_name}}</strong>, <br />
35
+ <br />
36
+ Order : <font style="font-size:14px;font-weight:bold">{{var order.increment_id}}</font> <br />
37
+ <br />
38
+ Please dispatch on our behalf to: </p>
39
+ <font style="font-size:12px;font-weight:bold">{{var shipping_address.firstname}} {{var shipping_address.lastname}}</font>
40
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
41
+ <tr>
42
+ <td>{{var shipping_address.company}}</td>
43
+ </tr>
44
+ <tr>
45
+ <td>{{var shipping_address.street1}} {{var shipping_address.street2}}</td>
46
+ </tr>
47
+ <tr>
48
+ <td>{{var shipping_address.city}}</td>
49
+ </tr>
50
+ <tr>
51
+ <td>{{var shipping_address.region}}</td>
52
+ </tr>
53
+ <tr>
54
+ <td>{{var shipping_address.postcode}}</td>
55
+ </tr>
56
+ <tr>
57
+ <td>{{var shipping_address.telephone}}</td>
58
+ </tr>
59
+ <tr>
60
+ <td>{{var shipping_address.email}} </td>
61
+ </tr>
62
+ </table>
63
+ <p>
64
+ Shipping Method:&nbsp;&nbsp;{{var order.shipping_description}}<br />
65
+ Shipping Note:&nbsp;&nbsp;{{var order.shipping_note}}<br />
66
+ Special Delivery Notes:&nbsp;&nbsp;{{var order.customer_note}}
67
+ </p>
68
+
69
+
70
+ {{layout handle="iweb_dropshipper_email_items" items=$items}}
71
+
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+ </td>
79
+ </tr>
80
+ </table>
81
+ </div>
82
+ </body>
83
+
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Iweb_Dropshipper</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This Module is used to assign item to dropshipper.When order get Placed then admin can send Dropshipper mail from admin or can send mail automatically by selecting option from admin To Notify Dropshipper That Your item has been Placed with Shiping Info.&#xD;
10
+ </summary>
11
+ <description>This Module is used to assign item to dropshipper.When order get Placed then admin can send Dropshipper mail from admin or can send mail automatically by selecting option from admin To Notify Dropshipper That Your item has been Placed with Shiping Info.</description>
12
+ <notes>This Module is used to assign item to dropshipper.When order get Placed then admin can send Dropshipper mail from admin or can send mail automatically by selecting option from admin To Notify Dropshipper That Your item has been Placed with Shiping Info.</notes>
13
+ <authors><author><name>sujit</name><user>suju</user><email>suju.eathen@gmail.com</email></author></authors>
14
+ <date>2013-02-12</date>
15
+ <time>08:47:19</time>
16
+ <contents><target name="magelocal"><dir name="Iweb"><dir name="Dropshipper"><dir name="Block"><dir name="Adminhtml"><dir name="Dropshipper"><dir name="Edit"><file name="Form.php" hash="d5333bb2a2896e68ffc4f4cacd180872"/><dir name="Tab"><dir name="Ajax"><file name="Serializer.php" hash="bdfba8d7ad8458b81b982d159919146e"/></dir><file name="Form.php" hash="59c8949525251707ca7b47d2dc4b55c6"/><file name="Product.php" hash="2c45adfeb68cb57ec493e5264d0e78e6"/></dir><file name="Tabs.php" hash="d0adb69b2e2dd702d42afc57a3d3bdaa"/></dir><file name="Edit.php" hash="8733ea1b1a17f1143654339c92270cc4"/><file name="Grid.php" hash="2f3563fe6b996ed4f619fdd88435366c"/></dir><file name="Dropshipper.php" hash="d636b813af7e6908af23ff04f190c018"/><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Dropshipper.php" hash="14b0fe511aca4493b027d33b683a396f"/></dir></dir></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Input.php" hash="a4911063350ff29c147ec2428c239345"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2be35e7b90c61aa3f05cf7adf6d962f7"/></dir><dir name="Model"><file name="Dropshipper.php" hash="1ce8c732f21ceb47b4983e508e7237f8"/><file name="Observer.php" hash="8ef925128f089de8f8b222adc9a72098"/><file name="Order.php" hash="cd0efb5e1ec2027c6ddce51e60fc28b6"/><file name="Product.php" hash="eaa7148bc2cddfa1c4ac2233c58ed750"/><dir name="Resource"><dir name="Dropshipper"><file name="Collection.php" hash="f0bb7c5b943c98aeee9f646986cf3d69"/></dir><file name="Dropshipper.php" hash="1af40dcf4a00b1cdc14d2c68749e56c0"/><dir name="Order"><file name="Collection.php" hash="c9cb7843803e4cb0afee9d84b4bab3c5"/></dir><file name="Order.php" hash="606ef1913c3175d9a37c394f2e71ebcd"/><dir name="Product"><file name="Collection.php" hash="624a31554a2524d89755dac35ccfc893"/></dir><file name="Product.php" hash="849e9e96c2aef1dea2d1db87a60a187f"/></dir><file name="Status.php" hash="18190728774bb2a8393b6c182c5e8eba"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Order"><file name="Status.php" hash="a0d85b2608aabdc2fc7905ed495a90c5"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DropshipperController.php" hash="d60f2f595bf8d841b5e574a51afd6d26"/><file name="OrderController.php" hash="d73ee8b8d1708290a92de4af0181695f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b14023d52b784736530a120e2563fcb8"/><file name="config.xml" hash="3c12ca1c8d01291da73c0629602e8739"/><file name="system.xml" hash="83b3a5a5c28cf87135090b68d3525abf"/></dir><dir name="sql"><dir name="iweb_dropshipper_setup"><file name="mysql4-install-0.0.1.php" hash="e2d96f5418f09c585a29b78ce55aad4a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iweb-dropshipper.xml" hash="b13f7eee642b333512d73f8a2c84ad0c"/></dir><dir name="template"><dir name="dropshipper"><dir name="order"><dir name="view"><file name="products.phtml" hash="25d8ed0fcf512392631314319716519f"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iweb-dropshipper.xml" hash="95d7163435c2feb6c7f97ad4e960131c"/></dir><dir name="template"><dir name="dropshipper"><dir name="email"><dir name="items"><file name="default.phtml" hash="49202c1db999a69f7fc8355e4e472ed6"/></dir><file name="items.phtml" hash="34493bbe93b09320d4ec5d5862699ed0"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="app"><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><file name="dropshipper.html" hash="41b6dad744c8262b7e7b41c62442e4f5"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iweb_Dropshipper.xml" hash="e3101a7068e78578ebc14b27cee5ced2"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Iweb_Dropshipper</name><channel>community</channel><min>1.3</min><max>1.7</max></package></required></dependencies>
19
+ </package>