Version Notes
package is ready
Download this release
Release Info
Developer | Logicbroker |
Extension | dropship360 |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.1.1 to 3.2.2
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Edit/Vendortab.php +1 -1
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Edit/Vendortabhistory.php +1 -1
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Grid.php +1 -1
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Sourcing.php +1 -0
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Sourcing/Pomanagment.php +46 -0
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/System/Config/Ftpconnectionbutton.php +1 -1
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Upload.php +2 -2
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Upload/Edit/Form.php +1 -1
- app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Vendorproductuploadhistory.php +80 -79
- app/code/community/Logicbroker/Dropship360/Helper/Data.php +24 -7
- app/code/community/Logicbroker/Dropship360/Model/Csvparser.php +98 -86
- app/code/community/Logicbroker/Dropship360/Model/Import.php +253 -0
- app/code/community/Logicbroker/Dropship360/Model/Import/Base.php +618 -0
- app/code/community/Logicbroker/Dropship360/Model/Import/Ftp.php +127 -0
- app/code/community/Logicbroker/Dropship360/Model/Import/Ftpimport.php +240 -0
- app/code/community/Logicbroker/Dropship360/Model/Import/Manualimport.php +61 -0
- app/code/community/Logicbroker/Dropship360/Model/Import/Productsetup.php +249 -0
- app/code/community/Logicbroker/Dropship360/Model/Inventory.php +242 -79
- app/code/community/Logicbroker/Dropship360/Model/Inventorylog.php +70 -0
- app/code/community/Logicbroker/Dropship360/Model/Observer.php +68 -318
- app/code/community/Logicbroker/Dropship360/Model/Order/Api.php +13 -4
- app/code/community/Logicbroker/Dropship360/Model/Orderitems.php +4 -0
- app/code/community/Logicbroker/Dropship360/Model/Ordersourcing.php +255 -3
- app/code/community/Logicbroker/Dropship360/Model/Productimport.php +1 -1
- app/code/community/Logicbroker/Dropship360/Model/Ranking.php +3 -2
- app/code/community/Logicbroker/Dropship360/Model/Resource/Orderitems.php +1 -0
- app/code/community/Logicbroker/Dropship360/Model/System/Config/Source/Vendorlist.php +1 -1
- app/code/community/Logicbroker/Dropship360/Model/Uploadvendor.php +3 -1497
- app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{InventoryController.php → Logicbroker/InventoryController.php} +1 -1
- app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{LogicbrokerController.php → Logicbroker/LogicbrokerController.php} +1 -1
- {includes/src/Logicbroker/Dropship360/controllers/Adminhtml → app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/RankingController.php +13 -5
- {includes/src/Logicbroker/Dropship360/controllers/Adminhtml → app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/ReportController.php +1 -1
- app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{SourcingController.php → Logicbroker/SourcingController.php} +4 -4
- app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{UploadController.php → Logicbroker/UploadController.php} +20 -9
- app/code/community/Logicbroker/Dropship360/etc/adminhtml.xml +5 -4
- app/code/community/Logicbroker/Dropship360/etc/api.xml +4 -0
- app/code/community/Logicbroker/Dropship360/etc/config.xml +10 -10
- app/code/community/Logicbroker/Dropship360/etc/system.xml +1 -1
- app/code/community/Logicbroker/Dropship360/etc/wsdl.xml +6 -0
- app/code/community/Logicbroker/Dropship360/sql/dropship360_setup/mysql4-upgrade-1.0.5-1.0.6.php +2 -2
- app/code/community/Logicbroker/Dropship360/sql/dropship360_setup/mysql4-upgrade-1.0.7-1.0.8.php +11 -0
- app/design/adminhtml/default/default/layout/logicbroker.xml +27 -24
- app/design/adminhtml/default/default/template/logicbroker/bundle/renderer.phtml +1 -1
- app/design/adminhtml/default/default/template/logicbroker/downloadable/downloadable.phtml +1 -1
- app/design/adminhtml/default/default/template/logicbroker/sales/default.phtml +1 -1
- app/design/adminhtml/default/default/template/logicbroker/system/config/fieldset/hint.phtml +1 -1
- app/design/adminhtml/default/default/template/logicbroker/upload_vendor_product.phtml +2 -2
- app/design/adminhtml/default/default/template/logicbroker/vendor_upload_product_history.phtml +50 -13
- app/design/adminhtml/default/default/template/logicbroker/window.phtml +1 -1
- includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{InventoryController.php → Logicbroker/InventoryController.php} +1 -1
- includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{LogicbrokerController.php → Logicbroker/LogicbrokerController.php} +1 -1
- {app/code/community/Logicbroker/Dropship360/controllers/Adminhtml → includes/src/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/RankingController.php +13 -5
- {app/code/community/Logicbroker/Dropship360/controllers/Adminhtml → includes/src/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/ReportController.php +1 -1
- includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{SourcingController.php → Logicbroker/SourcingController.php} +4 -4
- includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{UploadController.php → Logicbroker/UploadController.php} +20 -9
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab.php +1 -1
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory.php +1 -1
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid.php +1 -1
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Sourcing.php +1 -0
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Pomanagment.php +46 -0
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton.php +1 -1
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Upload.php +2 -2
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form.php +1 -1
- includes/src/Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory.php +80 -79
- includes/src/Logicbroker_Dropship360_Helper_Data.php +24 -7
- includes/src/Logicbroker_Dropship360_Model_Csvparser.php +98 -86
- includes/src/Logicbroker_Dropship360_Model_Import.php +253 -0
- includes/src/Logicbroker_Dropship360_Model_Import_Base.php +618 -0
- includes/src/Logicbroker_Dropship360_Model_Import_Ftp.php +127 -0
- includes/src/Logicbroker_Dropship360_Model_Import_Ftpimport.php +240 -0
- includes/src/Logicbroker_Dropship360_Model_Import_Manualimport.php +61 -0
- includes/src/Logicbroker_Dropship360_Model_Import_Productsetup.php +249 -0
- includes/src/Logicbroker_Dropship360_Model_Inventory.php +242 -79
- includes/src/Logicbroker_Dropship360_Model_Inventorylog.php +70 -0
- includes/src/Logicbroker_Dropship360_Model_Observer.php +68 -318
- includes/src/Logicbroker_Dropship360_Model_Order_Api.php +13 -4
- includes/src/Logicbroker_Dropship360_Model_Orderitems.php +4 -0
- includes/src/Logicbroker_Dropship360_Model_Ordersourcing.php +255 -3
- includes/src/Logicbroker_Dropship360_Model_Productimport.php +1 -1
- includes/src/Logicbroker_Dropship360_Model_Ranking.php +3 -2
- includes/src/Logicbroker_Dropship360_Model_Resource_Orderitems.php +1 -0
- includes/src/Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist.php +1 -1
- includes/src/Logicbroker_Dropship360_Model_Uploadvendor.php +3 -1497
- package.xml +4 -4
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Edit/Vendortab.php
CHANGED
@@ -28,7 +28,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab extends M
|
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
-
return $this->getUrl('
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
+
return $this->getUrl('adminhtml/logicbroker_inventory/vendors', array('_current' => true));
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Edit/Vendortabhistory.php
CHANGED
@@ -28,7 +28,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory ex
|
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
-
return $this->getUrl('
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
+
return $this->getUrl('adminhtml/logicbroker_inventory/vendorshistory', array('_current' => true));
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Inventory/Grid.php
CHANGED
@@ -26,7 +26,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid extends Mage_Adminh
|
|
26 |
$collection = Mage::getModel('dropship360/inventory')->getCollection();
|
27 |
$collection->getSelect()->join(array('lbRanking'=>Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')),'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array('lb_vendor_name'));
|
28 |
$collection->getSelect()->joinLeft(array('prod' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),'prod.sku = main_table.product_sku',array('magento_pro_id'=>'entity_id'));
|
29 |
-
$collection->getSelect()->joinLeft(array('cpev' => Mage::getSingleton('core/resource')->getTableName('catalog/product').'_varchar'),'cpev.entity_id=prod.entity_id AND cpev.attribute_id='.$prodNameAttrId.'',array('product_name' => 'value'));
|
30 |
$collection->getSelect()->where('prod.entity_id IS NOT NULL');
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
26 |
$collection = Mage::getModel('dropship360/inventory')->getCollection();
|
27 |
$collection->getSelect()->join(array('lbRanking'=>Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')),'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array('lb_vendor_name'));
|
28 |
$collection->getSelect()->joinLeft(array('prod' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),'prod.sku = main_table.product_sku',array('magento_pro_id'=>'entity_id'));
|
29 |
+
$collection->getSelect()->joinLeft(array('cpev' => Mage::getSingleton('core/resource')->getTableName('catalog/product').'_varchar'),'cpev.store_id = 0 AND cpev.entity_id=prod.entity_id AND cpev.attribute_id='.$prodNameAttrId.'',array('product_name' => 'value'));
|
30 |
$collection->getSelect()->where('prod.entity_id IS NOT NULL');
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Sourcing.php
CHANGED
@@ -22,6 +22,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Sourcing extends Mage_Adminhtml_Bl
|
|
22 |
|
23 |
$lbItemCollection = Mage::getModel('dropship360/orderitems')->getCollection()->addFieldTofilter('item_order_id',$item->getOrderId())->addFieldTofilter('sku',$item->getSku());
|
24 |
$lbItemCollection->getSelect()->joinLeft( array('lbr'=> Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')), "main_table.lb_vendor_code = lbr.lb_vendor_code",array("lbr.lb_vendor_name"));
|
|
|
25 |
return $lbItemCollection->getFirstItem ();
|
26 |
}
|
27 |
}
|
22 |
|
23 |
$lbItemCollection = Mage::getModel('dropship360/orderitems')->getCollection()->addFieldTofilter('item_order_id',$item->getOrderId())->addFieldTofilter('sku',$item->getSku());
|
24 |
$lbItemCollection->getSelect()->joinLeft( array('lbr'=> Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')), "main_table.lb_vendor_code = lbr.lb_vendor_code",array("lbr.lb_vendor_name"));
|
25 |
+
$lbItemCollection->getSelect()->limit(1);
|
26 |
return $lbItemCollection->getFirstItem ();
|
27 |
}
|
28 |
}
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Sourcing/Pomanagment.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Poll manager grid
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Pomanagment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
35 |
+
{
|
36 |
+
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
$this->_controller = 'adminhtml_sourcing';
|
40 |
+
$this->_headerText = Mage::helper('poll')->__('PO Management');
|
41 |
+
$this->_blockGroup = 'dropship360';
|
42 |
+
//$this->_addButtonLabel = Mage::helper('poll')->__('Add New Poll');
|
43 |
+
parent::__construct();
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/System/Config/Ftpconnectionbutton.php
CHANGED
@@ -49,7 +49,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton
|
|
49 |
*/
|
50 |
public function getAjaxSyncUrl()
|
51 |
{
|
52 |
-
return $this->getUrl('
|
53 |
}
|
54 |
|
55 |
|
49 |
*/
|
50 |
public function getAjaxSyncUrl()
|
51 |
{
|
52 |
+
return $this->getUrl('adminhtml/logicbroker_upload/validateftpconnection');
|
53 |
}
|
54 |
|
55 |
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Upload.php
CHANGED
@@ -19,7 +19,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload extends Mage_Adminhtml_Bloc
|
|
19 |
));
|
20 |
$this->addButton('history',array(
|
21 |
'label' => 'History',
|
22 |
-
'onclick' => 'setLocation(\'' . $this->getUrl('*/
|
23 |
'class' => 'save',
|
24 |
));
|
25 |
parent::__construct();
|
@@ -105,6 +105,6 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload extends Mage_Adminhtml_Bloc
|
|
105 |
}
|
106 |
protected function getSetupUrl()
|
107 |
{
|
108 |
-
return $this->getUrl('*/
|
109 |
}
|
110 |
}
|
19 |
));
|
20 |
$this->addButton('history',array(
|
21 |
'label' => 'History',
|
22 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/logicbroker_upload/vendorsuploadhistory') .'\')',
|
23 |
'class' => 'save',
|
24 |
));
|
25 |
parent::__construct();
|
105 |
}
|
106 |
protected function getSetupUrl()
|
107 |
{
|
108 |
+
return $this->getUrl('*/logicbroker_upload/run');
|
109 |
}
|
110 |
}
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Upload/Edit/Form.php
CHANGED
@@ -18,7 +18,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form extends Mage_Admi
|
|
18 |
$isProductSetupMode = $this->getProductsetupmode();
|
19 |
$form = new Varien_Data_Form(array(
|
20 |
'id' => 'edit_form',
|
21 |
-
'action' => ($isProductSetupMode) ? $this->getUrl('*/
|
22 |
'method' => 'post',
|
23 |
'enctype' => 'multipart/form-data'
|
24 |
));
|
18 |
$isProductSetupMode = $this->getProductsetupmode();
|
19 |
$form = new Varien_Data_Form(array(
|
20 |
'id' => 'edit_form',
|
21 |
+
'action' => ($isProductSetupMode) ? $this->getUrl('*/logicbroker_upload/uploadFile') : $this->getUrl('*/*/uploadFile'),
|
22 |
'method' => 'post',
|
23 |
'enctype' => 'multipart/form-data'
|
24 |
));
|
app/code/community/Logicbroker/Dropship360/Block/Adminhtml/Vendorproductuploadhistory.php
CHANGED
@@ -6,74 +6,95 @@
|
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
-
class Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory extends
|
10 |
{
|
11 |
-
|
12 |
-
protected $
|
13 |
-
|
14 |
-
|
15 |
-
'row_qty'=>'Bad Data for Qty at Row(s) row_num',
|
16 |
-
'row_cost'=>'Bad Data for Cost at Row(s) row_num',
|
17 |
-
'empty_file'=>'Sorry,we cant find the record to update inventory',
|
18 |
-
'inventory_update_error'=>'Error in updating magento product inventory, magento_sku',
|
19 |
-
'magento_sku_exists'=>'magento product sku not exist magento_sku',
|
20 |
-
'inventory_add_error'=>'Error in adding magento product inventory, magento_sku',
|
21 |
-
'combination_notexist'=>'Vendor Sku vendor_sku & Supplier code vendor_code combination does not exist',
|
22 |
-
'already_assigned'=>'Vendor sku vendor_sku is already been assigned for this vendor',
|
23 |
-
'duplicate_vendor_sku'=>'Vendor sku vendor_sku is duplicate in Magento Sku magento_sku for this supplier',
|
24 |
-
'combination_exist'=> 'Vendor sku vendor_sku or Supplier code vendor_code combination already present for Magento Sku magento_sku',
|
25 |
-
'data_notchnage'=> 'Cost & Qty for Vendor Sku vendor_sku & Supplier code vendor_code not changed',
|
26 |
-
'lb_upc_notexist'=> 'UPC attribute missing vendor_sku',
|
27 |
-
'lb_upc_multiple'=> 'Multiple Match found for UPC vendor_sku',
|
28 |
-
'lb_mnp_notexist'=> 'MNP attribute missing vendor_sku',
|
29 |
-
'lb_mnp_multiple'=> 'Multiple Match found for MNP vendor_sku',
|
30 |
-
'sku_multiple'=> 'Multiple Match found for SKU vendor_sku',
|
31 |
-
'attribute_notexist'=> 'Attribute assigned for Supplier code vendor_code does not exist for Vendor sku vendor_sku'
|
32 |
-
);
|
33 |
-
protected $_replace = array('magento_sku','vendor_sku','vendor_code');
|
34 |
public function __construct()
|
35 |
{
|
36 |
-
$
|
37 |
-
$this->
|
38 |
-
$this->_blockGroup = 'dropship360';
|
39 |
$this->_headerText = Mage::helper('dropship360')->__('Supplier Product Upload Log');
|
40 |
-
|
41 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
'label' => 'Back',
|
43 |
-
'onclick' => 'setLocation(\'' . $
|
44 |
'class' => 'back',
|
45 |
-
)
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$this->
|
50 |
-
|
|
|
|
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
public function getMessageArray(){
|
54 |
-
return
|
55 |
}
|
56 |
|
57 |
public function getReplaceValue(){
|
58 |
-
return
|
59 |
}
|
60 |
-
public function
|
61 |
|
62 |
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
63 |
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
public function getLogDescriptionCollection($error_id){
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
return $
|
77 |
}
|
78 |
|
79 |
public function parseDescription($data,$vendorCode){
|
@@ -109,34 +130,14 @@ protected $_replace = array('magento_sku','vendor_sku','vendor_code');
|
|
109 |
return '<li>'.$string.'</li>';
|
110 |
}
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
{
|
123 |
-
$decodedata[] = array_merge($dataTemp, $this->getDecodedJson($eachRow['description']));
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}else
|
127 |
-
{
|
128 |
-
$decodedata = $this->getDecodedJson($data);
|
129 |
-
}
|
130 |
-
return $decodedata;
|
131 |
-
}
|
132 |
-
protected function getDecodedJson($data)
|
133 |
-
{
|
134 |
-
if(empty($data) || !Mage::helper('dropship360')->isJson($data)){
|
135 |
-
return $data;
|
136 |
-
}
|
137 |
-
$data = trim($data,'"');
|
138 |
-
$data = trim($data,'\'');
|
139 |
-
$decodedata = Mage::helper('core')->jsonDecode($data);
|
140 |
-
return $decodedata;
|
141 |
-
}
|
142 |
}
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
+
class Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory extends Mage_Core_Block_Template
|
10 |
{
|
11 |
+
protected $_message;
|
12 |
+
protected $_replace;
|
13 |
+
protected $_backButtonUrl;
|
14 |
+
protected $_headerText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function __construct()
|
16 |
{
|
17 |
+
$this->setBackButtonUrl();
|
18 |
+
$this->setMsgVariables();
|
|
|
19 |
$this->_headerText = Mage::helper('dropship360')->__('Supplier Product Upload Log');
|
20 |
+
parent::__construct();
|
21 |
+
$this->setCollection($this->_initCollection());
|
22 |
+
}
|
23 |
+
protected function setMsgVariables(){
|
24 |
+
$this->_message = $this->getMessageArray();
|
25 |
+
$this->_replace = $this->getReplaceValue();
|
26 |
+
}
|
27 |
+
protected function setBackButtonUrl()
|
28 |
+
{
|
29 |
+
$params = Mage::app()->getRequest()->getParams();
|
30 |
+
if(array_key_exists("p",$params) ||array_key_exists("limit",$params)){
|
31 |
+
$this->_backButtonUrl = Mage::getSingleton('adminhtml/session')->getBackButtonUrl();
|
32 |
+
}else
|
33 |
+
{
|
34 |
+
$this->_backButtonUrl = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer() : Mage::getUrl('*/*/');
|
35 |
+
Mage::getSingleton('adminhtml/session')->setBackButtonUrl( $this->_backButtonUrl);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getButtonsHtml()
|
40 |
+
{
|
41 |
+
$childId = 'back_button';
|
42 |
+
|
43 |
+
$data = array(
|
44 |
'label' => 'Back',
|
45 |
+
'onclick' => 'setLocation(\'' . $this->_backButtonUrl .'\')',
|
46 |
'class' => 'back',
|
47 |
+
);
|
48 |
+
$out = '';
|
49 |
+
$block = $this->getLayout()->createBlock('adminhtml/widget_button');
|
50 |
+
$this->setChild($childId, $block);
|
51 |
+
$child = $this->getChild($childId);
|
52 |
+
$child->setData($data);
|
53 |
+
$out = $this->getChildHtml($childId);
|
54 |
+
return $out;
|
55 |
}
|
56 |
+
|
57 |
+
|
58 |
+
public function getHeaderHtml()
|
59 |
+
{
|
60 |
+
return '<h3 class="header-adminhtml-ranking">' . $this->_headerText . '</h3>';
|
61 |
+
}
|
62 |
|
63 |
public function getMessageArray(){
|
64 |
+
return Mage::getModel('dropship360/inventorylog')->getMessageArray();
|
65 |
}
|
66 |
|
67 |
public function getReplaceValue(){
|
68 |
+
return Mage::getModel('dropship360/inventorylog')->getReplaceValue();
|
69 |
}
|
70 |
+
public function _initCollection(){
|
71 |
|
72 |
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
73 |
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
74 |
+
$collection = new Varien_Data_Collection_Db($conn);
|
75 |
+
$collection->setConnection($conn);
|
76 |
+
$collection->getSelect()->from($tableVendorImportLog)->order('created_at DESC');
|
77 |
+
return $collection;
|
78 |
}
|
79 |
|
80 |
+
protected function pager(){
|
81 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
|
82 |
+
$pager->setTemplate('logicbroker/html/pager.phtml');
|
83 |
+
$pager->setAvailableLimit(array(20=>20,50=>50,100=>100,200=>200));
|
84 |
+
$pager->setCollection($this->getCollection());
|
85 |
+
//$pager->setData('area','frontend');
|
86 |
+
$this->setChild('pager', $pager);
|
87 |
+
$this->getCollection()->load();
|
88 |
+
return $this;
|
89 |
+
|
90 |
+
}
|
91 |
public function getLogDescriptionCollection($error_id){
|
92 |
+
|
93 |
+
return Mage::getModel('dropship360/inventorylog')->getLogDescriptionCollection($error_id);
|
94 |
+
}
|
95 |
+
public function prepareRowData($data)
|
96 |
+
{
|
97 |
+
return Mage::getModel('dropship360/inventorylog')->prepareRowData($data);
|
98 |
}
|
99 |
|
100 |
public function parseDescription($data,$vendorCode){
|
130 |
return '<li>'.$string.'</li>';
|
131 |
}
|
132 |
|
133 |
+
protected function _prepareLayout()
|
134 |
+
{
|
135 |
+
parent::_prepareLayout();
|
136 |
+
$this->pager();
|
137 |
+
}
|
138 |
+
|
139 |
+
public function getPagerHtml()
|
140 |
+
{
|
141 |
+
return $this->getChildHtml('pager');
|
142 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
app/code/community/Logicbroker/Dropship360/Helper/Data.php
CHANGED
@@ -17,12 +17,13 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
17 |
const LOGICBROKER_ITEM_STATUS_CANCELLED = 'Cancelled';
|
18 |
const LOGICBROKER_ITEM_STATUS_NO_DROPSHIP = 'No Dropship';
|
19 |
const LOGICBROKER_ITEM_STATUS_COMPLETED = 'Completed';
|
|
|
20 |
const LOGICBROKER_PRODUCT_LINK_UPC = 'UPC';
|
21 |
const LOGICBROKER_PRODUCT_LINK_MNP = 'Manufacturer Part Number';
|
22 |
const LOGICBROKER_PRODUCT_LINK_SKU = 'Magento Sku';
|
23 |
const LOGICBROKER_PRODUCT_LINK_NONE = 'None';
|
24 |
-
const LOGICBROKER_PRODUCT_LINK_CODE_UPC = '
|
25 |
-
const LOGICBROKER_PRODUCT_LINK_CODE_MNP = '
|
26 |
const LOGICBROKER_PRODUCT_LINK_CODE_SKU = 'sku';
|
27 |
protected $_maxtime = 60; // time in minutes
|
28 |
public function getConfigObject($nodeName = null)
|
@@ -32,7 +33,17 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
32 |
|
33 |
public function getItemStatuses()
|
34 |
{
|
35 |
-
return array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
|
@@ -60,6 +71,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
60 |
$product_collection = Mage::getResourceModel('catalog/product_collection');
|
61 |
$product_collection->getSelect()->join(Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item', 'e.entity_id ='.Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item.product_id');
|
62 |
$product_collection->getSelect()->where('e.sku = ' ."'" .$product_sku."'");
|
|
|
63 |
$product_collection_count = count($product_collection);
|
64 |
if($product_collection_count > 0)
|
65 |
{
|
@@ -254,7 +266,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
254 |
return array('error' => true);
|
255 |
}
|
256 |
$io = new Varien_Io_File();
|
257 |
-
$path = Mage::getBaseDir('var') . DS . 'export'
|
258 |
$name = md5(microtime());
|
259 |
$file = $path . DS . $name . '.csv';
|
260 |
$io->setAllowCreateFolders(true);
|
@@ -289,6 +301,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
289 |
unset($csv);
|
290 |
}
|
291 |
}
|
|
|
292 |
return array(
|
293 |
'type' => 'filename',
|
294 |
'value' => $file,
|
@@ -299,11 +312,11 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
299 |
}
|
300 |
public function prepareExportVaues($description,$vendorCode){
|
301 |
$csvData = array();
|
302 |
-
$decodedata = Mage::
|
303 |
if(!is_array($decodedata) || empty($decodedata))
|
304 |
return empty($decodedata) ? implode('',$decodedata) : $decodedata;
|
305 |
foreach($decodedata as $data){
|
306 |
-
$msgArray = Mage::
|
307 |
$msg = $msgArray[$data['error_type']];
|
308 |
if(is_array($data['value']) && !empty($data['value'])){
|
309 |
$csvData[] = array('magento_sku'=>$data['value']['magento_sku'],'vendor_sku'=>$data['value']['vendor_sku'],'cost'=>$data['value']['cost'],'qty'=>$data['value']['qty'],'reason'=> $this->genrateHtml($data['value'],$msg,$vendorCode));
|
@@ -314,7 +327,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
314 |
return $csvData;
|
315 |
}
|
316 |
public function genrateHtml($value,$msg,$vendorCode){
|
317 |
-
$replace = Mage::
|
318 |
$string = $msg;
|
319 |
$value['vendor_code'] = $vendorCode;
|
320 |
foreach($replace as $val){
|
@@ -420,4 +433,8 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
420 |
$vendorRankModel = Mage::getSingleton('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
421 |
return $vendorRankModel->getLbVendorName();
|
422 |
}
|
|
|
|
|
|
|
|
|
423 |
}
|
17 |
const LOGICBROKER_ITEM_STATUS_CANCELLED = 'Cancelled';
|
18 |
const LOGICBROKER_ITEM_STATUS_NO_DROPSHIP = 'No Dropship';
|
19 |
const LOGICBROKER_ITEM_STATUS_COMPLETED = 'Completed';
|
20 |
+
const LOGICBROKER_ITEM_STATUS_ERROR = 'Error';
|
21 |
const LOGICBROKER_PRODUCT_LINK_UPC = 'UPC';
|
22 |
const LOGICBROKER_PRODUCT_LINK_MNP = 'Manufacturer Part Number';
|
23 |
const LOGICBROKER_PRODUCT_LINK_SKU = 'Magento Sku';
|
24 |
const LOGICBROKER_PRODUCT_LINK_NONE = 'None';
|
25 |
+
const LOGICBROKER_PRODUCT_LINK_CODE_UPC = 'upc';
|
26 |
+
const LOGICBROKER_PRODUCT_LINK_CODE_MNP = 'manufacturer_part_number';
|
27 |
const LOGICBROKER_PRODUCT_LINK_CODE_SKU = 'sku';
|
28 |
protected $_maxtime = 60; // time in minutes
|
29 |
public function getConfigObject($nodeName = null)
|
33 |
|
34 |
public function getItemStatuses()
|
35 |
{
|
36 |
+
return array (
|
37 |
+
self::LOGICBROKER_ITEM_STATUS_SOURCING,
|
38 |
+
self::LOGICBROKER_ITEM_STATUS_REPROCESS,
|
39 |
+
self::LOGICBROKER_ITEM_STATUS_BACKORDER,
|
40 |
+
self::LOGICBROKER_ITEM_STATUS_TRANSMITTING,
|
41 |
+
self::LOGICBROKER_ITEM_STATUS_SENT_TO_SUPPLIER,
|
42 |
+
self::LOGICBROKER_ITEM_STATUS_CANCELLED,
|
43 |
+
self::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP,
|
44 |
+
self::LOGICBROKER_ITEM_STATUS_COMPLETED,
|
45 |
+
self::LOGICBROKER_ITEM_STATUS_ERROR
|
46 |
+
);
|
47 |
}
|
48 |
|
49 |
|
71 |
$product_collection = Mage::getResourceModel('catalog/product_collection');
|
72 |
$product_collection->getSelect()->join(Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item', 'e.entity_id ='.Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item.product_id');
|
73 |
$product_collection->getSelect()->where('e.sku = ' ."'" .$product_sku."'");
|
74 |
+
$product_collection->getSelect()->limit(1);
|
75 |
$product_collection_count = count($product_collection);
|
76 |
if($product_collection_count > 0)
|
77 |
{
|
266 |
return array('error' => true);
|
267 |
}
|
268 |
$io = new Varien_Io_File();
|
269 |
+
$path = Mage::getBaseDir('var') . DS . 'export';
|
270 |
$name = md5(microtime());
|
271 |
$file = $path . DS . $name . '.csv';
|
272 |
$io->setAllowCreateFolders(true);
|
301 |
unset($csv);
|
302 |
}
|
303 |
}
|
304 |
+
$io->streamClose();
|
305 |
return array(
|
306 |
'type' => 'filename',
|
307 |
'value' => $file,
|
312 |
}
|
313 |
public function prepareExportVaues($description,$vendorCode){
|
314 |
$csvData = array();
|
315 |
+
$decodedata = Mage::getModel('dropship360/inventorylog')->prepareRowData($description);
|
316 |
if(!is_array($decodedata) || empty($decodedata))
|
317 |
return empty($decodedata) ? implode('',$decodedata) : $decodedata;
|
318 |
foreach($decodedata as $data){
|
319 |
+
$msgArray = Mage::getModel('dropship360/inventorylog')->getMessageArray();
|
320 |
$msg = $msgArray[$data['error_type']];
|
321 |
if(is_array($data['value']) && !empty($data['value'])){
|
322 |
$csvData[] = array('magento_sku'=>$data['value']['magento_sku'],'vendor_sku'=>$data['value']['vendor_sku'],'cost'=>$data['value']['cost'],'qty'=>$data['value']['qty'],'reason'=> $this->genrateHtml($data['value'],$msg,$vendorCode));
|
327 |
return $csvData;
|
328 |
}
|
329 |
public function genrateHtml($value,$msg,$vendorCode){
|
330 |
+
$replace = Mage::getModel('dropship360/inventorylog')->getReplaceValue();
|
331 |
$string = $msg;
|
332 |
$value['vendor_code'] = $vendorCode;
|
333 |
foreach($replace as $val){
|
433 |
$vendorRankModel = Mage::getSingleton('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
434 |
return $vendorRankModel->getLbVendorName();
|
435 |
}
|
436 |
+
|
437 |
+
public function convertToHtmlcode($name){
|
438 |
+
return htmlentities($name,ENT_QUOTES,'ISO-8859-1');
|
439 |
+
}
|
440 |
}
|
app/code/community/Logicbroker/Dropship360/Model/Csvparser.php
CHANGED
@@ -12,8 +12,8 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
12 |
protected $dbConnection;
|
13 |
protected $tableName;
|
14 |
protected $vendorObject;
|
15 |
-
protected $chunksize =
|
16 |
-
|
17 |
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
18 |
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
19 |
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
@@ -21,6 +21,7 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
21 |
protected $_indexVendorSku = 0;
|
22 |
protected $_indexStock = 1;
|
23 |
protected $_indexPrice = 2;
|
|
|
24 |
|
25 |
public function __construct(){
|
26 |
|
@@ -47,6 +48,9 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
47 |
return $result;
|
48 |
}
|
49 |
|
|
|
|
|
|
|
50 |
protected function checkFtpHeader($header)
|
51 |
{
|
52 |
if(count($header) == 4 )
|
@@ -57,37 +61,52 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
57 |
}
|
58 |
}
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
{
|
65 |
-
return $csvData;
|
66 |
-
}
|
67 |
$this->emptyTable();
|
68 |
-
$this->checkFtpHeader($
|
|
|
69 |
$insertQuery = $this->insertMultiple($csvData,$vendorCode);
|
70 |
-
if
|
71 |
-
|
72 |
-
|
73 |
}
|
74 |
else{
|
75 |
$parsedData = $csvData;
|
76 |
}
|
77 |
return $parsedData;
|
78 |
}
|
79 |
-
|
|
|
|
|
80 |
protected function insertMultiple($csvData,$vendorCode){
|
81 |
$connection = $this->dbConnection->getConnection ( 'core_write' );
|
82 |
$csvArray = array();
|
83 |
-
|
84 |
-
foreach($
|
85 |
-
{
|
86 |
-
foreach ($value as $key=>$data)
|
87 |
{
|
88 |
-
if
|
|
|
89 |
continue;
|
90 |
-
$csvArray[] = array('vendor_code'=>$vendorCode,'csv_vendor_sku'=>trim($data [$this->_indexVendorSku]),'csv_stock'=>$data [$this->_indexStock],'csv_price'=>$data [$this->_indexPrice]);
|
91 |
}
|
92 |
try {
|
93 |
$connection->insertOnDuplicate($this->tableName,$csvArray,array('csv_vendor_sku','csv_stock','csv_price'));
|
@@ -95,8 +114,6 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
95 |
Mage::log($e->getTrace(),null,'logicbroker_debug.log');
|
96 |
return false;
|
97 |
}
|
98 |
-
$csvArray = array();
|
99 |
-
}
|
100 |
return true;
|
101 |
}
|
102 |
|
@@ -113,27 +130,70 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
113 |
Mage::log($e->getMessage(), null, 'vendor_inventory_import_error.log');
|
114 |
return false;
|
115 |
}
|
116 |
-
|
117 |
}
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
}
|
134 |
-
return $chnagedValue;
|
135 |
}
|
136 |
-
|
137 |
public function emptyTable()
|
138 |
{
|
139 |
$write = $this->dbConnection->getConnection ( 'core_write' );
|
@@ -190,55 +250,7 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
190 |
->date($date, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
|
191 |
return $date;
|
192 |
}
|
193 |
-
|
194 |
-
{
|
195 |
-
$records = array();
|
196 |
-
foreach($csvData as $row => $csvRowData)
|
197 |
-
{
|
198 |
-
if($row == 0)
|
199 |
-
continue;
|
200 |
-
if(!$isProductSetupMode)
|
201 |
-
{
|
202 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
203 |
-
if(is_numeric($csvRowData[2])){
|
204 |
-
/* LBN - 935 change */
|
205 |
-
$magento_sku = Mage::getModel('dropship360/uploadvendor')->getMagentoSku($lb_vendor_code, trim($csvRowData[1]));
|
206 |
-
$csvqty = (!empty($magento_sku)) ? Mage::helper('dropship360')->getIsQtyDecimal($magento_sku,$csvRowData[2]) : $csvRowData[2];;
|
207 |
-
}
|
208 |
-
else
|
209 |
-
{
|
210 |
-
$csvqty = $csvRowData[2];
|
211 |
-
}
|
212 |
-
}
|
213 |
-
if(!$isProductSetupMode)
|
214 |
-
$records[$row] = array('vendor_sku'=>trim($csvRowData[1]),'qty'=>$csvqty ,'cost'=>$csvRowData[3],'lb_vendor_code'=>$lb_vendor_code);
|
215 |
-
else
|
216 |
-
$records[$row] = array('magento_sku'=>trim($csvRowData[0]),'vendor_sku'=>trim($csvRowData[1]),'qty'=>0 ,'cost'=>0,'lb_vendor_code'=>$lb_vendor_code);
|
217 |
-
}
|
218 |
-
return $records;
|
219 |
-
}
|
220 |
-
public function generateFtpCsvRow($csvData,$vendorCode)
|
221 |
-
{
|
222 |
-
$records = array();
|
223 |
-
foreach($csvData as $row => $csvRowData)
|
224 |
-
{
|
225 |
-
if($row == 0)
|
226 |
-
continue;
|
227 |
-
//patch for backwards compatible for ftp change lbn-1070
|
228 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
229 |
-
if(is_numeric($csvRowData[2]) || $csvRowData[2] > 0){
|
230 |
-
/* LBN - 935 change */
|
231 |
-
$magento_sku = Mage::getModel('dropship360/uploadvendor')->getMagentoSku($vendorCode, trim($csvRowData[1]));
|
232 |
-
(! empty ( $magento_sku )) ? $qty = Mage::helper ( 'dropship360' )->getIsQtyDecimal ( $magento_sku, $csvRowData [2] ) : $qty = $csvRowData [2];
|
233 |
-
/* End of LBN - 935 change */
|
234 |
-
}else{
|
235 |
-
$qty = $csvRowData[2];
|
236 |
-
}
|
237 |
-
$records[$row] = array('lb_vendor_code'=>$vendorCode,'vendor_sku'=>trim($csvRowData[1]),'qty'=>$qty ,'cost'=>$csvRowData[3]);
|
238 |
-
//$vendorCode = $csvRowData[0];
|
239 |
-
}
|
240 |
-
return $records;
|
241 |
-
}
|
242 |
public function isCsvFileEmpty()
|
243 |
{
|
244 |
return (count($this->getCsvRows()) > 0) ? false : true;
|
12 |
protected $dbConnection;
|
13 |
protected $tableName;
|
14 |
protected $vendorObject;
|
15 |
+
protected $chunksize = 100;
|
16 |
+
protected $_vendorCode;
|
17 |
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
18 |
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
19 |
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
21 |
protected $_indexVendorSku = 0;
|
22 |
protected $_indexStock = 1;
|
23 |
protected $_indexPrice = 2;
|
24 |
+
protected $_vendorName;
|
25 |
|
26 |
public function __construct(){
|
27 |
|
48 |
return $result;
|
49 |
}
|
50 |
|
51 |
+
/*
|
52 |
+
* check ftp backward compatibility header
|
53 |
+
*/
|
54 |
protected function checkFtpHeader($header)
|
55 |
{
|
56 |
if(count($header) == 4 )
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
/*
|
65 |
+
* set vendorCode and vendorName
|
66 |
+
*/
|
67 |
+
protected function setVendorDetails($vendorCode) {
|
68 |
+
if(isset($this->_vendorCode) && isset($this->_vendorAttribute))
|
69 |
+
return;
|
70 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
71 |
+
$this->_vendorCode = $vendorCode;
|
72 |
+
//$this->_vendorAttribute = $ranking->getLinkingAttribute();
|
73 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
74 |
+
}
|
75 |
+
/*
|
76 |
+
* @return array in following from
|
77 |
+
* @change_row => values has been chnaged
|
78 |
+
* @rel_not_exist => relation not exist in vendor inventory table
|
79 |
+
*/
|
80 |
+
public function getChangedValue($csvData,$vendorCode,$header = array()){
|
81 |
|
82 |
+
$parsedData = array();
|
83 |
+
$this->setVendorDetails($vendorCode);
|
|
|
|
|
|
|
84 |
$this->emptyTable();
|
85 |
+
$this->checkFtpHeader($header);
|
86 |
+
//insert csv data in csv_temp_table
|
87 |
$insertQuery = $this->insertMultiple($csvData,$vendorCode);
|
88 |
+
//if error than return orignal csvdata
|
89 |
+
if($insertQuery){
|
90 |
+
$parsedData = $this->prepareCsvjoin();
|
91 |
}
|
92 |
else{
|
93 |
$parsedData = $csvData;
|
94 |
}
|
95 |
return $parsedData;
|
96 |
}
|
97 |
+
/*
|
98 |
+
* Insert records in csv tmp table.
|
99 |
+
*/
|
100 |
protected function insertMultiple($csvData,$vendorCode){
|
101 |
$connection = $this->dbConnection->getConnection ( 'core_write' );
|
102 |
$csvArray = array();
|
103 |
+
|
104 |
+
foreach ($csvData as $key=>$data)
|
|
|
|
|
105 |
{
|
106 |
+
//if row is empty
|
107 |
+
if(count(array_filter($data, "strlen")) == 0 )
|
108 |
continue;
|
109 |
+
$csvArray[] = array('row_id'=>$key,'vendor_code'=>$vendorCode,'csv_vendor_sku'=>trim($data [$this->_indexVendorSku]),'csv_stock'=>$data [$this->_indexStock],'csv_price'=>$data [$this->_indexPrice]);
|
110 |
}
|
111 |
try {
|
112 |
$connection->insertOnDuplicate($this->tableName,$csvArray,array('csv_vendor_sku','csv_stock','csv_price'));
|
114 |
Mage::log($e->getTrace(),null,'logicbroker_debug.log');
|
115 |
return false;
|
116 |
}
|
|
|
|
|
117 |
return true;
|
118 |
}
|
119 |
|
130 |
Mage::log($e->getMessage(), null, 'vendor_inventory_import_error.log');
|
131 |
return false;
|
132 |
}
|
|
|
133 |
}
|
134 |
|
135 |
+
/*
|
136 |
+
* prepare CSV data with additional column along CSV are totalQty,isDecimal,sku,product_id
|
137 |
+
* @return array change_row,unchange_row,rel_not_exist
|
138 |
+
*/
|
139 |
+
protected function prepareCsvjoin(){
|
140 |
+
$changedValue =array();
|
141 |
+
//$changedValue[] = $header;
|
142 |
+
$helper = Mage::helper('dropship360');
|
143 |
+
$collection = $this->vendorObject->getCollection();
|
144 |
+
$stockItemTable = $helper->getTableName('cataloginventory/stock_item');
|
145 |
+
$catalogProductTable = $helper->getTableName('catalog/product');
|
146 |
+
$isDecimalQuery = '(select is_qty_decimal from '.$stockItemTable.' where product_id = catalog.entity_id) as is_decimal';
|
147 |
+
$qtyQuery = '(select IFNULL(SUM(stock),0) from '.$collection->getMainTable().' where product_sku = main_table.product_sku and lb_vendor_code != main_table.lb_vendor_code) as qty';
|
148 |
+
|
149 |
+
$collection->addFieldToSelect(array('lb_vendor_code','lb_vendor_sku','stock','cost','product_sku'));
|
150 |
+
$collection->getSelect()
|
151 |
+
->join(array('inventory'=>$this->tableName),'inventory.vendor_code = main_table.lb_vendor_code and inventory.csv_vendor_sku = main_table.lb_vendor_sku')
|
152 |
+
->where('inventory.csv_stock != main_table.stock or inventory.csv_price != main_table.cost');
|
153 |
+
$collection->getSelect()
|
154 |
+
->join(array('catalog'=>$catalogProductTable),'catalog.sku = main_table.product_sku',array('entity_id'));
|
155 |
+
$collection->getSelect()->columns($qtyQuery);
|
156 |
+
$collection->getSelect()->columns($isDecimalQuery);
|
157 |
+
|
158 |
+
if($collection->getSize() > 0 ){
|
159 |
+
foreach($collection as $data){
|
160 |
+
$csvArray[] = array('vendor_code'=>$data->getLbVendorCode(),'csv_vendor_sku'=>$data->getCsvVendorSku());
|
161 |
+
$stock = ($data->getIsDecimal() || !is_numeric($data->getCsvStock()) ) ? $data->getCsvStock() : floor($data->getCsvStock());
|
162 |
+
$changedValue['change_row'][$data->getRowId()] = array($data->getCsvVendorSku(),$stock,$data->getCsvPrice(),'row_id'=>$data->getRowId(),'magento_sku'=>$data->getProductSku(),'product_qty'=>$data->getQty(),'product_id'=>$data->getEntityId(),'vendor_id'=>$data->getId());
|
163 |
+
}
|
164 |
+
$dbobj = $this->dbConnection->getConnection('core_write');
|
165 |
+
$dbobj->insertOnDuplicate($this->tableName,$csvArray,array('is_processed'=>1));
|
166 |
+
$csvArray = array();
|
167 |
+
}
|
168 |
+
$this->addExtraCol($changedValue);
|
169 |
+
return $changedValue;
|
170 |
+
}
|
171 |
+
//adding extra col in array to minimize DB call
|
172 |
+
public function addExtraCol(&$changedValue){
|
173 |
+
$helper = Mage::helper('dropship360');
|
174 |
+
$inventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
175 |
+
$catalogProductTable = $helper->getTableName('catalog/product');
|
176 |
+
$connection = $this->dbConnection->getConnection('core_write');
|
177 |
+
$select = $connection->select()
|
178 |
+
->from(array('csvtmpdata' => $this->tableName))
|
179 |
+
->joinleft(
|
180 |
+
array('vendor_inventory' => $inventoryTable),
|
181 |
+
'csvtmpdata.vendor_code = vendor_inventory.lb_vendor_code and csvtmpdata.csv_vendor_sku = vendor_inventory.lb_vendor_sku',array('lb_vendor_code','lb_vendor_sku','stock','cost','product_sku'))
|
182 |
+
->joinleft(
|
183 |
+
array('catalogproduct'=>$catalogProductTable),
|
184 |
+
'catalogproduct.sku = vendor_inventory.product_sku',array('sku'))
|
185 |
+
->where('csvtmpdata.is_processed = ?',0);
|
186 |
+
$csvtmpdata = $connection->fetchAll($select);
|
187 |
+
if(count($csvtmpdata) > 0 ){
|
188 |
+
foreach($csvtmpdata as $data){
|
189 |
+
if($data['lb_vendor_code'] || $data['lb_vendor_sku']){
|
190 |
+
$changedValue['unchange_row'][$data['row_id']] = array($data['csv_vendor_sku'],$data[csv_stock],$data['csv_price'],'magento_sku'=>$data['product_sku'],'sku'=>$data['sku']);
|
191 |
+
}else{
|
192 |
+
$changedValue['rel_not_exist'][$data['row_id']] = array($data['csv_vendor_sku'],$data[csv_stock],$data['csv_price']);
|
193 |
+
}
|
194 |
}
|
195 |
}
|
|
|
196 |
}
|
|
|
197 |
public function emptyTable()
|
198 |
{
|
199 |
$write = $this->dbConnection->getConnection ( 'core_write' );
|
250 |
->date($date, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
|
251 |
return $date;
|
252 |
}
|
253 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
public function isCsvFileEmpty()
|
255 |
{
|
256 |
return (count($this->getCsvRows()) > 0) ? false : true;
|
app/code/community/Logicbroker/Dropship360/Model/Import.php
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Import vendor inventory kick off from this file and on the basis of upload type
|
9 |
+
* objects are created.
|
10 |
+
* following oeprations are prefromed :
|
11 |
+
* 1. file and header validation
|
12 |
+
* 2. retrive and remove CSV file from local file system after completed import
|
13 |
+
* 3. Support all three upload type
|
14 |
+
*/
|
15 |
+
class Logicbroker_Dropship360_Model_Import extends Mage_Core_Model_Abstract {
|
16 |
+
const FIELD_NAME_SOURCE_FILE = 'import_file';
|
17 |
+
protected $_colNames;
|
18 |
+
protected $_rowData;
|
19 |
+
protected $_importType;
|
20 |
+
protected $_importObject;
|
21 |
+
protected $_fileObj;
|
22 |
+
protected function _construct() {
|
23 |
+
//$this->_init ( "dropship360/uploadvendor" );
|
24 |
+
$this->_fileObj = $this->fileObj();
|
25 |
+
}
|
26 |
+
|
27 |
+
// initialize variables
|
28 |
+
public function initCsvData($file) {
|
29 |
+
$csvObject = new Varien_File_Csv ();
|
30 |
+
$csvData = $csvObject->getData ( $file );
|
31 |
+
if($csvData)
|
32 |
+
$this->_colNames = $csvData [0];
|
33 |
+
$this->_rowData = $csvData;
|
34 |
+
}
|
35 |
+
/* prepare downloadable sample CSV file for user */
|
36 |
+
public function getCsvFile($isProductSetupMode = false)
|
37 |
+
{
|
38 |
+
$io = new Varien_Io_File();
|
39 |
+
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
|
40 |
+
$name = md5(microtime());
|
41 |
+
$file = $path . DS . $name;
|
42 |
+
$io->setAllowCreateFolders(true);
|
43 |
+
$io->open(array('path' => $path));
|
44 |
+
$io->streamOpen($file, 'w+');
|
45 |
+
$io->streamLock(true);
|
46 |
+
($isProductSetupMode) ? $io->streamWriteCsv(array('magento_sku','vendor_sku')) : $io->streamWriteCsv(array('vendor_sku','qty','cost'));
|
47 |
+
$io->streamUnlock();
|
48 |
+
$io->streamClose();
|
49 |
+
return array(
|
50 |
+
'type' => 'filename',
|
51 |
+
'value' => $file,
|
52 |
+
'rm' => true // can delete file after use
|
53 |
+
);
|
54 |
+
}
|
55 |
+
public function getDatabaseConnection() {
|
56 |
+
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
57 |
+
}
|
58 |
+
protected function _getSession() {
|
59 |
+
return Mage::getSingleton ( 'adminhtml/session' );
|
60 |
+
}
|
61 |
+
public function insertCronEntry($filename, $data = null) {
|
62 |
+
$uploadFile = Mage::getModel('dropship360/uploadvendor');
|
63 |
+
$uploadFile->setFileName ( $filename );
|
64 |
+
$uploadFile->setUpdatedBy ( 'manually' );
|
65 |
+
$uploadFile->setUpdatedAt ( now () );
|
66 |
+
$uploadFile->setLbVendorCode ( Mage::app ()->getRequest ()->getPost ( 'vendor' ) );
|
67 |
+
try {
|
68 |
+
$uploadFile->save ();
|
69 |
+
} catch ( Exception $e ) {
|
70 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( $e->getMessage () ) );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* Import working directory
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
public static function getWorkingDir() {
|
79 |
+
return Mage::getBaseDir ( 'var' ) . DS . 'logicbrokervendorproduct' . DS;
|
80 |
+
}
|
81 |
+
protected function setImportType() {
|
82 |
+
$type = ($this->getProductsetupmode ()) ? 'productsetup' : 'manualimport';
|
83 |
+
$this->_importType = $type;
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
public function getImportType() {
|
87 |
+
return $this->_importType;
|
88 |
+
}
|
89 |
+
public function uploadSource() {
|
90 |
+
$error = false;
|
91 |
+
$vendorCode = $this->getVendor ();
|
92 |
+
$this->setImportType ();
|
93 |
+
$entity = 'vendor_product_' . date ( 'ymdHis' );
|
94 |
+
$uploader = Mage::getModel ( 'core/file_uploader', self::FIELD_NAME_SOURCE_FILE );
|
95 |
+
$uploader->skipDbProcessing ( true );
|
96 |
+
$result = $uploader->save ( self::getWorkingDir () );
|
97 |
+
$extension = pathinfo ( $result ['file'], PATHINFO_EXTENSION );
|
98 |
+
$uploadedFile = $result ['path'] . $result ['file'];
|
99 |
+
$this->initCsvData ( $uploadedFile );
|
100 |
+
$error = $this->validateCsv ();
|
101 |
+
if ($error) {
|
102 |
+
$this->_fileObj->rm ( $uploadedFile );
|
103 |
+
$this->_getSession ()->addNotice ( Mage::helper ( 'dropship360' )->__ ( 'Please fix errors and re-upload file' ) );
|
104 |
+
return $error;
|
105 |
+
}
|
106 |
+
|
107 |
+
$sourceFile = self::getWorkingDir () . $entity;
|
108 |
+
|
109 |
+
$sourceFile .= '.' . strtolower ( $extension );
|
110 |
+
$fileName = $entity . '.' . strtolower ( $extension );
|
111 |
+
|
112 |
+
if (strtolower ( $uploadedFile ) != strtolower ( $sourceFile )) {
|
113 |
+
if ($this->_fileObj->fileExists( $sourceFile )) {
|
114 |
+
$this->_fileObj->rm ( $sourceFile );
|
115 |
+
}
|
116 |
+
|
117 |
+
if (! @rename($uploadedFile,$sourceFile )) {
|
118 |
+
Mage::throwException ( Mage::helper ( 'importexport' )->__ ( 'Source file moving failed' ) );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
Mage::register ( 'file_name', $fileName );
|
122 |
+
if (! $error)
|
123 |
+
$this->insertCronEntry ( $fileName );
|
124 |
+
|
125 |
+
return $error;
|
126 |
+
}
|
127 |
+
public function validateCsv() {
|
128 |
+
$isFailed = false;
|
129 |
+
// create object as per requested import type
|
130 |
+
$this->_importObject = Mage::getModel ( 'dropship360/import_' . $this->getImportType () );
|
131 |
+
|
132 |
+
//check for empty csv file
|
133 |
+
if(count($this->_rowData) <= 1){
|
134 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( 'CSV file is empty ') );
|
135 |
+
$isFailed = true;
|
136 |
+
}
|
137 |
+
// checks columns
|
138 |
+
elseif (!$this->_importObject->validateCsvHeader ( $this->_colNames ) || empty ( $this->_colNames ) ) {
|
139 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( 'CSV header %s is invalid ', implode ( ',', $this->_colNames ) ) );
|
140 |
+
$isFailed = true;
|
141 |
+
}
|
142 |
+
return $isFailed;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Get Varien I/O File class object
|
147 |
+
*
|
148 |
+
* @return object
|
149 |
+
*/
|
150 |
+
protected function fileObj() {
|
151 |
+
$fileObj = new Varien_Io_File ();
|
152 |
+
return $fileObj;
|
153 |
+
}
|
154 |
+
|
155 |
+
public function parseCsv($fileName = null,$lb_vendor_code = null)
|
156 |
+
{
|
157 |
+
$uploadFile = Mage::getModel('dropship360/uploadvendor');
|
158 |
+
if(empty($fileName) || empty($lb_vendor_code)){
|
159 |
+
$this->_getSession()->addError($this->__('Required parameters are missing CSV file or Vendor-Code'));
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
unset($this->_rowData[0]);
|
163 |
+
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
164 |
+
$this->_importObject->startImport($this->_rowData,$lb_vendor_code);
|
165 |
+
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
166 |
+
try{
|
167 |
+
$updateFileStatus = $uploadFile->unsetData()->load($fileName,'file_name');
|
168 |
+
$updateFileStatus->setImportStatus('done');
|
169 |
+
$updateFileStatus->save();
|
170 |
+
}catch(Exception $e){
|
171 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
172 |
+
Mage::log($e->getMessage(), Zend_Log::ERR);
|
173 |
+
}
|
174 |
+
$file = self::getWorkingDir() . $fileName;
|
175 |
+
$this->fileObj()->rm($file);
|
176 |
+
return $this;
|
177 |
+
}
|
178 |
+
|
179 |
+
/*
|
180 |
+
*
|
181 |
+
* Ftp function call by observer from where program execution started
|
182 |
+
*
|
183 |
+
*/
|
184 |
+
public function ftpParseCsv(){
|
185 |
+
if(Mage::helper('dropship360')->isProcessRunning('bulk_assign')){
|
186 |
+
$message = 'Bulk product setup is currently running hence cannot run ftp import';
|
187 |
+
Mage::log($message, null, 'logicbroker_log_report.log');
|
188 |
+
return;
|
189 |
+
}
|
190 |
+
$ftpfileName = array();
|
191 |
+
$vendorFiles = array();
|
192 |
+
$ftpObj = Mage::getModel('dropship360/import_ftpimport');
|
193 |
+
if (!$ftpObj->isFtpUploadEnable()) {
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
try{
|
197 |
+
$ftpObj->connect(); // connect to FTP site
|
198 |
+
$vendorFiles = $ftpObj->downloadFiles(self::getWorkingDir()); // download and archive all FTP files
|
199 |
+
}catch (Exception $e){
|
200 |
+
$ftpObj->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' =>$e->getMessage(),'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
201 |
+
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
202 |
+
$valueArray = array (
|
203 |
+
'con_error'=>$e->getMessage(),
|
204 |
+
'magento_sku' => '',
|
205 |
+
'vendor_sku' => '',
|
206 |
+
'cost' => '',
|
207 |
+
'qty' => '',
|
208 |
+
);
|
209 |
+
$ftpObj->saveFtpHistoryError($valueArray,'connection_error','connection-error');
|
210 |
+
}
|
211 |
+
/*
|
212 |
+
* vendors files on FTP server return empty
|
213 |
+
* 1) vendor inventory folder empty
|
214 |
+
* 2) supplier vendor not set at supplier management screen
|
215 |
+
*/
|
216 |
+
if(empty($vendorFiles)){
|
217 |
+
Mage::log('Files not found on FTP server Or Supplier vendor not set', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
218 |
+
return $this;
|
219 |
+
}
|
220 |
+
|
221 |
+
/*
|
222 |
+
* start process files as per vendor.
|
223 |
+
*/
|
224 |
+
$ftpObj->initialize();
|
225 |
+
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
226 |
+
foreach($vendorFiles as $vendor=>$files){
|
227 |
+
$ftpObj->initVar($vendor);
|
228 |
+
foreach ($files as $filepath) {
|
229 |
+
try{
|
230 |
+
$ftpObj->initFtpCsvData($filepath);
|
231 |
+
$isInvalid = $ftpObj->validateFtpCsv($filepath);
|
232 |
+
if($isInvalid){
|
233 |
+
continue; // skip file for invalid header and empty file
|
234 |
+
}
|
235 |
+
$ftpObj->startImport($filepath,$vendor);
|
236 |
+
$ftpObj->resetVar();
|
237 |
+
$this->_fileObj->rm($filepath);
|
238 |
+
}catch (Exception $e){
|
239 |
+
$ftpObj->sendMail ( array (
|
240 |
+
'subject' => 'Exception occurred during FTP inventory import for supplier '.$vendor,
|
241 |
+
'message' => $filepath.'<br>'.$e->getMessage (),
|
242 |
+
'bcc' => trim ( Mage::helper ( 'dropship360' )->getConfigObject ( 'apiconfig/email/bcc' ) )
|
243 |
+
) );
|
244 |
+
Mage::log('FTP-'.$e->getMessage().'Description ##'.$vendor.' ## '.$filepath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
245 |
+
$ftpObj->resetVar();
|
246 |
+
continue;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
251 |
+
$ftpObj->finalize();
|
252 |
+
}
|
253 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Import/Base.php
ADDED
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Base file will contain comman functions which will used by vendor inventory import section i.e.
|
9 |
+
* @Manual Inventory Upload
|
10 |
+
* @Ftp Inventory Upload
|
11 |
+
* @Product Setup
|
12 |
+
* In some cases we have override Base class function to achive funcntioanlity of above section
|
13 |
+
*/
|
14 |
+
|
15 |
+
abstract class Logicbroker_Dropship360_Model_Import_Base
|
16 |
+
{
|
17 |
+
abstract public function validateCsvHeader($colNames);
|
18 |
+
protected $_vendorCode = '';
|
19 |
+
protected $_linkAttribute;
|
20 |
+
protected $_errorsCount = 0;
|
21 |
+
protected $_successCount = 0;
|
22 |
+
protected $_vendorInventory = array();
|
23 |
+
protected $_productInventory = array();
|
24 |
+
protected $_inlineLog = array();
|
25 |
+
protected $_historyLog = array();
|
26 |
+
protected $_csvParserObj;
|
27 |
+
protected $_chunkSize = 1000;
|
28 |
+
protected $_bufferStock ;
|
29 |
+
protected $_dbConnection;
|
30 |
+
protected $_updatedBy = '';
|
31 |
+
protected $_vendorName;
|
32 |
+
protected $_indexVendorSku = 0;
|
33 |
+
protected $_indexStock = 1;
|
34 |
+
protected $_indexPrice = 2;
|
35 |
+
protected $_historyErrorType = 'Missing/Bad Data';
|
36 |
+
protected $_manualCsvError = array();
|
37 |
+
|
38 |
+
public function initVar($vendorCode){
|
39 |
+
$this->_dbConnection = Mage::helper('dropship360')->getDatabaseConnection()->getConnection ( 'core_write' );
|
40 |
+
$this->_bufferStock = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
41 |
+
$this->_vendorCode = $vendorCode;
|
42 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
43 |
+
$this->_linkAttribute = $ranking->getLinkingAttribute();
|
44 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
45 |
+
$this->_updatedBy = Mage::getSingleton('admin/session')->getUser()->getUsername();
|
46 |
+
}
|
47 |
+
/*
|
48 |
+
* @return value from core_config_data
|
49 |
+
*/
|
50 |
+
protected function getConfigValue($path)
|
51 |
+
{
|
52 |
+
return Mage::getStoreConfig($path);
|
53 |
+
}
|
54 |
+
|
55 |
+
/*
|
56 |
+
* check if attribute assign to catalog_product
|
57 |
+
*/
|
58 |
+
protected function checkAttributeAval($attr,$object = null){
|
59 |
+
$isExist = false;
|
60 |
+
$attrEav = Mage::getResourceModel('catalog/eav_attribute')->loadByCode('catalog_product',$attr);
|
61 |
+
if ($attrEav->getId())
|
62 |
+
$isExist = true;
|
63 |
+
return $isExist;
|
64 |
+
}
|
65 |
+
|
66 |
+
/*
|
67 |
+
* @errorCode-type: history
|
68 |
+
* @history : log for upload history page
|
69 |
+
*/
|
70 |
+
public function addRowError($errorCode, $errorRowNum, $colName = array())
|
71 |
+
{
|
72 |
+
$colCount = count($colName);
|
73 |
+
$i = 0;
|
74 |
+
while ($i < $colCount) {
|
75 |
+
$this->_manualCsvError[$errorCode]['row_'.$colName[$i]][] = $errorRowNum + 1;
|
76 |
+
$i++;
|
77 |
+
}
|
78 |
+
$this->_errorsCount ++;
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
/* arry_filter function
|
83 |
+
*
|
84 |
+
*/
|
85 |
+
protected function validateGenerateProduct($product){
|
86 |
+
$isValid = true;
|
87 |
+
|
88 |
+
$helper = Mage::helper('dropship360');
|
89 |
+
if(!array_key_exists('magento_sku', $product))
|
90 |
+
{
|
91 |
+
$errorType = ($this->_linkAttribute == $helper::LOGICBROKER_PRODUCT_LINK_CODE_SKU) ? 'magento_sku_exists' : $this->_linkAttribute.'_notexist';
|
92 |
+
$data = array (
|
93 |
+
'magento_sku' => $product [$this->_indexVendorSku],
|
94 |
+
'qty' => $product [$this->_indexStock],
|
95 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
96 |
+
'cost' => $product [$this->_indexPrice]
|
97 |
+
);
|
98 |
+
$this->setLogError('history',$data,$errorType);
|
99 |
+
$isValid = false;
|
100 |
+
//$this->_errorsCount ++;
|
101 |
+
}elseif(count($product['product_id']) > 1 )
|
102 |
+
{
|
103 |
+
$data = array (
|
104 |
+
'magento_sku' => $product['magento_sku'],
|
105 |
+
'qty' => $product [$this->_indexStock],
|
106 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
107 |
+
'cost' => $product [$this->_indexPrice]
|
108 |
+
);
|
109 |
+
$this->setLogError('history',$data,$this->_linkAttribute.'_multiple');
|
110 |
+
|
111 |
+
$isValid = false;
|
112 |
+
//$this->_errorsCount ++;
|
113 |
+
}elseif($this->_checkDuplicateCombination(null,$product)){
|
114 |
+
$data = array (
|
115 |
+
'magento_sku' => $product['magento_sku'],
|
116 |
+
'qty' => $product [$this->_indexStock],
|
117 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
118 |
+
'cost' => $product [$this->_indexPrice]
|
119 |
+
);
|
120 |
+
$this->setLogError('history',$data,'combination_exist');
|
121 |
+
$isValid = false;
|
122 |
+
}
|
123 |
+
else{
|
124 |
+
$isValid = $this->validate($product); //validating row values if all above cases passed
|
125 |
+
}
|
126 |
+
|
127 |
+
return $isValid;
|
128 |
+
}
|
129 |
+
/*
|
130 |
+
* prepare data for insert new relation in inventory table
|
131 |
+
*/
|
132 |
+
protected function prepareAddData(&$changedCsvData) {
|
133 |
+
$magentoSkuArray = array();
|
134 |
+
$helper = Mage::helper('dropship360');
|
135 |
+
$stockItemTable = $helper->getTableName('cataloginventory/stock_item');
|
136 |
+
$tableVendorInventory = $helper->getTableName('dropship360/inventory');
|
137 |
+
$collection = Mage::getMOdel('catalog/product')->getCollection();
|
138 |
+
$qtyQuery = '(select IFNULL(SUM(stock),0) from '.$tableVendorInventory.' where product_sku = e.sku and lb_vendor_code != "'.$this->_vendorCode.'") as qty';
|
139 |
+
$isDecimalQuery = '(select is_qty_decimal from '.$stockItemTable.' where product_id = e.entity_id) as is_decimal';
|
140 |
+
foreach($changedCsvData as $key=>$rowData){
|
141 |
+
($rowData[$this->_indexVendorSku]) ? $magentoSkuArray[] = $rowData[$this->_indexVendorSku] : '';
|
142 |
+
}
|
143 |
+
$collection->addAttributeToFilter($this->_linkAttribute,array('in'=>$magentoSkuArray));
|
144 |
+
$collection->getSelect()->columns($isDecimalQuery);
|
145 |
+
$collection->getSelect()->columns($qtyQuery);
|
146 |
+
if($collection->getSize() > 0){
|
147 |
+
foreach($changedCsvData as $rowNum => &$rowData){
|
148 |
+
foreach($collection as $data){
|
149 |
+
if($data->getData($this->_linkAttribute) == $rowData[$this->_indexVendorSku]){
|
150 |
+
$rowData[$this->_indexStock] = ($data->getIsDecimal() || !is_numeric($rowData[$this->_indexStock])) ? $rowData[$this->_indexStock] : floor($rowData[$this->_indexStock]);
|
151 |
+
$rowData['row_id'] = $rowNum;
|
152 |
+
$rowData['magento_sku'] = $data->getSku ();
|
153 |
+
$rowData['product_qty'] = $data->getQty ();
|
154 |
+
$rowData['product_id'][] = $data->getEntityId ();
|
155 |
+
continue;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
/*
|
163 |
+
* create new entry in inventory table and update product inventory
|
164 |
+
*/
|
165 |
+
protected function generateNonExistingRel($validRow ){
|
166 |
+
foreach($validRow as $rowNumber=>$rowData){
|
167 |
+
$this->_validateCostQty($rowNumber,$rowData,'Add');
|
168 |
+
if($isQtyVal = $this->prepareVendorInventory($rowData,'add')){//check if row have valid qty value.
|
169 |
+
$this->prepareProductInventory($rowData);
|
170 |
+
}
|
171 |
+
$this->_successCount++;
|
172 |
+
}
|
173 |
+
$this->saveProductInventory();
|
174 |
+
$this->insertVendorInventory();
|
175 |
+
$this->saveInlineLog();
|
176 |
+
}
|
177 |
+
/*
|
178 |
+
* insert vendor detail in vendor inventory table
|
179 |
+
*/
|
180 |
+
protected function insertVendorInventory(){
|
181 |
+
if($this->_vendorInventory):
|
182 |
+
|
183 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
184 |
+
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','lb_vendor_sku','stock','cost','created_at','updated_at');
|
185 |
+
|
186 |
+
try {
|
187 |
+
$this->_dbConnection->insertArray($vendorInventoryTable,$dbFields,$this->_vendorInventory);
|
188 |
+
|
189 |
+
$this->_vendorInventory = array();
|
190 |
+
} catch ( Exception $e ) {
|
191 |
+
Mage::throwException('Error in inserting vendor inventory : '.$e->getMessage());
|
192 |
+
}
|
193 |
+
endif;
|
194 |
+
}
|
195 |
+
/*
|
196 |
+
* @return data for operation
|
197 |
+
* 1) update
|
198 |
+
* 2) insert
|
199 |
+
*/
|
200 |
+
protected function getArray($unsetItem = null,$values,$opr){
|
201 |
+
if($opr == 'update'){
|
202 |
+
$cost = (array_key_exists('cost', $values)) ? $values['cost'] : '';
|
203 |
+
$stock = (array_key_exists('stock', $values)) ? $values['stock'] : '';
|
204 |
+
$array = array('stock'=>$stock,'cost'=>$cost,'updated_at'=>now());
|
205 |
+
if($unsetItem)
|
206 |
+
unset($array[$unsetItem]);
|
207 |
+
}else{
|
208 |
+
$array = array(
|
209 |
+
$this->_vendorCode, //0
|
210 |
+
$this->_vendorName, //1
|
211 |
+
$values ['magento_sku'],//2
|
212 |
+
$values['vendor_sku'],//3
|
213 |
+
$values['stock'],//4
|
214 |
+
$values['cost'],//5
|
215 |
+
now (),//6
|
216 |
+
now () //7
|
217 |
+
);
|
218 |
+
if($unsetItem == 'cost')
|
219 |
+
$array[5] = ''; //set cost
|
220 |
+
if($unsetItem == 'stock')
|
221 |
+
$array[4] = '';//set stock
|
222 |
+
if($unsetItem == 'stock_cost'){
|
223 |
+
$array[4] = ''; //set stock
|
224 |
+
$array[5] = ''; //set cost
|
225 |
+
}
|
226 |
+
}
|
227 |
+
return $array;
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
/*
|
232 |
+
* function used to update vendor inventory cost and qty
|
233 |
+
*/
|
234 |
+
|
235 |
+
protected function updateVendorInventory($changedCsvData){
|
236 |
+
$this->_filterRowData($changedCsvData['change_row']);
|
237 |
+
if($changedCsvData){
|
238 |
+
foreach($changedCsvData['change_row'] as $rowNumber=>$rowData){
|
239 |
+
$this->validateRowData($rowNumber,$rowData);
|
240 |
+
if($isQtyVal = $this->prepareVendorInventory($rowData))//check if row have valid qty value.
|
241 |
+
$this->prepareProductInventory($rowData);
|
242 |
+
}
|
243 |
+
$this->saveProductInventory();
|
244 |
+
$this->saveVendorInventory();
|
245 |
+
$this->saveInlineLog();
|
246 |
+
//$this->prepareLogHistory($changedCsvData);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
/*
|
251 |
+
* create new relation for vendor_sku,vendor_code,magento_sku
|
252 |
+
*/
|
253 |
+
protected function addVendorInventory($changedCsvData){
|
254 |
+
if(!$this->checkAttributeAval($this->_linkAttribute)){
|
255 |
+
$data = implode(';',array_keys($changedCsvData['rel_not_exist']));
|
256 |
+
$this->_manualCsvError['history']['attribute_notexist'][] = $data;
|
257 |
+
//$this->setLogError('history',$data,'attribute_notexist');
|
258 |
+
$this->_errorsCount = $this->_errorsCount + count($changedCsvData['rel_not_exist']);
|
259 |
+
return ;
|
260 |
+
}
|
261 |
+
$this->prepareAddData($changedCsvData['rel_not_exist']);
|
262 |
+
$validRow = array_filter($changedCsvData['rel_not_exist'],array($this,'validateGenerateProduct'));
|
263 |
+
$this->generateNonExistingRel($validRow);
|
264 |
+
}
|
265 |
+
|
266 |
+
/*
|
267 |
+
* remove rows which have invalid cost and Qty
|
268 |
+
* @ it will not remove row which have partial correct cost or qty
|
269 |
+
*/
|
270 |
+
protected function _filterRowData(&$changedCsvData) {
|
271 |
+
$changedCsvData = array_filter($changedCsvData,array($this,'validate'));
|
272 |
+
}
|
273 |
+
|
274 |
+
/* filter valid data
|
275 |
+
* csv row format
|
276 |
+
* $row[$this->_indexStock] = vendor_sku
|
277 |
+
* $row[1] = qty
|
278 |
+
* $row[2] = cost
|
279 |
+
*/
|
280 |
+
protected function validate($rowData,$key = null) {
|
281 |
+
$isValid = true;
|
282 |
+
$colName = array();
|
283 |
+
$errorCode = 'history';
|
284 |
+
|
285 |
+
// col vendor_sku value is empty
|
286 |
+
if(!isset($rowData[$this->_indexVendorSku])){
|
287 |
+
$isValid = false;
|
288 |
+
$colName[] = 'vendor_sku';
|
289 |
+
}
|
290 |
+
|
291 |
+
// col cost and qty value is non-numeric,-ve, #empty value allowed
|
292 |
+
if((!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0) && (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0)){
|
293 |
+
$isValid = false;
|
294 |
+
$colName[] = 'qty';
|
295 |
+
$colName[] = 'cost';
|
296 |
+
//for product details page inline error log
|
297 |
+
$logdesc = 'Ignore';
|
298 |
+
$this->addInlineLog('inline', $logdesc, $rowData);
|
299 |
+
|
300 |
+
|
301 |
+
}
|
302 |
+
(!$isValid) ? $this->addRowError($errorCode,$rowData['row_id'],$colName) : '';
|
303 |
+
return $isValid;
|
304 |
+
}
|
305 |
+
/*
|
306 |
+
* validating cost or qty for partial update
|
307 |
+
* @generating error for partial update
|
308 |
+
*/
|
309 |
+
protected function validateRowData($rowNumber,$rowData) {
|
310 |
+
$this->_validateCostQty($rowNumber,$rowData);
|
311 |
+
//$this->_validateMagentoSku($rowNumber,$rowData);
|
312 |
+
//$this->_checkCombination($rowNumber,$rowData);
|
313 |
+
}
|
314 |
+
|
315 |
+
/* filter valid data for partial update
|
316 |
+
* csv row format
|
317 |
+
* $rowData[0] = vendor_sku
|
318 |
+
* $rowData[1] = qty
|
319 |
+
* $rowData[2] = cost
|
320 |
+
*/
|
321 |
+
protected function _validateCostQty($rowNumber,$rowData,$type = 'Update') {
|
322 |
+
$ignoreData = array();
|
323 |
+
$errorCode = 'inline';
|
324 |
+
|
325 |
+
if((!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0) && (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0)){
|
326 |
+
$logdesc = 'Ignore';
|
327 |
+
}elseif(!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0){
|
328 |
+
$logdesc = 'Qty '.$type.', Cost Ignored';
|
329 |
+
}elseif(!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0){
|
330 |
+
$logdesc = 'Cost '.$type.', Qty Ignored';
|
331 |
+
}else{
|
332 |
+
$logdesc = $type;
|
333 |
+
}
|
334 |
+
$this->addInlineLog($errorCode, $logdesc, $rowData);
|
335 |
+
}
|
336 |
+
|
337 |
+
/* if duplicate entry find discard row
|
338 |
+
* csv row format
|
339 |
+
* $rowData[0] = vendor_sku
|
340 |
+
* $rowData[$this->_indexPrice] = qty
|
341 |
+
* $rowData[2] = cost
|
342 |
+
*/
|
343 |
+
protected function _checkDuplicateCombination($rowNumber = null,$rowData) {
|
344 |
+
$isDuplicate = false;
|
345 |
+
try {
|
346 |
+
if(array_key_exists('magento_sku', $rowData)){
|
347 |
+
$inventoryCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
348 |
+
$inventoryCollection->addFieldToFilter('product_sku',$rowData['magento_sku'])
|
349 |
+
->addFieldToFilter('lb_vendor_code',$this->_vendorCode);
|
350 |
+
$inventoryCollection->getSelect()->limit(1);
|
351 |
+
if($inventoryCollection->getSize() > 0){
|
352 |
+
$isDuplicate = true;
|
353 |
+
if(array_key_exists('productSetup', $rowData))
|
354 |
+
Mage::register('product_setup_vendor_id', $inventoryCollection->getFirstItem()->getId());
|
355 |
+
}
|
356 |
+
}
|
357 |
+
return $isDuplicate;
|
358 |
+
} catch (Exception $e) {
|
359 |
+
Mage::throwException('Error in checking duplicate vendor : '.$e->getMessage());
|
360 |
+
return;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
/*
|
365 |
+
* @var $_vendorInventory
|
366 |
+
* use to update cost and qty possible case
|
367 |
+
* invalid_qty : ignore qty and update cost
|
368 |
+
* invalid_cost : ignore cost and update qty
|
369 |
+
* both invalid : no update will perform
|
370 |
+
* both valid : update cost and qty
|
371 |
+
*/
|
372 |
+
protected function prepareVendorInventory($rowData,$opration = 'update') {
|
373 |
+
$isQtyVal = true;
|
374 |
+
$qty = (!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0 || trim($rowData[$this->_indexStock]) =='') ? 'invalid_qty' : $rowData[$this->_indexStock];
|
375 |
+
$cost = (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0 || trim($rowData[$this->_indexPrice]) =='') ? 'invalid_cost' : $rowData[$this->_indexPrice];
|
376 |
+
$rowId = array_key_exists('vendor_id',$rowData) ? $rowData['vendor_id'] : null;
|
377 |
+
if((string)$qty == 'invalid_qty' && (string)$cost == 'invalid_cost'){
|
378 |
+
if($rowId)
|
379 |
+
$this->_vendorInventory[$rowId] = $this->getArray('stock_cost',null,'add');//no-update only insert
|
380 |
+
else
|
381 |
+
$this->_vendorInventory[] = $this->getArray('stock_cost',null,'add');//no-update only insert
|
382 |
+
$isQtyVal = false;
|
383 |
+
}elseif((string)$qty == 'invalid_qty'){
|
384 |
+
if($rowId)
|
385 |
+
$this->_vendorInventory[$rowId] = $this->getArray('stock',array('cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
386 |
+
else
|
387 |
+
$this->_vendorInventory[] = $this->getArray('stock',array('cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
388 |
+
$isQtyVal = false;
|
389 |
+
}elseif( (string)$cost == 'invalid_cost'){
|
390 |
+
$qty = $this->calculateQty($rowData);
|
391 |
+
if($rowId)
|
392 |
+
$this->_vendorInventory[$rowId] = $this->getArray('cost',array('stock'=>$qty,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
393 |
+
else
|
394 |
+
$this->_vendorInventory[] = $this->getArray('cost',array('stock'=>$qty,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
395 |
+
}else{
|
396 |
+
$qty = $this->calculateQty($rowData);
|
397 |
+
if($rowId)
|
398 |
+
$this->_vendorInventory[$rowId] = $this->getArray(null,array('stock'=>$qty,'cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
399 |
+
else
|
400 |
+
$this->_vendorInventory[] = $this->getArray(null,array('stock'=>$qty,'cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
401 |
+
}
|
402 |
+
return $isQtyVal;
|
403 |
+
}
|
404 |
+
|
405 |
+
/*
|
406 |
+
* calculate vendor qty on the basis of buffer value
|
407 |
+
* calculate complete product qty including current vendor qty
|
408 |
+
*/
|
409 |
+
protected function calculateQty($rowData,$productQty = false){
|
410 |
+
$checkQty = (!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0 || trim($rowData[$this->_indexStock]) =='') ? 'invalid_qty' : $rowData[$this->_indexStock];
|
411 |
+
if($checkQty == 'invalid_qty')
|
412 |
+
return $rowData[$this->_indexStock];
|
413 |
+
|
414 |
+
$qty = 0;
|
415 |
+
if ($this->_bufferStock >= 0 && isset ( $this->_bufferStock )) {
|
416 |
+
$qty = (($uploadQty = $checkQty - $this->_bufferStock) < 0) ? 0 : $uploadQty;
|
417 |
+
} else {
|
418 |
+
$qty = $checkQty;
|
419 |
+
}
|
420 |
+
if ($productQty) {
|
421 |
+
$qty = $qty + $rowData ['product_qty'];
|
422 |
+
}
|
423 |
+
return $qty;
|
424 |
+
}
|
425 |
+
|
426 |
+
/*
|
427 |
+
* @var $_productInventory as array to do multiple update query for
|
428 |
+
* product inventory
|
429 |
+
*/
|
430 |
+
protected function prepareProductInventory($rowData){
|
431 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item');
|
432 |
+
$stockItem->loadByProduct($rowData['product_id']);
|
433 |
+
$existStockData = $stockItem->getData();
|
434 |
+
$existStockData['qty'] = $this->calculateQty($rowData,true);
|
435 |
+
$existStockData['is_in_stock'] = ($existStockData['qty']) ? 1 : 0;
|
436 |
+
unset($existStockData['type_id']);
|
437 |
+
unset($existStockData['stock_status_changed_automatically']);
|
438 |
+
unset($existStockData['use_config_enable_qty_increments']);
|
439 |
+
$this->_productInventory[] = $existStockData;
|
440 |
+
}
|
441 |
+
|
442 |
+
/*
|
443 |
+
* @var $_inlineLog as array contain error string for vendor inline log
|
444 |
+
* $log = array(0=>$activity,1=>$rowData)
|
445 |
+
*/
|
446 |
+
protected function prepareInlineLog(){
|
447 |
+
if (!array_key_exists('inline',$this->_manualCsvError)) {
|
448 |
+
return;
|
449 |
+
}
|
450 |
+
$inline = $this->_manualCsvError['inline'];
|
451 |
+
foreach($inline as $log){
|
452 |
+
$this->_inlineLog[] =
|
453 |
+
array (
|
454 |
+
$this->_vendorCode,
|
455 |
+
$this->_vendorName,
|
456 |
+
$log [1] ['magento_sku'] ,//magento_sku
|
457 |
+
$log [1] [$this->_indexPrice],//cost
|
458 |
+
$this->calculateQty($log[1]),//stock
|
459 |
+
$this->_updatedBy,//updateby
|
460 |
+
$log[0],//activity
|
461 |
+
now(),//created
|
462 |
+
now()//update
|
463 |
+
);
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
/*
|
468 |
+
* @var $_historyLog log array which will be displayed on vendor upload history
|
469 |
+
*/
|
470 |
+
protected function prepareLogHistory($changedCsvData = array()){
|
471 |
+
if (array_key_exists('history',$this->_manualCsvError)) {
|
472 |
+
$rowError = $this->_manualCsvError['history'];
|
473 |
+
foreach($rowError as $type=>$error){
|
474 |
+
$this->_historyLog [] = array (
|
475 |
+
'error_type' => $type,
|
476 |
+
'value' => is_array($error) ? implode(';',$error) : $error
|
477 |
+
);
|
478 |
+
}
|
479 |
+
//$this->_manualCsvError['history'] = array();
|
480 |
+
}
|
481 |
+
if (array_key_exists('unchange_row',$changedCsvData)){
|
482 |
+
$unchangedData = $changedCsvData['unchange_row'];
|
483 |
+
foreach ($unchangedData as $key=>$data){
|
484 |
+
$this->_errorsCount ++;
|
485 |
+
$this->_historyLog [] = array (
|
486 |
+
'error_type' => ($data['sku']) ? 'data_notchnage' : 'magento_sku_exists',
|
487 |
+
'value' => array (
|
488 |
+
'magento_sku' => $data ['magento_sku'],
|
489 |
+
'qty' => $data [$this->_indexStock],
|
490 |
+
'vendor_sku' => $data [$this->_indexVendorSku],
|
491 |
+
'cost' => $data [$this->_indexPrice]
|
492 |
+
)
|
493 |
+
);
|
494 |
+
|
495 |
+
}
|
496 |
+
}
|
497 |
+
if (array_key_exists('rel_not_exist',$changedCsvData)){
|
498 |
+
if(!isset($this->_linkAttribute)):
|
499 |
+
$relNotExist = $changedCsvData['rel_not_exist'];
|
500 |
+
foreach ($relNotExist as $key=>$data){
|
501 |
+
$this->_errorsCount ++;
|
502 |
+
$this->_historyLog [] = array (
|
503 |
+
'error_type' => 'combination_notexist',
|
504 |
+
'value' => array (
|
505 |
+
'magento_sku' => '',
|
506 |
+
'qty' => $data [$this->_indexStock],
|
507 |
+
'vendor_sku' => $data [$this->_indexVendorSku],
|
508 |
+
'cost' => $data [$this->_indexPrice]
|
509 |
+
)
|
510 |
+
);
|
511 |
+
|
512 |
+
}
|
513 |
+
endif;
|
514 |
+
}
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
+
/*
|
519 |
+
* save cost and qty for vendor
|
520 |
+
*/
|
521 |
+
protected function saveVendorInventory() {
|
522 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
523 |
+
foreach($this->_vendorInventory as $key=>$rowData){
|
524 |
+
try{
|
525 |
+
if(is_array($rowData)){
|
526 |
+
$this->_dbConnection->update($vendorInventoryTable,$rowData,array('id = ?'=>$key));
|
527 |
+
$this->_successCount++;
|
528 |
+
}
|
529 |
+
}catch (Exception $e){
|
530 |
+
Mage::throwException('Error in saving vendor inventory : '.$e->getMessage());
|
531 |
+
$this->_dbConnection->rollBack();
|
532 |
+
}
|
533 |
+
}
|
534 |
+
$this->_vendorInventory = array();
|
535 |
+
}
|
536 |
+
|
537 |
+
/*
|
538 |
+
* save product inventory for magento
|
539 |
+
*/
|
540 |
+
protected function saveProductInventory() {
|
541 |
+
try{
|
542 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('cataloginventory/stock_item');
|
543 |
+
if($this->_productInventory){
|
544 |
+
$this->_dbConnection->insertOnDuplicate($vendorInventoryTable,$this->_productInventory,array('qty','is_in_stock'));
|
545 |
+
$this->_productInventory = array();
|
546 |
+
}
|
547 |
+
}catch (Exception $e){
|
548 |
+
Mage::throwException('Error in saving product inventory : '.$e->getMessage());
|
549 |
+
$this->_dbConnection->rollBack();
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
/*
|
554 |
+
* save inline log available on product detail page
|
555 |
+
*/
|
556 |
+
protected function saveInlineLog() {
|
557 |
+
try{
|
558 |
+
$this->prepareInlineLog();
|
559 |
+
$tableVendorInventoryLog = Mage::helper('dropship360')->getTableName('dropship360/inventorylog');
|
560 |
+
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','cost','stock','updated_by','activity','updated_at','created_at');
|
561 |
+
if($this->_inlineLog){
|
562 |
+
$this->_dbConnection->insertArray($tableVendorInventoryLog,$dbFields,$this->_inlineLog);
|
563 |
+
$this->_inlineLog = array();
|
564 |
+
unset($this->_manualCsvError['inline']);
|
565 |
+
}
|
566 |
+
}catch (Exception $e){
|
567 |
+
Mage::throwException('Error in saving inline log : '.$e->getMessage());
|
568 |
+
$this->_dbConnection->rollBack();
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
/*
|
573 |
+
* save vendor complete csv upload error history
|
574 |
+
*/
|
575 |
+
protected function saveLogHistory() {
|
576 |
+
try{
|
577 |
+
$helper = Mage::helper('dropship360');
|
578 |
+
$tableVendorImportLog = $helper->getTableName('dropship360/vendor_import_log');
|
579 |
+
$tableVendorImportLogDesc = $helper->getTableName('dropship360/vendor_import_log_desc');
|
580 |
+
$errType = ($this->_errorsCount > 0) ? $this->_historyErrorType : '';
|
581 |
+
$success = $this->_successCount;
|
582 |
+
$failed = $this->_errorsCount;
|
583 |
+
$dbFields = array('lb_vendor_code','updated_by','success','failure','ftp_error','created_at');
|
584 |
+
$dbValue = array($this->_vendorCode,$this->_updatedBy,$success,$failed,$errType,now());
|
585 |
+
$this->_dbConnection->insertArray($tableVendorImportLog,$dbFields,array($dbValue));
|
586 |
+
$entityId = $this->_dbConnection->lastInsertId($tableVendorImportLog);
|
587 |
+
foreach($this->_historyLog as $data)
|
588 |
+
$this->_dbConnection->insertArray($tableVendorImportLogDesc,array('error_id','description'),array(array($entityId,Mage::helper('core')->jsonEncode($data))));
|
589 |
+
$this->_historyLog = array();
|
590 |
+
}catch (Exception $e){
|
591 |
+
Mage::throwException('Error in saving history log : '.$e->getMessage());
|
592 |
+
$this->_dbConnection->rollBack();
|
593 |
+
}
|
594 |
+
return $entityId;
|
595 |
+
}
|
596 |
+
/*
|
597 |
+
* @return data to be insert in vendor inventory history log
|
598 |
+
*/
|
599 |
+
protected function setLogError($errorCode,$data,$type) {
|
600 |
+
$this->_historyLog [] = array(
|
601 |
+
'error_type' => $type,
|
602 |
+
'value' => $data
|
603 |
+
);
|
604 |
+
$this->_errorsCount ++;
|
605 |
+
}
|
606 |
+
protected function setHistoryErrorType($type){
|
607 |
+
return $this->_historyErrorType = $type;
|
608 |
+
}
|
609 |
+
/*
|
610 |
+
* @errorCode-type: inline
|
611 |
+
* @inline : vendor inventory update log for product details page
|
612 |
+
*/
|
613 |
+
public function addInlineLog($errorCode, $logdesc,$rowData)
|
614 |
+
{
|
615 |
+
$this->_manualCsvError[$errorCode][] = array($logdesc,$rowData);
|
616 |
+
return $this;
|
617 |
+
}
|
618 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Import/Ftp.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* used by Ftp inventory upload for FTP opreations i.e.
|
9 |
+
* 1. archive file
|
10 |
+
* 2. upload file
|
11 |
+
* 3. connect ftp
|
12 |
+
* 4. downloadfiles
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Logicbroker_Dropship360_Model_Import_Ftp extends Mage_System_Ftp
|
16 |
+
{
|
17 |
+
protected $_ftp;
|
18 |
+
protected $_fileObj;
|
19 |
+
protected $_urlString;
|
20 |
+
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
21 |
+
const XML_PATH_UPLOAD_FTP_SITE = 'logicbroker_sourcing/cron_settings_upload/ftp_site';
|
22 |
+
const XML_PATH_UPLOAD_FTP_USERNAME = 'logicbroker_sourcing/cron_settings_upload/ftp_username';
|
23 |
+
const XML_PATH_UPLOAD_FTP_PASSWORD = 'logicbroker_sourcing/cron_settings_upload/ftp_password';
|
24 |
+
const XML_PATH_UPLOAD_FTP_TYPE = 'logicbroker_sourcing/cron_settings_upload/ftp_type';
|
25 |
+
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
26 |
+
|
27 |
+
|
28 |
+
public function __construct(){
|
29 |
+
$this->_fileObj = new Varien_Io_File();
|
30 |
+
$this->_fileObj->setAllowCreateFolders(true);
|
31 |
+
}
|
32 |
+
protected function getConfigValue($path)
|
33 |
+
{
|
34 |
+
return Mage::getStoreConfig($path);
|
35 |
+
}
|
36 |
+
|
37 |
+
public function connectftp(){
|
38 |
+
$urlString = $this->getUrlString();
|
39 |
+
$this->connect($urlString);
|
40 |
+
}
|
41 |
+
|
42 |
+
/*
|
43 |
+
* Connection string: ftp://user:pass@server:port/path
|
44 |
+
* user,pass,port,path are optional parts
|
45 |
+
*/
|
46 |
+
protected function getUrlString() {
|
47 |
+
if(!$this->_urlString){
|
48 |
+
$ftp_site = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_SITE);
|
49 |
+
$ftp_username = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_USERNAME);
|
50 |
+
$ftp_password = Mage::helper('core')->decrypt($this->getConfigValue(self::XML_PATH_UPLOAD_FTP_PASSWORD));
|
51 |
+
$ftp_type = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_TYPE);
|
52 |
+
$this->_urlString = 'ftp://'.$ftp_username.':'.$ftp_password.'@'.$ftp_site;
|
53 |
+
}
|
54 |
+
return $this->_urlString;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function downloadFiles($localpath,$vendorRanks){
|
58 |
+
|
59 |
+
$fileinfo = array();
|
60 |
+
foreach($vendorRanks as $vendorCode=>$serverpath){
|
61 |
+
$localPath = $this->getFiles($vendorCode,$serverpath,$localpath);
|
62 |
+
if(!empty($localPath)){
|
63 |
+
$fileinfo[$vendorCode] = $localPath;
|
64 |
+
//$this->archiveFiles($vendor);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
return $fileinfo;
|
68 |
+
}
|
69 |
+
protected function getFiles($vendorCode,$serverpath,$localpath) {
|
70 |
+
$this->createArchiveAndReportFolder($serverpath);
|
71 |
+
$files = $this->ls($serverpath);
|
72 |
+
$localfilepath = array();
|
73 |
+
$filterFiles = array_filter($files,array($this,'filterFiles'));
|
74 |
+
if($filterFiles){
|
75 |
+
$this->_fileObj->createDestinationDir($localpath.$serverpath);
|
76 |
+
foreach($filterFiles as $fileDetail){
|
77 |
+
if($this->download($serverpath.DS.$fileDetail['name'], $localpath.$serverpath.DS.$fileDetail['name'])){
|
78 |
+
$this->archiveFile($serverpath, $localpath, $fileDetail['name']);
|
79 |
+
$dateString = $fileDetail['rawdata'][5].$fileDetail['rawdata'][6].$fileDetail['rawdata'][7];
|
80 |
+
$dateString = strtotime($dateString);
|
81 |
+
if(array_key_exists($dateString,$localfilepath))
|
82 |
+
$dateString = rand(100,200) + $dateString;
|
83 |
+
$localfilepath[$dateString] = $localpath.$serverpath.DS.$fileDetail['name'];
|
84 |
+
}else{
|
85 |
+
Mage::log('Downloading failed for file : '.$serverpath.DS.$fileDetail['name'], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
86 |
+
}
|
87 |
+
}
|
88 |
+
ksort($localfilepath);
|
89 |
+
}
|
90 |
+
return array_values($localfilepath);
|
91 |
+
}
|
92 |
+
protected function filterFiles($files) {
|
93 |
+
return !$files['dir'];
|
94 |
+
}
|
95 |
+
protected function createArchiveAndReportFolder($serverpath){
|
96 |
+
$this->chdir($this->correctFilePath($serverpath));
|
97 |
+
$this->mdkir('Archive');
|
98 |
+
$this->mdkir('Reports');
|
99 |
+
$this->chdir('/');
|
100 |
+
}
|
101 |
+
protected function archiveFile($serverpath,$localpath,$filename) {
|
102 |
+
$path = $this->correctFilePath($serverpath.DS.'Archive'.DS.date("Y-m-d_H_i_s_").$filename);
|
103 |
+
if($this->upload($path,$localpath.$serverpath.DS.$filename)){
|
104 |
+
if($this->delete($serverpath.DS.$filename))
|
105 |
+
Mage::log('File deleted successfully : '.$serverpath.DS.$filename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
106 |
+
}else{
|
107 |
+
Mage::log('Failed to move file in archive folder : '.$path, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
public function uploadReport($file,$vendorCode) {
|
113 |
+
$this->connectftp();
|
114 |
+
$localPath = $file['value'];
|
115 |
+
$accountNumber = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER);
|
116 |
+
$serverPath = $accountNumber.'_'.$vendorCode.DS.'Inventory'.DS.'Reports';
|
117 |
+
$filename = 'report'.Mage::getModel('core/date')->date('Ymd-his').'.csv';
|
118 |
+
$correctServerPath = $this->correctFilePath($serverPath.DS.$filename);
|
119 |
+
if($this->upload($correctServerPath,$localPath)){
|
120 |
+
if($this->_fileObj->rm($file['value']))
|
121 |
+
Mage::log('Report file deleted successfully : '.$localPath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
122 |
+
}else{
|
123 |
+
Mage::log('Failed to move file in reports folder : '.$correctServerPath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Import/Ftpimport.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* ftp vendor inventory import
|
9 |
+
* product attribute used upc,manufacturer_part_number,sku for insert new relation
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Ftpimport extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $_ftp;
|
15 |
+
protected $ftpCSVFormatbacward = array('vendor_code','vendor_sku','qty','cost');
|
16 |
+
protected $_colNamesFtp;
|
17 |
+
protected $_rowDataFtp;
|
18 |
+
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
19 |
+
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
20 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
21 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
22 |
+
|
23 |
+
public function __construct(){
|
24 |
+
$this->_ftp = Mage::getModel('dropship360/import_ftp');
|
25 |
+
$this->_dbConnection = Mage::helper('dropship360')->getDatabaseConnection()->getConnection ( 'core_write' );
|
26 |
+
}
|
27 |
+
|
28 |
+
/*
|
29 |
+
* initialize variable used during file execution
|
30 |
+
*/
|
31 |
+
public function initVar($vendorCode){
|
32 |
+
$this->_bufferStock = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
33 |
+
$this->_vendorCode = $vendorCode;
|
34 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
35 |
+
$this->_linkAttribute = $ranking->getLinkingAttribute();
|
36 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
37 |
+
$this->_updatedBy = 'FTP';
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* validate FTP file header
|
43 |
+
*/
|
44 |
+
public function validateCsvHeader($colNamesFtp){
|
45 |
+
$headerValidation = true;
|
46 |
+
$result = array_diff($colNamesFtp,$this->ftpCSVFormatbacward);
|
47 |
+
if(count($result) > 0 ){
|
48 |
+
if(!in_array('vendor_code',$result))
|
49 |
+
$headerValidation = false;
|
50 |
+
}
|
51 |
+
return $headerValidation;
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
* connect to FTP site
|
56 |
+
*/
|
57 |
+
public function connect(){
|
58 |
+
$this->_ftp->connectftp();
|
59 |
+
}
|
60 |
+
/*
|
61 |
+
* send email in following cases
|
62 |
+
* 1) FTP connection failure
|
63 |
+
* 2) bad file header
|
64 |
+
* 3) invalid row data
|
65 |
+
*/
|
66 |
+
public function sendMail($mailData = array()){
|
67 |
+
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED)) {
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
$mailData['datetime'] = Mage::getModel('core/date')->date();
|
71 |
+
$postObject = new Varien_Object();
|
72 |
+
$postObject->setData($mailData);
|
73 |
+
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
74 |
+
$templateId = 'logicbroker_ftp_con_fail';
|
75 |
+
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId);
|
76 |
+
if(!$isMailSent)
|
77 |
+
Mage::log('Notification email not sent :'.$email, null, 'logicbroker_debug.log');
|
78 |
+
}
|
79 |
+
/*
|
80 |
+
* check FTP inventory upload enable from DS360 configuration page
|
81 |
+
*/
|
82 |
+
public function isFtpUploadEnable() {
|
83 |
+
return Mage::getStoreConfigFlag ( self::XML_PATH_UPLOAD_ENABLED );
|
84 |
+
}
|
85 |
+
|
86 |
+
/*
|
87 |
+
* Inventory file process start
|
88 |
+
*/
|
89 |
+
public function startImport($file,$vendorCode){
|
90 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
91 |
+
//$changedCsvData = array();
|
92 |
+
unset($this->_rowDataFtp[0]);
|
93 |
+
//$this->checkFtpHeader($this->_colNamesFtp);
|
94 |
+
$csvData = $this->_rowDataFtp;
|
95 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
96 |
+
foreach($sliceCsv as $slicedData){
|
97 |
+
/* @var $changedCsvData
|
98 |
+
* filter CSV row as we need to process only those records
|
99 |
+
* which are present in our inventory table
|
100 |
+
*/
|
101 |
+
$changedCsvData = $this->_csvParserObj->getChangedValue($slicedData,$vendorCode,$this->_colNamesFtp);
|
102 |
+
//condition used for update existing relation in logicbroker_inventory_table
|
103 |
+
if(array_key_exists('change_row',$changedCsvData)){
|
104 |
+
$this->updateVendorInventory($changedCsvData);
|
105 |
+
}
|
106 |
+
//condition used for add new relation in logicbroker_inventory_table according to attribute selected
|
107 |
+
if(array_key_exists('rel_not_exist',$changedCsvData) && $this->_linkAttribute){
|
108 |
+
$this->addVendorInventory($changedCsvData);
|
109 |
+
}
|
110 |
+
$this->prepareLogHistory($changedCsvData);
|
111 |
+
$this->_manualCsvError = array();
|
112 |
+
$changedCsvData = array();
|
113 |
+
}
|
114 |
+
$logHistory = $this->_historyLog;
|
115 |
+
$errorId = $this->saveLogHistory();
|
116 |
+
/*
|
117 |
+
* send email if their is invalid row data
|
118 |
+
*/
|
119 |
+
if($this->_errorsCount > 0){
|
120 |
+
$reportFile = Mage::helper ( 'dropship360' )->generateErrorList ( array (
|
121 |
+
'failure' => count($this->_errorsCount),
|
122 |
+
'lb_vendor_code' => $vendorCode,
|
123 |
+
'error_id' => $errorId,
|
124 |
+
'ftp_error_desc'=>null
|
125 |
+
), true );
|
126 |
+
if(!$reportFile['error'])
|
127 |
+
$this->_ftp->uploadReport($reportFile,$vendorCode);
|
128 |
+
$serverPath = explode('logicbrokervendorproduct',$file);
|
129 |
+
$this->sendMail ( array (
|
130 |
+
'isfailed' => true,
|
131 |
+
'vendor_code' => $vendorCode,
|
132 |
+
'subject' => 'dropship360 failed to update inventory',
|
133 |
+
'message' => 'Missing/Bad data, check CSV data at following FTP path <br>' . $serverPath [1]
|
134 |
+
) );
|
135 |
+
}
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
/*
|
139 |
+
* download all FTP files for each vendor
|
140 |
+
* @return files array
|
141 |
+
* array[vendor_code] = array(file_path)
|
142 |
+
*/
|
143 |
+
public function downloadFiles($localpath){
|
144 |
+
$files = array();
|
145 |
+
$vendorRanks = $this->getVendorRankCollection();
|
146 |
+
if(!empty($vendorRanks)){
|
147 |
+
$files = $this->_ftp->downloadFiles($localpath,$vendorRanks);
|
148 |
+
}
|
149 |
+
return $files;
|
150 |
+
}
|
151 |
+
/*
|
152 |
+
* @return active vendors and inventory folder path
|
153 |
+
*/
|
154 |
+
protected function getVendorRankCollection() {
|
155 |
+
$rankCollection = Mage::getModel('dropship360/ranking')->getCollection()
|
156 |
+
->addFieldToFilter('is_dropship','yes');
|
157 |
+
$vendorRank = array();
|
158 |
+
$accountNumber = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER);
|
159 |
+
if($rankCollection->getSize() > 0){
|
160 |
+
foreach($rankCollection as $vendor){
|
161 |
+
$path = $accountNumber.'_'.$vendor->getLbVendorCode().DS.'Inventory';
|
162 |
+
$vendorRank[$vendor->getLbVendorCode()] = $path;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $vendorRank;
|
166 |
+
}
|
167 |
+
/*
|
168 |
+
* @var $this->_colNamesFtp : CSV header
|
169 |
+
* @var $this->_rowDataFtp : CSV rows
|
170 |
+
*/
|
171 |
+
public function initFtpCsvData($file){
|
172 |
+
$csvObject = new Varien_File_Csv ();
|
173 |
+
$csvData = $csvObject->getData ( $file );
|
174 |
+
if($csvData)
|
175 |
+
$this->_colNamesFtp = $csvData [0];
|
176 |
+
$this->_rowDataFtp = $csvData;
|
177 |
+
return $this;
|
178 |
+
}
|
179 |
+
/*
|
180 |
+
* validate csv file before start import process
|
181 |
+
*/
|
182 |
+
public function validateFtpCsv($file) {
|
183 |
+
$isFailed = false;
|
184 |
+
|
185 |
+
//check for empty csv file
|
186 |
+
if(count($this->_rowDataFtp) <= 1){
|
187 |
+
$this->saveFtpHistoryError('','empty_file','Bad File');
|
188 |
+
$isFailed = true;
|
189 |
+
}
|
190 |
+
// checks columns
|
191 |
+
elseif (!$this->validateCsvHeader ( $this->_colNamesFtp ) || empty ( $this->_colNamesFtp ) ) {
|
192 |
+
$serverPath = explode('logicbrokervendorproduct',$file);
|
193 |
+
$valueArray = array (
|
194 |
+
'file_name' => str_replace(DS,'#',$serverPath[1]),
|
195 |
+
'magento_sku' => '',
|
196 |
+
'vendor_sku' => '',
|
197 |
+
'cost' => '',
|
198 |
+
'qty' => '',
|
199 |
+
);
|
200 |
+
$this->saveFtpHistoryError($valueArray,'ftp_bad_header','Bad File header');
|
201 |
+
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$this->_vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Bad File header,Check header format at following FTP path '.$serverPath[1]));
|
202 |
+
Mage::log('Please check header format for file :'.$serverPath[1], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
203 |
+
$isFailed = true;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $isFailed;
|
207 |
+
}
|
208 |
+
/*
|
209 |
+
* before process next FTP file reset global variable
|
210 |
+
*/
|
211 |
+
public function resetVar() {
|
212 |
+
$this->_errorsCount = 0;
|
213 |
+
$this->_successCount = 0;
|
214 |
+
$this->_colNamesFtp = array();
|
215 |
+
$this->_rowDataFtp = array();
|
216 |
+
$this->_historyErrorType = 'Missing/Bad Data';
|
217 |
+
|
218 |
+
}
|
219 |
+
/*
|
220 |
+
* set and save History log forcefully and
|
221 |
+
*/
|
222 |
+
public function saveFtpHistoryError($message,$msgtype,$historyType){
|
223 |
+
$this->_updatedBy = 'FTP';
|
224 |
+
$this->setLogError('history',$message,$msgtype);
|
225 |
+
$this->setHistoryErrorType($historyType);
|
226 |
+
$this->saveLogHistory();
|
227 |
+
$this->resetVar();
|
228 |
+
return;
|
229 |
+
}
|
230 |
+
public function initialize(){
|
231 |
+
Mage::helper('dropship360')->startProcess('manual_upload');
|
232 |
+
Mage::log('Ftp upload started', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
233 |
+
}
|
234 |
+
|
235 |
+
public function finalize(){
|
236 |
+
Mage::helper('dropship360')->finishProcess('manual_upload');
|
237 |
+
Mage::log('Ftp upload finished', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Import/Manualimport.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Manual vendor inventory import
|
9 |
+
* product attribute used upc,manufacturer_part_number,sku for insert new relation
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Manualimport extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
15 |
+
protected $_csvParserObj;
|
16 |
+
protected $_chunkSize = 1000;
|
17 |
+
|
18 |
+
public function validateCsvHeader($colNames){
|
19 |
+
$headerValidation = true;
|
20 |
+
$result = array_diff($colNames,$this->manualCSVFormat);
|
21 |
+
if(count($result) > 0){
|
22 |
+
$headerValidation = false;
|
23 |
+
}
|
24 |
+
return $headerValidation;
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
public function startImport($csvData,$vendorCode){
|
29 |
+
$this->initVar($vendorCode);
|
30 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
31 |
+
//$changedCsvData = array();
|
32 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
33 |
+
foreach($sliceCsv as $slicedData){
|
34 |
+
/* @var $changedCsvData
|
35 |
+
* filter CSV row as we need to process only those records
|
36 |
+
* which are present in our inventory table
|
37 |
+
*/
|
38 |
+
$historyLogBefore = $this->_historyLog;
|
39 |
+
try {
|
40 |
+
$changedCsvData = $this->_csvParserObj->getChangedValue($slicedData,$vendorCode);
|
41 |
+
//condition used for update existing relation in logicbroker_inventory_table
|
42 |
+
if(array_key_exists('change_row',$changedCsvData)){
|
43 |
+
$this->updateVendorInventory($changedCsvData);
|
44 |
+
}
|
45 |
+
//condition used for add new relation in logicbroker_inventory_table according to attribute selected
|
46 |
+
if(array_key_exists('rel_not_exist',$changedCsvData) && $this->_linkAttribute){
|
47 |
+
$this->addVendorInventory($changedCsvData);
|
48 |
+
}
|
49 |
+
$this->prepareLogHistory($changedCsvData);
|
50 |
+
$this->_manualCsvError = array();
|
51 |
+
$changedCsvData = array();
|
52 |
+
} catch (Exception $e) {
|
53 |
+
$this->_historyLog = $historyLogBefore;
|
54 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
55 |
+
Mage::log('error in import :'.$e->getMessage(), null, 'logicbroker_manual_vendor_inventory_import.log');
|
56 |
+
continue;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
$this->saveLogHistory();
|
60 |
+
}
|
61 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Import/Productsetup.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Product setup with default cost = "" and price = ""
|
9 |
+
* generate new relation between VSKU,VC and MSKU if already exists than ignore
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Productsetup extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
15 |
+
protected $_indexMagentoSku = 0;
|
16 |
+
protected $_indexVendorSku = 1;
|
17 |
+
protected $_newVendorSkuForProductSetup = array();
|
18 |
+
/*
|
19 |
+
* $_vendorSkuArray is used to store vendorSku this array
|
20 |
+
* should contain unique array value if not throw error
|
21 |
+
* @csv_productsetup_test_case - csv file has same vendor sku
|
22 |
+
*
|
23 |
+
*/
|
24 |
+
protected $_vendorSkuArray = array();
|
25 |
+
|
26 |
+
public function validateCsvHeader($colNames)
|
27 |
+
{
|
28 |
+
$headerValidation = true;
|
29 |
+
$result = array_diff($colNames,$this->productSetupCSVFormat);
|
30 |
+
if(count($result) > 0){
|
31 |
+
$headerValidation = false;
|
32 |
+
}
|
33 |
+
return $headerValidation;
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
public function startImport($csvData,$vendorCode){
|
38 |
+
$this->initVar($vendorCode);
|
39 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
40 |
+
//$changedCsvData = array();
|
41 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
42 |
+
foreach($sliceCsv as $slicedData){
|
43 |
+
/* @var $changedCsvData
|
44 |
+
* filter CSV row as we need to process only those records
|
45 |
+
* which are present in our inventory table
|
46 |
+
*/
|
47 |
+
$historyLogBefore = $this->_historyLog;
|
48 |
+
try {
|
49 |
+
$slicedData = $this->_filterRowData($slicedData);
|
50 |
+
foreach($slicedData as $row){
|
51 |
+
$validationStatus = $this->isVendorRelExists($row);
|
52 |
+
if(!$validationStatus){
|
53 |
+
$this->addVendorInventory($row);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$this->updateVendorSkuForProductSetup();
|
57 |
+
$this->insertVendorInventory();
|
58 |
+
$this->saveInlineLog();
|
59 |
+
$this->prepareLogHistory();
|
60 |
+
$this->_manualCsvError = array();
|
61 |
+
|
62 |
+
} catch (Exception $e) {
|
63 |
+
$this->_historyLog = $historyLogBefore;
|
64 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
65 |
+
Mage::log('error in import :'.$e->getMessage(), null, 'logicbroker_manual_vendor_inventory_import.log');
|
66 |
+
continue;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
$this->saveLogHistory();
|
70 |
+
}
|
71 |
+
|
72 |
+
/* filter valid data
|
73 |
+
* csv row format
|
74 |
+
* $row[$this->_indexStock] = vendor_sku
|
75 |
+
* $row[1] = qty
|
76 |
+
* $row[2] = cost
|
77 |
+
*/
|
78 |
+
protected function validate($rowData,$key = null) {
|
79 |
+
$isValid = true;
|
80 |
+
$colName = array();
|
81 |
+
$errorCode = 'history';
|
82 |
+
|
83 |
+
// col magento_sku value is empty
|
84 |
+
if(empty($rowData[$this->_indexMagentoSku])){
|
85 |
+
$isValid = false;
|
86 |
+
$colName[] = 'magento_sku';
|
87 |
+
}
|
88 |
+
|
89 |
+
// col vendor_sku value is empty
|
90 |
+
if(empty($rowData[$this->_indexVendorSku])){
|
91 |
+
$isValid = false;
|
92 |
+
$colName[] = 'vendor_sku';
|
93 |
+
}
|
94 |
+
|
95 |
+
(!$isValid) ? $this->addRowError($errorCode,$key,$colName) : '';
|
96 |
+
return $isValid;
|
97 |
+
}
|
98 |
+
/*
|
99 |
+
* remove rows which have invalid cost and Qty
|
100 |
+
* @ it will not remove row which have partial correct cost or qty
|
101 |
+
*/
|
102 |
+
protected function _filterRowData($slicedData) {
|
103 |
+
$changedCsvData = array();
|
104 |
+
foreach($slicedData as $key=>$row){
|
105 |
+
if(!$this->validate($row,$key))
|
106 |
+
continue;
|
107 |
+
$changedCsvData[$key] = $row;
|
108 |
+
}
|
109 |
+
return $changedCsvData;
|
110 |
+
}
|
111 |
+
protected function isVendorRelExists($row){
|
112 |
+
$isRelFound = false;
|
113 |
+
//check if magento sku exists
|
114 |
+
if(!Mage::getModel('catalog/product')->getIdBySku(trim($row[$this->_indexMagentoSku]))){
|
115 |
+
$isRelFound = true;//log error relation already exists
|
116 |
+
$data = array (
|
117 |
+
'magento_sku' =>$row[$this->_indexMagentoSku],
|
118 |
+
'qty' => '',
|
119 |
+
'vendor_sku' =>$row[$this->_indexVendorSku],
|
120 |
+
'cost' => ''
|
121 |
+
);
|
122 |
+
$this->setLogError('history', $data, 'magento_sku_exists');
|
123 |
+
return $isRelFound;
|
124 |
+
}
|
125 |
+
|
126 |
+
if($this->checkVCVSMSUnique($row)){
|
127 |
+
return $isRelFound = true;
|
128 |
+
}
|
129 |
+
|
130 |
+
if($this->checkVCVSUnique($row)){
|
131 |
+
return $isRelFound = true;
|
132 |
+
}
|
133 |
+
|
134 |
+
if(count($this->_vendorSkuArray) > 0 && in_array($row[$this->_indexVendorSku],$this->_vendorSkuArray )){
|
135 |
+
$isRelFound = true;//log error relation already exists
|
136 |
+
$data = array('vendor_sku'=>$row[$this->_indexVendorSku]);
|
137 |
+
$this->setLogError('history', $data, 'already_assigned');
|
138 |
+
return $isRelFound;
|
139 |
+
}else{
|
140 |
+
$this->_vendorSkuArray[] = $row[$this->_indexVendorSku];
|
141 |
+
}
|
142 |
+
/*
|
143 |
+
* check magento_sku has already assigned vendorCode
|
144 |
+
* in this case we need to update vendor_sku before updating
|
145 |
+
* we need to check vendorCode and vendorSku should have unique
|
146 |
+
* combination in logicbroker_vendor_inventory table
|
147 |
+
*/
|
148 |
+
$rowData = array('magento_sku'=>$row[$this->_indexMagentoSku],'productSetup'=>true);
|
149 |
+
if($this->_checkDuplicateCombination(null,$rowData)){
|
150 |
+
$errorCode = 'inline';
|
151 |
+
$data = array (
|
152 |
+
'magento_sku' => $row[$this->_indexMagentoSku],
|
153 |
+
$this->_indexStock => '',
|
154 |
+
$this->_indexPrice => ''
|
155 |
+
);
|
156 |
+
$this->addInlineLog($errorCode, 'Product Setup - vendor sku updated', $data);
|
157 |
+
$this->_newVendorSkuForProductSetup [Mage::registry ( 'product_setup_vendor_id' )] = array (
|
158 |
+
'lb_vendor_sku' => $row[$this->_indexVendorSku],
|
159 |
+
'updated_at' => now()
|
160 |
+
);
|
161 |
+
Mage::unregister('product_setup_vendor_id');
|
162 |
+
return $isRelFound = true;
|
163 |
+
}
|
164 |
+
|
165 |
+
return $isRelFound;
|
166 |
+
}
|
167 |
+
//check lb_vendor_code && lb_vendor_sku && magento_sku is not duplicate
|
168 |
+
protected function checkVCVSMSUnique($row){
|
169 |
+
$isRelFound = false;
|
170 |
+
$vendorCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
171 |
+
$vendorCollection->addFieldToFilter('lb_vendor_code',$this->_vendorCode)
|
172 |
+
->addFieldToFilter('product_sku',$row[$this->_indexMagentoSku])
|
173 |
+
->addFieldToFilter('lb_vendor_sku',$row[$this->_indexVendorSku]);
|
174 |
+
if($vendorCollection->getSize() > 0){
|
175 |
+
$isRelFound = true;//log error relation already exists
|
176 |
+
$data = array (
|
177 |
+
'vendor_sku' => $row [$this->_indexVendorSku],
|
178 |
+
'vendor_code' => $this->_vendorCode,
|
179 |
+
'magento_sku' => $row [$this->_indexMagentoSku]
|
180 |
+
);
|
181 |
+
$this->setLogError('history', $data, 'combination_exist');
|
182 |
+
return $isRelFound;
|
183 |
+
}
|
184 |
+
return $isRelFound;
|
185 |
+
|
186 |
+
}
|
187 |
+
//check lb_vendor_code && lb_vendor_sku is unique
|
188 |
+
//
|
189 |
+
protected function checkVCVSUnique($row){
|
190 |
+
$isRelFound = false;
|
191 |
+
$vendorCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
192 |
+
$vendorCollection->addFieldToFilter('lb_vendor_code',$this->_vendorCode)
|
193 |
+
->addFieldToFilter('lb_vendor_sku',$row[$this->_indexVendorSku]);
|
194 |
+
if($vendorCollection->getSize() > 0){
|
195 |
+
$isRelFound = true;//log error relation already exists
|
196 |
+
$data = array('vendor_sku'=>$row[$this->_indexVendorSku]);
|
197 |
+
$this->setLogError('history', $data, 'already_assigned');
|
198 |
+
return $isRelFound;
|
199 |
+
}
|
200 |
+
return $isRelFound;
|
201 |
+
}
|
202 |
+
protected function addVendorInventory($rowData){
|
203 |
+
$errorCode = 'inline';
|
204 |
+
$this->prepareVendorInventory($rowData,'add');
|
205 |
+
$data = array (
|
206 |
+
'magento_sku' => $rowData [$this->_indexMagentoSku],
|
207 |
+
$this->_indexStock => '',
|
208 |
+
$this->_indexPrice => ''
|
209 |
+
);
|
210 |
+
$this->addInlineLog($errorCode, 'Product Setup', $data);
|
211 |
+
}
|
212 |
+
|
213 |
+
/*
|
214 |
+
* @var $_vendorInventory
|
215 |
+
* use to update cost and qty possible case
|
216 |
+
* invalid_qty : ignore qty and update cost
|
217 |
+
* invalid_cost : ignore cost and update qty
|
218 |
+
* both invalid : no update will perform
|
219 |
+
* both valid : update cost and qty
|
220 |
+
*/
|
221 |
+
protected function prepareVendorInventory($rowData) {
|
222 |
+
$this->_vendorInventory [] = array($this->_vendorCode, //VC
|
223 |
+
$this->_vendorName, //VN
|
224 |
+
$rowData [$this->_indexMagentoSku],//MSKU
|
225 |
+
$rowData[$this->_indexVendorSku],//VSKU
|
226 |
+
'',//stock
|
227 |
+
'',//cost
|
228 |
+
now (),//Create
|
229 |
+
now () //update
|
230 |
+
);
|
231 |
+
$this->_successCount++;
|
232 |
+
}
|
233 |
+
|
234 |
+
protected function updateVendorSkuForProductSetup(){
|
235 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
236 |
+
foreach($this->_newVendorSkuForProductSetup as $key=>$rowData){
|
237 |
+
try{
|
238 |
+
if(is_array($rowData)){
|
239 |
+
$this->_dbConnection->update($vendorInventoryTable,$rowData,array('id = ?'=>$key));
|
240 |
+
$this->_successCount++;
|
241 |
+
}
|
242 |
+
}catch (Exception $e){
|
243 |
+
Mage::throwException('Error in updating vendor sku for product setup : '.$e->getMessage());
|
244 |
+
$this->_dbConnection->rollBack();
|
245 |
+
}
|
246 |
+
}
|
247 |
+
$this->_newVendorSkuForProductSetup = array();
|
248 |
+
}
|
249 |
+
}
|
app/code/community/Logicbroker/Dropship360/Model/Inventory.php
CHANGED
@@ -15,18 +15,26 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
15 |
protected $_stockBeforeQtyDecimalCheck = '';
|
16 |
protected $_iserror = true;
|
17 |
protected $_errorMsg = '';
|
|
|
|
|
|
|
18 |
protected function _construct()
|
19 |
{
|
20 |
$this->_init("dropship360/inventory");
|
21 |
}
|
22 |
-
|
|
|
|
|
|
|
23 |
public function prepareInventoryTable($restReqest)
|
24 |
{
|
25 |
$result = $this->prepareData($restReqest);
|
26 |
$this->updateProductStock();
|
27 |
return $result;
|
28 |
}
|
29 |
-
|
|
|
|
|
30 |
protected function updateProductStock()
|
31 |
{
|
32 |
$dataCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
@@ -51,6 +59,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
51 |
}
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
protected function saveStockData($sku, $qty)
|
55 |
{
|
56 |
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
@@ -67,13 +80,15 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
67 |
$stockItem->save();
|
68 |
} catch (Exception $e) {
|
69 |
Mage::helper('dropship360')->genrateLog(0,'mgento inventory update started','mgento inventory update ended','Section :Error In Setting/update magento inventory: '.$e->getMessage().' sku : '.$sku);
|
70 |
-
echo $e->getMessage();
|
71 |
}
|
72 |
}
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
|
|
|
|
|
|
|
77 |
protected function prepareData($restReqest)
|
78 |
{
|
79 |
$result = array();
|
@@ -87,6 +102,63 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
87 |
return $result;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
protected function validateRowData($val)
|
91 |
{
|
92 |
if(empty($val['product_sku']) && empty($val['lb_vendor_sku'])){
|
@@ -97,8 +169,14 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
97 |
$this->_iserror = false;
|
98 |
}
|
99 |
return $this->_iserror;
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
protected function updateStock($val,$buffer)
|
103 |
{
|
104 |
if(!empty($buffer))
|
@@ -106,7 +184,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
106 |
return $val['stock'];
|
107 |
}
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
110 |
protected function _prepareCollection($val)
|
111 |
{
|
112 |
$dataCollection = Mage::getModel('dropship360/inventory');
|
@@ -135,8 +217,13 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
135 |
}
|
136 |
}
|
137 |
return $collection;
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
140 |
protected function getLogMsg($ignoreData)
|
141 |
{
|
142 |
if(count($ignoreData)>0){
|
@@ -160,56 +247,33 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
160 |
return array('msg'=>$msg,'type'=>$type);
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
if(!$this->validateRowData($val))
|
175 |
-
{
|
176 |
-
return $this->_errorMsg;
|
177 |
-
}
|
178 |
-
|
179 |
-
$ignoreData = array();
|
180 |
-
(!is_numeric($val['cost']) || $val['cost'] < 0) ? $ignoreData[]= 'cost' : '';
|
181 |
-
(!is_numeric($val['stock']) || $val['stock'] < 0) ? $ignoreData[]= 'stock' : '';
|
182 |
-
(!is_numeric($val['stock']) || $val['stock'] < 0 || $val['stock'] == "") ? $stockFlag = false : $stockFlag = true;
|
183 |
-
(!is_numeric($val['cost']) || $val['cost'] < 0 || $val['cost'] == "") ? $costFlag = false : $costFlag = true;
|
184 |
-
$val['stock'] = $this->updateStock($val,$buffer);
|
185 |
-
$collection = $this->_prepareCollection($val);
|
186 |
-
if(is_null($collection)){
|
187 |
-
return $this->_errorMsg;
|
188 |
-
}
|
189 |
-
$product_sku = $collection->getFirstItem()->getProductSku();
|
190 |
-
/* LBN - 935 change */
|
191 |
-
$val['stock'] = Mage::helper('dropship360')->getIsQtyDecimal($product_sku,$val['stock']);
|
192 |
-
if($collection->getSize() >= 2 && empty($val['product_sku']))
|
193 |
-
{
|
194 |
-
return 'Multiple records found. Please provide Product SKU';
|
195 |
-
}
|
196 |
-
if($collection->getSize() > 0){
|
197 |
-
$collection->getFirstItem ()->setUpdatedAt(now());
|
198 |
-
($stockFlag == true) ? $collection->getFirstItem ()->setStock($val['stock']) : '';
|
199 |
-
($costFlag == true) ? $collection->getFirstItem ()->setCost($val['cost']) : '';
|
200 |
-
$arrayUpdate = array('updated_by'=>'system','product_sku'=>$product_sku,'lb_vendor_code'=>$val['lb_vendor_code'],'cost'=>$val['cost'],'stock'=>$originalStock);
|
201 |
-
$logDetail = $this->getLogMsg($ignoreData);
|
202 |
-
$this->_saveInventoryLog($logDetail['type'],$arrayUpdate);
|
203 |
-
if(count($ignoreData)!=2){
|
204 |
-
$collection->getFirstItem ()->save();
|
205 |
-
$this->_updateVendorList($vendorCollection,$val,false);
|
206 |
-
}
|
207 |
-
return $logDetail['msg'];
|
208 |
-
}else{
|
209 |
-
return 'Vendor Sku "'.$val['lb_vendor_sku'].'" and Magento SKU "'.$val['product_sku'].'" combination does not exist for vendor ';
|
210 |
-
}
|
211 |
-
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
public function saveTabVendorData($request)
|
214 |
{
|
215 |
$update = isset($request['vendor_update']) ? $request['vendor_update'] : '';
|
@@ -242,6 +306,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
242 |
return array('inventory'=>$finalStock,'result' => $result);
|
243 |
}
|
244 |
|
|
|
|
|
|
|
|
|
|
|
245 |
protected function _validate($request)
|
246 |
{
|
247 |
$arrVendorCode = array();
|
@@ -271,13 +340,25 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
271 |
(!$isUniqueCombination && !$isEntrySame) ? $isError = false : $isError;
|
272 |
return $isError;
|
273 |
}
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
protected function checkCodeSkuCombination($vendorCode,$vendorSku)
|
276 |
{
|
277 |
$collection = $this->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
278 |
return $collection->count();
|
279 |
}
|
280 |
|
|
|
|
|
|
|
|
|
|
|
281 |
protected function _addNewInventoryVendor($request,$productSku){
|
282 |
$vendorCollection = Mage::getModel('dropship360/ranking')->load($request['lb_vendor_code'],'lb_vendor_code');
|
283 |
$request['created_at'] = now();
|
@@ -304,13 +385,20 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
304 |
}
|
305 |
}
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
protected function _updateInventoryVendor($id,$request){
|
308 |
|
309 |
$model = $this->load($id);
|
310 |
$vendorCode = $model->getLbVendorCode();
|
311 |
$vendorName = $model->getLbVendorName();
|
312 |
$DbValues['cost'] = $model->getCost();
|
313 |
-
|
|
|
314 |
$DbValues['lb_vendor_sku'] = $model->getLbVendorSku();
|
315 |
$productSku = $model->getProductSku();
|
316 |
$request['lb_vendor_sku'] = trim($request['lb_vendor_sku']);
|
@@ -346,6 +434,10 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
346 |
return true;
|
347 |
}
|
348 |
|
|
|
|
|
|
|
|
|
349 |
protected function _deleteInvendorVendor($vendorId){
|
350 |
$model = $this->load($vendorId);
|
351 |
$vendorCode = $model->getLbVendorCode();
|
@@ -361,6 +453,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
361 |
}
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
364 |
public function _saveInventoryLog($type,$request){
|
365 |
$modelLog = Mage::getModel('dropship360/inventorylog');
|
366 |
$request['activity'] = $type;
|
@@ -379,21 +476,50 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
379 |
}
|
380 |
}
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
389 |
}
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
}
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
protected function _updateBuffer($stock,$dbCost = null){
|
398 |
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
399 |
$finalStock = 0;
|
@@ -413,7 +539,10 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
413 |
}
|
414 |
return $finalStock;
|
415 |
}
|
416 |
-
|
|
|
|
|
|
|
417 |
* that first vendor has been added to logicbroker_vendor_inventory
|
418 |
*/
|
419 |
protected function _afterSave()
|
@@ -429,7 +558,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
429 |
return;
|
430 |
}
|
431 |
|
432 |
-
|
|
|
|
|
|
|
|
|
433 |
|
434 |
try {
|
435 |
$fieldsetData['subject'] = 'DS360 Product Setup completed on Magento';
|
@@ -446,21 +579,51 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
446 |
return false;//$e->getMassage();
|
447 |
}
|
448 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
public function upDateVendorName($vendor){
|
450 |
if(empty($vendor['code']) || empty($vendor['name']))
|
451 |
{
|
452 |
return;
|
453 |
}
|
|
|
454 |
$table = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
455 |
-
$update = 'UPDATE '.$table.' SET lb_vendor_name = "'.$vendor['name'].'" WHERE lb_vendor_code = "'.$vendor['code'].'"';
|
456 |
$conObj = Mage::getSingleton ( 'core/resource' )->getConnection('core_write');
|
457 |
-
$conObj->beginTransaction();
|
458 |
-
$conObj->query($update);
|
459 |
try {
|
460 |
-
$conObj->
|
461 |
} catch ( Exception $e ) {
|
462 |
-
|
463 |
-
Mage::getSingleton ( 'adminhtml/session' )->addError($e->getMessage ());
|
464 |
}
|
465 |
}
|
466 |
}
|
15 |
protected $_stockBeforeQtyDecimalCheck = '';
|
16 |
protected $_iserror = true;
|
17 |
protected $_errorMsg = '';
|
18 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
19 |
+
const XML_PATH_INVENTORY_NOTIFICATION_DAYS = 'logicbroker_sourcing/inventory_notification/days';
|
20 |
+
|
21 |
protected function _construct()
|
22 |
{
|
23 |
$this->_init("dropship360/inventory");
|
24 |
}
|
25 |
+
/**
|
26 |
+
* @param Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Admin_V1 $restReqest
|
27 |
+
* function used by REST for update vendor inventory
|
28 |
+
*/
|
29 |
public function prepareInventoryTable($restReqest)
|
30 |
{
|
31 |
$result = $this->prepareData($restReqest);
|
32 |
$this->updateProductStock();
|
33 |
return $result;
|
34 |
}
|
35 |
+
/**
|
36 |
+
* update vendor inventory using REST
|
37 |
+
*/
|
38 |
protected function updateProductStock()
|
39 |
{
|
40 |
$dataCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
59 |
}
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* update catalogInventory for product
|
64 |
+
* @param Logicbroker_Dropship360_Model_Inventory $sku
|
65 |
+
* @param Logicbroker_Dropship360_Model_Inventory $qty
|
66 |
+
*/
|
67 |
protected function saveStockData($sku, $qty)
|
68 |
{
|
69 |
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
80 |
$stockItem->save();
|
81 |
} catch (Exception $e) {
|
82 |
Mage::helper('dropship360')->genrateLog(0,'mgento inventory update started','mgento inventory update ended','Section :Error In Setting/update magento inventory: '.$e->getMessage().' sku : '.$sku);
|
|
|
83 |
}
|
84 |
}
|
85 |
}
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* prepare and insert/update vendor data from REST request
|
90 |
+
* @param REST $restReqest
|
91 |
+
*/
|
92 |
protected function prepareData($restReqest)
|
93 |
{
|
94 |
$result = array();
|
102 |
return $result;
|
103 |
}
|
104 |
|
105 |
+
/**
|
106 |
+
* This function is used to save Vendor inventory
|
107 |
+
* @param array $val
|
108 |
+
* @return array $msg
|
109 |
+
*/
|
110 |
+
protected function saveLbInventory($rowVal, $buffer)
|
111 |
+
{
|
112 |
+
$val = array_map('trim',$rowVal);
|
113 |
+
$originalStock = $val['stock'];
|
114 |
+
$vendorObject = Mage::getModel('dropship360/ranking');
|
115 |
+
$vendorCollection = $vendorObject->load($val['lb_vendor_code'],'lb_vendor_code');
|
116 |
+
if(!$this->validateRowData($val))
|
117 |
+
{
|
118 |
+
return $this->_errorMsg;
|
119 |
+
}
|
120 |
+
|
121 |
+
$ignoreData = array();
|
122 |
+
(!is_numeric($val['cost']) || $val['cost'] < 0) ? $ignoreData[]= 'cost' : '';
|
123 |
+
(!is_numeric($val['stock']) || $val['stock'] < 0) ? $ignoreData[]= 'stock' : '';
|
124 |
+
(!is_numeric($val['stock']) || $val['stock'] < 0 || $val['stock'] == "") ? $stockFlag = false : $stockFlag = true;
|
125 |
+
(!is_numeric($val['cost']) || $val['cost'] < 0 || $val['cost'] == "") ? $costFlag = false : $costFlag = true;
|
126 |
+
$val['stock'] = $this->updateStock($val,$buffer);
|
127 |
+
$collection = $this->_prepareCollection($val);
|
128 |
+
if(is_null($collection)){
|
129 |
+
return $this->_errorMsg;
|
130 |
+
}
|
131 |
+
// if($collection->getSize() >= 2 && empty($val['product_sku']))
|
132 |
+
// {
|
133 |
+
// return 'Multiple records found. Please provide Product SKU';
|
134 |
+
// }
|
135 |
+
$collection->getSelect()->limit(1);
|
136 |
+
$product_sku = $collection->getFirstItem()->getProductSku();
|
137 |
+
/* LBN - 935 change */
|
138 |
+
$val['stock'] = Mage::helper('dropship360')->getIsQtyDecimal($product_sku,$val['stock']);
|
139 |
+
|
140 |
+
if($collection->getSize() > 0){
|
141 |
+
$collection->getFirstItem ()->setUpdatedAt(now());
|
142 |
+
($stockFlag == true) ? $collection->getFirstItem ()->setStock($val['stock']) : '';
|
143 |
+
($costFlag == true) ? $collection->getFirstItem ()->setCost($val['cost']) : '';
|
144 |
+
$arrayUpdate = array('updated_by'=>'system','product_sku'=>$product_sku,'lb_vendor_code'=>$val['lb_vendor_code'],'cost'=>$val['cost'],'stock'=>$originalStock);
|
145 |
+
$logDetail = $this->getLogMsg($ignoreData);
|
146 |
+
$this->_saveInventoryLog($logDetail['type'],$arrayUpdate);
|
147 |
+
if(count($ignoreData)!=2){
|
148 |
+
$collection->getFirstItem ()->save();
|
149 |
+
$this->_updateVendorList($vendorCollection,$val,false);
|
150 |
+
}
|
151 |
+
return $logDetail['msg'];
|
152 |
+
}else{
|
153 |
+
return 'Vendor Sku "'.$val['lb_vendor_sku'].'" and Magento SKU "'.$val['product_sku'].'" combination does not exist for vendor ';
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Validate row data getting from REST
|
159 |
+
* @param json $val
|
160 |
+
* @return boolean
|
161 |
+
*/
|
162 |
protected function validateRowData($val)
|
163 |
{
|
164 |
if(empty($val['product_sku']) && empty($val['lb_vendor_sku'])){
|
169 |
$this->_iserror = false;
|
170 |
}
|
171 |
return $this->_iserror;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* get processed stock for vendor
|
176 |
+
* @param json $val
|
177 |
+
* @param core_config_data $buffer
|
178 |
+
* @return stock (request-stock + buffer)
|
179 |
+
*/
|
180 |
protected function updateStock($val,$buffer)
|
181 |
{
|
182 |
if(!empty($buffer))
|
184 |
return $val['stock'];
|
185 |
}
|
186 |
|
187 |
+
/**
|
188 |
+
* prepare collection from vendor inventory table
|
189 |
+
* @param jason $val
|
190 |
+
* @return collection
|
191 |
+
*/
|
192 |
protected function _prepareCollection($val)
|
193 |
{
|
194 |
$dataCollection = Mage::getModel('dropship360/inventory');
|
217 |
}
|
218 |
}
|
219 |
return $collection;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* generate inline log message for product details page
|
224 |
+
* @param array $ignoreData
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
protected function getLogMsg($ignoreData)
|
228 |
{
|
229 |
if(count($ignoreData)>0){
|
247 |
return array('msg'=>$msg,'type'=>$type);
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* create new vendor using REST if not exist
|
252 |
+
* @param Logicbroker_Dropship360_Model_Ranking $object
|
253 |
+
* @param string $data
|
254 |
+
*/
|
255 |
+
protected function _updateVendorList($object,$data = ''){
|
256 |
+
if(!empty($data)){
|
257 |
+
$object->setUpdatedAt(now());
|
258 |
+
$object->setLbVendorType('enhanced');
|
259 |
+
if(!$object->getId()) $object->setIsDropship('no');
|
260 |
+
$object->setLbVendorCode($data['lb_vendor_code']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
+
}
|
263 |
+
try{
|
264 |
+
$object->save();
|
265 |
+
}catch(Exception $e){
|
266 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
/* update or add vendor inventory using REST code ends here */
|
271 |
+
/**************************************************************/
|
272 |
+
/**
|
273 |
+
* create,update,delete vendor data from product details page
|
274 |
+
* @param Mage_catalog_Model_Product $request
|
275 |
+
* @return boolean|multitype:number boolean
|
276 |
+
*/
|
277 |
public function saveTabVendorData($request)
|
278 |
{
|
279 |
$update = isset($request['vendor_update']) ? $request['vendor_update'] : '';
|
306 |
return array('inventory'=>$finalStock,'result' => $result);
|
307 |
}
|
308 |
|
309 |
+
/**
|
310 |
+
* validate frontend admin data provided by user on product detail page
|
311 |
+
* @param Mage_catalog_Model_Product $request
|
312 |
+
* @return boolean
|
313 |
+
*/
|
314 |
protected function _validate($request)
|
315 |
{
|
316 |
$arrVendorCode = array();
|
340 |
(!$isUniqueCombination && !$isEntrySame) ? $isError = false : $isError;
|
341 |
return $isError;
|
342 |
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* check unique combination of vendorCode and vendorSku
|
346 |
+
* in logicbroker_vendor_inventory table
|
347 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorCode
|
348 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorSku
|
349 |
+
* @return number
|
350 |
+
*/
|
351 |
protected function checkCodeSkuCombination($vendorCode,$vendorSku)
|
352 |
{
|
353 |
$collection = $this->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
354 |
return $collection->count();
|
355 |
}
|
356 |
|
357 |
+
/**
|
358 |
+
* add new vendor on product details page for SKU in request
|
359 |
+
* @param Mage_catalog_Model_Product $request
|
360 |
+
* @param Mage_catalog_Model_Product $productSku
|
361 |
+
*/
|
362 |
protected function _addNewInventoryVendor($request,$productSku){
|
363 |
$vendorCollection = Mage::getModel('dropship360/ranking')->load($request['lb_vendor_code'],'lb_vendor_code');
|
364 |
$request['created_at'] = now();
|
385 |
}
|
386 |
}
|
387 |
|
388 |
+
/**
|
389 |
+
* update vendor inventory data as per data from product details page for SKU in request
|
390 |
+
* @param Logicbroker_Dropship360_Model_Inventory $id
|
391 |
+
* @param Mage_Catalog_Model_Product $request
|
392 |
+
* @return boolean
|
393 |
+
*/
|
394 |
protected function _updateInventoryVendor($id,$request){
|
395 |
|
396 |
$model = $this->load($id);
|
397 |
$vendorCode = $model->getLbVendorCode();
|
398 |
$vendorName = $model->getLbVendorName();
|
399 |
$DbValues['cost'] = $model->getCost();
|
400 |
+
//patch apply to check empty stock
|
401 |
+
$DbValues['stock'] = ($model->getStock() == '') ? -9999999 : $model->getStock();
|
402 |
$DbValues['lb_vendor_sku'] = $model->getLbVendorSku();
|
403 |
$productSku = $model->getProductSku();
|
404 |
$request['lb_vendor_sku'] = trim($request['lb_vendor_sku']);
|
434 |
return true;
|
435 |
}
|
436 |
|
437 |
+
/**
|
438 |
+
* Delete vendor from product details page for SKU in request
|
439 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorId
|
440 |
+
*/
|
441 |
protected function _deleteInvendorVendor($vendorId){
|
442 |
$model = $this->load($vendorId);
|
443 |
$vendorCode = $model->getLbVendorCode();
|
453 |
}
|
454 |
}
|
455 |
|
456 |
+
/**
|
457 |
+
* add inline comment to dropship360 history tab on product details page
|
458 |
+
* @param Logicbroker_Dropship360_Model_Inventorylog $type
|
459 |
+
* @param Mage_Catalog_Model_Product $request
|
460 |
+
*/
|
461 |
public function _saveInventoryLog($type,$request){
|
462 |
$modelLog = Mage::getModel('dropship360/inventorylog');
|
463 |
$request['activity'] = $type;
|
476 |
}
|
477 |
}
|
478 |
|
479 |
+
/**
|
480 |
+
* update catalogInventory
|
481 |
+
* @param array $result
|
482 |
+
* @param Mage_Catalog_Model_Product $sku
|
483 |
+
*/
|
484 |
+
public function productInventoryUpdate($result,$sku)
|
485 |
+
{
|
486 |
+
if(!$result['result']){
|
487 |
+
return;
|
488 |
}
|
489 |
+
|
490 |
+
$finalStock = $result['inventory'];
|
491 |
+
$finalStock = Mage::helper('dropship360')->getIsQtyDecimal($sku, $finalStock);
|
492 |
+
$conn = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
493 |
+
|
494 |
+
$tableNameStatus = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status' );
|
495 |
+
$tableNameItem = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_item' );
|
496 |
+
$tableNameItemIdx = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status_indexer_idx' );
|
497 |
+
|
498 |
+
$stockStatus = $finalStock ? 1 : 0;
|
499 |
+
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
500 |
+
if($productId){
|
501 |
+
$updateStatus = 'update '.$tableNameStatus.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
502 |
+
$updateItem = 'update '.$tableNameItem.' SET qty = '.$finalStock.',is_in_stock = '.$stockStatus.' where product_id = '.$productId;
|
503 |
+
$updateItemIdx = 'update '.$tableNameItemIdx.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
504 |
+
$conn->beginTransaction ();
|
505 |
+
$conn->query ($updateStatus);
|
506 |
+
$conn->query ($updateItem);
|
507 |
+
$conn->query ($updateItemIdx);
|
508 |
+
try {
|
509 |
+
$conn->commit ();
|
510 |
+
} catch ( Exception $e ) {
|
511 |
+
$conn->rollBack ();
|
512 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
513 |
+
}
|
514 |
}
|
515 |
}
|
516 |
|
517 |
+
/**
|
518 |
+
* calculate final stock
|
519 |
+
* @param request $stock
|
520 |
+
* @param Logicbroker_Dropship360_Model_Inventory $dbCost
|
521 |
+
* @return stock
|
522 |
+
*/
|
523 |
protected function _updateBuffer($stock,$dbCost = null){
|
524 |
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
525 |
$finalStock = 0;
|
539 |
}
|
540 |
return $finalStock;
|
541 |
}
|
542 |
+
/***************Vendor details save from product details page code ends here*****/
|
543 |
+
|
544 |
+
/**
|
545 |
+
* method use to send email notification to logicbroker
|
546 |
* that first vendor has been added to logicbroker_vendor_inventory
|
547 |
*/
|
548 |
protected function _afterSave()
|
558 |
return;
|
559 |
}
|
560 |
|
561 |
+
/**
|
562 |
+
* send email notification to logicbroker support
|
563 |
+
* @return boolean
|
564 |
+
*/
|
565 |
+
protected function sendVendorNotification(){
|
566 |
|
567 |
try {
|
568 |
$fieldsetData['subject'] = 'DS360 Product Setup completed on Magento';
|
579 |
return false;//$e->getMassage();
|
580 |
}
|
581 |
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* send notification email to users mention in activity monitor section
|
585 |
+
* @return Logicbroker_Dropship360_Model_Inventory
|
586 |
+
*/
|
587 |
+
public function notificationProductInventoryUpdate(){
|
588 |
+
$itemObject;
|
589 |
+
$fileInfo = array();
|
590 |
+
$ioAdapter = new Varien_Io_File();
|
591 |
+
$open_monitor_from = Date('Y-m-d h:i:s', strtotime('-'.Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS).' day'));
|
592 |
+
$open_monitor_to = Mage::getModel('core/date')->gmtDate();
|
593 |
+
$itemObject = Mage::getModel('dropship360/inventory')->getCollection()->addFieldTofilter('updated_at', array('from' => $open_monitor_from,'to' => $open_monitor_to));
|
594 |
+
if($itemObject->getSize() <= 0){
|
595 |
+
Mage::log('cannot send outdated product inventory email collection is empty for form :'.$open_monitor_from.' to :'.$open_monitor_to, null, 'notification_error.log');
|
596 |
+
return $this;
|
597 |
+
}
|
598 |
+
$fileInfo = Mage::getModel('dropship360/csvparser')->getCsvFile($itemObject);
|
599 |
+
$mailData['days'] = Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS);
|
600 |
+
$mailData['subject'] = 'dropship360 list of outdated product inventory';
|
601 |
+
$postObject = new Varien_Object();
|
602 |
+
$postObject->setData($mailData);
|
603 |
+
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
604 |
+
$templateId = 'logicbroker_outdated_product_inventory';
|
605 |
+
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId,$fileInfo['value']);
|
606 |
+
$ioAdapter->rm($fileInfo['value']);
|
607 |
+
return $this;
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* update vendor name
|
612 |
+
* @param Logicbroker_Dropship360_Model_Ranking $vendor
|
613 |
+
*/
|
614 |
public function upDateVendorName($vendor){
|
615 |
if(empty($vendor['code']) || empty($vendor['name']))
|
616 |
{
|
617 |
return;
|
618 |
}
|
619 |
+
$helper = Mage::helper('dropship360');
|
620 |
$table = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
|
|
621 |
$conObj = Mage::getSingleton ( 'core/resource' )->getConnection('core_write');
|
|
|
|
|
622 |
try {
|
623 |
+
$conObj->update($table,array('lb_vendor_name'=>$helper->convertToHtmlcode($vendor['name'])),array('lb_vendor_code = ?'=>$vendor['code']));
|
624 |
} catch ( Exception $e ) {
|
625 |
+
Mage::throwException('Error occured while renaming vendor in inventory table : '.$e->getMessage());
|
626 |
+
//Mage::getSingleton ( 'adminhtml/session' )->addError($e->getMessage ());
|
627 |
}
|
628 |
}
|
629 |
}
|
app/code/community/Logicbroker/Dropship360/Model/Inventorylog.php
CHANGED
@@ -9,9 +9,79 @@
|
|
9 |
|
10 |
class Logicbroker_Dropship360_Model_Inventorylog extends Mage_Core_Model_Abstract
|
11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
protected function _construct(){
|
13 |
|
14 |
$this->_init("dropship360/inventorylog");
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
9 |
|
10 |
class Logicbroker_Dropship360_Model_Inventorylog extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
protected $_message = array(
|
13 |
+
'row_magento_sku'=>'Missing Data at Row(s) for Magento Sku row_num',
|
14 |
+
'row_vendor_sku'=>'Missing Data at Row(s) for Vendor Sku row_num',
|
15 |
+
'row_qty'=>'Bad Data for Qty at Row(s) row_num',
|
16 |
+
'row_cost'=>'Bad Data for Cost at Row(s) row_num',
|
17 |
+
'empty_file'=>'Sorry,we cant find the record to update inventory',
|
18 |
+
'inventory_update_error'=>'Error in updating magento product inventory, magento_sku',
|
19 |
+
'magento_sku_exists'=>'magento product sku not exist magento_sku',
|
20 |
+
'inventory_add_error'=>'Error in adding magento product inventory, magento_sku',
|
21 |
+
'combination_notexist'=>'Vendor Sku vendor_sku & Supplier code vendor_code combination does not exist',
|
22 |
+
'already_assigned'=>'Vendor sku vendor_sku is already been assigned for this vendor',
|
23 |
+
'duplicate_vendor_sku'=>'Vendor sku vendor_sku is duplicate in Magento Sku magento_sku for this supplier',
|
24 |
+
'combination_exist'=> 'Vendor sku vendor_sku or Supplier code vendor_code combination already present for Magento Sku magento_sku',
|
25 |
+
'data_notchnage'=> 'Cost & Qty for Vendor Sku vendor_sku & Supplier code vendor_code not changed',
|
26 |
+
'upc_notexist'=> 'UPC attribute missing vendor_sku',
|
27 |
+
'upc_multiple'=> 'Multiple Match found for UPC vendor_sku',
|
28 |
+
'manufacturer_part_number_notexist'=> 'MNP attribute missing vendor_sku',
|
29 |
+
'manufacturer_part_number_multiple'=> 'Multiple Match found for MNP vendor_sku',
|
30 |
+
'sku_multiple'=> 'Multiple Match found for SKU vendor_sku',
|
31 |
+
'attribute_notexist'=> 'Attribute assigned for Supplier does not exist for Row(s) row_num',
|
32 |
+
'ftp_bad_header'=>'Bad csv header for file file_name',
|
33 |
+
'connection_error'=>'con_error'
|
34 |
+
);
|
35 |
+
protected $_replace = array('magento_sku','vendor_sku','vendor_code','file_name','con_error');
|
36 |
+
|
37 |
protected function _construct(){
|
38 |
|
39 |
$this->_init("dropship360/inventorylog");
|
40 |
}
|
41 |
+
|
42 |
+
public function getMessageArray(){
|
43 |
+
return $this->_message;
|
44 |
+
}
|
45 |
+
public function getReplaceValue(){
|
46 |
+
return $this->_replace;
|
47 |
+
}
|
48 |
+
public function getLogDescriptionCollection($error_id){
|
49 |
+
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
50 |
+
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log_desc' );
|
51 |
+
$select = $conn->select()->from($tableVendorImportLog)->where('error_id ='.$error_id);
|
52 |
+
$rows = $conn->fetchAll($select);
|
53 |
+
return $rows;
|
54 |
+
}
|
55 |
+
public function prepareRowData($data)
|
56 |
+
{
|
57 |
+
$decodedata = array();
|
58 |
+
$dataTemp = array();
|
59 |
+
if(is_numeric($data))
|
60 |
+
{
|
61 |
+
$rowData = $this->getLogDescriptionCollection($data);
|
62 |
+
if(count($rowData) > 0)
|
63 |
+
{
|
64 |
+
foreach($rowData as $eachRow)
|
65 |
+
{
|
66 |
+
$decodedata[] = array_merge($dataTemp, $this->getDecodedJson($eachRow['description']));
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}else
|
70 |
+
{
|
71 |
+
$decodedata = $this->getDecodedJson($data);
|
72 |
+
}
|
73 |
+
return $decodedata;
|
74 |
+
}
|
75 |
+
|
76 |
+
protected function getDecodedJson($data)
|
77 |
+
{
|
78 |
+
if(empty($data) || !Mage::helper('dropship360')->isJson($data)){
|
79 |
+
return $data;
|
80 |
+
}
|
81 |
+
$data = trim($data,'"');
|
82 |
+
$data = trim($data,'\'');
|
83 |
+
$decodedata = Mage::helper('core')->jsonDecode($data);
|
84 |
+
return $decodedata;
|
85 |
+
}
|
86 |
}
|
87 |
|
app/code/community/Logicbroker/Dropship360/Model/Observer.php
CHANGED
@@ -13,22 +13,27 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
13 |
const XML_PATH_LOGICBROKER_ORDER_BEGIN_SOURCING_STATUS = 'Reprocess';
|
14 |
const XML_PATH_LOGICBROKER_ORDER_BACKORDERED = 'Backorder';
|
15 |
const XML_PATH_LOGICBROKER_EMAIL_SHIPMENT = 'logicbroker_sourcing/rank/email_shipment';
|
16 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
17 |
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
18 |
-
|
19 |
-
|
20 |
-
protected $_orderStatus;
|
21 |
-
protected $_itemData = array();
|
22 |
|
23 |
public static function getWorkingDir()
|
24 |
{
|
25 |
return Mage::getBaseDir();
|
26 |
}
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
public function insertProcessOrder($object)
|
30 |
{
|
31 |
|
|
|
|
|
|
|
|
|
32 |
$this->_orderStatus = $object->getOrder()->getStatus();
|
33 |
foreach ($object->getOrder ()->getAllItems() as $item){
|
34 |
if(in_array($item->getProductType(),array('simple','grouped')) ){
|
@@ -36,39 +41,17 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
36 |
$ended = 1;
|
37 |
$logMsg = 'Item inserted @'.Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/orderitems' ). ' sku : '.$item->getSku().','.$object->getOrder()->getIncrementId();
|
38 |
Mage::helper('dropship360')->genrateLog(++$started,'Order Item Inserted Started',null,$logMsg);
|
39 |
-
|
40 |
Mage::helper('dropship360')->genrateLog(++$ended,null,'Order Item Inserted Ended',null);
|
41 |
}
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
protected function getOrderSourcing($item, $object){
|
46 |
-
$orderSourcingInstance = Mage::getModel ( 'dropship360/orderitems' );
|
47 |
-
Mage::getModel('dropship360/logicbroker')->prepareNotification($orderSourcingInstance,$object->getOrder()->getEntityId());
|
48 |
-
$orderStatus = $object->getOrder()->getStatus();
|
49 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderSourcingInstance, 'Sourcing', $orderStatus);
|
50 |
-
$orderSourcingInstance->setSku ( $item->getSku() );
|
51 |
-
$orderSourcingInstance->setItemId ( $item->getItemId() );
|
52 |
-
$orderSourcingInstance->setItemOrderId ( $object->getOrder()->getEntityId() );
|
53 |
-
$orderSourcingInstance->setLbItemStatus ('Sourcing');
|
54 |
-
$orderSourcingInstance->setUpdatedBy ('Cron');
|
55 |
-
$orderSourcingInstance->setUpdatedAt(now());
|
56 |
-
$orderSourcingInstance->setItemStatusHistory($itemStatusHistory);
|
57 |
-
try {
|
58 |
-
$orderSourcingInstance->save ();
|
59 |
-
} catch ( Execption $e ) {
|
60 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'Section : order item inserted Error: '.$e->getMessage().' sku : '.$item->getSku());
|
61 |
-
echo $e->getMessage();
|
62 |
}
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$this->_itemData = array();
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
public function logicbrokerSourcing() {
|
73 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
74 |
if(!Mage::getStoreConfig(self::CRON_STRING_PATH_SOURCING)) {
|
@@ -82,13 +65,17 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
82 |
}
|
83 |
Mage::helper('dropship360')->genrateLog(1,'Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null,null);
|
84 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
85 |
-
$
|
86 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/dispaly_sourcing_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
87 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
88 |
Mage::helper('dropship360')->genrateLog(2,null,'Sourcing Ended for ' .Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null);
|
89 |
return;
|
90 |
}
|
91 |
|
|
|
|
|
|
|
|
|
92 |
public function logicbrokerBackorder()
|
93 |
{
|
94 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
@@ -102,7 +89,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
102 |
}
|
103 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER . ' item status',null,null);
|
104 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
105 |
-
$
|
106 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/display_backorder_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
107 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
108 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Ended for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER .' item status',null,null);
|
@@ -110,7 +97,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
110 |
}
|
111 |
|
112 |
|
113 |
-
|
114 |
* Save last cron status
|
115 |
* @param string $statusPath
|
116 |
* @param string $status
|
@@ -121,173 +108,6 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
121 |
return;
|
122 |
}
|
123 |
|
124 |
-
protected function setLbVendorRanking($crontype,$isCronSourcing = false)
|
125 |
-
{
|
126 |
-
$reprocess = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS;
|
127 |
-
$lbOrderInstances = Mage::getModel('dropship360/ordersourcing');
|
128 |
-
$collection = $lbOrderInstances->prepareItemCollection($crontype,$isCronSourcing);
|
129 |
-
if(count($collection) > 0 ){
|
130 |
-
foreach ( $collection as $orderID => $orderCollectionData ) {
|
131 |
-
$orderCollection = Mage::getModel('sales/order')->Load($orderID);
|
132 |
-
//Patch : skip sourcing process if order is deleted
|
133 |
-
if (! $orderCollection->getEntityId ()) {
|
134 |
-
Mage::helper ( 'dropship360' )->genrateLog ( 0, null, null, 'Order not exists for => order_id: ' . $orderID . ' hence cannot continue' );
|
135 |
-
continue;
|
136 |
-
}
|
137 |
-
$this->_orderStatus = $orderCollection->getStatus();
|
138 |
-
foreach ($orderCollectionData as $orderData ){
|
139 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'<---->Item Processing Started : '.$orderData->getSku());
|
140 |
-
if ($crontype == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS) {
|
141 |
-
$assigned = $this->assignToVendor(Mage::getModel('sales/order_item')->Load($orderData->getItemId()));
|
142 |
-
}else
|
143 |
-
{
|
144 |
-
$orderItems = Mage::getModel( 'dropship360/orderitems' )->load($orderData->getItemId(), 'item_id');
|
145 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItems, $reprocess, $this->_orderStatus);
|
146 |
-
$this->_itemData[$orderData->getItemId()] = array('lb_item_status'=>$reprocess,'item_status_history'=>$itemStatusHistory);
|
147 |
-
}
|
148 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'####### Item Processing ended : '.$orderData->getSku());
|
149 |
-
|
150 |
-
}
|
151 |
-
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$orderCollection,$crontype);
|
152 |
-
$this->_itemData = array();
|
153 |
-
}
|
154 |
-
}else {
|
155 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'Order collection is empty for => Cron_type: '.$crontype.' hence cannot continue');
|
156 |
-
return;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
protected function assignToVendor($item) {
|
160 |
-
$productSku = $item->getSku ();
|
161 |
-
$itemStatusComplete = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
162 |
-
$itemStatusBackorder = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER;
|
163 |
-
$itemStatusNoDropShip = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP;
|
164 |
-
$qtyInvoiced = $item->getQtyOrdered ();
|
165 |
-
$itemId = $item->getItemId ();
|
166 |
-
$isDefaultVendor = false;
|
167 |
-
$vendorCode = '';
|
168 |
-
$inventoryStock = '';
|
169 |
-
$defaultVendor = (Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder') == 'none') ? '' : Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder');
|
170 |
-
$orderItemInstance = Mage::getModel ( 'dropship360/orderitems' );
|
171 |
-
$orderItemInstance->load ( $itemId, 'item_id' );
|
172 |
-
$collectionVendor = $orderItemInstance->prepareOrderItemData($item);
|
173 |
-
$arrDefaultVendorDetails = array();
|
174 |
-
$vendorCost = 0;
|
175 |
-
|
176 |
-
if ($collectionVendor->count () > 0) {
|
177 |
-
if($collectionVendor->count () >= 1){
|
178 |
-
foreach ($collectionVendor as $vendorData) {
|
179 |
-
//assign default vendor details
|
180 |
-
if(!empty($defaultVendor) && $vendorData->getLbVendorCode() == $defaultVendor )
|
181 |
-
{
|
182 |
-
$arrDefaultVendorDetails = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
183 |
-
}
|
184 |
-
//if item is in backordered
|
185 |
-
if($vendorData->getStock() < $qtyInvoiced ){
|
186 |
-
$arrVendorDetail[] = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
187 |
-
$vendorCode = $arrVendorDetail[0]['lb_vendor_code'];
|
188 |
-
$inventoryStock = $arrVendorDetail[0]['stock'];
|
189 |
-
$vendorCost = $arrVendorDetail[0]['cost'];
|
190 |
-
$vendorSku = $arrVendorDetail[0]['lb_vendor_sku'];
|
191 |
-
$productSku = $arrVendorDetail[0]['product_sku'];
|
192 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
193 |
-
$isDefaultVendor = true;
|
194 |
-
}else{
|
195 |
-
$vendorCode = $vendorData->getLbVendorCode();
|
196 |
-
$inventoryStock = $vendorData->getStock();
|
197 |
-
$vendorCost = $vendorData->getCost();
|
198 |
-
$vendorSku = $vendorData->getLbVendorSku();
|
199 |
-
$productSku = $vendorData->getProductSku();
|
200 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
201 |
-
$isDefaultVendor = false;
|
202 |
-
break;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
206 |
-
}else {
|
207 |
-
$arrFirstVendor = $collectionVendor->getFirstItem ()->getData ();
|
208 |
-
$vendorCode = $arrFirstVendor ['lb_vendor_code'];
|
209 |
-
$inventoryStock = $arrFirstVendor ['stock'];
|
210 |
-
$vendorCost = $arrFirstVendor ['cost'];
|
211 |
-
$vendorSku = $arrFirstVendor ['lb_vendor_sku'];
|
212 |
-
$productSku = $arrFirstVendor ['product_sku'];
|
213 |
-
if($inventoryStock < $qtyInvoiced)
|
214 |
-
$isDefaultVendor = true;
|
215 |
-
else
|
216 |
-
$isDefaultVendor = false;
|
217 |
-
|
218 |
-
$arrVendorAvailable[] = $arrFirstVendor ['lb_vendor_code'];
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
if(!empty($vendorCode)){
|
223 |
-
if ($vendorCode && $inventoryStock >= $qtyInvoiced) {
|
224 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
225 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusComplete);
|
226 |
-
Mage::getModel('dropship360/logicbroker')->setupNotification();
|
227 |
-
$this->_itemData [$item->getItemId ()] = array (
|
228 |
-
'updateInventory' => true,
|
229 |
-
'qtyInvoiced' =>$qtyInvoiced,
|
230 |
-
'updated_at' => now (),
|
231 |
-
'sku' => $item->getSku (),
|
232 |
-
'updated_by' => 'Cron',
|
233 |
-
'lb_item_status' => $itemStatusComplete,
|
234 |
-
'lb_vendor_code' => $vendorCode,
|
235 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
236 |
-
'lb_vendor_sku' => $vendorSku,
|
237 |
-
'item_status_history' => $itemStatusHistory
|
238 |
-
);
|
239 |
-
return $itemStatusComplete;
|
240 |
-
}
|
241 |
-
if ($isDefaultVendor && $inventoryStock <= $qtyInvoiced && !empty($defaultVendor) && in_array($defaultVendor,$arrVendorAvailable)) {
|
242 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
243 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details Default vendor set ==>stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->Transmitting');
|
244 |
-
$this->_itemData [$item->getItemId ()] = array (
|
245 |
-
'updateInventory' => false,
|
246 |
-
'updated_at' => now (),
|
247 |
-
'sku' => $item->getSku (),
|
248 |
-
'updated_by' => 'Cron',
|
249 |
-
'lb_item_status' => $itemStatusComplete,
|
250 |
-
'lb_vendor_code' => $defaultVendor,
|
251 |
-
'vendor_cost' => $arrDefaultVendorDetails ['cost'] * $qtyInvoiced,
|
252 |
-
'lb_vendor_sku' => $arrDefaultVendorDetails ['lb_vendor_sku'],
|
253 |
-
'item_status_history' => $itemStatusHistory
|
254 |
-
);
|
255 |
-
return $itemStatusComplete;
|
256 |
-
}
|
257 |
-
if ($vendorCode && $inventoryStock <= $qtyInvoiced) {
|
258 |
-
$itemStatusHistory =Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusBackorder, $this->_orderStatus);
|
259 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==>stock('.$inventoryStock.') <= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusBackorder);
|
260 |
-
$this->_itemData [$item->getItemId ()] = array (
|
261 |
-
'updateInventory' => false,
|
262 |
-
'updated_at' => now (),
|
263 |
-
'sku' => $item->getSku (),
|
264 |
-
'updated_by' => 'Cron',
|
265 |
-
'lb_item_status' => $itemStatusBackorder,
|
266 |
-
'lb_vendor_code' => $vendorCode,
|
267 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
268 |
-
'lb_vendor_sku' => $vendorSku,
|
269 |
-
'item_status_history' => $itemStatusHistory
|
270 |
-
);
|
271 |
-
return $itemStatusBackorder;
|
272 |
-
}
|
273 |
-
}else{
|
274 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance,$itemStatusNoDropShip, $this->_orderStatus);
|
275 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> No vendor Set ,vendor_code ->'.$vendorCode.', item-status->No Dropship');
|
276 |
-
$this->_itemData [$item->getItemId ()] = array (
|
277 |
-
'updateInventory' => false,
|
278 |
-
'updated_at' => now (),
|
279 |
-
'sku' => $item->getSku (),
|
280 |
-
'updated_by' => 'Cron',
|
281 |
-
'lb_item_status' => $itemStatusNoDropShip,
|
282 |
-
'lb_vendor_code' => $vendorCode,
|
283 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
284 |
-
'lb_vendor_sku' => '',
|
285 |
-
'item_status_history' => $itemStatusHistory
|
286 |
-
);
|
287 |
-
return $itemStatusNoDropShip;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
/**
|
292 |
* Flag to stop observer executing more than once
|
293 |
*
|
@@ -297,7 +117,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
297 |
|
298 |
/**
|
299 |
* This method will run when the product is saved from the Magento Admin
|
300 |
-
* Use this function to update the
|
301 |
* data or anything you like
|
302 |
*
|
303 |
* @param Varien_Event_Observer $observer
|
@@ -308,111 +128,27 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
308 |
$product = $observer->getEvent()->getProduct();
|
309 |
if(!empty($product['vendor_update']) || !empty($product['vendor_new'])){
|
310 |
try {
|
311 |
-
|
312 |
-
* Perform any actions you want here
|
313 |
-
*
|
314 |
-
*/
|
315 |
-
$customFieldValue = $this->_getRequest()->getPost('product');
|
316 |
$result = Mage::getModel('dropship360/inventory')->saveTabVendorData($customFieldValue);
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Uncomment the line below to save the product
|
320 |
-
*
|
321 |
-
*/
|
322 |
-
//if(!$result)
|
323 |
-
//Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dropship360')->__('Vendor Data Cannot be saved'));
|
324 |
-
|
325 |
-
//$product->save();
|
326 |
-
|
327 |
-
|
328 |
-
$this->_inventoryUpdate($result,$customFieldValue['sku']);
|
329 |
}
|
330 |
catch (Exception $e) {
|
331 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
332 |
}
|
333 |
}
|
334 |
-
return;
|
335 |
}
|
336 |
|
337 |
-
protected function _inventoryUpdate($result,$sku)
|
338 |
-
{
|
339 |
-
if(!$result['result']){
|
340 |
-
return;
|
341 |
-
}
|
342 |
-
|
343 |
-
$finalStock = $result['inventory'];
|
344 |
-
$finalStock = Mage::helper('dropship360')->getIsQtyDecimal($sku, $finalStock);
|
345 |
-
$conn = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
346 |
-
|
347 |
-
$tableNameStatus = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status' );
|
348 |
-
$tableNameItem = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_item' );
|
349 |
-
$tableNameItemIdx = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status_indexer_idx' );
|
350 |
-
|
351 |
-
$stockStatus = $finalStock ? 1 : 0;
|
352 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
353 |
-
if($productId){
|
354 |
-
$updateStatus = 'update '.$tableNameStatus.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
355 |
-
$updateItem = 'update '.$tableNameItem.' SET qty = '.$finalStock.',is_in_stock = '.$stockStatus.' where product_id = '.$productId;
|
356 |
-
$updateItemIdx = 'update '.$tableNameItemIdx.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
357 |
-
$conn->beginTransaction ();
|
358 |
-
$conn->query ($updateStatus);
|
359 |
-
$conn->query ($updateItem);
|
360 |
-
$conn->query ($updateItemIdx);
|
361 |
-
try {
|
362 |
-
$conn->commit ();
|
363 |
-
} catch ( Exception $e ) {
|
364 |
-
$conn->rollBack ();
|
365 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Retrieve the product model
|
372 |
-
*
|
373 |
-
* @return Mage_Catalog_Model_Product $product
|
374 |
-
*/
|
375 |
-
public function getProduct()
|
376 |
-
{
|
377 |
-
return Mage::registry('product');
|
378 |
-
}
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Shortcut to getRequest
|
382 |
-
*
|
383 |
-
*/
|
384 |
-
protected function _getRequest()
|
385 |
-
{
|
386 |
-
return Mage::app()->getRequest();
|
387 |
-
}
|
388 |
|
389 |
public function preDispatch(Varien_Event_Observer $observer)
|
390 |
{
|
391 |
return;
|
392 |
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
$trackingNumbers = array();
|
399 |
-
foreach ($shipment->getAllTracks() as $track) {
|
400 |
-
$trackingNumbers[] = $track->getNumber();
|
401 |
-
};
|
402 |
-
// send shipment email only when carrier tracking info is added
|
403 |
-
if (count($trackingNumbers) > 0) {
|
404 |
-
$lastValueOfArray = end($trackingNumbers);
|
405 |
-
$lastValueOfArray = trim($lastValueOfArray);
|
406 |
-
if(!empty($lastValueOfArray))
|
407 |
-
return true;
|
408 |
-
else
|
409 |
-
return false;
|
410 |
-
} else {
|
411 |
-
return false;
|
412 |
-
}
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
|
417 |
{
|
418 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
@@ -431,7 +167,11 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
431 |
}
|
432 |
return $this;
|
433 |
}
|
434 |
-
|
|
|
|
|
|
|
|
|
435 |
public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
|
436 |
{
|
437 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
@@ -452,7 +192,32 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
452 |
return $this;
|
453 |
}
|
454 |
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
* This function is used to delete the sku from vendor inventory
|
457 |
* when the same sku is deleted from catalog product
|
458 |
*/
|
@@ -471,30 +236,15 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
471 |
}
|
472 |
return $this;
|
473 |
}
|
474 |
-
|
|
|
|
|
|
|
475 |
public function notifyForProductUpdateInventory(){
|
476 |
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_DAYS) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL)) {
|
477 |
return $this;
|
478 |
}
|
479 |
-
|
480 |
-
$fileInfo = array();
|
481 |
-
$ioAdapter = new Varien_Io_File();
|
482 |
-
$open_monitor_from = Date('Y-m-d h:i:s', strtotime('-'.Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS).' day'));
|
483 |
-
$open_monitor_to = Mage::getModel('core/date')->gmtDate();
|
484 |
-
$itemObject = Mage::getModel('dropship360/inventory')->getCollection()->addFieldTofilter('updated_at', array('from' => $open_monitor_from,'to' => $open_monitor_to));
|
485 |
-
if($itemObject->getSize() <= 0){
|
486 |
-
Mage::log('cannot send outdated product inventory email collection is empty for form :'.$open_monitor_from.' to :'.$open_monitor_to, null, 'notification_error.log');
|
487 |
-
return $this;
|
488 |
-
}
|
489 |
-
$fileInfo = Mage::getModel('dropship360/csvparser')->getCsvFile($itemObject);
|
490 |
-
$mailData['days'] = Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS);
|
491 |
-
$mailData['subject'] = 'dropship360 list of outdated product inventory';
|
492 |
-
$postObject = new Varien_Object();
|
493 |
-
$postObject->setData($mailData);
|
494 |
-
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
495 |
-
$templateId = 'logicbroker_outdated_product_inventory';
|
496 |
-
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId,$fileInfo['value']);
|
497 |
-
$ioAdapter->rm($fileInfo['value']);
|
498 |
return $this;
|
499 |
}
|
500 |
}
|
13 |
const XML_PATH_LOGICBROKER_ORDER_BEGIN_SOURCING_STATUS = 'Reprocess';
|
14 |
const XML_PATH_LOGICBROKER_ORDER_BACKORDERED = 'Backorder';
|
15 |
const XML_PATH_LOGICBROKER_EMAIL_SHIPMENT = 'logicbroker_sourcing/rank/email_shipment';
|
|
|
16 |
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
17 |
+
|
18 |
+
|
|
|
|
|
19 |
|
20 |
public static function getWorkingDir()
|
21 |
{
|
22 |
return Mage::getBaseDir();
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @event : sales_order_place_after
|
27 |
+
* insert order items details in logicbroker_sales_orders_items for sourcing
|
28 |
+
* processing is dependent dropship360 extension configuration
|
29 |
+
*/
|
30 |
public function insertProcessOrder($object)
|
31 |
{
|
32 |
|
33 |
+
if($object->getOrder()->getLogicbrokerItemProcessed())
|
34 |
+
{
|
35 |
+
return;
|
36 |
+
}
|
37 |
$this->_orderStatus = $object->getOrder()->getStatus();
|
38 |
foreach ($object->getOrder ()->getAllItems() as $item){
|
39 |
if(in_array($item->getProductType(),array('simple','grouped')) ){
|
41 |
$ended = 1;
|
42 |
$logMsg = 'Item inserted @'.Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/orderitems' ). ' sku : '.$item->getSku().','.$object->getOrder()->getIncrementId();
|
43 |
Mage::helper('dropship360')->genrateLog(++$started,'Order Item Inserted Started',null,$logMsg);
|
44 |
+
Mage::getModel('dropship360/ordersourcing')->getOrderSourcing($item, $object);
|
45 |
Mage::helper('dropship360')->genrateLog(++$ended,null,'Order Item Inserted Ended',null);
|
46 |
}
|
47 |
}
|
48 |
+
$object->getOrder()->setLogicbrokerItemProcessed(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* @cron : logicbroker_dropship360
|
53 |
+
* logicbroker main/reprocess souring logic execution begins
|
54 |
+
*/
|
|
|
|
|
|
|
|
|
55 |
public function logicbrokerSourcing() {
|
56 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
57 |
if(!Mage::getStoreConfig(self::CRON_STRING_PATH_SOURCING)) {
|
65 |
}
|
66 |
Mage::helper('dropship360')->genrateLog(1,'Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null,null);
|
67 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
68 |
+
$sourcingObj->setLbVendorRanking (Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS,true);
|
69 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/dispaly_sourcing_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
70 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
71 |
Mage::helper('dropship360')->genrateLog(2,null,'Sourcing Ended for ' .Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null);
|
72 |
return;
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* @cron : logicbroker_backorder
|
77 |
+
* logicbroker backorder souring logic execution begins
|
78 |
+
*/
|
79 |
public function logicbrokerBackorder()
|
80 |
{
|
81 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
89 |
}
|
90 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER . ' item status',null,null);
|
91 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
92 |
+
$sourcingObj->setLbVendorRanking (Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
93 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/display_backorder_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
94 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
95 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Ended for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER .' item status',null,null);
|
97 |
}
|
98 |
|
99 |
|
100 |
+
/**
|
101 |
* Save last cron status
|
102 |
* @param string $statusPath
|
103 |
* @param string $status
|
108 |
return;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Flag to stop observer executing more than once
|
113 |
*
|
117 |
|
118 |
/**
|
119 |
* This method will run when the product is saved from the Magento Admin
|
120 |
+
* Use this function to update the logicbroker dropship360 model, process the
|
121 |
* data or anything you like
|
122 |
*
|
123 |
* @param Varien_Event_Observer $observer
|
128 |
$product = $observer->getEvent()->getProduct();
|
129 |
if(!empty($product['vendor_update']) || !empty($product['vendor_new'])){
|
130 |
try {
|
131 |
+
$customFieldValue = Mage::app()->getRequest()->getPost('product');
|
|
|
|
|
|
|
|
|
132 |
$result = Mage::getModel('dropship360/inventory')->saveTabVendorData($customFieldValue);
|
133 |
+
Mage::getModel('dropship360/inventory')->productInventoryUpdate($result,$customFieldValue['sku']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
catch (Exception $e) {
|
136 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
137 |
}
|
138 |
}
|
139 |
+
return $this;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
public function preDispatch(Varien_Event_Observer $observer)
|
144 |
{
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* @event : sales_order_shipment_save_before
|
150 |
+
* send email when shipping tracking information is added
|
151 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
|
153 |
{
|
154 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
167 |
}
|
168 |
return $this;
|
169 |
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
*@event : sales_order_shipment_save_after
|
173 |
+
*send email when shipping tracking information is added
|
174 |
+
*/
|
175 |
public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
|
176 |
{
|
177 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
192 |
return $this;
|
193 |
}
|
194 |
|
195 |
+
/**
|
196 |
+
* validate shipping email need to send
|
197 |
+
*/
|
198 |
+
protected function _isValidForShipmentEmail($shipment)
|
199 |
+
{
|
200 |
+
// send shipment email only when email shipment is enabled from module
|
201 |
+
if(Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
202 |
+
$trackingNumbers = array();
|
203 |
+
foreach ($shipment->getAllTracks() as $track) {
|
204 |
+
$trackingNumbers[] = $track->getNumber();
|
205 |
+
};
|
206 |
+
// send shipment email only when carrier tracking info is added
|
207 |
+
if (count($trackingNumbers) > 0) {
|
208 |
+
$lastValueOfArray = end($trackingNumbers);
|
209 |
+
$lastValueOfArray = trim($lastValueOfArray);
|
210 |
+
if(!empty($lastValueOfArray))
|
211 |
+
return true;
|
212 |
+
else
|
213 |
+
return false;
|
214 |
+
} else {
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
* This function is used to delete the sku from vendor inventory
|
222 |
* when the same sku is deleted from catalog product
|
223 |
*/
|
236 |
}
|
237 |
return $this;
|
238 |
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @function : notify customer for outdated product inventory through email,initiated by cron
|
242 |
+
*/
|
243 |
public function notifyForProductUpdateInventory(){
|
244 |
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_DAYS) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL)) {
|
245 |
return $this;
|
246 |
}
|
247 |
+
Mage::getModel('dropship360/inventory')->notificationProductInventoryUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
return $this;
|
249 |
}
|
250 |
}
|
app/code/community/Logicbroker/Dropship360/Model/Order/Api.php
CHANGED
@@ -153,23 +153,25 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
153 |
$productItems = array();
|
154 |
$productItems = $this->_getAttributes($item, 'order_item');
|
155 |
$lbItems = Mage::getModel('dropship360/orderitems')->getCollection()
|
156 |
-
->addFieldToSelect(array('sku', 'lb_vendor_sku', 'lb_item_status', 'lb_vendor_code', 'item_id'))
|
157 |
->addFieldToFilter('item_order_id',array('eq'=>$order->getId()))
|
158 |
->addFieldToFilter('item_id', array('eq'=>$productItems['item_id']))
|
159 |
->addFieldToFilter('lb_item_status', array('eq'=>$this->_itemStatusTansmitting));
|
160 |
$lbItems->getSelect()->join(array('salesOrder'=>Mage::getSingleton('core/resource')->getTableName('sales/order')),
|
161 |
'salesOrder.entity_id = main_table.item_order_id', array('state'))->where('salesOrder.state = ?','processing');
|
|
|
162 |
if($lbItems->getSize() > 0){
|
163 |
$productItems['lb_item_status'] = $lbItems->getFirstItem()->getLbItemStatus();
|
164 |
$productItems['lb_vendor_sku'] = $lbItems->getFirstItem()->getLbVendorSku();
|
165 |
$productItems['lb_vendor_code'] = $lbItems->getFirstItem()->getLbVendorCode();
|
|
|
166 |
}
|
167 |
return $productItems;
|
168 |
}
|
169 |
|
170 |
|
171 |
/**
|
172 |
-
* Change
|
173 |
*
|
174 |
* @param string $orderIncrementId, array $sku, string $status
|
175 |
* @return bool
|
@@ -235,7 +237,9 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
235 |
if (!$store_id) {
|
236 |
$this->_fault('invaild_store');
|
237 |
}
|
238 |
-
|
|
|
|
|
239 |
$orderItemsdDetails = array();
|
240 |
try{
|
241 |
|
@@ -264,7 +268,12 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
264 |
}
|
265 |
|
266 |
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
268 |
public function setLbOrderItemStatus($orderIncrementId,$itemStatus){
|
269 |
|
270 |
$order = $this->_initOrder($orderIncrementId);
|
153 |
$productItems = array();
|
154 |
$productItems = $this->_getAttributes($item, 'order_item');
|
155 |
$lbItems = Mage::getModel('dropship360/orderitems')->getCollection()
|
156 |
+
->addFieldToSelect(array('sku', 'lb_vendor_sku', 'lb_item_status', 'lb_vendor_code', 'item_id','vendor_cost'))
|
157 |
->addFieldToFilter('item_order_id',array('eq'=>$order->getId()))
|
158 |
->addFieldToFilter('item_id', array('eq'=>$productItems['item_id']))
|
159 |
->addFieldToFilter('lb_item_status', array('eq'=>$this->_itemStatusTansmitting));
|
160 |
$lbItems->getSelect()->join(array('salesOrder'=>Mage::getSingleton('core/resource')->getTableName('sales/order')),
|
161 |
'salesOrder.entity_id = main_table.item_order_id', array('state'))->where('salesOrder.state = ?','processing');
|
162 |
+
$lbItems->getSelect()->limit(1);
|
163 |
if($lbItems->getSize() > 0){
|
164 |
$productItems['lb_item_status'] = $lbItems->getFirstItem()->getLbItemStatus();
|
165 |
$productItems['lb_vendor_sku'] = $lbItems->getFirstItem()->getLbVendorSku();
|
166 |
$productItems['lb_vendor_code'] = $lbItems->getFirstItem()->getLbVendorCode();
|
167 |
+
$productItems['lb_vendor_cost'] = $lbItems->getFirstItem()->getVendorCost();
|
168 |
}
|
169 |
return $productItems;
|
170 |
}
|
171 |
|
172 |
|
173 |
/**
|
174 |
+
* Change Dropship360 order item status for given item sku
|
175 |
*
|
176 |
* @param string $orderIncrementId, array $sku, string $status
|
177 |
* @return bool
|
237 |
if (!$store_id) {
|
238 |
$this->_fault('invaild_store');
|
239 |
}
|
240 |
+
//Default DS item status will be TRANSMITTING
|
241 |
+
$orderItemStatus = (!empty($orderItemStatus)) ? $orderItemStatus : Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
242 |
+
|
243 |
$orderItemsdDetails = array();
|
244 |
try{
|
245 |
|
268 |
}
|
269 |
|
270 |
|
271 |
+
/**
|
272 |
+
* set itemStatus to all dropship360 order items irrespective of SKU
|
273 |
+
* @param Mage_sales_order $orderIncrementId
|
274 |
+
* @param Logicbroker_Dropship360_Model_Orderitems $itemStatus
|
275 |
+
* @return multitype:string
|
276 |
+
*/
|
277 |
public function setLbOrderItemStatus($orderIncrementId,$itemStatus){
|
278 |
|
279 |
$order = $this->_initOrder($orderIncrementId);
|
app/code/community/Logicbroker/Dropship360/Model/Orderitems.php
CHANGED
@@ -25,7 +25,9 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
25 |
|
26 |
$collectionVendor = Mage::getModel ( 'dropship360/inventory' )->getCollection ()->addFieldToFilter ( 'product_sku', $productSku );
|
27 |
$collectionVendor->getSelect ()->joinleft ( array ('lbRanking' => Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/ranking' )), 'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array ('*') )->where('lbRanking.is_dropship = "yes" and lbRanking.is_active = "yes"');
|
|
|
28 |
$collectionVendor->getSelect ()->order ( $orderBy );
|
|
|
29 |
return $collectionVendor;
|
30 |
}
|
31 |
|
@@ -64,6 +66,7 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
64 |
{
|
65 |
$inventory = Mage::getModel ( 'dropship360/inventory' )->getCollection()
|
66 |
->addFieldToFilter('lb_vendor_code',$vendorCode)->addFieldToFilter('product_sku',$productSku);
|
|
|
67 |
$filedData = $inventory->getFirstItem()->getData();
|
68 |
$LbInventoryStock = $filedData['stock'];
|
69 |
$finalStock = $LbInventoryStock - $qtyInvoiced;
|
@@ -80,6 +83,7 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
80 |
{
|
81 |
$arrData = array();
|
82 |
$inventoryModel = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('lb_vendor_code',$request['lb_vendor_code'])->addFieldToFilter('product_sku',$request['product_sku']);
|
|
|
83 |
$arrData['lb_vendor_code'] = $request['lb_vendor_code'];
|
84 |
$arrData['lb_item_status'] = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
85 |
$arrData['updated_by'] = 'User';
|
25 |
|
26 |
$collectionVendor = Mage::getModel ( 'dropship360/inventory' )->getCollection ()->addFieldToFilter ( 'product_sku', $productSku );
|
27 |
$collectionVendor->getSelect ()->joinleft ( array ('lbRanking' => Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/ranking' )), 'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array ('*') )->where('lbRanking.is_dropship = "yes" and lbRanking.is_active = "yes"');
|
28 |
+
$collectionVendor->getSelect ()->group ( 'lbRanking.id' );
|
29 |
$collectionVendor->getSelect ()->order ( $orderBy );
|
30 |
+
|
31 |
return $collectionVendor;
|
32 |
}
|
33 |
|
66 |
{
|
67 |
$inventory = Mage::getModel ( 'dropship360/inventory' )->getCollection()
|
68 |
->addFieldToFilter('lb_vendor_code',$vendorCode)->addFieldToFilter('product_sku',$productSku);
|
69 |
+
$inventory->getSelect()->limit(1);
|
70 |
$filedData = $inventory->getFirstItem()->getData();
|
71 |
$LbInventoryStock = $filedData['stock'];
|
72 |
$finalStock = $LbInventoryStock - $qtyInvoiced;
|
83 |
{
|
84 |
$arrData = array();
|
85 |
$inventoryModel = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('lb_vendor_code',$request['lb_vendor_code'])->addFieldToFilter('product_sku',$request['product_sku']);
|
86 |
+
$inventoryModel->getSelect()->limit(1);
|
87 |
$arrData['lb_vendor_code'] = $request['lb_vendor_code'];
|
88 |
$arrData['lb_item_status'] = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
89 |
$arrData['updated_by'] = 'User';
|
app/code/community/Logicbroker/Dropship360/Model/Ordersourcing.php
CHANGED
@@ -14,9 +14,18 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
14 |
protected $_pathBackorderStart = 'logicbroker/backorder_cron/start_time';
|
15 |
protected $_pathBackorderComp = 'logicbroker/backorder_cron/comp_time';
|
16 |
protected $_waitTIme = 30; //min
|
|
|
|
|
|
|
17 |
protected function _construct(){
|
18 |
$this->_init("dropship360/ordersourcing");
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function prepareItemCollection($crontype,$isCronSourcing = false){
|
21 |
$orderItemColletion = array();
|
22 |
$rowObj = new Varien_Object();
|
@@ -47,6 +56,11 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
47 |
}
|
48 |
return $orderItemColletion;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
50 |
protected function getOrderForProcess($condition){
|
51 |
$orderIds = array();
|
52 |
$processingItem = Mage::getModel('dropship360/orderitems')->getCollection();
|
@@ -54,7 +68,6 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
54 |
$processingItem->addFieldToFilter('state','processing');
|
55 |
$processingItem->addFieldToFilter('lb_item_status',array('in'=>$condition));
|
56 |
$processingItem->getSelect()->group('item_order_id');
|
57 |
-
//$processingItem->getSelect()->limit('200');
|
58 |
$processingItem->getSelect()->order('id asc');
|
59 |
if($processingItem->getSize() > 0){
|
60 |
foreach ($processingItem as $item){
|
@@ -63,28 +76,267 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
63 |
}
|
64 |
return $orderIds;
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
public function checkRunningStatus($type)
|
67 |
{
|
68 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
69 |
if(!Mage::getStoreConfigFlag($path)){
|
70 |
return false;//job not running
|
71 |
}
|
72 |
-
|
73 |
$time = strtotime(Mage::getStoreConfig($path));
|
74 |
-
|
75 |
return false;//insert forcefully
|
76 |
}*/
|
77 |
return true;
|
78 |
}
|
|
|
|
|
|
|
|
|
79 |
public function sourcingStarted($type){
|
80 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
81 |
$value = strftime('%Y-%m-%d %H:%M:00', time());
|
82 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
84 |
public function sourcingCompleted($type){
|
85 |
//$path = ($type == 'backorder') ? $this->_pathBackorderComp : $this->_pathSourcingComp;
|
86 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
87 |
$value = '';//strftime('%Y-%m-%d %H:%M:00', time());
|
88 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
14 |
protected $_pathBackorderStart = 'logicbroker/backorder_cron/start_time';
|
15 |
protected $_pathBackorderComp = 'logicbroker/backorder_cron/comp_time';
|
16 |
protected $_waitTIme = 30; //min
|
17 |
+
const XML_PATH_LOGICSOURCING_SOURCING_TYPE = 'logicbroker_sourcing/rank/sourcing_type';
|
18 |
+
protected $_orderStatus;
|
19 |
+
protected $_itemData = array();
|
20 |
protected function _construct(){
|
21 |
$this->_init("dropship360/ordersourcing");
|
22 |
}
|
23 |
+
/**
|
24 |
+
* Prepare order collection from logicbroker_sales_order_items
|
25 |
+
* @param $crontype (Reprocess,sourcing,backorder)
|
26 |
+
* @param string $isCronSourcing
|
27 |
+
* @return collection
|
28 |
+
*/
|
29 |
public function prepareItemCollection($crontype,$isCronSourcing = false){
|
30 |
$orderItemColletion = array();
|
31 |
$rowObj = new Varien_Object();
|
56 |
}
|
57 |
return $orderItemColletion;
|
58 |
}
|
59 |
+
/**
|
60 |
+
* unsed
|
61 |
+
* @param unknown $condition
|
62 |
+
* @return multitype:NULL
|
63 |
+
*/
|
64 |
protected function getOrderForProcess($condition){
|
65 |
$orderIds = array();
|
66 |
$processingItem = Mage::getModel('dropship360/orderitems')->getCollection();
|
68 |
$processingItem->addFieldToFilter('state','processing');
|
69 |
$processingItem->addFieldToFilter('lb_item_status',array('in'=>$condition));
|
70 |
$processingItem->getSelect()->group('item_order_id');
|
|
|
71 |
$processingItem->getSelect()->order('id asc');
|
72 |
if($processingItem->getSize() > 0){
|
73 |
foreach ($processingItem as $item){
|
76 |
}
|
77 |
return $orderIds;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* check souring cron running status
|
82 |
+
* @param cron_type $type
|
83 |
+
* @return boolean
|
84 |
+
*/
|
85 |
public function checkRunningStatus($type)
|
86 |
{
|
87 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
88 |
if(!Mage::getStoreConfigFlag($path)){
|
89 |
return false;//job not running
|
90 |
}
|
91 |
+
/*$now = time() - ($this->_waitTIme * 60);
|
92 |
$time = strtotime(Mage::getStoreConfig($path));
|
93 |
+
if ($time < $now) {
|
94 |
return false;//insert forcefully
|
95 |
}*/
|
96 |
return true;
|
97 |
}
|
98 |
+
/**
|
99 |
+
* set date time value in core_config_data when cron start
|
100 |
+
* @param cron_type $type
|
101 |
+
*/
|
102 |
public function sourcingStarted($type){
|
103 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
104 |
$value = strftime('%Y-%m-%d %H:%M:00', time());
|
105 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
106 |
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* update datetime value in core_config_data when sourcing done
|
110 |
+
* @param unknown $type
|
111 |
+
*/
|
112 |
public function sourcingCompleted($type){
|
113 |
//$path = ($type == 'backorder') ? $this->_pathBackorderComp : $this->_pathSourcingComp;
|
114 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
115 |
$value = '';//strftime('%Y-%m-%d %H:%M:00', time());
|
116 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
117 |
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* save data in logicbroker_sales_order_item when new order placed using event
|
121 |
+
* @param sales_order_item $item
|
122 |
+
* @param event $object
|
123 |
+
*/
|
124 |
+
public function getOrderSourcing($item, $object){
|
125 |
+
return $this->_getOrderSourcing($item, $object);
|
126 |
+
}
|
127 |
+
protected function _getOrderSourcing($item, $object){
|
128 |
+
$orderSourcingInstance = Mage::getModel ( 'dropship360/orderitems' );
|
129 |
+
Mage::getModel('dropship360/logicbroker')->prepareNotification($orderSourcingInstance,$object->getOrder()->getEntityId());
|
130 |
+
$orderStatus = $object->getOrder()->getStatus();
|
131 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderSourcingInstance, 'Sourcing', $orderStatus);
|
132 |
+
$orderSourcingInstance->setSku ( $item->getSku() );
|
133 |
+
$orderSourcingInstance->setItemId ( $item->getItemId() );
|
134 |
+
$orderSourcingInstance->setItemOrderId ( $object->getOrder()->getEntityId() );
|
135 |
+
$orderSourcingInstance->setLbItemStatus ('Sourcing');
|
136 |
+
$orderSourcingInstance->setUpdatedBy ('Cron');
|
137 |
+
$orderSourcingInstance->setUpdatedAt(now());
|
138 |
+
$orderSourcingInstance->setItemStatusHistory($itemStatusHistory);
|
139 |
+
try {
|
140 |
+
$orderSourcingInstance->save ();
|
141 |
+
} catch ( Execption $e ) {
|
142 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'Section : order item inserted Error: '.$e->getMessage().' sku : '.$item->getSku());
|
143 |
+
echo $e->getMessage();
|
144 |
+
}
|
145 |
+
|
146 |
+
//As item get saved in logicbroker_sales_orders_items we run our sourcing logic
|
147 |
+
if(Mage::getStoreConfigFlag(self::XML_PATH_LOGICSOURCING_SOURCING_TYPE)){
|
148 |
+
$this->assignToVendor($item);
|
149 |
+
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$object->getOrder());
|
150 |
+
$this->_itemData = array();
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* process item and save order item ranking in logicbroker_sales_order_items
|
156 |
+
* @param cron_type $crontype
|
157 |
+
* @param string $isCronSourcing
|
158 |
+
*/
|
159 |
+
public function setLbVendorRanking($crontype,$isCronSourcing = false){
|
160 |
+
$this->_setLbVendorRanking($crontype,$isCronSourcing);
|
161 |
+
}
|
162 |
+
|
163 |
+
protected function _setLbVendorRanking($crontype,$isCronSourcing)
|
164 |
+
{
|
165 |
+
$reprocess = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS;
|
166 |
+
$lbOrderInstances = Mage::getModel('dropship360/ordersourcing');
|
167 |
+
$collection = $lbOrderInstances->prepareItemCollection($crontype,$isCronSourcing);
|
168 |
+
try{
|
169 |
+
if(count($collection) > 0 ){
|
170 |
+
foreach ( $collection as $orderID => $orderCollectionData ) {
|
171 |
+
$orderCollection = Mage::getModel('sales/order')->Load($orderID);
|
172 |
+
//Patch : skip sourcing process if order is deleted
|
173 |
+
if (! $orderCollection->getEntityId ()) {
|
174 |
+
Mage::helper ( 'dropship360' )->genrateLog ( 0, null, null, 'Order not exists for => order_id: ' . $orderID . ' hence cannot continue' );
|
175 |
+
continue;
|
176 |
+
}
|
177 |
+
$this->_orderStatus = $orderCollection->getStatus();
|
178 |
+
foreach ($orderCollectionData as $orderData ){
|
179 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'<---->Item Processing Started : Order id '.$orderID.'##'.$orderData->getSku());
|
180 |
+
if ($crontype == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS) {
|
181 |
+
$assigned = $this->assignToVendor(Mage::getModel('sales/order_item')->Load($orderData->getItemId()));
|
182 |
+
}else
|
183 |
+
{
|
184 |
+
$orderItems = Mage::getModel( 'dropship360/orderitems' )->load($orderData->getItemId(), 'item_id');
|
185 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItems, $reprocess, $this->_orderStatus);
|
186 |
+
$this->_itemData[$orderData->getItemId()] = array('lb_item_status'=>$reprocess,'item_status_history'=>$itemStatusHistory);
|
187 |
+
}
|
188 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'####### Item Processing ended : Order id '.$orderID.'##'.$orderData->getSku());
|
189 |
+
|
190 |
+
}
|
191 |
+
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$orderCollection,$crontype);
|
192 |
+
$this->_itemData = array();
|
193 |
+
}
|
194 |
+
}else {
|
195 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'Order collection is empty for => Cron_type: '.$crontype.' hence cannot continue');
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
}catch (Exception $e){
|
199 |
+
Mage::helper('dropship360')->genrateLog(null,null,null,$e->getMessage());
|
200 |
+
Mage::helper('dropship360')->genrateLog(null,null,null,$e->getTraceAsString());
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* assign vendor for item on the basis of ranking and configuration
|
207 |
+
* @param sa;es_order_item $item
|
208 |
+
* @return string
|
209 |
+
*/
|
210 |
+
protected function assignToVendor($item) {
|
211 |
+
$productSku = $item->getSku ();
|
212 |
+
$itemStatusComplete = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
213 |
+
$itemStatusBackorder = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER;
|
214 |
+
$itemStatusNoDropShip = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP;
|
215 |
+
$qtyInvoiced = $item->getQtyOrdered ();
|
216 |
+
$itemId = $item->getItemId ();
|
217 |
+
$isDefaultVendor = false;
|
218 |
+
$vendorCode = '';
|
219 |
+
$inventoryStock = '';
|
220 |
+
$defaultVendor = (Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder') == 'none') ? '' : Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder');
|
221 |
+
$orderItemInstance = Mage::getModel ( 'dropship360/orderitems' );
|
222 |
+
$orderItemInstance->load ( $itemId, 'item_id' );
|
223 |
+
$collectionVendor = $orderItemInstance->prepareOrderItemData($item);
|
224 |
+
$arrDefaultVendorDetails = array();
|
225 |
+
$vendorCost = 0;
|
226 |
+
|
227 |
+
if ($collectionVendor->count () > 0) {
|
228 |
+
if($collectionVendor->count () >= 1){
|
229 |
+
foreach ($collectionVendor as $vendorData) {
|
230 |
+
//assign default vendor details
|
231 |
+
if(!empty($defaultVendor) && $vendorData->getLbVendorCode() == $defaultVendor )
|
232 |
+
{
|
233 |
+
$arrDefaultVendorDetails = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
234 |
+
}
|
235 |
+
//if item is in backordered
|
236 |
+
if($vendorData->getStock() < $qtyInvoiced ){
|
237 |
+
$arrVendorDetail[] = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
238 |
+
$vendorCode = $arrVendorDetail[0]['lb_vendor_code'];
|
239 |
+
$inventoryStock = $arrVendorDetail[0]['stock'];
|
240 |
+
$vendorCost = $arrVendorDetail[0]['cost'];
|
241 |
+
$vendorSku = $arrVendorDetail[0]['lb_vendor_sku'];
|
242 |
+
$productSku = $arrVendorDetail[0]['product_sku'];
|
243 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
244 |
+
$isDefaultVendor = true;
|
245 |
+
}else{
|
246 |
+
$vendorCode = $vendorData->getLbVendorCode();
|
247 |
+
$inventoryStock = $vendorData->getStock();
|
248 |
+
$vendorCost = $vendorData->getCost();
|
249 |
+
$vendorSku = $vendorData->getLbVendorSku();
|
250 |
+
$productSku = $vendorData->getProductSku();
|
251 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
252 |
+
$isDefaultVendor = false;
|
253 |
+
break;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
257 |
+
}else {
|
258 |
+
$arrFirstVendor = $collectionVendor->getFirstItem ()->getData ();
|
259 |
+
$vendorCode = $arrFirstVendor ['lb_vendor_code'];
|
260 |
+
$inventoryStock = $arrFirstVendor ['stock'];
|
261 |
+
$vendorCost = $arrFirstVendor ['cost'];
|
262 |
+
$vendorSku = $arrFirstVendor ['lb_vendor_sku'];
|
263 |
+
$productSku = $arrFirstVendor ['product_sku'];
|
264 |
+
if($inventoryStock < $qtyInvoiced)
|
265 |
+
$isDefaultVendor = true;
|
266 |
+
else
|
267 |
+
$isDefaultVendor = false;
|
268 |
+
|
269 |
+
$arrVendorAvailable[] = $arrFirstVendor ['lb_vendor_code'];
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
if(!empty($vendorCode)){
|
274 |
+
if ($vendorCode && $inventoryStock >= $qtyInvoiced) {
|
275 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
276 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusComplete);
|
277 |
+
Mage::getModel('dropship360/logicbroker')->setupNotification();
|
278 |
+
$this->_itemData [$item->getItemId ()] = array (
|
279 |
+
'updateInventory' => true,
|
280 |
+
'qtyInvoiced' =>$qtyInvoiced,
|
281 |
+
'updated_at' => now (),
|
282 |
+
'sku' => $item->getSku (),
|
283 |
+
'updated_by' => 'Cron',
|
284 |
+
'lb_item_status' => $itemStatusComplete,
|
285 |
+
'lb_vendor_code' => $vendorCode,
|
286 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
287 |
+
'lb_vendor_sku' => $vendorSku,
|
288 |
+
'item_status_history' => $itemStatusHistory
|
289 |
+
);
|
290 |
+
return $itemStatusComplete;
|
291 |
+
}
|
292 |
+
if ($isDefaultVendor && $inventoryStock <= $qtyInvoiced && !empty($defaultVendor) && in_array($defaultVendor,$arrVendorAvailable)) {
|
293 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
294 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details Default vendor set ==>stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->Transmitting');
|
295 |
+
$this->_itemData [$item->getItemId ()] = array (
|
296 |
+
'updateInventory' => false,
|
297 |
+
'updated_at' => now (),
|
298 |
+
'sku' => $item->getSku (),
|
299 |
+
'updated_by' => 'Cron',
|
300 |
+
'lb_item_status' => $itemStatusComplete,
|
301 |
+
'lb_vendor_code' => $defaultVendor,
|
302 |
+
'vendor_cost' => $arrDefaultVendorDetails ['cost'] * $qtyInvoiced,
|
303 |
+
'lb_vendor_sku' => $arrDefaultVendorDetails ['lb_vendor_sku'],
|
304 |
+
'item_status_history' => $itemStatusHistory
|
305 |
+
);
|
306 |
+
return $itemStatusComplete;
|
307 |
+
}
|
308 |
+
if ($vendorCode && $inventoryStock <= $qtyInvoiced) {
|
309 |
+
$itemStatusHistory =Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusBackorder, $this->_orderStatus);
|
310 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==>stock('.$inventoryStock.') <= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusBackorder);
|
311 |
+
$this->_itemData [$item->getItemId ()] = array (
|
312 |
+
'updateInventory' => false,
|
313 |
+
'updated_at' => now (),
|
314 |
+
'sku' => $item->getSku (),
|
315 |
+
'updated_by' => 'Cron',
|
316 |
+
'lb_item_status' => $itemStatusBackorder,
|
317 |
+
'lb_vendor_code' => $vendorCode,
|
318 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
319 |
+
'lb_vendor_sku' => $vendorSku,
|
320 |
+
'item_status_history' => $itemStatusHistory
|
321 |
+
);
|
322 |
+
return $itemStatusBackorder;
|
323 |
+
}
|
324 |
+
}else{
|
325 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance,$itemStatusNoDropShip, $this->_orderStatus);
|
326 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> No vendor Set ,vendor_code ->'.$vendorCode.', item-status->No Dropship');
|
327 |
+
$this->_itemData [$item->getItemId ()] = array (
|
328 |
+
'updateInventory' => false,
|
329 |
+
'updated_at' => now (),
|
330 |
+
'sku' => $item->getSku (),
|
331 |
+
'updated_by' => 'Cron',
|
332 |
+
'lb_item_status' => $itemStatusNoDropShip,
|
333 |
+
'lb_vendor_code' => $vendorCode,
|
334 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
335 |
+
'lb_vendor_sku' => '',
|
336 |
+
'item_status_history' => $itemStatusHistory
|
337 |
+
);
|
338 |
+
return $itemStatusNoDropShip;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
}
|
app/code/community/Logicbroker/Dropship360/Model/Productimport.php
CHANGED
@@ -10,7 +10,7 @@ class Logicbroker_Dropship360_Model_Productimport {
|
|
10 |
protected $prePopulatedAttribute = array ();
|
11 |
protected $catalogTable;
|
12 |
protected $productCategory;
|
13 |
-
protected $allowedAttribute = array('name','short_description','description','weight','price','msrp','manufacturer','action','
|
14 |
protected $preDefineAttribute = array (
|
15 |
'status' => 2,
|
16 |
'visibility' => 1,
|
10 |
protected $prePopulatedAttribute = array ();
|
11 |
protected $catalogTable;
|
12 |
protected $productCategory;
|
13 |
+
protected $allowedAttribute = array('name','short_description','description','weight','price','msrp','manufacturer','action','upc','manufacturer_part_number');
|
14 |
protected $preDefineAttribute = array (
|
15 |
'status' => 2,
|
16 |
'visibility' => 1,
|
app/code/community/Logicbroker/Dropship360/Model/Ranking.php
CHANGED
@@ -49,12 +49,13 @@ class Logicbroker_Dropship360_Model_Ranking extends Mage_Core_Model_Abstract
|
|
49 |
}
|
50 |
|
51 |
protected function saveVendorDetails($value){
|
|
|
52 |
$vendorDetail = Mage::getModel('dropship360/ranking')->load($value['lb_vendor_code'],'lb_vendor_code');
|
53 |
if(!$vendorDetail->getId()){
|
54 |
$vendorDetail->setLbVendorCode($value['lb_vendor_code']);
|
55 |
-
$vendorDetail->setLbVendorName($value['lb_vendor_name']);
|
56 |
$vendorDetail->setRanking($value['ranking']);
|
57 |
-
|
58 |
$vendorDetail->setUpdatedAt(now());
|
59 |
$vendorDetail->setCreatedAt(now());
|
60 |
$vendorDetail->save();
|
49 |
}
|
50 |
|
51 |
protected function saveVendorDetails($value){
|
52 |
+
$helper = Mage::helper('dropship360');
|
53 |
$vendorDetail = Mage::getModel('dropship360/ranking')->load($value['lb_vendor_code'],'lb_vendor_code');
|
54 |
if(!$vendorDetail->getId()){
|
55 |
$vendorDetail->setLbVendorCode($value['lb_vendor_code']);
|
56 |
+
$vendorDetail->setLbVendorName($helper->convertToHtmlcode($value['lb_vendor_name']));
|
57 |
$vendorDetail->setRanking($value['ranking']);
|
58 |
+
$vendorDetail->setIsDropship('no');
|
59 |
$vendorDetail->setUpdatedAt(now());
|
60 |
$vendorDetail->setCreatedAt(now());
|
61 |
$vendorDetail->save();
|
app/code/community/Logicbroker/Dropship360/Model/Resource/Orderitems.php
CHANGED
@@ -13,6 +13,7 @@ class Logicbroker_Dropship360_Model_Resource_Orderitems extends Mage_Core_Model_
|
|
13 |
{
|
14 |
$this->_init("dropship360/orderitems", "id");
|
15 |
}
|
|
|
16 |
public function saveOrderItems($itemData,$orderObj,$crontype)
|
17 |
{
|
18 |
try {
|
13 |
{
|
14 |
$this->_init("dropship360/orderitems", "id");
|
15 |
}
|
16 |
+
|
17 |
public function saveOrderItems($itemData,$orderObj,$crontype)
|
18 |
{
|
19 |
try {
|
app/code/community/Logicbroker/Dropship360/Model/System/Config/Source/Vendorlist.php
CHANGED
@@ -83,7 +83,7 @@ class Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist
|
|
83 |
if($collectionVendor->count() > 0){
|
84 |
foreach ($collectionVendor as $vendor) {
|
85 |
$options[] = array(
|
86 |
-
'label' => $vendor->getLbVendorCode().'--'
|
87 |
'value' => $vendor->getLbVendorCode()
|
88 |
);
|
89 |
}
|
83 |
if($collectionVendor->count() > 0){
|
84 |
foreach ($collectionVendor as $vendor) {
|
85 |
$options[] = array(
|
86 |
+
'label' => $vendor->getLbVendorCode().'--'.html_entity_decode($vendor->getLbVendorName(),ENT_QUOTES,"ISO-8859-1"),
|
87 |
'value' => $vendor->getLbVendorCode()
|
88 |
);
|
89 |
}
|
app/code/community/Logicbroker/Dropship360/Model/Uploadvendor.php
CHANGED
@@ -10,42 +10,9 @@
|
|
10 |
class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
|
13 |
-
const FIELD_NAME_SOURCE_FILE = 'import_file';
|
14 |
-
protected $_isProductSetupMode = false;
|
15 |
-
protected $sendBadFileAlert = false;
|
16 |
-
protected $_haderError = array();
|
17 |
-
protected $_FtpErrors = array();
|
18 |
-
protected $_UploadCsvErrors = array();
|
19 |
-
protected $_inventoryModel;
|
20 |
-
protected $_vendorSkuFlag = array();
|
21 |
-
protected $conn;
|
22 |
-
protected $ftpRequestPram = array();
|
23 |
-
protected $_errors = array();
|
24 |
-
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
25 |
-
const XML_PATH_UPLOAD_FTP_SITE = 'logicbroker_sourcing/cron_settings_upload/ftp_site';
|
26 |
-
const XML_PATH_UPLOAD_FTP_USERNAME = 'logicbroker_sourcing/cron_settings_upload/ftp_username';
|
27 |
-
const XML_PATH_UPLOAD_FTP_PASSWORD = 'logicbroker_sourcing/cron_settings_upload/ftp_password';
|
28 |
-
const XML_PATH_UPLOAD_FTP_TYPE = 'logicbroker_sourcing/cron_settings_upload/ftp_type';
|
29 |
-
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
30 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
31 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
32 |
-
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
33 |
-
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
34 |
-
protected $productSetupCSVFormat = array('magento_sku','vendor_sku','','');
|
35 |
-
protected $_csvDataCache;
|
36 |
-
protected $_vendorCode;
|
37 |
-
protected $_csvParserObj;
|
38 |
-
protected $emptyRecords = array(); //checkDataIntigrity fnction store empty records from CSV
|
39 |
-
protected $result = array(); //checkDataIntigrity fnction store final result for error
|
40 |
-
protected $supplierName = '';
|
41 |
-
|
42 |
protected function _construct()
|
43 |
{
|
44 |
-
$this->_inventoryModel = Mage::getModel('dropship360/inventory');
|
45 |
-
$this->conn = $this->getDatabaseConnection ();
|
46 |
$this->_init("dropship360/uploadvendor");
|
47 |
-
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
48 |
-
|
49 |
}
|
50 |
|
51 |
public function getDatabaseConnection()
|
@@ -53,1233 +20,6 @@ class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstrac
|
|
53 |
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
54 |
}
|
55 |
|
56 |
-
protected function _getSession()
|
57 |
-
{
|
58 |
-
return Mage::getSingleton('adminhtml/session');
|
59 |
-
}
|
60 |
-
|
61 |
-
protected function _getCsvData($fileName,$header = false)
|
62 |
-
{
|
63 |
-
$csvObject = new Varien_File_Csv();
|
64 |
-
|
65 |
-
if(!$this->_csvDataCache){
|
66 |
-
$this->_csvDataCache = $this->_csvParserObj->getChangedValue($csvObject->getData($fileName),$this->_vendorCode);
|
67 |
-
}else
|
68 |
-
{
|
69 |
-
if($header){
|
70 |
-
return array($this->_csvDataCache[0]);
|
71 |
-
}else
|
72 |
-
{
|
73 |
-
$this->_csvDataCache;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
return $this->_csvDataCache;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Import working directory
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
|
87 |
-
public static function getWorkingDir()
|
88 |
-
{
|
89 |
-
return Mage::getBaseDir('var') . DS . 'logicbrokervendorproduct' . DS;
|
90 |
-
}
|
91 |
-
|
92 |
-
public function insertCronEntry($filename,$data = null){
|
93 |
-
|
94 |
-
$this->setFileName($filename);
|
95 |
-
$this->setUpdatedBy('manually');
|
96 |
-
$this->setUpdatedAt(now());
|
97 |
-
$this->setLbVendorCode(Mage::app()->getRequest()->getPost('vendor'));
|
98 |
-
try{
|
99 |
-
$this->save();
|
100 |
-
}catch(Exception $e){
|
101 |
-
$this->_getSession()->addError(Mage::helper('dropship360')->__($e->getMessage()));
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
public function uploadSource()
|
106 |
-
{
|
107 |
-
$error = false;
|
108 |
-
$this->_vendorCode = $this->getVendor();
|
109 |
-
$this->_isProductSetupMode = $this->getProductsetupmode();
|
110 |
-
$entity = 'vendor_product_'.date('ymdHis');
|
111 |
-
$uploader = Mage::getModel('core/file_uploader', self::FIELD_NAME_SOURCE_FILE);
|
112 |
-
$uploader->skipDbProcessing(true);
|
113 |
-
$result = $uploader->save(self::getWorkingDir());
|
114 |
-
$extension = pathinfo($result['file'], PATHINFO_EXTENSION);
|
115 |
-
$uploadedFile = $result['path'] . $result['file'];
|
116 |
-
$error = $this->validateCsv($uploadedFile);
|
117 |
-
if($error){
|
118 |
-
$this->fileObj()->rm($uploadedFile);
|
119 |
-
$this->_getSession()->addNotice(Mage::helper('dropship360')->__('Please fix errors and re-upload file'));
|
120 |
-
return $error;
|
121 |
-
}
|
122 |
-
|
123 |
-
$sourceFile = self::getWorkingDir() . $entity;
|
124 |
-
|
125 |
-
$sourceFile .= '.' . strtolower($extension);
|
126 |
-
$fileName = $entity.'.'.strtolower($extension);
|
127 |
-
|
128 |
-
if(strtolower($uploadedFile) != strtolower($sourceFile)) {
|
129 |
-
if (file_exists($sourceFile)) {
|
130 |
-
$this->fileObj()->rm($sourceFile);
|
131 |
-
}
|
132 |
-
|
133 |
-
if (!@rename($uploadedFile, $sourceFile)) {
|
134 |
-
Mage::throwException(Mage::helper('importexport')->__('Source file moving failed'));
|
135 |
-
}
|
136 |
-
}
|
137 |
-
Mage::register('file_name',$fileName);
|
138 |
-
if(!$error)
|
139 |
-
$this->insertCronEntry($fileName);
|
140 |
-
|
141 |
-
return $error;
|
142 |
-
}
|
143 |
-
|
144 |
-
|
145 |
-
public function validateCsv($fileName)
|
146 |
-
{
|
147 |
-
//$fileName
|
148 |
-
$isError = false;
|
149 |
-
$csvData = $this->_getCsvData($fileName,true);
|
150 |
-
|
151 |
-
/** checks columns */
|
152 |
-
|
153 |
-
if($this->validateCsvHeader($csvData)){
|
154 |
-
$isError = false;
|
155 |
-
}else{
|
156 |
-
$this->_getSession()->addError(Mage::helper('dropship360')->__('CSV header %s is invalid ',implode(',',$this->_haderError)));
|
157 |
-
$isError = true;
|
158 |
-
$this->_csvDataCache = array();
|
159 |
-
}
|
160 |
-
return $isError;
|
161 |
-
}
|
162 |
-
|
163 |
-
protected function validateCsvHeader($csvData,$isFtp = false)
|
164 |
-
{
|
165 |
-
$result = true;
|
166 |
-
if(empty($csvData))
|
167 |
-
{
|
168 |
-
return false;
|
169 |
-
}
|
170 |
-
if ($this->_isProductSetupMode && !$isFtp ){
|
171 |
-
$csvFields = $this->productSetupCSVFormat;
|
172 |
-
}else{
|
173 |
-
$csvFields = (!$isFtp) ? $this->manualCSVFormat : $this->ftpCSVFormat;
|
174 |
-
}
|
175 |
-
$cvsDataNum = count($csvData[0]);
|
176 |
-
|
177 |
-
if(!$this->validateManualCsvHeader($cvsDataNum,$csvData,$isFtp))
|
178 |
-
return false;
|
179 |
-
if(!$this->validateFtpCsvHeader($cvsDataNum,$csvData))
|
180 |
-
return false;
|
181 |
-
if(!$this->validateProductSetupCsvHeader($cvsDataNum,$csvData))
|
182 |
-
return false;
|
183 |
-
for ($i = 0; $i < $cvsDataNum; $i++) {
|
184 |
-
if( $isFtp && ($csvData[0][0] == 'vendor_code' || $csvData[0][0] == 'vendor_sku')){
|
185 |
-
continue;
|
186 |
-
}
|
187 |
-
if($csvData[0][$i] == $csvFields[$i]){
|
188 |
-
continue;
|
189 |
-
}else{
|
190 |
-
(!$isFtp) ? $this->_haderError[] = $csvData[0][$i] : '';
|
191 |
-
$result = false;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
return $result;
|
195 |
-
}
|
196 |
-
|
197 |
-
protected function validateManualCsvHeader($cvsDataNum,$csvData,$isFtp)
|
198 |
-
{
|
199 |
-
if(!$isFtp && !$this->_isProductSetupMode ){
|
200 |
-
if($cvsDataNum != 3){
|
201 |
-
foreach ($csvData[0] as $val){
|
202 |
-
if(!in_array($val,array('vendor_sku','cost','qty')))
|
203 |
-
{
|
204 |
-
$this->_haderError[] = $val;
|
205 |
-
}
|
206 |
-
}
|
207 |
-
return false;
|
208 |
-
}
|
209 |
-
}
|
210 |
-
return true;
|
211 |
-
}
|
212 |
-
protected function validateFtpCsvHeader($cvsDataNum,$csvData)
|
213 |
-
{
|
214 |
-
$validation = true;
|
215 |
-
if($cvsDataNum == 3 || $cvsDataNum == 4){
|
216 |
-
foreach ($csvData[0] as $val){
|
217 |
-
if(!in_array($val,($cvsDataNum == 3) ? array('vendor_sku','qty', 'cost') : array('vendor_code','vendor_sku','qty', 'cost'))){
|
218 |
-
$this->_haderError[] = $val;
|
219 |
-
$validation = false;
|
220 |
-
}
|
221 |
-
}
|
222 |
-
return $validation;
|
223 |
-
}
|
224 |
-
return true;
|
225 |
-
}
|
226 |
-
protected function validateProductSetupCsvHeader($cvsDataNum,$csvData)
|
227 |
-
{
|
228 |
-
if($this->_isProductSetupMode ){
|
229 |
-
if($cvsDataNum != 2){
|
230 |
-
foreach ($csvData[0] as $val){
|
231 |
-
if(!in_array($val,array('vendor_sku','magento_sku')))
|
232 |
-
{
|
233 |
-
$this->_haderError[] = $val;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
return false;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
return true;
|
240 |
-
}
|
241 |
-
protected function checkDataIntigrity($csvData,$isFtp = false){
|
242 |
-
|
243 |
-
//patch for FTP backward compatibility header
|
244 |
-
(count($csvData[0]) <= 3) ? array_unshift($csvData[0], "") : $csvData[0];
|
245 |
-
foreach($csvData as $row => $csvRowData)
|
246 |
-
{
|
247 |
-
if($row == 0)
|
248 |
-
continue;
|
249 |
-
if(!$this->_isProductSetupMode && !$isFtp){
|
250 |
-
array_unshift($csvRowData, "");
|
251 |
-
}
|
252 |
-
//patch for FTP backward compatibility data
|
253 |
-
if($isFtp)
|
254 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
255 |
-
$this->getErrorRowNumber($csvRowData,$row);
|
256 |
-
}
|
257 |
-
$this->generateMsg($isFtp,$this->result,$this->emptyRecords);
|
258 |
-
return in_array(true,$this->result) ? true : false;
|
259 |
-
}
|
260 |
-
protected function getErrorRowNumber($csvRowData,$row)
|
261 |
-
{
|
262 |
-
|
263 |
-
foreach($csvRowData as $key => $data){
|
264 |
-
$data = trim($data);
|
265 |
-
switch($key){
|
266 |
-
case is_numeric($key) ? 0 : 'magento_sku' :
|
267 |
-
if($this->_isProductSetupMode){
|
268 |
-
if(empty($data)){
|
269 |
-
$this->emptyRecords['magento_sku'][] = $row;
|
270 |
-
$this->result[] = true;
|
271 |
-
} else {
|
272 |
-
$this->result[] = false;
|
273 |
-
}
|
274 |
-
}else{
|
275 |
-
continue;
|
276 |
-
}
|
277 |
-
break;
|
278 |
-
case is_numeric($key) ? 1 : 'vendor_sku':
|
279 |
-
if(empty($data)){
|
280 |
-
$this->emptyRecords['vendor_sku'][] = $row;
|
281 |
-
$this->result[] = true;
|
282 |
-
}
|
283 |
-
else
|
284 |
-
$this->result[] = false;
|
285 |
-
break;
|
286 |
-
case is_numeric($key) ? 2 : 'qty':
|
287 |
-
if(!is_numeric($data) || $data < 0 )
|
288 |
-
{
|
289 |
-
if($data!=""){
|
290 |
-
$this->emptyRecords['qty'][] = $row;
|
291 |
-
$this->result[] = true;
|
292 |
-
}
|
293 |
-
}
|
294 |
-
else
|
295 |
-
$this->result[] = false;
|
296 |
-
break;
|
297 |
-
case is_numeric($key) ? 3 : 'cost':
|
298 |
-
if(!is_numeric($data) || $data < 0 ){
|
299 |
-
if($data!=""){
|
300 |
-
$this->emptyRecords['cost'][] = $row;
|
301 |
-
$this->result[] = true;
|
302 |
-
}
|
303 |
-
}
|
304 |
-
else
|
305 |
-
$this->result[] = false;
|
306 |
-
break;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
return;
|
310 |
-
}
|
311 |
-
protected function generateMsg($isFtp,$result,$emptyRecords){
|
312 |
-
|
313 |
-
$error = in_array(true,$result) ? true : false;
|
314 |
-
if($error){
|
315 |
-
foreach($emptyRecords as $key=>$value){
|
316 |
-
if($this->_isProductSetupMode){
|
317 |
-
if($key == 'magento_sku'){
|
318 |
-
$string = implode(';',$value);
|
319 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_magento_sku','value'=>$string);
|
320 |
-
}
|
321 |
-
}
|
322 |
-
if($key == 'vendor_sku'){
|
323 |
-
$string = implode(';',$value);
|
324 |
-
if($isFtp){
|
325 |
-
$this->_FtpErrors[] = array('error_type'=>'row_vendor_sku','value'=>$string);
|
326 |
-
$this->sendBadFileAlert = true;
|
327 |
-
}else{
|
328 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_vendor_sku','value'=>$string);
|
329 |
-
}
|
330 |
-
}
|
331 |
-
if($key == 'qty'){
|
332 |
-
$string = implode(';',$value);
|
333 |
-
if($isFtp){
|
334 |
-
$this->_FtpErrors[] = array('error_type'=>'row_qty','value'=>$string);
|
335 |
-
$this->sendBadFileAlert = true;
|
336 |
-
}else{
|
337 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_qty','value'=>$string);
|
338 |
-
}
|
339 |
-
}
|
340 |
-
if($key == 'cost'){
|
341 |
-
$string = implode(';',$value);
|
342 |
-
if($isFtp){
|
343 |
-
$this->_FtpErrors[] = array('error_type'=>'row_cost','value'=>$string);
|
344 |
-
$this->sendBadFileAlert = true;
|
345 |
-
}else{
|
346 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_cost','value'=>$string);
|
347 |
-
}
|
348 |
-
}
|
349 |
-
}
|
350 |
-
}
|
351 |
-
return ;
|
352 |
-
}
|
353 |
-
|
354 |
-
protected function getConfigValue($path)
|
355 |
-
{
|
356 |
-
return Mage::getStoreConfig($path);
|
357 |
-
}
|
358 |
-
public function getMagentoSku($vendorCode,$vendorSku){
|
359 |
-
$sku = '';
|
360 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
361 |
-
if($vendorCollection->count() > 0)
|
362 |
-
{
|
363 |
-
$sku = $vendorCollection->getFirstItem()->getProductSku();
|
364 |
-
}
|
365 |
-
return $sku;
|
366 |
-
}
|
367 |
-
|
368 |
-
/* parse uploaded csv file */
|
369 |
-
public function parseCsv($fileName = null,$lb_vendor_code = null)
|
370 |
-
{
|
371 |
-
$records = array();
|
372 |
-
$success = array();
|
373 |
-
$failure = array();
|
374 |
-
$counter = 0;
|
375 |
-
$foramterroroutput = array();
|
376 |
-
$this->_csvDataCache = array();
|
377 |
-
$this->_vendorCode = $lb_vendor_code;
|
378 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
379 |
-
$csvData = $this->_getCsvData(self::getWorkingDir().$fileName);
|
380 |
-
|
381 |
-
if(count($csvData) <= 1 && Mage::getModel('dropship360/csvparser')->isCsvFileEmpty())
|
382 |
-
{
|
383 |
-
$failure[$fileName] = 'Sorry,we cant find the record to update inventory';
|
384 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'empty_file','value'=>'Sorry,we cant find the record to update inventory');
|
385 |
-
}
|
386 |
-
|
387 |
-
$records = Mage::getModel('dropship360/csvparser')->generateManualCsvRow($csvData,$this->_isProductSetupMode,$lb_vendor_code);
|
388 |
-
|
389 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
390 |
-
//$this->conn->beginTransaction ();
|
391 |
-
if(is_array($records) && !empty($records)){
|
392 |
-
$requestData = array_chunk($records, 1, true);
|
393 |
-
|
394 |
-
foreach($requestData as $dataArr){
|
395 |
-
foreach($dataArr as $data){
|
396 |
-
if($this->_isProductSetupMode){
|
397 |
-
$result[] = $this->validateProductSetupMode($data);
|
398 |
-
}else{
|
399 |
-
$result[] = $this->validateCsvData($data);
|
400 |
-
}
|
401 |
-
}
|
402 |
-
}
|
403 |
-
foreach($result as $successOrfail){
|
404 |
-
if($successOrfail['success']!="")
|
405 |
-
$success[] = $successOrfail['success'];
|
406 |
-
if($successOrfail['failure']!="")
|
407 |
-
$failure[] = $successOrfail['failure'];
|
408 |
-
}
|
409 |
-
try{
|
410 |
-
$updateFileStatus = Mage::getModel('dropship360/uploadvendor')->load($fileName,'file_name');
|
411 |
-
$updateFileStatus->setImportStatus('done');
|
412 |
-
$updateFileStatus->save();
|
413 |
-
}catch(Exception $e){
|
414 |
-
echo $e->getMessage();
|
415 |
-
$this->_errors[] = $e->getMessage();
|
416 |
-
$this->_errors[] = $e->getTrace();
|
417 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
418 |
-
Mage::logException($e);
|
419 |
-
}
|
420 |
-
$this->checkDataIntigrity($csvData);
|
421 |
-
}
|
422 |
-
$finalResultCounter = (!$this->_isProductSetupMode) ? $this->logForUnprocessedRows($lb_vendor_code) : 0;
|
423 |
-
|
424 |
-
if(is_array($finalResultCounter))
|
425 |
-
{
|
426 |
-
$failed = count($failure)+$finalResultCounter['failure'];
|
427 |
-
$success = count($success)+$finalResultCounter['success'];
|
428 |
-
}else
|
429 |
-
{
|
430 |
-
$failed = count($failure)+$finalResultCounter;
|
431 |
-
$success = count($success)+$finalResultCounter;
|
432 |
-
}
|
433 |
-
|
434 |
-
$ftp_err = ($failed > 0) ? 'Missing/Bad Data' : '';
|
435 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,ftp_error,created_at) VALUES ("'.$lb_vendor_code.'","'.Mage::getSingleton('admin/session')->getUser()->getUsername().'",'.$success.','.$failed.',"'.$ftp_err.'","'.now().'")';
|
436 |
-
$this->conn->beginTransaction ();
|
437 |
-
$this->conn->query($insert);
|
438 |
-
$entityId = $this->conn->lastInsertId($tableVendorImportLog);
|
439 |
-
try {
|
440 |
-
$this->conn->commit ();
|
441 |
-
$this->prepareInsertAndExeQuery($this->_UploadCsvErrors,$entityId);
|
442 |
-
$file = self::getWorkingDir() . $fileName;
|
443 |
-
$this->fileObj()->rm($file);
|
444 |
-
} catch ( Exception $e ) {
|
445 |
-
$this->conn->rollBack ();
|
446 |
-
$this->_errors[] = $e->getMessage();
|
447 |
-
$this->_errors[] = $e->getTrace();
|
448 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
449 |
-
Mage::logException($e);
|
450 |
-
echo $e->getMessage();
|
451 |
-
|
452 |
-
}
|
453 |
-
$this->_csvParserObj->emptyTable();
|
454 |
-
$this->_csvDataCache = array();
|
455 |
-
$this->_vendorSkuFlag = array();
|
456 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal trasectional level
|
457 |
-
return $this;
|
458 |
-
}
|
459 |
-
|
460 |
-
|
461 |
-
protected function chekDuplicateCombination($data)
|
462 |
-
{
|
463 |
-
$result = true;
|
464 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
465 |
-
if($collection->count() > 0){
|
466 |
-
$existing_product_sku = $collection->getFirstItem()->getProductSku();
|
467 |
-
if(!empty($existing_product_sku)){
|
468 |
-
if($data['magento_sku'] != $existing_product_sku){
|
469 |
-
$result = false;
|
470 |
-
}
|
471 |
-
}
|
472 |
-
}
|
473 |
-
$inventoryCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',$data['magento_sku']);
|
474 |
-
if($inventoryCollection->getSize() > 0){
|
475 |
-
$inventoryCollection = $inventoryCollection->getData();
|
476 |
-
$inventoryCollection = $inventoryCollection[0];
|
477 |
-
$existing_vendor_sku = $inventoryCollection['lb_vendor_sku'];
|
478 |
-
if($existing_vendor_sku != trim($data['vendor_sku']))
|
479 |
-
{
|
480 |
-
$result = false;
|
481 |
-
}
|
482 |
-
}
|
483 |
-
return $result;
|
484 |
-
}
|
485 |
-
|
486 |
-
protected function _prepareCollection()
|
487 |
-
{
|
488 |
-
$collection = $this->getCollection()->addFieldToFilter('import_status','pending');
|
489 |
-
$collection->getSelect()->limit(1);
|
490 |
-
return $collection;
|
491 |
-
}
|
492 |
-
|
493 |
-
protected function calculateProductQty($data){
|
494 |
-
$qty = 0;
|
495 |
-
$configBuffer = 0;
|
496 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
497 |
-
return array('final_qty'=> .999999999,'upload_qty'=> .999999999); // apply patch for accept empty qty row from CSV
|
498 |
-
}
|
499 |
-
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
500 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldToFilter('product_sku',$data['magento_sku']);
|
501 |
-
if($collection->count() > 0){
|
502 |
-
foreach($collection as $qtyData){
|
503 |
-
if($data['lb_vendor_code'] != $qtyData->getLbVendorCode() )
|
504 |
-
$qty += $qtyData->getStock();
|
505 |
-
}
|
506 |
-
}
|
507 |
-
|
508 |
-
if($data['qty'] <= 0){
|
509 |
-
$rQty = 0;
|
510 |
-
}else{
|
511 |
-
$rQty = $data['qty'];
|
512 |
-
}
|
513 |
-
|
514 |
-
if(!empty($buffer) && $buffer >= 0){
|
515 |
-
$configBuffer = $buffer;
|
516 |
-
}else{
|
517 |
-
$configBuffer = 0;
|
518 |
-
}
|
519 |
-
|
520 |
-
$uploadQty = $rQty - $configBuffer;
|
521 |
-
$finalUploadQty = ($uploadQty >= 0) ? $uploadQty : 0;
|
522 |
-
$finalQty = $qty+$finalUploadQty;
|
523 |
-
return array('final_qty'=> ($finalQty >= 0) ? $finalQty : 0,'upload_qty'=> $finalUploadQty);
|
524 |
-
}
|
525 |
-
protected function vendorProductInsert($data)
|
526 |
-
{
|
527 |
-
$tableVendorInventory = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
528 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data);
|
529 |
-
$qtyArray = $this->calculateProductQty($data);
|
530 |
-
|
531 |
-
switch($inventoryCollectionResult['operationType'])
|
532 |
-
{
|
533 |
-
case 'update':
|
534 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']));
|
535 |
-
if($productId){
|
536 |
-
|
537 |
-
$update = $this->_prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,false);
|
538 |
-
|
539 |
-
try {
|
540 |
-
if(!$this->updateProductInventory(trim($data['magento_sku']),$qtyArray['final_qty']))
|
541 |
-
{
|
542 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
543 |
-
return false;
|
544 |
-
}
|
545 |
-
if($update){
|
546 |
-
$this->conn->beginTransaction ();
|
547 |
-
$this->conn->query($update);
|
548 |
-
$this->conn->commit ();
|
549 |
-
}
|
550 |
-
return true;
|
551 |
-
} catch ( Exception $e ) {
|
552 |
-
$this->conn->rollBack ();
|
553 |
-
$this->_errors[] = $e->getMessage();
|
554 |
-
$this->_errors[] = $e->getTrace();
|
555 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
556 |
-
Mage::logException($e);
|
557 |
-
echo $e->getMessage();
|
558 |
-
}
|
559 |
-
|
560 |
-
}else
|
561 |
-
{
|
562 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'magento_sku_exists','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
563 |
-
return false;
|
564 |
-
}
|
565 |
-
break;
|
566 |
-
case 'productsetup' :
|
567 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($data['magento_sku']);
|
568 |
-
if($productId){
|
569 |
-
$qtyInsert = $qtyArray['upload_qty'];
|
570 |
-
$costInsert = $data['cost'];
|
571 |
-
$insert = 'INSERT INTO '.$tableVendorInventory.' (lb_vendor_code,lb_vendor_name,product_sku,lb_vendor_sku,stock,cost,created_at,updated_at) VALUES ("'.$data['lb_vendor_code'].'","'.$this->getVendorName($data['lb_vendor_code']).'","'.$data['magento_sku'].'","'.$data['vendor_sku'].'",'.$qtyInsert.','.$costInsert.',"'.now().'","'.now().'")';
|
572 |
-
try {
|
573 |
-
if(!$this->updateProductInventory($data['magento_sku'],$qtyArray['final_qty']))
|
574 |
-
{
|
575 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_add_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
576 |
-
return false;
|
577 |
-
}
|
578 |
-
$this->conn->beginTransaction ();
|
579 |
-
$this->conn->query($insert);
|
580 |
-
$this->conn->commit ();
|
581 |
-
return true;
|
582 |
-
} catch ( Exception $e ) {
|
583 |
-
$this->conn->rollBack ();
|
584 |
-
$this->_errors[] = $e->getMessage();
|
585 |
-
$this->_errors[] = $e->getTrace();
|
586 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
587 |
-
Mage::logException($e);
|
588 |
-
echo $e->getMessage();
|
589 |
-
}
|
590 |
-
}
|
591 |
-
break;
|
592 |
-
case 'addnotallowed':
|
593 |
-
|
594 |
-
//$this->_UploadCsvErrors['general_error'][] = 'Add error: Cannot create new entry for vendor sku <b>' .$data['vendor_sku'].'</b>';
|
595 |
-
return false;
|
596 |
-
break;
|
597 |
-
}
|
598 |
-
return true;
|
599 |
-
|
600 |
-
}
|
601 |
-
|
602 |
-
protected function _prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,$isFtp)
|
603 |
-
{
|
604 |
-
$update;
|
605 |
-
(!is_numeric($data['cost']) || $data['cost'] < 0 || trim($data['cost']) =="") ? $costUpdate = '' : $costUpdate = 'cost ='. $data['cost'] . ',';
|
606 |
-
($qtyArray['upload_qty'] == .999999999 || trim($data['qty']) =="" ) ? $qtyUpdate = '' : $qtyUpdate = ' stock = '.$qtyArray['upload_qty']. ',';
|
607 |
-
if(!$isFtp){
|
608 |
-
($costUpdate=='' && $qtyUpdate =='' && !$this->_isProductSetupMode) ? $timeUpdate = "" : $timeUpdate = ' updated_at = "'.now(). '",';
|
609 |
-
$vSkuUpdate = ' lb_vendor_sku = "'.$data['vendor_sku']. '"';
|
610 |
-
$update = 'update '.$tableVendorInventory.' set '.$costUpdate.$qtyUpdate.$timeUpdate.$vSkuUpdate.' where id = '.$inventoryCollectionResult['vendor_id'];
|
611 |
-
}else
|
612 |
-
{
|
613 |
-
if(trim($data['qty'])!='' || trim($data['cost']) !='')
|
614 |
-
$update = 'update '.$tableVendorInventory.' set '.$costUpdate. $qtyUpdate.' updated_at = "'.now().'" where id = '.$inventoryCollectionResult['vendor_id'];
|
615 |
-
}
|
616 |
-
return $update;
|
617 |
-
}
|
618 |
-
protected function getInventoryLogQuery($data,$type,$qty,$updateBy=null,$ignoreData)
|
619 |
-
{
|
620 |
-
if(count($ignoreData)>0){
|
621 |
-
if($type=='update'){
|
622 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Updated, Qty Ignored' : '';
|
623 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Updated, Cost Ignored' : '';
|
624 |
-
}else{
|
625 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Added, Qty Ignored' : '';
|
626 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Added, Cost Ignored' : '';
|
627 |
-
}
|
628 |
-
if(count($ignoreData)==2){
|
629 |
-
$type = 'ignore';
|
630 |
-
}
|
631 |
-
}
|
632 |
-
if($qty==0.999999999)
|
633 |
-
$qty = 0;
|
634 |
-
$vendorRankModel = Mage::getModel('dropship360/ranking')->load($data['lb_vendor_code'],'lb_vendor_code');
|
635 |
-
$vendorName = $vendorRankModel->getLbVendorName();
|
636 |
-
|
637 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName('dropship360/inventorylog');
|
638 |
-
if(!$updateBy){
|
639 |
-
$updateBy = Mage::getSingleton('admin/session')->getUser()->getUsername();
|
640 |
-
}
|
641 |
-
if(isset($data["pucost"]) && isset($data["puqty"])){
|
642 |
-
$data['cost']= $data["pucost"];
|
643 |
-
$qty = $data["puqty"];
|
644 |
-
}
|
645 |
-
if(isset($data["pucost"]) && isset($data["puqty"])){
|
646 |
-
$data['cost']= $data["pucost"];
|
647 |
-
$qty = $data["puqty"];
|
648 |
-
}
|
649 |
-
return 'INSERT INTO '.$tableName.' (lb_vendor_code,lb_vendor_name,product_sku,cost,stock,updated_by,activity,updated_at,created_at) VALUES ("'.$data['lb_vendor_code'].'","'.$vendorName.'","'.$data['magento_sku'].'","'.$data['cost'].'","'.$qty.'","'.$updateBy.'","'.$type.'","'.now().'","'.now().'")';
|
650 |
-
}
|
651 |
-
|
652 |
-
protected function getInventoryCollection($data,$isFtp = false,$log = false)
|
653 |
-
{
|
654 |
-
$spacesTrimmedSku = $this->getTrimmedSku();
|
655 |
-
$searchedSku = array_search(trim($data['vendor_sku']), $spacesTrimmedSku);
|
656 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',trim($data['vendor_sku']));
|
657 |
-
if(isset($data['operationType'])){
|
658 |
-
if($this->_isProductSetupMode && $data['operationType'] == 'update'){
|
659 |
-
if($data['operationType'] == 'update')
|
660 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',trim($data['magento_sku']));
|
661 |
-
}
|
662 |
-
}
|
663 |
-
if($searchedSku){
|
664 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$searchedSku);
|
665 |
-
}
|
666 |
-
if($vendorCollection->getSize() > 0 || (isset($data['operationType']) && $data['operationType']=="update")){
|
667 |
-
$result = array('operationType'=> 'update','vendor_id'=>$vendorCollection->getFirstItem ()->getId(),'magento_sku'=>$vendorCollection->getFirstItem ()->getProductSku());
|
668 |
-
$data['magento_sku'] = $vendorCollection->getFirstItem ()->getProductSku();
|
669 |
-
}else{
|
670 |
-
if($log){
|
671 |
-
$isDuplicate = false;
|
672 |
-
if(in_array($data['vendor_sku'],$this->_vendorSkuFlag)){
|
673 |
-
$isDuplicate = true;
|
674 |
-
}
|
675 |
-
else{
|
676 |
-
$this->_vendorSkuFlag[] = $data['vendor_sku'];
|
677 |
-
}
|
678 |
-
if($isDuplicate){
|
679 |
-
$result = array('operationType'=> 'ignore','vendor_id'=>'');
|
680 |
-
}else{
|
681 |
-
$result = ($this->_isProductSetupMode) ? array('operationType'=> 'productsetup','vendor_id'=>'','magento_sku'=>$data['magento_sku']) :
|
682 |
-
array('operationType'=> 'addnotallowed','vendor_id'=>'','magento_sku'=>null);
|
683 |
-
}
|
684 |
-
}else{
|
685 |
-
$result = ($this->_isProductSetupMode) ? array('operationType'=> 'productsetup','vendor_id'=>'','magento_sku'=>$data['magento_sku']) :
|
686 |
-
array('operationType'=> 'addnotallowed','vendor_id'=>'','magento_sku'=>null);
|
687 |
-
}
|
688 |
-
}
|
689 |
-
return $result;
|
690 |
-
}
|
691 |
-
|
692 |
-
protected function updateProductInventory($sku,$qty)
|
693 |
-
{
|
694 |
-
if($qty == .999999999){
|
695 |
-
return true;
|
696 |
-
}
|
697 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
698 |
-
if($productId){
|
699 |
-
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
|
700 |
-
if (!$stockItem->getId()) {
|
701 |
-
$stockItem->setData('product_id', $productId);
|
702 |
-
$stockItem->setData('stock_id', 1);
|
703 |
-
}
|
704 |
-
|
705 |
-
if ($stockItem->getQty() != $qty) {
|
706 |
-
$stockItem->setData('qty', $qty);
|
707 |
-
$stockItem->setData('is_in_stock', $qty ? 1 : 0);
|
708 |
-
try {
|
709 |
-
$stockItem->save();
|
710 |
-
return true;
|
711 |
-
} catch (Exception $e) {
|
712 |
-
echo $e->getMessage();
|
713 |
-
}
|
714 |
-
|
715 |
-
}
|
716 |
-
}else{
|
717 |
-
return false;
|
718 |
-
}
|
719 |
-
return true;
|
720 |
-
}
|
721 |
-
|
722 |
-
/* prepare downloadable sample CSV file for user */
|
723 |
-
public function getCsvFile($isProductSetupMode = false)
|
724 |
-
{
|
725 |
-
$io = new Varien_Io_File();
|
726 |
-
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
|
727 |
-
$name = md5(microtime());
|
728 |
-
$file = $path . DS . $name;
|
729 |
-
|
730 |
-
$io->setAllowCreateFolders(true);
|
731 |
-
$io->open(array('path' => $path));
|
732 |
-
$io->streamOpen($file, 'w+');
|
733 |
-
$io->streamLock(true);
|
734 |
-
($isProductSetupMode) ? $io->streamWriteCsv(array('magento_sku','vendor_sku')) : $io->streamWriteCsv(array('vendor_sku','qty','cost'));
|
735 |
-
$io->streamUnlock();
|
736 |
-
$io->streamClose();
|
737 |
-
return array(
|
738 |
-
'type' => 'filename',
|
739 |
-
'value' => $file,
|
740 |
-
'rm' => true // can delete file after use
|
741 |
-
);
|
742 |
-
}
|
743 |
-
|
744 |
-
protected function getVendorName($vendorCode)
|
745 |
-
{
|
746 |
-
return Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code')->getLbVendorName();
|
747 |
-
}
|
748 |
-
|
749 |
-
|
750 |
-
/*
|
751 |
-
*
|
752 |
-
* logic to Import CSV file from logicbroker FTP for vendor inventory cost
|
753 |
-
*
|
754 |
-
*
|
755 |
-
*/
|
756 |
-
public function testFtpConnection($request,$isFtp = false)
|
757 |
-
{
|
758 |
-
$ftpServer = $request['ftp_site'];
|
759 |
-
$ftpUserName = $request['ftp_username'];
|
760 |
-
$ftpPassword = $request['ftp_password'];
|
761 |
-
$ftpType = $request['ftp_type'];
|
762 |
-
try {
|
763 |
-
if($ftpType['value'] == 'ftp'){
|
764 |
-
$ftpcon = ftp_connect($ftpServer['value']);
|
765 |
-
}else{
|
766 |
-
if(function_exists('ftp_ssl_connect'))
|
767 |
-
$ftpcon = ftp_ssl_connect($ftpServer['value']);
|
768 |
-
else
|
769 |
-
return array('error'=>true,'message' => 'System does not support secure ftp');
|
770 |
-
}
|
771 |
-
if (false === $ftpcon) {
|
772 |
-
|
773 |
-
return array('error'=>true,'message' => 'Unable to connect');
|
774 |
-
}
|
775 |
-
$loggedIn = @ftp_login($ftpcon, $ftpUserName['value'], $ftpPassword['value']);
|
776 |
-
ftp_pasv($ftpcon, true);
|
777 |
-
if (false === $loggedIn) {
|
778 |
-
return array('error'=>true,'message' => 'Unable to log in');
|
779 |
-
}
|
780 |
-
if(!$isFtp)
|
781 |
-
ftp_close($ftpcon);
|
782 |
-
} catch (Exception $e) {
|
783 |
-
return array('error'=>true,'message' => $e->getMessage());
|
784 |
-
|
785 |
-
}
|
786 |
-
if($isFtp)
|
787 |
-
return array('error'=>false,'message' => null,'object'=>$ftpcon);
|
788 |
-
else
|
789 |
-
return array('error'=>false,'message' => null);
|
790 |
-
}
|
791 |
-
|
792 |
-
/*
|
793 |
-
*
|
794 |
-
* Ftp function call by observer from where program execution started
|
795 |
-
*
|
796 |
-
*/
|
797 |
-
public function ftpParseCsv()
|
798 |
-
{
|
799 |
-
if(Mage::helper('dropship360')->isProcessRunning('bulk_assign')){
|
800 |
-
$message = 'Bulk product setup is currently running hence cannot run ftp import';
|
801 |
-
Mage::log($message, null, 'logicbroker_log_report.log');
|
802 |
-
return;
|
803 |
-
}
|
804 |
-
$ftpfileName = array();
|
805 |
-
$this->ftpRequestPram = array('ftp_site'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_SITE)),'ftp_username'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_USERNAME)),'ftp_password'=>array('value'=> Mage::helper('core')->decrypt($this->getConfigValue(self::XML_PATH_UPLOAD_FTP_PASSWORD))),'ftp_type'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_TYPE)));
|
806 |
-
|
807 |
-
if (! Mage::getStoreConfigFlag ( self::XML_PATH_UPLOAD_ENABLED )) {
|
808 |
-
return $this;
|
809 |
-
}
|
810 |
-
$connectionResult = $this->testFtpConnection($this->ftpRequestPram,true);
|
811 |
-
if($connectionResult['error']){
|
812 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => 'Connection Failure','bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
813 |
-
$this->genrateLogEntry(array('ftp_error'=>'Connection error','ftp_error_desc'=>$connectionResult['message'],'error'=> 1));
|
814 |
-
Mage::log($connectionResult['message'], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
815 |
-
ftp_close($connectionResult['object']);
|
816 |
-
return $this;
|
817 |
-
}
|
818 |
-
|
819 |
-
$rankCollection = Mage::getModel('dropship360/ranking')->getCollection()->addFieldToFilter('is_dropship','yes');
|
820 |
-
/* file path format <ftp site>/<Logicbroker Account Number>_MagVendID<number>/Inventory/ */
|
821 |
-
|
822 |
-
if($rankCollection->getSize() > 0){
|
823 |
-
foreach($rankCollection as $ranks){
|
824 |
-
$path = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER).'_'.$ranks->getLbVendorCode().'/'.'Inventory';
|
825 |
-
$ftpFiles = array();
|
826 |
-
$ftpFilesList = ftp_nlist($connectionResult['object'],$path);
|
827 |
-
//patch for sort ftp files by time
|
828 |
-
if($ftpFilesList){
|
829 |
-
foreach ($ftpFilesList as $value) {
|
830 |
-
if(preg_match("/.csv$/i", $value, $match)){
|
831 |
-
$fileTime = ftp_mdtm($connectionResult['object'], $value);
|
832 |
-
if(array_key_exists($fileTime,$ftpFiles))
|
833 |
-
$ftpFiles[$fileTime+20] = $value; // if timestamp same for files
|
834 |
-
else
|
835 |
-
$ftpFiles[$fileTime] = $value;
|
836 |
-
}
|
837 |
-
}
|
838 |
-
ksort($ftpFiles); // sort associative arrays in acending order, according to the key(time)
|
839 |
-
}
|
840 |
-
if($ftpFiles){
|
841 |
-
foreach($ftpFiles as $file){
|
842 |
-
if($this->downloadFtpFile($connectionResult['object'],$file,$path, $ranks->getLbVendorCode()))
|
843 |
-
$ftpfileName[$ranks->getLbVendorCode()][] = self::getWorkingDir().str_replace("\\","/",$path).DS.$this->downloadFtpFile($connectionResult['object'],$file,$path);
|
844 |
-
}
|
845 |
-
}
|
846 |
-
ftp_chdir($connectionResult['object'],'/');
|
847 |
-
}
|
848 |
-
}else{
|
849 |
-
$this->genrateLogEntry(array('ftp_error'=>'Import Error','ftp_error_desc'=>'No dropship supplier found','error'=> 1));
|
850 |
-
Mage::log('No dropship supplier found', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
851 |
-
ftp_close($connectionResult['object']);
|
852 |
-
return $this;
|
853 |
-
}
|
854 |
-
if(!empty($ftpfileName)){
|
855 |
-
$this->initialize();
|
856 |
-
$this->_csvParserObj->emptyTable();
|
857 |
-
$this->_csvDataCache = array();
|
858 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); //dirty read patch
|
859 |
-
foreach($ftpfileName as $vendorCode=>$fileinfo)
|
860 |
-
{
|
861 |
-
$this->_vendorCode = $vendorCode;
|
862 |
-
foreach($fileinfo as $path){
|
863 |
-
if($this->validateCsvHeader($this->_getCsvData($path,true),true)){
|
864 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
865 |
-
$this->ftpUpdateVendorProduct($this->_getCsvData($path),$path,$vendorCode);
|
866 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal trasectional level
|
867 |
-
$this->_csvDataCache = array();//for more than one csv file on FTP server
|
868 |
-
|
869 |
-
}else{
|
870 |
-
$this->_csvDataCache = array();
|
871 |
-
$logPath = explode('logicbrokervendorproduct',str_replace("\\","/",$path));
|
872 |
-
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Bad File header,Check header format at following FTP path '.$logPath[1]));
|
873 |
-
$this->genrateLogEntry(array('lb_vendor_code'=>$vendorCode,'ftp_error'=>'Bad File header','ftp_error_desc'=>'Check header format at following FTP path '.$logPath[1],'error'=> 1));
|
874 |
-
Mage::log('Please check header format', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
875 |
-
}
|
876 |
-
//fix move file to archive folder in all cases
|
877 |
-
$this->archiveFtpFile(array('object'=>$connectionResult['object'],'path'=>$path));
|
878 |
-
}
|
879 |
-
}
|
880 |
-
$this->finalize();
|
881 |
-
}else{
|
882 |
-
Mage::log('No files found on ftp server', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
883 |
-
ftp_close($connectionResult['object']);
|
884 |
-
return $this;
|
885 |
-
}
|
886 |
-
ftp_close($connectionResult['object']);
|
887 |
-
$this->_csvParserObj->emptyTable();
|
888 |
-
$this->_csvDataCache = array();
|
889 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
890 |
-
return $this;
|
891 |
-
}
|
892 |
-
|
893 |
-
protected function initialize(){
|
894 |
-
Mage::helper('dropship360')->startProcess('manual_upload');
|
895 |
-
Mage::log('Ftp upload started', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
896 |
-
}
|
897 |
-
|
898 |
-
protected function finalize(){
|
899 |
-
Mage::helper('dropship360')->finishProcess('manual_upload');
|
900 |
-
Mage::log('Ftp upload finished', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
901 |
-
}
|
902 |
-
|
903 |
-
protected function archiveFtpFile($object)
|
904 |
-
{
|
905 |
-
$path = str_replace("\\","/",$object['path']);
|
906 |
-
$patharr = explode('logicbrokervendorproduct',$path);
|
907 |
-
$dirname = pathinfo($patharr[1],PATHINFO_DIRNAME);
|
908 |
-
$basename = pathinfo($patharr[1],PATHINFO_BASENAME );
|
909 |
-
$newname = Mage::getModel('core/date')->date('Ymd-his').'_'.$basename;
|
910 |
-
$connection = $this->testFtpConnection($this->ftpRequestPram,true);
|
911 |
-
if($connection['error'])
|
912 |
-
{
|
913 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => "Connection Failure--Can not archive file -".$basename,'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
914 |
-
Mage::log($connection['message'] ."--Can not archive file -".$basename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
915 |
-
}
|
916 |
-
else
|
917 |
-
{
|
918 |
-
$object['object'] = $connection['object'];
|
919 |
-
}
|
920 |
-
ftp_chdir($object['object'],$dirname);
|
921 |
-
ftp_mkdir($object['object'], 'Archive');
|
922 |
-
ftp_chdir($object['object'],'Archive');
|
923 |
-
ftp_put($object['object'], $basename, $path, FTP_ASCII);
|
924 |
-
ftp_rename ($object['object'],$basename,$newname);
|
925 |
-
ftp_chdir($object['object'],'/');
|
926 |
-
$this->fileObj()->rm($object['path']);
|
927 |
-
ftp_delete($object['object'], $dirname.'/'.$basename);
|
928 |
-
ftp_close($connection['object']);
|
929 |
-
return;
|
930 |
-
|
931 |
-
}
|
932 |
-
protected function validateFtpFile($file, $vendorCode = null)
|
933 |
-
{
|
934 |
-
$file = str_replace("/","\\",$file);
|
935 |
-
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
936 |
-
return true;
|
937 |
-
}
|
938 |
-
|
939 |
-
protected function downloadFtpFile($ftpRequest,$file,$path, $vendorCode = null)
|
940 |
-
{
|
941 |
-
if(!file_exists(self::getWorkingDir().$path)){
|
942 |
-
$patharr = explode('/',$path);
|
943 |
-
$this->fileObj()->mkdir(self::getWorkingDir().$patharr[0]);
|
944 |
-
$this->fileObj()->chmod(self::getWorkingDir().$patharr[0],0777);
|
945 |
-
$this->fileObj()->mkdir(self::getWorkingDir().$patharr[0].'/'.$patharr[1]);
|
946 |
-
$this->fileObj()->chmod(self::getWorkingDir().$patharr[0].'/'.$patharr[1],0777);
|
947 |
-
}
|
948 |
-
$fileName = explode('/',$file);
|
949 |
-
|
950 |
-
ftp_chdir($ftpRequest,'/'.$fileName[0].'/'.$fileName[1]);
|
951 |
-
$server_file = $fileName[2];
|
952 |
-
$local_file = self::getWorkingDir().$path.DS.$fileName[2];
|
953 |
-
// download server file
|
954 |
-
if (ftp_get($ftpRequest, $local_file, $server_file, FTP_ASCII)){
|
955 |
-
|
956 |
-
return $fileName[2];
|
957 |
-
}else{
|
958 |
-
return false;
|
959 |
-
}
|
960 |
-
}
|
961 |
-
|
962 |
-
protected function uploadReport($file,$vendorCode){
|
963 |
-
$path = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER).'_'.$vendorCode.'/'.'Inventory';
|
964 |
-
$reprotPath = 'report'.Mage::getModel('core/date')->date('Ymd-his').'.csv';
|
965 |
-
$connection = $this->testFtpConnection($this->ftpRequestPram,true);
|
966 |
-
if($connection['error'])
|
967 |
-
{
|
968 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => "Connection Failure--Can not upload report file -".$basename,'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
969 |
-
Mage::log($connection['message'] ."--Can not archive file -".$basename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
970 |
-
}
|
971 |
-
else
|
972 |
-
{
|
973 |
-
$object = $connection['object'];
|
974 |
-
}
|
975 |
-
ftp_chdir($object,'/');
|
976 |
-
ftp_chdir($object,$path);
|
977 |
-
ftp_mkdir($object,'Reports');
|
978 |
-
ftp_chdir($object,'Reports');
|
979 |
-
ftp_put($object, $reprotPath,$file['value'], FTP_ASCII);
|
980 |
-
ftp_chdir($object,'/');
|
981 |
-
$this->fileObj()->rm( $file['value']);
|
982 |
-
ftp_close($connection['object']);
|
983 |
-
return;
|
984 |
-
}
|
985 |
-
protected function ftpUpdateVendorProduct($csvData,$path,$vendorCode = null)
|
986 |
-
{
|
987 |
-
$records = array();
|
988 |
-
$success = array();
|
989 |
-
$failure = array();
|
990 |
-
$itemerroroutput = array();
|
991 |
-
$counter = 0;
|
992 |
-
//$vendorCode = '';
|
993 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
994 |
-
if(count($csvData) <= 1 && Mage::getModel('dropship360/csvparser')->isCsvFileEmpty())
|
995 |
-
{
|
996 |
-
$failure[] = 'Sorry,we cant find the record to update inventory';
|
997 |
-
$this->_FtpErrors[] = array('error_type'=>'empty_file','value'=>'Sorry,we cant find the record to update inventory');
|
998 |
-
}
|
999 |
-
$records = Mage::getModel('dropship360/csvparser')->generateFtpCsvRow($csvData,$vendorCode);
|
1000 |
-
//$this->conn->beginTransaction ();
|
1001 |
-
if(is_array($records) && !empty($records)){
|
1002 |
-
$requestData = array_chunk($records, 1, true);
|
1003 |
-
|
1004 |
-
foreach($requestData as $dataArr)
|
1005 |
-
{
|
1006 |
-
foreach($dataArr as $data){
|
1007 |
-
$result[] = $this->validateCsvData($data, true);
|
1008 |
-
}
|
1009 |
-
}
|
1010 |
-
foreach($result as $successOrfail){
|
1011 |
-
if($successOrfail['success']!="")
|
1012 |
-
$success[] = $successOrfail['success'];
|
1013 |
-
if($successOrfail['failure']!="")
|
1014 |
-
$failure[] = $successOrfail['failure'];
|
1015 |
-
|
1016 |
-
}
|
1017 |
-
$this->checkDataIntigrity($this->_getCsvData($path),true);
|
1018 |
-
}
|
1019 |
-
$finalResultCounter = (!$this->_isProductSetupMode) ? $this->logForUnprocessedRows($vendorCode,true) : 0;
|
1020 |
-
if(is_array($finalResultCounter))
|
1021 |
-
{
|
1022 |
-
$failed = count($failure)+$finalResultCounter['failure'];
|
1023 |
-
$success = count($success)+$finalResultCounter['success'];
|
1024 |
-
}else
|
1025 |
-
{
|
1026 |
-
$failed = count($failure)+$finalResultCounter;
|
1027 |
-
$success = count($success)+$finalResultCounter;
|
1028 |
-
}
|
1029 |
-
$itemerroroutput = Mage::helper('core')->jsonEncode($this->_FtpErrors);
|
1030 |
-
//$failed = count($failure)+$counter;
|
1031 |
-
$ftp_err = ($failed > 0) ? 'Missing/Bad Data' : '';
|
1032 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,ftp_error,created_at) VALUES ("'.$vendorCode.'","FTP",'.$success.','.$failed.',"'.$ftp_err.'","'.now().'")';
|
1033 |
-
$this->conn->beginTransaction ();
|
1034 |
-
$this->conn->query($insert);
|
1035 |
-
$entityId = $this->conn->lastInsertId($tableVendorImportLog);
|
1036 |
-
try {
|
1037 |
-
$this->conn->commit ();
|
1038 |
-
if(count($this->_FtpErrors) > 0){
|
1039 |
-
$csvFile = Mage::helper('dropship360')->generateErrorList(array('ftp_error_desc'=>$itemerroroutput,'lb_vendor_code'=>$vendorCode),true);
|
1040 |
-
$this->uploadReport($csvFile,$vendorCode);
|
1041 |
-
}
|
1042 |
-
if($this->sendBadFileAlert){
|
1043 |
-
$logPath = explode('logicbrokervendorproduct',str_replace("\\","/",$path));
|
1044 |
-
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Missing/Bad data, check CSV data at following FTP path <br>'.$logPath[1]));
|
1045 |
-
}
|
1046 |
-
$this->prepareInsertAndExeQuery($this->_FtpErrors,$entityId);
|
1047 |
-
$itemerroroutput = array();
|
1048 |
-
$this->_FtpErrors = array();
|
1049 |
-
} catch ( Exception $e ) {
|
1050 |
-
$this->conn->rollBack ();
|
1051 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1052 |
-
echo $e->getMessage();
|
1053 |
-
|
1054 |
-
}
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
protected function ftpVendorProductUpdate($data)
|
1058 |
-
{
|
1059 |
-
$tableVendorInventory = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
1060 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data,true);
|
1061 |
-
$qtyArray = $this->calculateProductQty(array('magento_sku'=>$inventoryCollectionResult['magento_sku'],'qty'=>$data['qty'],'lb_vendor_code'=>$data['lb_vendor_code']));
|
1062 |
-
switch($inventoryCollectionResult['operationType'])
|
1063 |
-
{
|
1064 |
-
case 'update':
|
1065 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($inventoryCollectionResult['magento_sku']);
|
1066 |
-
if($productId){
|
1067 |
-
$update = $this->_prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,true);
|
1068 |
-
try {
|
1069 |
-
if(!$this->updateProductInventory($inventoryCollectionResult['magento_sku'],$qtyArray['final_qty']))
|
1070 |
-
{
|
1071 |
-
$this->_FtpErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$inventoryCollectionResult['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));;
|
1072 |
-
$this->sendBadFileAlert = true;
|
1073 |
-
return false;
|
1074 |
-
}
|
1075 |
-
if($update){
|
1076 |
-
$this->conn->beginTransaction ();
|
1077 |
-
$this->conn->query($update);
|
1078 |
-
$this->conn->commit ();
|
1079 |
-
}
|
1080 |
-
return true;
|
1081 |
-
} catch ( Exception $e ) {
|
1082 |
-
$this->conn->rollBack ();
|
1083 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1084 |
-
echo $e->getMessage();
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
}else{
|
1088 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1089 |
-
$this->sendBadFileAlert = true;
|
1090 |
-
return false;
|
1091 |
-
}
|
1092 |
-
break;
|
1093 |
-
default :
|
1094 |
-
/*fix for ticket lbn-710 vendor_sku not visible*/
|
1095 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));;
|
1096 |
-
$this->sendBadFileAlert = true;
|
1097 |
-
return false;
|
1098 |
-
}
|
1099 |
-
return true;
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
protected function genrateLogEntry($message)
|
1103 |
-
{
|
1104 |
-
$vendorCode = (!empty($message['lb_vendor_code'])) ? $message['lb_vendor_code'] : '';
|
1105 |
-
$ftp_error = (!empty($message['ftp_error'])) ? $message['ftp_error'] : '';
|
1106 |
-
$ftp_error_desc = (!empty($message['ftp_error_desc'])) ? $message['ftp_error_desc'] : '';
|
1107 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
1108 |
-
$this->conn->beginTransaction ();
|
1109 |
-
$now = now();
|
1110 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,created_at,ftp_error,ftp_error_desc) VALUES ("'.$vendorCode.'","FTP",'.count($success).','.$message['error'].',"'.$now.'","'.$ftp_error.'","'.$ftp_error_desc.'")';
|
1111 |
-
$this->conn->query($insert);
|
1112 |
-
try {
|
1113 |
-
$this->conn->commit ();
|
1114 |
-
} catch ( Exception $e ) {
|
1115 |
-
$this->conn->rollBack ();
|
1116 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1117 |
-
echo $e->getMessage();
|
1118 |
-
|
1119 |
-
}
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
/**
|
1123 |
-
* Check csv data for qty and cost values
|
1124 |
-
* @param array $data, bool $isFtp
|
1125 |
-
* @return array
|
1126 |
-
*/
|
1127 |
-
protected function validateCsvData($data, $isFtp=false){
|
1128 |
-
$invalidData = false;
|
1129 |
-
$success = 0;
|
1130 |
-
$failure = 0;
|
1131 |
-
$ignoreData = array();
|
1132 |
-
|
1133 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data,true,($isFtp) ? false : true);
|
1134 |
-
$data['magento_sku'] = $inventoryCollectionResult['magento_sku'];
|
1135 |
-
|
1136 |
-
if(Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']))){
|
1137 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
1138 |
-
$ignoreData[]= 'qty';
|
1139 |
-
}
|
1140 |
-
if(!is_numeric($data['cost']) || $data['cost'] < 0){
|
1141 |
-
$ignoreData[]= 'cost';
|
1142 |
-
}
|
1143 |
-
if((!is_numeric($data['cost']) || $data['cost'] < 0) && (!is_numeric($data['qty']) || $data['qty'] < 0)){
|
1144 |
-
if($data['cost']!="" && $data['qty']!="")
|
1145 |
-
$invalidData = true;
|
1146 |
-
}
|
1147 |
-
/* fix for lbn-954*/
|
1148 |
-
if(!$duplicateCombination = $this->chekDuplicateCombination($data)){
|
1149 |
-
$invalidData = true;
|
1150 |
-
if(!$isFtp){
|
1151 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1152 |
-
}else{
|
1153 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1154 |
-
$this->sendBadFileAlert = true;
|
1155 |
-
}
|
1156 |
-
}
|
1157 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',trim($data['vendor_sku']));
|
1158 |
-
if($vendorCollection->getSize() == 0){
|
1159 |
-
$spacesTrimmedSku = $this->getTrimmedSku();
|
1160 |
-
$searchedSku = array_search(trim($data['vendor_sku']), $spacesTrimmedSku);
|
1161 |
-
if($searchedSku){
|
1162 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$searchedSku);
|
1163 |
-
}
|
1164 |
-
}
|
1165 |
-
if($vendorCollection->getSize() > 0){
|
1166 |
-
if($data['magento_sku']!=$vendorCollection->getFirstItem ()->getProductSku()){
|
1167 |
-
$invalidData = true;
|
1168 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'already_assigned','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1169 |
-
}
|
1170 |
-
}
|
1171 |
-
if($invalidData){
|
1172 |
-
$failure+=1;
|
1173 |
-
}else{
|
1174 |
-
if($isFtp){
|
1175 |
-
($this->ftpVendorProductUpdate($data)) ? $success += 1 : $failure+=1;
|
1176 |
-
}else{
|
1177 |
-
($this->vendorProductInsert($data)) ? $success += 1 : $failure+=1;
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
}
|
1181 |
-
}else{
|
1182 |
-
$failure+=1;
|
1183 |
-
if(!$isFtp){
|
1184 |
-
if(trim($data['vendor_sku']))
|
1185 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1186 |
-
}else{
|
1187 |
-
if(trim($data['vendor_sku']))
|
1188 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1189 |
-
$this->sendBadFileAlert = true;
|
1190 |
-
}
|
1191 |
-
}
|
1192 |
-
if($data['magento_sku']){
|
1193 |
-
if($isFtp){
|
1194 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data,'update',$data['qty'],'FTP', $ignoreData);
|
1195 |
-
}else{
|
1196 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data, $inventoryCollectionResult['operationType'], $data['qty'], null,$ignoreData);
|
1197 |
-
}
|
1198 |
-
if($insertInventoryLog)
|
1199 |
-
{
|
1200 |
-
$this->conn->beginTransaction ();
|
1201 |
-
$this->conn->query($insertInventoryLog);
|
1202 |
-
try{
|
1203 |
-
$this->conn->commit ();
|
1204 |
-
}catch(Exception $e){
|
1205 |
-
$this->conn->rollBack ();
|
1206 |
-
}
|
1207 |
-
}
|
1208 |
-
}
|
1209 |
-
return array('success'=>$success, 'failure'=>$failure);
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
|
1213 |
-
/**
|
1214 |
-
* Validate product setup data for manual upload
|
1215 |
-
* @param array $data, bool $isFtp
|
1216 |
-
* @return array
|
1217 |
-
*/
|
1218 |
-
protected function validateProductSetupMode($data, $isFtp = false){
|
1219 |
-
$invalidData = false;
|
1220 |
-
$success = 0;
|
1221 |
-
$failure = 0;
|
1222 |
-
$type = "Product Setup";
|
1223 |
-
if(trim($data['vendor_sku'])=="" || trim($data['magento_sku'])==""){
|
1224 |
-
return array('success'=>$success =0, 'failure'=>$failure+=1);
|
1225 |
-
}
|
1226 |
-
if(Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']))){
|
1227 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
1228 |
-
if($collection->count() > 0){
|
1229 |
-
$existing_product_sku = $collection->getFirstItem()->getProductSku();
|
1230 |
-
if(!empty($existing_product_sku)){
|
1231 |
-
if($data['magento_sku'] != $existing_product_sku){
|
1232 |
-
$invalidData = true;
|
1233 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'duplicate_vendor_sku','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1234 |
-
|
1235 |
-
}else{
|
1236 |
-
$invalidData = true;
|
1237 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1238 |
-
}
|
1239 |
-
}
|
1240 |
-
}
|
1241 |
-
$inventoryCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',$data['magento_sku']);
|
1242 |
-
if($inventoryCollection->getSize() > 0){
|
1243 |
-
$inventoryCollection = $inventoryCollection->getData();
|
1244 |
-
$inventoryCollection = $inventoryCollection[0];
|
1245 |
-
$existing_vendor_sku = $inventoryCollection['lb_vendor_sku'];
|
1246 |
-
if(trim($data['vendor_sku'])!=""){
|
1247 |
-
if($existing_vendor_sku != trim($data['vendor_sku'])){
|
1248 |
-
if($existing_vendor_sku != trim($data['vendor_sku'])){
|
1249 |
-
$data['operationType'] = "update";
|
1250 |
-
$data['cost'] = "";
|
1251 |
-
$data['qty'] = "";
|
1252 |
-
$data['pucost'] = $inventoryCollection['cost'];
|
1253 |
-
$data['puqty'] = $inventoryCollection['stock'];
|
1254 |
-
$type = "Product Update";
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
}
|
1258 |
-
}
|
1259 |
-
if($invalidData){
|
1260 |
-
$failure+=1;
|
1261 |
-
}else{
|
1262 |
-
($this->vendorProductInsert($data)) ? $success += 1 : $failure+=1;
|
1263 |
-
if($this->vendorProductInsert($data)){
|
1264 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data, $type, 0, null, null);
|
1265 |
-
if($insertInventoryLog){
|
1266 |
-
$this->conn->beginTransaction ();
|
1267 |
-
$this->conn->query($insertInventoryLog);
|
1268 |
-
try{
|
1269 |
-
$this->conn->commit ();
|
1270 |
-
}catch(Exception $e){
|
1271 |
-
$this->conn->rollBack ();
|
1272 |
-
}
|
1273 |
-
}
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
-
}else{
|
1277 |
-
$failure+=1;
|
1278 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'magento_sku_exists','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1279 |
-
}
|
1280 |
-
return array('success'=>$success, 'failure'=>$failure);
|
1281 |
-
}
|
1282 |
-
|
1283 |
/* method for bulk assignment of vendor code to all product*/
|
1284 |
public function prepareBulkassignmentCollection($vendorCode)
|
1285 |
{
|
@@ -1299,243 +39,9 @@ class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstrac
|
|
1299 |
{
|
1300 |
foreach($skus as $mageSku){
|
1301 |
$magentoSku[] = $mageSku['sku'];
|
|
|
|
|
1302 |
}
|
1303 |
-
}
|
1304 |
-
}
|
1305 |
return $magentoSku;
|
1306 |
}
|
1307 |
-
|
1308 |
-
/**
|
1309 |
-
* Get Varien I/O File class object
|
1310 |
-
* @return object
|
1311 |
-
*/
|
1312 |
-
protected function fileObj()
|
1313 |
-
{
|
1314 |
-
$fileObj = new Varien_Io_File();
|
1315 |
-
return $fileObj;
|
1316 |
-
}
|
1317 |
-
|
1318 |
-
/**
|
1319 |
-
* Get vendor skus with satrting and trailing spaces
|
1320 |
-
* @return array
|
1321 |
-
*/
|
1322 |
-
protected function getTrimmedSku()
|
1323 |
-
{
|
1324 |
-
$read = Mage::getSingleton ('core/resource')->getConnection ('core_read');
|
1325 |
-
$tableName = Mage::getSingleton ('core/resource')->getTableName('logicbroker_vendor_inventory');
|
1326 |
-
$trimSpacesQuery = 'SELECT lb_vendor_sku FROM '.$tableName.' WHERE lb_vendor_sku LIKE '. '"% %"';
|
1327 |
-
$result = $read->fetchAll($trimSpacesQuery);
|
1328 |
-
$trimmedSkus = array();
|
1329 |
-
if(count($result) > 0){
|
1330 |
-
foreach($result as $k=>$v){
|
1331 |
-
foreach($v as $sku)
|
1332 |
-
$trimmedSkus[$sku] = trim($sku);
|
1333 |
-
}
|
1334 |
-
}
|
1335 |
-
return $trimmedSkus;
|
1336 |
-
}
|
1337 |
-
|
1338 |
-
protected function sendMail($mailData = array()){
|
1339 |
-
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED)) {
|
1340 |
-
return $this;
|
1341 |
-
}
|
1342 |
-
$mailData['datetime'] = Mage::getModel('core/date')->date();
|
1343 |
-
$postObject = new Varien_Object();
|
1344 |
-
$postObject->setData($mailData);
|
1345 |
-
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
1346 |
-
$templateId = 'logicbroker_ftp_con_fail';
|
1347 |
-
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId);
|
1348 |
-
if(!$isMailSent)
|
1349 |
-
Mage::log('Notification email not sent :'.$email, null, 'logicbroker_debug.log');
|
1350 |
-
}
|
1351 |
-
protected function logForUnprocessedRows($vendorCode,$isFtp = false){
|
1352 |
-
$msg = '';
|
1353 |
-
$error = 0;
|
1354 |
-
$success = 0;
|
1355 |
-
$proObj = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
1356 |
-
$proLinkAttr = $proObj->getLinkingAttribute();
|
1357 |
-
$proLinkAttr = empty($proLinkAttr) ? 'none' : $proLinkAttr;
|
1358 |
-
$this->supplierName = $proObj->getLbVendorName();
|
1359 |
-
$helper = Mage::helper('dropship360');
|
1360 |
-
$csvData = Mage::getModel('dropship360/csvparser')->getUnprocessedCsvRows($vendorCode,$isFtp);
|
1361 |
-
if(count($csvData) > 0 ){
|
1362 |
-
foreach($csvData as $data){
|
1363 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
1364 |
-
if($collection->getSize() > 0)
|
1365 |
-
{
|
1366 |
-
$msg = array('error_type'=>'data_notchnage','value'=>array('magento_sku'=> $collection->getFirstItem()->getProductSku(),'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1367 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1368 |
-
$error++;
|
1369 |
-
}else
|
1370 |
-
{
|
1371 |
-
switch ($proLinkAttr) {
|
1372 |
-
case 'none':
|
1373 |
-
$msg = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1374 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1375 |
-
$error++;
|
1376 |
-
break;
|
1377 |
-
default:
|
1378 |
-
$proCol = Mage::getModel('catalog/product')->getCollection();
|
1379 |
-
if(!$this->checkAttributeAval($proLinkAttr,$proCol)){
|
1380 |
-
$msg = array('error_type'=>'attribute_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1381 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1382 |
-
$error++;
|
1383 |
-
}else{
|
1384 |
-
$product = $proCol->addAttributeToFilter($proLinkAttr,$data['vendor_sku']);
|
1385 |
-
if($this->validateGenerateProduct($product,$data,$proLinkAttr,$isFtp)){
|
1386 |
-
$tempArray = $this->genNonExistPro($product,$data,$isFtp);
|
1387 |
-
!empty($tempArray['success']) ? $success++ : '';
|
1388 |
-
!empty($tempArray['failure']) ? $error++ : '';
|
1389 |
-
}else
|
1390 |
-
{
|
1391 |
-
$error++;
|
1392 |
-
}
|
1393 |
-
}
|
1394 |
-
break;
|
1395 |
-
}
|
1396 |
-
}
|
1397 |
-
}
|
1398 |
-
$csvData[0] = $this->_csvDataCache[0];
|
1399 |
-
$this->emptyRecords = array();
|
1400 |
-
$this->result = array();
|
1401 |
-
$this->checkDataIntigrity($csvData,$isFtp);
|
1402 |
-
}
|
1403 |
-
return array('success'=>$success,'failure'=>$error);
|
1404 |
-
}
|
1405 |
-
protected function prepareInsertAndExeQuery($csvData,$entityId){
|
1406 |
-
if(count($csvData) <= 0 || empty($entityId))
|
1407 |
-
return ;
|
1408 |
-
$tableName = Mage::getSingleton ( 'core/resource' )->getTableName ('dropship360/vendor_import_log_desc');
|
1409 |
-
|
1410 |
-
foreach($csvData as $data)
|
1411 |
-
{
|
1412 |
-
try {
|
1413 |
-
$this->conn->insertArray($tableName,array('error_id','description'),array(array($entityId,Mage::helper('core')->jsonEncode($data))));
|
1414 |
-
} catch ( Exception $e ) {
|
1415 |
-
Mage::logException($e);
|
1416 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
}
|
1420 |
-
return ;
|
1421 |
-
}
|
1422 |
-
protected function validateGenerateProduct($product,$data,$attr,$isFtp){
|
1423 |
-
$isValid = true;
|
1424 |
-
$helper = Mage::helper('dropship360');
|
1425 |
-
if($product->getSize() == 0)
|
1426 |
-
{
|
1427 |
-
$errorType = ($attr == $helper::LOGICBROKER_PRODUCT_LINK_CODE_SKU) ? 'magento_sku_exists' : $attr.'_notexist';
|
1428 |
-
$msg = array('error_type'=>$errorType,'value'=>array('magento_sku'=>$data['vendor_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1429 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1430 |
-
$isValid = false;
|
1431 |
-
}elseif($product->getSize() > 1)
|
1432 |
-
{
|
1433 |
-
$msg = array('error_type'=>$attr.'_multiple','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1434 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1435 |
-
$isValid = false;
|
1436 |
-
}else{
|
1437 |
-
$data['magento_sku'] = $product->getFirstItem()->getSku();
|
1438 |
-
if(!$this->chekDuplicateCombination($data))
|
1439 |
-
{
|
1440 |
-
$msg = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1441 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1442 |
-
$isValid = false;
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
return $isValid;
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
protected function genNonExistPro($proObj,$data,$isFtp){
|
1450 |
-
$invalidData = false;
|
1451 |
-
$failure = 0;
|
1452 |
-
$success = 0;
|
1453 |
-
$ignoreData = array();
|
1454 |
-
$data['magento_sku'] = $proObj->getFirstItem()->getSku();
|
1455 |
-
/* LBN - 935 change */
|
1456 |
-
$data['qty'] = (is_numeric($data['qty'])) ? Mage::helper('dropship360')->getIsQtyDecimal($data['magento_sku'],$data['qty']) : $data['qty'];
|
1457 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
1458 |
-
$ignoreData[]= 'qty';
|
1459 |
-
}
|
1460 |
-
if(!is_numeric($data['cost']) || $data['cost'] < 0){
|
1461 |
-
$ignoreData[]= 'cost';
|
1462 |
-
}
|
1463 |
-
if((!is_numeric($data['cost']) || $data['cost'] < 0) && (!is_numeric($data['qty']) || $data['qty'] < 0)){
|
1464 |
-
if($data['cost']!="" && $data['qty']!="")
|
1465 |
-
$invalidData = true;
|
1466 |
-
}
|
1467 |
-
|
1468 |
-
if($invalidData){
|
1469 |
-
$failure+=1;
|
1470 |
-
}else{
|
1471 |
-
($this->insertNonExistPro($proObj,$data,$isFtp)) ? $success += 1 : $failure += 1;
|
1472 |
-
}
|
1473 |
-
|
1474 |
-
$this->insertInventoryLog($ignoreData,$data,$isFtp);
|
1475 |
-
|
1476 |
-
return array('success'=>$success,'failure'=>$failure);
|
1477 |
-
}
|
1478 |
-
|
1479 |
-
protected function insertNonExistPro($proObj,$data,$isFtp = false){
|
1480 |
-
|
1481 |
-
$vendorCode = ($isFtp) ? $data['lb_vendor_code'] : $this->_vendorCode;
|
1482 |
-
$tableVendorInventory = Mage::getSingleton ('core/resource')->getTableName('dropship360/inventory');
|
1483 |
-
$qtyArray = $this->calculateProductQty($data);
|
1484 |
-
$costInsert = (!is_numeric($data['cost']) || $data['cost'] < 0 || trim($data['cost']) =="") ? 0 : $data['cost'] ;
|
1485 |
-
$qtyInsert = ($qtyArray['upload_qty'] == .999999999 || trim($data['qty']) =="" ) ? 0 : $qtyArray['upload_qty'];
|
1486 |
-
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','lb_vendor_sku','stock','cost','created_at','updated_at');
|
1487 |
-
$dbFieldVal = array(
|
1488 |
-
array($vendorCode,$this->supplierName,$data['magento_sku'],$data['vendor_sku'],$qtyInsert,$costInsert,now(),now())
|
1489 |
-
);
|
1490 |
-
try {
|
1491 |
-
if(!$this->updateProductInventory(trim($data['magento_sku']),$qtyArray['final_qty']))
|
1492 |
-
{
|
1493 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1494 |
-
return false;
|
1495 |
-
}
|
1496 |
-
$this->conn->insertArray($tableVendorInventory,$dbFields,$dbFieldVal);
|
1497 |
-
return true;
|
1498 |
-
} catch ( Exception $e ) {
|
1499 |
-
Mage::logException($e);
|
1500 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1501 |
-
}
|
1502 |
-
|
1503 |
-
|
1504 |
-
}
|
1505 |
-
protected function insertInventoryLog($ignoreData,$data,$isFtp)
|
1506 |
-
{
|
1507 |
-
$type = 'add';
|
1508 |
-
$vendorCode = ($isFtp) ? $data['lb_vendor_code'] : $this->_vendorCode;
|
1509 |
-
if(count($ignoreData)>0){
|
1510 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Added, Qty Ignored' : '';
|
1511 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Added, Cost Ignored' : '';
|
1512 |
-
|
1513 |
-
if(count($ignoreData)==2){
|
1514 |
-
$type = 'ignore';
|
1515 |
-
}
|
1516 |
-
}
|
1517 |
-
if($data['qty']==0.999999999)
|
1518 |
-
$data['qty'] = 0;
|
1519 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName('dropship360/inventorylog');
|
1520 |
-
$updatedBy = (!$isFtp) ? Mage::getSingleton('admin/session')->getUser()->getUsername() : 'FTP';
|
1521 |
-
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','cost','stock','updated_by','activity','updated_at','created_at');
|
1522 |
-
$dbFieldVal = array(
|
1523 |
-
array($vendorCode,$this->supplierName,$data['magento_sku'],$data['cost'],$data['qty'],$updatedBy,$type,now(),now())
|
1524 |
-
);
|
1525 |
-
try {
|
1526 |
-
$this->conn->insertArray($tableName,$dbFields,$dbFieldVal);
|
1527 |
-
return true;
|
1528 |
-
} catch ( Exception $e ) {
|
1529 |
-
Mage::logException($e);
|
1530 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
}
|
1534 |
-
protected function checkAttributeAval($attr,$object){
|
1535 |
-
$isExist = false;
|
1536 |
-
$attrEav = Mage::getResourceModel('catalog/eav_attribute')->loadByCode('catalog_product',$attr);
|
1537 |
-
if ($attrEav->getId())
|
1538 |
-
$isExist = true;
|
1539 |
-
return $isExist;
|
1540 |
-
}
|
1541 |
-
}
|
10 |
class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
protected function _construct()
|
14 |
{
|
|
|
|
|
15 |
$this->_init("dropship360/uploadvendor");
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function getDatabaseConnection()
|
20 |
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/* method for bulk assignment of vendor code to all product*/
|
24 |
public function prepareBulkassignmentCollection($vendorCode)
|
25 |
{
|
39 |
{
|
40 |
foreach($skus as $mageSku){
|
41 |
$magentoSku[] = $mageSku['sku'];
|
42 |
+
}
|
43 |
+
}
|
44 |
}
|
|
|
|
|
45 |
return $magentoSku;
|
46 |
}
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{InventoryController.php → Logicbroker/InventoryController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_InventoryController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{LogicbrokerController.php → Logicbroker/LogicbrokerController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_LogicbrokerController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
{includes/src/Logicbroker/Dropship360/controllers/Adminhtml → app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/RankingController.php
RENAMED
@@ -6,7 +6,7 @@
|
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
-
class
|
10 |
|
11 |
protected function _initAction() {
|
12 |
$this->loadLayout ()->_setActiveMenu ( 'dropship360/vendor_ranking' )->_addBreadcrumb ( Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ), Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ) );
|
@@ -39,6 +39,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
39 |
|
40 |
public function addNewVendorAction() {
|
41 |
$isSuccess = false;
|
|
|
42 |
$data = $this->getRequest ()->getPost ();
|
43 |
$arrVendor = array();
|
44 |
$vendorRankCollection = Mage::getModel ( 'dropship360/ranking' );
|
@@ -55,7 +56,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
55 |
$code = 'MagVendID'.$suffix;
|
56 |
$vendorRankCollection->setLbVendorCode($code);
|
57 |
$vendorRankCollection->setRanking($data['rank']);
|
58 |
-
$vendorRankCollection->setLbVendorName($data['name']);
|
59 |
$vendorRankCollection->setLbVendorType('user');
|
60 |
$vendorRankCollection->setCreatedAt(now());
|
61 |
$vendorRankCollection->setUpdatedAt(now());
|
@@ -76,7 +77,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
76 |
public function saverankingAction() {
|
77 |
$vendorName = array();
|
78 |
$data = $this->getRequest ()->getPost ();
|
79 |
-
|
80 |
$tableName = $data['partent_save_table_input'];
|
81 |
$dropShip = json_decode((urldecode($data['dropship_data'])),true);
|
82 |
$nonDropShip = json_decode((urldecode($data['nondropship_data'])),true);
|
@@ -112,6 +113,11 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
112 |
Mage::getSingleton ( 'adminhtml/session' )->addSuccess ( Mage::helper ( 'dropship360' )->__ ( 'Supplier ranking saved successfully' ) );
|
113 |
$this->_redirect ( '*/*/' );
|
114 |
return;
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
protected function _saveVendorRanking($key, $val, $rank = false) {
|
117 |
try {
|
@@ -132,12 +138,14 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
132 |
|
133 |
protected function _updateVendorName($val) {
|
134 |
try {
|
|
|
135 |
$model = Mage::getModel ( 'dropship360/ranking' )->load ( $val['code'], 'lb_vendor_code' );
|
136 |
if($model->getLbVendorCode())
|
137 |
-
$model->setLbVendorName ($val['name'])->save();
|
138 |
Mage::getModel ( 'dropship360/inventory' )->upDateVendorName($val);
|
139 |
} catch ( Exception $e ) {
|
140 |
-
Mage::
|
|
|
141 |
}
|
142 |
}
|
143 |
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_RankingController extends Mage_Adminhtml_Controller_Action {
|
10 |
|
11 |
protected function _initAction() {
|
12 |
$this->loadLayout ()->_setActiveMenu ( 'dropship360/vendor_ranking' )->_addBreadcrumb ( Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ), Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ) );
|
39 |
|
40 |
public function addNewVendorAction() {
|
41 |
$isSuccess = false;
|
42 |
+
$helper = Mage::helper('dropship360');
|
43 |
$data = $this->getRequest ()->getPost ();
|
44 |
$arrVendor = array();
|
45 |
$vendorRankCollection = Mage::getModel ( 'dropship360/ranking' );
|
56 |
$code = 'MagVendID'.$suffix;
|
57 |
$vendorRankCollection->setLbVendorCode($code);
|
58 |
$vendorRankCollection->setRanking($data['rank']);
|
59 |
+
$vendorRankCollection->setLbVendorName($helper->convertToHtmlcode($data['name']));
|
60 |
$vendorRankCollection->setLbVendorType('user');
|
61 |
$vendorRankCollection->setCreatedAt(now());
|
62 |
$vendorRankCollection->setUpdatedAt(now());
|
77 |
public function saverankingAction() {
|
78 |
$vendorName = array();
|
79 |
$data = $this->getRequest ()->getPost ();
|
80 |
+
try{
|
81 |
$tableName = $data['partent_save_table_input'];
|
82 |
$dropShip = json_decode((urldecode($data['dropship_data'])),true);
|
83 |
$nonDropShip = json_decode((urldecode($data['nondropship_data'])),true);
|
113 |
Mage::getSingleton ( 'adminhtml/session' )->addSuccess ( Mage::helper ( 'dropship360' )->__ ( 'Supplier ranking saved successfully' ) );
|
114 |
$this->_redirect ( '*/*/' );
|
115 |
return;
|
116 |
+
}catch(Exception $e){
|
117 |
+
Mage::getSingleton ( 'adminhtml/session' )->addError ( $e->getMessage () );
|
118 |
+
$this->_redirect ( '*/*/' );
|
119 |
+
return;
|
120 |
+
}
|
121 |
}
|
122 |
protected function _saveVendorRanking($key, $val, $rank = false) {
|
123 |
try {
|
138 |
|
139 |
protected function _updateVendorName($val) {
|
140 |
try {
|
141 |
+
$helper = Mage::helper('dropship360');
|
142 |
$model = Mage::getModel ( 'dropship360/ranking' )->load ( $val['code'], 'lb_vendor_code' );
|
143 |
if($model->getLbVendorCode())
|
144 |
+
$model->setLbVendorName ($helper->convertToHtmlcode($val['name']))->save();
|
145 |
Mage::getModel ( 'dropship360/inventory' )->upDateVendorName($val);
|
146 |
} catch ( Exception $e ) {
|
147 |
+
Mage::throwException('Error occured while renaming vendor in ranking table : '.$e->getMessage());
|
148 |
+
//Mage::getSingleton ( 'adminhtml/session' )->addError ( $e->getMessage () );
|
149 |
}
|
150 |
}
|
151 |
|
{includes/src/Logicbroker/Dropship360/controllers/Adminhtml → app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/ReportController.php
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_ReportController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{SourcingController.php → Logicbroker/SourcingController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
@@ -27,9 +27,9 @@ class Logicbroker_Dropship360_Adminhtml_SourcingController extends Mage_Adminhtm
|
|
27 |
*/
|
28 |
|
29 |
public function sourcinggridAction() {
|
30 |
-
$this->_initAction()
|
31 |
-
$this->getLayout()->createBlock('dropship360/
|
32 |
-
$this->
|
33 |
|
34 |
}
|
35 |
public function editAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_SourcingController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
27 |
*/
|
28 |
|
29 |
public function sourcinggridAction() {
|
30 |
+
$this->_initAction(); //->_title($this->__('PO Management'));
|
31 |
+
$this->getLayout()->createBlock('dropship360/adminhtml_sourcing_pomanagment');
|
32 |
+
$this->renderLayout();
|
33 |
|
34 |
}
|
35 |
public function editAction() {
|
app/code/community/Logicbroker/Dropship360/controllers/Adminhtml/{UploadController.php → Logicbroker/UploadController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
@@ -41,10 +41,10 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
41 |
public function uploadFileAction()
|
42 |
{
|
43 |
$data = $this->getRequest()->getPost();
|
44 |
-
$productSetupMode = (
|
45 |
if($productSetupMode)
|
46 |
{
|
47 |
-
$redirectUrl = '*/
|
48 |
}
|
49 |
else
|
50 |
{
|
@@ -57,7 +57,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
57 |
}
|
58 |
if ($data) {
|
59 |
try {
|
60 |
-
$import = Mage::getModel('dropship360/
|
61 |
$validationResult = $import->setData($data)->uploadSource();
|
62 |
if(!$validationResult){
|
63 |
$this->initialize();
|
@@ -121,11 +121,21 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
121 |
public function validateftpconnectionAction()
|
122 |
{
|
123 |
$paramsArray = $this->getRequest()->getParams();
|
124 |
-
$
|
125 |
-
$
|
126 |
-
$result =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
Mage::app()->getResponse()->setBody($result);
|
128 |
-
|
129 |
}
|
130 |
|
131 |
public function saveAction()
|
@@ -214,7 +224,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
214 |
$isProductSetupMode = (isset($paramsArray['isproductsetupmode']) && $paramsArray['isproductsetupmode']) ? true : false;
|
215 |
$type = ($isProductSetupMode) ? 'setup' : 'upload';
|
216 |
$fileName = 'logicbroker_supplier_product_'.$type.'.csv';
|
217 |
-
$content = Mage::getModel('dropship360/
|
218 |
$this->_prepareDownloadResponse($fileName, $content);
|
219 |
$this->_redirect('*/*/index');
|
220 |
|
@@ -263,6 +273,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
263 |
}
|
264 |
foreach($rowIds as $sku){
|
265 |
$collection = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('product_sku',$sku)->addFieldToFilter('lb_vendor_code',$vendorCode);
|
|
|
266 |
$inventoryId = ($collection->getSize() > 0) ? $collection->getFirstItem()->getId() : '';
|
267 |
if(!$inventoryId)
|
268 |
{
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_UploadController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
41 |
public function uploadFileAction()
|
42 |
{
|
43 |
$data = $this->getRequest()->getPost();
|
44 |
+
$productSetupMode = (array_key_exists('productsetupmode', $data)) ? $data['productsetupmode'] : 0;
|
45 |
if($productSetupMode)
|
46 |
{
|
47 |
+
$redirectUrl = '*/logicbroker_ranking/index';
|
48 |
}
|
49 |
else
|
50 |
{
|
57 |
}
|
58 |
if ($data) {
|
59 |
try {
|
60 |
+
$import = Mage::getModel('dropship360/import');
|
61 |
$validationResult = $import->setData($data)->uploadSource();
|
62 |
if(!$validationResult){
|
63 |
$this->initialize();
|
121 |
public function validateftpconnectionAction()
|
122 |
{
|
123 |
$paramsArray = $this->getRequest()->getParams();
|
124 |
+
$ftpdetails = $paramsArray['groups']['cron_settings_upload']['fields'];
|
125 |
+
$urlString = 'ftp://'.$ftpdetails['ftp_username']['value'].':'.$ftpdetails['ftp_password']['value'].'@'.$ftpdetails['ftp_site']['value'];
|
126 |
+
$result = array();
|
127 |
+
$validateConnection = Mage::getModel('dropship360/import_ftp');
|
128 |
+
try {
|
129 |
+
$validateConnection->connect($urlString);
|
130 |
+
$validateConnection->close();
|
131 |
+
$result = array('error'=>false,'message' => null);
|
132 |
+
$result = Mage::helper('core')->jsonEncode($result);
|
133 |
+
} catch (Exception $e) {
|
134 |
+
$result = array('error'=>true,'message' => $e->getMessage());
|
135 |
+
$result = Mage::helper('core')->jsonEncode($result);
|
136 |
+
}
|
137 |
+
|
138 |
Mage::app()->getResponse()->setBody($result);
|
|
|
139 |
}
|
140 |
|
141 |
public function saveAction()
|
224 |
$isProductSetupMode = (isset($paramsArray['isproductsetupmode']) && $paramsArray['isproductsetupmode']) ? true : false;
|
225 |
$type = ($isProductSetupMode) ? 'setup' : 'upload';
|
226 |
$fileName = 'logicbroker_supplier_product_'.$type.'.csv';
|
227 |
+
$content = Mage::getModel('dropship360/import')->getCsvFile($isProductSetupMode);
|
228 |
$this->_prepareDownloadResponse($fileName, $content);
|
229 |
$this->_redirect('*/*/index');
|
230 |
|
273 |
}
|
274 |
foreach($rowIds as $sku){
|
275 |
$collection = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('product_sku',$sku)->addFieldToFilter('lb_vendor_code',$vendorCode);
|
276 |
+
$collection->getSelect()->limit(1);
|
277 |
$inventoryId = ($collection->getSize() > 0) ? $collection->getFirstItem()->getId() : '';
|
278 |
if(!$inventoryId)
|
279 |
{
|
app/code/community/Logicbroker/Dropship360/etc/adminhtml.xml
CHANGED
@@ -60,22 +60,23 @@
|
|
60 |
<children>
|
61 |
<inventory translate="title">
|
62 |
<title>Supplier Inventory</title>
|
63 |
-
|
|
|
64 |
<sort_order>12</sort_order>
|
65 |
</inventory>
|
66 |
<vendor_ranking translate="title">
|
67 |
<title>Supplier Management</title>
|
68 |
-
<action>
|
69 |
<sort_order>13</sort_order>
|
70 |
</vendor_ranking>
|
71 |
<order_sourcing translate="title">
|
72 |
<title>PO Management</title>
|
73 |
-
<action>
|
74 |
<sort_order>11</sort_order>
|
75 |
</order_sourcing>
|
76 |
<bar_report translate="title">
|
77 |
<title>Activity Monitor</title>
|
78 |
-
<action>
|
79 |
<sort_order>14</sort_order>
|
80 |
</bar_report>
|
81 |
<logicbroker_integration translate="title">
|
60 |
<children>
|
61 |
<inventory translate="title">
|
62 |
<title>Supplier Inventory</title>
|
63 |
+
<!-- <action>logicbroker/adminhtml_upload</action> -->
|
64 |
+
<action>adminhtml/logicbroker_upload</action>
|
65 |
<sort_order>12</sort_order>
|
66 |
</inventory>
|
67 |
<vendor_ranking translate="title">
|
68 |
<title>Supplier Management</title>
|
69 |
+
<action>adminhtml/logicbroker_ranking</action>
|
70 |
<sort_order>13</sort_order>
|
71 |
</vendor_ranking>
|
72 |
<order_sourcing translate="title">
|
73 |
<title>PO Management</title>
|
74 |
+
<action>adminhtml/logicbroker_sourcing/sourcinggrid</action>
|
75 |
<sort_order>11</sort_order>
|
76 |
</order_sourcing>
|
77 |
<bar_report translate="title">
|
78 |
<title>Activity Monitor</title>
|
79 |
+
<action>adminhtml/logicbroker_report/activitymonitor</action>
|
80 |
<sort_order>14</sort_order>
|
81 |
</bar_report>
|
82 |
<logicbroker_integration translate="title">
|
app/code/community/Logicbroker/Dropship360/etc/api.xml
CHANGED
@@ -71,6 +71,10 @@
|
|
71 |
<code>104</code>
|
72 |
<message>Invaild Store Id</message>
|
73 |
</invaild_store>
|
|
|
|
|
|
|
|
|
74 |
</faults>
|
75 |
</sales_order>
|
76 |
<sales_order_shipment>
|
71 |
<code>104</code>
|
72 |
<message>Invaild Store Id</message>
|
73 |
</invaild_store>
|
74 |
+
<invaild_dropshipstatus>
|
75 |
+
<code>105</code>
|
76 |
+
<message>Invaild Dropship360 Status Only Transmitting Status Supported</message>
|
77 |
+
</invaild_dropshipstatus>
|
78 |
</faults>
|
79 |
</sales_order>
|
80 |
<sales_order_shipment>
|
app/code/community/Logicbroker/Dropship360/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Logicbroker_Dropship360>
|
5 |
-
<version>1.0.
|
6 |
</Logicbroker_Dropship360>
|
7 |
</modules>
|
8 |
<global>
|
@@ -169,15 +169,15 @@
|
|
169 |
|
170 |
</global>
|
171 |
|
172 |
-
|
173 |
<routers>
|
174 |
-
<
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
</routers>
|
182 |
</admin>
|
183 |
<adminhtml>
|
@@ -271,7 +271,7 @@
|
|
271 |
</logicbroker_backorder>
|
272 |
<logicbroker_uploadvendor>
|
273 |
<run>
|
274 |
-
<model>dropship360/
|
275 |
</run>
|
276 |
</logicbroker_uploadvendor>
|
277 |
<logicbroker_report_email>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Logicbroker_Dropship360>
|
5 |
+
<version>1.0.8</version>
|
6 |
</Logicbroker_Dropship360>
|
7 |
</modules>
|
8 |
<global>
|
169 |
|
170 |
</global>
|
171 |
|
172 |
+
<admin>
|
173 |
<routers>
|
174 |
+
<adminhtml>
|
175 |
+
<args>
|
176 |
+
<modules>
|
177 |
+
<Logicbroker_Dropship360 after="Mage_Adminhtml">Logicbroker_Dropship360_Adminhtml</Logicbroker_Dropship360>
|
178 |
+
</modules>
|
179 |
+
</args>
|
180 |
+
</adminhtml>
|
181 |
</routers>
|
182 |
</admin>
|
183 |
<adminhtml>
|
271 |
</logicbroker_backorder>
|
272 |
<logicbroker_uploadvendor>
|
273 |
<run>
|
274 |
+
<model>dropship360/import::ftpParseCsv</model>
|
275 |
</run>
|
276 |
</logicbroker_uploadvendor>
|
277 |
<logicbroker_report_email>
|
app/code/community/Logicbroker/Dropship360/etc/system.xml
CHANGED
@@ -337,7 +337,7 @@
|
|
337 |
<show_in_store>0</show_in_store>
|
338 |
</enabled>
|
339 |
<cron_setting translate="label">
|
340 |
-
<label>
|
341 |
<frontend_model>dropship360/adminhtml_system_config_crontime</frontend_model>
|
342 |
<backend_model>dropship360/system_config_backend_oudatedinventory_email</backend_model>
|
343 |
<sort_order>10</sort_order>
|
337 |
<show_in_store>0</show_in_store>
|
338 |
</enabled>
|
339 |
<cron_setting translate="label">
|
340 |
+
<label>Outdated Product Notification Cron Frequency</label>
|
341 |
<frontend_model>dropship360/adminhtml_system_config_crontime</frontend_model>
|
342 |
<backend_model>dropship360/system_config_backend_oudatedinventory_email</backend_model>
|
343 |
<sort_order>10</sort_order>
|
app/code/community/Logicbroker/Dropship360/etc/wsdl.xml
CHANGED
@@ -35,6 +35,12 @@
|
|
35 |
<element name="lb_item_status" type="xsd:string" minOccurs="0" />
|
36 |
<element name="lb_vendor_sku" type="xsd:string" minOccurs="0" />
|
37 |
<element name="lb_vendor_code" type="xsd:string" minOccurs="0" />
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
</all>
|
39 |
</complexType>
|
40 |
<complexType name="salesOrderLbEntity">
|
35 |
<element name="lb_item_status" type="xsd:string" minOccurs="0" />
|
36 |
<element name="lb_vendor_sku" type="xsd:string" minOccurs="0" />
|
37 |
<element name="lb_vendor_code" type="xsd:string" minOccurs="0" />
|
38 |
+
<element name="lb_vendor_cost" type="xsd:string" minOccurs="0" />
|
39 |
+
</all>
|
40 |
+
</complexType>
|
41 |
+
<complexType name="salesOrderEntity">
|
42 |
+
<all>
|
43 |
+
<element name="coupon_code" type="xsd:string" minOccurs="0" />
|
44 |
</all>
|
45 |
</complexType>
|
46 |
<complexType name="salesOrderLbEntity">
|
app/code/community/Logicbroker/Dropship360/sql/dropship360_setup/mysql4-upgrade-1.0.5-1.0.6.php
CHANGED
@@ -53,7 +53,7 @@ FOREIGN KEY (`error_id`) REFERENCES {$installer->getTable('dropship360/vendor_im
|
|
53 |
//patch apply for MAGENTO-CE/EE 1.9.2.2
|
54 |
$admin_permission_block = Mage::getConfig()->getTablePrefix().'permission_block';
|
55 |
if ($installer->getConnection()->isTableExists($admin_permission_block)){
|
56 |
-
$installer->getConnection()->
|
57 |
$installer->getTable('admin/permission_block'),
|
58 |
array(
|
59 |
array('block_name' => 'dropship360/adminhtml_reports_staticemailgrid', 'is_allowed' => 1)
|
@@ -62,7 +62,7 @@ if ($installer->getConnection()->isTableExists($admin_permission_block)){
|
|
62 |
}
|
63 |
$admin_permission_var = Mage::getConfig()->getTablePrefix().'permission_variable';
|
64 |
if ($installer->getConnection()->isTableExists($admin_permission_var)){
|
65 |
-
$installer->getConnection()->
|
66 |
$installer->getTable('admin/permission_variable'),
|
67 |
array(
|
68 |
array('variable_name' => 'logicbroker_sourcing/cron_settings_upload/ftp_site', 'is_allowed' => 1),
|
53 |
//patch apply for MAGENTO-CE/EE 1.9.2.2
|
54 |
$admin_permission_block = Mage::getConfig()->getTablePrefix().'permission_block';
|
55 |
if ($installer->getConnection()->isTableExists($admin_permission_block)){
|
56 |
+
$installer->getConnection()->insertOnDuplicate(
|
57 |
$installer->getTable('admin/permission_block'),
|
58 |
array(
|
59 |
array('block_name' => 'dropship360/adminhtml_reports_staticemailgrid', 'is_allowed' => 1)
|
62 |
}
|
63 |
$admin_permission_var = Mage::getConfig()->getTablePrefix().'permission_variable';
|
64 |
if ($installer->getConnection()->isTableExists($admin_permission_var)){
|
65 |
+
$installer->getConnection()->insertOnDuplicate(
|
66 |
$installer->getTable('admin/permission_variable'),
|
67 |
array(
|
68 |
array('variable_name' => 'logicbroker_sourcing/cron_settings_upload/ftp_site', 'is_allowed' => 1),
|
app/code/community/Logicbroker/Dropship360/sql/dropship360_setup/mysql4-upgrade-1.0.7-1.0.8.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Logicbroker
|
4 |
+
*
|
5 |
+
* @category Community
|
6 |
+
* @package Logicbroker_Dropship360
|
7 |
+
*/
|
8 |
+
$installer = $this;
|
9 |
+
//adding new dropship360 item status refer LBN-1444
|
10 |
+
$installer->getConnection()->modifyColumn($installer->getTable('dropship360/orderitems'),'lb_item_status', ' ENUM( "Sourcing", "Reprocess", "Backorder", "Transmitting", "Sent to Supplier", "Sent to Vendor", "Cancelled", "No Dropship", "Completed" ,"Error") NOT NULL DEFAULT "Sourcing" ');
|
11 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/logicbroker.xml
CHANGED
@@ -6,25 +6,25 @@
|
|
6 |
<block type="dropship360/adminhtml_notification" name="logicbrokernotification" as="logicbrokernotification" template="logicbroker/window.phtml" />
|
7 |
</reference>
|
8 |
</default>
|
9 |
-
<
|
10 |
<reference name="content">
|
11 |
<block type="dropship360/adminhtml_logicbroker" name="dropship360" />
|
12 |
</reference>
|
13 |
<reference name="js">
|
14 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
15 |
</reference>
|
16 |
-
</
|
17 |
|
18 |
-
<
|
19 |
<reference name="content">
|
20 |
<block type="dropship360/adminhtml_sourcing" name="dropship360" />
|
21 |
</reference>
|
22 |
<reference name="js">
|
23 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
24 |
</reference>
|
25 |
-
</
|
26 |
|
27 |
-
<
|
28 |
<reference name="head">
|
29 |
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
30 |
<action method="addItem"><type>css</type><name>prototype/windows/themes/magento.css</name></action>
|
@@ -43,59 +43,62 @@
|
|
43 |
</block>
|
44 |
</block>
|
45 |
</reference>
|
46 |
-
</
|
47 |
|
48 |
-
<
|
49 |
<reference name="content">
|
50 |
<block type="dropship360/adminhtml_inventory" name="inventory" />
|
51 |
</reference>
|
52 |
<reference name="js">
|
53 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
54 |
</reference>
|
55 |
-
</
|
56 |
|
57 |
-
<
|
58 |
<reference name="content">
|
59 |
<block type="core/text_list" name="root" output="toHtml" >
|
60 |
<block type="dropship360/adminhtml_inventory_edit_tab_lbvendor" name="vendors_product_tab" template="logicbroker/vendorproducttab.phtml"/>
|
61 |
</block>
|
62 |
</reference>
|
63 |
-
</
|
64 |
|
65 |
-
<
|
66 |
<reference name="content">
|
67 |
<block type="core/text_list" name="root" output="toHtml" >
|
68 |
<block type="dropship360/adminhtml_inventory_edit_tab_vendortabhistory" name="vendors_product_tab_history" template="logicbroker/vendorproducttabhistory.phtml"/>
|
69 |
</block>
|
70 |
</reference>
|
71 |
-
</
|
72 |
|
73 |
-
<
|
|
|
|
|
|
|
74 |
<reference name="content">
|
75 |
<block type="dropship360/adminhtml_Vendorproductuploadhistory" name="vendors_product_upload_history" template="logicbroker/vendor_upload_product_history.phtml"/>
|
76 |
</reference>
|
77 |
<reference name="js">
|
78 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
79 |
</reference>
|
80 |
-
</
|
81 |
|
82 |
-
<
|
83 |
<remove name="right"/>
|
84 |
<remove name="left"/>
|
85 |
<remove name="core_profiler"/>
|
86 |
<block type="core/template" name="root" output="toHtml" template="logicbroker/popup.phtml"/>
|
87 |
-
</
|
88 |
|
89 |
-
<
|
90 |
<reference name="content">
|
91 |
<block type="dropship360/adminhtml_showhistory" name="showhistory" template="logicbroker/result.phtml"/>
|
92 |
</reference>
|
93 |
<reference name="js">
|
94 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
95 |
</reference>
|
96 |
-
</
|
97 |
|
98 |
-
<
|
99 |
<reference name="content">
|
100 |
<block type="dropship360/adminhtml_upload" name="upload" template = "logicbroker/upload_vendor_product.phtml">
|
101 |
<block type="dropship360/adminhtml_inventory" name="inventory" />
|
@@ -105,8 +108,8 @@
|
|
105 |
<reference name="js">
|
106 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
107 |
</reference>
|
108 |
-
</
|
109 |
-
<
|
110 |
<remove name="root"/>
|
111 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
112 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
@@ -118,7 +121,7 @@
|
|
118 |
</block>
|
119 |
<block type="dropship360/adminhtml_upload_bulkassign" name="logicbroker_bulkassign" template="logicbroker/process-profile.phtml" output="toHtml"/>
|
120 |
</block>
|
121 |
-
</
|
122 |
|
123 |
<adminhtml_sales_order_view>
|
124 |
<reference name="order_items">
|
@@ -157,7 +160,7 @@
|
|
157 |
</action>
|
158 |
</reference>
|
159 |
</adminhtml_catalog_product_edit>
|
160 |
-
<
|
161 |
<update handle="report_sales"/>
|
162 |
<reference name="content">
|
163 |
<block type="dropship360/adminhtml_reports_activitymonitor" template="logicbroker/reports/grid/container.phtml" name="report.activitymonitor">
|
@@ -167,5 +170,5 @@
|
|
167 |
<reference name="js">
|
168 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
169 |
</reference>
|
170 |
-
</
|
171 |
</layout>
|
6 |
<block type="dropship360/adminhtml_notification" name="logicbrokernotification" as="logicbrokernotification" template="logicbroker/window.phtml" />
|
7 |
</reference>
|
8 |
</default>
|
9 |
+
<adminhtml_logicbroker_logicbroker_index>
|
10 |
<reference name="content">
|
11 |
<block type="dropship360/adminhtml_logicbroker" name="dropship360" />
|
12 |
</reference>
|
13 |
<reference name="js">
|
14 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
15 |
</reference>
|
16 |
+
</adminhtml_logicbroker_logicbroker_index>
|
17 |
|
18 |
+
<adminhtml_logicbroker_sourcing_sourcinggrid>
|
19 |
<reference name="content">
|
20 |
<block type="dropship360/adminhtml_sourcing" name="dropship360" />
|
21 |
</reference>
|
22 |
<reference name="js">
|
23 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
24 |
</reference>
|
25 |
+
</adminhtml_logicbroker_sourcing_sourcinggrid>
|
26 |
|
27 |
+
<adminhtml_logicbroker_ranking_index>
|
28 |
<reference name="head">
|
29 |
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
30 |
<action method="addItem"><type>css</type><name>prototype/windows/themes/magento.css</name></action>
|
43 |
</block>
|
44 |
</block>
|
45 |
</reference>
|
46 |
+
</adminhtml_logicbroker_ranking_index>
|
47 |
|
48 |
+
<adminhtml_logicbroker_inventory_index>
|
49 |
<reference name="content">
|
50 |
<block type="dropship360/adminhtml_inventory" name="inventory" />
|
51 |
</reference>
|
52 |
<reference name="js">
|
53 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
54 |
</reference>
|
55 |
+
</adminhtml_logicbroker_inventory_index>
|
56 |
|
57 |
+
<adminhtml_logicbroker_inventory_vendors>
|
58 |
<reference name="content">
|
59 |
<block type="core/text_list" name="root" output="toHtml" >
|
60 |
<block type="dropship360/adminhtml_inventory_edit_tab_lbvendor" name="vendors_product_tab" template="logicbroker/vendorproducttab.phtml"/>
|
61 |
</block>
|
62 |
</reference>
|
63 |
+
</adminhtml_logicbroker_inventory_vendors>
|
64 |
|
65 |
+
<adminhtml_logicbroker_inventory_vendorshistory>
|
66 |
<reference name="content">
|
67 |
<block type="core/text_list" name="root" output="toHtml" >
|
68 |
<block type="dropship360/adminhtml_inventory_edit_tab_vendortabhistory" name="vendors_product_tab_history" template="logicbroker/vendorproducttabhistory.phtml"/>
|
69 |
</block>
|
70 |
</reference>
|
71 |
+
</adminhtml_logicbroker_inventory_vendorshistory>
|
72 |
|
73 |
+
<adminhtml_logicbroker_upload_vendorsuploadhistory>
|
74 |
+
<reference name="head">
|
75 |
+
<action method="addItem"><type>js_css</type><name>logicbroker/vendorhistory.css</name></action>
|
76 |
+
</reference>
|
77 |
<reference name="content">
|
78 |
<block type="dropship360/adminhtml_Vendorproductuploadhistory" name="vendors_product_upload_history" template="logicbroker/vendor_upload_product_history.phtml"/>
|
79 |
</reference>
|
80 |
<reference name="js">
|
81 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
82 |
</reference>
|
83 |
+
</adminhtml_logicbroker_upload_vendorsuploadhistory>
|
84 |
|
85 |
+
<adminhtml_logicbroker_ranking_popup>
|
86 |
<remove name="right"/>
|
87 |
<remove name="left"/>
|
88 |
<remove name="core_profiler"/>
|
89 |
<block type="core/template" name="root" output="toHtml" template="logicbroker/popup.phtml"/>
|
90 |
+
</adminhtml_logicbroker_ranking_popup>
|
91 |
|
92 |
+
<adminhtml_logicbroker_ranking_showhistory>
|
93 |
<reference name="content">
|
94 |
<block type="dropship360/adminhtml_showhistory" name="showhistory" template="logicbroker/result.phtml"/>
|
95 |
</reference>
|
96 |
<reference name="js">
|
97 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
98 |
</reference>
|
99 |
+
</adminhtml_logicbroker_ranking_showhistory>
|
100 |
|
101 |
+
<adminhtml_logicbroker_upload_index>
|
102 |
<reference name="content">
|
103 |
<block type="dropship360/adminhtml_upload" name="upload" template = "logicbroker/upload_vendor_product.phtml">
|
104 |
<block type="dropship360/adminhtml_inventory" name="inventory" />
|
108 |
<reference name="js">
|
109 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
110 |
</reference>
|
111 |
+
</adminhtml_logicbroker_upload_index>
|
112 |
+
<adminhtml_logicbroker_upload_run>
|
113 |
<remove name="root"/>
|
114 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
115 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
121 |
</block>
|
122 |
<block type="dropship360/adminhtml_upload_bulkassign" name="logicbroker_bulkassign" template="logicbroker/process-profile.phtml" output="toHtml"/>
|
123 |
</block>
|
124 |
+
</adminhtml_logicbroker_upload_run>
|
125 |
|
126 |
<adminhtml_sales_order_view>
|
127 |
<reference name="order_items">
|
160 |
</action>
|
161 |
</reference>
|
162 |
</adminhtml_catalog_product_edit>
|
163 |
+
<adminhtml_logicbroker_report_activitymonitor>
|
164 |
<update handle="report_sales"/>
|
165 |
<reference name="content">
|
166 |
<block type="dropship360/adminhtml_reports_activitymonitor" template="logicbroker/reports/grid/container.phtml" name="report.activitymonitor">
|
170 |
<reference name="js">
|
171 |
<block type="core/template" template="logicbroker/add_help_js.phtml"/>
|
172 |
</reference>
|
173 |
+
</adminhtml_logicbroker_report_activitymonitor>
|
174 |
</layout>
|
app/design/adminhtml/default/default/template/logicbroker/bundle/renderer.phtml
CHANGED
@@ -416,7 +416,7 @@ function respondToClick(id) {
|
|
416 |
|
417 |
function respondToChange(obj) {
|
418 |
var itemId = obj.id.split('-');
|
419 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
420 |
parameters: {
|
421 |
'lb_item_id': itemId[1],
|
422 |
'lb_item_status': obj.value
|
416 |
|
417 |
function respondToChange(obj) {
|
418 |
var itemId = obj.id.split('-');
|
419 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/logicbroker_logicbroker/changeStatusAjax') ?>', {
|
420 |
parameters: {
|
421 |
'lb_item_id': itemId[1],
|
422 |
'lb_item_status': obj.value
|
app/design/adminhtml/default/default/template/logicbroker/downloadable/downloadable.phtml
CHANGED
@@ -276,7 +276,7 @@ function respondToClick(id) {
|
|
276 |
|
277 |
function respondToChange(obj) {
|
278 |
var itemId = obj.id.split('-');
|
279 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
280 |
parameters: {
|
281 |
'lb_item_id': itemId[1],
|
282 |
'lb_item_status': obj.value
|
276 |
|
277 |
function respondToChange(obj) {
|
278 |
var itemId = obj.id.split('-');
|
279 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/logicbroker_logicbroker/changeStatusAjax') ?>', {
|
280 |
parameters: {
|
281 |
'lb_item_id': itemId[1],
|
282 |
'lb_item_status': obj.value
|
app/design/adminhtml/default/default/template/logicbroker/sales/default.phtml
CHANGED
@@ -285,7 +285,7 @@ function respondToClick(id) {
|
|
285 |
function respondToChange(obj) {
|
286 |
if(obj.value){
|
287 |
var itemId = obj.id.split('-');
|
288 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
289 |
parameters: {
|
290 |
'lb_item_id': itemId[1],
|
291 |
'lb_item_status': obj.value,
|
285 |
function respondToChange(obj) {
|
286 |
if(obj.value){
|
287 |
var itemId = obj.id.split('-');
|
288 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/logicbroker_logicbroker/changeStatusAjax') ?>', {
|
289 |
parameters: {
|
290 |
'lb_item_id': itemId[1],
|
291 |
'lb_item_status': obj.value,
|
app/design/adminhtml/default/default/template/logicbroker/system/config/fieldset/hint.phtml
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
<b><span>Step 2:</span> Connect logicbroker to your Magento Admin Panel </b>
|
50 |
</div>
|
51 |
|
52 |
-
<p><span>Create your logicbroker SOAP API User > <a href="<?php echo $this->getUrl('
|
53 |
update your logicbroker API key</a></span> (this is like your
|
54 |
password)</p>
|
55 |
<p> <span>Login to <a target="_blank" href="https://portal.logicbroker.com/">logicbroker</a> and navigate to <b>Systems
|
49 |
<b><span>Step 2:</span> Connect logicbroker to your Magento Admin Panel </b>
|
50 |
</div>
|
51 |
|
52 |
+
<p><span>Create your logicbroker SOAP API User > <a href="<?php echo $this->getUrl('adminhtml/logicbroker_logicbroker/getapidetails') ?>">Click Here to
|
53 |
update your logicbroker API key</a></span> (this is like your
|
54 |
password)</p>
|
55 |
<p> <span>Login to <a target="_blank" href="https://portal.logicbroker.com/">logicbroker</a> and navigate to <b>Systems
|
app/design/adminhtml/default/default/template/logicbroker/upload_vendor_product.phtml
CHANGED
@@ -32,9 +32,9 @@ var formSubmit = false;
|
|
32 |
function downloadSampleCsv()
|
33 |
{
|
34 |
if(isProductModeSteup)
|
35 |
-
setLocation("<?php echo $this->getUrl('
|
36 |
else
|
37 |
-
setLocation("<?php echo $this->getUrl('
|
38 |
}
|
39 |
document.observe("dom:loaded", function(){
|
40 |
if($('uploadStarted'))
|
32 |
function downloadSampleCsv()
|
33 |
{
|
34 |
if(isProductModeSteup)
|
35 |
+
setLocation("<?php echo $this->getUrl('adminhtml/logicbroker_upload/download',array('_query'=>array('isproductsetupmode' => true))) ?>");
|
36 |
else
|
37 |
+
setLocation("<?php echo $this->getUrl('adminhtml/logicbroker_upload/download') ?>");
|
38 |
}
|
39 |
document.observe("dom:loaded", function(){
|
40 |
if($('uploadStarted'))
|
app/design/adminhtml/default/default/template/logicbroker/vendor_upload_product_history.phtml
CHANGED
@@ -13,15 +13,19 @@
|
|
13 |
<td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
|
14 |
</tr>
|
15 |
</table>
|
|
|
16 |
</div>
|
17 |
-
<div class="
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
<fieldset>
|
22 |
<ul class="note-list">
|
23 |
<?php $i = 0 ?>
|
24 |
-
<?php foreach ($this->
|
25 |
|
26 |
<li>
|
27 |
<strong><?php echo $_item['lb_vendor_code'] ?></strong>
|
@@ -33,10 +37,31 @@
|
|
33 |
<span class="separator">|</span>
|
34 |
<strong><?php echo $_item['failure'] ?> failed updates</strong>
|
35 |
<?php if(!empty($_item['ftp_error'])): ?>
|
36 |
-
<a href="
|
37 |
-
<div id="simplediv<?php echo $i ?>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
$rowData = (!is_null($_item['ftp_error_desc'])) ? $_item['ftp_error_desc'] : $_item['error_id'];
|
39 |
-
echo $this->parseDescription($rowData,$_item['lb_vendor_code']);
|
|
|
|
|
|
|
40 |
<?php endif; ?>
|
41 |
<span class="separator">|</span>
|
42 |
<strong> <?php echo $this->formatDate($_item['created_at'], 'medium', true); ?></strong>
|
@@ -54,10 +79,22 @@
|
|
54 |
</div>
|
55 |
|
56 |
<script type="text/javascript">
|
57 |
-
function
|
58 |
-
{
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
</script>
|
62 |
-
|
63 |
-
|
13 |
<td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
|
14 |
</tr>
|
15 |
</table>
|
16 |
+
|
17 |
</div>
|
18 |
+
<div class="supplier-pager">
|
19 |
+
<?php echo $this->getPagerHtml(); ?>
|
20 |
+
</div>
|
21 |
+
<div class="grid">
|
22 |
+
<div class="entry-edit" style="clear:both;">
|
23 |
+
<?php if(count($this->getCollection()) > 0 ): ?>
|
24 |
+
|
25 |
<fieldset>
|
26 |
<ul class="note-list">
|
27 |
<?php $i = 0 ?>
|
28 |
+
<?php foreach ($this->getCollection() as $_item): ?>
|
29 |
|
30 |
<li>
|
31 |
<strong><?php echo $_item['lb_vendor_code'] ?></strong>
|
37 |
<span class="separator">|</span>
|
38 |
<strong><?php echo $_item['failure'] ?> failed updates</strong>
|
39 |
<?php if(!empty($_item['ftp_error'])): ?>
|
40 |
+
<a href = "javascript:void(0)" onclick = "document.getElementById('simplediv<?php echo $i ?>').style.display='block';document.getElementById('fade').style.display='block';document.getElementById('simplediv<?php echo $i ?>').className='white_content active' "><strong><?php echo $_item['ftp_error'] ?> </strong></a>
|
41 |
+
<div id="simplediv<?php echo $i ?>" class="white_content">
|
42 |
+
<div>
|
43 |
+
<button title="Save Config" type="button" class="scalable save" onclick="setLocation('<?php echo Mage::helper('adminhtml')->getUrl('*/*/exportErrorCsv',array('vcode'=>$_item['lb_vendor_code'], 'vdate'=>$_item['created_at']))?>')" style="float:left"><span><span><span>Download</span></span></span></button>
|
44 |
+
<button title="Save Config" type="button" class="scalable save" onclick="document.getElementById('simplediv<?php echo $i ?>').style.display='none';document.getElementById('fade').style.display='none'" style="float:right"><span><span><span>Close</span></span></span></button>
|
45 |
+
</div>
|
46 |
+
<div class="clear"></div>
|
47 |
+
<div style="padding-top:10px">
|
48 |
+
<hr/>
|
49 |
+
<strong><?php echo $_item['lb_vendor_code'] ?></strong>
|
50 |
+
<span class="separator">|</span>
|
51 |
+
<strong><?php echo $_item['updated_by'] ?></strong>
|
52 |
+
<span class="separator">|</span>
|
53 |
+
<strong><?php echo $_item['success'] ?> successfully updates</strong>
|
54 |
+
<span class="separator">|</span>
|
55 |
+
<strong><?php echo $_item['failure'] ?> failed updates</strong>
|
56 |
+
<span class="separator">|</span>
|
57 |
+
<strong> <?php echo $this->formatDate($_item['created_at'], 'medium', true); ?></strong>
|
58 |
+
<hr/>
|
59 |
+
<?php
|
60 |
$rowData = (!is_null($_item['ftp_error_desc'])) ? $_item['ftp_error_desc'] : $_item['error_id'];
|
61 |
+
echo $this->parseDescription($rowData,$_item['lb_vendor_code']); ?>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<div id="fade" class="black_overlay"></div>
|
65 |
<?php endif; ?>
|
66 |
<span class="separator">|</span>
|
67 |
<strong> <?php echo $this->formatDate($_item['created_at'], 'medium', true); ?></strong>
|
79 |
</div>
|
80 |
|
81 |
<script type="text/javascript">
|
82 |
+
$(document).on('keyup',function(evt) {
|
83 |
+
if (evt.keyCode == 27) {
|
84 |
+
$$('.white_content.active').each(function(ele){
|
85 |
+
$(ele).removeClassName('active');
|
86 |
+
$(ele).addClassName('inactive');
|
87 |
+
$(ele.id).style.display='none';
|
88 |
+
document.getElementById('fade').style.display='none';
|
89 |
+
})
|
90 |
}
|
91 |
+
});
|
92 |
+
$('fade').observe('click', function(event) {
|
93 |
+
$$('.white_content.active').each(function(ele){
|
94 |
+
$(ele).removeClassName('active');
|
95 |
+
$(ele).addClassName('inactive');
|
96 |
+
$(ele.id).style.display='none';
|
97 |
+
document.getElementById('fade').style.display='none';
|
98 |
+
})
|
99 |
+
});
|
100 |
</script>
|
|
|
|
app/design/adminhtml/default/default/template/logicbroker/window.phtml
CHANGED
@@ -53,7 +53,7 @@
|
|
53 |
$('save_button').removeClassName('disabled');
|
54 |
return;
|
55 |
}
|
56 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
57 |
{
|
58 |
method:'get',
|
59 |
parameters: {user_id: '<?php echo $msg['user_id']?>',api_key:$('api_key').value },
|
53 |
$('save_button').removeClassName('disabled');
|
54 |
return;
|
55 |
}
|
56 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/logicbroker_sourcing/saveSoapApi') ?>',
|
57 |
{
|
58 |
method:'get',
|
59 |
parameters: {user_id: '<?php echo $msg['user_id']?>',api_key:$('api_key').value },
|
includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{InventoryController.php → Logicbroker/InventoryController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_InventoryController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{LogicbrokerController.php → Logicbroker/LogicbrokerController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_LogicbrokerController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
{app/code/community/Logicbroker/Dropship360/controllers/Adminhtml → includes/src/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/RankingController.php
RENAMED
@@ -6,7 +6,7 @@
|
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
-
class
|
10 |
|
11 |
protected function _initAction() {
|
12 |
$this->loadLayout ()->_setActiveMenu ( 'dropship360/vendor_ranking' )->_addBreadcrumb ( Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ), Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ) );
|
@@ -39,6 +39,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
39 |
|
40 |
public function addNewVendorAction() {
|
41 |
$isSuccess = false;
|
|
|
42 |
$data = $this->getRequest ()->getPost ();
|
43 |
$arrVendor = array();
|
44 |
$vendorRankCollection = Mage::getModel ( 'dropship360/ranking' );
|
@@ -55,7 +56,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
55 |
$code = 'MagVendID'.$suffix;
|
56 |
$vendorRankCollection->setLbVendorCode($code);
|
57 |
$vendorRankCollection->setRanking($data['rank']);
|
58 |
-
$vendorRankCollection->setLbVendorName($data['name']);
|
59 |
$vendorRankCollection->setLbVendorType('user');
|
60 |
$vendorRankCollection->setCreatedAt(now());
|
61 |
$vendorRankCollection->setUpdatedAt(now());
|
@@ -76,7 +77,7 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
76 |
public function saverankingAction() {
|
77 |
$vendorName = array();
|
78 |
$data = $this->getRequest ()->getPost ();
|
79 |
-
|
80 |
$tableName = $data['partent_save_table_input'];
|
81 |
$dropShip = json_decode((urldecode($data['dropship_data'])),true);
|
82 |
$nonDropShip = json_decode((urldecode($data['nondropship_data'])),true);
|
@@ -112,6 +113,11 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
112 |
Mage::getSingleton ( 'adminhtml/session' )->addSuccess ( Mage::helper ( 'dropship360' )->__ ( 'Supplier ranking saved successfully' ) );
|
113 |
$this->_redirect ( '*/*/' );
|
114 |
return;
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
protected function _saveVendorRanking($key, $val, $rank = false) {
|
117 |
try {
|
@@ -132,12 +138,14 @@ class Logicbroker_Dropship360_Adminhtml_RankingController extends Mage_Adminhtml
|
|
132 |
|
133 |
protected function _updateVendorName($val) {
|
134 |
try {
|
|
|
135 |
$model = Mage::getModel ( 'dropship360/ranking' )->load ( $val['code'], 'lb_vendor_code' );
|
136 |
if($model->getLbVendorCode())
|
137 |
-
$model->setLbVendorName ($val['name'])->save();
|
138 |
Mage::getModel ( 'dropship360/inventory' )->upDateVendorName($val);
|
139 |
} catch ( Exception $e ) {
|
140 |
-
Mage::
|
|
|
141 |
}
|
142 |
}
|
143 |
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_RankingController extends Mage_Adminhtml_Controller_Action {
|
10 |
|
11 |
protected function _initAction() {
|
12 |
$this->loadLayout ()->_setActiveMenu ( 'dropship360/vendor_ranking' )->_addBreadcrumb ( Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ), Mage::helper ( 'adminhtml' )->__ ( 'Supplier Management' ) );
|
39 |
|
40 |
public function addNewVendorAction() {
|
41 |
$isSuccess = false;
|
42 |
+
$helper = Mage::helper('dropship360');
|
43 |
$data = $this->getRequest ()->getPost ();
|
44 |
$arrVendor = array();
|
45 |
$vendorRankCollection = Mage::getModel ( 'dropship360/ranking' );
|
56 |
$code = 'MagVendID'.$suffix;
|
57 |
$vendorRankCollection->setLbVendorCode($code);
|
58 |
$vendorRankCollection->setRanking($data['rank']);
|
59 |
+
$vendorRankCollection->setLbVendorName($helper->convertToHtmlcode($data['name']));
|
60 |
$vendorRankCollection->setLbVendorType('user');
|
61 |
$vendorRankCollection->setCreatedAt(now());
|
62 |
$vendorRankCollection->setUpdatedAt(now());
|
77 |
public function saverankingAction() {
|
78 |
$vendorName = array();
|
79 |
$data = $this->getRequest ()->getPost ();
|
80 |
+
try{
|
81 |
$tableName = $data['partent_save_table_input'];
|
82 |
$dropShip = json_decode((urldecode($data['dropship_data'])),true);
|
83 |
$nonDropShip = json_decode((urldecode($data['nondropship_data'])),true);
|
113 |
Mage::getSingleton ( 'adminhtml/session' )->addSuccess ( Mage::helper ( 'dropship360' )->__ ( 'Supplier ranking saved successfully' ) );
|
114 |
$this->_redirect ( '*/*/' );
|
115 |
return;
|
116 |
+
}catch(Exception $e){
|
117 |
+
Mage::getSingleton ( 'adminhtml/session' )->addError ( $e->getMessage () );
|
118 |
+
$this->_redirect ( '*/*/' );
|
119 |
+
return;
|
120 |
+
}
|
121 |
}
|
122 |
protected function _saveVendorRanking($key, $val, $rank = false) {
|
123 |
try {
|
138 |
|
139 |
protected function _updateVendorName($val) {
|
140 |
try {
|
141 |
+
$helper = Mage::helper('dropship360');
|
142 |
$model = Mage::getModel ( 'dropship360/ranking' )->load ( $val['code'], 'lb_vendor_code' );
|
143 |
if($model->getLbVendorCode())
|
144 |
+
$model->setLbVendorName ($helper->convertToHtmlcode($val['name']))->save();
|
145 |
Mage::getModel ( 'dropship360/inventory' )->upDateVendorName($val);
|
146 |
} catch ( Exception $e ) {
|
147 |
+
Mage::throwException('Error occured while renaming vendor in ranking table : '.$e->getMessage());
|
148 |
+
//Mage::getSingleton ( 'adminhtml/session' )->addError ( $e->getMessage () );
|
149 |
}
|
150 |
}
|
151 |
|
{app/code/community/Logicbroker/Dropship360/controllers/Adminhtml → includes/src/Logicbroker/Dropship360/controllers/Adminhtml/Logicbroker}/ReportController.php
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_ReportController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{SourcingController.php → Logicbroker/SourcingController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
@@ -27,9 +27,9 @@ class Logicbroker_Dropship360_Adminhtml_SourcingController extends Mage_Adminhtm
|
|
27 |
*/
|
28 |
|
29 |
public function sourcinggridAction() {
|
30 |
-
$this->_initAction()
|
31 |
-
$this->getLayout()->createBlock('dropship360/
|
32 |
-
$this->
|
33 |
|
34 |
}
|
35 |
public function editAction() {
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_SourcingController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction() {
|
27 |
*/
|
28 |
|
29 |
public function sourcinggridAction() {
|
30 |
+
$this->_initAction(); //->_title($this->__('PO Management'));
|
31 |
+
$this->getLayout()->createBlock('dropship360/adminhtml_sourcing_pomanagment');
|
32 |
+
$this->renderLayout();
|
33 |
|
34 |
}
|
35 |
public function editAction() {
|
includes/src/Logicbroker/Dropship360/controllers/Adminhtml/{UploadController.php → Logicbroker/UploadController.php}
RENAMED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
@@ -41,10 +41,10 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
41 |
public function uploadFileAction()
|
42 |
{
|
43 |
$data = $this->getRequest()->getPost();
|
44 |
-
$productSetupMode = (
|
45 |
if($productSetupMode)
|
46 |
{
|
47 |
-
$redirectUrl = '*/
|
48 |
}
|
49 |
else
|
50 |
{
|
@@ -57,7 +57,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
57 |
}
|
58 |
if ($data) {
|
59 |
try {
|
60 |
-
$import = Mage::getModel('dropship360/
|
61 |
$validationResult = $import->setData($data)->uploadSource();
|
62 |
if(!$validationResult){
|
63 |
$this->initialize();
|
@@ -121,11 +121,21 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
121 |
public function validateftpconnectionAction()
|
122 |
{
|
123 |
$paramsArray = $this->getRequest()->getParams();
|
124 |
-
$
|
125 |
-
$
|
126 |
-
$result =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
Mage::app()->getResponse()->setBody($result);
|
128 |
-
|
129 |
}
|
130 |
|
131 |
public function saveAction()
|
@@ -214,7 +224,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
214 |
$isProductSetupMode = (isset($paramsArray['isproductsetupmode']) && $paramsArray['isproductsetupmode']) ? true : false;
|
215 |
$type = ($isProductSetupMode) ? 'setup' : 'upload';
|
216 |
$fileName = 'logicbroker_supplier_product_'.$type.'.csv';
|
217 |
-
$content = Mage::getModel('dropship360/
|
218 |
$this->_prepareDownloadResponse($fileName, $content);
|
219 |
$this->_redirect('*/*/index');
|
220 |
|
@@ -263,6 +273,7 @@ class Logicbroker_Dropship360_Adminhtml_UploadController extends Mage_Adminhtml_
|
|
263 |
}
|
264 |
foreach($rowIds as $sku){
|
265 |
$collection = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('product_sku',$sku)->addFieldToFilter('lb_vendor_code',$vendorCode);
|
|
|
266 |
$inventoryId = ($collection->getSize() > 0) ? $collection->getFirstItem()->getId() : '';
|
267 |
if(!$inventoryId)
|
268 |
{
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
|
10 |
+
class Logicbroker_Dropship360_Adminhtml_Logicbroker_UploadController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
|
13 |
protected function _initAction()
|
41 |
public function uploadFileAction()
|
42 |
{
|
43 |
$data = $this->getRequest()->getPost();
|
44 |
+
$productSetupMode = (array_key_exists('productsetupmode', $data)) ? $data['productsetupmode'] : 0;
|
45 |
if($productSetupMode)
|
46 |
{
|
47 |
+
$redirectUrl = '*/logicbroker_ranking/index';
|
48 |
}
|
49 |
else
|
50 |
{
|
57 |
}
|
58 |
if ($data) {
|
59 |
try {
|
60 |
+
$import = Mage::getModel('dropship360/import');
|
61 |
$validationResult = $import->setData($data)->uploadSource();
|
62 |
if(!$validationResult){
|
63 |
$this->initialize();
|
121 |
public function validateftpconnectionAction()
|
122 |
{
|
123 |
$paramsArray = $this->getRequest()->getParams();
|
124 |
+
$ftpdetails = $paramsArray['groups']['cron_settings_upload']['fields'];
|
125 |
+
$urlString = 'ftp://'.$ftpdetails['ftp_username']['value'].':'.$ftpdetails['ftp_password']['value'].'@'.$ftpdetails['ftp_site']['value'];
|
126 |
+
$result = array();
|
127 |
+
$validateConnection = Mage::getModel('dropship360/import_ftp');
|
128 |
+
try {
|
129 |
+
$validateConnection->connect($urlString);
|
130 |
+
$validateConnection->close();
|
131 |
+
$result = array('error'=>false,'message' => null);
|
132 |
+
$result = Mage::helper('core')->jsonEncode($result);
|
133 |
+
} catch (Exception $e) {
|
134 |
+
$result = array('error'=>true,'message' => $e->getMessage());
|
135 |
+
$result = Mage::helper('core')->jsonEncode($result);
|
136 |
+
}
|
137 |
+
|
138 |
Mage::app()->getResponse()->setBody($result);
|
|
|
139 |
}
|
140 |
|
141 |
public function saveAction()
|
224 |
$isProductSetupMode = (isset($paramsArray['isproductsetupmode']) && $paramsArray['isproductsetupmode']) ? true : false;
|
225 |
$type = ($isProductSetupMode) ? 'setup' : 'upload';
|
226 |
$fileName = 'logicbroker_supplier_product_'.$type.'.csv';
|
227 |
+
$content = Mage::getModel('dropship360/import')->getCsvFile($isProductSetupMode);
|
228 |
$this->_prepareDownloadResponse($fileName, $content);
|
229 |
$this->_redirect('*/*/index');
|
230 |
|
273 |
}
|
274 |
foreach($rowIds as $sku){
|
275 |
$collection = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('product_sku',$sku)->addFieldToFilter('lb_vendor_code',$vendorCode);
|
276 |
+
$collection->getSelect()->limit(1);
|
277 |
$inventoryId = ($collection->getSize() > 0) ? $collection->getFirstItem()->getId() : '';
|
278 |
if(!$inventoryId)
|
279 |
{
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab.php
CHANGED
@@ -28,7 +28,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab extends M
|
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
-
return $this->getUrl('
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
+
return $this->getUrl('adminhtml/logicbroker_inventory/vendors', array('_current' => true));
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory.php
CHANGED
@@ -28,7 +28,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory ex
|
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
-
return $this->getUrl('
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
28 |
}
|
29 |
public function getTabUrl()
|
30 |
{
|
31 |
+
return $this->getUrl('adminhtml/logicbroker_inventory/vendorshistory', array('_current' => true));
|
32 |
}
|
33 |
public function getTabClass()
|
34 |
{
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid.php
CHANGED
@@ -26,7 +26,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid extends Mage_Adminh
|
|
26 |
$collection = Mage::getModel('dropship360/inventory')->getCollection();
|
27 |
$collection->getSelect()->join(array('lbRanking'=>Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')),'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array('lb_vendor_name'));
|
28 |
$collection->getSelect()->joinLeft(array('prod' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),'prod.sku = main_table.product_sku',array('magento_pro_id'=>'entity_id'));
|
29 |
-
$collection->getSelect()->joinLeft(array('cpev' => Mage::getSingleton('core/resource')->getTableName('catalog/product').'_varchar'),'cpev.entity_id=prod.entity_id AND cpev.attribute_id='.$prodNameAttrId.'',array('product_name' => 'value'));
|
30 |
$collection->getSelect()->where('prod.entity_id IS NOT NULL');
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
26 |
$collection = Mage::getModel('dropship360/inventory')->getCollection();
|
27 |
$collection->getSelect()->join(array('lbRanking'=>Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')),'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array('lb_vendor_name'));
|
28 |
$collection->getSelect()->joinLeft(array('prod' => Mage::getSingleton('core/resource')->getTableName('catalog/product')),'prod.sku = main_table.product_sku',array('magento_pro_id'=>'entity_id'));
|
29 |
+
$collection->getSelect()->joinLeft(array('cpev' => Mage::getSingleton('core/resource')->getTableName('catalog/product').'_varchar'),'cpev.store_id = 0 AND cpev.entity_id=prod.entity_id AND cpev.attribute_id='.$prodNameAttrId.'',array('product_name' => 'value'));
|
30 |
$collection->getSelect()->where('prod.entity_id IS NOT NULL');
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Sourcing.php
CHANGED
@@ -22,6 +22,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Sourcing extends Mage_Adminhtml_Bl
|
|
22 |
|
23 |
$lbItemCollection = Mage::getModel('dropship360/orderitems')->getCollection()->addFieldTofilter('item_order_id',$item->getOrderId())->addFieldTofilter('sku',$item->getSku());
|
24 |
$lbItemCollection->getSelect()->joinLeft( array('lbr'=> Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')), "main_table.lb_vendor_code = lbr.lb_vendor_code",array("lbr.lb_vendor_name"));
|
|
|
25 |
return $lbItemCollection->getFirstItem ();
|
26 |
}
|
27 |
}
|
22 |
|
23 |
$lbItemCollection = Mage::getModel('dropship360/orderitems')->getCollection()->addFieldTofilter('item_order_id',$item->getOrderId())->addFieldTofilter('sku',$item->getSku());
|
24 |
$lbItemCollection->getSelect()->joinLeft( array('lbr'=> Mage::getSingleton('core/resource')->getTableName('dropship360/ranking')), "main_table.lb_vendor_code = lbr.lb_vendor_code",array("lbr.lb_vendor_name"));
|
25 |
+
$lbItemCollection->getSelect()->limit(1);
|
26 |
return $lbItemCollection->getFirstItem ();
|
27 |
}
|
28 |
}
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Pomanagment.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Poll manager grid
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Pomanagment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
35 |
+
{
|
36 |
+
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
$this->_controller = 'adminhtml_sourcing';
|
40 |
+
$this->_headerText = Mage::helper('poll')->__('PO Management');
|
41 |
+
$this->_blockGroup = 'dropship360';
|
42 |
+
//$this->_addButtonLabel = Mage::helper('poll')->__('Add New Poll');
|
43 |
+
parent::__construct();
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton.php
CHANGED
@@ -49,7 +49,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton
|
|
49 |
*/
|
50 |
public function getAjaxSyncUrl()
|
51 |
{
|
52 |
-
return $this->getUrl('
|
53 |
}
|
54 |
|
55 |
|
49 |
*/
|
50 |
public function getAjaxSyncUrl()
|
51 |
{
|
52 |
+
return $this->getUrl('adminhtml/logicbroker_upload/validateftpconnection');
|
53 |
}
|
54 |
|
55 |
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Upload.php
CHANGED
@@ -19,7 +19,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload extends Mage_Adminhtml_Bloc
|
|
19 |
));
|
20 |
$this->addButton('history',array(
|
21 |
'label' => 'History',
|
22 |
-
'onclick' => 'setLocation(\'' . $this->getUrl('*/
|
23 |
'class' => 'save',
|
24 |
));
|
25 |
parent::__construct();
|
@@ -105,6 +105,6 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload extends Mage_Adminhtml_Bloc
|
|
105 |
}
|
106 |
protected function getSetupUrl()
|
107 |
{
|
108 |
-
return $this->getUrl('*/
|
109 |
}
|
110 |
}
|
19 |
));
|
20 |
$this->addButton('history',array(
|
21 |
'label' => 'History',
|
22 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/logicbroker_upload/vendorsuploadhistory') .'\')',
|
23 |
'class' => 'save',
|
24 |
));
|
25 |
parent::__construct();
|
105 |
}
|
106 |
protected function getSetupUrl()
|
107 |
{
|
108 |
+
return $this->getUrl('*/logicbroker_upload/run');
|
109 |
}
|
110 |
}
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form.php
CHANGED
@@ -18,7 +18,7 @@ class Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form extends Mage_Admi
|
|
18 |
$isProductSetupMode = $this->getProductsetupmode();
|
19 |
$form = new Varien_Data_Form(array(
|
20 |
'id' => 'edit_form',
|
21 |
-
'action' => ($isProductSetupMode) ? $this->getUrl('*/
|
22 |
'method' => 'post',
|
23 |
'enctype' => 'multipart/form-data'
|
24 |
));
|
18 |
$isProductSetupMode = $this->getProductsetupmode();
|
19 |
$form = new Varien_Data_Form(array(
|
20 |
'id' => 'edit_form',
|
21 |
+
'action' => ($isProductSetupMode) ? $this->getUrl('*/logicbroker_upload/uploadFile') : $this->getUrl('*/*/uploadFile'),
|
22 |
'method' => 'post',
|
23 |
'enctype' => 'multipart/form-data'
|
24 |
));
|
includes/src/Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory.php
CHANGED
@@ -6,74 +6,95 @@
|
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
-
class Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory extends
|
10 |
{
|
11 |
-
|
12 |
-
protected $
|
13 |
-
|
14 |
-
|
15 |
-
'row_qty'=>'Bad Data for Qty at Row(s) row_num',
|
16 |
-
'row_cost'=>'Bad Data for Cost at Row(s) row_num',
|
17 |
-
'empty_file'=>'Sorry,we cant find the record to update inventory',
|
18 |
-
'inventory_update_error'=>'Error in updating magento product inventory, magento_sku',
|
19 |
-
'magento_sku_exists'=>'magento product sku not exist magento_sku',
|
20 |
-
'inventory_add_error'=>'Error in adding magento product inventory, magento_sku',
|
21 |
-
'combination_notexist'=>'Vendor Sku vendor_sku & Supplier code vendor_code combination does not exist',
|
22 |
-
'already_assigned'=>'Vendor sku vendor_sku is already been assigned for this vendor',
|
23 |
-
'duplicate_vendor_sku'=>'Vendor sku vendor_sku is duplicate in Magento Sku magento_sku for this supplier',
|
24 |
-
'combination_exist'=> 'Vendor sku vendor_sku or Supplier code vendor_code combination already present for Magento Sku magento_sku',
|
25 |
-
'data_notchnage'=> 'Cost & Qty for Vendor Sku vendor_sku & Supplier code vendor_code not changed',
|
26 |
-
'lb_upc_notexist'=> 'UPC attribute missing vendor_sku',
|
27 |
-
'lb_upc_multiple'=> 'Multiple Match found for UPC vendor_sku',
|
28 |
-
'lb_mnp_notexist'=> 'MNP attribute missing vendor_sku',
|
29 |
-
'lb_mnp_multiple'=> 'Multiple Match found for MNP vendor_sku',
|
30 |
-
'sku_multiple'=> 'Multiple Match found for SKU vendor_sku',
|
31 |
-
'attribute_notexist'=> 'Attribute assigned for Supplier code vendor_code does not exist for Vendor sku vendor_sku'
|
32 |
-
);
|
33 |
-
protected $_replace = array('magento_sku','vendor_sku','vendor_code');
|
34 |
public function __construct()
|
35 |
{
|
36 |
-
$
|
37 |
-
$this->
|
38 |
-
$this->_blockGroup = 'dropship360';
|
39 |
$this->_headerText = Mage::helper('dropship360')->__('Supplier Product Upload Log');
|
40 |
-
|
41 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
'label' => 'Back',
|
43 |
-
'onclick' => 'setLocation(\'' . $
|
44 |
'class' => 'back',
|
45 |
-
)
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$this->
|
50 |
-
|
|
|
|
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
public function getMessageArray(){
|
54 |
-
return
|
55 |
}
|
56 |
|
57 |
public function getReplaceValue(){
|
58 |
-
return
|
59 |
}
|
60 |
-
public function
|
61 |
|
62 |
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
63 |
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
public function getLogDescriptionCollection($error_id){
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
return $
|
77 |
}
|
78 |
|
79 |
public function parseDescription($data,$vendorCode){
|
@@ -109,34 +130,14 @@ protected $_replace = array('magento_sku','vendor_sku','vendor_code');
|
|
109 |
return '<li>'.$string.'</li>';
|
110 |
}
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
{
|
123 |
-
$decodedata[] = array_merge($dataTemp, $this->getDecodedJson($eachRow['description']));
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}else
|
127 |
-
{
|
128 |
-
$decodedata = $this->getDecodedJson($data);
|
129 |
-
}
|
130 |
-
return $decodedata;
|
131 |
-
}
|
132 |
-
protected function getDecodedJson($data)
|
133 |
-
{
|
134 |
-
if(empty($data) || !Mage::helper('dropship360')->isJson($data)){
|
135 |
-
return $data;
|
136 |
-
}
|
137 |
-
$data = trim($data,'"');
|
138 |
-
$data = trim($data,'\'');
|
139 |
-
$decodedata = Mage::helper('core')->jsonDecode($data);
|
140 |
-
return $decodedata;
|
141 |
-
}
|
142 |
}
|
6 |
* @category Community
|
7 |
* @package Logicbroker_Dropship360
|
8 |
*/
|
9 |
+
class Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory extends Mage_Core_Block_Template
|
10 |
{
|
11 |
+
protected $_message;
|
12 |
+
protected $_replace;
|
13 |
+
protected $_backButtonUrl;
|
14 |
+
protected $_headerText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function __construct()
|
16 |
{
|
17 |
+
$this->setBackButtonUrl();
|
18 |
+
$this->setMsgVariables();
|
|
|
19 |
$this->_headerText = Mage::helper('dropship360')->__('Supplier Product Upload Log');
|
20 |
+
parent::__construct();
|
21 |
+
$this->setCollection($this->_initCollection());
|
22 |
+
}
|
23 |
+
protected function setMsgVariables(){
|
24 |
+
$this->_message = $this->getMessageArray();
|
25 |
+
$this->_replace = $this->getReplaceValue();
|
26 |
+
}
|
27 |
+
protected function setBackButtonUrl()
|
28 |
+
{
|
29 |
+
$params = Mage::app()->getRequest()->getParams();
|
30 |
+
if(array_key_exists("p",$params) ||array_key_exists("limit",$params)){
|
31 |
+
$this->_backButtonUrl = Mage::getSingleton('adminhtml/session')->getBackButtonUrl();
|
32 |
+
}else
|
33 |
+
{
|
34 |
+
$this->_backButtonUrl = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer() : Mage::getUrl('*/*/');
|
35 |
+
Mage::getSingleton('adminhtml/session')->setBackButtonUrl( $this->_backButtonUrl);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getButtonsHtml()
|
40 |
+
{
|
41 |
+
$childId = 'back_button';
|
42 |
+
|
43 |
+
$data = array(
|
44 |
'label' => 'Back',
|
45 |
+
'onclick' => 'setLocation(\'' . $this->_backButtonUrl .'\')',
|
46 |
'class' => 'back',
|
47 |
+
);
|
48 |
+
$out = '';
|
49 |
+
$block = $this->getLayout()->createBlock('adminhtml/widget_button');
|
50 |
+
$this->setChild($childId, $block);
|
51 |
+
$child = $this->getChild($childId);
|
52 |
+
$child->setData($data);
|
53 |
+
$out = $this->getChildHtml($childId);
|
54 |
+
return $out;
|
55 |
}
|
56 |
+
|
57 |
+
|
58 |
+
public function getHeaderHtml()
|
59 |
+
{
|
60 |
+
return '<h3 class="header-adminhtml-ranking">' . $this->_headerText . '</h3>';
|
61 |
+
}
|
62 |
|
63 |
public function getMessageArray(){
|
64 |
+
return Mage::getModel('dropship360/inventorylog')->getMessageArray();
|
65 |
}
|
66 |
|
67 |
public function getReplaceValue(){
|
68 |
+
return Mage::getModel('dropship360/inventorylog')->getReplaceValue();
|
69 |
}
|
70 |
+
public function _initCollection(){
|
71 |
|
72 |
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
73 |
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
74 |
+
$collection = new Varien_Data_Collection_Db($conn);
|
75 |
+
$collection->setConnection($conn);
|
76 |
+
$collection->getSelect()->from($tableVendorImportLog)->order('created_at DESC');
|
77 |
+
return $collection;
|
78 |
}
|
79 |
|
80 |
+
protected function pager(){
|
81 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
|
82 |
+
$pager->setTemplate('logicbroker/html/pager.phtml');
|
83 |
+
$pager->setAvailableLimit(array(20=>20,50=>50,100=>100,200=>200));
|
84 |
+
$pager->setCollection($this->getCollection());
|
85 |
+
//$pager->setData('area','frontend');
|
86 |
+
$this->setChild('pager', $pager);
|
87 |
+
$this->getCollection()->load();
|
88 |
+
return $this;
|
89 |
+
|
90 |
+
}
|
91 |
public function getLogDescriptionCollection($error_id){
|
92 |
+
|
93 |
+
return Mage::getModel('dropship360/inventorylog')->getLogDescriptionCollection($error_id);
|
94 |
+
}
|
95 |
+
public function prepareRowData($data)
|
96 |
+
{
|
97 |
+
return Mage::getModel('dropship360/inventorylog')->prepareRowData($data);
|
98 |
}
|
99 |
|
100 |
public function parseDescription($data,$vendorCode){
|
130 |
return '<li>'.$string.'</li>';
|
131 |
}
|
132 |
|
133 |
+
protected function _prepareLayout()
|
134 |
+
{
|
135 |
+
parent::_prepareLayout();
|
136 |
+
$this->pager();
|
137 |
+
}
|
138 |
+
|
139 |
+
public function getPagerHtml()
|
140 |
+
{
|
141 |
+
return $this->getChildHtml('pager');
|
142 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
includes/src/Logicbroker_Dropship360_Helper_Data.php
CHANGED
@@ -17,12 +17,13 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
17 |
const LOGICBROKER_ITEM_STATUS_CANCELLED = 'Cancelled';
|
18 |
const LOGICBROKER_ITEM_STATUS_NO_DROPSHIP = 'No Dropship';
|
19 |
const LOGICBROKER_ITEM_STATUS_COMPLETED = 'Completed';
|
|
|
20 |
const LOGICBROKER_PRODUCT_LINK_UPC = 'UPC';
|
21 |
const LOGICBROKER_PRODUCT_LINK_MNP = 'Manufacturer Part Number';
|
22 |
const LOGICBROKER_PRODUCT_LINK_SKU = 'Magento Sku';
|
23 |
const LOGICBROKER_PRODUCT_LINK_NONE = 'None';
|
24 |
-
const LOGICBROKER_PRODUCT_LINK_CODE_UPC = '
|
25 |
-
const LOGICBROKER_PRODUCT_LINK_CODE_MNP = '
|
26 |
const LOGICBROKER_PRODUCT_LINK_CODE_SKU = 'sku';
|
27 |
protected $_maxtime = 60; // time in minutes
|
28 |
public function getConfigObject($nodeName = null)
|
@@ -32,7 +33,17 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
32 |
|
33 |
public function getItemStatuses()
|
34 |
{
|
35 |
-
return array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
|
@@ -60,6 +71,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
60 |
$product_collection = Mage::getResourceModel('catalog/product_collection');
|
61 |
$product_collection->getSelect()->join(Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item', 'e.entity_id ='.Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item.product_id');
|
62 |
$product_collection->getSelect()->where('e.sku = ' ."'" .$product_sku."'");
|
|
|
63 |
$product_collection_count = count($product_collection);
|
64 |
if($product_collection_count > 0)
|
65 |
{
|
@@ -254,7 +266,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
254 |
return array('error' => true);
|
255 |
}
|
256 |
$io = new Varien_Io_File();
|
257 |
-
$path = Mage::getBaseDir('var') . DS . 'export'
|
258 |
$name = md5(microtime());
|
259 |
$file = $path . DS . $name . '.csv';
|
260 |
$io->setAllowCreateFolders(true);
|
@@ -289,6 +301,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
289 |
unset($csv);
|
290 |
}
|
291 |
}
|
|
|
292 |
return array(
|
293 |
'type' => 'filename',
|
294 |
'value' => $file,
|
@@ -299,11 +312,11 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
299 |
}
|
300 |
public function prepareExportVaues($description,$vendorCode){
|
301 |
$csvData = array();
|
302 |
-
$decodedata = Mage::
|
303 |
if(!is_array($decodedata) || empty($decodedata))
|
304 |
return empty($decodedata) ? implode('',$decodedata) : $decodedata;
|
305 |
foreach($decodedata as $data){
|
306 |
-
$msgArray = Mage::
|
307 |
$msg = $msgArray[$data['error_type']];
|
308 |
if(is_array($data['value']) && !empty($data['value'])){
|
309 |
$csvData[] = array('magento_sku'=>$data['value']['magento_sku'],'vendor_sku'=>$data['value']['vendor_sku'],'cost'=>$data['value']['cost'],'qty'=>$data['value']['qty'],'reason'=> $this->genrateHtml($data['value'],$msg,$vendorCode));
|
@@ -314,7 +327,7 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
314 |
return $csvData;
|
315 |
}
|
316 |
public function genrateHtml($value,$msg,$vendorCode){
|
317 |
-
$replace = Mage::
|
318 |
$string = $msg;
|
319 |
$value['vendor_code'] = $vendorCode;
|
320 |
foreach($replace as $val){
|
@@ -420,4 +433,8 @@ class Logicbroker_Dropship360_Helper_Data extends Mage_Core_Helper_Abstract
|
|
420 |
$vendorRankModel = Mage::getSingleton('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
421 |
return $vendorRankModel->getLbVendorName();
|
422 |
}
|
|
|
|
|
|
|
|
|
423 |
}
|
17 |
const LOGICBROKER_ITEM_STATUS_CANCELLED = 'Cancelled';
|
18 |
const LOGICBROKER_ITEM_STATUS_NO_DROPSHIP = 'No Dropship';
|
19 |
const LOGICBROKER_ITEM_STATUS_COMPLETED = 'Completed';
|
20 |
+
const LOGICBROKER_ITEM_STATUS_ERROR = 'Error';
|
21 |
const LOGICBROKER_PRODUCT_LINK_UPC = 'UPC';
|
22 |
const LOGICBROKER_PRODUCT_LINK_MNP = 'Manufacturer Part Number';
|
23 |
const LOGICBROKER_PRODUCT_LINK_SKU = 'Magento Sku';
|
24 |
const LOGICBROKER_PRODUCT_LINK_NONE = 'None';
|
25 |
+
const LOGICBROKER_PRODUCT_LINK_CODE_UPC = 'upc';
|
26 |
+
const LOGICBROKER_PRODUCT_LINK_CODE_MNP = 'manufacturer_part_number';
|
27 |
const LOGICBROKER_PRODUCT_LINK_CODE_SKU = 'sku';
|
28 |
protected $_maxtime = 60; // time in minutes
|
29 |
public function getConfigObject($nodeName = null)
|
33 |
|
34 |
public function getItemStatuses()
|
35 |
{
|
36 |
+
return array (
|
37 |
+
self::LOGICBROKER_ITEM_STATUS_SOURCING,
|
38 |
+
self::LOGICBROKER_ITEM_STATUS_REPROCESS,
|
39 |
+
self::LOGICBROKER_ITEM_STATUS_BACKORDER,
|
40 |
+
self::LOGICBROKER_ITEM_STATUS_TRANSMITTING,
|
41 |
+
self::LOGICBROKER_ITEM_STATUS_SENT_TO_SUPPLIER,
|
42 |
+
self::LOGICBROKER_ITEM_STATUS_CANCELLED,
|
43 |
+
self::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP,
|
44 |
+
self::LOGICBROKER_ITEM_STATUS_COMPLETED,
|
45 |
+
self::LOGICBROKER_ITEM_STATUS_ERROR
|
46 |
+
);
|
47 |
}
|
48 |
|
49 |
|
71 |
$product_collection = Mage::getResourceModel('catalog/product_collection');
|
72 |
$product_collection->getSelect()->join(Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item', 'e.entity_id ='.Mage::getConfig()->getTablePrefix().'cataloginventory_stock_item.product_id');
|
73 |
$product_collection->getSelect()->where('e.sku = ' ."'" .$product_sku."'");
|
74 |
+
$product_collection->getSelect()->limit(1);
|
75 |
$product_collection_count = count($product_collection);
|
76 |
if($product_collection_count > 0)
|
77 |
{
|
266 |
return array('error' => true);
|
267 |
}
|
268 |
$io = new Varien_Io_File();
|
269 |
+
$path = Mage::getBaseDir('var') . DS . 'export';
|
270 |
$name = md5(microtime());
|
271 |
$file = $path . DS . $name . '.csv';
|
272 |
$io->setAllowCreateFolders(true);
|
301 |
unset($csv);
|
302 |
}
|
303 |
}
|
304 |
+
$io->streamClose();
|
305 |
return array(
|
306 |
'type' => 'filename',
|
307 |
'value' => $file,
|
312 |
}
|
313 |
public function prepareExportVaues($description,$vendorCode){
|
314 |
$csvData = array();
|
315 |
+
$decodedata = Mage::getModel('dropship360/inventorylog')->prepareRowData($description);
|
316 |
if(!is_array($decodedata) || empty($decodedata))
|
317 |
return empty($decodedata) ? implode('',$decodedata) : $decodedata;
|
318 |
foreach($decodedata as $data){
|
319 |
+
$msgArray = Mage::getModel('dropship360/inventorylog')->getMessageArray();
|
320 |
$msg = $msgArray[$data['error_type']];
|
321 |
if(is_array($data['value']) && !empty($data['value'])){
|
322 |
$csvData[] = array('magento_sku'=>$data['value']['magento_sku'],'vendor_sku'=>$data['value']['vendor_sku'],'cost'=>$data['value']['cost'],'qty'=>$data['value']['qty'],'reason'=> $this->genrateHtml($data['value'],$msg,$vendorCode));
|
327 |
return $csvData;
|
328 |
}
|
329 |
public function genrateHtml($value,$msg,$vendorCode){
|
330 |
+
$replace = Mage::getModel('dropship360/inventorylog')->getReplaceValue();
|
331 |
$string = $msg;
|
332 |
$value['vendor_code'] = $vendorCode;
|
333 |
foreach($replace as $val){
|
433 |
$vendorRankModel = Mage::getSingleton('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
434 |
return $vendorRankModel->getLbVendorName();
|
435 |
}
|
436 |
+
|
437 |
+
public function convertToHtmlcode($name){
|
438 |
+
return htmlentities($name,ENT_QUOTES,'ISO-8859-1');
|
439 |
+
}
|
440 |
}
|
includes/src/Logicbroker_Dropship360_Model_Csvparser.php
CHANGED
@@ -12,8 +12,8 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
12 |
protected $dbConnection;
|
13 |
protected $tableName;
|
14 |
protected $vendorObject;
|
15 |
-
protected $chunksize =
|
16 |
-
|
17 |
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
18 |
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
19 |
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
@@ -21,6 +21,7 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
21 |
protected $_indexVendorSku = 0;
|
22 |
protected $_indexStock = 1;
|
23 |
protected $_indexPrice = 2;
|
|
|
24 |
|
25 |
public function __construct(){
|
26 |
|
@@ -47,6 +48,9 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
47 |
return $result;
|
48 |
}
|
49 |
|
|
|
|
|
|
|
50 |
protected function checkFtpHeader($header)
|
51 |
{
|
52 |
if(count($header) == 4 )
|
@@ -57,37 +61,52 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
57 |
}
|
58 |
}
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
{
|
65 |
-
return $csvData;
|
66 |
-
}
|
67 |
$this->emptyTable();
|
68 |
-
$this->checkFtpHeader($
|
|
|
69 |
$insertQuery = $this->insertMultiple($csvData,$vendorCode);
|
70 |
-
if
|
71 |
-
|
72 |
-
|
73 |
}
|
74 |
else{
|
75 |
$parsedData = $csvData;
|
76 |
}
|
77 |
return $parsedData;
|
78 |
}
|
79 |
-
|
|
|
|
|
80 |
protected function insertMultiple($csvData,$vendorCode){
|
81 |
$connection = $this->dbConnection->getConnection ( 'core_write' );
|
82 |
$csvArray = array();
|
83 |
-
|
84 |
-
foreach($
|
85 |
-
{
|
86 |
-
foreach ($value as $key=>$data)
|
87 |
{
|
88 |
-
if
|
|
|
89 |
continue;
|
90 |
-
$csvArray[] = array('vendor_code'=>$vendorCode,'csv_vendor_sku'=>trim($data [$this->_indexVendorSku]),'csv_stock'=>$data [$this->_indexStock],'csv_price'=>$data [$this->_indexPrice]);
|
91 |
}
|
92 |
try {
|
93 |
$connection->insertOnDuplicate($this->tableName,$csvArray,array('csv_vendor_sku','csv_stock','csv_price'));
|
@@ -95,8 +114,6 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
95 |
Mage::log($e->getTrace(),null,'logicbroker_debug.log');
|
96 |
return false;
|
97 |
}
|
98 |
-
$csvArray = array();
|
99 |
-
}
|
100 |
return true;
|
101 |
}
|
102 |
|
@@ -113,27 +130,70 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
113 |
Mage::log($e->getMessage(), null, 'vendor_inventory_import_error.log');
|
114 |
return false;
|
115 |
}
|
116 |
-
|
117 |
}
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
}
|
134 |
-
return $chnagedValue;
|
135 |
}
|
136 |
-
|
137 |
public function emptyTable()
|
138 |
{
|
139 |
$write = $this->dbConnection->getConnection ( 'core_write' );
|
@@ -190,55 +250,7 @@ class Logicbroker_Dropship360_Model_Csvparser
|
|
190 |
->date($date, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
|
191 |
return $date;
|
192 |
}
|
193 |
-
|
194 |
-
{
|
195 |
-
$records = array();
|
196 |
-
foreach($csvData as $row => $csvRowData)
|
197 |
-
{
|
198 |
-
if($row == 0)
|
199 |
-
continue;
|
200 |
-
if(!$isProductSetupMode)
|
201 |
-
{
|
202 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
203 |
-
if(is_numeric($csvRowData[2])){
|
204 |
-
/* LBN - 935 change */
|
205 |
-
$magento_sku = Mage::getModel('dropship360/uploadvendor')->getMagentoSku($lb_vendor_code, trim($csvRowData[1]));
|
206 |
-
$csvqty = (!empty($magento_sku)) ? Mage::helper('dropship360')->getIsQtyDecimal($magento_sku,$csvRowData[2]) : $csvRowData[2];;
|
207 |
-
}
|
208 |
-
else
|
209 |
-
{
|
210 |
-
$csvqty = $csvRowData[2];
|
211 |
-
}
|
212 |
-
}
|
213 |
-
if(!$isProductSetupMode)
|
214 |
-
$records[$row] = array('vendor_sku'=>trim($csvRowData[1]),'qty'=>$csvqty ,'cost'=>$csvRowData[3],'lb_vendor_code'=>$lb_vendor_code);
|
215 |
-
else
|
216 |
-
$records[$row] = array('magento_sku'=>trim($csvRowData[0]),'vendor_sku'=>trim($csvRowData[1]),'qty'=>0 ,'cost'=>0,'lb_vendor_code'=>$lb_vendor_code);
|
217 |
-
}
|
218 |
-
return $records;
|
219 |
-
}
|
220 |
-
public function generateFtpCsvRow($csvData,$vendorCode)
|
221 |
-
{
|
222 |
-
$records = array();
|
223 |
-
foreach($csvData as $row => $csvRowData)
|
224 |
-
{
|
225 |
-
if($row == 0)
|
226 |
-
continue;
|
227 |
-
//patch for backwards compatible for ftp change lbn-1070
|
228 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
229 |
-
if(is_numeric($csvRowData[2]) || $csvRowData[2] > 0){
|
230 |
-
/* LBN - 935 change */
|
231 |
-
$magento_sku = Mage::getModel('dropship360/uploadvendor')->getMagentoSku($vendorCode, trim($csvRowData[1]));
|
232 |
-
(! empty ( $magento_sku )) ? $qty = Mage::helper ( 'dropship360' )->getIsQtyDecimal ( $magento_sku, $csvRowData [2] ) : $qty = $csvRowData [2];
|
233 |
-
/* End of LBN - 935 change */
|
234 |
-
}else{
|
235 |
-
$qty = $csvRowData[2];
|
236 |
-
}
|
237 |
-
$records[$row] = array('lb_vendor_code'=>$vendorCode,'vendor_sku'=>trim($csvRowData[1]),'qty'=>$qty ,'cost'=>$csvRowData[3]);
|
238 |
-
//$vendorCode = $csvRowData[0];
|
239 |
-
}
|
240 |
-
return $records;
|
241 |
-
}
|
242 |
public function isCsvFileEmpty()
|
243 |
{
|
244 |
return (count($this->getCsvRows()) > 0) ? false : true;
|
12 |
protected $dbConnection;
|
13 |
protected $tableName;
|
14 |
protected $vendorObject;
|
15 |
+
protected $chunksize = 100;
|
16 |
+
protected $_vendorCode;
|
17 |
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
18 |
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
19 |
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
21 |
protected $_indexVendorSku = 0;
|
22 |
protected $_indexStock = 1;
|
23 |
protected $_indexPrice = 2;
|
24 |
+
protected $_vendorName;
|
25 |
|
26 |
public function __construct(){
|
27 |
|
48 |
return $result;
|
49 |
}
|
50 |
|
51 |
+
/*
|
52 |
+
* check ftp backward compatibility header
|
53 |
+
*/
|
54 |
protected function checkFtpHeader($header)
|
55 |
{
|
56 |
if(count($header) == 4 )
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
/*
|
65 |
+
* set vendorCode and vendorName
|
66 |
+
*/
|
67 |
+
protected function setVendorDetails($vendorCode) {
|
68 |
+
if(isset($this->_vendorCode) && isset($this->_vendorAttribute))
|
69 |
+
return;
|
70 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
71 |
+
$this->_vendorCode = $vendorCode;
|
72 |
+
//$this->_vendorAttribute = $ranking->getLinkingAttribute();
|
73 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
74 |
+
}
|
75 |
+
/*
|
76 |
+
* @return array in following from
|
77 |
+
* @change_row => values has been chnaged
|
78 |
+
* @rel_not_exist => relation not exist in vendor inventory table
|
79 |
+
*/
|
80 |
+
public function getChangedValue($csvData,$vendorCode,$header = array()){
|
81 |
|
82 |
+
$parsedData = array();
|
83 |
+
$this->setVendorDetails($vendorCode);
|
|
|
|
|
|
|
84 |
$this->emptyTable();
|
85 |
+
$this->checkFtpHeader($header);
|
86 |
+
//insert csv data in csv_temp_table
|
87 |
$insertQuery = $this->insertMultiple($csvData,$vendorCode);
|
88 |
+
//if error than return orignal csvdata
|
89 |
+
if($insertQuery){
|
90 |
+
$parsedData = $this->prepareCsvjoin();
|
91 |
}
|
92 |
else{
|
93 |
$parsedData = $csvData;
|
94 |
}
|
95 |
return $parsedData;
|
96 |
}
|
97 |
+
/*
|
98 |
+
* Insert records in csv tmp table.
|
99 |
+
*/
|
100 |
protected function insertMultiple($csvData,$vendorCode){
|
101 |
$connection = $this->dbConnection->getConnection ( 'core_write' );
|
102 |
$csvArray = array();
|
103 |
+
|
104 |
+
foreach ($csvData as $key=>$data)
|
|
|
|
|
105 |
{
|
106 |
+
//if row is empty
|
107 |
+
if(count(array_filter($data, "strlen")) == 0 )
|
108 |
continue;
|
109 |
+
$csvArray[] = array('row_id'=>$key,'vendor_code'=>$vendorCode,'csv_vendor_sku'=>trim($data [$this->_indexVendorSku]),'csv_stock'=>$data [$this->_indexStock],'csv_price'=>$data [$this->_indexPrice]);
|
110 |
}
|
111 |
try {
|
112 |
$connection->insertOnDuplicate($this->tableName,$csvArray,array('csv_vendor_sku','csv_stock','csv_price'));
|
114 |
Mage::log($e->getTrace(),null,'logicbroker_debug.log');
|
115 |
return false;
|
116 |
}
|
|
|
|
|
117 |
return true;
|
118 |
}
|
119 |
|
130 |
Mage::log($e->getMessage(), null, 'vendor_inventory_import_error.log');
|
131 |
return false;
|
132 |
}
|
|
|
133 |
}
|
134 |
|
135 |
+
/*
|
136 |
+
* prepare CSV data with additional column along CSV are totalQty,isDecimal,sku,product_id
|
137 |
+
* @return array change_row,unchange_row,rel_not_exist
|
138 |
+
*/
|
139 |
+
protected function prepareCsvjoin(){
|
140 |
+
$changedValue =array();
|
141 |
+
//$changedValue[] = $header;
|
142 |
+
$helper = Mage::helper('dropship360');
|
143 |
+
$collection = $this->vendorObject->getCollection();
|
144 |
+
$stockItemTable = $helper->getTableName('cataloginventory/stock_item');
|
145 |
+
$catalogProductTable = $helper->getTableName('catalog/product');
|
146 |
+
$isDecimalQuery = '(select is_qty_decimal from '.$stockItemTable.' where product_id = catalog.entity_id) as is_decimal';
|
147 |
+
$qtyQuery = '(select IFNULL(SUM(stock),0) from '.$collection->getMainTable().' where product_sku = main_table.product_sku and lb_vendor_code != main_table.lb_vendor_code) as qty';
|
148 |
+
|
149 |
+
$collection->addFieldToSelect(array('lb_vendor_code','lb_vendor_sku','stock','cost','product_sku'));
|
150 |
+
$collection->getSelect()
|
151 |
+
->join(array('inventory'=>$this->tableName),'inventory.vendor_code = main_table.lb_vendor_code and inventory.csv_vendor_sku = main_table.lb_vendor_sku')
|
152 |
+
->where('inventory.csv_stock != main_table.stock or inventory.csv_price != main_table.cost');
|
153 |
+
$collection->getSelect()
|
154 |
+
->join(array('catalog'=>$catalogProductTable),'catalog.sku = main_table.product_sku',array('entity_id'));
|
155 |
+
$collection->getSelect()->columns($qtyQuery);
|
156 |
+
$collection->getSelect()->columns($isDecimalQuery);
|
157 |
+
|
158 |
+
if($collection->getSize() > 0 ){
|
159 |
+
foreach($collection as $data){
|
160 |
+
$csvArray[] = array('vendor_code'=>$data->getLbVendorCode(),'csv_vendor_sku'=>$data->getCsvVendorSku());
|
161 |
+
$stock = ($data->getIsDecimal() || !is_numeric($data->getCsvStock()) ) ? $data->getCsvStock() : floor($data->getCsvStock());
|
162 |
+
$changedValue['change_row'][$data->getRowId()] = array($data->getCsvVendorSku(),$stock,$data->getCsvPrice(),'row_id'=>$data->getRowId(),'magento_sku'=>$data->getProductSku(),'product_qty'=>$data->getQty(),'product_id'=>$data->getEntityId(),'vendor_id'=>$data->getId());
|
163 |
+
}
|
164 |
+
$dbobj = $this->dbConnection->getConnection('core_write');
|
165 |
+
$dbobj->insertOnDuplicate($this->tableName,$csvArray,array('is_processed'=>1));
|
166 |
+
$csvArray = array();
|
167 |
+
}
|
168 |
+
$this->addExtraCol($changedValue);
|
169 |
+
return $changedValue;
|
170 |
+
}
|
171 |
+
//adding extra col in array to minimize DB call
|
172 |
+
public function addExtraCol(&$changedValue){
|
173 |
+
$helper = Mage::helper('dropship360');
|
174 |
+
$inventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
175 |
+
$catalogProductTable = $helper->getTableName('catalog/product');
|
176 |
+
$connection = $this->dbConnection->getConnection('core_write');
|
177 |
+
$select = $connection->select()
|
178 |
+
->from(array('csvtmpdata' => $this->tableName))
|
179 |
+
->joinleft(
|
180 |
+
array('vendor_inventory' => $inventoryTable),
|
181 |
+
'csvtmpdata.vendor_code = vendor_inventory.lb_vendor_code and csvtmpdata.csv_vendor_sku = vendor_inventory.lb_vendor_sku',array('lb_vendor_code','lb_vendor_sku','stock','cost','product_sku'))
|
182 |
+
->joinleft(
|
183 |
+
array('catalogproduct'=>$catalogProductTable),
|
184 |
+
'catalogproduct.sku = vendor_inventory.product_sku',array('sku'))
|
185 |
+
->where('csvtmpdata.is_processed = ?',0);
|
186 |
+
$csvtmpdata = $connection->fetchAll($select);
|
187 |
+
if(count($csvtmpdata) > 0 ){
|
188 |
+
foreach($csvtmpdata as $data){
|
189 |
+
if($data['lb_vendor_code'] || $data['lb_vendor_sku']){
|
190 |
+
$changedValue['unchange_row'][$data['row_id']] = array($data['csv_vendor_sku'],$data[csv_stock],$data['csv_price'],'magento_sku'=>$data['product_sku'],'sku'=>$data['sku']);
|
191 |
+
}else{
|
192 |
+
$changedValue['rel_not_exist'][$data['row_id']] = array($data['csv_vendor_sku'],$data[csv_stock],$data['csv_price']);
|
193 |
+
}
|
194 |
}
|
195 |
}
|
|
|
196 |
}
|
|
|
197 |
public function emptyTable()
|
198 |
{
|
199 |
$write = $this->dbConnection->getConnection ( 'core_write' );
|
250 |
->date($date, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
|
251 |
return $date;
|
252 |
}
|
253 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
public function isCsvFileEmpty()
|
255 |
{
|
256 |
return (count($this->getCsvRows()) > 0) ? false : true;
|
includes/src/Logicbroker_Dropship360_Model_Import.php
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Import vendor inventory kick off from this file and on the basis of upload type
|
9 |
+
* objects are created.
|
10 |
+
* following oeprations are prefromed :
|
11 |
+
* 1. file and header validation
|
12 |
+
* 2. retrive and remove CSV file from local file system after completed import
|
13 |
+
* 3. Support all three upload type
|
14 |
+
*/
|
15 |
+
class Logicbroker_Dropship360_Model_Import extends Mage_Core_Model_Abstract {
|
16 |
+
const FIELD_NAME_SOURCE_FILE = 'import_file';
|
17 |
+
protected $_colNames;
|
18 |
+
protected $_rowData;
|
19 |
+
protected $_importType;
|
20 |
+
protected $_importObject;
|
21 |
+
protected $_fileObj;
|
22 |
+
protected function _construct() {
|
23 |
+
//$this->_init ( "dropship360/uploadvendor" );
|
24 |
+
$this->_fileObj = $this->fileObj();
|
25 |
+
}
|
26 |
+
|
27 |
+
// initialize variables
|
28 |
+
public function initCsvData($file) {
|
29 |
+
$csvObject = new Varien_File_Csv ();
|
30 |
+
$csvData = $csvObject->getData ( $file );
|
31 |
+
if($csvData)
|
32 |
+
$this->_colNames = $csvData [0];
|
33 |
+
$this->_rowData = $csvData;
|
34 |
+
}
|
35 |
+
/* prepare downloadable sample CSV file for user */
|
36 |
+
public function getCsvFile($isProductSetupMode = false)
|
37 |
+
{
|
38 |
+
$io = new Varien_Io_File();
|
39 |
+
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
|
40 |
+
$name = md5(microtime());
|
41 |
+
$file = $path . DS . $name;
|
42 |
+
$io->setAllowCreateFolders(true);
|
43 |
+
$io->open(array('path' => $path));
|
44 |
+
$io->streamOpen($file, 'w+');
|
45 |
+
$io->streamLock(true);
|
46 |
+
($isProductSetupMode) ? $io->streamWriteCsv(array('magento_sku','vendor_sku')) : $io->streamWriteCsv(array('vendor_sku','qty','cost'));
|
47 |
+
$io->streamUnlock();
|
48 |
+
$io->streamClose();
|
49 |
+
return array(
|
50 |
+
'type' => 'filename',
|
51 |
+
'value' => $file,
|
52 |
+
'rm' => true // can delete file after use
|
53 |
+
);
|
54 |
+
}
|
55 |
+
public function getDatabaseConnection() {
|
56 |
+
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
57 |
+
}
|
58 |
+
protected function _getSession() {
|
59 |
+
return Mage::getSingleton ( 'adminhtml/session' );
|
60 |
+
}
|
61 |
+
public function insertCronEntry($filename, $data = null) {
|
62 |
+
$uploadFile = Mage::getModel('dropship360/uploadvendor');
|
63 |
+
$uploadFile->setFileName ( $filename );
|
64 |
+
$uploadFile->setUpdatedBy ( 'manually' );
|
65 |
+
$uploadFile->setUpdatedAt ( now () );
|
66 |
+
$uploadFile->setLbVendorCode ( Mage::app ()->getRequest ()->getPost ( 'vendor' ) );
|
67 |
+
try {
|
68 |
+
$uploadFile->save ();
|
69 |
+
} catch ( Exception $e ) {
|
70 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( $e->getMessage () ) );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* Import working directory
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
public static function getWorkingDir() {
|
79 |
+
return Mage::getBaseDir ( 'var' ) . DS . 'logicbrokervendorproduct' . DS;
|
80 |
+
}
|
81 |
+
protected function setImportType() {
|
82 |
+
$type = ($this->getProductsetupmode ()) ? 'productsetup' : 'manualimport';
|
83 |
+
$this->_importType = $type;
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
public function getImportType() {
|
87 |
+
return $this->_importType;
|
88 |
+
}
|
89 |
+
public function uploadSource() {
|
90 |
+
$error = false;
|
91 |
+
$vendorCode = $this->getVendor ();
|
92 |
+
$this->setImportType ();
|
93 |
+
$entity = 'vendor_product_' . date ( 'ymdHis' );
|
94 |
+
$uploader = Mage::getModel ( 'core/file_uploader', self::FIELD_NAME_SOURCE_FILE );
|
95 |
+
$uploader->skipDbProcessing ( true );
|
96 |
+
$result = $uploader->save ( self::getWorkingDir () );
|
97 |
+
$extension = pathinfo ( $result ['file'], PATHINFO_EXTENSION );
|
98 |
+
$uploadedFile = $result ['path'] . $result ['file'];
|
99 |
+
$this->initCsvData ( $uploadedFile );
|
100 |
+
$error = $this->validateCsv ();
|
101 |
+
if ($error) {
|
102 |
+
$this->_fileObj->rm ( $uploadedFile );
|
103 |
+
$this->_getSession ()->addNotice ( Mage::helper ( 'dropship360' )->__ ( 'Please fix errors and re-upload file' ) );
|
104 |
+
return $error;
|
105 |
+
}
|
106 |
+
|
107 |
+
$sourceFile = self::getWorkingDir () . $entity;
|
108 |
+
|
109 |
+
$sourceFile .= '.' . strtolower ( $extension );
|
110 |
+
$fileName = $entity . '.' . strtolower ( $extension );
|
111 |
+
|
112 |
+
if (strtolower ( $uploadedFile ) != strtolower ( $sourceFile )) {
|
113 |
+
if ($this->_fileObj->fileExists( $sourceFile )) {
|
114 |
+
$this->_fileObj->rm ( $sourceFile );
|
115 |
+
}
|
116 |
+
|
117 |
+
if (! @rename($uploadedFile,$sourceFile )) {
|
118 |
+
Mage::throwException ( Mage::helper ( 'importexport' )->__ ( 'Source file moving failed' ) );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
Mage::register ( 'file_name', $fileName );
|
122 |
+
if (! $error)
|
123 |
+
$this->insertCronEntry ( $fileName );
|
124 |
+
|
125 |
+
return $error;
|
126 |
+
}
|
127 |
+
public function validateCsv() {
|
128 |
+
$isFailed = false;
|
129 |
+
// create object as per requested import type
|
130 |
+
$this->_importObject = Mage::getModel ( 'dropship360/import_' . $this->getImportType () );
|
131 |
+
|
132 |
+
//check for empty csv file
|
133 |
+
if(count($this->_rowData) <= 1){
|
134 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( 'CSV file is empty ') );
|
135 |
+
$isFailed = true;
|
136 |
+
}
|
137 |
+
// checks columns
|
138 |
+
elseif (!$this->_importObject->validateCsvHeader ( $this->_colNames ) || empty ( $this->_colNames ) ) {
|
139 |
+
$this->_getSession ()->addError ( Mage::helper ( 'dropship360' )->__ ( 'CSV header %s is invalid ', implode ( ',', $this->_colNames ) ) );
|
140 |
+
$isFailed = true;
|
141 |
+
}
|
142 |
+
return $isFailed;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Get Varien I/O File class object
|
147 |
+
*
|
148 |
+
* @return object
|
149 |
+
*/
|
150 |
+
protected function fileObj() {
|
151 |
+
$fileObj = new Varien_Io_File ();
|
152 |
+
return $fileObj;
|
153 |
+
}
|
154 |
+
|
155 |
+
public function parseCsv($fileName = null,$lb_vendor_code = null)
|
156 |
+
{
|
157 |
+
$uploadFile = Mage::getModel('dropship360/uploadvendor');
|
158 |
+
if(empty($fileName) || empty($lb_vendor_code)){
|
159 |
+
$this->_getSession()->addError($this->__('Required parameters are missing CSV file or Vendor-Code'));
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
unset($this->_rowData[0]);
|
163 |
+
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
164 |
+
$this->_importObject->startImport($this->_rowData,$lb_vendor_code);
|
165 |
+
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
166 |
+
try{
|
167 |
+
$updateFileStatus = $uploadFile->unsetData()->load($fileName,'file_name');
|
168 |
+
$updateFileStatus->setImportStatus('done');
|
169 |
+
$updateFileStatus->save();
|
170 |
+
}catch(Exception $e){
|
171 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
172 |
+
Mage::log($e->getMessage(), Zend_Log::ERR);
|
173 |
+
}
|
174 |
+
$file = self::getWorkingDir() . $fileName;
|
175 |
+
$this->fileObj()->rm($file);
|
176 |
+
return $this;
|
177 |
+
}
|
178 |
+
|
179 |
+
/*
|
180 |
+
*
|
181 |
+
* Ftp function call by observer from where program execution started
|
182 |
+
*
|
183 |
+
*/
|
184 |
+
public function ftpParseCsv(){
|
185 |
+
if(Mage::helper('dropship360')->isProcessRunning('bulk_assign')){
|
186 |
+
$message = 'Bulk product setup is currently running hence cannot run ftp import';
|
187 |
+
Mage::log($message, null, 'logicbroker_log_report.log');
|
188 |
+
return;
|
189 |
+
}
|
190 |
+
$ftpfileName = array();
|
191 |
+
$vendorFiles = array();
|
192 |
+
$ftpObj = Mage::getModel('dropship360/import_ftpimport');
|
193 |
+
if (!$ftpObj->isFtpUploadEnable()) {
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
try{
|
197 |
+
$ftpObj->connect(); // connect to FTP site
|
198 |
+
$vendorFiles = $ftpObj->downloadFiles(self::getWorkingDir()); // download and archive all FTP files
|
199 |
+
}catch (Exception $e){
|
200 |
+
$ftpObj->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' =>$e->getMessage(),'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
201 |
+
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
202 |
+
$valueArray = array (
|
203 |
+
'con_error'=>$e->getMessage(),
|
204 |
+
'magento_sku' => '',
|
205 |
+
'vendor_sku' => '',
|
206 |
+
'cost' => '',
|
207 |
+
'qty' => '',
|
208 |
+
);
|
209 |
+
$ftpObj->saveFtpHistoryError($valueArray,'connection_error','connection-error');
|
210 |
+
}
|
211 |
+
/*
|
212 |
+
* vendors files on FTP server return empty
|
213 |
+
* 1) vendor inventory folder empty
|
214 |
+
* 2) supplier vendor not set at supplier management screen
|
215 |
+
*/
|
216 |
+
if(empty($vendorFiles)){
|
217 |
+
Mage::log('Files not found on FTP server Or Supplier vendor not set', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
218 |
+
return $this;
|
219 |
+
}
|
220 |
+
|
221 |
+
/*
|
222 |
+
* start process files as per vendor.
|
223 |
+
*/
|
224 |
+
$ftpObj->initialize();
|
225 |
+
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
226 |
+
foreach($vendorFiles as $vendor=>$files){
|
227 |
+
$ftpObj->initVar($vendor);
|
228 |
+
foreach ($files as $filepath) {
|
229 |
+
try{
|
230 |
+
$ftpObj->initFtpCsvData($filepath);
|
231 |
+
$isInvalid = $ftpObj->validateFtpCsv($filepath);
|
232 |
+
if($isInvalid){
|
233 |
+
continue; // skip file for invalid header and empty file
|
234 |
+
}
|
235 |
+
$ftpObj->startImport($filepath,$vendor);
|
236 |
+
$ftpObj->resetVar();
|
237 |
+
$this->_fileObj->rm($filepath);
|
238 |
+
}catch (Exception $e){
|
239 |
+
$ftpObj->sendMail ( array (
|
240 |
+
'subject' => 'Exception occurred during FTP inventory import for supplier '.$vendor,
|
241 |
+
'message' => $filepath.'<br>'.$e->getMessage (),
|
242 |
+
'bcc' => trim ( Mage::helper ( 'dropship360' )->getConfigObject ( 'apiconfig/email/bcc' ) )
|
243 |
+
) );
|
244 |
+
Mage::log('FTP-'.$e->getMessage().'Description ##'.$vendor.' ## '.$filepath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
245 |
+
$ftpObj->resetVar();
|
246 |
+
continue;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
251 |
+
$ftpObj->finalize();
|
252 |
+
}
|
253 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Import_Base.php
ADDED
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Base file will contain comman functions which will used by vendor inventory import section i.e.
|
9 |
+
* @Manual Inventory Upload
|
10 |
+
* @Ftp Inventory Upload
|
11 |
+
* @Product Setup
|
12 |
+
* In some cases we have override Base class function to achive funcntioanlity of above section
|
13 |
+
*/
|
14 |
+
|
15 |
+
abstract class Logicbroker_Dropship360_Model_Import_Base
|
16 |
+
{
|
17 |
+
abstract public function validateCsvHeader($colNames);
|
18 |
+
protected $_vendorCode = '';
|
19 |
+
protected $_linkAttribute;
|
20 |
+
protected $_errorsCount = 0;
|
21 |
+
protected $_successCount = 0;
|
22 |
+
protected $_vendorInventory = array();
|
23 |
+
protected $_productInventory = array();
|
24 |
+
protected $_inlineLog = array();
|
25 |
+
protected $_historyLog = array();
|
26 |
+
protected $_csvParserObj;
|
27 |
+
protected $_chunkSize = 1000;
|
28 |
+
protected $_bufferStock ;
|
29 |
+
protected $_dbConnection;
|
30 |
+
protected $_updatedBy = '';
|
31 |
+
protected $_vendorName;
|
32 |
+
protected $_indexVendorSku = 0;
|
33 |
+
protected $_indexStock = 1;
|
34 |
+
protected $_indexPrice = 2;
|
35 |
+
protected $_historyErrorType = 'Missing/Bad Data';
|
36 |
+
protected $_manualCsvError = array();
|
37 |
+
|
38 |
+
public function initVar($vendorCode){
|
39 |
+
$this->_dbConnection = Mage::helper('dropship360')->getDatabaseConnection()->getConnection ( 'core_write' );
|
40 |
+
$this->_bufferStock = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
41 |
+
$this->_vendorCode = $vendorCode;
|
42 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
43 |
+
$this->_linkAttribute = $ranking->getLinkingAttribute();
|
44 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
45 |
+
$this->_updatedBy = Mage::getSingleton('admin/session')->getUser()->getUsername();
|
46 |
+
}
|
47 |
+
/*
|
48 |
+
* @return value from core_config_data
|
49 |
+
*/
|
50 |
+
protected function getConfigValue($path)
|
51 |
+
{
|
52 |
+
return Mage::getStoreConfig($path);
|
53 |
+
}
|
54 |
+
|
55 |
+
/*
|
56 |
+
* check if attribute assign to catalog_product
|
57 |
+
*/
|
58 |
+
protected function checkAttributeAval($attr,$object = null){
|
59 |
+
$isExist = false;
|
60 |
+
$attrEav = Mage::getResourceModel('catalog/eav_attribute')->loadByCode('catalog_product',$attr);
|
61 |
+
if ($attrEav->getId())
|
62 |
+
$isExist = true;
|
63 |
+
return $isExist;
|
64 |
+
}
|
65 |
+
|
66 |
+
/*
|
67 |
+
* @errorCode-type: history
|
68 |
+
* @history : log for upload history page
|
69 |
+
*/
|
70 |
+
public function addRowError($errorCode, $errorRowNum, $colName = array())
|
71 |
+
{
|
72 |
+
$colCount = count($colName);
|
73 |
+
$i = 0;
|
74 |
+
while ($i < $colCount) {
|
75 |
+
$this->_manualCsvError[$errorCode]['row_'.$colName[$i]][] = $errorRowNum + 1;
|
76 |
+
$i++;
|
77 |
+
}
|
78 |
+
$this->_errorsCount ++;
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
/* arry_filter function
|
83 |
+
*
|
84 |
+
*/
|
85 |
+
protected function validateGenerateProduct($product){
|
86 |
+
$isValid = true;
|
87 |
+
|
88 |
+
$helper = Mage::helper('dropship360');
|
89 |
+
if(!array_key_exists('magento_sku', $product))
|
90 |
+
{
|
91 |
+
$errorType = ($this->_linkAttribute == $helper::LOGICBROKER_PRODUCT_LINK_CODE_SKU) ? 'magento_sku_exists' : $this->_linkAttribute.'_notexist';
|
92 |
+
$data = array (
|
93 |
+
'magento_sku' => $product [$this->_indexVendorSku],
|
94 |
+
'qty' => $product [$this->_indexStock],
|
95 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
96 |
+
'cost' => $product [$this->_indexPrice]
|
97 |
+
);
|
98 |
+
$this->setLogError('history',$data,$errorType);
|
99 |
+
$isValid = false;
|
100 |
+
//$this->_errorsCount ++;
|
101 |
+
}elseif(count($product['product_id']) > 1 )
|
102 |
+
{
|
103 |
+
$data = array (
|
104 |
+
'magento_sku' => $product['magento_sku'],
|
105 |
+
'qty' => $product [$this->_indexStock],
|
106 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
107 |
+
'cost' => $product [$this->_indexPrice]
|
108 |
+
);
|
109 |
+
$this->setLogError('history',$data,$this->_linkAttribute.'_multiple');
|
110 |
+
|
111 |
+
$isValid = false;
|
112 |
+
//$this->_errorsCount ++;
|
113 |
+
}elseif($this->_checkDuplicateCombination(null,$product)){
|
114 |
+
$data = array (
|
115 |
+
'magento_sku' => $product['magento_sku'],
|
116 |
+
'qty' => $product [$this->_indexStock],
|
117 |
+
'vendor_sku' => $product [$this->_indexVendorSku],
|
118 |
+
'cost' => $product [$this->_indexPrice]
|
119 |
+
);
|
120 |
+
$this->setLogError('history',$data,'combination_exist');
|
121 |
+
$isValid = false;
|
122 |
+
}
|
123 |
+
else{
|
124 |
+
$isValid = $this->validate($product); //validating row values if all above cases passed
|
125 |
+
}
|
126 |
+
|
127 |
+
return $isValid;
|
128 |
+
}
|
129 |
+
/*
|
130 |
+
* prepare data for insert new relation in inventory table
|
131 |
+
*/
|
132 |
+
protected function prepareAddData(&$changedCsvData) {
|
133 |
+
$magentoSkuArray = array();
|
134 |
+
$helper = Mage::helper('dropship360');
|
135 |
+
$stockItemTable = $helper->getTableName('cataloginventory/stock_item');
|
136 |
+
$tableVendorInventory = $helper->getTableName('dropship360/inventory');
|
137 |
+
$collection = Mage::getMOdel('catalog/product')->getCollection();
|
138 |
+
$qtyQuery = '(select IFNULL(SUM(stock),0) from '.$tableVendorInventory.' where product_sku = e.sku and lb_vendor_code != "'.$this->_vendorCode.'") as qty';
|
139 |
+
$isDecimalQuery = '(select is_qty_decimal from '.$stockItemTable.' where product_id = e.entity_id) as is_decimal';
|
140 |
+
foreach($changedCsvData as $key=>$rowData){
|
141 |
+
($rowData[$this->_indexVendorSku]) ? $magentoSkuArray[] = $rowData[$this->_indexVendorSku] : '';
|
142 |
+
}
|
143 |
+
$collection->addAttributeToFilter($this->_linkAttribute,array('in'=>$magentoSkuArray));
|
144 |
+
$collection->getSelect()->columns($isDecimalQuery);
|
145 |
+
$collection->getSelect()->columns($qtyQuery);
|
146 |
+
if($collection->getSize() > 0){
|
147 |
+
foreach($changedCsvData as $rowNum => &$rowData){
|
148 |
+
foreach($collection as $data){
|
149 |
+
if($data->getData($this->_linkAttribute) == $rowData[$this->_indexVendorSku]){
|
150 |
+
$rowData[$this->_indexStock] = ($data->getIsDecimal() || !is_numeric($rowData[$this->_indexStock])) ? $rowData[$this->_indexStock] : floor($rowData[$this->_indexStock]);
|
151 |
+
$rowData['row_id'] = $rowNum;
|
152 |
+
$rowData['magento_sku'] = $data->getSku ();
|
153 |
+
$rowData['product_qty'] = $data->getQty ();
|
154 |
+
$rowData['product_id'][] = $data->getEntityId ();
|
155 |
+
continue;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
/*
|
163 |
+
* create new entry in inventory table and update product inventory
|
164 |
+
*/
|
165 |
+
protected function generateNonExistingRel($validRow ){
|
166 |
+
foreach($validRow as $rowNumber=>$rowData){
|
167 |
+
$this->_validateCostQty($rowNumber,$rowData,'Add');
|
168 |
+
if($isQtyVal = $this->prepareVendorInventory($rowData,'add')){//check if row have valid qty value.
|
169 |
+
$this->prepareProductInventory($rowData);
|
170 |
+
}
|
171 |
+
$this->_successCount++;
|
172 |
+
}
|
173 |
+
$this->saveProductInventory();
|
174 |
+
$this->insertVendorInventory();
|
175 |
+
$this->saveInlineLog();
|
176 |
+
}
|
177 |
+
/*
|
178 |
+
* insert vendor detail in vendor inventory table
|
179 |
+
*/
|
180 |
+
protected function insertVendorInventory(){
|
181 |
+
if($this->_vendorInventory):
|
182 |
+
|
183 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
184 |
+
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','lb_vendor_sku','stock','cost','created_at','updated_at');
|
185 |
+
|
186 |
+
try {
|
187 |
+
$this->_dbConnection->insertArray($vendorInventoryTable,$dbFields,$this->_vendorInventory);
|
188 |
+
|
189 |
+
$this->_vendorInventory = array();
|
190 |
+
} catch ( Exception $e ) {
|
191 |
+
Mage::throwException('Error in inserting vendor inventory : '.$e->getMessage());
|
192 |
+
}
|
193 |
+
endif;
|
194 |
+
}
|
195 |
+
/*
|
196 |
+
* @return data for operation
|
197 |
+
* 1) update
|
198 |
+
* 2) insert
|
199 |
+
*/
|
200 |
+
protected function getArray($unsetItem = null,$values,$opr){
|
201 |
+
if($opr == 'update'){
|
202 |
+
$cost = (array_key_exists('cost', $values)) ? $values['cost'] : '';
|
203 |
+
$stock = (array_key_exists('stock', $values)) ? $values['stock'] : '';
|
204 |
+
$array = array('stock'=>$stock,'cost'=>$cost,'updated_at'=>now());
|
205 |
+
if($unsetItem)
|
206 |
+
unset($array[$unsetItem]);
|
207 |
+
}else{
|
208 |
+
$array = array(
|
209 |
+
$this->_vendorCode, //0
|
210 |
+
$this->_vendorName, //1
|
211 |
+
$values ['magento_sku'],//2
|
212 |
+
$values['vendor_sku'],//3
|
213 |
+
$values['stock'],//4
|
214 |
+
$values['cost'],//5
|
215 |
+
now (),//6
|
216 |
+
now () //7
|
217 |
+
);
|
218 |
+
if($unsetItem == 'cost')
|
219 |
+
$array[5] = ''; //set cost
|
220 |
+
if($unsetItem == 'stock')
|
221 |
+
$array[4] = '';//set stock
|
222 |
+
if($unsetItem == 'stock_cost'){
|
223 |
+
$array[4] = ''; //set stock
|
224 |
+
$array[5] = ''; //set cost
|
225 |
+
}
|
226 |
+
}
|
227 |
+
return $array;
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
/*
|
232 |
+
* function used to update vendor inventory cost and qty
|
233 |
+
*/
|
234 |
+
|
235 |
+
protected function updateVendorInventory($changedCsvData){
|
236 |
+
$this->_filterRowData($changedCsvData['change_row']);
|
237 |
+
if($changedCsvData){
|
238 |
+
foreach($changedCsvData['change_row'] as $rowNumber=>$rowData){
|
239 |
+
$this->validateRowData($rowNumber,$rowData);
|
240 |
+
if($isQtyVal = $this->prepareVendorInventory($rowData))//check if row have valid qty value.
|
241 |
+
$this->prepareProductInventory($rowData);
|
242 |
+
}
|
243 |
+
$this->saveProductInventory();
|
244 |
+
$this->saveVendorInventory();
|
245 |
+
$this->saveInlineLog();
|
246 |
+
//$this->prepareLogHistory($changedCsvData);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
/*
|
251 |
+
* create new relation for vendor_sku,vendor_code,magento_sku
|
252 |
+
*/
|
253 |
+
protected function addVendorInventory($changedCsvData){
|
254 |
+
if(!$this->checkAttributeAval($this->_linkAttribute)){
|
255 |
+
$data = implode(';',array_keys($changedCsvData['rel_not_exist']));
|
256 |
+
$this->_manualCsvError['history']['attribute_notexist'][] = $data;
|
257 |
+
//$this->setLogError('history',$data,'attribute_notexist');
|
258 |
+
$this->_errorsCount = $this->_errorsCount + count($changedCsvData['rel_not_exist']);
|
259 |
+
return ;
|
260 |
+
}
|
261 |
+
$this->prepareAddData($changedCsvData['rel_not_exist']);
|
262 |
+
$validRow = array_filter($changedCsvData['rel_not_exist'],array($this,'validateGenerateProduct'));
|
263 |
+
$this->generateNonExistingRel($validRow);
|
264 |
+
}
|
265 |
+
|
266 |
+
/*
|
267 |
+
* remove rows which have invalid cost and Qty
|
268 |
+
* @ it will not remove row which have partial correct cost or qty
|
269 |
+
*/
|
270 |
+
protected function _filterRowData(&$changedCsvData) {
|
271 |
+
$changedCsvData = array_filter($changedCsvData,array($this,'validate'));
|
272 |
+
}
|
273 |
+
|
274 |
+
/* filter valid data
|
275 |
+
* csv row format
|
276 |
+
* $row[$this->_indexStock] = vendor_sku
|
277 |
+
* $row[1] = qty
|
278 |
+
* $row[2] = cost
|
279 |
+
*/
|
280 |
+
protected function validate($rowData,$key = null) {
|
281 |
+
$isValid = true;
|
282 |
+
$colName = array();
|
283 |
+
$errorCode = 'history';
|
284 |
+
|
285 |
+
// col vendor_sku value is empty
|
286 |
+
if(!isset($rowData[$this->_indexVendorSku])){
|
287 |
+
$isValid = false;
|
288 |
+
$colName[] = 'vendor_sku';
|
289 |
+
}
|
290 |
+
|
291 |
+
// col cost and qty value is non-numeric,-ve, #empty value allowed
|
292 |
+
if((!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0) && (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0)){
|
293 |
+
$isValid = false;
|
294 |
+
$colName[] = 'qty';
|
295 |
+
$colName[] = 'cost';
|
296 |
+
//for product details page inline error log
|
297 |
+
$logdesc = 'Ignore';
|
298 |
+
$this->addInlineLog('inline', $logdesc, $rowData);
|
299 |
+
|
300 |
+
|
301 |
+
}
|
302 |
+
(!$isValid) ? $this->addRowError($errorCode,$rowData['row_id'],$colName) : '';
|
303 |
+
return $isValid;
|
304 |
+
}
|
305 |
+
/*
|
306 |
+
* validating cost or qty for partial update
|
307 |
+
* @generating error for partial update
|
308 |
+
*/
|
309 |
+
protected function validateRowData($rowNumber,$rowData) {
|
310 |
+
$this->_validateCostQty($rowNumber,$rowData);
|
311 |
+
//$this->_validateMagentoSku($rowNumber,$rowData);
|
312 |
+
//$this->_checkCombination($rowNumber,$rowData);
|
313 |
+
}
|
314 |
+
|
315 |
+
/* filter valid data for partial update
|
316 |
+
* csv row format
|
317 |
+
* $rowData[0] = vendor_sku
|
318 |
+
* $rowData[1] = qty
|
319 |
+
* $rowData[2] = cost
|
320 |
+
*/
|
321 |
+
protected function _validateCostQty($rowNumber,$rowData,$type = 'Update') {
|
322 |
+
$ignoreData = array();
|
323 |
+
$errorCode = 'inline';
|
324 |
+
|
325 |
+
if((!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0) && (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0)){
|
326 |
+
$logdesc = 'Ignore';
|
327 |
+
}elseif(!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0){
|
328 |
+
$logdesc = 'Qty '.$type.', Cost Ignored';
|
329 |
+
}elseif(!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0){
|
330 |
+
$logdesc = 'Cost '.$type.', Qty Ignored';
|
331 |
+
}else{
|
332 |
+
$logdesc = $type;
|
333 |
+
}
|
334 |
+
$this->addInlineLog($errorCode, $logdesc, $rowData);
|
335 |
+
}
|
336 |
+
|
337 |
+
/* if duplicate entry find discard row
|
338 |
+
* csv row format
|
339 |
+
* $rowData[0] = vendor_sku
|
340 |
+
* $rowData[$this->_indexPrice] = qty
|
341 |
+
* $rowData[2] = cost
|
342 |
+
*/
|
343 |
+
protected function _checkDuplicateCombination($rowNumber = null,$rowData) {
|
344 |
+
$isDuplicate = false;
|
345 |
+
try {
|
346 |
+
if(array_key_exists('magento_sku', $rowData)){
|
347 |
+
$inventoryCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
348 |
+
$inventoryCollection->addFieldToFilter('product_sku',$rowData['magento_sku'])
|
349 |
+
->addFieldToFilter('lb_vendor_code',$this->_vendorCode);
|
350 |
+
$inventoryCollection->getSelect()->limit(1);
|
351 |
+
if($inventoryCollection->getSize() > 0){
|
352 |
+
$isDuplicate = true;
|
353 |
+
if(array_key_exists('productSetup', $rowData))
|
354 |
+
Mage::register('product_setup_vendor_id', $inventoryCollection->getFirstItem()->getId());
|
355 |
+
}
|
356 |
+
}
|
357 |
+
return $isDuplicate;
|
358 |
+
} catch (Exception $e) {
|
359 |
+
Mage::throwException('Error in checking duplicate vendor : '.$e->getMessage());
|
360 |
+
return;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
/*
|
365 |
+
* @var $_vendorInventory
|
366 |
+
* use to update cost and qty possible case
|
367 |
+
* invalid_qty : ignore qty and update cost
|
368 |
+
* invalid_cost : ignore cost and update qty
|
369 |
+
* both invalid : no update will perform
|
370 |
+
* both valid : update cost and qty
|
371 |
+
*/
|
372 |
+
protected function prepareVendorInventory($rowData,$opration = 'update') {
|
373 |
+
$isQtyVal = true;
|
374 |
+
$qty = (!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0 || trim($rowData[$this->_indexStock]) =='') ? 'invalid_qty' : $rowData[$this->_indexStock];
|
375 |
+
$cost = (!is_numeric($rowData[$this->_indexPrice]) || $rowData[$this->_indexPrice] < 0 || trim($rowData[$this->_indexPrice]) =='') ? 'invalid_cost' : $rowData[$this->_indexPrice];
|
376 |
+
$rowId = array_key_exists('vendor_id',$rowData) ? $rowData['vendor_id'] : null;
|
377 |
+
if((string)$qty == 'invalid_qty' && (string)$cost == 'invalid_cost'){
|
378 |
+
if($rowId)
|
379 |
+
$this->_vendorInventory[$rowId] = $this->getArray('stock_cost',null,'add');//no-update only insert
|
380 |
+
else
|
381 |
+
$this->_vendorInventory[] = $this->getArray('stock_cost',null,'add');//no-update only insert
|
382 |
+
$isQtyVal = false;
|
383 |
+
}elseif((string)$qty == 'invalid_qty'){
|
384 |
+
if($rowId)
|
385 |
+
$this->_vendorInventory[$rowId] = $this->getArray('stock',array('cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
386 |
+
else
|
387 |
+
$this->_vendorInventory[] = $this->getArray('stock',array('cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
388 |
+
$isQtyVal = false;
|
389 |
+
}elseif( (string)$cost == 'invalid_cost'){
|
390 |
+
$qty = $this->calculateQty($rowData);
|
391 |
+
if($rowId)
|
392 |
+
$this->_vendorInventory[$rowId] = $this->getArray('cost',array('stock'=>$qty,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
393 |
+
else
|
394 |
+
$this->_vendorInventory[] = $this->getArray('cost',array('stock'=>$qty,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
395 |
+
}else{
|
396 |
+
$qty = $this->calculateQty($rowData);
|
397 |
+
if($rowId)
|
398 |
+
$this->_vendorInventory[$rowId] = $this->getArray(null,array('stock'=>$qty,'cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
399 |
+
else
|
400 |
+
$this->_vendorInventory[] = $this->getArray(null,array('stock'=>$qty,'cost'=>$cost,'vendor_sku'=>$rowData[$this->_indexVendorSku],'magento_sku'=>$rowData['magento_sku']),$opration);
|
401 |
+
}
|
402 |
+
return $isQtyVal;
|
403 |
+
}
|
404 |
+
|
405 |
+
/*
|
406 |
+
* calculate vendor qty on the basis of buffer value
|
407 |
+
* calculate complete product qty including current vendor qty
|
408 |
+
*/
|
409 |
+
protected function calculateQty($rowData,$productQty = false){
|
410 |
+
$checkQty = (!is_numeric($rowData[$this->_indexStock]) || $rowData[$this->_indexStock] < 0 || trim($rowData[$this->_indexStock]) =='') ? 'invalid_qty' : $rowData[$this->_indexStock];
|
411 |
+
if($checkQty == 'invalid_qty')
|
412 |
+
return $rowData[$this->_indexStock];
|
413 |
+
|
414 |
+
$qty = 0;
|
415 |
+
if ($this->_bufferStock >= 0 && isset ( $this->_bufferStock )) {
|
416 |
+
$qty = (($uploadQty = $checkQty - $this->_bufferStock) < 0) ? 0 : $uploadQty;
|
417 |
+
} else {
|
418 |
+
$qty = $checkQty;
|
419 |
+
}
|
420 |
+
if ($productQty) {
|
421 |
+
$qty = $qty + $rowData ['product_qty'];
|
422 |
+
}
|
423 |
+
return $qty;
|
424 |
+
}
|
425 |
+
|
426 |
+
/*
|
427 |
+
* @var $_productInventory as array to do multiple update query for
|
428 |
+
* product inventory
|
429 |
+
*/
|
430 |
+
protected function prepareProductInventory($rowData){
|
431 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item');
|
432 |
+
$stockItem->loadByProduct($rowData['product_id']);
|
433 |
+
$existStockData = $stockItem->getData();
|
434 |
+
$existStockData['qty'] = $this->calculateQty($rowData,true);
|
435 |
+
$existStockData['is_in_stock'] = ($existStockData['qty']) ? 1 : 0;
|
436 |
+
unset($existStockData['type_id']);
|
437 |
+
unset($existStockData['stock_status_changed_automatically']);
|
438 |
+
unset($existStockData['use_config_enable_qty_increments']);
|
439 |
+
$this->_productInventory[] = $existStockData;
|
440 |
+
}
|
441 |
+
|
442 |
+
/*
|
443 |
+
* @var $_inlineLog as array contain error string for vendor inline log
|
444 |
+
* $log = array(0=>$activity,1=>$rowData)
|
445 |
+
*/
|
446 |
+
protected function prepareInlineLog(){
|
447 |
+
if (!array_key_exists('inline',$this->_manualCsvError)) {
|
448 |
+
return;
|
449 |
+
}
|
450 |
+
$inline = $this->_manualCsvError['inline'];
|
451 |
+
foreach($inline as $log){
|
452 |
+
$this->_inlineLog[] =
|
453 |
+
array (
|
454 |
+
$this->_vendorCode,
|
455 |
+
$this->_vendorName,
|
456 |
+
$log [1] ['magento_sku'] ,//magento_sku
|
457 |
+
$log [1] [$this->_indexPrice],//cost
|
458 |
+
$this->calculateQty($log[1]),//stock
|
459 |
+
$this->_updatedBy,//updateby
|
460 |
+
$log[0],//activity
|
461 |
+
now(),//created
|
462 |
+
now()//update
|
463 |
+
);
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
/*
|
468 |
+
* @var $_historyLog log array which will be displayed on vendor upload history
|
469 |
+
*/
|
470 |
+
protected function prepareLogHistory($changedCsvData = array()){
|
471 |
+
if (array_key_exists('history',$this->_manualCsvError)) {
|
472 |
+
$rowError = $this->_manualCsvError['history'];
|
473 |
+
foreach($rowError as $type=>$error){
|
474 |
+
$this->_historyLog [] = array (
|
475 |
+
'error_type' => $type,
|
476 |
+
'value' => is_array($error) ? implode(';',$error) : $error
|
477 |
+
);
|
478 |
+
}
|
479 |
+
//$this->_manualCsvError['history'] = array();
|
480 |
+
}
|
481 |
+
if (array_key_exists('unchange_row',$changedCsvData)){
|
482 |
+
$unchangedData = $changedCsvData['unchange_row'];
|
483 |
+
foreach ($unchangedData as $key=>$data){
|
484 |
+
$this->_errorsCount ++;
|
485 |
+
$this->_historyLog [] = array (
|
486 |
+
'error_type' => ($data['sku']) ? 'data_notchnage' : 'magento_sku_exists',
|
487 |
+
'value' => array (
|
488 |
+
'magento_sku' => $data ['magento_sku'],
|
489 |
+
'qty' => $data [$this->_indexStock],
|
490 |
+
'vendor_sku' => $data [$this->_indexVendorSku],
|
491 |
+
'cost' => $data [$this->_indexPrice]
|
492 |
+
)
|
493 |
+
);
|
494 |
+
|
495 |
+
}
|
496 |
+
}
|
497 |
+
if (array_key_exists('rel_not_exist',$changedCsvData)){
|
498 |
+
if(!isset($this->_linkAttribute)):
|
499 |
+
$relNotExist = $changedCsvData['rel_not_exist'];
|
500 |
+
foreach ($relNotExist as $key=>$data){
|
501 |
+
$this->_errorsCount ++;
|
502 |
+
$this->_historyLog [] = array (
|
503 |
+
'error_type' => 'combination_notexist',
|
504 |
+
'value' => array (
|
505 |
+
'magento_sku' => '',
|
506 |
+
'qty' => $data [$this->_indexStock],
|
507 |
+
'vendor_sku' => $data [$this->_indexVendorSku],
|
508 |
+
'cost' => $data [$this->_indexPrice]
|
509 |
+
)
|
510 |
+
);
|
511 |
+
|
512 |
+
}
|
513 |
+
endif;
|
514 |
+
}
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
+
/*
|
519 |
+
* save cost and qty for vendor
|
520 |
+
*/
|
521 |
+
protected function saveVendorInventory() {
|
522 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
523 |
+
foreach($this->_vendorInventory as $key=>$rowData){
|
524 |
+
try{
|
525 |
+
if(is_array($rowData)){
|
526 |
+
$this->_dbConnection->update($vendorInventoryTable,$rowData,array('id = ?'=>$key));
|
527 |
+
$this->_successCount++;
|
528 |
+
}
|
529 |
+
}catch (Exception $e){
|
530 |
+
Mage::throwException('Error in saving vendor inventory : '.$e->getMessage());
|
531 |
+
$this->_dbConnection->rollBack();
|
532 |
+
}
|
533 |
+
}
|
534 |
+
$this->_vendorInventory = array();
|
535 |
+
}
|
536 |
+
|
537 |
+
/*
|
538 |
+
* save product inventory for magento
|
539 |
+
*/
|
540 |
+
protected function saveProductInventory() {
|
541 |
+
try{
|
542 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('cataloginventory/stock_item');
|
543 |
+
if($this->_productInventory){
|
544 |
+
$this->_dbConnection->insertOnDuplicate($vendorInventoryTable,$this->_productInventory,array('qty','is_in_stock'));
|
545 |
+
$this->_productInventory = array();
|
546 |
+
}
|
547 |
+
}catch (Exception $e){
|
548 |
+
Mage::throwException('Error in saving product inventory : '.$e->getMessage());
|
549 |
+
$this->_dbConnection->rollBack();
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
/*
|
554 |
+
* save inline log available on product detail page
|
555 |
+
*/
|
556 |
+
protected function saveInlineLog() {
|
557 |
+
try{
|
558 |
+
$this->prepareInlineLog();
|
559 |
+
$tableVendorInventoryLog = Mage::helper('dropship360')->getTableName('dropship360/inventorylog');
|
560 |
+
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','cost','stock','updated_by','activity','updated_at','created_at');
|
561 |
+
if($this->_inlineLog){
|
562 |
+
$this->_dbConnection->insertArray($tableVendorInventoryLog,$dbFields,$this->_inlineLog);
|
563 |
+
$this->_inlineLog = array();
|
564 |
+
unset($this->_manualCsvError['inline']);
|
565 |
+
}
|
566 |
+
}catch (Exception $e){
|
567 |
+
Mage::throwException('Error in saving inline log : '.$e->getMessage());
|
568 |
+
$this->_dbConnection->rollBack();
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
/*
|
573 |
+
* save vendor complete csv upload error history
|
574 |
+
*/
|
575 |
+
protected function saveLogHistory() {
|
576 |
+
try{
|
577 |
+
$helper = Mage::helper('dropship360');
|
578 |
+
$tableVendorImportLog = $helper->getTableName('dropship360/vendor_import_log');
|
579 |
+
$tableVendorImportLogDesc = $helper->getTableName('dropship360/vendor_import_log_desc');
|
580 |
+
$errType = ($this->_errorsCount > 0) ? $this->_historyErrorType : '';
|
581 |
+
$success = $this->_successCount;
|
582 |
+
$failed = $this->_errorsCount;
|
583 |
+
$dbFields = array('lb_vendor_code','updated_by','success','failure','ftp_error','created_at');
|
584 |
+
$dbValue = array($this->_vendorCode,$this->_updatedBy,$success,$failed,$errType,now());
|
585 |
+
$this->_dbConnection->insertArray($tableVendorImportLog,$dbFields,array($dbValue));
|
586 |
+
$entityId = $this->_dbConnection->lastInsertId($tableVendorImportLog);
|
587 |
+
foreach($this->_historyLog as $data)
|
588 |
+
$this->_dbConnection->insertArray($tableVendorImportLogDesc,array('error_id','description'),array(array($entityId,Mage::helper('core')->jsonEncode($data))));
|
589 |
+
$this->_historyLog = array();
|
590 |
+
}catch (Exception $e){
|
591 |
+
Mage::throwException('Error in saving history log : '.$e->getMessage());
|
592 |
+
$this->_dbConnection->rollBack();
|
593 |
+
}
|
594 |
+
return $entityId;
|
595 |
+
}
|
596 |
+
/*
|
597 |
+
* @return data to be insert in vendor inventory history log
|
598 |
+
*/
|
599 |
+
protected function setLogError($errorCode,$data,$type) {
|
600 |
+
$this->_historyLog [] = array(
|
601 |
+
'error_type' => $type,
|
602 |
+
'value' => $data
|
603 |
+
);
|
604 |
+
$this->_errorsCount ++;
|
605 |
+
}
|
606 |
+
protected function setHistoryErrorType($type){
|
607 |
+
return $this->_historyErrorType = $type;
|
608 |
+
}
|
609 |
+
/*
|
610 |
+
* @errorCode-type: inline
|
611 |
+
* @inline : vendor inventory update log for product details page
|
612 |
+
*/
|
613 |
+
public function addInlineLog($errorCode, $logdesc,$rowData)
|
614 |
+
{
|
615 |
+
$this->_manualCsvError[$errorCode][] = array($logdesc,$rowData);
|
616 |
+
return $this;
|
617 |
+
}
|
618 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Import_Ftp.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* used by Ftp inventory upload for FTP opreations i.e.
|
9 |
+
* 1. archive file
|
10 |
+
* 2. upload file
|
11 |
+
* 3. connect ftp
|
12 |
+
* 4. downloadfiles
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Logicbroker_Dropship360_Model_Import_Ftp extends Mage_System_Ftp
|
16 |
+
{
|
17 |
+
protected $_ftp;
|
18 |
+
protected $_fileObj;
|
19 |
+
protected $_urlString;
|
20 |
+
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
21 |
+
const XML_PATH_UPLOAD_FTP_SITE = 'logicbroker_sourcing/cron_settings_upload/ftp_site';
|
22 |
+
const XML_PATH_UPLOAD_FTP_USERNAME = 'logicbroker_sourcing/cron_settings_upload/ftp_username';
|
23 |
+
const XML_PATH_UPLOAD_FTP_PASSWORD = 'logicbroker_sourcing/cron_settings_upload/ftp_password';
|
24 |
+
const XML_PATH_UPLOAD_FTP_TYPE = 'logicbroker_sourcing/cron_settings_upload/ftp_type';
|
25 |
+
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
26 |
+
|
27 |
+
|
28 |
+
public function __construct(){
|
29 |
+
$this->_fileObj = new Varien_Io_File();
|
30 |
+
$this->_fileObj->setAllowCreateFolders(true);
|
31 |
+
}
|
32 |
+
protected function getConfigValue($path)
|
33 |
+
{
|
34 |
+
return Mage::getStoreConfig($path);
|
35 |
+
}
|
36 |
+
|
37 |
+
public function connectftp(){
|
38 |
+
$urlString = $this->getUrlString();
|
39 |
+
$this->connect($urlString);
|
40 |
+
}
|
41 |
+
|
42 |
+
/*
|
43 |
+
* Connection string: ftp://user:pass@server:port/path
|
44 |
+
* user,pass,port,path are optional parts
|
45 |
+
*/
|
46 |
+
protected function getUrlString() {
|
47 |
+
if(!$this->_urlString){
|
48 |
+
$ftp_site = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_SITE);
|
49 |
+
$ftp_username = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_USERNAME);
|
50 |
+
$ftp_password = Mage::helper('core')->decrypt($this->getConfigValue(self::XML_PATH_UPLOAD_FTP_PASSWORD));
|
51 |
+
$ftp_type = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_TYPE);
|
52 |
+
$this->_urlString = 'ftp://'.$ftp_username.':'.$ftp_password.'@'.$ftp_site;
|
53 |
+
}
|
54 |
+
return $this->_urlString;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function downloadFiles($localpath,$vendorRanks){
|
58 |
+
|
59 |
+
$fileinfo = array();
|
60 |
+
foreach($vendorRanks as $vendorCode=>$serverpath){
|
61 |
+
$localPath = $this->getFiles($vendorCode,$serverpath,$localpath);
|
62 |
+
if(!empty($localPath)){
|
63 |
+
$fileinfo[$vendorCode] = $localPath;
|
64 |
+
//$this->archiveFiles($vendor);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
return $fileinfo;
|
68 |
+
}
|
69 |
+
protected function getFiles($vendorCode,$serverpath,$localpath) {
|
70 |
+
$this->createArchiveAndReportFolder($serverpath);
|
71 |
+
$files = $this->ls($serverpath);
|
72 |
+
$localfilepath = array();
|
73 |
+
$filterFiles = array_filter($files,array($this,'filterFiles'));
|
74 |
+
if($filterFiles){
|
75 |
+
$this->_fileObj->createDestinationDir($localpath.$serverpath);
|
76 |
+
foreach($filterFiles as $fileDetail){
|
77 |
+
if($this->download($serverpath.DS.$fileDetail['name'], $localpath.$serverpath.DS.$fileDetail['name'])){
|
78 |
+
$this->archiveFile($serverpath, $localpath, $fileDetail['name']);
|
79 |
+
$dateString = $fileDetail['rawdata'][5].$fileDetail['rawdata'][6].$fileDetail['rawdata'][7];
|
80 |
+
$dateString = strtotime($dateString);
|
81 |
+
if(array_key_exists($dateString,$localfilepath))
|
82 |
+
$dateString = rand(100,200) + $dateString;
|
83 |
+
$localfilepath[$dateString] = $localpath.$serverpath.DS.$fileDetail['name'];
|
84 |
+
}else{
|
85 |
+
Mage::log('Downloading failed for file : '.$serverpath.DS.$fileDetail['name'], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
86 |
+
}
|
87 |
+
}
|
88 |
+
ksort($localfilepath);
|
89 |
+
}
|
90 |
+
return array_values($localfilepath);
|
91 |
+
}
|
92 |
+
protected function filterFiles($files) {
|
93 |
+
return !$files['dir'];
|
94 |
+
}
|
95 |
+
protected function createArchiveAndReportFolder($serverpath){
|
96 |
+
$this->chdir($this->correctFilePath($serverpath));
|
97 |
+
$this->mdkir('Archive');
|
98 |
+
$this->mdkir('Reports');
|
99 |
+
$this->chdir('/');
|
100 |
+
}
|
101 |
+
protected function archiveFile($serverpath,$localpath,$filename) {
|
102 |
+
$path = $this->correctFilePath($serverpath.DS.'Archive'.DS.date("Y-m-d_H_i_s_").$filename);
|
103 |
+
if($this->upload($path,$localpath.$serverpath.DS.$filename)){
|
104 |
+
if($this->delete($serverpath.DS.$filename))
|
105 |
+
Mage::log('File deleted successfully : '.$serverpath.DS.$filename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
106 |
+
}else{
|
107 |
+
Mage::log('Failed to move file in archive folder : '.$path, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
public function uploadReport($file,$vendorCode) {
|
113 |
+
$this->connectftp();
|
114 |
+
$localPath = $file['value'];
|
115 |
+
$accountNumber = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER);
|
116 |
+
$serverPath = $accountNumber.'_'.$vendorCode.DS.'Inventory'.DS.'Reports';
|
117 |
+
$filename = 'report'.Mage::getModel('core/date')->date('Ymd-his').'.csv';
|
118 |
+
$correctServerPath = $this->correctFilePath($serverPath.DS.$filename);
|
119 |
+
if($this->upload($correctServerPath,$localPath)){
|
120 |
+
if($this->_fileObj->rm($file['value']))
|
121 |
+
Mage::log('Report file deleted successfully : '.$localPath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
122 |
+
}else{
|
123 |
+
Mage::log('Failed to move file in reports folder : '.$correctServerPath, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Import_Ftpimport.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* ftp vendor inventory import
|
9 |
+
* product attribute used upc,manufacturer_part_number,sku for insert new relation
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Ftpimport extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $_ftp;
|
15 |
+
protected $ftpCSVFormatbacward = array('vendor_code','vendor_sku','qty','cost');
|
16 |
+
protected $_colNamesFtp;
|
17 |
+
protected $_rowDataFtp;
|
18 |
+
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
19 |
+
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
20 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
21 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
22 |
+
|
23 |
+
public function __construct(){
|
24 |
+
$this->_ftp = Mage::getModel('dropship360/import_ftp');
|
25 |
+
$this->_dbConnection = Mage::helper('dropship360')->getDatabaseConnection()->getConnection ( 'core_write' );
|
26 |
+
}
|
27 |
+
|
28 |
+
/*
|
29 |
+
* initialize variable used during file execution
|
30 |
+
*/
|
31 |
+
public function initVar($vendorCode){
|
32 |
+
$this->_bufferStock = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
33 |
+
$this->_vendorCode = $vendorCode;
|
34 |
+
$ranking = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
35 |
+
$this->_linkAttribute = $ranking->getLinkingAttribute();
|
36 |
+
$this->_vendorName = $ranking->getLbVendorName();
|
37 |
+
$this->_updatedBy = 'FTP';
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* validate FTP file header
|
43 |
+
*/
|
44 |
+
public function validateCsvHeader($colNamesFtp){
|
45 |
+
$headerValidation = true;
|
46 |
+
$result = array_diff($colNamesFtp,$this->ftpCSVFormatbacward);
|
47 |
+
if(count($result) > 0 ){
|
48 |
+
if(!in_array('vendor_code',$result))
|
49 |
+
$headerValidation = false;
|
50 |
+
}
|
51 |
+
return $headerValidation;
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
* connect to FTP site
|
56 |
+
*/
|
57 |
+
public function connect(){
|
58 |
+
$this->_ftp->connectftp();
|
59 |
+
}
|
60 |
+
/*
|
61 |
+
* send email in following cases
|
62 |
+
* 1) FTP connection failure
|
63 |
+
* 2) bad file header
|
64 |
+
* 3) invalid row data
|
65 |
+
*/
|
66 |
+
public function sendMail($mailData = array()){
|
67 |
+
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED)) {
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
$mailData['datetime'] = Mage::getModel('core/date')->date();
|
71 |
+
$postObject = new Varien_Object();
|
72 |
+
$postObject->setData($mailData);
|
73 |
+
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
74 |
+
$templateId = 'logicbroker_ftp_con_fail';
|
75 |
+
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId);
|
76 |
+
if(!$isMailSent)
|
77 |
+
Mage::log('Notification email not sent :'.$email, null, 'logicbroker_debug.log');
|
78 |
+
}
|
79 |
+
/*
|
80 |
+
* check FTP inventory upload enable from DS360 configuration page
|
81 |
+
*/
|
82 |
+
public function isFtpUploadEnable() {
|
83 |
+
return Mage::getStoreConfigFlag ( self::XML_PATH_UPLOAD_ENABLED );
|
84 |
+
}
|
85 |
+
|
86 |
+
/*
|
87 |
+
* Inventory file process start
|
88 |
+
*/
|
89 |
+
public function startImport($file,$vendorCode){
|
90 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
91 |
+
//$changedCsvData = array();
|
92 |
+
unset($this->_rowDataFtp[0]);
|
93 |
+
//$this->checkFtpHeader($this->_colNamesFtp);
|
94 |
+
$csvData = $this->_rowDataFtp;
|
95 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
96 |
+
foreach($sliceCsv as $slicedData){
|
97 |
+
/* @var $changedCsvData
|
98 |
+
* filter CSV row as we need to process only those records
|
99 |
+
* which are present in our inventory table
|
100 |
+
*/
|
101 |
+
$changedCsvData = $this->_csvParserObj->getChangedValue($slicedData,$vendorCode,$this->_colNamesFtp);
|
102 |
+
//condition used for update existing relation in logicbroker_inventory_table
|
103 |
+
if(array_key_exists('change_row',$changedCsvData)){
|
104 |
+
$this->updateVendorInventory($changedCsvData);
|
105 |
+
}
|
106 |
+
//condition used for add new relation in logicbroker_inventory_table according to attribute selected
|
107 |
+
if(array_key_exists('rel_not_exist',$changedCsvData) && $this->_linkAttribute){
|
108 |
+
$this->addVendorInventory($changedCsvData);
|
109 |
+
}
|
110 |
+
$this->prepareLogHistory($changedCsvData);
|
111 |
+
$this->_manualCsvError = array();
|
112 |
+
$changedCsvData = array();
|
113 |
+
}
|
114 |
+
$logHistory = $this->_historyLog;
|
115 |
+
$errorId = $this->saveLogHistory();
|
116 |
+
/*
|
117 |
+
* send email if their is invalid row data
|
118 |
+
*/
|
119 |
+
if($this->_errorsCount > 0){
|
120 |
+
$reportFile = Mage::helper ( 'dropship360' )->generateErrorList ( array (
|
121 |
+
'failure' => count($this->_errorsCount),
|
122 |
+
'lb_vendor_code' => $vendorCode,
|
123 |
+
'error_id' => $errorId,
|
124 |
+
'ftp_error_desc'=>null
|
125 |
+
), true );
|
126 |
+
if(!$reportFile['error'])
|
127 |
+
$this->_ftp->uploadReport($reportFile,$vendorCode);
|
128 |
+
$serverPath = explode('logicbrokervendorproduct',$file);
|
129 |
+
$this->sendMail ( array (
|
130 |
+
'isfailed' => true,
|
131 |
+
'vendor_code' => $vendorCode,
|
132 |
+
'subject' => 'dropship360 failed to update inventory',
|
133 |
+
'message' => 'Missing/Bad data, check CSV data at following FTP path <br>' . $serverPath [1]
|
134 |
+
) );
|
135 |
+
}
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
/*
|
139 |
+
* download all FTP files for each vendor
|
140 |
+
* @return files array
|
141 |
+
* array[vendor_code] = array(file_path)
|
142 |
+
*/
|
143 |
+
public function downloadFiles($localpath){
|
144 |
+
$files = array();
|
145 |
+
$vendorRanks = $this->getVendorRankCollection();
|
146 |
+
if(!empty($vendorRanks)){
|
147 |
+
$files = $this->_ftp->downloadFiles($localpath,$vendorRanks);
|
148 |
+
}
|
149 |
+
return $files;
|
150 |
+
}
|
151 |
+
/*
|
152 |
+
* @return active vendors and inventory folder path
|
153 |
+
*/
|
154 |
+
protected function getVendorRankCollection() {
|
155 |
+
$rankCollection = Mage::getModel('dropship360/ranking')->getCollection()
|
156 |
+
->addFieldToFilter('is_dropship','yes');
|
157 |
+
$vendorRank = array();
|
158 |
+
$accountNumber = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER);
|
159 |
+
if($rankCollection->getSize() > 0){
|
160 |
+
foreach($rankCollection as $vendor){
|
161 |
+
$path = $accountNumber.'_'.$vendor->getLbVendorCode().DS.'Inventory';
|
162 |
+
$vendorRank[$vendor->getLbVendorCode()] = $path;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $vendorRank;
|
166 |
+
}
|
167 |
+
/*
|
168 |
+
* @var $this->_colNamesFtp : CSV header
|
169 |
+
* @var $this->_rowDataFtp : CSV rows
|
170 |
+
*/
|
171 |
+
public function initFtpCsvData($file){
|
172 |
+
$csvObject = new Varien_File_Csv ();
|
173 |
+
$csvData = $csvObject->getData ( $file );
|
174 |
+
if($csvData)
|
175 |
+
$this->_colNamesFtp = $csvData [0];
|
176 |
+
$this->_rowDataFtp = $csvData;
|
177 |
+
return $this;
|
178 |
+
}
|
179 |
+
/*
|
180 |
+
* validate csv file before start import process
|
181 |
+
*/
|
182 |
+
public function validateFtpCsv($file) {
|
183 |
+
$isFailed = false;
|
184 |
+
|
185 |
+
//check for empty csv file
|
186 |
+
if(count($this->_rowDataFtp) <= 1){
|
187 |
+
$this->saveFtpHistoryError('','empty_file','Bad File');
|
188 |
+
$isFailed = true;
|
189 |
+
}
|
190 |
+
// checks columns
|
191 |
+
elseif (!$this->validateCsvHeader ( $this->_colNamesFtp ) || empty ( $this->_colNamesFtp ) ) {
|
192 |
+
$serverPath = explode('logicbrokervendorproduct',$file);
|
193 |
+
$valueArray = array (
|
194 |
+
'file_name' => str_replace(DS,'#',$serverPath[1]),
|
195 |
+
'magento_sku' => '',
|
196 |
+
'vendor_sku' => '',
|
197 |
+
'cost' => '',
|
198 |
+
'qty' => '',
|
199 |
+
);
|
200 |
+
$this->saveFtpHistoryError($valueArray,'ftp_bad_header','Bad File header');
|
201 |
+
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$this->_vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Bad File header,Check header format at following FTP path '.$serverPath[1]));
|
202 |
+
Mage::log('Please check header format for file :'.$serverPath[1], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
203 |
+
$isFailed = true;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $isFailed;
|
207 |
+
}
|
208 |
+
/*
|
209 |
+
* before process next FTP file reset global variable
|
210 |
+
*/
|
211 |
+
public function resetVar() {
|
212 |
+
$this->_errorsCount = 0;
|
213 |
+
$this->_successCount = 0;
|
214 |
+
$this->_colNamesFtp = array();
|
215 |
+
$this->_rowDataFtp = array();
|
216 |
+
$this->_historyErrorType = 'Missing/Bad Data';
|
217 |
+
|
218 |
+
}
|
219 |
+
/*
|
220 |
+
* set and save History log forcefully and
|
221 |
+
*/
|
222 |
+
public function saveFtpHistoryError($message,$msgtype,$historyType){
|
223 |
+
$this->_updatedBy = 'FTP';
|
224 |
+
$this->setLogError('history',$message,$msgtype);
|
225 |
+
$this->setHistoryErrorType($historyType);
|
226 |
+
$this->saveLogHistory();
|
227 |
+
$this->resetVar();
|
228 |
+
return;
|
229 |
+
}
|
230 |
+
public function initialize(){
|
231 |
+
Mage::helper('dropship360')->startProcess('manual_upload');
|
232 |
+
Mage::log('Ftp upload started', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
233 |
+
}
|
234 |
+
|
235 |
+
public function finalize(){
|
236 |
+
Mage::helper('dropship360')->finishProcess('manual_upload');
|
237 |
+
Mage::log('Ftp upload finished', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Import_Manualimport.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Manual vendor inventory import
|
9 |
+
* product attribute used upc,manufacturer_part_number,sku for insert new relation
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Manualimport extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
15 |
+
protected $_csvParserObj;
|
16 |
+
protected $_chunkSize = 1000;
|
17 |
+
|
18 |
+
public function validateCsvHeader($colNames){
|
19 |
+
$headerValidation = true;
|
20 |
+
$result = array_diff($colNames,$this->manualCSVFormat);
|
21 |
+
if(count($result) > 0){
|
22 |
+
$headerValidation = false;
|
23 |
+
}
|
24 |
+
return $headerValidation;
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
public function startImport($csvData,$vendorCode){
|
29 |
+
$this->initVar($vendorCode);
|
30 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
31 |
+
//$changedCsvData = array();
|
32 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
33 |
+
foreach($sliceCsv as $slicedData){
|
34 |
+
/* @var $changedCsvData
|
35 |
+
* filter CSV row as we need to process only those records
|
36 |
+
* which are present in our inventory table
|
37 |
+
*/
|
38 |
+
$historyLogBefore = $this->_historyLog;
|
39 |
+
try {
|
40 |
+
$changedCsvData = $this->_csvParserObj->getChangedValue($slicedData,$vendorCode);
|
41 |
+
//condition used for update existing relation in logicbroker_inventory_table
|
42 |
+
if(array_key_exists('change_row',$changedCsvData)){
|
43 |
+
$this->updateVendorInventory($changedCsvData);
|
44 |
+
}
|
45 |
+
//condition used for add new relation in logicbroker_inventory_table according to attribute selected
|
46 |
+
if(array_key_exists('rel_not_exist',$changedCsvData) && $this->_linkAttribute){
|
47 |
+
$this->addVendorInventory($changedCsvData);
|
48 |
+
}
|
49 |
+
$this->prepareLogHistory($changedCsvData);
|
50 |
+
$this->_manualCsvError = array();
|
51 |
+
$changedCsvData = array();
|
52 |
+
} catch (Exception $e) {
|
53 |
+
$this->_historyLog = $historyLogBefore;
|
54 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
55 |
+
Mage::log('error in import :'.$e->getMessage(), null, 'logicbroker_manual_vendor_inventory_import.log');
|
56 |
+
continue;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
$this->saveLogHistory();
|
60 |
+
}
|
61 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Import_Productsetup.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Logicbroker
|
5 |
+
*
|
6 |
+
* @category Community
|
7 |
+
* @package Logicbroker_Dropship360
|
8 |
+
* Product setup with default cost = "" and price = ""
|
9 |
+
* generate new relation between VSKU,VC and MSKU if already exists than ignore
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Logicbroker_Dropship360_Model_Import_Productsetup extends Logicbroker_Dropship360_Model_Import_Base
|
13 |
+
{
|
14 |
+
protected $productSetupCSVFormat = array('magento_sku','vendor_sku');
|
15 |
+
protected $_indexMagentoSku = 0;
|
16 |
+
protected $_indexVendorSku = 1;
|
17 |
+
protected $_newVendorSkuForProductSetup = array();
|
18 |
+
/*
|
19 |
+
* $_vendorSkuArray is used to store vendorSku this array
|
20 |
+
* should contain unique array value if not throw error
|
21 |
+
* @csv_productsetup_test_case - csv file has same vendor sku
|
22 |
+
*
|
23 |
+
*/
|
24 |
+
protected $_vendorSkuArray = array();
|
25 |
+
|
26 |
+
public function validateCsvHeader($colNames)
|
27 |
+
{
|
28 |
+
$headerValidation = true;
|
29 |
+
$result = array_diff($colNames,$this->productSetupCSVFormat);
|
30 |
+
if(count($result) > 0){
|
31 |
+
$headerValidation = false;
|
32 |
+
}
|
33 |
+
return $headerValidation;
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
public function startImport($csvData,$vendorCode){
|
38 |
+
$this->initVar($vendorCode);
|
39 |
+
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
40 |
+
//$changedCsvData = array();
|
41 |
+
$sliceCsv = array_chunk($csvData, $this->_chunkSize,true);
|
42 |
+
foreach($sliceCsv as $slicedData){
|
43 |
+
/* @var $changedCsvData
|
44 |
+
* filter CSV row as we need to process only those records
|
45 |
+
* which are present in our inventory table
|
46 |
+
*/
|
47 |
+
$historyLogBefore = $this->_historyLog;
|
48 |
+
try {
|
49 |
+
$slicedData = $this->_filterRowData($slicedData);
|
50 |
+
foreach($slicedData as $row){
|
51 |
+
$validationStatus = $this->isVendorRelExists($row);
|
52 |
+
if(!$validationStatus){
|
53 |
+
$this->addVendorInventory($row);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$this->updateVendorSkuForProductSetup();
|
57 |
+
$this->insertVendorInventory();
|
58 |
+
$this->saveInlineLog();
|
59 |
+
$this->prepareLogHistory();
|
60 |
+
$this->_manualCsvError = array();
|
61 |
+
|
62 |
+
} catch (Exception $e) {
|
63 |
+
$this->_historyLog = $historyLogBefore;
|
64 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
65 |
+
Mage::log('error in import :'.$e->getMessage(), null, 'logicbroker_manual_vendor_inventory_import.log');
|
66 |
+
continue;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
$this->saveLogHistory();
|
70 |
+
}
|
71 |
+
|
72 |
+
/* filter valid data
|
73 |
+
* csv row format
|
74 |
+
* $row[$this->_indexStock] = vendor_sku
|
75 |
+
* $row[1] = qty
|
76 |
+
* $row[2] = cost
|
77 |
+
*/
|
78 |
+
protected function validate($rowData,$key = null) {
|
79 |
+
$isValid = true;
|
80 |
+
$colName = array();
|
81 |
+
$errorCode = 'history';
|
82 |
+
|
83 |
+
// col magento_sku value is empty
|
84 |
+
if(empty($rowData[$this->_indexMagentoSku])){
|
85 |
+
$isValid = false;
|
86 |
+
$colName[] = 'magento_sku';
|
87 |
+
}
|
88 |
+
|
89 |
+
// col vendor_sku value is empty
|
90 |
+
if(empty($rowData[$this->_indexVendorSku])){
|
91 |
+
$isValid = false;
|
92 |
+
$colName[] = 'vendor_sku';
|
93 |
+
}
|
94 |
+
|
95 |
+
(!$isValid) ? $this->addRowError($errorCode,$key,$colName) : '';
|
96 |
+
return $isValid;
|
97 |
+
}
|
98 |
+
/*
|
99 |
+
* remove rows which have invalid cost and Qty
|
100 |
+
* @ it will not remove row which have partial correct cost or qty
|
101 |
+
*/
|
102 |
+
protected function _filterRowData($slicedData) {
|
103 |
+
$changedCsvData = array();
|
104 |
+
foreach($slicedData as $key=>$row){
|
105 |
+
if(!$this->validate($row,$key))
|
106 |
+
continue;
|
107 |
+
$changedCsvData[$key] = $row;
|
108 |
+
}
|
109 |
+
return $changedCsvData;
|
110 |
+
}
|
111 |
+
protected function isVendorRelExists($row){
|
112 |
+
$isRelFound = false;
|
113 |
+
//check if magento sku exists
|
114 |
+
if(!Mage::getModel('catalog/product')->getIdBySku(trim($row[$this->_indexMagentoSku]))){
|
115 |
+
$isRelFound = true;//log error relation already exists
|
116 |
+
$data = array (
|
117 |
+
'magento_sku' =>$row[$this->_indexMagentoSku],
|
118 |
+
'qty' => '',
|
119 |
+
'vendor_sku' =>$row[$this->_indexVendorSku],
|
120 |
+
'cost' => ''
|
121 |
+
);
|
122 |
+
$this->setLogError('history', $data, 'magento_sku_exists');
|
123 |
+
return $isRelFound;
|
124 |
+
}
|
125 |
+
|
126 |
+
if($this->checkVCVSMSUnique($row)){
|
127 |
+
return $isRelFound = true;
|
128 |
+
}
|
129 |
+
|
130 |
+
if($this->checkVCVSUnique($row)){
|
131 |
+
return $isRelFound = true;
|
132 |
+
}
|
133 |
+
|
134 |
+
if(count($this->_vendorSkuArray) > 0 && in_array($row[$this->_indexVendorSku],$this->_vendorSkuArray )){
|
135 |
+
$isRelFound = true;//log error relation already exists
|
136 |
+
$data = array('vendor_sku'=>$row[$this->_indexVendorSku]);
|
137 |
+
$this->setLogError('history', $data, 'already_assigned');
|
138 |
+
return $isRelFound;
|
139 |
+
}else{
|
140 |
+
$this->_vendorSkuArray[] = $row[$this->_indexVendorSku];
|
141 |
+
}
|
142 |
+
/*
|
143 |
+
* check magento_sku has already assigned vendorCode
|
144 |
+
* in this case we need to update vendor_sku before updating
|
145 |
+
* we need to check vendorCode and vendorSku should have unique
|
146 |
+
* combination in logicbroker_vendor_inventory table
|
147 |
+
*/
|
148 |
+
$rowData = array('magento_sku'=>$row[$this->_indexMagentoSku],'productSetup'=>true);
|
149 |
+
if($this->_checkDuplicateCombination(null,$rowData)){
|
150 |
+
$errorCode = 'inline';
|
151 |
+
$data = array (
|
152 |
+
'magento_sku' => $row[$this->_indexMagentoSku],
|
153 |
+
$this->_indexStock => '',
|
154 |
+
$this->_indexPrice => ''
|
155 |
+
);
|
156 |
+
$this->addInlineLog($errorCode, 'Product Setup - vendor sku updated', $data);
|
157 |
+
$this->_newVendorSkuForProductSetup [Mage::registry ( 'product_setup_vendor_id' )] = array (
|
158 |
+
'lb_vendor_sku' => $row[$this->_indexVendorSku],
|
159 |
+
'updated_at' => now()
|
160 |
+
);
|
161 |
+
Mage::unregister('product_setup_vendor_id');
|
162 |
+
return $isRelFound = true;
|
163 |
+
}
|
164 |
+
|
165 |
+
return $isRelFound;
|
166 |
+
}
|
167 |
+
//check lb_vendor_code && lb_vendor_sku && magento_sku is not duplicate
|
168 |
+
protected function checkVCVSMSUnique($row){
|
169 |
+
$isRelFound = false;
|
170 |
+
$vendorCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
171 |
+
$vendorCollection->addFieldToFilter('lb_vendor_code',$this->_vendorCode)
|
172 |
+
->addFieldToFilter('product_sku',$row[$this->_indexMagentoSku])
|
173 |
+
->addFieldToFilter('lb_vendor_sku',$row[$this->_indexVendorSku]);
|
174 |
+
if($vendorCollection->getSize() > 0){
|
175 |
+
$isRelFound = true;//log error relation already exists
|
176 |
+
$data = array (
|
177 |
+
'vendor_sku' => $row [$this->_indexVendorSku],
|
178 |
+
'vendor_code' => $this->_vendorCode,
|
179 |
+
'magento_sku' => $row [$this->_indexMagentoSku]
|
180 |
+
);
|
181 |
+
$this->setLogError('history', $data, 'combination_exist');
|
182 |
+
return $isRelFound;
|
183 |
+
}
|
184 |
+
return $isRelFound;
|
185 |
+
|
186 |
+
}
|
187 |
+
//check lb_vendor_code && lb_vendor_sku is unique
|
188 |
+
//
|
189 |
+
protected function checkVCVSUnique($row){
|
190 |
+
$isRelFound = false;
|
191 |
+
$vendorCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
192 |
+
$vendorCollection->addFieldToFilter('lb_vendor_code',$this->_vendorCode)
|
193 |
+
->addFieldToFilter('lb_vendor_sku',$row[$this->_indexVendorSku]);
|
194 |
+
if($vendorCollection->getSize() > 0){
|
195 |
+
$isRelFound = true;//log error relation already exists
|
196 |
+
$data = array('vendor_sku'=>$row[$this->_indexVendorSku]);
|
197 |
+
$this->setLogError('history', $data, 'already_assigned');
|
198 |
+
return $isRelFound;
|
199 |
+
}
|
200 |
+
return $isRelFound;
|
201 |
+
}
|
202 |
+
protected function addVendorInventory($rowData){
|
203 |
+
$errorCode = 'inline';
|
204 |
+
$this->prepareVendorInventory($rowData,'add');
|
205 |
+
$data = array (
|
206 |
+
'magento_sku' => $rowData [$this->_indexMagentoSku],
|
207 |
+
$this->_indexStock => '',
|
208 |
+
$this->_indexPrice => ''
|
209 |
+
);
|
210 |
+
$this->addInlineLog($errorCode, 'Product Setup', $data);
|
211 |
+
}
|
212 |
+
|
213 |
+
/*
|
214 |
+
* @var $_vendorInventory
|
215 |
+
* use to update cost and qty possible case
|
216 |
+
* invalid_qty : ignore qty and update cost
|
217 |
+
* invalid_cost : ignore cost and update qty
|
218 |
+
* both invalid : no update will perform
|
219 |
+
* both valid : update cost and qty
|
220 |
+
*/
|
221 |
+
protected function prepareVendorInventory($rowData) {
|
222 |
+
$this->_vendorInventory [] = array($this->_vendorCode, //VC
|
223 |
+
$this->_vendorName, //VN
|
224 |
+
$rowData [$this->_indexMagentoSku],//MSKU
|
225 |
+
$rowData[$this->_indexVendorSku],//VSKU
|
226 |
+
'',//stock
|
227 |
+
'',//cost
|
228 |
+
now (),//Create
|
229 |
+
now () //update
|
230 |
+
);
|
231 |
+
$this->_successCount++;
|
232 |
+
}
|
233 |
+
|
234 |
+
protected function updateVendorSkuForProductSetup(){
|
235 |
+
$vendorInventoryTable = Mage::helper('dropship360')->getTableName('dropship360/inventory');
|
236 |
+
foreach($this->_newVendorSkuForProductSetup as $key=>$rowData){
|
237 |
+
try{
|
238 |
+
if(is_array($rowData)){
|
239 |
+
$this->_dbConnection->update($vendorInventoryTable,$rowData,array('id = ?'=>$key));
|
240 |
+
$this->_successCount++;
|
241 |
+
}
|
242 |
+
}catch (Exception $e){
|
243 |
+
Mage::throwException('Error in updating vendor sku for product setup : '.$e->getMessage());
|
244 |
+
$this->_dbConnection->rollBack();
|
245 |
+
}
|
246 |
+
}
|
247 |
+
$this->_newVendorSkuForProductSetup = array();
|
248 |
+
}
|
249 |
+
}
|
includes/src/Logicbroker_Dropship360_Model_Inventory.php
CHANGED
@@ -15,18 +15,26 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
15 |
protected $_stockBeforeQtyDecimalCheck = '';
|
16 |
protected $_iserror = true;
|
17 |
protected $_errorMsg = '';
|
|
|
|
|
|
|
18 |
protected function _construct()
|
19 |
{
|
20 |
$this->_init("dropship360/inventory");
|
21 |
}
|
22 |
-
|
|
|
|
|
|
|
23 |
public function prepareInventoryTable($restReqest)
|
24 |
{
|
25 |
$result = $this->prepareData($restReqest);
|
26 |
$this->updateProductStock();
|
27 |
return $result;
|
28 |
}
|
29 |
-
|
|
|
|
|
30 |
protected function updateProductStock()
|
31 |
{
|
32 |
$dataCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
@@ -51,6 +59,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
51 |
}
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
protected function saveStockData($sku, $qty)
|
55 |
{
|
56 |
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
@@ -67,13 +80,15 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
67 |
$stockItem->save();
|
68 |
} catch (Exception $e) {
|
69 |
Mage::helper('dropship360')->genrateLog(0,'mgento inventory update started','mgento inventory update ended','Section :Error In Setting/update magento inventory: '.$e->getMessage().' sku : '.$sku);
|
70 |
-
echo $e->getMessage();
|
71 |
}
|
72 |
}
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
|
|
|
|
|
|
|
77 |
protected function prepareData($restReqest)
|
78 |
{
|
79 |
$result = array();
|
@@ -87,6 +102,63 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
87 |
return $result;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
protected function validateRowData($val)
|
91 |
{
|
92 |
if(empty($val['product_sku']) && empty($val['lb_vendor_sku'])){
|
@@ -97,8 +169,14 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
97 |
$this->_iserror = false;
|
98 |
}
|
99 |
return $this->_iserror;
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
protected function updateStock($val,$buffer)
|
103 |
{
|
104 |
if(!empty($buffer))
|
@@ -106,7 +184,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
106 |
return $val['stock'];
|
107 |
}
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
110 |
protected function _prepareCollection($val)
|
111 |
{
|
112 |
$dataCollection = Mage::getModel('dropship360/inventory');
|
@@ -135,8 +217,13 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
135 |
}
|
136 |
}
|
137 |
return $collection;
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
140 |
protected function getLogMsg($ignoreData)
|
141 |
{
|
142 |
if(count($ignoreData)>0){
|
@@ -160,56 +247,33 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
160 |
return array('msg'=>$msg,'type'=>$type);
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
if(!$this->validateRowData($val))
|
175 |
-
{
|
176 |
-
return $this->_errorMsg;
|
177 |
-
}
|
178 |
-
|
179 |
-
$ignoreData = array();
|
180 |
-
(!is_numeric($val['cost']) || $val['cost'] < 0) ? $ignoreData[]= 'cost' : '';
|
181 |
-
(!is_numeric($val['stock']) || $val['stock'] < 0) ? $ignoreData[]= 'stock' : '';
|
182 |
-
(!is_numeric($val['stock']) || $val['stock'] < 0 || $val['stock'] == "") ? $stockFlag = false : $stockFlag = true;
|
183 |
-
(!is_numeric($val['cost']) || $val['cost'] < 0 || $val['cost'] == "") ? $costFlag = false : $costFlag = true;
|
184 |
-
$val['stock'] = $this->updateStock($val,$buffer);
|
185 |
-
$collection = $this->_prepareCollection($val);
|
186 |
-
if(is_null($collection)){
|
187 |
-
return $this->_errorMsg;
|
188 |
-
}
|
189 |
-
$product_sku = $collection->getFirstItem()->getProductSku();
|
190 |
-
/* LBN - 935 change */
|
191 |
-
$val['stock'] = Mage::helper('dropship360')->getIsQtyDecimal($product_sku,$val['stock']);
|
192 |
-
if($collection->getSize() >= 2 && empty($val['product_sku']))
|
193 |
-
{
|
194 |
-
return 'Multiple records found. Please provide Product SKU';
|
195 |
-
}
|
196 |
-
if($collection->getSize() > 0){
|
197 |
-
$collection->getFirstItem ()->setUpdatedAt(now());
|
198 |
-
($stockFlag == true) ? $collection->getFirstItem ()->setStock($val['stock']) : '';
|
199 |
-
($costFlag == true) ? $collection->getFirstItem ()->setCost($val['cost']) : '';
|
200 |
-
$arrayUpdate = array('updated_by'=>'system','product_sku'=>$product_sku,'lb_vendor_code'=>$val['lb_vendor_code'],'cost'=>$val['cost'],'stock'=>$originalStock);
|
201 |
-
$logDetail = $this->getLogMsg($ignoreData);
|
202 |
-
$this->_saveInventoryLog($logDetail['type'],$arrayUpdate);
|
203 |
-
if(count($ignoreData)!=2){
|
204 |
-
$collection->getFirstItem ()->save();
|
205 |
-
$this->_updateVendorList($vendorCollection,$val,false);
|
206 |
-
}
|
207 |
-
return $logDetail['msg'];
|
208 |
-
}else{
|
209 |
-
return 'Vendor Sku "'.$val['lb_vendor_sku'].'" and Magento SKU "'.$val['product_sku'].'" combination does not exist for vendor ';
|
210 |
-
}
|
211 |
-
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
public function saveTabVendorData($request)
|
214 |
{
|
215 |
$update = isset($request['vendor_update']) ? $request['vendor_update'] : '';
|
@@ -242,6 +306,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
242 |
return array('inventory'=>$finalStock,'result' => $result);
|
243 |
}
|
244 |
|
|
|
|
|
|
|
|
|
|
|
245 |
protected function _validate($request)
|
246 |
{
|
247 |
$arrVendorCode = array();
|
@@ -271,13 +340,25 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
271 |
(!$isUniqueCombination && !$isEntrySame) ? $isError = false : $isError;
|
272 |
return $isError;
|
273 |
}
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
protected function checkCodeSkuCombination($vendorCode,$vendorSku)
|
276 |
{
|
277 |
$collection = $this->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
278 |
return $collection->count();
|
279 |
}
|
280 |
|
|
|
|
|
|
|
|
|
|
|
281 |
protected function _addNewInventoryVendor($request,$productSku){
|
282 |
$vendorCollection = Mage::getModel('dropship360/ranking')->load($request['lb_vendor_code'],'lb_vendor_code');
|
283 |
$request['created_at'] = now();
|
@@ -304,13 +385,20 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
304 |
}
|
305 |
}
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
protected function _updateInventoryVendor($id,$request){
|
308 |
|
309 |
$model = $this->load($id);
|
310 |
$vendorCode = $model->getLbVendorCode();
|
311 |
$vendorName = $model->getLbVendorName();
|
312 |
$DbValues['cost'] = $model->getCost();
|
313 |
-
|
|
|
314 |
$DbValues['lb_vendor_sku'] = $model->getLbVendorSku();
|
315 |
$productSku = $model->getProductSku();
|
316 |
$request['lb_vendor_sku'] = trim($request['lb_vendor_sku']);
|
@@ -346,6 +434,10 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
346 |
return true;
|
347 |
}
|
348 |
|
|
|
|
|
|
|
|
|
349 |
protected function _deleteInvendorVendor($vendorId){
|
350 |
$model = $this->load($vendorId);
|
351 |
$vendorCode = $model->getLbVendorCode();
|
@@ -361,6 +453,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
361 |
}
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
364 |
public function _saveInventoryLog($type,$request){
|
365 |
$modelLog = Mage::getModel('dropship360/inventorylog');
|
366 |
$request['activity'] = $type;
|
@@ -379,21 +476,50 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
379 |
}
|
380 |
}
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
389 |
}
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
}
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
protected function _updateBuffer($stock,$dbCost = null){
|
398 |
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
399 |
$finalStock = 0;
|
@@ -413,7 +539,10 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
413 |
}
|
414 |
return $finalStock;
|
415 |
}
|
416 |
-
|
|
|
|
|
|
|
417 |
* that first vendor has been added to logicbroker_vendor_inventory
|
418 |
*/
|
419 |
protected function _afterSave()
|
@@ -429,7 +558,11 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
429 |
return;
|
430 |
}
|
431 |
|
432 |
-
|
|
|
|
|
|
|
|
|
433 |
|
434 |
try {
|
435 |
$fieldsetData['subject'] = 'DS360 Product Setup completed on Magento';
|
@@ -446,21 +579,51 @@ class Logicbroker_Dropship360_Model_Inventory extends Mage_Core_Model_Abstract
|
|
446 |
return false;//$e->getMassage();
|
447 |
}
|
448 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
public function upDateVendorName($vendor){
|
450 |
if(empty($vendor['code']) || empty($vendor['name']))
|
451 |
{
|
452 |
return;
|
453 |
}
|
|
|
454 |
$table = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
455 |
-
$update = 'UPDATE '.$table.' SET lb_vendor_name = "'.$vendor['name'].'" WHERE lb_vendor_code = "'.$vendor['code'].'"';
|
456 |
$conObj = Mage::getSingleton ( 'core/resource' )->getConnection('core_write');
|
457 |
-
$conObj->beginTransaction();
|
458 |
-
$conObj->query($update);
|
459 |
try {
|
460 |
-
$conObj->
|
461 |
} catch ( Exception $e ) {
|
462 |
-
|
463 |
-
Mage::getSingleton ( 'adminhtml/session' )->addError($e->getMessage ());
|
464 |
}
|
465 |
}
|
466 |
}
|
15 |
protected $_stockBeforeQtyDecimalCheck = '';
|
16 |
protected $_iserror = true;
|
17 |
protected $_errorMsg = '';
|
18 |
+
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
19 |
+
const XML_PATH_INVENTORY_NOTIFICATION_DAYS = 'logicbroker_sourcing/inventory_notification/days';
|
20 |
+
|
21 |
protected function _construct()
|
22 |
{
|
23 |
$this->_init("dropship360/inventory");
|
24 |
}
|
25 |
+
/**
|
26 |
+
* @param Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Admin_V1 $restReqest
|
27 |
+
* function used by REST for update vendor inventory
|
28 |
+
*/
|
29 |
public function prepareInventoryTable($restReqest)
|
30 |
{
|
31 |
$result = $this->prepareData($restReqest);
|
32 |
$this->updateProductStock();
|
33 |
return $result;
|
34 |
}
|
35 |
+
/**
|
36 |
+
* update vendor inventory using REST
|
37 |
+
*/
|
38 |
protected function updateProductStock()
|
39 |
{
|
40 |
$dataCollection = Mage::getModel('dropship360/inventory')->getCollection();
|
59 |
}
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* update catalogInventory for product
|
64 |
+
* @param Logicbroker_Dropship360_Model_Inventory $sku
|
65 |
+
* @param Logicbroker_Dropship360_Model_Inventory $qty
|
66 |
+
*/
|
67 |
protected function saveStockData($sku, $qty)
|
68 |
{
|
69 |
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
80 |
$stockItem->save();
|
81 |
} catch (Exception $e) {
|
82 |
Mage::helper('dropship360')->genrateLog(0,'mgento inventory update started','mgento inventory update ended','Section :Error In Setting/update magento inventory: '.$e->getMessage().' sku : '.$sku);
|
|
|
83 |
}
|
84 |
}
|
85 |
}
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* prepare and insert/update vendor data from REST request
|
90 |
+
* @param REST $restReqest
|
91 |
+
*/
|
92 |
protected function prepareData($restReqest)
|
93 |
{
|
94 |
$result = array();
|
102 |
return $result;
|
103 |
}
|
104 |
|
105 |
+
/**
|
106 |
+
* This function is used to save Vendor inventory
|
107 |
+
* @param array $val
|
108 |
+
* @return array $msg
|
109 |
+
*/
|
110 |
+
protected function saveLbInventory($rowVal, $buffer)
|
111 |
+
{
|
112 |
+
$val = array_map('trim',$rowVal);
|
113 |
+
$originalStock = $val['stock'];
|
114 |
+
$vendorObject = Mage::getModel('dropship360/ranking');
|
115 |
+
$vendorCollection = $vendorObject->load($val['lb_vendor_code'],'lb_vendor_code');
|
116 |
+
if(!$this->validateRowData($val))
|
117 |
+
{
|
118 |
+
return $this->_errorMsg;
|
119 |
+
}
|
120 |
+
|
121 |
+
$ignoreData = array();
|
122 |
+
(!is_numeric($val['cost']) || $val['cost'] < 0) ? $ignoreData[]= 'cost' : '';
|
123 |
+
(!is_numeric($val['stock']) || $val['stock'] < 0) ? $ignoreData[]= 'stock' : '';
|
124 |
+
(!is_numeric($val['stock']) || $val['stock'] < 0 || $val['stock'] == "") ? $stockFlag = false : $stockFlag = true;
|
125 |
+
(!is_numeric($val['cost']) || $val['cost'] < 0 || $val['cost'] == "") ? $costFlag = false : $costFlag = true;
|
126 |
+
$val['stock'] = $this->updateStock($val,$buffer);
|
127 |
+
$collection = $this->_prepareCollection($val);
|
128 |
+
if(is_null($collection)){
|
129 |
+
return $this->_errorMsg;
|
130 |
+
}
|
131 |
+
// if($collection->getSize() >= 2 && empty($val['product_sku']))
|
132 |
+
// {
|
133 |
+
// return 'Multiple records found. Please provide Product SKU';
|
134 |
+
// }
|
135 |
+
$collection->getSelect()->limit(1);
|
136 |
+
$product_sku = $collection->getFirstItem()->getProductSku();
|
137 |
+
/* LBN - 935 change */
|
138 |
+
$val['stock'] = Mage::helper('dropship360')->getIsQtyDecimal($product_sku,$val['stock']);
|
139 |
+
|
140 |
+
if($collection->getSize() > 0){
|
141 |
+
$collection->getFirstItem ()->setUpdatedAt(now());
|
142 |
+
($stockFlag == true) ? $collection->getFirstItem ()->setStock($val['stock']) : '';
|
143 |
+
($costFlag == true) ? $collection->getFirstItem ()->setCost($val['cost']) : '';
|
144 |
+
$arrayUpdate = array('updated_by'=>'system','product_sku'=>$product_sku,'lb_vendor_code'=>$val['lb_vendor_code'],'cost'=>$val['cost'],'stock'=>$originalStock);
|
145 |
+
$logDetail = $this->getLogMsg($ignoreData);
|
146 |
+
$this->_saveInventoryLog($logDetail['type'],$arrayUpdate);
|
147 |
+
if(count($ignoreData)!=2){
|
148 |
+
$collection->getFirstItem ()->save();
|
149 |
+
$this->_updateVendorList($vendorCollection,$val,false);
|
150 |
+
}
|
151 |
+
return $logDetail['msg'];
|
152 |
+
}else{
|
153 |
+
return 'Vendor Sku "'.$val['lb_vendor_sku'].'" and Magento SKU "'.$val['product_sku'].'" combination does not exist for vendor ';
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Validate row data getting from REST
|
159 |
+
* @param json $val
|
160 |
+
* @return boolean
|
161 |
+
*/
|
162 |
protected function validateRowData($val)
|
163 |
{
|
164 |
if(empty($val['product_sku']) && empty($val['lb_vendor_sku'])){
|
169 |
$this->_iserror = false;
|
170 |
}
|
171 |
return $this->_iserror;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* get processed stock for vendor
|
176 |
+
* @param json $val
|
177 |
+
* @param core_config_data $buffer
|
178 |
+
* @return stock (request-stock + buffer)
|
179 |
+
*/
|
180 |
protected function updateStock($val,$buffer)
|
181 |
{
|
182 |
if(!empty($buffer))
|
184 |
return $val['stock'];
|
185 |
}
|
186 |
|
187 |
+
/**
|
188 |
+
* prepare collection from vendor inventory table
|
189 |
+
* @param jason $val
|
190 |
+
* @return collection
|
191 |
+
*/
|
192 |
protected function _prepareCollection($val)
|
193 |
{
|
194 |
$dataCollection = Mage::getModel('dropship360/inventory');
|
217 |
}
|
218 |
}
|
219 |
return $collection;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* generate inline log message for product details page
|
224 |
+
* @param array $ignoreData
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
protected function getLogMsg($ignoreData)
|
228 |
{
|
229 |
if(count($ignoreData)>0){
|
247 |
return array('msg'=>$msg,'type'=>$type);
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* create new vendor using REST if not exist
|
252 |
+
* @param Logicbroker_Dropship360_Model_Ranking $object
|
253 |
+
* @param string $data
|
254 |
+
*/
|
255 |
+
protected function _updateVendorList($object,$data = ''){
|
256 |
+
if(!empty($data)){
|
257 |
+
$object->setUpdatedAt(now());
|
258 |
+
$object->setLbVendorType('enhanced');
|
259 |
+
if(!$object->getId()) $object->setIsDropship('no');
|
260 |
+
$object->setLbVendorCode($data['lb_vendor_code']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
+
}
|
263 |
+
try{
|
264 |
+
$object->save();
|
265 |
+
}catch(Exception $e){
|
266 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
/* update or add vendor inventory using REST code ends here */
|
271 |
+
/**************************************************************/
|
272 |
+
/**
|
273 |
+
* create,update,delete vendor data from product details page
|
274 |
+
* @param Mage_catalog_Model_Product $request
|
275 |
+
* @return boolean|multitype:number boolean
|
276 |
+
*/
|
277 |
public function saveTabVendorData($request)
|
278 |
{
|
279 |
$update = isset($request['vendor_update']) ? $request['vendor_update'] : '';
|
306 |
return array('inventory'=>$finalStock,'result' => $result);
|
307 |
}
|
308 |
|
309 |
+
/**
|
310 |
+
* validate frontend admin data provided by user on product detail page
|
311 |
+
* @param Mage_catalog_Model_Product $request
|
312 |
+
* @return boolean
|
313 |
+
*/
|
314 |
protected function _validate($request)
|
315 |
{
|
316 |
$arrVendorCode = array();
|
340 |
(!$isUniqueCombination && !$isEntrySame) ? $isError = false : $isError;
|
341 |
return $isError;
|
342 |
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* check unique combination of vendorCode and vendorSku
|
346 |
+
* in logicbroker_vendor_inventory table
|
347 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorCode
|
348 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorSku
|
349 |
+
* @return number
|
350 |
+
*/
|
351 |
protected function checkCodeSkuCombination($vendorCode,$vendorSku)
|
352 |
{
|
353 |
$collection = $this->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
354 |
return $collection->count();
|
355 |
}
|
356 |
|
357 |
+
/**
|
358 |
+
* add new vendor on product details page for SKU in request
|
359 |
+
* @param Mage_catalog_Model_Product $request
|
360 |
+
* @param Mage_catalog_Model_Product $productSku
|
361 |
+
*/
|
362 |
protected function _addNewInventoryVendor($request,$productSku){
|
363 |
$vendorCollection = Mage::getModel('dropship360/ranking')->load($request['lb_vendor_code'],'lb_vendor_code');
|
364 |
$request['created_at'] = now();
|
385 |
}
|
386 |
}
|
387 |
|
388 |
+
/**
|
389 |
+
* update vendor inventory data as per data from product details page for SKU in request
|
390 |
+
* @param Logicbroker_Dropship360_Model_Inventory $id
|
391 |
+
* @param Mage_Catalog_Model_Product $request
|
392 |
+
* @return boolean
|
393 |
+
*/
|
394 |
protected function _updateInventoryVendor($id,$request){
|
395 |
|
396 |
$model = $this->load($id);
|
397 |
$vendorCode = $model->getLbVendorCode();
|
398 |
$vendorName = $model->getLbVendorName();
|
399 |
$DbValues['cost'] = $model->getCost();
|
400 |
+
//patch apply to check empty stock
|
401 |
+
$DbValues['stock'] = ($model->getStock() == '') ? -9999999 : $model->getStock();
|
402 |
$DbValues['lb_vendor_sku'] = $model->getLbVendorSku();
|
403 |
$productSku = $model->getProductSku();
|
404 |
$request['lb_vendor_sku'] = trim($request['lb_vendor_sku']);
|
434 |
return true;
|
435 |
}
|
436 |
|
437 |
+
/**
|
438 |
+
* Delete vendor from product details page for SKU in request
|
439 |
+
* @param Logicbroker_Dropship360_Model_Inventory $vendorId
|
440 |
+
*/
|
441 |
protected function _deleteInvendorVendor($vendorId){
|
442 |
$model = $this->load($vendorId);
|
443 |
$vendorCode = $model->getLbVendorCode();
|
453 |
}
|
454 |
}
|
455 |
|
456 |
+
/**
|
457 |
+
* add inline comment to dropship360 history tab on product details page
|
458 |
+
* @param Logicbroker_Dropship360_Model_Inventorylog $type
|
459 |
+
* @param Mage_Catalog_Model_Product $request
|
460 |
+
*/
|
461 |
public function _saveInventoryLog($type,$request){
|
462 |
$modelLog = Mage::getModel('dropship360/inventorylog');
|
463 |
$request['activity'] = $type;
|
476 |
}
|
477 |
}
|
478 |
|
479 |
+
/**
|
480 |
+
* update catalogInventory
|
481 |
+
* @param array $result
|
482 |
+
* @param Mage_Catalog_Model_Product $sku
|
483 |
+
*/
|
484 |
+
public function productInventoryUpdate($result,$sku)
|
485 |
+
{
|
486 |
+
if(!$result['result']){
|
487 |
+
return;
|
488 |
}
|
489 |
+
|
490 |
+
$finalStock = $result['inventory'];
|
491 |
+
$finalStock = Mage::helper('dropship360')->getIsQtyDecimal($sku, $finalStock);
|
492 |
+
$conn = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
493 |
+
|
494 |
+
$tableNameStatus = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status' );
|
495 |
+
$tableNameItem = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_item' );
|
496 |
+
$tableNameItemIdx = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status_indexer_idx' );
|
497 |
+
|
498 |
+
$stockStatus = $finalStock ? 1 : 0;
|
499 |
+
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
500 |
+
if($productId){
|
501 |
+
$updateStatus = 'update '.$tableNameStatus.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
502 |
+
$updateItem = 'update '.$tableNameItem.' SET qty = '.$finalStock.',is_in_stock = '.$stockStatus.' where product_id = '.$productId;
|
503 |
+
$updateItemIdx = 'update '.$tableNameItemIdx.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
504 |
+
$conn->beginTransaction ();
|
505 |
+
$conn->query ($updateStatus);
|
506 |
+
$conn->query ($updateItem);
|
507 |
+
$conn->query ($updateItemIdx);
|
508 |
+
try {
|
509 |
+
$conn->commit ();
|
510 |
+
} catch ( Exception $e ) {
|
511 |
+
$conn->rollBack ();
|
512 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
513 |
+
}
|
514 |
}
|
515 |
}
|
516 |
|
517 |
+
/**
|
518 |
+
* calculate final stock
|
519 |
+
* @param request $stock
|
520 |
+
* @param Logicbroker_Dropship360_Model_Inventory $dbCost
|
521 |
+
* @return stock
|
522 |
+
*/
|
523 |
protected function _updateBuffer($stock,$dbCost = null){
|
524 |
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
525 |
$finalStock = 0;
|
539 |
}
|
540 |
return $finalStock;
|
541 |
}
|
542 |
+
/***************Vendor details save from product details page code ends here*****/
|
543 |
+
|
544 |
+
/**
|
545 |
+
* method use to send email notification to logicbroker
|
546 |
* that first vendor has been added to logicbroker_vendor_inventory
|
547 |
*/
|
548 |
protected function _afterSave()
|
558 |
return;
|
559 |
}
|
560 |
|
561 |
+
/**
|
562 |
+
* send email notification to logicbroker support
|
563 |
+
* @return boolean
|
564 |
+
*/
|
565 |
+
protected function sendVendorNotification(){
|
566 |
|
567 |
try {
|
568 |
$fieldsetData['subject'] = 'DS360 Product Setup completed on Magento';
|
579 |
return false;//$e->getMassage();
|
580 |
}
|
581 |
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* send notification email to users mention in activity monitor section
|
585 |
+
* @return Logicbroker_Dropship360_Model_Inventory
|
586 |
+
*/
|
587 |
+
public function notificationProductInventoryUpdate(){
|
588 |
+
$itemObject;
|
589 |
+
$fileInfo = array();
|
590 |
+
$ioAdapter = new Varien_Io_File();
|
591 |
+
$open_monitor_from = Date('Y-m-d h:i:s', strtotime('-'.Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS).' day'));
|
592 |
+
$open_monitor_to = Mage::getModel('core/date')->gmtDate();
|
593 |
+
$itemObject = Mage::getModel('dropship360/inventory')->getCollection()->addFieldTofilter('updated_at', array('from' => $open_monitor_from,'to' => $open_monitor_to));
|
594 |
+
if($itemObject->getSize() <= 0){
|
595 |
+
Mage::log('cannot send outdated product inventory email collection is empty for form :'.$open_monitor_from.' to :'.$open_monitor_to, null, 'notification_error.log');
|
596 |
+
return $this;
|
597 |
+
}
|
598 |
+
$fileInfo = Mage::getModel('dropship360/csvparser')->getCsvFile($itemObject);
|
599 |
+
$mailData['days'] = Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS);
|
600 |
+
$mailData['subject'] = 'dropship360 list of outdated product inventory';
|
601 |
+
$postObject = new Varien_Object();
|
602 |
+
$postObject->setData($mailData);
|
603 |
+
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
604 |
+
$templateId = 'logicbroker_outdated_product_inventory';
|
605 |
+
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId,$fileInfo['value']);
|
606 |
+
$ioAdapter->rm($fileInfo['value']);
|
607 |
+
return $this;
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* update vendor name
|
612 |
+
* @param Logicbroker_Dropship360_Model_Ranking $vendor
|
613 |
+
*/
|
614 |
public function upDateVendorName($vendor){
|
615 |
if(empty($vendor['code']) || empty($vendor['name']))
|
616 |
{
|
617 |
return;
|
618 |
}
|
619 |
+
$helper = Mage::helper('dropship360');
|
620 |
$table = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
|
|
621 |
$conObj = Mage::getSingleton ( 'core/resource' )->getConnection('core_write');
|
|
|
|
|
622 |
try {
|
623 |
+
$conObj->update($table,array('lb_vendor_name'=>$helper->convertToHtmlcode($vendor['name'])),array('lb_vendor_code = ?'=>$vendor['code']));
|
624 |
} catch ( Exception $e ) {
|
625 |
+
Mage::throwException('Error occured while renaming vendor in inventory table : '.$e->getMessage());
|
626 |
+
//Mage::getSingleton ( 'adminhtml/session' )->addError($e->getMessage ());
|
627 |
}
|
628 |
}
|
629 |
}
|
includes/src/Logicbroker_Dropship360_Model_Inventorylog.php
CHANGED
@@ -9,9 +9,79 @@
|
|
9 |
|
10 |
class Logicbroker_Dropship360_Model_Inventorylog extends Mage_Core_Model_Abstract
|
11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
protected function _construct(){
|
13 |
|
14 |
$this->_init("dropship360/inventorylog");
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
9 |
|
10 |
class Logicbroker_Dropship360_Model_Inventorylog extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
protected $_message = array(
|
13 |
+
'row_magento_sku'=>'Missing Data at Row(s) for Magento Sku row_num',
|
14 |
+
'row_vendor_sku'=>'Missing Data at Row(s) for Vendor Sku row_num',
|
15 |
+
'row_qty'=>'Bad Data for Qty at Row(s) row_num',
|
16 |
+
'row_cost'=>'Bad Data for Cost at Row(s) row_num',
|
17 |
+
'empty_file'=>'Sorry,we cant find the record to update inventory',
|
18 |
+
'inventory_update_error'=>'Error in updating magento product inventory, magento_sku',
|
19 |
+
'magento_sku_exists'=>'magento product sku not exist magento_sku',
|
20 |
+
'inventory_add_error'=>'Error in adding magento product inventory, magento_sku',
|
21 |
+
'combination_notexist'=>'Vendor Sku vendor_sku & Supplier code vendor_code combination does not exist',
|
22 |
+
'already_assigned'=>'Vendor sku vendor_sku is already been assigned for this vendor',
|
23 |
+
'duplicate_vendor_sku'=>'Vendor sku vendor_sku is duplicate in Magento Sku magento_sku for this supplier',
|
24 |
+
'combination_exist'=> 'Vendor sku vendor_sku or Supplier code vendor_code combination already present for Magento Sku magento_sku',
|
25 |
+
'data_notchnage'=> 'Cost & Qty for Vendor Sku vendor_sku & Supplier code vendor_code not changed',
|
26 |
+
'upc_notexist'=> 'UPC attribute missing vendor_sku',
|
27 |
+
'upc_multiple'=> 'Multiple Match found for UPC vendor_sku',
|
28 |
+
'manufacturer_part_number_notexist'=> 'MNP attribute missing vendor_sku',
|
29 |
+
'manufacturer_part_number_multiple'=> 'Multiple Match found for MNP vendor_sku',
|
30 |
+
'sku_multiple'=> 'Multiple Match found for SKU vendor_sku',
|
31 |
+
'attribute_notexist'=> 'Attribute assigned for Supplier does not exist for Row(s) row_num',
|
32 |
+
'ftp_bad_header'=>'Bad csv header for file file_name',
|
33 |
+
'connection_error'=>'con_error'
|
34 |
+
);
|
35 |
+
protected $_replace = array('magento_sku','vendor_sku','vendor_code','file_name','con_error');
|
36 |
+
|
37 |
protected function _construct(){
|
38 |
|
39 |
$this->_init("dropship360/inventorylog");
|
40 |
}
|
41 |
+
|
42 |
+
public function getMessageArray(){
|
43 |
+
return $this->_message;
|
44 |
+
}
|
45 |
+
public function getReplaceValue(){
|
46 |
+
return $this->_replace;
|
47 |
+
}
|
48 |
+
public function getLogDescriptionCollection($error_id){
|
49 |
+
$conn = Mage::getModel('dropship360/uploadvendor')->getDatabaseConnection();
|
50 |
+
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log_desc' );
|
51 |
+
$select = $conn->select()->from($tableVendorImportLog)->where('error_id ='.$error_id);
|
52 |
+
$rows = $conn->fetchAll($select);
|
53 |
+
return $rows;
|
54 |
+
}
|
55 |
+
public function prepareRowData($data)
|
56 |
+
{
|
57 |
+
$decodedata = array();
|
58 |
+
$dataTemp = array();
|
59 |
+
if(is_numeric($data))
|
60 |
+
{
|
61 |
+
$rowData = $this->getLogDescriptionCollection($data);
|
62 |
+
if(count($rowData) > 0)
|
63 |
+
{
|
64 |
+
foreach($rowData as $eachRow)
|
65 |
+
{
|
66 |
+
$decodedata[] = array_merge($dataTemp, $this->getDecodedJson($eachRow['description']));
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}else
|
70 |
+
{
|
71 |
+
$decodedata = $this->getDecodedJson($data);
|
72 |
+
}
|
73 |
+
return $decodedata;
|
74 |
+
}
|
75 |
+
|
76 |
+
protected function getDecodedJson($data)
|
77 |
+
{
|
78 |
+
if(empty($data) || !Mage::helper('dropship360')->isJson($data)){
|
79 |
+
return $data;
|
80 |
+
}
|
81 |
+
$data = trim($data,'"');
|
82 |
+
$data = trim($data,'\'');
|
83 |
+
$decodedata = Mage::helper('core')->jsonDecode($data);
|
84 |
+
return $decodedata;
|
85 |
+
}
|
86 |
}
|
87 |
|
includes/src/Logicbroker_Dropship360_Model_Observer.php
CHANGED
@@ -13,22 +13,27 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
13 |
const XML_PATH_LOGICBROKER_ORDER_BEGIN_SOURCING_STATUS = 'Reprocess';
|
14 |
const XML_PATH_LOGICBROKER_ORDER_BACKORDERED = 'Backorder';
|
15 |
const XML_PATH_LOGICBROKER_EMAIL_SHIPMENT = 'logicbroker_sourcing/rank/email_shipment';
|
16 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
17 |
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
18 |
-
|
19 |
-
|
20 |
-
protected $_orderStatus;
|
21 |
-
protected $_itemData = array();
|
22 |
|
23 |
public static function getWorkingDir()
|
24 |
{
|
25 |
return Mage::getBaseDir();
|
26 |
}
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
public function insertProcessOrder($object)
|
30 |
{
|
31 |
|
|
|
|
|
|
|
|
|
32 |
$this->_orderStatus = $object->getOrder()->getStatus();
|
33 |
foreach ($object->getOrder ()->getAllItems() as $item){
|
34 |
if(in_array($item->getProductType(),array('simple','grouped')) ){
|
@@ -36,39 +41,17 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
36 |
$ended = 1;
|
37 |
$logMsg = 'Item inserted @'.Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/orderitems' ). ' sku : '.$item->getSku().','.$object->getOrder()->getIncrementId();
|
38 |
Mage::helper('dropship360')->genrateLog(++$started,'Order Item Inserted Started',null,$logMsg);
|
39 |
-
|
40 |
Mage::helper('dropship360')->genrateLog(++$ended,null,'Order Item Inserted Ended',null);
|
41 |
}
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
protected function getOrderSourcing($item, $object){
|
46 |
-
$orderSourcingInstance = Mage::getModel ( 'dropship360/orderitems' );
|
47 |
-
Mage::getModel('dropship360/logicbroker')->prepareNotification($orderSourcingInstance,$object->getOrder()->getEntityId());
|
48 |
-
$orderStatus = $object->getOrder()->getStatus();
|
49 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderSourcingInstance, 'Sourcing', $orderStatus);
|
50 |
-
$orderSourcingInstance->setSku ( $item->getSku() );
|
51 |
-
$orderSourcingInstance->setItemId ( $item->getItemId() );
|
52 |
-
$orderSourcingInstance->setItemOrderId ( $object->getOrder()->getEntityId() );
|
53 |
-
$orderSourcingInstance->setLbItemStatus ('Sourcing');
|
54 |
-
$orderSourcingInstance->setUpdatedBy ('Cron');
|
55 |
-
$orderSourcingInstance->setUpdatedAt(now());
|
56 |
-
$orderSourcingInstance->setItemStatusHistory($itemStatusHistory);
|
57 |
-
try {
|
58 |
-
$orderSourcingInstance->save ();
|
59 |
-
} catch ( Execption $e ) {
|
60 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'Section : order item inserted Error: '.$e->getMessage().' sku : '.$item->getSku());
|
61 |
-
echo $e->getMessage();
|
62 |
}
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$this->_itemData = array();
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
public function logicbrokerSourcing() {
|
73 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
74 |
if(!Mage::getStoreConfig(self::CRON_STRING_PATH_SOURCING)) {
|
@@ -82,13 +65,17 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
82 |
}
|
83 |
Mage::helper('dropship360')->genrateLog(1,'Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null,null);
|
84 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
85 |
-
$
|
86 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/dispaly_sourcing_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
87 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
88 |
Mage::helper('dropship360')->genrateLog(2,null,'Sourcing Ended for ' .Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null);
|
89 |
return;
|
90 |
}
|
91 |
|
|
|
|
|
|
|
|
|
92 |
public function logicbrokerBackorder()
|
93 |
{
|
94 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
@@ -102,7 +89,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
102 |
}
|
103 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER . ' item status',null,null);
|
104 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
105 |
-
$
|
106 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/display_backorder_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
107 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
108 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Ended for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER .' item status',null,null);
|
@@ -110,7 +97,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
110 |
}
|
111 |
|
112 |
|
113 |
-
|
114 |
* Save last cron status
|
115 |
* @param string $statusPath
|
116 |
* @param string $status
|
@@ -121,173 +108,6 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
121 |
return;
|
122 |
}
|
123 |
|
124 |
-
protected function setLbVendorRanking($crontype,$isCronSourcing = false)
|
125 |
-
{
|
126 |
-
$reprocess = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS;
|
127 |
-
$lbOrderInstances = Mage::getModel('dropship360/ordersourcing');
|
128 |
-
$collection = $lbOrderInstances->prepareItemCollection($crontype,$isCronSourcing);
|
129 |
-
if(count($collection) > 0 ){
|
130 |
-
foreach ( $collection as $orderID => $orderCollectionData ) {
|
131 |
-
$orderCollection = Mage::getModel('sales/order')->Load($orderID);
|
132 |
-
//Patch : skip sourcing process if order is deleted
|
133 |
-
if (! $orderCollection->getEntityId ()) {
|
134 |
-
Mage::helper ( 'dropship360' )->genrateLog ( 0, null, null, 'Order not exists for => order_id: ' . $orderID . ' hence cannot continue' );
|
135 |
-
continue;
|
136 |
-
}
|
137 |
-
$this->_orderStatus = $orderCollection->getStatus();
|
138 |
-
foreach ($orderCollectionData as $orderData ){
|
139 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'<---->Item Processing Started : '.$orderData->getSku());
|
140 |
-
if ($crontype == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS) {
|
141 |
-
$assigned = $this->assignToVendor(Mage::getModel('sales/order_item')->Load($orderData->getItemId()));
|
142 |
-
}else
|
143 |
-
{
|
144 |
-
$orderItems = Mage::getModel( 'dropship360/orderitems' )->load($orderData->getItemId(), 'item_id');
|
145 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItems, $reprocess, $this->_orderStatus);
|
146 |
-
$this->_itemData[$orderData->getItemId()] = array('lb_item_status'=>$reprocess,'item_status_history'=>$itemStatusHistory);
|
147 |
-
}
|
148 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'####### Item Processing ended : '.$orderData->getSku());
|
149 |
-
|
150 |
-
}
|
151 |
-
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$orderCollection,$crontype);
|
152 |
-
$this->_itemData = array();
|
153 |
-
}
|
154 |
-
}else {
|
155 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'Order collection is empty for => Cron_type: '.$crontype.' hence cannot continue');
|
156 |
-
return;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
protected function assignToVendor($item) {
|
160 |
-
$productSku = $item->getSku ();
|
161 |
-
$itemStatusComplete = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
162 |
-
$itemStatusBackorder = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER;
|
163 |
-
$itemStatusNoDropShip = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP;
|
164 |
-
$qtyInvoiced = $item->getQtyOrdered ();
|
165 |
-
$itemId = $item->getItemId ();
|
166 |
-
$isDefaultVendor = false;
|
167 |
-
$vendorCode = '';
|
168 |
-
$inventoryStock = '';
|
169 |
-
$defaultVendor = (Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder') == 'none') ? '' : Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder');
|
170 |
-
$orderItemInstance = Mage::getModel ( 'dropship360/orderitems' );
|
171 |
-
$orderItemInstance->load ( $itemId, 'item_id' );
|
172 |
-
$collectionVendor = $orderItemInstance->prepareOrderItemData($item);
|
173 |
-
$arrDefaultVendorDetails = array();
|
174 |
-
$vendorCost = 0;
|
175 |
-
|
176 |
-
if ($collectionVendor->count () > 0) {
|
177 |
-
if($collectionVendor->count () >= 1){
|
178 |
-
foreach ($collectionVendor as $vendorData) {
|
179 |
-
//assign default vendor details
|
180 |
-
if(!empty($defaultVendor) && $vendorData->getLbVendorCode() == $defaultVendor )
|
181 |
-
{
|
182 |
-
$arrDefaultVendorDetails = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
183 |
-
}
|
184 |
-
//if item is in backordered
|
185 |
-
if($vendorData->getStock() < $qtyInvoiced ){
|
186 |
-
$arrVendorDetail[] = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
187 |
-
$vendorCode = $arrVendorDetail[0]['lb_vendor_code'];
|
188 |
-
$inventoryStock = $arrVendorDetail[0]['stock'];
|
189 |
-
$vendorCost = $arrVendorDetail[0]['cost'];
|
190 |
-
$vendorSku = $arrVendorDetail[0]['lb_vendor_sku'];
|
191 |
-
$productSku = $arrVendorDetail[0]['product_sku'];
|
192 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
193 |
-
$isDefaultVendor = true;
|
194 |
-
}else{
|
195 |
-
$vendorCode = $vendorData->getLbVendorCode();
|
196 |
-
$inventoryStock = $vendorData->getStock();
|
197 |
-
$vendorCost = $vendorData->getCost();
|
198 |
-
$vendorSku = $vendorData->getLbVendorSku();
|
199 |
-
$productSku = $vendorData->getProductSku();
|
200 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
201 |
-
$isDefaultVendor = false;
|
202 |
-
break;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
206 |
-
}else {
|
207 |
-
$arrFirstVendor = $collectionVendor->getFirstItem ()->getData ();
|
208 |
-
$vendorCode = $arrFirstVendor ['lb_vendor_code'];
|
209 |
-
$inventoryStock = $arrFirstVendor ['stock'];
|
210 |
-
$vendorCost = $arrFirstVendor ['cost'];
|
211 |
-
$vendorSku = $arrFirstVendor ['lb_vendor_sku'];
|
212 |
-
$productSku = $arrFirstVendor ['product_sku'];
|
213 |
-
if($inventoryStock < $qtyInvoiced)
|
214 |
-
$isDefaultVendor = true;
|
215 |
-
else
|
216 |
-
$isDefaultVendor = false;
|
217 |
-
|
218 |
-
$arrVendorAvailable[] = $arrFirstVendor ['lb_vendor_code'];
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
if(!empty($vendorCode)){
|
223 |
-
if ($vendorCode && $inventoryStock >= $qtyInvoiced) {
|
224 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
225 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusComplete);
|
226 |
-
Mage::getModel('dropship360/logicbroker')->setupNotification();
|
227 |
-
$this->_itemData [$item->getItemId ()] = array (
|
228 |
-
'updateInventory' => true,
|
229 |
-
'qtyInvoiced' =>$qtyInvoiced,
|
230 |
-
'updated_at' => now (),
|
231 |
-
'sku' => $item->getSku (),
|
232 |
-
'updated_by' => 'Cron',
|
233 |
-
'lb_item_status' => $itemStatusComplete,
|
234 |
-
'lb_vendor_code' => $vendorCode,
|
235 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
236 |
-
'lb_vendor_sku' => $vendorSku,
|
237 |
-
'item_status_history' => $itemStatusHistory
|
238 |
-
);
|
239 |
-
return $itemStatusComplete;
|
240 |
-
}
|
241 |
-
if ($isDefaultVendor && $inventoryStock <= $qtyInvoiced && !empty($defaultVendor) && in_array($defaultVendor,$arrVendorAvailable)) {
|
242 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
243 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details Default vendor set ==>stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->Transmitting');
|
244 |
-
$this->_itemData [$item->getItemId ()] = array (
|
245 |
-
'updateInventory' => false,
|
246 |
-
'updated_at' => now (),
|
247 |
-
'sku' => $item->getSku (),
|
248 |
-
'updated_by' => 'Cron',
|
249 |
-
'lb_item_status' => $itemStatusComplete,
|
250 |
-
'lb_vendor_code' => $defaultVendor,
|
251 |
-
'vendor_cost' => $arrDefaultVendorDetails ['cost'] * $qtyInvoiced,
|
252 |
-
'lb_vendor_sku' => $arrDefaultVendorDetails ['lb_vendor_sku'],
|
253 |
-
'item_status_history' => $itemStatusHistory
|
254 |
-
);
|
255 |
-
return $itemStatusComplete;
|
256 |
-
}
|
257 |
-
if ($vendorCode && $inventoryStock <= $qtyInvoiced) {
|
258 |
-
$itemStatusHistory =Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusBackorder, $this->_orderStatus);
|
259 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==>stock('.$inventoryStock.') <= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusBackorder);
|
260 |
-
$this->_itemData [$item->getItemId ()] = array (
|
261 |
-
'updateInventory' => false,
|
262 |
-
'updated_at' => now (),
|
263 |
-
'sku' => $item->getSku (),
|
264 |
-
'updated_by' => 'Cron',
|
265 |
-
'lb_item_status' => $itemStatusBackorder,
|
266 |
-
'lb_vendor_code' => $vendorCode,
|
267 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
268 |
-
'lb_vendor_sku' => $vendorSku,
|
269 |
-
'item_status_history' => $itemStatusHistory
|
270 |
-
);
|
271 |
-
return $itemStatusBackorder;
|
272 |
-
}
|
273 |
-
}else{
|
274 |
-
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance,$itemStatusNoDropShip, $this->_orderStatus);
|
275 |
-
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> No vendor Set ,vendor_code ->'.$vendorCode.', item-status->No Dropship');
|
276 |
-
$this->_itemData [$item->getItemId ()] = array (
|
277 |
-
'updateInventory' => false,
|
278 |
-
'updated_at' => now (),
|
279 |
-
'sku' => $item->getSku (),
|
280 |
-
'updated_by' => 'Cron',
|
281 |
-
'lb_item_status' => $itemStatusNoDropShip,
|
282 |
-
'lb_vendor_code' => $vendorCode,
|
283 |
-
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
284 |
-
'lb_vendor_sku' => '',
|
285 |
-
'item_status_history' => $itemStatusHistory
|
286 |
-
);
|
287 |
-
return $itemStatusNoDropShip;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
/**
|
292 |
* Flag to stop observer executing more than once
|
293 |
*
|
@@ -297,7 +117,7 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
297 |
|
298 |
/**
|
299 |
* This method will run when the product is saved from the Magento Admin
|
300 |
-
* Use this function to update the
|
301 |
* data or anything you like
|
302 |
*
|
303 |
* @param Varien_Event_Observer $observer
|
@@ -308,111 +128,27 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
308 |
$product = $observer->getEvent()->getProduct();
|
309 |
if(!empty($product['vendor_update']) || !empty($product['vendor_new'])){
|
310 |
try {
|
311 |
-
|
312 |
-
* Perform any actions you want here
|
313 |
-
*
|
314 |
-
*/
|
315 |
-
$customFieldValue = $this->_getRequest()->getPost('product');
|
316 |
$result = Mage::getModel('dropship360/inventory')->saveTabVendorData($customFieldValue);
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Uncomment the line below to save the product
|
320 |
-
*
|
321 |
-
*/
|
322 |
-
//if(!$result)
|
323 |
-
//Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dropship360')->__('Vendor Data Cannot be saved'));
|
324 |
-
|
325 |
-
//$product->save();
|
326 |
-
|
327 |
-
|
328 |
-
$this->_inventoryUpdate($result,$customFieldValue['sku']);
|
329 |
}
|
330 |
catch (Exception $e) {
|
331 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
332 |
}
|
333 |
}
|
334 |
-
return;
|
335 |
}
|
336 |
|
337 |
-
protected function _inventoryUpdate($result,$sku)
|
338 |
-
{
|
339 |
-
if(!$result['result']){
|
340 |
-
return;
|
341 |
-
}
|
342 |
-
|
343 |
-
$finalStock = $result['inventory'];
|
344 |
-
$finalStock = Mage::helper('dropship360')->getIsQtyDecimal($sku, $finalStock);
|
345 |
-
$conn = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
346 |
-
|
347 |
-
$tableNameStatus = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status' );
|
348 |
-
$tableNameItem = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_item' );
|
349 |
-
$tableNameItemIdx = Mage::getSingleton ( 'core/resource' )->getTableName ( 'cataloginventory/stock_status_indexer_idx' );
|
350 |
-
|
351 |
-
$stockStatus = $finalStock ? 1 : 0;
|
352 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
353 |
-
if($productId){
|
354 |
-
$updateStatus = 'update '.$tableNameStatus.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
355 |
-
$updateItem = 'update '.$tableNameItem.' SET qty = '.$finalStock.',is_in_stock = '.$stockStatus.' where product_id = '.$productId;
|
356 |
-
$updateItemIdx = 'update '.$tableNameItemIdx.' SET qty = '.$finalStock.',stock_status = '.$stockStatus.' where product_id = '.$productId;
|
357 |
-
$conn->beginTransaction ();
|
358 |
-
$conn->query ($updateStatus);
|
359 |
-
$conn->query ($updateItem);
|
360 |
-
$conn->query ($updateItemIdx);
|
361 |
-
try {
|
362 |
-
$conn->commit ();
|
363 |
-
} catch ( Exception $e ) {
|
364 |
-
$conn->rollBack ();
|
365 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Retrieve the product model
|
372 |
-
*
|
373 |
-
* @return Mage_Catalog_Model_Product $product
|
374 |
-
*/
|
375 |
-
public function getProduct()
|
376 |
-
{
|
377 |
-
return Mage::registry('product');
|
378 |
-
}
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Shortcut to getRequest
|
382 |
-
*
|
383 |
-
*/
|
384 |
-
protected function _getRequest()
|
385 |
-
{
|
386 |
-
return Mage::app()->getRequest();
|
387 |
-
}
|
388 |
|
389 |
public function preDispatch(Varien_Event_Observer $observer)
|
390 |
{
|
391 |
return;
|
392 |
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
$trackingNumbers = array();
|
399 |
-
foreach ($shipment->getAllTracks() as $track) {
|
400 |
-
$trackingNumbers[] = $track->getNumber();
|
401 |
-
};
|
402 |
-
// send shipment email only when carrier tracking info is added
|
403 |
-
if (count($trackingNumbers) > 0) {
|
404 |
-
$lastValueOfArray = end($trackingNumbers);
|
405 |
-
$lastValueOfArray = trim($lastValueOfArray);
|
406 |
-
if(!empty($lastValueOfArray))
|
407 |
-
return true;
|
408 |
-
else
|
409 |
-
return false;
|
410 |
-
} else {
|
411 |
-
return false;
|
412 |
-
}
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
|
417 |
{
|
418 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
@@ -431,7 +167,11 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
431 |
}
|
432 |
return $this;
|
433 |
}
|
434 |
-
|
|
|
|
|
|
|
|
|
435 |
public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
|
436 |
{
|
437 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
@@ -452,7 +192,32 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
452 |
return $this;
|
453 |
}
|
454 |
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
* This function is used to delete the sku from vendor inventory
|
457 |
* when the same sku is deleted from catalog product
|
458 |
*/
|
@@ -471,30 +236,15 @@ class Logicbroker_Dropship360_Model_Observer {
|
|
471 |
}
|
472 |
return $this;
|
473 |
}
|
474 |
-
|
|
|
|
|
|
|
475 |
public function notifyForProductUpdateInventory(){
|
476 |
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_DAYS) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL)) {
|
477 |
return $this;
|
478 |
}
|
479 |
-
|
480 |
-
$fileInfo = array();
|
481 |
-
$ioAdapter = new Varien_Io_File();
|
482 |
-
$open_monitor_from = Date('Y-m-d h:i:s', strtotime('-'.Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS).' day'));
|
483 |
-
$open_monitor_to = Mage::getModel('core/date')->gmtDate();
|
484 |
-
$itemObject = Mage::getModel('dropship360/inventory')->getCollection()->addFieldTofilter('updated_at', array('from' => $open_monitor_from,'to' => $open_monitor_to));
|
485 |
-
if($itemObject->getSize() <= 0){
|
486 |
-
Mage::log('cannot send outdated product inventory email collection is empty for form :'.$open_monitor_from.' to :'.$open_monitor_to, null, 'notification_error.log');
|
487 |
-
return $this;
|
488 |
-
}
|
489 |
-
$fileInfo = Mage::getModel('dropship360/csvparser')->getCsvFile($itemObject);
|
490 |
-
$mailData['days'] = Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_DAYS);
|
491 |
-
$mailData['subject'] = 'dropship360 list of outdated product inventory';
|
492 |
-
$postObject = new Varien_Object();
|
493 |
-
$postObject->setData($mailData);
|
494 |
-
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
495 |
-
$templateId = 'logicbroker_outdated_product_inventory';
|
496 |
-
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId,$fileInfo['value']);
|
497 |
-
$ioAdapter->rm($fileInfo['value']);
|
498 |
return $this;
|
499 |
}
|
500 |
}
|
13 |
const XML_PATH_LOGICBROKER_ORDER_BEGIN_SOURCING_STATUS = 'Reprocess';
|
14 |
const XML_PATH_LOGICBROKER_ORDER_BACKORDERED = 'Backorder';
|
15 |
const XML_PATH_LOGICBROKER_EMAIL_SHIPMENT = 'logicbroker_sourcing/rank/email_shipment';
|
|
|
16 |
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
17 |
+
|
18 |
+
|
|
|
|
|
19 |
|
20 |
public static function getWorkingDir()
|
21 |
{
|
22 |
return Mage::getBaseDir();
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @event : sales_order_place_after
|
27 |
+
* insert order items details in logicbroker_sales_orders_items for sourcing
|
28 |
+
* processing is dependent dropship360 extension configuration
|
29 |
+
*/
|
30 |
public function insertProcessOrder($object)
|
31 |
{
|
32 |
|
33 |
+
if($object->getOrder()->getLogicbrokerItemProcessed())
|
34 |
+
{
|
35 |
+
return;
|
36 |
+
}
|
37 |
$this->_orderStatus = $object->getOrder()->getStatus();
|
38 |
foreach ($object->getOrder ()->getAllItems() as $item){
|
39 |
if(in_array($item->getProductType(),array('simple','grouped')) ){
|
41 |
$ended = 1;
|
42 |
$logMsg = 'Item inserted @'.Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/orderitems' ). ' sku : '.$item->getSku().','.$object->getOrder()->getIncrementId();
|
43 |
Mage::helper('dropship360')->genrateLog(++$started,'Order Item Inserted Started',null,$logMsg);
|
44 |
+
Mage::getModel('dropship360/ordersourcing')->getOrderSourcing($item, $object);
|
45 |
Mage::helper('dropship360')->genrateLog(++$ended,null,'Order Item Inserted Ended',null);
|
46 |
}
|
47 |
}
|
48 |
+
$object->getOrder()->setLogicbrokerItemProcessed(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* @cron : logicbroker_dropship360
|
53 |
+
* logicbroker main/reprocess souring logic execution begins
|
54 |
+
*/
|
|
|
|
|
|
|
|
|
55 |
public function logicbrokerSourcing() {
|
56 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
57 |
if(!Mage::getStoreConfig(self::CRON_STRING_PATH_SOURCING)) {
|
65 |
}
|
66 |
Mage::helper('dropship360')->genrateLog(1,'Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null,null);
|
67 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
68 |
+
$sourcingObj->setLbVendorRanking (Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS,true);
|
69 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/dispaly_sourcing_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
70 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_SOURCING);
|
71 |
Mage::helper('dropship360')->genrateLog(2,null,'Sourcing Ended for ' .Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS.' Item status',null);
|
72 |
return;
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* @cron : logicbroker_backorder
|
77 |
+
* logicbroker backorder souring logic execution begins
|
78 |
+
*/
|
79 |
public function logicbrokerBackorder()
|
80 |
{
|
81 |
$sourcingObj = Mage::getModel('dropship360/ordersourcing');
|
89 |
}
|
90 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Started for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER . ' item status',null,null);
|
91 |
$sourcingObj->sourcingStarted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
92 |
+
$sourcingObj->setLbVendorRanking (Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
93 |
$this->addCronStatus('logicbroker_sourcing/cron_settings/display_backorder_updated_time', Mage::helper('core')->formatDate(now(), 'medium', true));
|
94 |
$sourcingObj->sourcingCompleted(Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER);
|
95 |
Mage::helper('dropship360')->genrateLog(1,'Backorder Sourcing Ended for '.Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER .' item status',null,null);
|
97 |
}
|
98 |
|
99 |
|
100 |
+
/**
|
101 |
* Save last cron status
|
102 |
* @param string $statusPath
|
103 |
* @param string $status
|
108 |
return;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Flag to stop observer executing more than once
|
113 |
*
|
117 |
|
118 |
/**
|
119 |
* This method will run when the product is saved from the Magento Admin
|
120 |
+
* Use this function to update the logicbroker dropship360 model, process the
|
121 |
* data or anything you like
|
122 |
*
|
123 |
* @param Varien_Event_Observer $observer
|
128 |
$product = $observer->getEvent()->getProduct();
|
129 |
if(!empty($product['vendor_update']) || !empty($product['vendor_new'])){
|
130 |
try {
|
131 |
+
$customFieldValue = Mage::app()->getRequest()->getPost('product');
|
|
|
|
|
|
|
|
|
132 |
$result = Mage::getModel('dropship360/inventory')->saveTabVendorData($customFieldValue);
|
133 |
+
Mage::getModel('dropship360/inventory')->productInventoryUpdate($result,$customFieldValue['sku']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
catch (Exception $e) {
|
136 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
137 |
}
|
138 |
}
|
139 |
+
return $this;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
public function preDispatch(Varien_Event_Observer $observer)
|
144 |
{
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* @event : sales_order_shipment_save_before
|
150 |
+
* send email when shipping tracking information is added
|
151 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
|
153 |
{
|
154 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
167 |
}
|
168 |
return $this;
|
169 |
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
*@event : sales_order_shipment_save_after
|
173 |
+
*send email when shipping tracking information is added
|
174 |
+
*/
|
175 |
public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
|
176 |
{
|
177 |
if(!Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
192 |
return $this;
|
193 |
}
|
194 |
|
195 |
+
/**
|
196 |
+
* validate shipping email need to send
|
197 |
+
*/
|
198 |
+
protected function _isValidForShipmentEmail($shipment)
|
199 |
+
{
|
200 |
+
// send shipment email only when email shipment is enabled from module
|
201 |
+
if(Mage::getStoreConfig(self::XML_PATH_LOGICBROKER_EMAIL_SHIPMENT)){
|
202 |
+
$trackingNumbers = array();
|
203 |
+
foreach ($shipment->getAllTracks() as $track) {
|
204 |
+
$trackingNumbers[] = $track->getNumber();
|
205 |
+
};
|
206 |
+
// send shipment email only when carrier tracking info is added
|
207 |
+
if (count($trackingNumbers) > 0) {
|
208 |
+
$lastValueOfArray = end($trackingNumbers);
|
209 |
+
$lastValueOfArray = trim($lastValueOfArray);
|
210 |
+
if(!empty($lastValueOfArray))
|
211 |
+
return true;
|
212 |
+
else
|
213 |
+
return false;
|
214 |
+
} else {
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
* This function is used to delete the sku from vendor inventory
|
222 |
* when the same sku is deleted from catalog product
|
223 |
*/
|
236 |
}
|
237 |
return $this;
|
238 |
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @function : notify customer for outdated product inventory through email,initiated by cron
|
242 |
+
*/
|
243 |
public function notifyForProductUpdateInventory(){
|
244 |
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_DAYS) || !Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL)) {
|
245 |
return $this;
|
246 |
}
|
247 |
+
Mage::getModel('dropship360/inventory')->notificationProductInventoryUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
return $this;
|
249 |
}
|
250 |
}
|
includes/src/Logicbroker_Dropship360_Model_Order_Api.php
CHANGED
@@ -153,23 +153,25 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
153 |
$productItems = array();
|
154 |
$productItems = $this->_getAttributes($item, 'order_item');
|
155 |
$lbItems = Mage::getModel('dropship360/orderitems')->getCollection()
|
156 |
-
->addFieldToSelect(array('sku', 'lb_vendor_sku', 'lb_item_status', 'lb_vendor_code', 'item_id'))
|
157 |
->addFieldToFilter('item_order_id',array('eq'=>$order->getId()))
|
158 |
->addFieldToFilter('item_id', array('eq'=>$productItems['item_id']))
|
159 |
->addFieldToFilter('lb_item_status', array('eq'=>$this->_itemStatusTansmitting));
|
160 |
$lbItems->getSelect()->join(array('salesOrder'=>Mage::getSingleton('core/resource')->getTableName('sales/order')),
|
161 |
'salesOrder.entity_id = main_table.item_order_id', array('state'))->where('salesOrder.state = ?','processing');
|
|
|
162 |
if($lbItems->getSize() > 0){
|
163 |
$productItems['lb_item_status'] = $lbItems->getFirstItem()->getLbItemStatus();
|
164 |
$productItems['lb_vendor_sku'] = $lbItems->getFirstItem()->getLbVendorSku();
|
165 |
$productItems['lb_vendor_code'] = $lbItems->getFirstItem()->getLbVendorCode();
|
|
|
166 |
}
|
167 |
return $productItems;
|
168 |
}
|
169 |
|
170 |
|
171 |
/**
|
172 |
-
* Change
|
173 |
*
|
174 |
* @param string $orderIncrementId, array $sku, string $status
|
175 |
* @return bool
|
@@ -235,7 +237,9 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
235 |
if (!$store_id) {
|
236 |
$this->_fault('invaild_store');
|
237 |
}
|
238 |
-
|
|
|
|
|
239 |
$orderItemsdDetails = array();
|
240 |
try{
|
241 |
|
@@ -264,7 +268,12 @@ class Logicbroker_Dropship360_Model_Order_Api extends Mage_Sales_Model_Order_Api
|
|
264 |
}
|
265 |
|
266 |
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
268 |
public function setLbOrderItemStatus($orderIncrementId,$itemStatus){
|
269 |
|
270 |
$order = $this->_initOrder($orderIncrementId);
|
153 |
$productItems = array();
|
154 |
$productItems = $this->_getAttributes($item, 'order_item');
|
155 |
$lbItems = Mage::getModel('dropship360/orderitems')->getCollection()
|
156 |
+
->addFieldToSelect(array('sku', 'lb_vendor_sku', 'lb_item_status', 'lb_vendor_code', 'item_id','vendor_cost'))
|
157 |
->addFieldToFilter('item_order_id',array('eq'=>$order->getId()))
|
158 |
->addFieldToFilter('item_id', array('eq'=>$productItems['item_id']))
|
159 |
->addFieldToFilter('lb_item_status', array('eq'=>$this->_itemStatusTansmitting));
|
160 |
$lbItems->getSelect()->join(array('salesOrder'=>Mage::getSingleton('core/resource')->getTableName('sales/order')),
|
161 |
'salesOrder.entity_id = main_table.item_order_id', array('state'))->where('salesOrder.state = ?','processing');
|
162 |
+
$lbItems->getSelect()->limit(1);
|
163 |
if($lbItems->getSize() > 0){
|
164 |
$productItems['lb_item_status'] = $lbItems->getFirstItem()->getLbItemStatus();
|
165 |
$productItems['lb_vendor_sku'] = $lbItems->getFirstItem()->getLbVendorSku();
|
166 |
$productItems['lb_vendor_code'] = $lbItems->getFirstItem()->getLbVendorCode();
|
167 |
+
$productItems['lb_vendor_cost'] = $lbItems->getFirstItem()->getVendorCost();
|
168 |
}
|
169 |
return $productItems;
|
170 |
}
|
171 |
|
172 |
|
173 |
/**
|
174 |
+
* Change Dropship360 order item status for given item sku
|
175 |
*
|
176 |
* @param string $orderIncrementId, array $sku, string $status
|
177 |
* @return bool
|
237 |
if (!$store_id) {
|
238 |
$this->_fault('invaild_store');
|
239 |
}
|
240 |
+
//Default DS item status will be TRANSMITTING
|
241 |
+
$orderItemStatus = (!empty($orderItemStatus)) ? $orderItemStatus : Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
242 |
+
|
243 |
$orderItemsdDetails = array();
|
244 |
try{
|
245 |
|
268 |
}
|
269 |
|
270 |
|
271 |
+
/**
|
272 |
+
* set itemStatus to all dropship360 order items irrespective of SKU
|
273 |
+
* @param Mage_sales_order $orderIncrementId
|
274 |
+
* @param Logicbroker_Dropship360_Model_Orderitems $itemStatus
|
275 |
+
* @return multitype:string
|
276 |
+
*/
|
277 |
public function setLbOrderItemStatus($orderIncrementId,$itemStatus){
|
278 |
|
279 |
$order = $this->_initOrder($orderIncrementId);
|
includes/src/Logicbroker_Dropship360_Model_Orderitems.php
CHANGED
@@ -25,7 +25,9 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
25 |
|
26 |
$collectionVendor = Mage::getModel ( 'dropship360/inventory' )->getCollection ()->addFieldToFilter ( 'product_sku', $productSku );
|
27 |
$collectionVendor->getSelect ()->joinleft ( array ('lbRanking' => Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/ranking' )), 'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array ('*') )->where('lbRanking.is_dropship = "yes" and lbRanking.is_active = "yes"');
|
|
|
28 |
$collectionVendor->getSelect ()->order ( $orderBy );
|
|
|
29 |
return $collectionVendor;
|
30 |
}
|
31 |
|
@@ -64,6 +66,7 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
64 |
{
|
65 |
$inventory = Mage::getModel ( 'dropship360/inventory' )->getCollection()
|
66 |
->addFieldToFilter('lb_vendor_code',$vendorCode)->addFieldToFilter('product_sku',$productSku);
|
|
|
67 |
$filedData = $inventory->getFirstItem()->getData();
|
68 |
$LbInventoryStock = $filedData['stock'];
|
69 |
$finalStock = $LbInventoryStock - $qtyInvoiced;
|
@@ -80,6 +83,7 @@ class Logicbroker_Dropship360_Model_Orderitems extends Mage_Core_Model_Abstract
|
|
80 |
{
|
81 |
$arrData = array();
|
82 |
$inventoryModel = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('lb_vendor_code',$request['lb_vendor_code'])->addFieldToFilter('product_sku',$request['product_sku']);
|
|
|
83 |
$arrData['lb_vendor_code'] = $request['lb_vendor_code'];
|
84 |
$arrData['lb_item_status'] = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
85 |
$arrData['updated_by'] = 'User';
|
25 |
|
26 |
$collectionVendor = Mage::getModel ( 'dropship360/inventory' )->getCollection ()->addFieldToFilter ( 'product_sku', $productSku );
|
27 |
$collectionVendor->getSelect ()->joinleft ( array ('lbRanking' => Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/ranking' )), 'lbRanking.lb_vendor_code = main_table.lb_vendor_code', array ('*') )->where('lbRanking.is_dropship = "yes" and lbRanking.is_active = "yes"');
|
28 |
+
$collectionVendor->getSelect ()->group ( 'lbRanking.id' );
|
29 |
$collectionVendor->getSelect ()->order ( $orderBy );
|
30 |
+
|
31 |
return $collectionVendor;
|
32 |
}
|
33 |
|
66 |
{
|
67 |
$inventory = Mage::getModel ( 'dropship360/inventory' )->getCollection()
|
68 |
->addFieldToFilter('lb_vendor_code',$vendorCode)->addFieldToFilter('product_sku',$productSku);
|
69 |
+
$inventory->getSelect()->limit(1);
|
70 |
$filedData = $inventory->getFirstItem()->getData();
|
71 |
$LbInventoryStock = $filedData['stock'];
|
72 |
$finalStock = $LbInventoryStock - $qtyInvoiced;
|
83 |
{
|
84 |
$arrData = array();
|
85 |
$inventoryModel = Mage::getModel('dropship360/inventory')->getCollection()->addFieldToFilter('lb_vendor_code',$request['lb_vendor_code'])->addFieldToFilter('product_sku',$request['product_sku']);
|
86 |
+
$inventoryModel->getSelect()->limit(1);
|
87 |
$arrData['lb_vendor_code'] = $request['lb_vendor_code'];
|
88 |
$arrData['lb_item_status'] = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
89 |
$arrData['updated_by'] = 'User';
|
includes/src/Logicbroker_Dropship360_Model_Ordersourcing.php
CHANGED
@@ -14,9 +14,18 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
14 |
protected $_pathBackorderStart = 'logicbroker/backorder_cron/start_time';
|
15 |
protected $_pathBackorderComp = 'logicbroker/backorder_cron/comp_time';
|
16 |
protected $_waitTIme = 30; //min
|
|
|
|
|
|
|
17 |
protected function _construct(){
|
18 |
$this->_init("dropship360/ordersourcing");
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function prepareItemCollection($crontype,$isCronSourcing = false){
|
21 |
$orderItemColletion = array();
|
22 |
$rowObj = new Varien_Object();
|
@@ -47,6 +56,11 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
47 |
}
|
48 |
return $orderItemColletion;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
50 |
protected function getOrderForProcess($condition){
|
51 |
$orderIds = array();
|
52 |
$processingItem = Mage::getModel('dropship360/orderitems')->getCollection();
|
@@ -54,7 +68,6 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
54 |
$processingItem->addFieldToFilter('state','processing');
|
55 |
$processingItem->addFieldToFilter('lb_item_status',array('in'=>$condition));
|
56 |
$processingItem->getSelect()->group('item_order_id');
|
57 |
-
//$processingItem->getSelect()->limit('200');
|
58 |
$processingItem->getSelect()->order('id asc');
|
59 |
if($processingItem->getSize() > 0){
|
60 |
foreach ($processingItem as $item){
|
@@ -63,28 +76,267 @@ class Logicbroker_Dropship360_Model_Ordersourcing extends Mage_Core_Model_Abstra
|
|
63 |
}
|
64 |
return $orderIds;
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
public function checkRunningStatus($type)
|
67 |
{
|
68 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
69 |
if(!Mage::getStoreConfigFlag($path)){
|
70 |
return false;//job not running
|
71 |
}
|
72 |
-
|
73 |
$time = strtotime(Mage::getStoreConfig($path));
|
74 |
-
|
75 |
return false;//insert forcefully
|
76 |
}*/
|
77 |
return true;
|
78 |
}
|
|
|
|
|
|
|
|
|
79 |
public function sourcingStarted($type){
|
80 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
81 |
$value = strftime('%Y-%m-%d %H:%M:00', time());
|
82 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
84 |
public function sourcingCompleted($type){
|
85 |
//$path = ($type == 'backorder') ? $this->_pathBackorderComp : $this->_pathSourcingComp;
|
86 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
87 |
$value = '';//strftime('%Y-%m-%d %H:%M:00', time());
|
88 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
14 |
protected $_pathBackorderStart = 'logicbroker/backorder_cron/start_time';
|
15 |
protected $_pathBackorderComp = 'logicbroker/backorder_cron/comp_time';
|
16 |
protected $_waitTIme = 30; //min
|
17 |
+
const XML_PATH_LOGICSOURCING_SOURCING_TYPE = 'logicbroker_sourcing/rank/sourcing_type';
|
18 |
+
protected $_orderStatus;
|
19 |
+
protected $_itemData = array();
|
20 |
protected function _construct(){
|
21 |
$this->_init("dropship360/ordersourcing");
|
22 |
}
|
23 |
+
/**
|
24 |
+
* Prepare order collection from logicbroker_sales_order_items
|
25 |
+
* @param $crontype (Reprocess,sourcing,backorder)
|
26 |
+
* @param string $isCronSourcing
|
27 |
+
* @return collection
|
28 |
+
*/
|
29 |
public function prepareItemCollection($crontype,$isCronSourcing = false){
|
30 |
$orderItemColletion = array();
|
31 |
$rowObj = new Varien_Object();
|
56 |
}
|
57 |
return $orderItemColletion;
|
58 |
}
|
59 |
+
/**
|
60 |
+
* unsed
|
61 |
+
* @param unknown $condition
|
62 |
+
* @return multitype:NULL
|
63 |
+
*/
|
64 |
protected function getOrderForProcess($condition){
|
65 |
$orderIds = array();
|
66 |
$processingItem = Mage::getModel('dropship360/orderitems')->getCollection();
|
68 |
$processingItem->addFieldToFilter('state','processing');
|
69 |
$processingItem->addFieldToFilter('lb_item_status',array('in'=>$condition));
|
70 |
$processingItem->getSelect()->group('item_order_id');
|
|
|
71 |
$processingItem->getSelect()->order('id asc');
|
72 |
if($processingItem->getSize() > 0){
|
73 |
foreach ($processingItem as $item){
|
76 |
}
|
77 |
return $orderIds;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* check souring cron running status
|
82 |
+
* @param cron_type $type
|
83 |
+
* @return boolean
|
84 |
+
*/
|
85 |
public function checkRunningStatus($type)
|
86 |
{
|
87 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
88 |
if(!Mage::getStoreConfigFlag($path)){
|
89 |
return false;//job not running
|
90 |
}
|
91 |
+
/*$now = time() - ($this->_waitTIme * 60);
|
92 |
$time = strtotime(Mage::getStoreConfig($path));
|
93 |
+
if ($time < $now) {
|
94 |
return false;//insert forcefully
|
95 |
}*/
|
96 |
return true;
|
97 |
}
|
98 |
+
/**
|
99 |
+
* set date time value in core_config_data when cron start
|
100 |
+
* @param cron_type $type
|
101 |
+
*/
|
102 |
public function sourcingStarted($type){
|
103 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
104 |
$value = strftime('%Y-%m-%d %H:%M:00', time());
|
105 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
106 |
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* update datetime value in core_config_data when sourcing done
|
110 |
+
* @param unknown $type
|
111 |
+
*/
|
112 |
public function sourcingCompleted($type){
|
113 |
//$path = ($type == 'backorder') ? $this->_pathBackorderComp : $this->_pathSourcingComp;
|
114 |
$path = ($type == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER) ? $this->_pathBackorderStart : $this->_pathSourcingStart;
|
115 |
$value = '';//strftime('%Y-%m-%d %H:%M:00', time());
|
116 |
Mage::getResourceModel('dropship360/ordersourcing')->saveConfig($path, $value);
|
117 |
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* save data in logicbroker_sales_order_item when new order placed using event
|
121 |
+
* @param sales_order_item $item
|
122 |
+
* @param event $object
|
123 |
+
*/
|
124 |
+
public function getOrderSourcing($item, $object){
|
125 |
+
return $this->_getOrderSourcing($item, $object);
|
126 |
+
}
|
127 |
+
protected function _getOrderSourcing($item, $object){
|
128 |
+
$orderSourcingInstance = Mage::getModel ( 'dropship360/orderitems' );
|
129 |
+
Mage::getModel('dropship360/logicbroker')->prepareNotification($orderSourcingInstance,$object->getOrder()->getEntityId());
|
130 |
+
$orderStatus = $object->getOrder()->getStatus();
|
131 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderSourcingInstance, 'Sourcing', $orderStatus);
|
132 |
+
$orderSourcingInstance->setSku ( $item->getSku() );
|
133 |
+
$orderSourcingInstance->setItemId ( $item->getItemId() );
|
134 |
+
$orderSourcingInstance->setItemOrderId ( $object->getOrder()->getEntityId() );
|
135 |
+
$orderSourcingInstance->setLbItemStatus ('Sourcing');
|
136 |
+
$orderSourcingInstance->setUpdatedBy ('Cron');
|
137 |
+
$orderSourcingInstance->setUpdatedAt(now());
|
138 |
+
$orderSourcingInstance->setItemStatusHistory($itemStatusHistory);
|
139 |
+
try {
|
140 |
+
$orderSourcingInstance->save ();
|
141 |
+
} catch ( Execption $e ) {
|
142 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'Section : order item inserted Error: '.$e->getMessage().' sku : '.$item->getSku());
|
143 |
+
echo $e->getMessage();
|
144 |
+
}
|
145 |
+
|
146 |
+
//As item get saved in logicbroker_sales_orders_items we run our sourcing logic
|
147 |
+
if(Mage::getStoreConfigFlag(self::XML_PATH_LOGICSOURCING_SOURCING_TYPE)){
|
148 |
+
$this->assignToVendor($item);
|
149 |
+
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$object->getOrder());
|
150 |
+
$this->_itemData = array();
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* process item and save order item ranking in logicbroker_sales_order_items
|
156 |
+
* @param cron_type $crontype
|
157 |
+
* @param string $isCronSourcing
|
158 |
+
*/
|
159 |
+
public function setLbVendorRanking($crontype,$isCronSourcing = false){
|
160 |
+
$this->_setLbVendorRanking($crontype,$isCronSourcing);
|
161 |
+
}
|
162 |
+
|
163 |
+
protected function _setLbVendorRanking($crontype,$isCronSourcing)
|
164 |
+
{
|
165 |
+
$reprocess = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS;
|
166 |
+
$lbOrderInstances = Mage::getModel('dropship360/ordersourcing');
|
167 |
+
$collection = $lbOrderInstances->prepareItemCollection($crontype,$isCronSourcing);
|
168 |
+
try{
|
169 |
+
if(count($collection) > 0 ){
|
170 |
+
foreach ( $collection as $orderID => $orderCollectionData ) {
|
171 |
+
$orderCollection = Mage::getModel('sales/order')->Load($orderID);
|
172 |
+
//Patch : skip sourcing process if order is deleted
|
173 |
+
if (! $orderCollection->getEntityId ()) {
|
174 |
+
Mage::helper ( 'dropship360' )->genrateLog ( 0, null, null, 'Order not exists for => order_id: ' . $orderID . ' hence cannot continue' );
|
175 |
+
continue;
|
176 |
+
}
|
177 |
+
$this->_orderStatus = $orderCollection->getStatus();
|
178 |
+
foreach ($orderCollectionData as $orderData ){
|
179 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'<---->Item Processing Started : Order id '.$orderID.'##'.$orderData->getSku());
|
180 |
+
if ($crontype == Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_REPROCESS) {
|
181 |
+
$assigned = $this->assignToVendor(Mage::getModel('sales/order_item')->Load($orderData->getItemId()));
|
182 |
+
}else
|
183 |
+
{
|
184 |
+
$orderItems = Mage::getModel( 'dropship360/orderitems' )->load($orderData->getItemId(), 'item_id');
|
185 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItems, $reprocess, $this->_orderStatus);
|
186 |
+
$this->_itemData[$orderData->getItemId()] = array('lb_item_status'=>$reprocess,'item_status_history'=>$itemStatusHistory);
|
187 |
+
}
|
188 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'####### Item Processing ended : Order id '.$orderID.'##'.$orderData->getSku());
|
189 |
+
|
190 |
+
}
|
191 |
+
Mage::getResourceModel('dropship360/orderitems')->saveOrderItems($this->_itemData,$orderCollection,$crontype);
|
192 |
+
$this->_itemData = array();
|
193 |
+
}
|
194 |
+
}else {
|
195 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'Order collection is empty for => Cron_type: '.$crontype.' hence cannot continue');
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
}catch (Exception $e){
|
199 |
+
Mage::helper('dropship360')->genrateLog(null,null,null,$e->getMessage());
|
200 |
+
Mage::helper('dropship360')->genrateLog(null,null,null,$e->getTraceAsString());
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* assign vendor for item on the basis of ranking and configuration
|
207 |
+
* @param sa;es_order_item $item
|
208 |
+
* @return string
|
209 |
+
*/
|
210 |
+
protected function assignToVendor($item) {
|
211 |
+
$productSku = $item->getSku ();
|
212 |
+
$itemStatusComplete = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_TRANSMITTING;
|
213 |
+
$itemStatusBackorder = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_BACKORDER;
|
214 |
+
$itemStatusNoDropShip = Logicbroker_Dropship360_Helper_Data::LOGICBROKER_ITEM_STATUS_NO_DROPSHIP;
|
215 |
+
$qtyInvoiced = $item->getQtyOrdered ();
|
216 |
+
$itemId = $item->getItemId ();
|
217 |
+
$isDefaultVendor = false;
|
218 |
+
$vendorCode = '';
|
219 |
+
$inventoryStock = '';
|
220 |
+
$defaultVendor = (Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder') == 'none') ? '' : Mage::getStoreConfig('logicbroker_sourcing/rank/defaultbackorder');
|
221 |
+
$orderItemInstance = Mage::getModel ( 'dropship360/orderitems' );
|
222 |
+
$orderItemInstance->load ( $itemId, 'item_id' );
|
223 |
+
$collectionVendor = $orderItemInstance->prepareOrderItemData($item);
|
224 |
+
$arrDefaultVendorDetails = array();
|
225 |
+
$vendorCost = 0;
|
226 |
+
|
227 |
+
if ($collectionVendor->count () > 0) {
|
228 |
+
if($collectionVendor->count () >= 1){
|
229 |
+
foreach ($collectionVendor as $vendorData) {
|
230 |
+
//assign default vendor details
|
231 |
+
if(!empty($defaultVendor) && $vendorData->getLbVendorCode() == $defaultVendor )
|
232 |
+
{
|
233 |
+
$arrDefaultVendorDetails = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
234 |
+
}
|
235 |
+
//if item is in backordered
|
236 |
+
if($vendorData->getStock() < $qtyInvoiced ){
|
237 |
+
$arrVendorDetail[] = array('lb_vendor_code'=>$vendorData->getLbVendorCode(),'stock'=>$vendorData->getStock(),'cost'=>$vendorData->getCost(),'lb_vendor_sku'=>$vendorData->getLbVendorSku(),'product_sku'=>$vendorData->getProductSku());
|
238 |
+
$vendorCode = $arrVendorDetail[0]['lb_vendor_code'];
|
239 |
+
$inventoryStock = $arrVendorDetail[0]['stock'];
|
240 |
+
$vendorCost = $arrVendorDetail[0]['cost'];
|
241 |
+
$vendorSku = $arrVendorDetail[0]['lb_vendor_sku'];
|
242 |
+
$productSku = $arrVendorDetail[0]['product_sku'];
|
243 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
244 |
+
$isDefaultVendor = true;
|
245 |
+
}else{
|
246 |
+
$vendorCode = $vendorData->getLbVendorCode();
|
247 |
+
$inventoryStock = $vendorData->getStock();
|
248 |
+
$vendorCost = $vendorData->getCost();
|
249 |
+
$vendorSku = $vendorData->getLbVendorSku();
|
250 |
+
$productSku = $vendorData->getProductSku();
|
251 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
252 |
+
$isDefaultVendor = false;
|
253 |
+
break;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
$arrVendorAvailable[] = $vendorData->getLbVendorCode();
|
257 |
+
}else {
|
258 |
+
$arrFirstVendor = $collectionVendor->getFirstItem ()->getData ();
|
259 |
+
$vendorCode = $arrFirstVendor ['lb_vendor_code'];
|
260 |
+
$inventoryStock = $arrFirstVendor ['stock'];
|
261 |
+
$vendorCost = $arrFirstVendor ['cost'];
|
262 |
+
$vendorSku = $arrFirstVendor ['lb_vendor_sku'];
|
263 |
+
$productSku = $arrFirstVendor ['product_sku'];
|
264 |
+
if($inventoryStock < $qtyInvoiced)
|
265 |
+
$isDefaultVendor = true;
|
266 |
+
else
|
267 |
+
$isDefaultVendor = false;
|
268 |
+
|
269 |
+
$arrVendorAvailable[] = $arrFirstVendor ['lb_vendor_code'];
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
if(!empty($vendorCode)){
|
274 |
+
if ($vendorCode && $inventoryStock >= $qtyInvoiced) {
|
275 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
276 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusComplete);
|
277 |
+
Mage::getModel('dropship360/logicbroker')->setupNotification();
|
278 |
+
$this->_itemData [$item->getItemId ()] = array (
|
279 |
+
'updateInventory' => true,
|
280 |
+
'qtyInvoiced' =>$qtyInvoiced,
|
281 |
+
'updated_at' => now (),
|
282 |
+
'sku' => $item->getSku (),
|
283 |
+
'updated_by' => 'Cron',
|
284 |
+
'lb_item_status' => $itemStatusComplete,
|
285 |
+
'lb_vendor_code' => $vendorCode,
|
286 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
287 |
+
'lb_vendor_sku' => $vendorSku,
|
288 |
+
'item_status_history' => $itemStatusHistory
|
289 |
+
);
|
290 |
+
return $itemStatusComplete;
|
291 |
+
}
|
292 |
+
if ($isDefaultVendor && $inventoryStock <= $qtyInvoiced && !empty($defaultVendor) && in_array($defaultVendor,$arrVendorAvailable)) {
|
293 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusComplete, $this->_orderStatus);
|
294 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details Default vendor set ==>stock('.$inventoryStock.') >= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->Transmitting');
|
295 |
+
$this->_itemData [$item->getItemId ()] = array (
|
296 |
+
'updateInventory' => false,
|
297 |
+
'updated_at' => now (),
|
298 |
+
'sku' => $item->getSku (),
|
299 |
+
'updated_by' => 'Cron',
|
300 |
+
'lb_item_status' => $itemStatusComplete,
|
301 |
+
'lb_vendor_code' => $defaultVendor,
|
302 |
+
'vendor_cost' => $arrDefaultVendorDetails ['cost'] * $qtyInvoiced,
|
303 |
+
'lb_vendor_sku' => $arrDefaultVendorDetails ['lb_vendor_sku'],
|
304 |
+
'item_status_history' => $itemStatusHistory
|
305 |
+
);
|
306 |
+
return $itemStatusComplete;
|
307 |
+
}
|
308 |
+
if ($vendorCode && $inventoryStock <= $qtyInvoiced) {
|
309 |
+
$itemStatusHistory =Mage::helper('dropship360')->getSerialisedData($orderItemInstance, $itemStatusBackorder, $this->_orderStatus);
|
310 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==>stock('.$inventoryStock.') <= qtyinvoiced('.$qtyInvoiced.'),vendor_code ->'.$vendorCode.', item-status->'.$itemStatusBackorder);
|
311 |
+
$this->_itemData [$item->getItemId ()] = array (
|
312 |
+
'updateInventory' => false,
|
313 |
+
'updated_at' => now (),
|
314 |
+
'sku' => $item->getSku (),
|
315 |
+
'updated_by' => 'Cron',
|
316 |
+
'lb_item_status' => $itemStatusBackorder,
|
317 |
+
'lb_vendor_code' => $vendorCode,
|
318 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
319 |
+
'lb_vendor_sku' => $vendorSku,
|
320 |
+
'item_status_history' => $itemStatusHistory
|
321 |
+
);
|
322 |
+
return $itemStatusBackorder;
|
323 |
+
}
|
324 |
+
}else{
|
325 |
+
$itemStatusHistory = Mage::helper('dropship360')->getSerialisedData($orderItemInstance,$itemStatusNoDropShip, $this->_orderStatus);
|
326 |
+
Mage::helper('dropship360')->genrateLog(0,null,null,'@@@@@@@@ Sourcing Details==> No vendor Set ,vendor_code ->'.$vendorCode.', item-status->No Dropship');
|
327 |
+
$this->_itemData [$item->getItemId ()] = array (
|
328 |
+
'updateInventory' => false,
|
329 |
+
'updated_at' => now (),
|
330 |
+
'sku' => $item->getSku (),
|
331 |
+
'updated_by' => 'Cron',
|
332 |
+
'lb_item_status' => $itemStatusNoDropShip,
|
333 |
+
'lb_vendor_code' => $vendorCode,
|
334 |
+
'vendor_cost' => $vendorCost * $qtyInvoiced,
|
335 |
+
'lb_vendor_sku' => '',
|
336 |
+
'item_status_history' => $itemStatusHistory
|
337 |
+
);
|
338 |
+
return $itemStatusNoDropShip;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
}
|
includes/src/Logicbroker_Dropship360_Model_Productimport.php
CHANGED
@@ -10,7 +10,7 @@ class Logicbroker_Dropship360_Model_Productimport {
|
|
10 |
protected $prePopulatedAttribute = array ();
|
11 |
protected $catalogTable;
|
12 |
protected $productCategory;
|
13 |
-
protected $allowedAttribute = array('name','short_description','description','weight','price','msrp','manufacturer','action','
|
14 |
protected $preDefineAttribute = array (
|
15 |
'status' => 2,
|
16 |
'visibility' => 1,
|
10 |
protected $prePopulatedAttribute = array ();
|
11 |
protected $catalogTable;
|
12 |
protected $productCategory;
|
13 |
+
protected $allowedAttribute = array('name','short_description','description','weight','price','msrp','manufacturer','action','upc','manufacturer_part_number');
|
14 |
protected $preDefineAttribute = array (
|
15 |
'status' => 2,
|
16 |
'visibility' => 1,
|
includes/src/Logicbroker_Dropship360_Model_Ranking.php
CHANGED
@@ -49,12 +49,13 @@ class Logicbroker_Dropship360_Model_Ranking extends Mage_Core_Model_Abstract
|
|
49 |
}
|
50 |
|
51 |
protected function saveVendorDetails($value){
|
|
|
52 |
$vendorDetail = Mage::getModel('dropship360/ranking')->load($value['lb_vendor_code'],'lb_vendor_code');
|
53 |
if(!$vendorDetail->getId()){
|
54 |
$vendorDetail->setLbVendorCode($value['lb_vendor_code']);
|
55 |
-
$vendorDetail->setLbVendorName($value['lb_vendor_name']);
|
56 |
$vendorDetail->setRanking($value['ranking']);
|
57 |
-
|
58 |
$vendorDetail->setUpdatedAt(now());
|
59 |
$vendorDetail->setCreatedAt(now());
|
60 |
$vendorDetail->save();
|
49 |
}
|
50 |
|
51 |
protected function saveVendorDetails($value){
|
52 |
+
$helper = Mage::helper('dropship360');
|
53 |
$vendorDetail = Mage::getModel('dropship360/ranking')->load($value['lb_vendor_code'],'lb_vendor_code');
|
54 |
if(!$vendorDetail->getId()){
|
55 |
$vendorDetail->setLbVendorCode($value['lb_vendor_code']);
|
56 |
+
$vendorDetail->setLbVendorName($helper->convertToHtmlcode($value['lb_vendor_name']));
|
57 |
$vendorDetail->setRanking($value['ranking']);
|
58 |
+
$vendorDetail->setIsDropship('no');
|
59 |
$vendorDetail->setUpdatedAt(now());
|
60 |
$vendorDetail->setCreatedAt(now());
|
61 |
$vendorDetail->save();
|
includes/src/Logicbroker_Dropship360_Model_Resource_Orderitems.php
CHANGED
@@ -13,6 +13,7 @@ class Logicbroker_Dropship360_Model_Resource_Orderitems extends Mage_Core_Model_
|
|
13 |
{
|
14 |
$this->_init("dropship360/orderitems", "id");
|
15 |
}
|
|
|
16 |
public function saveOrderItems($itemData,$orderObj,$crontype)
|
17 |
{
|
18 |
try {
|
13 |
{
|
14 |
$this->_init("dropship360/orderitems", "id");
|
15 |
}
|
16 |
+
|
17 |
public function saveOrderItems($itemData,$orderObj,$crontype)
|
18 |
{
|
19 |
try {
|
includes/src/Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist.php
CHANGED
@@ -83,7 +83,7 @@ class Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist
|
|
83 |
if($collectionVendor->count() > 0){
|
84 |
foreach ($collectionVendor as $vendor) {
|
85 |
$options[] = array(
|
86 |
-
'label' => $vendor->getLbVendorCode().'--'
|
87 |
'value' => $vendor->getLbVendorCode()
|
88 |
);
|
89 |
}
|
83 |
if($collectionVendor->count() > 0){
|
84 |
foreach ($collectionVendor as $vendor) {
|
85 |
$options[] = array(
|
86 |
+
'label' => $vendor->getLbVendorCode().'--'.html_entity_decode($vendor->getLbVendorName(),ENT_QUOTES,"ISO-8859-1"),
|
87 |
'value' => $vendor->getLbVendorCode()
|
88 |
);
|
89 |
}
|
includes/src/Logicbroker_Dropship360_Model_Uploadvendor.php
CHANGED
@@ -10,42 +10,9 @@
|
|
10 |
class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
|
13 |
-
const FIELD_NAME_SOURCE_FILE = 'import_file';
|
14 |
-
protected $_isProductSetupMode = false;
|
15 |
-
protected $sendBadFileAlert = false;
|
16 |
-
protected $_haderError = array();
|
17 |
-
protected $_FtpErrors = array();
|
18 |
-
protected $_UploadCsvErrors = array();
|
19 |
-
protected $_inventoryModel;
|
20 |
-
protected $_vendorSkuFlag = array();
|
21 |
-
protected $conn;
|
22 |
-
protected $ftpRequestPram = array();
|
23 |
-
protected $_errors = array();
|
24 |
-
const XML_PATH_UPLOAD_ENABLED = 'logicbroker_sourcing/cron_settings_upload/enabled';
|
25 |
-
const XML_PATH_UPLOAD_FTP_SITE = 'logicbroker_sourcing/cron_settings_upload/ftp_site';
|
26 |
-
const XML_PATH_UPLOAD_FTP_USERNAME = 'logicbroker_sourcing/cron_settings_upload/ftp_username';
|
27 |
-
const XML_PATH_UPLOAD_FTP_PASSWORD = 'logicbroker_sourcing/cron_settings_upload/ftp_password';
|
28 |
-
const XML_PATH_UPLOAD_FTP_TYPE = 'logicbroker_sourcing/cron_settings_upload/ftp_type';
|
29 |
-
const XML_PATH_UPLOAD_FTP_ACCNUMBER = 'logicbroker_sourcing/cron_settings_upload/ftp_accnumber';
|
30 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL = 'logicbroker_sourcing/inventory_notification/email';
|
31 |
-
const XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED = 'logicbroker_sourcing/inventory_notification/enabled';
|
32 |
-
protected $ftpCSVFormat = array('vendor_code','vendor_sku','qty','cost');
|
33 |
-
protected $manualCSVFormat = array('vendor_sku','qty','cost');
|
34 |
-
protected $productSetupCSVFormat = array('magento_sku','vendor_sku','','');
|
35 |
-
protected $_csvDataCache;
|
36 |
-
protected $_vendorCode;
|
37 |
-
protected $_csvParserObj;
|
38 |
-
protected $emptyRecords = array(); //checkDataIntigrity fnction store empty records from CSV
|
39 |
-
protected $result = array(); //checkDataIntigrity fnction store final result for error
|
40 |
-
protected $supplierName = '';
|
41 |
-
|
42 |
protected function _construct()
|
43 |
{
|
44 |
-
$this->_inventoryModel = Mage::getModel('dropship360/inventory');
|
45 |
-
$this->conn = $this->getDatabaseConnection ();
|
46 |
$this->_init("dropship360/uploadvendor");
|
47 |
-
$this->_csvParserObj = Mage::getModel('dropship360/csvparser');
|
48 |
-
|
49 |
}
|
50 |
|
51 |
public function getDatabaseConnection()
|
@@ -53,1233 +20,6 @@ class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstrac
|
|
53 |
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
54 |
}
|
55 |
|
56 |
-
protected function _getSession()
|
57 |
-
{
|
58 |
-
return Mage::getSingleton('adminhtml/session');
|
59 |
-
}
|
60 |
-
|
61 |
-
protected function _getCsvData($fileName,$header = false)
|
62 |
-
{
|
63 |
-
$csvObject = new Varien_File_Csv();
|
64 |
-
|
65 |
-
if(!$this->_csvDataCache){
|
66 |
-
$this->_csvDataCache = $this->_csvParserObj->getChangedValue($csvObject->getData($fileName),$this->_vendorCode);
|
67 |
-
}else
|
68 |
-
{
|
69 |
-
if($header){
|
70 |
-
return array($this->_csvDataCache[0]);
|
71 |
-
}else
|
72 |
-
{
|
73 |
-
$this->_csvDataCache;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
return $this->_csvDataCache;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Import working directory
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
|
87 |
-
public static function getWorkingDir()
|
88 |
-
{
|
89 |
-
return Mage::getBaseDir('var') . DS . 'logicbrokervendorproduct' . DS;
|
90 |
-
}
|
91 |
-
|
92 |
-
public function insertCronEntry($filename,$data = null){
|
93 |
-
|
94 |
-
$this->setFileName($filename);
|
95 |
-
$this->setUpdatedBy('manually');
|
96 |
-
$this->setUpdatedAt(now());
|
97 |
-
$this->setLbVendorCode(Mage::app()->getRequest()->getPost('vendor'));
|
98 |
-
try{
|
99 |
-
$this->save();
|
100 |
-
}catch(Exception $e){
|
101 |
-
$this->_getSession()->addError(Mage::helper('dropship360')->__($e->getMessage()));
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
public function uploadSource()
|
106 |
-
{
|
107 |
-
$error = false;
|
108 |
-
$this->_vendorCode = $this->getVendor();
|
109 |
-
$this->_isProductSetupMode = $this->getProductsetupmode();
|
110 |
-
$entity = 'vendor_product_'.date('ymdHis');
|
111 |
-
$uploader = Mage::getModel('core/file_uploader', self::FIELD_NAME_SOURCE_FILE);
|
112 |
-
$uploader->skipDbProcessing(true);
|
113 |
-
$result = $uploader->save(self::getWorkingDir());
|
114 |
-
$extension = pathinfo($result['file'], PATHINFO_EXTENSION);
|
115 |
-
$uploadedFile = $result['path'] . $result['file'];
|
116 |
-
$error = $this->validateCsv($uploadedFile);
|
117 |
-
if($error){
|
118 |
-
$this->fileObj()->rm($uploadedFile);
|
119 |
-
$this->_getSession()->addNotice(Mage::helper('dropship360')->__('Please fix errors and re-upload file'));
|
120 |
-
return $error;
|
121 |
-
}
|
122 |
-
|
123 |
-
$sourceFile = self::getWorkingDir() . $entity;
|
124 |
-
|
125 |
-
$sourceFile .= '.' . strtolower($extension);
|
126 |
-
$fileName = $entity.'.'.strtolower($extension);
|
127 |
-
|
128 |
-
if(strtolower($uploadedFile) != strtolower($sourceFile)) {
|
129 |
-
if (file_exists($sourceFile)) {
|
130 |
-
$this->fileObj()->rm($sourceFile);
|
131 |
-
}
|
132 |
-
|
133 |
-
if (!@rename($uploadedFile, $sourceFile)) {
|
134 |
-
Mage::throwException(Mage::helper('importexport')->__('Source file moving failed'));
|
135 |
-
}
|
136 |
-
}
|
137 |
-
Mage::register('file_name',$fileName);
|
138 |
-
if(!$error)
|
139 |
-
$this->insertCronEntry($fileName);
|
140 |
-
|
141 |
-
return $error;
|
142 |
-
}
|
143 |
-
|
144 |
-
|
145 |
-
public function validateCsv($fileName)
|
146 |
-
{
|
147 |
-
//$fileName
|
148 |
-
$isError = false;
|
149 |
-
$csvData = $this->_getCsvData($fileName,true);
|
150 |
-
|
151 |
-
/** checks columns */
|
152 |
-
|
153 |
-
if($this->validateCsvHeader($csvData)){
|
154 |
-
$isError = false;
|
155 |
-
}else{
|
156 |
-
$this->_getSession()->addError(Mage::helper('dropship360')->__('CSV header %s is invalid ',implode(',',$this->_haderError)));
|
157 |
-
$isError = true;
|
158 |
-
$this->_csvDataCache = array();
|
159 |
-
}
|
160 |
-
return $isError;
|
161 |
-
}
|
162 |
-
|
163 |
-
protected function validateCsvHeader($csvData,$isFtp = false)
|
164 |
-
{
|
165 |
-
$result = true;
|
166 |
-
if(empty($csvData))
|
167 |
-
{
|
168 |
-
return false;
|
169 |
-
}
|
170 |
-
if ($this->_isProductSetupMode && !$isFtp ){
|
171 |
-
$csvFields = $this->productSetupCSVFormat;
|
172 |
-
}else{
|
173 |
-
$csvFields = (!$isFtp) ? $this->manualCSVFormat : $this->ftpCSVFormat;
|
174 |
-
}
|
175 |
-
$cvsDataNum = count($csvData[0]);
|
176 |
-
|
177 |
-
if(!$this->validateManualCsvHeader($cvsDataNum,$csvData,$isFtp))
|
178 |
-
return false;
|
179 |
-
if(!$this->validateFtpCsvHeader($cvsDataNum,$csvData))
|
180 |
-
return false;
|
181 |
-
if(!$this->validateProductSetupCsvHeader($cvsDataNum,$csvData))
|
182 |
-
return false;
|
183 |
-
for ($i = 0; $i < $cvsDataNum; $i++) {
|
184 |
-
if( $isFtp && ($csvData[0][0] == 'vendor_code' || $csvData[0][0] == 'vendor_sku')){
|
185 |
-
continue;
|
186 |
-
}
|
187 |
-
if($csvData[0][$i] == $csvFields[$i]){
|
188 |
-
continue;
|
189 |
-
}else{
|
190 |
-
(!$isFtp) ? $this->_haderError[] = $csvData[0][$i] : '';
|
191 |
-
$result = false;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
return $result;
|
195 |
-
}
|
196 |
-
|
197 |
-
protected function validateManualCsvHeader($cvsDataNum,$csvData,$isFtp)
|
198 |
-
{
|
199 |
-
if(!$isFtp && !$this->_isProductSetupMode ){
|
200 |
-
if($cvsDataNum != 3){
|
201 |
-
foreach ($csvData[0] as $val){
|
202 |
-
if(!in_array($val,array('vendor_sku','cost','qty')))
|
203 |
-
{
|
204 |
-
$this->_haderError[] = $val;
|
205 |
-
}
|
206 |
-
}
|
207 |
-
return false;
|
208 |
-
}
|
209 |
-
}
|
210 |
-
return true;
|
211 |
-
}
|
212 |
-
protected function validateFtpCsvHeader($cvsDataNum,$csvData)
|
213 |
-
{
|
214 |
-
$validation = true;
|
215 |
-
if($cvsDataNum == 3 || $cvsDataNum == 4){
|
216 |
-
foreach ($csvData[0] as $val){
|
217 |
-
if(!in_array($val,($cvsDataNum == 3) ? array('vendor_sku','qty', 'cost') : array('vendor_code','vendor_sku','qty', 'cost'))){
|
218 |
-
$this->_haderError[] = $val;
|
219 |
-
$validation = false;
|
220 |
-
}
|
221 |
-
}
|
222 |
-
return $validation;
|
223 |
-
}
|
224 |
-
return true;
|
225 |
-
}
|
226 |
-
protected function validateProductSetupCsvHeader($cvsDataNum,$csvData)
|
227 |
-
{
|
228 |
-
if($this->_isProductSetupMode ){
|
229 |
-
if($cvsDataNum != 2){
|
230 |
-
foreach ($csvData[0] as $val){
|
231 |
-
if(!in_array($val,array('vendor_sku','magento_sku')))
|
232 |
-
{
|
233 |
-
$this->_haderError[] = $val;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
return false;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
return true;
|
240 |
-
}
|
241 |
-
protected function checkDataIntigrity($csvData,$isFtp = false){
|
242 |
-
|
243 |
-
//patch for FTP backward compatibility header
|
244 |
-
(count($csvData[0]) <= 3) ? array_unshift($csvData[0], "") : $csvData[0];
|
245 |
-
foreach($csvData as $row => $csvRowData)
|
246 |
-
{
|
247 |
-
if($row == 0)
|
248 |
-
continue;
|
249 |
-
if(!$this->_isProductSetupMode && !$isFtp){
|
250 |
-
array_unshift($csvRowData, "");
|
251 |
-
}
|
252 |
-
//patch for FTP backward compatibility data
|
253 |
-
if($isFtp)
|
254 |
-
(count($csvRowData) <= 3) ? array_unshift($csvRowData, "") : $csvRowData;
|
255 |
-
$this->getErrorRowNumber($csvRowData,$row);
|
256 |
-
}
|
257 |
-
$this->generateMsg($isFtp,$this->result,$this->emptyRecords);
|
258 |
-
return in_array(true,$this->result) ? true : false;
|
259 |
-
}
|
260 |
-
protected function getErrorRowNumber($csvRowData,$row)
|
261 |
-
{
|
262 |
-
|
263 |
-
foreach($csvRowData as $key => $data){
|
264 |
-
$data = trim($data);
|
265 |
-
switch($key){
|
266 |
-
case is_numeric($key) ? 0 : 'magento_sku' :
|
267 |
-
if($this->_isProductSetupMode){
|
268 |
-
if(empty($data)){
|
269 |
-
$this->emptyRecords['magento_sku'][] = $row;
|
270 |
-
$this->result[] = true;
|
271 |
-
} else {
|
272 |
-
$this->result[] = false;
|
273 |
-
}
|
274 |
-
}else{
|
275 |
-
continue;
|
276 |
-
}
|
277 |
-
break;
|
278 |
-
case is_numeric($key) ? 1 : 'vendor_sku':
|
279 |
-
if(empty($data)){
|
280 |
-
$this->emptyRecords['vendor_sku'][] = $row;
|
281 |
-
$this->result[] = true;
|
282 |
-
}
|
283 |
-
else
|
284 |
-
$this->result[] = false;
|
285 |
-
break;
|
286 |
-
case is_numeric($key) ? 2 : 'qty':
|
287 |
-
if(!is_numeric($data) || $data < 0 )
|
288 |
-
{
|
289 |
-
if($data!=""){
|
290 |
-
$this->emptyRecords['qty'][] = $row;
|
291 |
-
$this->result[] = true;
|
292 |
-
}
|
293 |
-
}
|
294 |
-
else
|
295 |
-
$this->result[] = false;
|
296 |
-
break;
|
297 |
-
case is_numeric($key) ? 3 : 'cost':
|
298 |
-
if(!is_numeric($data) || $data < 0 ){
|
299 |
-
if($data!=""){
|
300 |
-
$this->emptyRecords['cost'][] = $row;
|
301 |
-
$this->result[] = true;
|
302 |
-
}
|
303 |
-
}
|
304 |
-
else
|
305 |
-
$this->result[] = false;
|
306 |
-
break;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
return;
|
310 |
-
}
|
311 |
-
protected function generateMsg($isFtp,$result,$emptyRecords){
|
312 |
-
|
313 |
-
$error = in_array(true,$result) ? true : false;
|
314 |
-
if($error){
|
315 |
-
foreach($emptyRecords as $key=>$value){
|
316 |
-
if($this->_isProductSetupMode){
|
317 |
-
if($key == 'magento_sku'){
|
318 |
-
$string = implode(';',$value);
|
319 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_magento_sku','value'=>$string);
|
320 |
-
}
|
321 |
-
}
|
322 |
-
if($key == 'vendor_sku'){
|
323 |
-
$string = implode(';',$value);
|
324 |
-
if($isFtp){
|
325 |
-
$this->_FtpErrors[] = array('error_type'=>'row_vendor_sku','value'=>$string);
|
326 |
-
$this->sendBadFileAlert = true;
|
327 |
-
}else{
|
328 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_vendor_sku','value'=>$string);
|
329 |
-
}
|
330 |
-
}
|
331 |
-
if($key == 'qty'){
|
332 |
-
$string = implode(';',$value);
|
333 |
-
if($isFtp){
|
334 |
-
$this->_FtpErrors[] = array('error_type'=>'row_qty','value'=>$string);
|
335 |
-
$this->sendBadFileAlert = true;
|
336 |
-
}else{
|
337 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_qty','value'=>$string);
|
338 |
-
}
|
339 |
-
}
|
340 |
-
if($key == 'cost'){
|
341 |
-
$string = implode(';',$value);
|
342 |
-
if($isFtp){
|
343 |
-
$this->_FtpErrors[] = array('error_type'=>'row_cost','value'=>$string);
|
344 |
-
$this->sendBadFileAlert = true;
|
345 |
-
}else{
|
346 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'row_cost','value'=>$string);
|
347 |
-
}
|
348 |
-
}
|
349 |
-
}
|
350 |
-
}
|
351 |
-
return ;
|
352 |
-
}
|
353 |
-
|
354 |
-
protected function getConfigValue($path)
|
355 |
-
{
|
356 |
-
return Mage::getStoreConfig($path);
|
357 |
-
}
|
358 |
-
public function getMagentoSku($vendorCode,$vendorSku){
|
359 |
-
$sku = '';
|
360 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$vendorSku);
|
361 |
-
if($vendorCollection->count() > 0)
|
362 |
-
{
|
363 |
-
$sku = $vendorCollection->getFirstItem()->getProductSku();
|
364 |
-
}
|
365 |
-
return $sku;
|
366 |
-
}
|
367 |
-
|
368 |
-
/* parse uploaded csv file */
|
369 |
-
public function parseCsv($fileName = null,$lb_vendor_code = null)
|
370 |
-
{
|
371 |
-
$records = array();
|
372 |
-
$success = array();
|
373 |
-
$failure = array();
|
374 |
-
$counter = 0;
|
375 |
-
$foramterroroutput = array();
|
376 |
-
$this->_csvDataCache = array();
|
377 |
-
$this->_vendorCode = $lb_vendor_code;
|
378 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
379 |
-
$csvData = $this->_getCsvData(self::getWorkingDir().$fileName);
|
380 |
-
|
381 |
-
if(count($csvData) <= 1 && Mage::getModel('dropship360/csvparser')->isCsvFileEmpty())
|
382 |
-
{
|
383 |
-
$failure[$fileName] = 'Sorry,we cant find the record to update inventory';
|
384 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'empty_file','value'=>'Sorry,we cant find the record to update inventory');
|
385 |
-
}
|
386 |
-
|
387 |
-
$records = Mage::getModel('dropship360/csvparser')->generateManualCsvRow($csvData,$this->_isProductSetupMode,$lb_vendor_code);
|
388 |
-
|
389 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
390 |
-
//$this->conn->beginTransaction ();
|
391 |
-
if(is_array($records) && !empty($records)){
|
392 |
-
$requestData = array_chunk($records, 1, true);
|
393 |
-
|
394 |
-
foreach($requestData as $dataArr){
|
395 |
-
foreach($dataArr as $data){
|
396 |
-
if($this->_isProductSetupMode){
|
397 |
-
$result[] = $this->validateProductSetupMode($data);
|
398 |
-
}else{
|
399 |
-
$result[] = $this->validateCsvData($data);
|
400 |
-
}
|
401 |
-
}
|
402 |
-
}
|
403 |
-
foreach($result as $successOrfail){
|
404 |
-
if($successOrfail['success']!="")
|
405 |
-
$success[] = $successOrfail['success'];
|
406 |
-
if($successOrfail['failure']!="")
|
407 |
-
$failure[] = $successOrfail['failure'];
|
408 |
-
}
|
409 |
-
try{
|
410 |
-
$updateFileStatus = Mage::getModel('dropship360/uploadvendor')->load($fileName,'file_name');
|
411 |
-
$updateFileStatus->setImportStatus('done');
|
412 |
-
$updateFileStatus->save();
|
413 |
-
}catch(Exception $e){
|
414 |
-
echo $e->getMessage();
|
415 |
-
$this->_errors[] = $e->getMessage();
|
416 |
-
$this->_errors[] = $e->getTrace();
|
417 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
418 |
-
Mage::logException($e);
|
419 |
-
}
|
420 |
-
$this->checkDataIntigrity($csvData);
|
421 |
-
}
|
422 |
-
$finalResultCounter = (!$this->_isProductSetupMode) ? $this->logForUnprocessedRows($lb_vendor_code) : 0;
|
423 |
-
|
424 |
-
if(is_array($finalResultCounter))
|
425 |
-
{
|
426 |
-
$failed = count($failure)+$finalResultCounter['failure'];
|
427 |
-
$success = count($success)+$finalResultCounter['success'];
|
428 |
-
}else
|
429 |
-
{
|
430 |
-
$failed = count($failure)+$finalResultCounter;
|
431 |
-
$success = count($success)+$finalResultCounter;
|
432 |
-
}
|
433 |
-
|
434 |
-
$ftp_err = ($failed > 0) ? 'Missing/Bad Data' : '';
|
435 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,ftp_error,created_at) VALUES ("'.$lb_vendor_code.'","'.Mage::getSingleton('admin/session')->getUser()->getUsername().'",'.$success.','.$failed.',"'.$ftp_err.'","'.now().'")';
|
436 |
-
$this->conn->beginTransaction ();
|
437 |
-
$this->conn->query($insert);
|
438 |
-
$entityId = $this->conn->lastInsertId($tableVendorImportLog);
|
439 |
-
try {
|
440 |
-
$this->conn->commit ();
|
441 |
-
$this->prepareInsertAndExeQuery($this->_UploadCsvErrors,$entityId);
|
442 |
-
$file = self::getWorkingDir() . $fileName;
|
443 |
-
$this->fileObj()->rm($file);
|
444 |
-
} catch ( Exception $e ) {
|
445 |
-
$this->conn->rollBack ();
|
446 |
-
$this->_errors[] = $e->getMessage();
|
447 |
-
$this->_errors[] = $e->getTrace();
|
448 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
449 |
-
Mage::logException($e);
|
450 |
-
echo $e->getMessage();
|
451 |
-
|
452 |
-
}
|
453 |
-
$this->_csvParserObj->emptyTable();
|
454 |
-
$this->_csvDataCache = array();
|
455 |
-
$this->_vendorSkuFlag = array();
|
456 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal trasectional level
|
457 |
-
return $this;
|
458 |
-
}
|
459 |
-
|
460 |
-
|
461 |
-
protected function chekDuplicateCombination($data)
|
462 |
-
{
|
463 |
-
$result = true;
|
464 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
465 |
-
if($collection->count() > 0){
|
466 |
-
$existing_product_sku = $collection->getFirstItem()->getProductSku();
|
467 |
-
if(!empty($existing_product_sku)){
|
468 |
-
if($data['magento_sku'] != $existing_product_sku){
|
469 |
-
$result = false;
|
470 |
-
}
|
471 |
-
}
|
472 |
-
}
|
473 |
-
$inventoryCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',$data['magento_sku']);
|
474 |
-
if($inventoryCollection->getSize() > 0){
|
475 |
-
$inventoryCollection = $inventoryCollection->getData();
|
476 |
-
$inventoryCollection = $inventoryCollection[0];
|
477 |
-
$existing_vendor_sku = $inventoryCollection['lb_vendor_sku'];
|
478 |
-
if($existing_vendor_sku != trim($data['vendor_sku']))
|
479 |
-
{
|
480 |
-
$result = false;
|
481 |
-
}
|
482 |
-
}
|
483 |
-
return $result;
|
484 |
-
}
|
485 |
-
|
486 |
-
protected function _prepareCollection()
|
487 |
-
{
|
488 |
-
$collection = $this->getCollection()->addFieldToFilter('import_status','pending');
|
489 |
-
$collection->getSelect()->limit(1);
|
490 |
-
return $collection;
|
491 |
-
}
|
492 |
-
|
493 |
-
protected function calculateProductQty($data){
|
494 |
-
$qty = 0;
|
495 |
-
$configBuffer = 0;
|
496 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
497 |
-
return array('final_qty'=> .999999999,'upload_qty'=> .999999999); // apply patch for accept empty qty row from CSV
|
498 |
-
}
|
499 |
-
$buffer = Mage::getStoreConfig('logicbroker_sourcing/inventory/buffer');
|
500 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldToFilter('product_sku',$data['magento_sku']);
|
501 |
-
if($collection->count() > 0){
|
502 |
-
foreach($collection as $qtyData){
|
503 |
-
if($data['lb_vendor_code'] != $qtyData->getLbVendorCode() )
|
504 |
-
$qty += $qtyData->getStock();
|
505 |
-
}
|
506 |
-
}
|
507 |
-
|
508 |
-
if($data['qty'] <= 0){
|
509 |
-
$rQty = 0;
|
510 |
-
}else{
|
511 |
-
$rQty = $data['qty'];
|
512 |
-
}
|
513 |
-
|
514 |
-
if(!empty($buffer) && $buffer >= 0){
|
515 |
-
$configBuffer = $buffer;
|
516 |
-
}else{
|
517 |
-
$configBuffer = 0;
|
518 |
-
}
|
519 |
-
|
520 |
-
$uploadQty = $rQty - $configBuffer;
|
521 |
-
$finalUploadQty = ($uploadQty >= 0) ? $uploadQty : 0;
|
522 |
-
$finalQty = $qty+$finalUploadQty;
|
523 |
-
return array('final_qty'=> ($finalQty >= 0) ? $finalQty : 0,'upload_qty'=> $finalUploadQty);
|
524 |
-
}
|
525 |
-
protected function vendorProductInsert($data)
|
526 |
-
{
|
527 |
-
$tableVendorInventory = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
528 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data);
|
529 |
-
$qtyArray = $this->calculateProductQty($data);
|
530 |
-
|
531 |
-
switch($inventoryCollectionResult['operationType'])
|
532 |
-
{
|
533 |
-
case 'update':
|
534 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']));
|
535 |
-
if($productId){
|
536 |
-
|
537 |
-
$update = $this->_prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,false);
|
538 |
-
|
539 |
-
try {
|
540 |
-
if(!$this->updateProductInventory(trim($data['magento_sku']),$qtyArray['final_qty']))
|
541 |
-
{
|
542 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
543 |
-
return false;
|
544 |
-
}
|
545 |
-
if($update){
|
546 |
-
$this->conn->beginTransaction ();
|
547 |
-
$this->conn->query($update);
|
548 |
-
$this->conn->commit ();
|
549 |
-
}
|
550 |
-
return true;
|
551 |
-
} catch ( Exception $e ) {
|
552 |
-
$this->conn->rollBack ();
|
553 |
-
$this->_errors[] = $e->getMessage();
|
554 |
-
$this->_errors[] = $e->getTrace();
|
555 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
556 |
-
Mage::logException($e);
|
557 |
-
echo $e->getMessage();
|
558 |
-
}
|
559 |
-
|
560 |
-
}else
|
561 |
-
{
|
562 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'magento_sku_exists','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
563 |
-
return false;
|
564 |
-
}
|
565 |
-
break;
|
566 |
-
case 'productsetup' :
|
567 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($data['magento_sku']);
|
568 |
-
if($productId){
|
569 |
-
$qtyInsert = $qtyArray['upload_qty'];
|
570 |
-
$costInsert = $data['cost'];
|
571 |
-
$insert = 'INSERT INTO '.$tableVendorInventory.' (lb_vendor_code,lb_vendor_name,product_sku,lb_vendor_sku,stock,cost,created_at,updated_at) VALUES ("'.$data['lb_vendor_code'].'","'.$this->getVendorName($data['lb_vendor_code']).'","'.$data['magento_sku'].'","'.$data['vendor_sku'].'",'.$qtyInsert.','.$costInsert.',"'.now().'","'.now().'")';
|
572 |
-
try {
|
573 |
-
if(!$this->updateProductInventory($data['magento_sku'],$qtyArray['final_qty']))
|
574 |
-
{
|
575 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_add_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
576 |
-
return false;
|
577 |
-
}
|
578 |
-
$this->conn->beginTransaction ();
|
579 |
-
$this->conn->query($insert);
|
580 |
-
$this->conn->commit ();
|
581 |
-
return true;
|
582 |
-
} catch ( Exception $e ) {
|
583 |
-
$this->conn->rollBack ();
|
584 |
-
$this->_errors[] = $e->getMessage();
|
585 |
-
$this->_errors[] = $e->getTrace();
|
586 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
587 |
-
Mage::logException($e);
|
588 |
-
echo $e->getMessage();
|
589 |
-
}
|
590 |
-
}
|
591 |
-
break;
|
592 |
-
case 'addnotallowed':
|
593 |
-
|
594 |
-
//$this->_UploadCsvErrors['general_error'][] = 'Add error: Cannot create new entry for vendor sku <b>' .$data['vendor_sku'].'</b>';
|
595 |
-
return false;
|
596 |
-
break;
|
597 |
-
}
|
598 |
-
return true;
|
599 |
-
|
600 |
-
}
|
601 |
-
|
602 |
-
protected function _prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,$isFtp)
|
603 |
-
{
|
604 |
-
$update;
|
605 |
-
(!is_numeric($data['cost']) || $data['cost'] < 0 || trim($data['cost']) =="") ? $costUpdate = '' : $costUpdate = 'cost ='. $data['cost'] . ',';
|
606 |
-
($qtyArray['upload_qty'] == .999999999 || trim($data['qty']) =="" ) ? $qtyUpdate = '' : $qtyUpdate = ' stock = '.$qtyArray['upload_qty']. ',';
|
607 |
-
if(!$isFtp){
|
608 |
-
($costUpdate=='' && $qtyUpdate =='' && !$this->_isProductSetupMode) ? $timeUpdate = "" : $timeUpdate = ' updated_at = "'.now(). '",';
|
609 |
-
$vSkuUpdate = ' lb_vendor_sku = "'.$data['vendor_sku']. '"';
|
610 |
-
$update = 'update '.$tableVendorInventory.' set '.$costUpdate.$qtyUpdate.$timeUpdate.$vSkuUpdate.' where id = '.$inventoryCollectionResult['vendor_id'];
|
611 |
-
}else
|
612 |
-
{
|
613 |
-
if(trim($data['qty'])!='' || trim($data['cost']) !='')
|
614 |
-
$update = 'update '.$tableVendorInventory.' set '.$costUpdate. $qtyUpdate.' updated_at = "'.now().'" where id = '.$inventoryCollectionResult['vendor_id'];
|
615 |
-
}
|
616 |
-
return $update;
|
617 |
-
}
|
618 |
-
protected function getInventoryLogQuery($data,$type,$qty,$updateBy=null,$ignoreData)
|
619 |
-
{
|
620 |
-
if(count($ignoreData)>0){
|
621 |
-
if($type=='update'){
|
622 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Updated, Qty Ignored' : '';
|
623 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Updated, Cost Ignored' : '';
|
624 |
-
}else{
|
625 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Added, Qty Ignored' : '';
|
626 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Added, Cost Ignored' : '';
|
627 |
-
}
|
628 |
-
if(count($ignoreData)==2){
|
629 |
-
$type = 'ignore';
|
630 |
-
}
|
631 |
-
}
|
632 |
-
if($qty==0.999999999)
|
633 |
-
$qty = 0;
|
634 |
-
$vendorRankModel = Mage::getModel('dropship360/ranking')->load($data['lb_vendor_code'],'lb_vendor_code');
|
635 |
-
$vendorName = $vendorRankModel->getLbVendorName();
|
636 |
-
|
637 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName('dropship360/inventorylog');
|
638 |
-
if(!$updateBy){
|
639 |
-
$updateBy = Mage::getSingleton('admin/session')->getUser()->getUsername();
|
640 |
-
}
|
641 |
-
if(isset($data["pucost"]) && isset($data["puqty"])){
|
642 |
-
$data['cost']= $data["pucost"];
|
643 |
-
$qty = $data["puqty"];
|
644 |
-
}
|
645 |
-
if(isset($data["pucost"]) && isset($data["puqty"])){
|
646 |
-
$data['cost']= $data["pucost"];
|
647 |
-
$qty = $data["puqty"];
|
648 |
-
}
|
649 |
-
return 'INSERT INTO '.$tableName.' (lb_vendor_code,lb_vendor_name,product_sku,cost,stock,updated_by,activity,updated_at,created_at) VALUES ("'.$data['lb_vendor_code'].'","'.$vendorName.'","'.$data['magento_sku'].'","'.$data['cost'].'","'.$qty.'","'.$updateBy.'","'.$type.'","'.now().'","'.now().'")';
|
650 |
-
}
|
651 |
-
|
652 |
-
protected function getInventoryCollection($data,$isFtp = false,$log = false)
|
653 |
-
{
|
654 |
-
$spacesTrimmedSku = $this->getTrimmedSku();
|
655 |
-
$searchedSku = array_search(trim($data['vendor_sku']), $spacesTrimmedSku);
|
656 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',trim($data['vendor_sku']));
|
657 |
-
if(isset($data['operationType'])){
|
658 |
-
if($this->_isProductSetupMode && $data['operationType'] == 'update'){
|
659 |
-
if($data['operationType'] == 'update')
|
660 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',trim($data['magento_sku']));
|
661 |
-
}
|
662 |
-
}
|
663 |
-
if($searchedSku){
|
664 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$searchedSku);
|
665 |
-
}
|
666 |
-
if($vendorCollection->getSize() > 0 || (isset($data['operationType']) && $data['operationType']=="update")){
|
667 |
-
$result = array('operationType'=> 'update','vendor_id'=>$vendorCollection->getFirstItem ()->getId(),'magento_sku'=>$vendorCollection->getFirstItem ()->getProductSku());
|
668 |
-
$data['magento_sku'] = $vendorCollection->getFirstItem ()->getProductSku();
|
669 |
-
}else{
|
670 |
-
if($log){
|
671 |
-
$isDuplicate = false;
|
672 |
-
if(in_array($data['vendor_sku'],$this->_vendorSkuFlag)){
|
673 |
-
$isDuplicate = true;
|
674 |
-
}
|
675 |
-
else{
|
676 |
-
$this->_vendorSkuFlag[] = $data['vendor_sku'];
|
677 |
-
}
|
678 |
-
if($isDuplicate){
|
679 |
-
$result = array('operationType'=> 'ignore','vendor_id'=>'');
|
680 |
-
}else{
|
681 |
-
$result = ($this->_isProductSetupMode) ? array('operationType'=> 'productsetup','vendor_id'=>'','magento_sku'=>$data['magento_sku']) :
|
682 |
-
array('operationType'=> 'addnotallowed','vendor_id'=>'','magento_sku'=>null);
|
683 |
-
}
|
684 |
-
}else{
|
685 |
-
$result = ($this->_isProductSetupMode) ? array('operationType'=> 'productsetup','vendor_id'=>'','magento_sku'=>$data['magento_sku']) :
|
686 |
-
array('operationType'=> 'addnotallowed','vendor_id'=>'','magento_sku'=>null);
|
687 |
-
}
|
688 |
-
}
|
689 |
-
return $result;
|
690 |
-
}
|
691 |
-
|
692 |
-
protected function updateProductInventory($sku,$qty)
|
693 |
-
{
|
694 |
-
if($qty == .999999999){
|
695 |
-
return true;
|
696 |
-
}
|
697 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
|
698 |
-
if($productId){
|
699 |
-
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
|
700 |
-
if (!$stockItem->getId()) {
|
701 |
-
$stockItem->setData('product_id', $productId);
|
702 |
-
$stockItem->setData('stock_id', 1);
|
703 |
-
}
|
704 |
-
|
705 |
-
if ($stockItem->getQty() != $qty) {
|
706 |
-
$stockItem->setData('qty', $qty);
|
707 |
-
$stockItem->setData('is_in_stock', $qty ? 1 : 0);
|
708 |
-
try {
|
709 |
-
$stockItem->save();
|
710 |
-
return true;
|
711 |
-
} catch (Exception $e) {
|
712 |
-
echo $e->getMessage();
|
713 |
-
}
|
714 |
-
|
715 |
-
}
|
716 |
-
}else{
|
717 |
-
return false;
|
718 |
-
}
|
719 |
-
return true;
|
720 |
-
}
|
721 |
-
|
722 |
-
/* prepare downloadable sample CSV file for user */
|
723 |
-
public function getCsvFile($isProductSetupMode = false)
|
724 |
-
{
|
725 |
-
$io = new Varien_Io_File();
|
726 |
-
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
|
727 |
-
$name = md5(microtime());
|
728 |
-
$file = $path . DS . $name;
|
729 |
-
|
730 |
-
$io->setAllowCreateFolders(true);
|
731 |
-
$io->open(array('path' => $path));
|
732 |
-
$io->streamOpen($file, 'w+');
|
733 |
-
$io->streamLock(true);
|
734 |
-
($isProductSetupMode) ? $io->streamWriteCsv(array('magento_sku','vendor_sku')) : $io->streamWriteCsv(array('vendor_sku','qty','cost'));
|
735 |
-
$io->streamUnlock();
|
736 |
-
$io->streamClose();
|
737 |
-
return array(
|
738 |
-
'type' => 'filename',
|
739 |
-
'value' => $file,
|
740 |
-
'rm' => true // can delete file after use
|
741 |
-
);
|
742 |
-
}
|
743 |
-
|
744 |
-
protected function getVendorName($vendorCode)
|
745 |
-
{
|
746 |
-
return Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code')->getLbVendorName();
|
747 |
-
}
|
748 |
-
|
749 |
-
|
750 |
-
/*
|
751 |
-
*
|
752 |
-
* logic to Import CSV file from logicbroker FTP for vendor inventory cost
|
753 |
-
*
|
754 |
-
*
|
755 |
-
*/
|
756 |
-
public function testFtpConnection($request,$isFtp = false)
|
757 |
-
{
|
758 |
-
$ftpServer = $request['ftp_site'];
|
759 |
-
$ftpUserName = $request['ftp_username'];
|
760 |
-
$ftpPassword = $request['ftp_password'];
|
761 |
-
$ftpType = $request['ftp_type'];
|
762 |
-
try {
|
763 |
-
if($ftpType['value'] == 'ftp'){
|
764 |
-
$ftpcon = ftp_connect($ftpServer['value']);
|
765 |
-
}else{
|
766 |
-
if(function_exists('ftp_ssl_connect'))
|
767 |
-
$ftpcon = ftp_ssl_connect($ftpServer['value']);
|
768 |
-
else
|
769 |
-
return array('error'=>true,'message' => 'System does not support secure ftp');
|
770 |
-
}
|
771 |
-
if (false === $ftpcon) {
|
772 |
-
|
773 |
-
return array('error'=>true,'message' => 'Unable to connect');
|
774 |
-
}
|
775 |
-
$loggedIn = @ftp_login($ftpcon, $ftpUserName['value'], $ftpPassword['value']);
|
776 |
-
ftp_pasv($ftpcon, true);
|
777 |
-
if (false === $loggedIn) {
|
778 |
-
return array('error'=>true,'message' => 'Unable to log in');
|
779 |
-
}
|
780 |
-
if(!$isFtp)
|
781 |
-
ftp_close($ftpcon);
|
782 |
-
} catch (Exception $e) {
|
783 |
-
return array('error'=>true,'message' => $e->getMessage());
|
784 |
-
|
785 |
-
}
|
786 |
-
if($isFtp)
|
787 |
-
return array('error'=>false,'message' => null,'object'=>$ftpcon);
|
788 |
-
else
|
789 |
-
return array('error'=>false,'message' => null);
|
790 |
-
}
|
791 |
-
|
792 |
-
/*
|
793 |
-
*
|
794 |
-
* Ftp function call by observer from where program execution started
|
795 |
-
*
|
796 |
-
*/
|
797 |
-
public function ftpParseCsv()
|
798 |
-
{
|
799 |
-
if(Mage::helper('dropship360')->isProcessRunning('bulk_assign')){
|
800 |
-
$message = 'Bulk product setup is currently running hence cannot run ftp import';
|
801 |
-
Mage::log($message, null, 'logicbroker_log_report.log');
|
802 |
-
return;
|
803 |
-
}
|
804 |
-
$ftpfileName = array();
|
805 |
-
$this->ftpRequestPram = array('ftp_site'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_SITE)),'ftp_username'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_USERNAME)),'ftp_password'=>array('value'=> Mage::helper('core')->decrypt($this->getConfigValue(self::XML_PATH_UPLOAD_FTP_PASSWORD))),'ftp_type'=>array('value'=> $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_TYPE)));
|
806 |
-
|
807 |
-
if (! Mage::getStoreConfigFlag ( self::XML_PATH_UPLOAD_ENABLED )) {
|
808 |
-
return $this;
|
809 |
-
}
|
810 |
-
$connectionResult = $this->testFtpConnection($this->ftpRequestPram,true);
|
811 |
-
if($connectionResult['error']){
|
812 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => 'Connection Failure','bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
813 |
-
$this->genrateLogEntry(array('ftp_error'=>'Connection error','ftp_error_desc'=>$connectionResult['message'],'error'=> 1));
|
814 |
-
Mage::log($connectionResult['message'], null, 'logicbroker_ftp_vendor_inventory_import.log');
|
815 |
-
ftp_close($connectionResult['object']);
|
816 |
-
return $this;
|
817 |
-
}
|
818 |
-
|
819 |
-
$rankCollection = Mage::getModel('dropship360/ranking')->getCollection()->addFieldToFilter('is_dropship','yes');
|
820 |
-
/* file path format <ftp site>/<Logicbroker Account Number>_MagVendID<number>/Inventory/ */
|
821 |
-
|
822 |
-
if($rankCollection->getSize() > 0){
|
823 |
-
foreach($rankCollection as $ranks){
|
824 |
-
$path = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER).'_'.$ranks->getLbVendorCode().'/'.'Inventory';
|
825 |
-
$ftpFiles = array();
|
826 |
-
$ftpFilesList = ftp_nlist($connectionResult['object'],$path);
|
827 |
-
//patch for sort ftp files by time
|
828 |
-
if($ftpFilesList){
|
829 |
-
foreach ($ftpFilesList as $value) {
|
830 |
-
if(preg_match("/.csv$/i", $value, $match)){
|
831 |
-
$fileTime = ftp_mdtm($connectionResult['object'], $value);
|
832 |
-
if(array_key_exists($fileTime,$ftpFiles))
|
833 |
-
$ftpFiles[$fileTime+20] = $value; // if timestamp same for files
|
834 |
-
else
|
835 |
-
$ftpFiles[$fileTime] = $value;
|
836 |
-
}
|
837 |
-
}
|
838 |
-
ksort($ftpFiles); // sort associative arrays in acending order, according to the key(time)
|
839 |
-
}
|
840 |
-
if($ftpFiles){
|
841 |
-
foreach($ftpFiles as $file){
|
842 |
-
if($this->downloadFtpFile($connectionResult['object'],$file,$path, $ranks->getLbVendorCode()))
|
843 |
-
$ftpfileName[$ranks->getLbVendorCode()][] = self::getWorkingDir().str_replace("\\","/",$path).DS.$this->downloadFtpFile($connectionResult['object'],$file,$path);
|
844 |
-
}
|
845 |
-
}
|
846 |
-
ftp_chdir($connectionResult['object'],'/');
|
847 |
-
}
|
848 |
-
}else{
|
849 |
-
$this->genrateLogEntry(array('ftp_error'=>'Import Error','ftp_error_desc'=>'No dropship supplier found','error'=> 1));
|
850 |
-
Mage::log('No dropship supplier found', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
851 |
-
ftp_close($connectionResult['object']);
|
852 |
-
return $this;
|
853 |
-
}
|
854 |
-
if(!empty($ftpfileName)){
|
855 |
-
$this->initialize();
|
856 |
-
$this->_csvParserObj->emptyTable();
|
857 |
-
$this->_csvDataCache = array();
|
858 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); //dirty read patch
|
859 |
-
foreach($ftpfileName as $vendorCode=>$fileinfo)
|
860 |
-
{
|
861 |
-
$this->_vendorCode = $vendorCode;
|
862 |
-
foreach($fileinfo as $path){
|
863 |
-
if($this->validateCsvHeader($this->_getCsvData($path,true),true)){
|
864 |
-
Mage::helper('dropship360')->turnOnReadUncommittedMode(); // dirty read patch
|
865 |
-
$this->ftpUpdateVendorProduct($this->_getCsvData($path),$path,$vendorCode);
|
866 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal trasectional level
|
867 |
-
$this->_csvDataCache = array();//for more than one csv file on FTP server
|
868 |
-
|
869 |
-
}else{
|
870 |
-
$this->_csvDataCache = array();
|
871 |
-
$logPath = explode('logicbrokervendorproduct',str_replace("\\","/",$path));
|
872 |
-
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Bad File header,Check header format at following FTP path '.$logPath[1]));
|
873 |
-
$this->genrateLogEntry(array('lb_vendor_code'=>$vendorCode,'ftp_error'=>'Bad File header','ftp_error_desc'=>'Check header format at following FTP path '.$logPath[1],'error'=> 1));
|
874 |
-
Mage::log('Please check header format', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
875 |
-
}
|
876 |
-
//fix move file to archive folder in all cases
|
877 |
-
$this->archiveFtpFile(array('object'=>$connectionResult['object'],'path'=>$path));
|
878 |
-
}
|
879 |
-
}
|
880 |
-
$this->finalize();
|
881 |
-
}else{
|
882 |
-
Mage::log('No files found on ftp server', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
883 |
-
ftp_close($connectionResult['object']);
|
884 |
-
return $this;
|
885 |
-
}
|
886 |
-
ftp_close($connectionResult['object']);
|
887 |
-
$this->_csvParserObj->emptyTable();
|
888 |
-
$this->_csvDataCache = array();
|
889 |
-
Mage::helper('dropship360')->turnOnReadCommittedMode(); //restore to orignal transection level
|
890 |
-
return $this;
|
891 |
-
}
|
892 |
-
|
893 |
-
protected function initialize(){
|
894 |
-
Mage::helper('dropship360')->startProcess('manual_upload');
|
895 |
-
Mage::log('Ftp upload started', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
896 |
-
}
|
897 |
-
|
898 |
-
protected function finalize(){
|
899 |
-
Mage::helper('dropship360')->finishProcess('manual_upload');
|
900 |
-
Mage::log('Ftp upload finished', null, 'logicbroker_ftp_vendor_inventory_import.log');
|
901 |
-
}
|
902 |
-
|
903 |
-
protected function archiveFtpFile($object)
|
904 |
-
{
|
905 |
-
$path = str_replace("\\","/",$object['path']);
|
906 |
-
$patharr = explode('logicbrokervendorproduct',$path);
|
907 |
-
$dirname = pathinfo($patharr[1],PATHINFO_DIRNAME);
|
908 |
-
$basename = pathinfo($patharr[1],PATHINFO_BASENAME );
|
909 |
-
$newname = Mage::getModel('core/date')->date('Ymd-his').'_'.$basename;
|
910 |
-
$connection = $this->testFtpConnection($this->ftpRequestPram,true);
|
911 |
-
if($connection['error'])
|
912 |
-
{
|
913 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => "Connection Failure--Can not archive file -".$basename,'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
914 |
-
Mage::log($connection['message'] ."--Can not archive file -".$basename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
915 |
-
}
|
916 |
-
else
|
917 |
-
{
|
918 |
-
$object['object'] = $connection['object'];
|
919 |
-
}
|
920 |
-
ftp_chdir($object['object'],$dirname);
|
921 |
-
ftp_mkdir($object['object'], 'Archive');
|
922 |
-
ftp_chdir($object['object'],'Archive');
|
923 |
-
ftp_put($object['object'], $basename, $path, FTP_ASCII);
|
924 |
-
ftp_rename ($object['object'],$basename,$newname);
|
925 |
-
ftp_chdir($object['object'],'/');
|
926 |
-
$this->fileObj()->rm($object['path']);
|
927 |
-
ftp_delete($object['object'], $dirname.'/'.$basename);
|
928 |
-
ftp_close($connection['object']);
|
929 |
-
return;
|
930 |
-
|
931 |
-
}
|
932 |
-
protected function validateFtpFile($file, $vendorCode = null)
|
933 |
-
{
|
934 |
-
$file = str_replace("/","\\",$file);
|
935 |
-
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
936 |
-
return true;
|
937 |
-
}
|
938 |
-
|
939 |
-
protected function downloadFtpFile($ftpRequest,$file,$path, $vendorCode = null)
|
940 |
-
{
|
941 |
-
if(!file_exists(self::getWorkingDir().$path)){
|
942 |
-
$patharr = explode('/',$path);
|
943 |
-
$this->fileObj()->mkdir(self::getWorkingDir().$patharr[0]);
|
944 |
-
$this->fileObj()->chmod(self::getWorkingDir().$patharr[0],0777);
|
945 |
-
$this->fileObj()->mkdir(self::getWorkingDir().$patharr[0].'/'.$patharr[1]);
|
946 |
-
$this->fileObj()->chmod(self::getWorkingDir().$patharr[0].'/'.$patharr[1],0777);
|
947 |
-
}
|
948 |
-
$fileName = explode('/',$file);
|
949 |
-
|
950 |
-
ftp_chdir($ftpRequest,'/'.$fileName[0].'/'.$fileName[1]);
|
951 |
-
$server_file = $fileName[2];
|
952 |
-
$local_file = self::getWorkingDir().$path.DS.$fileName[2];
|
953 |
-
// download server file
|
954 |
-
if (ftp_get($ftpRequest, $local_file, $server_file, FTP_ASCII)){
|
955 |
-
|
956 |
-
return $fileName[2];
|
957 |
-
}else{
|
958 |
-
return false;
|
959 |
-
}
|
960 |
-
}
|
961 |
-
|
962 |
-
protected function uploadReport($file,$vendorCode){
|
963 |
-
$path = $this->getConfigValue(self::XML_PATH_UPLOAD_FTP_ACCNUMBER).'_'.$vendorCode.'/'.'Inventory';
|
964 |
-
$reprotPath = 'report'.Mage::getModel('core/date')->date('Ymd-his').'.csv';
|
965 |
-
$connection = $this->testFtpConnection($this->ftpRequestPram,true);
|
966 |
-
if($connection['error'])
|
967 |
-
{
|
968 |
-
$this->sendMail(array('subject'=>'Your magento site has failed to connect FTP site','message' => "Connection Failure--Can not upload report file -".$basename,'bcc'=>trim(Mage::helper('dropship360')->getConfigObject('apiconfig/email/bcc'))));
|
969 |
-
Mage::log($connection['message'] ."--Can not archive file -".$basename, null, 'logicbroker_ftp_vendor_inventory_import.log');
|
970 |
-
}
|
971 |
-
else
|
972 |
-
{
|
973 |
-
$object = $connection['object'];
|
974 |
-
}
|
975 |
-
ftp_chdir($object,'/');
|
976 |
-
ftp_chdir($object,$path);
|
977 |
-
ftp_mkdir($object,'Reports');
|
978 |
-
ftp_chdir($object,'Reports');
|
979 |
-
ftp_put($object, $reprotPath,$file['value'], FTP_ASCII);
|
980 |
-
ftp_chdir($object,'/');
|
981 |
-
$this->fileObj()->rm( $file['value']);
|
982 |
-
ftp_close($connection['object']);
|
983 |
-
return;
|
984 |
-
}
|
985 |
-
protected function ftpUpdateVendorProduct($csvData,$path,$vendorCode = null)
|
986 |
-
{
|
987 |
-
$records = array();
|
988 |
-
$success = array();
|
989 |
-
$failure = array();
|
990 |
-
$itemerroroutput = array();
|
991 |
-
$counter = 0;
|
992 |
-
//$vendorCode = '';
|
993 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
994 |
-
if(count($csvData) <= 1 && Mage::getModel('dropship360/csvparser')->isCsvFileEmpty())
|
995 |
-
{
|
996 |
-
$failure[] = 'Sorry,we cant find the record to update inventory';
|
997 |
-
$this->_FtpErrors[] = array('error_type'=>'empty_file','value'=>'Sorry,we cant find the record to update inventory');
|
998 |
-
}
|
999 |
-
$records = Mage::getModel('dropship360/csvparser')->generateFtpCsvRow($csvData,$vendorCode);
|
1000 |
-
//$this->conn->beginTransaction ();
|
1001 |
-
if(is_array($records) && !empty($records)){
|
1002 |
-
$requestData = array_chunk($records, 1, true);
|
1003 |
-
|
1004 |
-
foreach($requestData as $dataArr)
|
1005 |
-
{
|
1006 |
-
foreach($dataArr as $data){
|
1007 |
-
$result[] = $this->validateCsvData($data, true);
|
1008 |
-
}
|
1009 |
-
}
|
1010 |
-
foreach($result as $successOrfail){
|
1011 |
-
if($successOrfail['success']!="")
|
1012 |
-
$success[] = $successOrfail['success'];
|
1013 |
-
if($successOrfail['failure']!="")
|
1014 |
-
$failure[] = $successOrfail['failure'];
|
1015 |
-
|
1016 |
-
}
|
1017 |
-
$this->checkDataIntigrity($this->_getCsvData($path),true);
|
1018 |
-
}
|
1019 |
-
$finalResultCounter = (!$this->_isProductSetupMode) ? $this->logForUnprocessedRows($vendorCode,true) : 0;
|
1020 |
-
if(is_array($finalResultCounter))
|
1021 |
-
{
|
1022 |
-
$failed = count($failure)+$finalResultCounter['failure'];
|
1023 |
-
$success = count($success)+$finalResultCounter['success'];
|
1024 |
-
}else
|
1025 |
-
{
|
1026 |
-
$failed = count($failure)+$finalResultCounter;
|
1027 |
-
$success = count($success)+$finalResultCounter;
|
1028 |
-
}
|
1029 |
-
$itemerroroutput = Mage::helper('core')->jsonEncode($this->_FtpErrors);
|
1030 |
-
//$failed = count($failure)+$counter;
|
1031 |
-
$ftp_err = ($failed > 0) ? 'Missing/Bad Data' : '';
|
1032 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,ftp_error,created_at) VALUES ("'.$vendorCode.'","FTP",'.$success.','.$failed.',"'.$ftp_err.'","'.now().'")';
|
1033 |
-
$this->conn->beginTransaction ();
|
1034 |
-
$this->conn->query($insert);
|
1035 |
-
$entityId = $this->conn->lastInsertId($tableVendorImportLog);
|
1036 |
-
try {
|
1037 |
-
$this->conn->commit ();
|
1038 |
-
if(count($this->_FtpErrors) > 0){
|
1039 |
-
$csvFile = Mage::helper('dropship360')->generateErrorList(array('ftp_error_desc'=>$itemerroroutput,'lb_vendor_code'=>$vendorCode),true);
|
1040 |
-
$this->uploadReport($csvFile,$vendorCode);
|
1041 |
-
}
|
1042 |
-
if($this->sendBadFileAlert){
|
1043 |
-
$logPath = explode('logicbrokervendorproduct',str_replace("\\","/",$path));
|
1044 |
-
$this->sendMail(array('isfailed'=>true,'vendor_code'=>$vendorCode,'subject'=>'dropship360 failed to update inventory','message' => 'Missing/Bad data, check CSV data at following FTP path <br>'.$logPath[1]));
|
1045 |
-
}
|
1046 |
-
$this->prepareInsertAndExeQuery($this->_FtpErrors,$entityId);
|
1047 |
-
$itemerroroutput = array();
|
1048 |
-
$this->_FtpErrors = array();
|
1049 |
-
} catch ( Exception $e ) {
|
1050 |
-
$this->conn->rollBack ();
|
1051 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1052 |
-
echo $e->getMessage();
|
1053 |
-
|
1054 |
-
}
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
protected function ftpVendorProductUpdate($data)
|
1058 |
-
{
|
1059 |
-
$tableVendorInventory = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/inventory' );
|
1060 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data,true);
|
1061 |
-
$qtyArray = $this->calculateProductQty(array('magento_sku'=>$inventoryCollectionResult['magento_sku'],'qty'=>$data['qty'],'lb_vendor_code'=>$data['lb_vendor_code']));
|
1062 |
-
switch($inventoryCollectionResult['operationType'])
|
1063 |
-
{
|
1064 |
-
case 'update':
|
1065 |
-
$productId = Mage::getModel('catalog/product')->getIdBySku($inventoryCollectionResult['magento_sku']);
|
1066 |
-
if($productId){
|
1067 |
-
$update = $this->_prepareUpdateQuery($data,$qtyArray,$inventoryCollectionResult,$tableVendorInventory,true);
|
1068 |
-
try {
|
1069 |
-
if(!$this->updateProductInventory($inventoryCollectionResult['magento_sku'],$qtyArray['final_qty']))
|
1070 |
-
{
|
1071 |
-
$this->_FtpErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$inventoryCollectionResult['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));;
|
1072 |
-
$this->sendBadFileAlert = true;
|
1073 |
-
return false;
|
1074 |
-
}
|
1075 |
-
if($update){
|
1076 |
-
$this->conn->beginTransaction ();
|
1077 |
-
$this->conn->query($update);
|
1078 |
-
$this->conn->commit ();
|
1079 |
-
}
|
1080 |
-
return true;
|
1081 |
-
} catch ( Exception $e ) {
|
1082 |
-
$this->conn->rollBack ();
|
1083 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1084 |
-
echo $e->getMessage();
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
}else{
|
1088 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1089 |
-
$this->sendBadFileAlert = true;
|
1090 |
-
return false;
|
1091 |
-
}
|
1092 |
-
break;
|
1093 |
-
default :
|
1094 |
-
/*fix for ticket lbn-710 vendor_sku not visible*/
|
1095 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));;
|
1096 |
-
$this->sendBadFileAlert = true;
|
1097 |
-
return false;
|
1098 |
-
}
|
1099 |
-
return true;
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
protected function genrateLogEntry($message)
|
1103 |
-
{
|
1104 |
-
$vendorCode = (!empty($message['lb_vendor_code'])) ? $message['lb_vendor_code'] : '';
|
1105 |
-
$ftp_error = (!empty($message['ftp_error'])) ? $message['ftp_error'] : '';
|
1106 |
-
$ftp_error_desc = (!empty($message['ftp_error_desc'])) ? $message['ftp_error_desc'] : '';
|
1107 |
-
$tableVendorImportLog = Mage::getSingleton ( 'core/resource' )->getTableName ( 'dropship360/vendor_import_log' );
|
1108 |
-
$this->conn->beginTransaction ();
|
1109 |
-
$now = now();
|
1110 |
-
$insert = 'INSERT INTO '.$tableVendorImportLog.'(lb_vendor_code,updated_by,success,failure,created_at,ftp_error,ftp_error_desc) VALUES ("'.$vendorCode.'","FTP",'.count($success).','.$message['error'].',"'.$now.'","'.$ftp_error.'","'.$ftp_error_desc.'")';
|
1111 |
-
$this->conn->query($insert);
|
1112 |
-
try {
|
1113 |
-
$this->conn->commit ();
|
1114 |
-
} catch ( Exception $e ) {
|
1115 |
-
$this->conn->rollBack ();
|
1116 |
-
Mage::log($e->getMessage(), null, 'logicbroker_ftp_vendor_inventory_import.log');
|
1117 |
-
echo $e->getMessage();
|
1118 |
-
|
1119 |
-
}
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
/**
|
1123 |
-
* Check csv data for qty and cost values
|
1124 |
-
* @param array $data, bool $isFtp
|
1125 |
-
* @return array
|
1126 |
-
*/
|
1127 |
-
protected function validateCsvData($data, $isFtp=false){
|
1128 |
-
$invalidData = false;
|
1129 |
-
$success = 0;
|
1130 |
-
$failure = 0;
|
1131 |
-
$ignoreData = array();
|
1132 |
-
|
1133 |
-
$inventoryCollectionResult = $this->getInventoryCollection($data,true,($isFtp) ? false : true);
|
1134 |
-
$data['magento_sku'] = $inventoryCollectionResult['magento_sku'];
|
1135 |
-
|
1136 |
-
if(Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']))){
|
1137 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
1138 |
-
$ignoreData[]= 'qty';
|
1139 |
-
}
|
1140 |
-
if(!is_numeric($data['cost']) || $data['cost'] < 0){
|
1141 |
-
$ignoreData[]= 'cost';
|
1142 |
-
}
|
1143 |
-
if((!is_numeric($data['cost']) || $data['cost'] < 0) && (!is_numeric($data['qty']) || $data['qty'] < 0)){
|
1144 |
-
if($data['cost']!="" && $data['qty']!="")
|
1145 |
-
$invalidData = true;
|
1146 |
-
}
|
1147 |
-
/* fix for lbn-954*/
|
1148 |
-
if(!$duplicateCombination = $this->chekDuplicateCombination($data)){
|
1149 |
-
$invalidData = true;
|
1150 |
-
if(!$isFtp){
|
1151 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1152 |
-
}else{
|
1153 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1154 |
-
$this->sendBadFileAlert = true;
|
1155 |
-
}
|
1156 |
-
}
|
1157 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',trim($data['vendor_sku']));
|
1158 |
-
if($vendorCollection->getSize() == 0){
|
1159 |
-
$spacesTrimmedSku = $this->getTrimmedSku();
|
1160 |
-
$searchedSku = array_search(trim($data['vendor_sku']), $spacesTrimmedSku);
|
1161 |
-
if($searchedSku){
|
1162 |
-
$vendorCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$searchedSku);
|
1163 |
-
}
|
1164 |
-
}
|
1165 |
-
if($vendorCollection->getSize() > 0){
|
1166 |
-
if($data['magento_sku']!=$vendorCollection->getFirstItem ()->getProductSku()){
|
1167 |
-
$invalidData = true;
|
1168 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'already_assigned','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1169 |
-
}
|
1170 |
-
}
|
1171 |
-
if($invalidData){
|
1172 |
-
$failure+=1;
|
1173 |
-
}else{
|
1174 |
-
if($isFtp){
|
1175 |
-
($this->ftpVendorProductUpdate($data)) ? $success += 1 : $failure+=1;
|
1176 |
-
}else{
|
1177 |
-
($this->vendorProductInsert($data)) ? $success += 1 : $failure+=1;
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
}
|
1181 |
-
}else{
|
1182 |
-
$failure+=1;
|
1183 |
-
if(!$isFtp){
|
1184 |
-
if(trim($data['vendor_sku']))
|
1185 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1186 |
-
}else{
|
1187 |
-
if(trim($data['vendor_sku']))
|
1188 |
-
$this->_FtpErrors[] = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1189 |
-
$this->sendBadFileAlert = true;
|
1190 |
-
}
|
1191 |
-
}
|
1192 |
-
if($data['magento_sku']){
|
1193 |
-
if($isFtp){
|
1194 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data,'update',$data['qty'],'FTP', $ignoreData);
|
1195 |
-
}else{
|
1196 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data, $inventoryCollectionResult['operationType'], $data['qty'], null,$ignoreData);
|
1197 |
-
}
|
1198 |
-
if($insertInventoryLog)
|
1199 |
-
{
|
1200 |
-
$this->conn->beginTransaction ();
|
1201 |
-
$this->conn->query($insertInventoryLog);
|
1202 |
-
try{
|
1203 |
-
$this->conn->commit ();
|
1204 |
-
}catch(Exception $e){
|
1205 |
-
$this->conn->rollBack ();
|
1206 |
-
}
|
1207 |
-
}
|
1208 |
-
}
|
1209 |
-
return array('success'=>$success, 'failure'=>$failure);
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
|
1213 |
-
/**
|
1214 |
-
* Validate product setup data for manual upload
|
1215 |
-
* @param array $data, bool $isFtp
|
1216 |
-
* @return array
|
1217 |
-
*/
|
1218 |
-
protected function validateProductSetupMode($data, $isFtp = false){
|
1219 |
-
$invalidData = false;
|
1220 |
-
$success = 0;
|
1221 |
-
$failure = 0;
|
1222 |
-
$type = "Product Setup";
|
1223 |
-
if(trim($data['vendor_sku'])=="" || trim($data['magento_sku'])==""){
|
1224 |
-
return array('success'=>$success =0, 'failure'=>$failure+=1);
|
1225 |
-
}
|
1226 |
-
if(Mage::getModel('catalog/product')->getIdBySku(trim($data['magento_sku']))){
|
1227 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
1228 |
-
if($collection->count() > 0){
|
1229 |
-
$existing_product_sku = $collection->getFirstItem()->getProductSku();
|
1230 |
-
if(!empty($existing_product_sku)){
|
1231 |
-
if($data['magento_sku'] != $existing_product_sku){
|
1232 |
-
$invalidData = true;
|
1233 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'duplicate_vendor_sku','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1234 |
-
|
1235 |
-
}else{
|
1236 |
-
$invalidData = true;
|
1237 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1238 |
-
}
|
1239 |
-
}
|
1240 |
-
}
|
1241 |
-
$inventoryCollection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$data['lb_vendor_code'])->addFieldTofilter('product_sku',$data['magento_sku']);
|
1242 |
-
if($inventoryCollection->getSize() > 0){
|
1243 |
-
$inventoryCollection = $inventoryCollection->getData();
|
1244 |
-
$inventoryCollection = $inventoryCollection[0];
|
1245 |
-
$existing_vendor_sku = $inventoryCollection['lb_vendor_sku'];
|
1246 |
-
if(trim($data['vendor_sku'])!=""){
|
1247 |
-
if($existing_vendor_sku != trim($data['vendor_sku'])){
|
1248 |
-
if($existing_vendor_sku != trim($data['vendor_sku'])){
|
1249 |
-
$data['operationType'] = "update";
|
1250 |
-
$data['cost'] = "";
|
1251 |
-
$data['qty'] = "";
|
1252 |
-
$data['pucost'] = $inventoryCollection['cost'];
|
1253 |
-
$data['puqty'] = $inventoryCollection['stock'];
|
1254 |
-
$type = "Product Update";
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
}
|
1258 |
-
}
|
1259 |
-
if($invalidData){
|
1260 |
-
$failure+=1;
|
1261 |
-
}else{
|
1262 |
-
($this->vendorProductInsert($data)) ? $success += 1 : $failure+=1;
|
1263 |
-
if($this->vendorProductInsert($data)){
|
1264 |
-
$insertInventoryLog = $this->getInventoryLogQuery($data, $type, 0, null, null);
|
1265 |
-
if($insertInventoryLog){
|
1266 |
-
$this->conn->beginTransaction ();
|
1267 |
-
$this->conn->query($insertInventoryLog);
|
1268 |
-
try{
|
1269 |
-
$this->conn->commit ();
|
1270 |
-
}catch(Exception $e){
|
1271 |
-
$this->conn->rollBack ();
|
1272 |
-
}
|
1273 |
-
}
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
-
}else{
|
1277 |
-
$failure+=1;
|
1278 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'magento_sku_exists','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1279 |
-
}
|
1280 |
-
return array('success'=>$success, 'failure'=>$failure);
|
1281 |
-
}
|
1282 |
-
|
1283 |
/* method for bulk assignment of vendor code to all product*/
|
1284 |
public function prepareBulkassignmentCollection($vendorCode)
|
1285 |
{
|
@@ -1299,243 +39,9 @@ class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstrac
|
|
1299 |
{
|
1300 |
foreach($skus as $mageSku){
|
1301 |
$magentoSku[] = $mageSku['sku'];
|
|
|
|
|
1302 |
}
|
1303 |
-
}
|
1304 |
-
}
|
1305 |
return $magentoSku;
|
1306 |
}
|
1307 |
-
|
1308 |
-
/**
|
1309 |
-
* Get Varien I/O File class object
|
1310 |
-
* @return object
|
1311 |
-
*/
|
1312 |
-
protected function fileObj()
|
1313 |
-
{
|
1314 |
-
$fileObj = new Varien_Io_File();
|
1315 |
-
return $fileObj;
|
1316 |
-
}
|
1317 |
-
|
1318 |
-
/**
|
1319 |
-
* Get vendor skus with satrting and trailing spaces
|
1320 |
-
* @return array
|
1321 |
-
*/
|
1322 |
-
protected function getTrimmedSku()
|
1323 |
-
{
|
1324 |
-
$read = Mage::getSingleton ('core/resource')->getConnection ('core_read');
|
1325 |
-
$tableName = Mage::getSingleton ('core/resource')->getTableName('logicbroker_vendor_inventory');
|
1326 |
-
$trimSpacesQuery = 'SELECT lb_vendor_sku FROM '.$tableName.' WHERE lb_vendor_sku LIKE '. '"% %"';
|
1327 |
-
$result = $read->fetchAll($trimSpacesQuery);
|
1328 |
-
$trimmedSkus = array();
|
1329 |
-
if(count($result) > 0){
|
1330 |
-
foreach($result as $k=>$v){
|
1331 |
-
foreach($v as $sku)
|
1332 |
-
$trimmedSkus[$sku] = trim($sku);
|
1333 |
-
}
|
1334 |
-
}
|
1335 |
-
return $trimmedSkus;
|
1336 |
-
}
|
1337 |
-
|
1338 |
-
protected function sendMail($mailData = array()){
|
1339 |
-
if (!Mage::getStoreConfigFlag (self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL_ENABLED)) {
|
1340 |
-
return $this;
|
1341 |
-
}
|
1342 |
-
$mailData['datetime'] = Mage::getModel('core/date')->date();
|
1343 |
-
$postObject = new Varien_Object();
|
1344 |
-
$postObject->setData($mailData);
|
1345 |
-
$email = trim(Mage::getStoreConfig(self::XML_PATH_INVENTORY_NOTIFICATION_EMAIL));
|
1346 |
-
$templateId = 'logicbroker_ftp_con_fail';
|
1347 |
-
$isMailSent = Mage::helper('dropship360')->sendMail($postObject,$email,$templateId);
|
1348 |
-
if(!$isMailSent)
|
1349 |
-
Mage::log('Notification email not sent :'.$email, null, 'logicbroker_debug.log');
|
1350 |
-
}
|
1351 |
-
protected function logForUnprocessedRows($vendorCode,$isFtp = false){
|
1352 |
-
$msg = '';
|
1353 |
-
$error = 0;
|
1354 |
-
$success = 0;
|
1355 |
-
$proObj = Mage::getModel('dropship360/ranking')->load($vendorCode,'lb_vendor_code');
|
1356 |
-
$proLinkAttr = $proObj->getLinkingAttribute();
|
1357 |
-
$proLinkAttr = empty($proLinkAttr) ? 'none' : $proLinkAttr;
|
1358 |
-
$this->supplierName = $proObj->getLbVendorName();
|
1359 |
-
$helper = Mage::helper('dropship360');
|
1360 |
-
$csvData = Mage::getModel('dropship360/csvparser')->getUnprocessedCsvRows($vendorCode,$isFtp);
|
1361 |
-
if(count($csvData) > 0 ){
|
1362 |
-
foreach($csvData as $data){
|
1363 |
-
$collection = $this->_inventoryModel->getCollection()->addFieldTofilter('lb_vendor_code',$vendorCode)->addFieldTofilter('lb_vendor_sku',$data['vendor_sku']);
|
1364 |
-
if($collection->getSize() > 0)
|
1365 |
-
{
|
1366 |
-
$msg = array('error_type'=>'data_notchnage','value'=>array('magento_sku'=> $collection->getFirstItem()->getProductSku(),'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1367 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1368 |
-
$error++;
|
1369 |
-
}else
|
1370 |
-
{
|
1371 |
-
switch ($proLinkAttr) {
|
1372 |
-
case 'none':
|
1373 |
-
$msg = array('error_type'=>'combination_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1374 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1375 |
-
$error++;
|
1376 |
-
break;
|
1377 |
-
default:
|
1378 |
-
$proCol = Mage::getModel('catalog/product')->getCollection();
|
1379 |
-
if(!$this->checkAttributeAval($proLinkAttr,$proCol)){
|
1380 |
-
$msg = array('error_type'=>'attribute_notexist','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1381 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1382 |
-
$error++;
|
1383 |
-
}else{
|
1384 |
-
$product = $proCol->addAttributeToFilter($proLinkAttr,$data['vendor_sku']);
|
1385 |
-
if($this->validateGenerateProduct($product,$data,$proLinkAttr,$isFtp)){
|
1386 |
-
$tempArray = $this->genNonExistPro($product,$data,$isFtp);
|
1387 |
-
!empty($tempArray['success']) ? $success++ : '';
|
1388 |
-
!empty($tempArray['failure']) ? $error++ : '';
|
1389 |
-
}else
|
1390 |
-
{
|
1391 |
-
$error++;
|
1392 |
-
}
|
1393 |
-
}
|
1394 |
-
break;
|
1395 |
-
}
|
1396 |
-
}
|
1397 |
-
}
|
1398 |
-
$csvData[0] = $this->_csvDataCache[0];
|
1399 |
-
$this->emptyRecords = array();
|
1400 |
-
$this->result = array();
|
1401 |
-
$this->checkDataIntigrity($csvData,$isFtp);
|
1402 |
-
}
|
1403 |
-
return array('success'=>$success,'failure'=>$error);
|
1404 |
-
}
|
1405 |
-
protected function prepareInsertAndExeQuery($csvData,$entityId){
|
1406 |
-
if(count($csvData) <= 0 || empty($entityId))
|
1407 |
-
return ;
|
1408 |
-
$tableName = Mage::getSingleton ( 'core/resource' )->getTableName ('dropship360/vendor_import_log_desc');
|
1409 |
-
|
1410 |
-
foreach($csvData as $data)
|
1411 |
-
{
|
1412 |
-
try {
|
1413 |
-
$this->conn->insertArray($tableName,array('error_id','description'),array(array($entityId,Mage::helper('core')->jsonEncode($data))));
|
1414 |
-
} catch ( Exception $e ) {
|
1415 |
-
Mage::logException($e);
|
1416 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
}
|
1420 |
-
return ;
|
1421 |
-
}
|
1422 |
-
protected function validateGenerateProduct($product,$data,$attr,$isFtp){
|
1423 |
-
$isValid = true;
|
1424 |
-
$helper = Mage::helper('dropship360');
|
1425 |
-
if($product->getSize() == 0)
|
1426 |
-
{
|
1427 |
-
$errorType = ($attr == $helper::LOGICBROKER_PRODUCT_LINK_CODE_SKU) ? 'magento_sku_exists' : $attr.'_notexist';
|
1428 |
-
$msg = array('error_type'=>$errorType,'value'=>array('magento_sku'=>$data['vendor_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1429 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1430 |
-
$isValid = false;
|
1431 |
-
}elseif($product->getSize() > 1)
|
1432 |
-
{
|
1433 |
-
$msg = array('error_type'=>$attr.'_multiple','value'=>array('magento_sku'=>'','qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1434 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1435 |
-
$isValid = false;
|
1436 |
-
}else{
|
1437 |
-
$data['magento_sku'] = $product->getFirstItem()->getSku();
|
1438 |
-
if(!$this->chekDuplicateCombination($data))
|
1439 |
-
{
|
1440 |
-
$msg = array('error_type'=>'combination_exist','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1441 |
-
(!$isFtp) ? $this->_UploadCsvErrors[] = $msg : $this->_FtpErrors[] = $msg;
|
1442 |
-
$isValid = false;
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
return $isValid;
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
protected function genNonExistPro($proObj,$data,$isFtp){
|
1450 |
-
$invalidData = false;
|
1451 |
-
$failure = 0;
|
1452 |
-
$success = 0;
|
1453 |
-
$ignoreData = array();
|
1454 |
-
$data['magento_sku'] = $proObj->getFirstItem()->getSku();
|
1455 |
-
/* LBN - 935 change */
|
1456 |
-
$data['qty'] = (is_numeric($data['qty'])) ? Mage::helper('dropship360')->getIsQtyDecimal($data['magento_sku'],$data['qty']) : $data['qty'];
|
1457 |
-
if(!is_numeric($data['qty']) || $data['qty'] < 0){
|
1458 |
-
$ignoreData[]= 'qty';
|
1459 |
-
}
|
1460 |
-
if(!is_numeric($data['cost']) || $data['cost'] < 0){
|
1461 |
-
$ignoreData[]= 'cost';
|
1462 |
-
}
|
1463 |
-
if((!is_numeric($data['cost']) || $data['cost'] < 0) && (!is_numeric($data['qty']) || $data['qty'] < 0)){
|
1464 |
-
if($data['cost']!="" && $data['qty']!="")
|
1465 |
-
$invalidData = true;
|
1466 |
-
}
|
1467 |
-
|
1468 |
-
if($invalidData){
|
1469 |
-
$failure+=1;
|
1470 |
-
}else{
|
1471 |
-
($this->insertNonExistPro($proObj,$data,$isFtp)) ? $success += 1 : $failure += 1;
|
1472 |
-
}
|
1473 |
-
|
1474 |
-
$this->insertInventoryLog($ignoreData,$data,$isFtp);
|
1475 |
-
|
1476 |
-
return array('success'=>$success,'failure'=>$failure);
|
1477 |
-
}
|
1478 |
-
|
1479 |
-
protected function insertNonExistPro($proObj,$data,$isFtp = false){
|
1480 |
-
|
1481 |
-
$vendorCode = ($isFtp) ? $data['lb_vendor_code'] : $this->_vendorCode;
|
1482 |
-
$tableVendorInventory = Mage::getSingleton ('core/resource')->getTableName('dropship360/inventory');
|
1483 |
-
$qtyArray = $this->calculateProductQty($data);
|
1484 |
-
$costInsert = (!is_numeric($data['cost']) || $data['cost'] < 0 || trim($data['cost']) =="") ? 0 : $data['cost'] ;
|
1485 |
-
$qtyInsert = ($qtyArray['upload_qty'] == .999999999 || trim($data['qty']) =="" ) ? 0 : $qtyArray['upload_qty'];
|
1486 |
-
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','lb_vendor_sku','stock','cost','created_at','updated_at');
|
1487 |
-
$dbFieldVal = array(
|
1488 |
-
array($vendorCode,$this->supplierName,$data['magento_sku'],$data['vendor_sku'],$qtyInsert,$costInsert,now(),now())
|
1489 |
-
);
|
1490 |
-
try {
|
1491 |
-
if(!$this->updateProductInventory(trim($data['magento_sku']),$qtyArray['final_qty']))
|
1492 |
-
{
|
1493 |
-
$this->_UploadCsvErrors[] = array('error_type'=>'inventory_update_error','value'=>array('magento_sku'=>$data['magento_sku'],'qty'=>$data['qty'],'vendor_sku'=>$data['vendor_sku'],'cost'=>$data['cost']));
|
1494 |
-
return false;
|
1495 |
-
}
|
1496 |
-
$this->conn->insertArray($tableVendorInventory,$dbFields,$dbFieldVal);
|
1497 |
-
return true;
|
1498 |
-
} catch ( Exception $e ) {
|
1499 |
-
Mage::logException($e);
|
1500 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1501 |
-
}
|
1502 |
-
|
1503 |
-
|
1504 |
-
}
|
1505 |
-
protected function insertInventoryLog($ignoreData,$data,$isFtp)
|
1506 |
-
{
|
1507 |
-
$type = 'add';
|
1508 |
-
$vendorCode = ($isFtp) ? $data['lb_vendor_code'] : $this->_vendorCode;
|
1509 |
-
if(count($ignoreData)>0){
|
1510 |
-
(in_array('qty', $ignoreData)) ? $type = 'Cost Added, Qty Ignored' : '';
|
1511 |
-
(in_array('cost', $ignoreData)) ? $type = 'Qty Added, Cost Ignored' : '';
|
1512 |
-
|
1513 |
-
if(count($ignoreData)==2){
|
1514 |
-
$type = 'ignore';
|
1515 |
-
}
|
1516 |
-
}
|
1517 |
-
if($data['qty']==0.999999999)
|
1518 |
-
$data['qty'] = 0;
|
1519 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName('dropship360/inventorylog');
|
1520 |
-
$updatedBy = (!$isFtp) ? Mage::getSingleton('admin/session')->getUser()->getUsername() : 'FTP';
|
1521 |
-
$dbFields = array('lb_vendor_code','lb_vendor_name','product_sku','cost','stock','updated_by','activity','updated_at','created_at');
|
1522 |
-
$dbFieldVal = array(
|
1523 |
-
array($vendorCode,$this->supplierName,$data['magento_sku'],$data['cost'],$data['qty'],$updatedBy,$type,now(),now())
|
1524 |
-
);
|
1525 |
-
try {
|
1526 |
-
$this->conn->insertArray($tableName,$dbFields,$dbFieldVal);
|
1527 |
-
return true;
|
1528 |
-
} catch ( Exception $e ) {
|
1529 |
-
Mage::logException($e);
|
1530 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
}
|
1534 |
-
protected function checkAttributeAval($attr,$object){
|
1535 |
-
$isExist = false;
|
1536 |
-
$attrEav = Mage::getResourceModel('catalog/eav_attribute')->loadByCode('catalog_product',$attr);
|
1537 |
-
if ($attrEav->getId())
|
1538 |
-
$isExist = true;
|
1539 |
-
return $isExist;
|
1540 |
-
}
|
1541 |
-
}
|
10 |
class Logicbroker_Dropship360_Model_Uploadvendor extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
protected function _construct()
|
14 |
{
|
|
|
|
|
15 |
$this->_init("dropship360/uploadvendor");
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function getDatabaseConnection()
|
20 |
return Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/* method for bulk assignment of vendor code to all product*/
|
24 |
public function prepareBulkassignmentCollection($vendorCode)
|
25 |
{
|
39 |
{
|
40 |
foreach($skus as $mageSku){
|
41 |
$magentoSku[] = $mageSku['sku'];
|
42 |
+
}
|
43 |
+
}
|
44 |
}
|
|
|
|
|
45 |
return $magentoSku;
|
46 |
}
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>dropship360</name>
|
4 |
-
<version>3.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://logicbroker.com/portfolio/magento/license">Customer License</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>logicbroker is the most complete eCommerce integration platform available and offers a true end-to-end EDI solution for Magento. Beyond its EDI capabilities, logicbroker’s flexible connectivity automates and simplifies tasks like drop ship deployment and omni-channel retailing. logicbroker connects Magento to backend systems like ERPs (Dynamics, Netsuite, Exact), accounting software (QuickBooks), and order management systems (M.O.M) to seamlessly exchange information</description>
|
11 |
<notes>package is ready</notes>
|
12 |
<authors><author><name>Logicbroker</name><user>Logicbroker</user><email>magentoext@logicbroker.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Logicbroker"><dir name="Dropship360"><dir name="Block"><dir name="Adminhtml"><dir name="Inventory"><dir name="Edit"><dir name="Tab"><file name="Addvendorfield.php" hash="af6a5039e07a8f610a50baaceec5465b"/><file name="Lbvendor.php" hash="67d2d2b7e825f63bff4d343bc1cf8aa4"/><file name="Vendortabhistory.php" hash="69fbc5a2cd3fb1d010a613943f7a951c"/></dir><file name="Vendortab.php" hash="814752c7c23059c93eb4fdc41a32bdd2"/><file name="Vendortabhistory.php" hash="c3a43db297bc516fac6f1a2beb2680c4"/></dir><file name="Grid.php" hash="55a9058cdf9004c4f944d5722c1e5ede"/></dir><file name="Inventory.php" hash="99a5d1a58c1dc6ef2cc56ae9fc5b6481"/><file name="Logicbroker.php" hash="239a7cefa7386a8d3b40ad78422d1ae4"/><file name="Notification.php" hash="18d8754907908e0262c087d573f934a5"/><dir name="Ranking"><file name="Grid.php" hash="52407d6d50481bc32c391e3e09e2a7a1"/></dir><file name="Ranking.php" hash="42e39843931b6030840f8c3161ec84b6"/><dir name="Reports"><dir name="Activitymonitor"><file name="Email.php" hash="b153871bad4a1599a2f9b4165c4287f2"/><file name="Form.php" hash="33d12cac623619efaaac0325f19452b8"/><file name="Grid.php" hash="fd9a2f6af14688fdc19a72803e319ece"/><file name="Periodopen.php" hash="6297aefbe9fc2f7c9449e1b461afe075"/></dir><file name="Activitymonitor.php" hash="750b5adec9792b9bdc593921b3e86a16"/><dir name="Form"><file name="Timestatus.php" hash="ef5b8206b1c0e71cd1d3ad6c31923a8a"/></dir><file name="Staticemailgrid.php" hash="078130167406426bad0e577d1fc4b0ce"/></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Items.php" hash="acb46509068da360104a0c8cada453da"/></dir></dir></dir><file name="Showhistory.php" hash="a82540104538beaa185238b4931fdb14"/><dir name="Sourcing"><dir name="Edit"><file name="Form.php" hash="e6b0312f4fc38b771089fbb1815578ef"/><dir name="Tab"><file name="Form.php" hash="d0d9a417b1e59d06030ff7a65c6cbc88"/></dir><file name="Tabs.php" hash="5298c26c63035ff916a986c8072c8d0b"/></dir><file name="Edit.php" hash="767bcde378baf0ff1196598e0c466fc5"/><file name="Grid.php" hash="8c1ab115b99ea39900dccd60ee7ac651"/><dir name="History"><dir name="Renderer"><file name="Action.php" hash="edea4e5929b246ff70d063aa5845b3f9"/></dir><dir name="View"><file name="Form.php" hash="9da38c9ec7e580f660155ec62d7e0eeb"/><file name="Tabs.php" hash="94ffa503cf28c9fa63076f84c02b9cee"/></dir><file name="View.php" hash="02be1363be1b4610bdee1dbc7cc2ba34"/></dir></dir><file name="Sourcing.php" hash="d94b0f3a7e4d290d71f69064cbe98282"/><dir name="System"><dir name="Config"><file name="Crontime.php" hash="b81ffae42850e8171d357f911a0e11fc"/><dir name="Fieldset"><file name="Hint.php" hash="72f6124a380765b0142ebecd9cbfb6cf"/></dir><file name="Ftpconnectionbutton.php" hash="f7d562a0e7377c85083f0d2fe14fea08"/><file name="Helplink.php" hash="0d0427b473f8a343efa394c4a0853942"/><file name="Singuplink.php" hash="a6927e292ac86b35339a5029034b5ac2"/><file name="Submitbutton.php" hash="7ce0fade94eede8db6ff04c0dbe50dac"/><file name="Time.php" hash="74a40038b4a50994296b0cb7fce2947f"/></dir></dir><dir name="Upload"><file name="Bulkassign.php" hash="bd462fdca45aec2dc8e762237ceefe1b"/><dir name="Edit"><file name="Button.php" hash="7b98d1326c1f93bc643e1463242224a2"/><file name="Form.php" hash="50eff157cd1fe36cc670786f053ae939"/></dir></dir><file name="Upload.php" hash="42c6c3cdcc0a6a015c567a83997d85a3"/><file name="Vendorproductuploadhistory.php" hash="135610c201ebde49e396ca2685249ccc"/><dir name="Widget"><dir name="Grid"><dir name="Column"><file name="Nameaction.php" hash="bd171423eec53f92fda759bf4d3624f1"/><file name="Orderaction.php" hash="842701da280c25c3c552b05d7c06413e"/><file name="Skuaction.php" hash="0c4477b7bdabcc81da134929b2926ef7"/><file name="Textaction.php" hash="9855312bb0dcac85104f7f0cd4a51054"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ee1785693bb5bddbb4c4452e678960d8"/></dir><dir name="Model"><dir name="Api2"><file name="Createroleandrule.php" hash="71ece80df5c5c87e13075841a1f9f4e1"/><dir name="Inventory"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="a6a58df3d657dbe8b8f42da5e107a212"/></dir><dir name="Customer"><file name="V1.php" hash="c0327118b69995896f78acd7907fa71f"/></dir><dir name="Guest"><file name="V1.php" hash="1c3f3a1a87ccd9bd1120138d8369229d"/></dir></dir><file name="Rest.php" hash="b7e996ed201e1d1e0239d6d226ef1007"/></dir><file name="Inventory.php" hash="9d08c98e36b9c232b9d796a418aac383"/><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="6f4acb240c2875694c9a710bfec844c4"/></dir><dir name="Customer"><file name="V1.php" hash="c0327118b69995896f78acd7907fa71f"/></dir><dir name="Guest"><file name="V1.php" hash="0f4c46ad1ef2e6fefd1fdbda4034ad85"/></dir></dir><file name="Rest.php" hash="f423598eb3ae1871d8b4a326f7dda181"/></dir><file name="Product.php" hash="5ced4e9d325db0cf6f748a13c8384298"/></dir><file name="Csvparser.php" hash="6b4810b688501b741c89bf04b5ab30b6"/><file name="Inventory.php" hash="f9c1489738188804a835641a76e29d85"/><file name="Inventorylog.php" hash="208f743adec62a2d8117120cf42ef342"/><file name="Logicbroker.php" hash="99124a4b0cf794f894e9725bf4d7589b"/><file name="Observer.php" hash="36fb3b2090cab1162a00e0769878b08b"/><dir name="Order"><file name="Api.php" hash="883eb8772a085238c1d87893ad8f326e"/></dir><file name="Orderitems.php" hash="54ed3910268b9a6828f44d0fbde92e12"/><file name="Ordersourcing.php" hash="cb43e6b2763d874c0579c26fdffd6598"/><file name="Productimport.php" hash="7feece453157d3930e7866b48afaa6f6"/><file name="Ranking.php" hash="96905331a59e81a2a0d54cff032c82fc"/><file name="Rankinglog.php" hash="094334cf66c9ce7304c87082570a496d"/><file name="Report.php" hash="ae7188a15da1892667de020648d6b4af"/><dir name="Resource"><dir name="Inventory"><file name="Collection.php" hash="4a0707fc5d728c872a7df48a372e3411"/></dir><file name="Inventory.php" hash="105f54b381ac6cde7ba6e4ff01435083"/><dir name="Inventorylog"><file name="Collection.php" hash="1a24af879a980509fc049106dfa7ed17"/></dir><file name="Inventorylog.php" hash="9821c43afd97cef8608b08c634456dd3"/><dir name="Orderitems"><file name="Collection.php" hash="09ca1baa286ba8dbe2d8636041afc183"/></dir><file name="Orderitems.php" hash="2f5611b00cf0b15994047a85476764d5"/><dir name="Ordersourcing"><file name="Collection.php" hash="a4341add3d2e4ed0d4fec5b5ead2b391"/></dir><file name="Ordersourcing.php" hash="6c9903c47b98b1032ed262578b15d5f2"/><dir name="Ranking"><file name="Collection.php" hash="2c5f73589c3cf1cc61d82ff3184e9180"/></dir><file name="Ranking.php" hash="e728c7db906f4257c9fa2828f3b1889c"/><dir name="Rankinglog"><file name="Collection.php" hash="847f4a313b4c57f1943667a743fb1876"/></dir><file name="Rankinglog.php" hash="280ca665631b7dfdc5fd65bdd37dd977"/><file name="Setup.php" hash="db1b106449549a4d6a94e115b35f36d3"/><dir name="Uploadvendor"><file name="Collection.php" hash="c00c646cd30ea2846eaf64aebfa60d81"/></dir><file name="Uploadvendor.php" hash="cdea6d41186776859dd4ff1b903631e0"/><file name="Vendorimportlog.php" hash="5612cc9ad31e26537854803cf48cd83c"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Oudatedinventory"><file name="Email.php" hash="3c0a74ca609f55dcbffb9eec2ec61eaa"/></dir><dir name="Report"><file name="Email.php" hash="b8add0d41e93c027e056103eb2ffd784"/></dir><dir name="Sourcing"><file name="Cronbackorder.php" hash="b653137f284099cda52229ca4a03032a"/><file name="Cronsourcing.php" hash="e344d67cb474c67d39453cbfb90ae010"/></dir><dir name="Uploadvendor"><file name="Cron.php" hash="d7ab43d34129359aaca41be3f8510e7a"/></dir></dir><dir name="Source"><file name="Attributecodes.php" hash="f97c33f5918714fccab7eb49119a8b95"/><file name="Category.php" hash="c5b9a7f9b613f8abe98c2419d802ab5c"/><file name="Ediqualifier.php" hash="ac6c52c324204bd2062c0361c64e27b6"/><file name="Ftptype.php" hash="66fc7d9ba1926a043060557f8ce87061"/><file name="Optionvalues.php" hash="48dc60144b3e8dae327e42c5bb567608"/><file name="Ranktype.php" hash="4a2a731340fd142ab77b75d64ac91ef8"/><file name="Store.php" hash="eaa19dfd1575ac6f851f115dd501fbf2"/><file name="Time.php" hash="7ccf6ebc62220eb3861b6ae3c91e7cfa"/><file name="Vendorlist.php" hash="535eea5a21a3c027a232cd1285a0120b"/></dir></dir></dir><file name="Uploadvendor.php" hash="4f3f408b07c0b06ba1133542257c46a6"/><dir name="Versions"><dir name="Api"><file name="V2.php" hash="6def122e3c99344db1d10dc0b4ccfaa3"/></dir><file name="Api.php" hash="7fc94e25af730bd4b8f48dbc8603bf7b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="InventoryController.php" hash="8c8df2448896a6dab42e131f1e5dee68"/><file name="LogicbrokerController.php" hash="0cf5f0ef8f84170b3c9f3749d3050128"/><file name="RankingController.php" hash="2a709afdad369cbb29c4dfa5f091fa64"/><file name="ReportController.php" hash="023e1acb60ef84290573df5a05281c90"/><file name="SourcingController.php" hash="35fb58b6b81fa1324ecd95b85abf0429"/><file name="UploadController.php" hash="fc31c7daea4eb49e8ee030fead1f3c50"/></dir></dir><dir name="data"><dir name="dropship360_setup"><file name="data-install-1.0.3.php" hash="571b05db7d7f51ff2a07be017e954285"/><file name="data-upgrade-1.0.3-1.0.4.php" hash="9880908a508362787c703f3ac38d70f0"/><file name="data-upgrade-1.0.4-1.0.5.php" hash="fae385cfd674925b55d148e9d149192a"/><file name="data-upgrade-1.0.5-1.0.6.php" hash="6fc6b8bc7e5023e153db504f9d941089"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7f6a2b88ab06d3bca8c8ee6dada72f1a"/><file name="api.xml" hash="7154cf55d8e7dc8fd6939ebe0bc8f66f"/><file name="api2.xml" hash="92e6f7bfeee312d5c5d9b5346994b698"/><file name="config.xml" hash="5adcc5e9349a052db5274f9b77abb350"/><file name="jstranslator.xml" hash="8de896de15a8c593a3198d8e2100a71d"/><file name="system.xml" hash="82798d5a2f3463b788715df53b6d1920"/><file name="wsdl.xml" hash="deb338269cb05784cb598725d16685af"/></dir><dir name="sql"><dir name="dropship360_setup"><file name="mysql4-install-1.0.3.php" hash="45e15c99c8041e08bbacd46cb994576d"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="5962486ed85a99c3f866c5854e14c11f"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="7895767223ec16662bc3f92deb7b6d2e"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="ac2243460d31dfa9b73133384a410168"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="1eff97e395c2d0cca92801d253a9b2d3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="logicbroker"><file name="add_help_js.phtml" hash="21a3ec98fdf3e499aaa66193e1a854a0"/><file name="addvendorfields.phtml" hash="4fda9044642b8e888f7565aa203fb41b"/><dir name="bundle"><file name="renderer.phtml" hash="d529bcca3a13d3dc8b4363e4d67a8a5c"/></dir><dir name="downloadable"><file name="downloadable.phtml" hash="06d6416024d05b49115da28c8b6277b1"/></dir><dir name="html"><file name="pager.phtml" hash="ef0e74e20708b97261197cd067b48e4d"/></dir><dir name="import"><dir name="form"><file name="after.phtml" hash="08085046e6675633ada4009bc000297f"/><file name="before.phtml" hash="3dda3ab8d33e980fb48b3ac8af757bfc"/></dir><dir name="frame"><file name="result.phtml" hash="3593b07a3b9540c7eea44d29fbf3c272"/></dir></dir><file name="inline-edit.phtml" hash="ad39e2d2a306160e69579016493744ba"/><file name="item_order_history.phtml" hash="a76e0a3f2143b7f3d45587bf79f5ab7e"/><file name="popup.phtml" hash="ca4e3467dceb197329cd2593e4d90096"/><file name="process-profile.phtml" hash="9d5708843faf3fffa478d18cd4efee11"/><dir name="reports"><dir name="email"><file name="grid.phtml" hash="5a7b8849ad148208806491c51c39fba5"/></dir><dir name="grid"><file name="container.phtml" hash="8d72e70a1d5feee742e999d5bf4c7bc6"/></dir></dir><file name="result.phtml" hash="0bff64bf35c207c0ab2b0e7607f75ef5"/><dir name="sales"><file name="default.phtml" hash="ef93018d9d64e8f367b4c1d5d446a15b"/><file name="items.phtml" hash="eece06fcdcbc9cb7975577e635191d0a"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="8169642d4b919af4cc85f2e1834eaec1"/></dir><file name="submitbutton.phtml" hash="ad652c41e879efe23da1a58d963dd197"/></dir></dir><file name="upload_vendor_product.phtml" hash="b39846857de94d50ad399995f2f25bbd"/><file name="vendor_ranking.phtml" hash="69ed0f93a93469fe61bb534c9d287d2d"/><file name="vendor_upload_product_history.phtml" hash="1b4bb192ad3593570b7e0c9dcfbb4322"/><file name="vendorproducttab.phtml" hash="9180e2f4a9f49b6b2372510acba9ad26"/><file name="vendorproducttabhistory.phtml" hash="9c0194bf9e410f46f1941246cdaee363"/><file name="window.phtml" hash="ad67768f1a01644766f1c422f411c5e6"/></dir></dir><dir name="layout"><file name="logicbroker.xml" hash="af72270304150e955deb4fc6e2364abf"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Logicbroker_Dropship360.xml" hash="67068aaea26ac3534322d12dbb7c0c1a"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Logicbroker_Dropship360.csv" hash="34e85a999b73c4a216eed04dfffa756d"/><dir name="template"><dir name="email"><dir name="logicbroker"><file name="activity_report_staticstatus.html" hash="1f060800e62af9aa3ab51916efd228c0"/><file name="first_order_notification.html" hash="bc2f640396d0ac3fc3d3e37bfe65f3a5"/><file name="first_productsetup_notification.html" hash="a2b56627a24975377263cffc594f8219"/><file name="logicbroker.html" hash="f4902b5293a5290c006dbc3522238dd4"/><file name="logicbroker_ftp_con_fail.html" hash="cc946e7665e4f7bca987c4fdd2b62e66"/><file name="oudated_product_inventory_notification.html" hash="f777b863bc1dce0ebddbc63f6e6be0b8"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="logicbroker"><dir><dir name="extjs"><file name="bootstrap.js" hash="a82e5f0ee98f60e92bb5774e25c480f7"/><dir name="css"><file name="example.css" hash="7fcbf7ea6c0466ac334f00e12ac4be7e"/><file name="ext-all.css" hash="ecf28869070c6511559c6a5286a6f6cb"/><dir name="images"><dir name="boundlist"><file name="trigger-arrow.png" hash="4655916b183b914b357da69b86414f52"/></dir><dir name="box"><file name="corners-blue.gif" hash="86fd4c5664e0971bfc11959e8442604c"/><file name="corners.gif" hash="d2d1bc2085b369ce35ffd20c0121676e"/><file name="l-blue.gif" hash="ced9ffbf66ea39e77083a591f8257267"/><file name="l.gif" hash="c4d9dbbdc59ae06b5e9e72a6a865c981"/><file name="r-blue.gif" hash="82dbb522a80e3246f6297719371a9494"/><file name="r.gif" hash="bf1e1d4a45f951ae656968a8c834f04a"/><file name="tb-blue.gif" hash="7c4b19eb682afdc1bde0640d2321fb25"/><file name="tb.gif" hash="dd3f63afe7ba90983ba73dad1c66bf2f"/></dir><dir name="button"><file name="arrow.gif" hash="44b6dbf385236a2697932a7a3e20b4a0"/><file name="btn.gif" hash="40ac871755023cc11ad15dcd77b54dbf"/><file name="group-cs.gif" hash="5dc0252bd9ecf72f98d858427054cf08"/><file name="group-lr.gif" hash="cb7813012d6be17e083835d60037029e"/><file name="group-tb.gif" hash="4edf9b7db13b1331282eed298384cab9"/><file name="s-arrow-b-noline.gif" hash="30d04f652551f1df9d59d33a99c9a320"/><file name="s-arrow-b.gif" hash="a957a6d618d19b92a2d1a7a1b50f5235"/><file name="s-arrow-bo.gif" hash="53a15d7907a017122f7f60402c435753"/><file name="s-arrow-light.gif" hash="6576de0eb6bec88f8e37c12829939573"/><file name="s-arrow-noline.gif" hash="13f08a275c58135365b8e58b3177ab1a"/><file name="s-arrow-o.gif" hash="5005d8dea2f9456aaf2ab27ca7bf5651"/><file name="s-arrow.gif" hash="bc71296ddf9c7ef5aa56b09ca3512c8a"/></dir><dir name="datepicker"><file name="datepicker-footer-bg.gif" hash="52e65759b3e8c81d3c3f2d0484ec9e58"/><file name="datepicker-footer-bg.png" hash="deca7c712da61f827c61b6219b3246af"/><file name="datepicker-header-bg.gif" hash="5cda0bb28a42b7023d24d48b9a0e1685"/><file name="datepicker-header-bg.png" hash="93fb8e8f1fb52d38e61ab064187f11de"/></dir><dir name="dd"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-no.gif" hash="ae536c37391ba78143b5c8283cec8d13"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/></dir><dir name="editor"><file name="tb-sprite.gif" hash="a2f06caddc2fb729db5cbbd874491128"/></dir><dir name="form"><file name="checkbox.gif" hash="75d685cab5665a935660a3d04f71c2be"/><file name="clear-trigger.gif" hash="97b3e5e9edf27b50d63d48098c2f1eae"/><file name="date-trigger.gif" hash="30b5bace9f3dac358716c1415270f874"/><file name="error-tip-corners.gif" hash="364474276178c7b48b6270056b42b808"/><file name="exclamation.gif" hash="37dbe02e3cbde0f6780650bfd8535e38"/><file name="radio.gif" hash="0239bdaef529be68530b86266a24742c"/><file name="search-trigger.gif" hash="559ef372cf27a38678d84e8c0b7237fc"/><file name="spinner-small.gif" hash="122ab763adfc5f379def95269889a876"/><file name="spinner.gif" hash="eee2bdd07a8136d2eff635b721838b4c"/><file name="text-bg.gif" hash="d5ba54c1f417e6a72cbce8b909078727"/><file name="trigger-square.gif" hash="c1cbaecc91209f77e2d20235c137e13e"/><file name="trigger-tpl.gif" hash="d7be20f0dc38f4f46cd318fe32cf3ce3"/><file name="trigger.gif" hash="447d5b600f7527f5c8cc49e7453bbb27"/></dir><dir name="grid"><file name="arrow-left-white.gif" hash="b04e859bdcbd21ad1f06b8bfa7881df8"/><file name="arrow-right-white.gif" hash="714eb00f8134dde3a65c83f3f71ad2c4"/><file name="cell-special-bg.gif" hash="60b05fd8cd98b6109112775a4cf2ad0e"/><file name="cell-special-bg.png" hash="a6487b6bd88ce1a726d41140595235be"/><file name="cell-special-selected-bg.gif" hash="2d4830861beacb8945d22b3bb79ad9c2"/><file name="cell-special-selected-bg.png" hash="df8d68826afb17ab5ed333565f531fdf"/><file name="checked.gif" hash="cb7b3408df56f5585aaa1242cd2f0b45"/><file name="col-move-bottom.gif" hash="9c38bcb5cee1dc9b4ce64ad9ab1386f8"/><file name="col-move-top.gif" hash="c4584202d5172464050f675d396d1c6f"/><file name="column-header-bg.gif" hash="1c0619ef4faf05d33d53e46f164664d0"/><file name="column-header-bg.png" hash="2c8e36b59e78fe93fcc13360bebd7f7f"/><file name="column-header-over-bg.gif" hash="8af4b32e4a033f3ac980277efee1d0b2"/><file name="column-header-over-bg.png" hash="25da418192d7f8bb7fbacc3baf6731fb"/><file name="columns.gif" hash="ef35242fa6514a81d17d5f700f561b7c"/><file name="dd-insert-arrow-left.gif" hash="fee4ee1bfc31c909a83713656497c8b2"/><file name="dd-insert-arrow-left.png" hash="5050c8e897cec907d6319f397a66c474"/><file name="dd-insert-arrow-right.gif" hash="b03355f58b96d167f0770b14358e5d88"/><file name="dd-insert-arrow-right.png" hash="46faba03ba3a35d750b5b758cc3d5d2c"/><file name="dirty.gif" hash="decca3b96e2c37cf6eb04ddb0d9f669b"/><file name="done.gif" hash="365266930a93451414fe51ffc524a196"/><file name="drop-no.gif" hash="b53ca86d60fbcc7a45c8917299218bfd"/><file name="drop-yes.gif" hash="af96f4c3b32a470db2f38abb521b5c97"/><file name="footer-bg.gif" hash="65ed63e44c6149f1127ad3b4be4e0108"/><file name="grid-blue-hd.gif" hash="dd35d5c1202c440c2d1a945b335984d3"/><file name="grid-blue-split.gif" hash="0494ba49974ff2bc1bf81e1d82dfee18"/><file name="grid-hrow.gif" hash="55972a5063d80f35fb6b95a79bb0018a"/><file name="grid-loading.gif" hash="9ac6f737eb9b15272f12b00bfeb3c3c6"/><file name="grid-split.gif" hash="3ef419d4b9421d8e94f673a6238dc4c0"/><file name="grid-vista-hd.gif" hash="675f403e8a9cb5ab4bed725da9fe2023"/><file name="grid3-hd-btn.gif" hash="e3e77072c16a6b27556236961f29c552"/><file name="grid3-hrow-over.gif" hash="a92d8f6c106943995720f2884634670e"/><file name="grid3-hrow.gif" hash="3e4484ea8db10af1320808c8477346ea"/><file name="grid3-rowheader.gif" hash="b4491705564909da7f9eaf749dbbfbb1"/><file name="group-by.gif" hash="3ff8c5936e358cf213227509c9bee95a"/><file name="group-collapse.gif" hash="fd6a72ffa784170d83f9f13322266ca8"/><file name="group-expand-sprite.gif" hash="d0f614a387292177f3acb0c95a4cd760"/><file name="group-expand.gif" hash="8a9ad3ed3d74c2911b7f101268a1843b"/><file name="hd-pop.gif" hash="e5f27a2f68cc2d13b11cf41c46d298dc"/><file name="hmenu-asc.gif" hash="048e0bc30f7c39d473dad5dabcbe03f2"/><file name="hmenu-desc.gif" hash="f0a987b34b003b25a7c82624d41f018a"/><file name="hmenu-lock.gif" hash="bcef18e25342c69c37c44dab87086065"/><file name="hmenu-lock.png" hash="2a3b0b441834f443c1086930939efdae"/><file name="hmenu-unlock.gif" hash="8cc8205dafa587ef02d8a86903ae8074"/><file name="hmenu-unlock.png" hash="c1f61df70b98c5498ea81e7e7b9effbb"/><file name="invalid_line.gif" hash="04a88e97b56e8a8ece4a66d49cc78828"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="mso-hd.gif" hash="37fba9c02f0eefe57f655890eef1c4a1"/><file name="nowait.gif" hash="23c91166dbb16ba8655363321bf5a400"/><file name="page-first-disabled.gif" hash="8d3185028c541cbcce67b5909c04824e"/><file name="page-first.gif" hash="16ec00fa770d860b768cf5034ddfca96"/><file name="page-last-disabled.gif" hash="1d123237ceeb5109a1b9274f0cf19d73"/><file name="page-last.gif" hash="ef524dd0b8dfe4eefecffaa1c0bb8edd"/><file name="page-next-disabled.gif" hash="0f4b8681772c91921fa93ede9c755ea0"/><file name="page-next.gif" hash="f6f9d2209dfc99912ffc9848d97646db"/><file name="page-prev-disabled.gif" hash="eefcbed15c8d37a89618b08f7b224297"/><file name="page-prev.gif" hash="80daad880483eed682b22ec70514ecc4"/><file name="pick-button.gif" hash="b431fdf306f1e2f033d0a431996de93f"/><file name="property-cell-bg.gif" hash="1b65e348d6db0c7b6c9aa5478c15a052"/><file name="property-cell-selected-bg.gif" hash="a94039f89dec164896ceff1fbdf6dbc5"/><file name="refresh-disabled.gif" hash="105c62973ba69710bc2b41b443af5198"/><file name="refresh.gif" hash="f1a2e7df30394c5a30bc76c2d09013b7"/><file name="row-check-sprite.gif" hash="2d0aa7e501c3e6f97a97faf75e35d3c3"/><file name="row-expand-sprite.gif" hash="be81199d9d4fa69bef47a8f036a5a7d8"/><file name="row-over.gif" hash="f639094bd0560aefabc86e51a825f23d"/><file name="row-sel.gif" hash="ca87d6b950386edd5e17c985769d9101"/><file name="sort-hd.gif" hash="2640addef6e987b4c5dfa4c8c2dfb10c"/><file name="sort_asc.gif" hash="2352874b5f636ca331fe9509a2f9bdd7"/><file name="sort_desc.gif" hash="d104fcf119d40c51554ddb8b377142e5"/><file name="unchecked.gif" hash="31846118bddc7945b595ea2090589cf1"/><file name="wait.gif" hash="b0cd5a5dc070c705ebf8814a909802c3"/></dir><dir name="layout"><file name="mini-bottom.gif" hash="ae8e3674fd32997dc5217d5d6199a5a5"/><file name="mini-left.gif" hash="8654fdb45ecf4406af2fce1d3beb7596"/><file name="mini-right.gif" hash="cbdf9fb0c45466b4217ac9f7bd6a9ed4"/><file name="mini-top.gif" hash="fbd91e98576f66fd2702495251b15240"/></dir><dir name="menu"><file name="checked.gif" hash="cb7b3408df56f5585aaa1242cd2f0b45"/><file name="group-checked.gif" hash="f7973443d91e5e074013f1b07ee79479"/><file name="item-over.gif" hash="29055ede2ff0584d0374a2ff5a987382"/><file name="menu-item-active-bg.gif" hash="5956b7cac9aabf4c670c2997bba12d47"/><file name="menu-item-active-corners.gif" hash="9a073e133a65c4e1b3bd4098ca72552a"/><file name="menu-item-active-sides.gif" hash="cf1981c1027a8c962a9d8c0f6d61c098"/><file name="menu-parent.gif" hash="d303ad7e3ced891736e80f77e1d4e51d"/><file name="menu.gif" hash="ae128d5f3f3a39213f3d4e23aec8728f"/><file name="unchecked.gif" hash="31846118bddc7945b595ea2090589cf1"/></dir><dir name="progress"><file name="progress-default-bg.gif" hash="b170dfad9f747e1aca54e47c4415c2d3"/></dir><dir name="shared"><file name="blue-loading.gif" hash="dc2fd7c0ed853c56b4ac65710af3bd0a"/><file name="calendar.gif" hash="81296cff1f97f5365524f2b9dcf626da"/><file name="glass-bg.gif" hash="bc2cd5c5ac9b3874d956c892d23f2119"/><file name="hd-sprite.gif" hash="6a54ae98bef53397d52282201852c204"/><file name="icon-error.gif" hash="f477b54b6b8361362e96c2218dce7ea0"/><file name="icon-info.gif" hash="ec6b7a5d4caeea767c8674689bae47c6"/><file name="icon-question.gif" hash="2713644a8aa582728d71e35eca62fbcd"/><file name="icon-warning.gif" hash="3f20258272af0e00f6b7531b3b9aee35"/><file name="large-loading.gif" hash="d96f6517e00399c37a9765e045eaaf22"/><file name="left-btn.gif" hash="6bf30c6cf0b5d70436c3e463b5532b35"/><file name="loading-balls.gif" hash="ac062b94ed674aaa50a6c18df92acdf3"/><file name="right-btn.gif" hash="e7ad3a7f4814791cecf1b90e77e9e139"/><file name="shadow-c.png" hash="7ab6163237099f2529452b88953a4049"/><file name="shadow-lr.png" hash="986270d8ab4330fa7499dc33ed135598"/><file name="shadow.png" hash="860bf4f690d2ea2aba7b11500925da62"/><file name="warning.gif" hash="448dc934a7f0dd6092b51f88a1e47b2d"/></dir><dir name="sizer"><file name="e-handle-dark.gif" hash="b86289f41d7ad1a7401dd2b2a9b3c3d8"/><file name="e-handle.gif" hash="510edc95ebaa36306916c50ca10596f7"/><file name="ne-handle-dark.gif" hash="115f71b851c7f0b5f354caa7b8dfff15"/><file name="ne-handle.gif" hash="8e268b962dc909d275997b572ff17a72"/><file name="nw-handle-dark.gif" hash="4a361e6920b2e34a39fd425a515c83b9"/><file name="nw-handle.gif" hash="1120600505249c38c3d1cc2ab120cd13"/><file name="s-handle-dark.gif" hash="4a6bf15d308a4ae580dd03cbd431a95c"/><file name="s-handle.gif" hash="5e3338cb09e9df7f52383d6b1423fc86"/><file name="se-handle-dark.gif" hash="f3d8d8aac23e3e9633072e2366cda847"/><file name="se-handle.gif" hash="71edc3f63f79f447d2c81ee09e1fbbc3"/><file name="square.gif" hash="4431ea1954bfd2a9cea0931f07fc7ffa"/><file name="sw-handle-dark.gif" hash="44b2400d873cf8a23d84424827cde44d"/><file name="sw-handle.gif" hash="c3e0befc4208a51180344765fd7deeda"/></dir><dir name="slider"><file name="slider-bg.gif" hash="a6286f74e6de7414663483aa08305a2f"/><file name="slider-bg.png" hash="1fbffa04044bed9262836d2a710f9ee1"/><file name="slider-thumb.gif" hash="e8b6ac40fa2709692ed0d806ef90b0c3"/><file name="slider-thumb.png" hash="24a893c9606f3a6892eb62f29a08870c"/><file name="slider-v-bg.gif" hash="9d8e5f0a4afa0e2256b999c856ba1a9e"/><file name="slider-v-bg.png" hash="0682c28925a7296730f7f221e4a76b96"/><file name="slider-v-thumb.gif" hash="c871f735637e1c383862aacecabb554a"/><file name="slider-v-thumb.png" hash="2fc3430dc351d9a118e048b9aafb7c3c"/></dir><dir name="tab-bar"><file name="scroll-left.gif" hash="611cea625f98ee5c0204dc186da8a05e"/><file name="scroll-right.gif" hash="b31b5bb81129aa52755f7f0becedc624"/><file name="tab-bar-default-bg.gif" hash="d8e4c911af8cf8660fd598b0a004fbb4"/></dir><dir name="tip"><file name="tip-corners.gif" hash="679a8fd0e2d9aa18fedc2f2b4f6001bc"/><file name="tip-sides.gif" hash="f9f434277b451d60474db8756a506736"/></dir><dir name="toolbar"><file name="more.gif" hash="15c7a30d4131305b672fe1e76d962d4d"/><file name="scroll-left.gif" hash="90ed293465f6f6bbb6104e9285f60392"/><file name="scroll-right.gif" hash="086497e95d820d7c58a1be2293e6e4a6"/><file name="toolbar-default-bg.gif" hash="61b9dcfa93a445a8a7dbbfde6efd5ecf"/></dir><dir name="tools"><file name="tool-sprite-tpl.gif" hash="e0449768cd5dce80b18fac904818ab33"/><file name="tool-sprites.gif" hash="75106d9a5ffab255a5bb3792a2a16e16"/><file name="tools-sprites-trans.gif" hash="8331513f15bd26be38974a7d7fc4ee41"/></dir><dir name="tree"><file name="arrows.gif" hash="bd4ecad4870c5b23926742ddd1298584"/><file name="drop-above.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-append.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-below.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-between.gif" hash="edb544a0de58547d4a39c526e06e3c82"/><file name="drop-no.gif" hash="67f83ea04a2eb1c50614a96faf625f25"/><file name="drop-over.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-under.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/><file name="elbow-end-minus-nl.gif" hash="04025031365f2bdb09169188eae9556b"/><file name="elbow-end-minus.gif" hash="b4ae35ce75b5bbe728fdeeb5ed89ac42"/><file name="elbow-end-plus-nl.gif" hash="d6343055539d3ae503329e65d0927c0d"/><file name="elbow-end-plus.gif" hash="46f4d75f43fff6fcd4b0b9aeda907e9c"/><file name="elbow-end.gif" hash="6748722c117147e321d0af952833109e"/><file name="elbow-line.gif" hash="765c70e58be8064da7ce8c01afb1f6c3"/><file name="elbow-minus-nl.gif" hash="04025031365f2bdb09169188eae9556b"/><file name="elbow-minus.gif" hash="01359f5b57c066f952c1d5a02f21a457"/><file name="elbow-plus-nl.gif" hash="d6343055539d3ae503329e65d0927c0d"/><file name="elbow-plus.gif" hash="e4385b53e7f15b43b74e9c3b46cfee77"/><file name="elbow.gif" hash="53321708a4948539bb8b4c8efeae39c7"/><file name="folder-open.gif" hash="2bf2623696392abc9b2853b59aab3bb5"/><file name="folder.gif" hash="d15144420ee39843bb27feb014ee4442"/><file name="leaf.gif" hash="23757d6e353f343e3c7edfe28428f198"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/></dir><dir name="util"><dir name="splitter"><file name="mini-bottom.gif" hash="ae8e3674fd32997dc5217d5d6199a5a5"/><file name="mini-left.gif" hash="8654fdb45ecf4406af2fce1d3beb7596"/><file name="mini-right.gif" hash="cbdf9fb0c45466b4217ac9f7bd6a9ed4"/><file name="mini-top.gif" hash="fbd91e98576f66fd2702495251b15240"/></dir></dir></dir></dir><file name="dnd_grid_to_grid.js" hash="057a8cbf8b255c1955c83ca249bd9ae8"/><file name="examples.js" hash="c34c39a3da1b2216f636778b26e10108"/><file name="ext-all.js" hash="33c8a2191d27ee2812d9e5469f094556"/></dir><dir name="jquery"><file name="jquery.min.js" hash="4c8cfcfcda2e9d34ba0097086a7bc328"/></dir><dir name="resources"><dir name="css"><file name="README.txt" hash="66440774774ca4995ad5137ac9ae48e0"/><file name="basic-dialog.css" hash="4cc973c87f79ea230f372cea597963ba"/><file name="box.css" hash="3809db7ee254d629d52dba0aad472d35"/><file name="button.css" hash="d3f29c8497579832fe5d7aafff7c3544"/><file name="combo.css" hash="483a1a701ca9c7db718e0e767f3d4585"/><file name="core.css" hash="6e82710d5206b6b7c0f70399cf649449"/><file name="date-picker.css" hash="fa68b668561d477e702318fb5d59636c"/><file name="dd.css" hash="f0e5f55969aeda8f65a01033613181c5"/><file name="debug.css" hash="6ef466c0c857e0c405cac7b8911f0824"/><file name="editor.css" hash="2fdb75e85a247c362285d4f079c0a12f"/><file name="ext-all.css" hash="c5e12af950c3ea3a243d0b9ca0dc4dba"/><file name="form.css" hash="38bd5bd602a83075325696af2c447e65"/><file name="grid.css" hash="c6d110f89542c04e4cbf98de73e97e9b"/><file name="layout.css" hash="89251906d248b3756f0ed354491651a6"/><file name="menu.css" hash="88eb8b3754612496ccf9d386694a39e0"/><file name="panel.css" hash="deaf7ccb5526687fadd67c093da9e604"/><file name="qtips.css" hash="2a6e683a7b23cbdf52177d7141d17435"/><file name="reset-min.css" hash="8fddbb1b7930f2817f2d5d215be98d5f"/><file name="resizable.css" hash="a50b8d1ea8e9dfbdd101a43bc63857c3"/><file name="tabs.css" hash="323d6f11f1550a43a02a617e39242ed5"/><file name="toolbar.css" hash="d09eb7507f57178967d217caeaa8b046"/><file name="tree.css" hash="b0104f954fbe1f04ebf49acffcec74ef"/><file name="ytheme-aero.css" hash="c25b48ba1b913f2ea094065fa916e9da"/><file name="ytheme-galdaka.css" hash="8b1917749205e64bdbcecc893e188b09"/><file name="ytheme-gray.css" hash="c45ba874b89038c9c8d9a79a1c591f26"/><file name="ytheme-magento.css" hash="94c3fc72743ad6d1fe7d8e74d713750e"/><file name="ytheme-vista.css" hash="2092ef97154cf5f6b33893bf5e178e21"/></dir><dir name="themes"><dir name="images"><dir name="default"><dir name="basic-dialog"><file name="btn-arrow.gif" hash="9e2365ef98c6096f6b5f411ab618bb4e"/><file name="btn-sprite.gif" hash="73a8327c23c12ed9ec42ac8f52b072e0"/><file name="close.gif" hash="2d54069e9355f295dd27027f7f779eb9"/><file name="collapse.gif" hash="63b2687a2dc81537765a7d22f9e480da"/><file name="e-handle.gif" hash="f9357e6c1dfbd00da007cf6705e08225"/><file name="expand.gif" hash="740af52fb7de6ca9fd888184e86a5308"/><file name="hd-sprite.gif" hash="6a54ae98bef53397d52282201852c204"/><file name="progress.gif" hash="baff9a083b93588fa7ff3548844a9e1a"/><file name="progress2.gif" hash="339036f9eb530c1b180c77f9a109ef3e"/><file name="s-handle.gif" hash="36b90844c0b35da23da21aac599957d4"/><file name="se-handle.gif" hash="668b22581100befcf947e806599dc0ce"/></dir><dir name="box"><file name="corners-blue.gif" hash="86fd4c5664e0971bfc11959e8442604c"/><file name="corners.gif" hash="d2d1bc2085b369ce35ffd20c0121676e"/><file name="l-blue.gif" hash="ced9ffbf66ea39e77083a591f8257267"/><file name="l.gif" hash="c4d9dbbdc59ae06b5e9e72a6a865c981"/><file name="r-blue.gif" hash="82dbb522a80e3246f6297719371a9494"/><file name="r.gif" hash="bf1e1d4a45f951ae656968a8c834f04a"/><file name="tb-blue.gif" hash="7c4b19eb682afdc1bde0640d2321fb25"/><file name="tb.gif" hash="dd3f63afe7ba90983ba73dad1c66bf2f"/></dir><dir name="dd"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-no.gif" hash="ae536c37391ba78143b5c8283cec8d13"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/></dir><dir name="editor"><file name="tb-sprite.gif" hash="8908365d736426795ce46de7e328b508"/></dir><dir name="form"><file name="clear-trigger.gif" hash="97b3e5e9edf27b50d63d48098c2f1eae"/><file name="date-trigger.gif" hash="9245675ed8931df277184b419cf4cdad"/><file name="error-tip-corners.gif" hash="364474276178c7b48b6270056b42b808"/><file name="exclamation.gif" hash="40491021e901fa801dbbc09b6c59d73e"/><file name="search-trigger.gif" hash="559ef372cf27a38678d84e8c0b7237fc"/><file name="text-bg.gif" hash="d5ba54c1f417e6a72cbce8b909078727"/><file name="trigger-tpl.gif" hash="d7be20f0dc38f4f46cd318fe32cf3ce3"/><file name="trigger.gif" hash="45019efdf75528242c5a68742821dc57"/></dir><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><dir name="grid"><file name="Thumbs.db" hash="c3affff39ba36b80da43a08c34a61391"/><file name="arrow-left-white.gif" hash="b04e859bdcbd21ad1f06b8bfa7881df8"/><file name="arrow-right-white.gif" hash="714eb00f8134dde3a65c83f3f71ad2c4"/><file name="col-move-bottom.gif" hash="9c38bcb5cee1dc9b4ce64ad9ab1386f8"/><file name="col-move-top.gif" hash="c4584202d5172464050f675d396d1c6f"/><file name="dirty.gif" hash="decca3b96e2c37cf6eb04ddb0d9f669b"/><file name="done.gif" hash="365266930a93451414fe51ffc524a196"/><file name="drop-no.gif" hash="b53ca86d60fbcc7a45c8917299218bfd"/><file name="drop-yes.gif" hash="af96f4c3b32a470db2f38abb521b5c97"/><file name="footer-bg.gif" hash="65ed63e44c6149f1127ad3b4be4e0108"/><file name="grid-blue-hd.gif" hash="dd35d5c1202c440c2d1a945b335984d3"/><file name="grid-blue-split.gif" hash="0494ba49974ff2bc1bf81e1d82dfee18"/><file name="grid-hrow.gif" hash="55972a5063d80f35fb6b95a79bb0018a"/><file name="grid-loading.gif" hash="9ac6f737eb9b15272f12b00bfeb3c3c6"/><file name="grid-split.gif" hash="3ef419d4b9421d8e94f673a6238dc4c0"/><file name="grid-vista-hd.gif" hash="675f403e8a9cb5ab4bed725da9fe2023"/><file name="grid3-hd-btn.gif" hash="e3e77072c16a6b27556236961f29c552"/><file name="grid3-hrow-over.gif" hash="a92d8f6c106943995720f2884634670e"/><file name="grid3-hrow.gif" hash="4c58074bb961c8f184522355f1b0eb90"/><file name="grid3-special-col-bg.gif" hash="c9df03a1c107360128da89fa47066405"/><file name="grid3-special-col-sel-bg.gif" hash="a94039f89dec164896ceff1fbdf6dbc5"/><file name="hd-pop.gif" hash="e5f27a2f68cc2d13b11cf41c46d298dc"/><file name="hmenu-asc.gif" hash="048e0bc30f7c39d473dad5dabcbe03f2"/><file name="hmenu-desc.gif" hash="f0a987b34b003b25a7c82624d41f018a"/><file name="hmenu-lock.gif" hash="bcef18e25342c69c37c44dab87086065"/><file name="hmenu-lock.png" hash="2a3b0b441834f443c1086930939efdae"/><file name="hmenu-unlock.gif" hash="8cc8205dafa587ef02d8a86903ae8074"/><file name="hmenu-unlock.png" hash="c1f61df70b98c5498ea81e7e7b9effbb"/><file name="invalid_line.gif" hash="04a88e97b56e8a8ece4a66d49cc78828"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="mso-hd.gif" hash="37fba9c02f0eefe57f655890eef1c4a1"/><file name="nowait.gif" hash="23c91166dbb16ba8655363321bf5a400"/><file name="page-first-disabled.gif" hash="8d3185028c541cbcce67b5909c04824e"/><file name="page-first.gif" hash="16ec00fa770d860b768cf5034ddfca96"/><file name="page-last-disabled.gif" hash="1d123237ceeb5109a1b9274f0cf19d73"/><file name="page-last.gif" hash="ef524dd0b8dfe4eefecffaa1c0bb8edd"/><file name="page-next-disabled.gif" hash="0f4b8681772c91921fa93ede9c755ea0"/><file name="page-next.gif" hash="f6f9d2209dfc99912ffc9848d97646db"/><file name="page-prev-disabled.gif" hash="eefcbed15c8d37a89618b08f7b224297"/><file name="page-prev.gif" hash="80daad880483eed682b22ec70514ecc4"/><file name="pick-button.gif" hash="b431fdf306f1e2f033d0a431996de93f"/><file name="refresh.gif" hash="8dae08d3581dcd9a04ca73877eab4b53"/><file name="row-check-sprite.gif" hash="2d0aa7e501c3e6f97a97faf75e35d3c3"/><file name="row-expand-sprite.gif" hash="be81199d9d4fa69bef47a8f036a5a7d8"/><file name="row-over.gif" hash="f639094bd0560aefabc86e51a825f23d"/><file name="row-sel.gif" hash="ca87d6b950386edd5e17c985769d9101"/><file name="sort_asc.gif" hash="cc186187e31b0c39abbb7d2394916292"/><file name="sort_desc.gif" hash="fcfe91243fac2e5f24d05bb44f78ded4"/><file name="wait.gif" hash="b0cd5a5dc070c705ebf8814a909802c3"/></dir><dir name="layout"><file name="collapse.gif" hash="dfcec0803d488a783916c750fd83a897"/><file name="expand.gif" hash="c9c9b0ea5311c3dc016c69dc234912bc"/><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><file name="ns-collapse.gif" hash="efa9fbd7a1f3f0f1f22360391e16126f"/><file name="ns-expand.gif" hash="da1f9d40c091d3b6dc7a8dee4fc02ac6"/><file name="panel-close.gif" hash="b185da1837344529bfb684a96d8371b5"/><file name="panel-title-bg.gif" hash="b66384c309a397963389a76b07e9ecd4"/><file name="panel-title-light-bg.gif" hash="688d3a263442db125da170e5d3aebf70"/><file name="stick.gif" hash="be9e67ae0b61b01cfd15928ca7a3da51"/><file name="stuck.gif" hash="745e0cacb51250ea0216efc4a1cb50cb"/><file name="tab-close-on.gif" hash="0ae2c978e85391a69f0dce8da18d8b23"/><file name="tab-close.gif" hash="f92107cc6b4cb78af084648a628e01d2"/></dir><dir name="menu"><file name="checked.gif" hash="692bc97badf50c05495f6109143b4b11"/><file name="group-checked.gif" hash="f7973443d91e5e074013f1b07ee79479"/><file name="menu-parent.gif" hash="d303ad7e3ced891736e80f77e1d4e51d"/><file name="menu.gif" hash="5d34732294bbe06a862961dd02bcc962"/><file name="unchecked.gif" hash="9b90ed7c9e8f0892ce09f3b35b19db53"/></dir><dir name="panel"><file name="corners-sprite.gif" hash="06daef2335218cdfd900ce8bf7a68738"/><file name="left-right.gif" hash="49344fefef7c6f866f910b9067f0990f"/><file name="tool-sprite-tpl.gif" hash="e0449768cd5dce80b18fac904818ab33"/><file name="tool-sprites.gif" hash="31ccd74ac8dab4b5669887310a2341df"/><file name="top-bottom.gif" hash="d9a86e8466a31bd1cb87aae2cf55faf2"/><file name="white-corners-sprite.gif" hash="de8b3036676d19b9635f319a8a4aad36"/><file name="white-left-right.gif" hash="77a6389c6737ad507ca5330ad8816524"/><file name="white-top-bottom.gif" hash="f865d7237bff3c45fd4a8c448f97d236"/></dir><dir name="qtip"><file name="bg.gif" hash="49c0a530cc16357bb39d51c13065a88f"/><file name="close.gif" hash="0379d036250096cae2e42b427b3df2e7"/><file name="tip-sprite.gif" hash="11637a20b1f3f2331bf0627146c2f433"/></dir><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/><file name="shadow-c.png" hash="3abbfce345687daada53445adf6fddc7"/><file name="shadow-lr.png" hash="986270d8ab4330fa7499dc33ed135598"/><file name="shadow.png" hash="860bf4f690d2ea2aba7b11500925da62"/><dir name="shared"><file name="calendar.gif" hash="81296cff1f97f5365524f2b9dcf626da"/><file name="glass-bg.gif" hash="bc2cd5c5ac9b3874d956c892d23f2119"/><file name="left-btn.gif" hash="6bf30c6cf0b5d70436c3e463b5532b35"/><file name="right-btn.gif" hash="e7ad3a7f4814791cecf1b90e77e9e139"/><file name="warning.gif" hash="448dc934a7f0dd6092b51f88a1e47b2d"/></dir><dir name="sizer"><file name="e-handle-dark.gif" hash="b86289f41d7ad1a7401dd2b2a9b3c3d8"/><file name="e-handle.gif" hash="510edc95ebaa36306916c50ca10596f7"/><file name="ne-handle-dark.gif" hash="115f71b851c7f0b5f354caa7b8dfff15"/><file name="ne-handle.gif" hash="8e268b962dc909d275997b572ff17a72"/><file name="nw-handle-dark.gif" hash="4a361e6920b2e34a39fd425a515c83b9"/><file name="nw-handle.gif" hash="1120600505249c38c3d1cc2ab120cd13"/><file name="s-handle-dark.gif" hash="4a6bf15d308a4ae580dd03cbd431a95c"/><file name="s-handle.gif" hash="5e3338cb09e9df7f52383d6b1423fc86"/><file name="se-handle-dark.gif" hash="f3d8d8aac23e3e9633072e2366cda847"/><file name="se-handle.gif" hash="71edc3f63f79f447d2c81ee09e1fbbc3"/><file name="square.gif" hash="4431ea1954bfd2a9cea0931f07fc7ffa"/><file name="sw-handle-dark.gif" hash="44b2400d873cf8a23d84424827cde44d"/><file name="sw-handle.gif" hash="c3e0befc4208a51180344765fd7deeda"/></dir><dir name="tabs"><file name="tab-btm-inactive-left-bg.gif" hash="4f141a6abf25d3c9409b6c381333c138"/><file name="tab-btm-inactive-right-bg.gif" hash="eb2423d3b9dd072976ce955ab0c683d6"/><file name="tab-btm-left-bg.gif" hash="a36eb9382ed8b858eff2c5d4e5d7011a"/><file name="tab-btm-right-bg.gif" hash="9e4245776f0f7b6b6c7ddbf40a43103a"/><file name="tab-sprite.gif" hash="6a7d481bf5b74acfbfa0b01a35bd6620"/></dir><dir name="toolbar"><file name="btn-arrow-light.gif" hash="fa49b39a0fd88ef26264da44a2b4edea"/><file name="btn-arrow.gif" hash="12bda29a4c8016cfa047e852c4353f59"/><file name="btn-over-bg.gif" hash="faddf9b24cefa721326ba3f87f3ef31f"/><file name="gray-bg.gif" hash="cf2d9408f320e696e607d8472afa7ff0"/><file name="tb-bg.gif" hash="5309337fd7a22cab9d9467fd9eaa0a0c"/><file name="tb-btn-sprite.gif" hash="3aed28dd646d22e215c8a6a3e983322f"/></dir><dir name="tree"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-between.gif" hash="edb544a0de58547d4a39c526e06e3c82"/><file name="drop-no.gif" hash="67f83ea04a2eb1c50614a96faf625f25"/><file name="drop-over.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-under.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/><file name="elbow-end-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-end-minus.gif" hash="a469f6a4394d797c2efeffc70409f6db"/><file name="elbow-end-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-end-plus.gif" hash="ec1482391363612d9e5f8c7087fddaba"/><file name="elbow-end.gif" hash="345551384aa325189ba28a1c20f3405e"/><file name="elbow-line.gif" hash="90e478158df476dc989a60daaafc87e6"/><file name="elbow-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-minus.gif" hash="71bb1bd44b1274c60d30dba1de472ed7"/><file name="elbow-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-plus.gif" hash="945572d06a74b5f952251a86c595f2da"/><file name="elbow.gif" hash="27679f3b1222ba95d9925885d7d82d02"/><file name="folder-open.gif" hash="c569141d6ae7c61d838ed8af26aa9380"/><file name="folder.gif" hash="b7209740bb4a825a06beb8698d92c2b1"/><file name="leaf.gif" hash="23757d6e353f343e3c7edfe28428f198"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/></dir><dir name="window"><file name="corners-sprite.gif" hash="b485d6e69678822a0fb77cc312487874"/><file name="left-right.gif" hash="3fe626d6ca2f71d36fc62c32cb1cc52a"/><file name="top-bottom.gif" hash="8a227016c401438e602c2f770a611d5b"/></dir></dir><dir name="magento"><dir name="basic-dialog"><file name="collapse-on.gif" hash="b60dfdc0d00cfb30a8a622e0c22eed84"/><file name="collapse.gif" hash="8525b9d2e93d31e0b071b1f9bf9550e5"/><file name="expand-on.gif" hash="0dfb4ac6d626cdcaa931c14dbb45848e"/><file name="expand.gif" hash="0eb5c03da8b8415e0568784c959e536a"/><file name="hd-sprite.gif" hash="035bf2296afd70af7020cf06b60bf3f6"/><file name="ns-collapse-on.gif" hash="88ed8b7578c803f68d9f1eb171454e00"/><file name="ns-collapse.gif" hash="44b91376c040f91672aaa98c1fcc062b"/><file name="ns-expand-on.gif" hash="587c2ce90066280e5e6cd731bb9d346c"/><file name="ns-expand.gif" hash="57b479b168f8a54200bd1770b5591630"/><file name="panel_close.gif" hash="686c6dfcf341de25487ab4d8ea5954ce"/><file name="pop_close.gif" hash="dd3605531f9959901eff6f089f084bdc"/><file name="pop_collapse.gif" hash="2b8007242ae1c9ae9f26c60a878a63f7"/></dir><dir name="grid"><file name="grid-body-bg.gif" hash="b5fe585c01f57b2171a2b723abcc4a38"/><file name="grid-split.gif" hash="32e210451e8dc4295b53cf7ca13bb4a6"/></dir><dir name="layout"><file name="checkered-bg.gif" hash="f0a0cd29a6120377c289fd39e2ee7e80"/><file name="icon-catalog.gif" hash="435ff2300ddefb9f8a4bad8ee806fb1a"/><file name="icon-category.gif" hash="ce2a146851bb5ec1e41670b68183b56a"/><file name="icon-my-tasks.gif" hash="0ecb888b160701845e25a7140d038af0"/><file name="icon-product.gif" hash="a0707878c5221052209e5ae6a4de0bd2"/></dir><file name="loading_bg.gif" hash="e202ef7e03d0ef3e9beac7480dae65bf"/><dir name="tabs"><file name="tab-sprite.gif" hash="049fb2f4186b6dc9de747ad96456b1ab"/></dir><dir name="toolbar"><file name="btn-arrow.gif" hash="938cffb6de5cc8b1febfd1851fd983c2"/><file name="header_bg.gif" hash="3696842a32740fa159484cabc3340d13"/><file name="toolbar-bg.gif" hash="8d1b465c2a75963407b536d9081f649f"/></dir><dir name="tree"><file name="elbow-end-minus-nl.gif" hash="6dc08c43109cc6a365bd0270f05e2f1c"/><file name="elbow-end-minus.gif" hash="3dbdb88a9297fe5631e832f046b0350b"/><file name="elbow-end-plus-nl.gif" hash="6dc08c43109cc6a365bd0270f05e2f1c"/><file name="elbow-end-plus.gif" hash="5470e5712a9742ba666c26cb429baaeb"/><file name="elbow-end.gif" hash="63fe879440e2784e0cc0d316ce017745"/><file name="elbow-line.gif" hash="b316a39455304e20e01dbc437f57fd32"/><file name="elbow-minus-nl.gif" hash="0e3129bff70475c8f7f297e0e59d1608"/><file name="elbow-minus.gif" hash="e7b18ff6800e65c6e171bbb2a911762e"/><file name="elbow-plus-nl.gif" hash="78a8f737941fa658f1e770258a3791cd"/><file name="elbow-plus.gif" hash="b02cb264df55aef2105b1b245d075e56"/><file name="elbow.gif" hash="b6bd0e0237e3cd413fa2dac27701c724"/><file name="folder-open.gif" hash="e3cd196406d4857dc0c926807f16c409"/><file name="folder.gif" hash="03eb26c42137ac792609822862ef4d0f"/><file name="leaf.gif" hash="e3cd196406d4857dc0c926807f16c409"/><file name="s.gif" hash="df3e567d6f16d040326c7a0ea29a4f41"/></dir></dir></dir></dir></dir></dir><file name="ranking.js" hash="bbdbf7077ae6ffeb65b5f0b50bb3204f"/><file name="vendorhistory.css" hash="1c6ac4db45e2f234749b8b71f285fe00"/></dir></dir><dir name="includes"><dir name="src"><dir name="Logicbroker"><dir name="Dropship360"><dir name="controllers"><dir name="Adminhtml"><file name="InventoryController.php" hash="8c8df2448896a6dab42e131f1e5dee68"/><file name="LogicbrokerController.php" hash="0cf5f0ef8f84170b3c9f3749d3050128"/><file name="RankingController.php" hash="2a709afdad369cbb29c4dfa5f091fa64"/><file name="ReportController.php" hash="023e1acb60ef84290573df5a05281c90"/><file name="SourcingController.php" hash="35fb58b6b81fa1324ecd95b85abf0429"/><file name="UploadController.php" hash="fc31c7daea4eb49e8ee030fead1f3c50"/></dir></dir></dir></dir><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory.php" hash="99a5d1a58c1dc6ef2cc56ae9fc5b6481"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Addvendorfield.php" hash="af6a5039e07a8f610a50baaceec5465b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Lbvendor.php" hash="67d2d2b7e825f63bff4d343bc1cf8aa4"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Vendortabhistory.php" hash="69fbc5a2cd3fb1d010a613943f7a951c"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab.php" hash="814752c7c23059c93eb4fdc41a32bdd2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory.php" hash="c3a43db297bc516fac6f1a2beb2680c4"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid.php" hash="55a9058cdf9004c4f944d5722c1e5ede"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Logicbroker.php" hash="239a7cefa7386a8d3b40ad78422d1ae4"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Notification.php" hash="18d8754907908e0262c087d573f934a5"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Ranking.php" hash="42e39843931b6030840f8c3161ec84b6"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Ranking_Grid.php" hash="52407d6d50481bc32c391e3e09e2a7a1"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor.php" hash="750b5adec9792b9bdc593921b3e86a16"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Email.php" hash="b153871bad4a1599a2f9b4165c4287f2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Form.php" hash="33d12cac623619efaaac0325f19452b8"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Grid.php" hash="fd9a2f6af14688fdc19a72803e319ece"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Periodopen.php" hash="6297aefbe9fc2f7c9449e1b461afe075"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Form_Timestatus.php" hash="ef5b8206b1c0e71cd1d3ad6c31923a8a"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Staticemailgrid.php" hash="078130167406426bad0e577d1fc4b0ce"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sales_Order_View_Items.php" hash="acb46509068da360104a0c8cada453da"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Showhistory.php" hash="a82540104538beaa185238b4931fdb14"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing.php" hash="d94b0f3a7e4d290d71f69064cbe98282"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit.php" hash="767bcde378baf0ff1196598e0c466fc5"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Form.php" hash="e6b0312f4fc38b771089fbb1815578ef"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Tab_Form.php" hash="d0d9a417b1e59d06030ff7a65c6cbc88"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Tabs.php" hash="5298c26c63035ff916a986c8072c8d0b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Grid.php" hash="8c1ab115b99ea39900dccd60ee7ac651"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_Renderer_Action.php" hash="edea4e5929b246ff70d063aa5845b3f9"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View.php" hash="02be1363be1b4610bdee1dbc7cc2ba34"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View_Form.php" hash="9da38c9ec7e580f660155ec62d7e0eeb"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View_Tabs.php" hash="94ffa503cf28c9fa63076f84c02b9cee"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Crontime.php" hash="b81ffae42850e8171d357f911a0e11fc"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Fieldset_Hint.php" hash="72f6124a380765b0142ebecd9cbfb6cf"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton.php" hash="f7d562a0e7377c85083f0d2fe14fea08"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Helplink.php" hash="0d0427b473f8a343efa394c4a0853942"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Singuplink.php" hash="a6927e292ac86b35339a5029034b5ac2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Submitbutton.php" hash="7ce0fade94eede8db6ff04c0dbe50dac"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Time.php" hash="74a40038b4a50994296b0cb7fce2947f"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload.php" hash="42c6c3cdcc0a6a015c567a83997d85a3"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Bulkassign.php" hash="bd462fdca45aec2dc8e762237ceefe1b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Button.php" hash="7b98d1326c1f93bc643e1463242224a2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form.php" hash="50eff157cd1fe36cc670786f053ae939"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory.php" hash="135610c201ebde49e396ca2685249ccc"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Nameaction.php" hash="bd171423eec53f92fda759bf4d3624f1"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Orderaction.php" hash="842701da280c25c3c552b05d7c06413e"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Skuaction.php" hash="0c4477b7bdabcc81da134929b2926ef7"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Textaction.php" hash="9855312bb0dcac85104f7f0cd4a51054"/><file name="Logicbroker_Dropship360_Helper_Data.php" hash="ee1785693bb5bddbb4c4452e678960d8"/><file name="Logicbroker_Dropship360_Model_Api2_Createroleandrule.php" hash="71ece80df5c5c87e13075841a1f9f4e1"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory.php" hash="9d08c98e36b9c232b9d796a418aac383"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest.php" hash="b7e996ed201e1d1e0239d6d226ef1007"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Admin_V1.php" hash="a6a58df3d657dbe8b8f42da5e107a212"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Customer_V1.php" hash="c0327118b69995896f78acd7907fa71f"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Guest_V1.php" hash="1c3f3a1a87ccd9bd1120138d8369229d"/><file name="Logicbroker_Dropship360_Model_Api2_Product.php" hash="5ced4e9d325db0cf6f748a13c8384298"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest.php" hash="f423598eb3ae1871d8b4a326f7dda181"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Admin_V1.php" hash="6f4acb240c2875694c9a710bfec844c4"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Customer_V1.php" hash="c0327118b69995896f78acd7907fa71f"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Guest_V1.php" hash="0f4c46ad1ef2e6fefd1fdbda4034ad85"/><file name="Logicbroker_Dropship360_Model_Csvparser.php" hash="6b4810b688501b741c89bf04b5ab30b6"/><file name="Logicbroker_Dropship360_Model_Inventory.php" hash="f9c1489738188804a835641a76e29d85"/><file name="Logicbroker_Dropship360_Model_Inventorylog.php" hash="208f743adec62a2d8117120cf42ef342"/><file name="Logicbroker_Dropship360_Model_Logicbroker.php" hash="99124a4b0cf794f894e9725bf4d7589b"/><file name="Logicbroker_Dropship360_Model_Observer.php" hash="36fb3b2090cab1162a00e0769878b08b"/><file name="Logicbroker_Dropship360_Model_Order_Api.php" hash="883eb8772a085238c1d87893ad8f326e"/><file name="Logicbroker_Dropship360_Model_Orderitems.php" hash="54ed3910268b9a6828f44d0fbde92e12"/><file name="Logicbroker_Dropship360_Model_Ordersourcing.php" hash="cb43e6b2763d874c0579c26fdffd6598"/><file name="Logicbroker_Dropship360_Model_Productimport.php" hash="7feece453157d3930e7866b48afaa6f6"/><file name="Logicbroker_Dropship360_Model_Ranking.php" hash="96905331a59e81a2a0d54cff032c82fc"/><file name="Logicbroker_Dropship360_Model_Rankinglog.php" hash="094334cf66c9ce7304c87082570a496d"/><file name="Logicbroker_Dropship360_Model_Report.php" hash="ae7188a15da1892667de020648d6b4af"/><file name="Logicbroker_Dropship360_Model_Resource_Inventory.php" hash="105f54b381ac6cde7ba6e4ff01435083"/><file name="Logicbroker_Dropship360_Model_Resource_Inventory_Collection.php" hash="4a0707fc5d728c872a7df48a372e3411"/><file name="Logicbroker_Dropship360_Model_Resource_Inventorylog.php" hash="9821c43afd97cef8608b08c634456dd3"/><file name="Logicbroker_Dropship360_Model_Resource_Inventorylog_Collection.php" hash="1a24af879a980509fc049106dfa7ed17"/><file name="Logicbroker_Dropship360_Model_Resource_Orderitems.php" hash="2f5611b00cf0b15994047a85476764d5"/><file name="Logicbroker_Dropship360_Model_Resource_Orderitems_Collection.php" hash="09ca1baa286ba8dbe2d8636041afc183"/><file name="Logicbroker_Dropship360_Model_Resource_Ordersourcing.php" hash="6c9903c47b98b1032ed262578b15d5f2"/><file name="Logicbroker_Dropship360_Model_Resource_Ordersourcing_Collection.php" hash="a4341add3d2e4ed0d4fec5b5ead2b391"/><file name="Logicbroker_Dropship360_Model_Resource_Ranking.php" hash="e728c7db906f4257c9fa2828f3b1889c"/><file name="Logicbroker_Dropship360_Model_Resource_Ranking_Collection.php" hash="2c5f73589c3cf1cc61d82ff3184e9180"/><file name="Logicbroker_Dropship360_Model_Resource_Rankinglog.php" hash="280ca665631b7dfdc5fd65bdd37dd977"/><file name="Logicbroker_Dropship360_Model_Resource_Rankinglog_Collection.php" hash="847f4a313b4c57f1943667a743fb1876"/><file name="Logicbroker_Dropship360_Model_Resource_Setup.php" hash="db1b106449549a4d6a94e115b35f36d3"/><file name="Logicbroker_Dropship360_Model_Resource_Uploadvendor.php" hash="cdea6d41186776859dd4ff1b903631e0"/><file name="Logicbroker_Dropship360_Model_Resource_Uploadvendor_Collection.php" hash="c00c646cd30ea2846eaf64aebfa60d81"/><file name="Logicbroker_Dropship360_Model_Resource_Vendorimportlog.php" hash="5612cc9ad31e26537854803cf48cd83c"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Oudatedinventory_Email.php" hash="3c0a74ca609f55dcbffb9eec2ec61eaa"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Report_Email.php" hash="b8add0d41e93c027e056103eb2ffd784"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Sourcing_Cronbackorder.php" hash="b653137f284099cda52229ca4a03032a"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Sourcing_Cronsourcing.php" hash="e344d67cb474c67d39453cbfb90ae010"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Uploadvendor_Cron.php" hash="d7ab43d34129359aaca41be3f8510e7a"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Attributecodes.php" hash="f97c33f5918714fccab7eb49119a8b95"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Category.php" hash="c5b9a7f9b613f8abe98c2419d802ab5c"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ediqualifier.php" hash="ac6c52c324204bd2062c0361c64e27b6"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ftptype.php" hash="66fc7d9ba1926a043060557f8ce87061"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Optionvalues.php" hash="48dc60144b3e8dae327e42c5bb567608"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ranktype.php" hash="4a2a731340fd142ab77b75d64ac91ef8"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Store.php" hash="eaa19dfd1575ac6f851f115dd501fbf2"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Time.php" hash="7ccf6ebc62220eb3861b6ae3c91e7cfa"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist.php" hash="535eea5a21a3c027a232cd1285a0120b"/><file name="Logicbroker_Dropship360_Model_Uploadvendor.php" hash="4f3f408b07c0b06ba1133542257c46a6"/><file name="Logicbroker_Dropship360_Model_Versions_Api.php" hash="7fc94e25af730bd4b8f48dbc8603bf7b"/><file name="Logicbroker_Dropship360_Model_Versions_Api_V2.php" hash="6def122e3c99344db1d10dc0b4ccfaa3"/></dir></dir><dir name="media"><dir name="logicbroker"><file name="Supplier_Ranking.png" hash="4390fdd6c9a3813ba716d50aa3a0dc2c"/><file name="System_Setup_Update.png" hash="b70cfea7eb0a4b02562d3d851c8a90a0"/><file name="System_Setup_Update_Step2.png" hash="719655c99dbaa771654551e1c496a708"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>dropship360</name>
|
4 |
+
<version>3.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://logicbroker.com/portfolio/magento/license">Customer License</license>
|
7 |
<channel>community</channel>
|
10 |
<description>logicbroker is the most complete eCommerce integration platform available and offers a true end-to-end EDI solution for Magento. Beyond its EDI capabilities, logicbroker’s flexible connectivity automates and simplifies tasks like drop ship deployment and omni-channel retailing. logicbroker connects Magento to backend systems like ERPs (Dynamics, Netsuite, Exact), accounting software (QuickBooks), and order management systems (M.O.M) to seamlessly exchange information</description>
|
11 |
<notes>package is ready</notes>
|
12 |
<authors><author><name>Logicbroker</name><user>Logicbroker</user><email>magentoext@logicbroker.com</email></author></authors>
|
13 |
+
<date>2016-06-24</date>
|
14 |
+
<time>15:34:45</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Logicbroker"><dir name="Dropship360"><dir name="Block"><dir name="Adminhtml"><dir name="Inventory"><dir name="Edit"><dir name="Tab"><file name="Addvendorfield.php" hash="af6a5039e07a8f610a50baaceec5465b"/><file name="Lbvendor.php" hash="67d2d2b7e825f63bff4d343bc1cf8aa4"/><file name="Vendortabhistory.php" hash="69fbc5a2cd3fb1d010a613943f7a951c"/></dir><file name="Vendortab.php" hash="2d527ae0b61912525b0c59ccc9c5bb51"/><file name="Vendortabhistory.php" hash="5d4df7f9445759a7943c4dfead927d6d"/></dir><file name="Grid.php" hash="8b43f6e012cfb9f278d14ddd4fa762ff"/></dir><file name="Inventory.php" hash="99a5d1a58c1dc6ef2cc56ae9fc5b6481"/><file name="Logicbroker.php" hash="239a7cefa7386a8d3b40ad78422d1ae4"/><file name="Notification.php" hash="18d8754907908e0262c087d573f934a5"/><dir name="Ranking"><file name="Grid.php" hash="52407d6d50481bc32c391e3e09e2a7a1"/></dir><file name="Ranking.php" hash="42e39843931b6030840f8c3161ec84b6"/><dir name="Reports"><dir name="Activitymonitor"><file name="Email.php" hash="b153871bad4a1599a2f9b4165c4287f2"/><file name="Form.php" hash="33d12cac623619efaaac0325f19452b8"/><file name="Grid.php" hash="fd9a2f6af14688fdc19a72803e319ece"/><file name="Periodopen.php" hash="6297aefbe9fc2f7c9449e1b461afe075"/></dir><file name="Activitymonitor.php" hash="750b5adec9792b9bdc593921b3e86a16"/><dir name="Form"><file name="Timestatus.php" hash="ef5b8206b1c0e71cd1d3ad6c31923a8a"/></dir><file name="Staticemailgrid.php" hash="078130167406426bad0e577d1fc4b0ce"/></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Items.php" hash="acb46509068da360104a0c8cada453da"/></dir></dir></dir><file name="Showhistory.php" hash="a82540104538beaa185238b4931fdb14"/><dir name="Sourcing"><dir name="Edit"><file name="Form.php" hash="e6b0312f4fc38b771089fbb1815578ef"/><dir name="Tab"><file name="Form.php" hash="d0d9a417b1e59d06030ff7a65c6cbc88"/></dir><file name="Tabs.php" hash="5298c26c63035ff916a986c8072c8d0b"/></dir><file name="Edit.php" hash="767bcde378baf0ff1196598e0c466fc5"/><file name="Grid.php" hash="8c1ab115b99ea39900dccd60ee7ac651"/><dir name="History"><dir name="Renderer"><file name="Action.php" hash="edea4e5929b246ff70d063aa5845b3f9"/></dir><dir name="View"><file name="Form.php" hash="9da38c9ec7e580f660155ec62d7e0eeb"/><file name="Tabs.php" hash="94ffa503cf28c9fa63076f84c02b9cee"/></dir><file name="View.php" hash="02be1363be1b4610bdee1dbc7cc2ba34"/></dir><file name="Pomanagment.php" hash="dcc67bb9439abc2bb4ec86cc1b8fe720"/></dir><file name="Sourcing.php" hash="5dbf26e493b5ede38087c4c98b708083"/><dir name="System"><dir name="Config"><file name="Crontime.php" hash="b81ffae42850e8171d357f911a0e11fc"/><dir name="Fieldset"><file name="Hint.php" hash="72f6124a380765b0142ebecd9cbfb6cf"/></dir><file name="Ftpconnectionbutton.php" hash="e8ee1b4007e476b4d11600b74eb034ea"/><file name="Helplink.php" hash="0d0427b473f8a343efa394c4a0853942"/><file name="Singuplink.php" hash="a6927e292ac86b35339a5029034b5ac2"/><file name="Submitbutton.php" hash="7ce0fade94eede8db6ff04c0dbe50dac"/><file name="Time.php" hash="74a40038b4a50994296b0cb7fce2947f"/></dir></dir><dir name="Upload"><file name="Bulkassign.php" hash="bd462fdca45aec2dc8e762237ceefe1b"/><dir name="Edit"><file name="Button.php" hash="7b98d1326c1f93bc643e1463242224a2"/><file name="Form.php" hash="263dba517dd240926fb9d04154d8c2ea"/></dir></dir><file name="Upload.php" hash="6121221ac90f5b9e92c10ec8df4f4727"/><file name="Vendorproductuploadhistory.php" hash="165ad202a5ae993300ba6494989ada67"/><dir name="Widget"><dir name="Grid"><dir name="Column"><file name="Nameaction.php" hash="bd171423eec53f92fda759bf4d3624f1"/><file name="Orderaction.php" hash="842701da280c25c3c552b05d7c06413e"/><file name="Skuaction.php" hash="0c4477b7bdabcc81da134929b2926ef7"/><file name="Textaction.php" hash="9855312bb0dcac85104f7f0cd4a51054"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5e719220290f4eb534d87f4ae39eb69d"/></dir><dir name="Model"><dir name="Api2"><file name="Createroleandrule.php" hash="71ece80df5c5c87e13075841a1f9f4e1"/><dir name="Inventory"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="a6a58df3d657dbe8b8f42da5e107a212"/></dir><dir name="Customer"><file name="V1.php" hash="c0327118b69995896f78acd7907fa71f"/></dir><dir name="Guest"><file name="V1.php" hash="1c3f3a1a87ccd9bd1120138d8369229d"/></dir></dir><file name="Rest.php" hash="b7e996ed201e1d1e0239d6d226ef1007"/></dir><file name="Inventory.php" hash="9d08c98e36b9c232b9d796a418aac383"/><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="6f4acb240c2875694c9a710bfec844c4"/></dir><dir name="Customer"><file name="V1.php" hash="c0327118b69995896f78acd7907fa71f"/></dir><dir name="Guest"><file name="V1.php" hash="0f4c46ad1ef2e6fefd1fdbda4034ad85"/></dir></dir><file name="Rest.php" hash="f423598eb3ae1871d8b4a326f7dda181"/></dir><file name="Product.php" hash="5ced4e9d325db0cf6f748a13c8384298"/></dir><file name="Csvparser.php" hash="010e13e9015a36358c05758227738182"/><dir name="Import"><file name="Base.php" hash="e4b244a10ac2ab1ae952d7d6cc4b9864"/><file name="Ftp.php" hash="5f72205e2525a320abc308439efe8527"/><file name="Ftpimport.php" hash="835c6e3a3878d8f6d742fe00314a5547"/><file name="Manualimport.php" hash="be55148fbf4b5b368fe5b43610da9677"/><file name="Productsetup.php" hash="1b6140bf65787e16faf791f909641d98"/></dir><file name="Import.php" hash="b56a7ea12a97c46dcd0b53b20a8b3cd8"/><file name="Inventory.php" hash="65753e4c7be5a526b1d56c87de71dd84"/><file name="Inventorylog.php" hash="e3a0444251b18237f663aabf4c054d7a"/><file name="Logicbroker.php" hash="99124a4b0cf794f894e9725bf4d7589b"/><file name="Observer.php" hash="5a56365880d0537ad84965719242fc3a"/><dir name="Order"><file name="Api.php" hash="4dc38ebb1e39a7b0a150c72e3ad7c19c"/></dir><file name="Orderitems.php" hash="986c257f9bb3fc23266617f86db000f2"/><file name="Ordersourcing.php" hash="d7eaaad82897268eadbfb51383ca01f8"/><file name="Productimport.php" hash="d32d63662c3ce93d4559475c2d3fdd11"/><file name="Ranking.php" hash="10ebabf55aa45db3e9e03f0fc0754d6b"/><file name="Rankinglog.php" hash="094334cf66c9ce7304c87082570a496d"/><file name="Report.php" hash="ae7188a15da1892667de020648d6b4af"/><dir name="Resource"><dir name="Inventory"><file name="Collection.php" hash="4a0707fc5d728c872a7df48a372e3411"/></dir><file name="Inventory.php" hash="105f54b381ac6cde7ba6e4ff01435083"/><dir name="Inventorylog"><file name="Collection.php" hash="1a24af879a980509fc049106dfa7ed17"/></dir><file name="Inventorylog.php" hash="9821c43afd97cef8608b08c634456dd3"/><dir name="Orderitems"><file name="Collection.php" hash="09ca1baa286ba8dbe2d8636041afc183"/></dir><file name="Orderitems.php" hash="f1b0d3a6c9efcdbe4ec182e5f2a452f2"/><dir name="Ordersourcing"><file name="Collection.php" hash="a4341add3d2e4ed0d4fec5b5ead2b391"/></dir><file name="Ordersourcing.php" hash="6c9903c47b98b1032ed262578b15d5f2"/><dir name="Ranking"><file name="Collection.php" hash="2c5f73589c3cf1cc61d82ff3184e9180"/></dir><file name="Ranking.php" hash="e728c7db906f4257c9fa2828f3b1889c"/><dir name="Rankinglog"><file name="Collection.php" hash="847f4a313b4c57f1943667a743fb1876"/></dir><file name="Rankinglog.php" hash="280ca665631b7dfdc5fd65bdd37dd977"/><file name="Setup.php" hash="db1b106449549a4d6a94e115b35f36d3"/><dir name="Uploadvendor"><file name="Collection.php" hash="c00c646cd30ea2846eaf64aebfa60d81"/></dir><file name="Uploadvendor.php" hash="cdea6d41186776859dd4ff1b903631e0"/><file name="Vendorimportlog.php" hash="5612cc9ad31e26537854803cf48cd83c"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Oudatedinventory"><file name="Email.php" hash="3c0a74ca609f55dcbffb9eec2ec61eaa"/></dir><dir name="Report"><file name="Email.php" hash="b8add0d41e93c027e056103eb2ffd784"/></dir><dir name="Sourcing"><file name="Cronbackorder.php" hash="b653137f284099cda52229ca4a03032a"/><file name="Cronsourcing.php" hash="e344d67cb474c67d39453cbfb90ae010"/></dir><dir name="Uploadvendor"><file name="Cron.php" hash="d7ab43d34129359aaca41be3f8510e7a"/></dir></dir><dir name="Source"><file name="Attributecodes.php" hash="f97c33f5918714fccab7eb49119a8b95"/><file name="Category.php" hash="c5b9a7f9b613f8abe98c2419d802ab5c"/><file name="Ediqualifier.php" hash="ac6c52c324204bd2062c0361c64e27b6"/><file name="Ftptype.php" hash="66fc7d9ba1926a043060557f8ce87061"/><file name="Optionvalues.php" hash="48dc60144b3e8dae327e42c5bb567608"/><file name="Ranktype.php" hash="4a2a731340fd142ab77b75d64ac91ef8"/><file name="Store.php" hash="eaa19dfd1575ac6f851f115dd501fbf2"/><file name="Time.php" hash="7ccf6ebc62220eb3861b6ae3c91e7cfa"/><file name="Vendorlist.php" hash="28e75832378ea85a4eb037b029fcad32"/></dir></dir></dir><file name="Uploadvendor.php" hash="2ba69f904a795307c6a66c4b38b30ae7"/><dir name="Versions"><dir name="Api"><file name="V2.php" hash="6def122e3c99344db1d10dc0b4ccfaa3"/></dir><file name="Api.php" hash="7fc94e25af730bd4b8f48dbc8603bf7b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Logicbroker"><file name="InventoryController.php" hash="961c77f6cc362a57302fdf524827698c"/><file name="LogicbrokerController.php" hash="d8fb861cf2d73adaa0589a05fa120307"/><file name="RankingController.php" hash="eef377b4c7310d7694dbfa3691a376a7"/><file name="ReportController.php" hash="51927a073fef936699037499ce9a1455"/><file name="SourcingController.php" hash="d156da62a0c1cc8644e04da759d7615e"/><file name="UploadController.php" hash="08ce7fbc961c94285d5b6f7efdc18aae"/></dir></dir></dir><dir name="data"><dir name="dropship360_setup"><file name="data-install-1.0.3.php" hash="571b05db7d7f51ff2a07be017e954285"/><file name="data-upgrade-1.0.3-1.0.4.php" hash="9880908a508362787c703f3ac38d70f0"/><file name="data-upgrade-1.0.4-1.0.5.php" hash="fae385cfd674925b55d148e9d149192a"/><file name="data-upgrade-1.0.5-1.0.6.php" hash="6fc6b8bc7e5023e153db504f9d941089"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ff343895f19b0cc628193173f7774a68"/><file name="api.xml" hash="165553b1db97a5e32898023c74fc07a5"/><file name="api2.xml" hash="92e6f7bfeee312d5c5d9b5346994b698"/><file name="config.xml" hash="6d78ba53c48ea7fc560c8961603215c5"/><file name="jstranslator.xml" hash="8de896de15a8c593a3198d8e2100a71d"/><file name="system.xml" hash="abc0bb87f058a8cbfdcdbd918881c23a"/><file name="wsdl.xml" hash="9e3f53bca73dddf8486d62a8306d8dac"/></dir><dir name="sql"><dir name="dropship360_setup"><file name="mysql4-install-1.0.3.php" hash="45e15c99c8041e08bbacd46cb994576d"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="5962486ed85a99c3f866c5854e14c11f"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="7895767223ec16662bc3f92deb7b6d2e"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="4945b81af12170c8aa78a36a147b1910"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="1eff97e395c2d0cca92801d253a9b2d3"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="bd268a99487f3f04e2d20149fc40b9f0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="logicbroker"><file name="add_help_js.phtml" hash="21a3ec98fdf3e499aaa66193e1a854a0"/><file name="addvendorfields.phtml" hash="4fda9044642b8e888f7565aa203fb41b"/><dir name="bundle"><file name="renderer.phtml" hash="90727f64e0018dd453c4d6c08aa152d5"/></dir><dir name="downloadable"><file name="downloadable.phtml" hash="a4f6bbb9469fad1f6a8d6cb76dcacd3a"/></dir><dir name="html"><file name="pager.phtml" hash="ef0e74e20708b97261197cd067b48e4d"/></dir><dir name="import"><dir name="form"><file name="after.phtml" hash="08085046e6675633ada4009bc000297f"/><file name="before.phtml" hash="3dda3ab8d33e980fb48b3ac8af757bfc"/></dir><dir name="frame"><file name="result.phtml" hash="3593b07a3b9540c7eea44d29fbf3c272"/></dir></dir><file name="inline-edit.phtml" hash="ad39e2d2a306160e69579016493744ba"/><file name="item_order_history.phtml" hash="a76e0a3f2143b7f3d45587bf79f5ab7e"/><file name="popup.phtml" hash="ca4e3467dceb197329cd2593e4d90096"/><file name="process-profile.phtml" hash="9d5708843faf3fffa478d18cd4efee11"/><dir name="reports"><dir name="email"><file name="grid.phtml" hash="5a7b8849ad148208806491c51c39fba5"/></dir><dir name="grid"><file name="container.phtml" hash="8d72e70a1d5feee742e999d5bf4c7bc6"/></dir></dir><file name="result.phtml" hash="0bff64bf35c207c0ab2b0e7607f75ef5"/><dir name="sales"><file name="default.phtml" hash="7db57395558a25ee9ad309a960f0abec"/><file name="items.phtml" hash="eece06fcdcbc9cb7975577e635191d0a"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="9e7131591c421ca2a526dacf22572b7e"/></dir><file name="submitbutton.phtml" hash="ad652c41e879efe23da1a58d963dd197"/></dir></dir><file name="upload_vendor_product.phtml" hash="2d04cd9fdb030546cd3e63837c68d769"/><file name="vendor_ranking.phtml" hash="69ed0f93a93469fe61bb534c9d287d2d"/><file name="vendor_upload_product_history.phtml" hash="bb9ea46753cfcd8d047cec14405c2216"/><file name="vendorproducttab.phtml" hash="9180e2f4a9f49b6b2372510acba9ad26"/><file name="vendorproducttabhistory.phtml" hash="9c0194bf9e410f46f1941246cdaee363"/><file name="window.phtml" hash="747bf4686b4635ed8caefa1ce629dfd8"/></dir></dir><dir name="layout"><file name="logicbroker.xml" hash="96c95fa44ec9eddfee8551fdd7cb7734"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Logicbroker_Dropship360.xml" hash="67068aaea26ac3534322d12dbb7c0c1a"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Logicbroker_Dropship360.csv" hash="34e85a999b73c4a216eed04dfffa756d"/><dir name="template"><dir name="email"><dir name="logicbroker"><file name="activity_report_staticstatus.html" hash="1f060800e62af9aa3ab51916efd228c0"/><file name="first_order_notification.html" hash="bc2f640396d0ac3fc3d3e37bfe65f3a5"/><file name="first_productsetup_notification.html" hash="a2b56627a24975377263cffc594f8219"/><file name="logicbroker.html" hash="f4902b5293a5290c006dbc3522238dd4"/><file name="logicbroker_ftp_con_fail.html" hash="cc946e7665e4f7bca987c4fdd2b62e66"/><file name="oudated_product_inventory_notification.html" hash="f777b863bc1dce0ebddbc63f6e6be0b8"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="logicbroker"><dir><dir name="extjs"><file name="bootstrap.js" hash="a82e5f0ee98f60e92bb5774e25c480f7"/><dir name="css"><file name="example.css" hash="7fcbf7ea6c0466ac334f00e12ac4be7e"/><file name="ext-all.css" hash="ecf28869070c6511559c6a5286a6f6cb"/><dir name="images"><dir name="boundlist"><file name="trigger-arrow.png" hash="4655916b183b914b357da69b86414f52"/></dir><dir name="box"><file name="corners-blue.gif" hash="86fd4c5664e0971bfc11959e8442604c"/><file name="corners.gif" hash="d2d1bc2085b369ce35ffd20c0121676e"/><file name="l-blue.gif" hash="ced9ffbf66ea39e77083a591f8257267"/><file name="l.gif" hash="c4d9dbbdc59ae06b5e9e72a6a865c981"/><file name="r-blue.gif" hash="82dbb522a80e3246f6297719371a9494"/><file name="r.gif" hash="bf1e1d4a45f951ae656968a8c834f04a"/><file name="tb-blue.gif" hash="7c4b19eb682afdc1bde0640d2321fb25"/><file name="tb.gif" hash="dd3f63afe7ba90983ba73dad1c66bf2f"/></dir><dir name="button"><file name="arrow.gif" hash="44b6dbf385236a2697932a7a3e20b4a0"/><file name="btn.gif" hash="40ac871755023cc11ad15dcd77b54dbf"/><file name="group-cs.gif" hash="5dc0252bd9ecf72f98d858427054cf08"/><file name="group-lr.gif" hash="cb7813012d6be17e083835d60037029e"/><file name="group-tb.gif" hash="4edf9b7db13b1331282eed298384cab9"/><file name="s-arrow-b-noline.gif" hash="30d04f652551f1df9d59d33a99c9a320"/><file name="s-arrow-b.gif" hash="a957a6d618d19b92a2d1a7a1b50f5235"/><file name="s-arrow-bo.gif" hash="53a15d7907a017122f7f60402c435753"/><file name="s-arrow-light.gif" hash="6576de0eb6bec88f8e37c12829939573"/><file name="s-arrow-noline.gif" hash="13f08a275c58135365b8e58b3177ab1a"/><file name="s-arrow-o.gif" hash="5005d8dea2f9456aaf2ab27ca7bf5651"/><file name="s-arrow.gif" hash="bc71296ddf9c7ef5aa56b09ca3512c8a"/></dir><dir name="datepicker"><file name="datepicker-footer-bg.gif" hash="52e65759b3e8c81d3c3f2d0484ec9e58"/><file name="datepicker-footer-bg.png" hash="deca7c712da61f827c61b6219b3246af"/><file name="datepicker-header-bg.gif" hash="5cda0bb28a42b7023d24d48b9a0e1685"/><file name="datepicker-header-bg.png" hash="93fb8e8f1fb52d38e61ab064187f11de"/></dir><dir name="dd"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-no.gif" hash="ae536c37391ba78143b5c8283cec8d13"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/></dir><dir name="editor"><file name="tb-sprite.gif" hash="a2f06caddc2fb729db5cbbd874491128"/></dir><dir name="form"><file name="checkbox.gif" hash="75d685cab5665a935660a3d04f71c2be"/><file name="clear-trigger.gif" hash="97b3e5e9edf27b50d63d48098c2f1eae"/><file name="date-trigger.gif" hash="30b5bace9f3dac358716c1415270f874"/><file name="error-tip-corners.gif" hash="364474276178c7b48b6270056b42b808"/><file name="exclamation.gif" hash="37dbe02e3cbde0f6780650bfd8535e38"/><file name="radio.gif" hash="0239bdaef529be68530b86266a24742c"/><file name="search-trigger.gif" hash="559ef372cf27a38678d84e8c0b7237fc"/><file name="spinner-small.gif" hash="122ab763adfc5f379def95269889a876"/><file name="spinner.gif" hash="eee2bdd07a8136d2eff635b721838b4c"/><file name="text-bg.gif" hash="d5ba54c1f417e6a72cbce8b909078727"/><file name="trigger-square.gif" hash="c1cbaecc91209f77e2d20235c137e13e"/><file name="trigger-tpl.gif" hash="d7be20f0dc38f4f46cd318fe32cf3ce3"/><file name="trigger.gif" hash="447d5b600f7527f5c8cc49e7453bbb27"/></dir><dir name="grid"><file name="arrow-left-white.gif" hash="b04e859bdcbd21ad1f06b8bfa7881df8"/><file name="arrow-right-white.gif" hash="714eb00f8134dde3a65c83f3f71ad2c4"/><file name="cell-special-bg.gif" hash="60b05fd8cd98b6109112775a4cf2ad0e"/><file name="cell-special-bg.png" hash="a6487b6bd88ce1a726d41140595235be"/><file name="cell-special-selected-bg.gif" hash="2d4830861beacb8945d22b3bb79ad9c2"/><file name="cell-special-selected-bg.png" hash="df8d68826afb17ab5ed333565f531fdf"/><file name="checked.gif" hash="cb7b3408df56f5585aaa1242cd2f0b45"/><file name="col-move-bottom.gif" hash="9c38bcb5cee1dc9b4ce64ad9ab1386f8"/><file name="col-move-top.gif" hash="c4584202d5172464050f675d396d1c6f"/><file name="column-header-bg.gif" hash="1c0619ef4faf05d33d53e46f164664d0"/><file name="column-header-bg.png" hash="2c8e36b59e78fe93fcc13360bebd7f7f"/><file name="column-header-over-bg.gif" hash="8af4b32e4a033f3ac980277efee1d0b2"/><file name="column-header-over-bg.png" hash="25da418192d7f8bb7fbacc3baf6731fb"/><file name="columns.gif" hash="ef35242fa6514a81d17d5f700f561b7c"/><file name="dd-insert-arrow-left.gif" hash="fee4ee1bfc31c909a83713656497c8b2"/><file name="dd-insert-arrow-left.png" hash="5050c8e897cec907d6319f397a66c474"/><file name="dd-insert-arrow-right.gif" hash="b03355f58b96d167f0770b14358e5d88"/><file name="dd-insert-arrow-right.png" hash="46faba03ba3a35d750b5b758cc3d5d2c"/><file name="dirty.gif" hash="decca3b96e2c37cf6eb04ddb0d9f669b"/><file name="done.gif" hash="365266930a93451414fe51ffc524a196"/><file name="drop-no.gif" hash="b53ca86d60fbcc7a45c8917299218bfd"/><file name="drop-yes.gif" hash="af96f4c3b32a470db2f38abb521b5c97"/><file name="footer-bg.gif" hash="65ed63e44c6149f1127ad3b4be4e0108"/><file name="grid-blue-hd.gif" hash="dd35d5c1202c440c2d1a945b335984d3"/><file name="grid-blue-split.gif" hash="0494ba49974ff2bc1bf81e1d82dfee18"/><file name="grid-hrow.gif" hash="55972a5063d80f35fb6b95a79bb0018a"/><file name="grid-loading.gif" hash="9ac6f737eb9b15272f12b00bfeb3c3c6"/><file name="grid-split.gif" hash="3ef419d4b9421d8e94f673a6238dc4c0"/><file name="grid-vista-hd.gif" hash="675f403e8a9cb5ab4bed725da9fe2023"/><file name="grid3-hd-btn.gif" hash="e3e77072c16a6b27556236961f29c552"/><file name="grid3-hrow-over.gif" hash="a92d8f6c106943995720f2884634670e"/><file name="grid3-hrow.gif" hash="3e4484ea8db10af1320808c8477346ea"/><file name="grid3-rowheader.gif" hash="b4491705564909da7f9eaf749dbbfbb1"/><file name="group-by.gif" hash="3ff8c5936e358cf213227509c9bee95a"/><file name="group-collapse.gif" hash="fd6a72ffa784170d83f9f13322266ca8"/><file name="group-expand-sprite.gif" hash="d0f614a387292177f3acb0c95a4cd760"/><file name="group-expand.gif" hash="8a9ad3ed3d74c2911b7f101268a1843b"/><file name="hd-pop.gif" hash="e5f27a2f68cc2d13b11cf41c46d298dc"/><file name="hmenu-asc.gif" hash="048e0bc30f7c39d473dad5dabcbe03f2"/><file name="hmenu-desc.gif" hash="f0a987b34b003b25a7c82624d41f018a"/><file name="hmenu-lock.gif" hash="bcef18e25342c69c37c44dab87086065"/><file name="hmenu-lock.png" hash="2a3b0b441834f443c1086930939efdae"/><file name="hmenu-unlock.gif" hash="8cc8205dafa587ef02d8a86903ae8074"/><file name="hmenu-unlock.png" hash="c1f61df70b98c5498ea81e7e7b9effbb"/><file name="invalid_line.gif" hash="04a88e97b56e8a8ece4a66d49cc78828"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="mso-hd.gif" hash="37fba9c02f0eefe57f655890eef1c4a1"/><file name="nowait.gif" hash="23c91166dbb16ba8655363321bf5a400"/><file name="page-first-disabled.gif" hash="8d3185028c541cbcce67b5909c04824e"/><file name="page-first.gif" hash="16ec00fa770d860b768cf5034ddfca96"/><file name="page-last-disabled.gif" hash="1d123237ceeb5109a1b9274f0cf19d73"/><file name="page-last.gif" hash="ef524dd0b8dfe4eefecffaa1c0bb8edd"/><file name="page-next-disabled.gif" hash="0f4b8681772c91921fa93ede9c755ea0"/><file name="page-next.gif" hash="f6f9d2209dfc99912ffc9848d97646db"/><file name="page-prev-disabled.gif" hash="eefcbed15c8d37a89618b08f7b224297"/><file name="page-prev.gif" hash="80daad880483eed682b22ec70514ecc4"/><file name="pick-button.gif" hash="b431fdf306f1e2f033d0a431996de93f"/><file name="property-cell-bg.gif" hash="1b65e348d6db0c7b6c9aa5478c15a052"/><file name="property-cell-selected-bg.gif" hash="a94039f89dec164896ceff1fbdf6dbc5"/><file name="refresh-disabled.gif" hash="105c62973ba69710bc2b41b443af5198"/><file name="refresh.gif" hash="f1a2e7df30394c5a30bc76c2d09013b7"/><file name="row-check-sprite.gif" hash="2d0aa7e501c3e6f97a97faf75e35d3c3"/><file name="row-expand-sprite.gif" hash="be81199d9d4fa69bef47a8f036a5a7d8"/><file name="row-over.gif" hash="f639094bd0560aefabc86e51a825f23d"/><file name="row-sel.gif" hash="ca87d6b950386edd5e17c985769d9101"/><file name="sort-hd.gif" hash="2640addef6e987b4c5dfa4c8c2dfb10c"/><file name="sort_asc.gif" hash="2352874b5f636ca331fe9509a2f9bdd7"/><file name="sort_desc.gif" hash="d104fcf119d40c51554ddb8b377142e5"/><file name="unchecked.gif" hash="31846118bddc7945b595ea2090589cf1"/><file name="wait.gif" hash="b0cd5a5dc070c705ebf8814a909802c3"/></dir><dir name="layout"><file name="mini-bottom.gif" hash="ae8e3674fd32997dc5217d5d6199a5a5"/><file name="mini-left.gif" hash="8654fdb45ecf4406af2fce1d3beb7596"/><file name="mini-right.gif" hash="cbdf9fb0c45466b4217ac9f7bd6a9ed4"/><file name="mini-top.gif" hash="fbd91e98576f66fd2702495251b15240"/></dir><dir name="menu"><file name="checked.gif" hash="cb7b3408df56f5585aaa1242cd2f0b45"/><file name="group-checked.gif" hash="f7973443d91e5e074013f1b07ee79479"/><file name="item-over.gif" hash="29055ede2ff0584d0374a2ff5a987382"/><file name="menu-item-active-bg.gif" hash="5956b7cac9aabf4c670c2997bba12d47"/><file name="menu-item-active-corners.gif" hash="9a073e133a65c4e1b3bd4098ca72552a"/><file name="menu-item-active-sides.gif" hash="cf1981c1027a8c962a9d8c0f6d61c098"/><file name="menu-parent.gif" hash="d303ad7e3ced891736e80f77e1d4e51d"/><file name="menu.gif" hash="ae128d5f3f3a39213f3d4e23aec8728f"/><file name="unchecked.gif" hash="31846118bddc7945b595ea2090589cf1"/></dir><dir name="progress"><file name="progress-default-bg.gif" hash="b170dfad9f747e1aca54e47c4415c2d3"/></dir><dir name="shared"><file name="blue-loading.gif" hash="dc2fd7c0ed853c56b4ac65710af3bd0a"/><file name="calendar.gif" hash="81296cff1f97f5365524f2b9dcf626da"/><file name="glass-bg.gif" hash="bc2cd5c5ac9b3874d956c892d23f2119"/><file name="hd-sprite.gif" hash="6a54ae98bef53397d52282201852c204"/><file name="icon-error.gif" hash="f477b54b6b8361362e96c2218dce7ea0"/><file name="icon-info.gif" hash="ec6b7a5d4caeea767c8674689bae47c6"/><file name="icon-question.gif" hash="2713644a8aa582728d71e35eca62fbcd"/><file name="icon-warning.gif" hash="3f20258272af0e00f6b7531b3b9aee35"/><file name="large-loading.gif" hash="d96f6517e00399c37a9765e045eaaf22"/><file name="left-btn.gif" hash="6bf30c6cf0b5d70436c3e463b5532b35"/><file name="loading-balls.gif" hash="ac062b94ed674aaa50a6c18df92acdf3"/><file name="right-btn.gif" hash="e7ad3a7f4814791cecf1b90e77e9e139"/><file name="shadow-c.png" hash="7ab6163237099f2529452b88953a4049"/><file name="shadow-lr.png" hash="986270d8ab4330fa7499dc33ed135598"/><file name="shadow.png" hash="860bf4f690d2ea2aba7b11500925da62"/><file name="warning.gif" hash="448dc934a7f0dd6092b51f88a1e47b2d"/></dir><dir name="sizer"><file name="e-handle-dark.gif" hash="b86289f41d7ad1a7401dd2b2a9b3c3d8"/><file name="e-handle.gif" hash="510edc95ebaa36306916c50ca10596f7"/><file name="ne-handle-dark.gif" hash="115f71b851c7f0b5f354caa7b8dfff15"/><file name="ne-handle.gif" hash="8e268b962dc909d275997b572ff17a72"/><file name="nw-handle-dark.gif" hash="4a361e6920b2e34a39fd425a515c83b9"/><file name="nw-handle.gif" hash="1120600505249c38c3d1cc2ab120cd13"/><file name="s-handle-dark.gif" hash="4a6bf15d308a4ae580dd03cbd431a95c"/><file name="s-handle.gif" hash="5e3338cb09e9df7f52383d6b1423fc86"/><file name="se-handle-dark.gif" hash="f3d8d8aac23e3e9633072e2366cda847"/><file name="se-handle.gif" hash="71edc3f63f79f447d2c81ee09e1fbbc3"/><file name="square.gif" hash="4431ea1954bfd2a9cea0931f07fc7ffa"/><file name="sw-handle-dark.gif" hash="44b2400d873cf8a23d84424827cde44d"/><file name="sw-handle.gif" hash="c3e0befc4208a51180344765fd7deeda"/></dir><dir name="slider"><file name="slider-bg.gif" hash="a6286f74e6de7414663483aa08305a2f"/><file name="slider-bg.png" hash="1fbffa04044bed9262836d2a710f9ee1"/><file name="slider-thumb.gif" hash="e8b6ac40fa2709692ed0d806ef90b0c3"/><file name="slider-thumb.png" hash="24a893c9606f3a6892eb62f29a08870c"/><file name="slider-v-bg.gif" hash="9d8e5f0a4afa0e2256b999c856ba1a9e"/><file name="slider-v-bg.png" hash="0682c28925a7296730f7f221e4a76b96"/><file name="slider-v-thumb.gif" hash="c871f735637e1c383862aacecabb554a"/><file name="slider-v-thumb.png" hash="2fc3430dc351d9a118e048b9aafb7c3c"/></dir><dir name="tab-bar"><file name="scroll-left.gif" hash="611cea625f98ee5c0204dc186da8a05e"/><file name="scroll-right.gif" hash="b31b5bb81129aa52755f7f0becedc624"/><file name="tab-bar-default-bg.gif" hash="d8e4c911af8cf8660fd598b0a004fbb4"/></dir><dir name="tip"><file name="tip-corners.gif" hash="679a8fd0e2d9aa18fedc2f2b4f6001bc"/><file name="tip-sides.gif" hash="f9f434277b451d60474db8756a506736"/></dir><dir name="toolbar"><file name="more.gif" hash="15c7a30d4131305b672fe1e76d962d4d"/><file name="scroll-left.gif" hash="90ed293465f6f6bbb6104e9285f60392"/><file name="scroll-right.gif" hash="086497e95d820d7c58a1be2293e6e4a6"/><file name="toolbar-default-bg.gif" hash="61b9dcfa93a445a8a7dbbfde6efd5ecf"/></dir><dir name="tools"><file name="tool-sprite-tpl.gif" hash="e0449768cd5dce80b18fac904818ab33"/><file name="tool-sprites.gif" hash="75106d9a5ffab255a5bb3792a2a16e16"/><file name="tools-sprites-trans.gif" hash="8331513f15bd26be38974a7d7fc4ee41"/></dir><dir name="tree"><file name="arrows.gif" hash="bd4ecad4870c5b23926742ddd1298584"/><file name="drop-above.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-append.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-below.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-between.gif" hash="edb544a0de58547d4a39c526e06e3c82"/><file name="drop-no.gif" hash="67f83ea04a2eb1c50614a96faf625f25"/><file name="drop-over.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-under.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/><file name="elbow-end-minus-nl.gif" hash="04025031365f2bdb09169188eae9556b"/><file name="elbow-end-minus.gif" hash="b4ae35ce75b5bbe728fdeeb5ed89ac42"/><file name="elbow-end-plus-nl.gif" hash="d6343055539d3ae503329e65d0927c0d"/><file name="elbow-end-plus.gif" hash="46f4d75f43fff6fcd4b0b9aeda907e9c"/><file name="elbow-end.gif" hash="6748722c117147e321d0af952833109e"/><file name="elbow-line.gif" hash="765c70e58be8064da7ce8c01afb1f6c3"/><file name="elbow-minus-nl.gif" hash="04025031365f2bdb09169188eae9556b"/><file name="elbow-minus.gif" hash="01359f5b57c066f952c1d5a02f21a457"/><file name="elbow-plus-nl.gif" hash="d6343055539d3ae503329e65d0927c0d"/><file name="elbow-plus.gif" hash="e4385b53e7f15b43b74e9c3b46cfee77"/><file name="elbow.gif" hash="53321708a4948539bb8b4c8efeae39c7"/><file name="folder-open.gif" hash="2bf2623696392abc9b2853b59aab3bb5"/><file name="folder.gif" hash="d15144420ee39843bb27feb014ee4442"/><file name="leaf.gif" hash="23757d6e353f343e3c7edfe28428f198"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/></dir><dir name="util"><dir name="splitter"><file name="mini-bottom.gif" hash="ae8e3674fd32997dc5217d5d6199a5a5"/><file name="mini-left.gif" hash="8654fdb45ecf4406af2fce1d3beb7596"/><file name="mini-right.gif" hash="cbdf9fb0c45466b4217ac9f7bd6a9ed4"/><file name="mini-top.gif" hash="fbd91e98576f66fd2702495251b15240"/></dir></dir></dir></dir><file name="dnd_grid_to_grid.js" hash="057a8cbf8b255c1955c83ca249bd9ae8"/><file name="examples.js" hash="c34c39a3da1b2216f636778b26e10108"/><file name="ext-all.js" hash="33c8a2191d27ee2812d9e5469f094556"/></dir><dir name="jquery"><file name="jquery.min.js" hash="4c8cfcfcda2e9d34ba0097086a7bc328"/></dir><dir name="resources"><dir name="css"><file name="README.txt" hash="66440774774ca4995ad5137ac9ae48e0"/><file name="basic-dialog.css" hash="4cc973c87f79ea230f372cea597963ba"/><file name="box.css" hash="3809db7ee254d629d52dba0aad472d35"/><file name="button.css" hash="d3f29c8497579832fe5d7aafff7c3544"/><file name="combo.css" hash="483a1a701ca9c7db718e0e767f3d4585"/><file name="core.css" hash="6e82710d5206b6b7c0f70399cf649449"/><file name="date-picker.css" hash="fa68b668561d477e702318fb5d59636c"/><file name="dd.css" hash="f0e5f55969aeda8f65a01033613181c5"/><file name="debug.css" hash="6ef466c0c857e0c405cac7b8911f0824"/><file name="editor.css" hash="2fdb75e85a247c362285d4f079c0a12f"/><file name="ext-all.css" hash="c5e12af950c3ea3a243d0b9ca0dc4dba"/><file name="form.css" hash="38bd5bd602a83075325696af2c447e65"/><file name="grid.css" hash="c6d110f89542c04e4cbf98de73e97e9b"/><file name="layout.css" hash="89251906d248b3756f0ed354491651a6"/><file name="menu.css" hash="88eb8b3754612496ccf9d386694a39e0"/><file name="panel.css" hash="deaf7ccb5526687fadd67c093da9e604"/><file name="qtips.css" hash="2a6e683a7b23cbdf52177d7141d17435"/><file name="reset-min.css" hash="8fddbb1b7930f2817f2d5d215be98d5f"/><file name="resizable.css" hash="a50b8d1ea8e9dfbdd101a43bc63857c3"/><file name="tabs.css" hash="323d6f11f1550a43a02a617e39242ed5"/><file name="toolbar.css" hash="d09eb7507f57178967d217caeaa8b046"/><file name="tree.css" hash="b0104f954fbe1f04ebf49acffcec74ef"/><file name="ytheme-aero.css" hash="c25b48ba1b913f2ea094065fa916e9da"/><file name="ytheme-galdaka.css" hash="8b1917749205e64bdbcecc893e188b09"/><file name="ytheme-gray.css" hash="c45ba874b89038c9c8d9a79a1c591f26"/><file name="ytheme-magento.css" hash="94c3fc72743ad6d1fe7d8e74d713750e"/><file name="ytheme-vista.css" hash="2092ef97154cf5f6b33893bf5e178e21"/></dir><dir name="themes"><dir name="images"><dir name="default"><dir name="basic-dialog"><file name="btn-arrow.gif" hash="9e2365ef98c6096f6b5f411ab618bb4e"/><file name="btn-sprite.gif" hash="73a8327c23c12ed9ec42ac8f52b072e0"/><file name="close.gif" hash="2d54069e9355f295dd27027f7f779eb9"/><file name="collapse.gif" hash="63b2687a2dc81537765a7d22f9e480da"/><file name="e-handle.gif" hash="f9357e6c1dfbd00da007cf6705e08225"/><file name="expand.gif" hash="740af52fb7de6ca9fd888184e86a5308"/><file name="hd-sprite.gif" hash="6a54ae98bef53397d52282201852c204"/><file name="progress.gif" hash="baff9a083b93588fa7ff3548844a9e1a"/><file name="progress2.gif" hash="339036f9eb530c1b180c77f9a109ef3e"/><file name="s-handle.gif" hash="36b90844c0b35da23da21aac599957d4"/><file name="se-handle.gif" hash="668b22581100befcf947e806599dc0ce"/></dir><dir name="box"><file name="corners-blue.gif" hash="86fd4c5664e0971bfc11959e8442604c"/><file name="corners.gif" hash="d2d1bc2085b369ce35ffd20c0121676e"/><file name="l-blue.gif" hash="ced9ffbf66ea39e77083a591f8257267"/><file name="l.gif" hash="c4d9dbbdc59ae06b5e9e72a6a865c981"/><file name="r-blue.gif" hash="82dbb522a80e3246f6297719371a9494"/><file name="r.gif" hash="bf1e1d4a45f951ae656968a8c834f04a"/><file name="tb-blue.gif" hash="7c4b19eb682afdc1bde0640d2321fb25"/><file name="tb.gif" hash="dd3f63afe7ba90983ba73dad1c66bf2f"/></dir><dir name="dd"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-no.gif" hash="ae536c37391ba78143b5c8283cec8d13"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/></dir><dir name="editor"><file name="tb-sprite.gif" hash="8908365d736426795ce46de7e328b508"/></dir><dir name="form"><file name="clear-trigger.gif" hash="97b3e5e9edf27b50d63d48098c2f1eae"/><file name="date-trigger.gif" hash="9245675ed8931df277184b419cf4cdad"/><file name="error-tip-corners.gif" hash="364474276178c7b48b6270056b42b808"/><file name="exclamation.gif" hash="40491021e901fa801dbbc09b6c59d73e"/><file name="search-trigger.gif" hash="559ef372cf27a38678d84e8c0b7237fc"/><file name="text-bg.gif" hash="d5ba54c1f417e6a72cbce8b909078727"/><file name="trigger-tpl.gif" hash="d7be20f0dc38f4f46cd318fe32cf3ce3"/><file name="trigger.gif" hash="45019efdf75528242c5a68742821dc57"/></dir><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><dir name="grid"><file name="Thumbs.db" hash="c3affff39ba36b80da43a08c34a61391"/><file name="arrow-left-white.gif" hash="b04e859bdcbd21ad1f06b8bfa7881df8"/><file name="arrow-right-white.gif" hash="714eb00f8134dde3a65c83f3f71ad2c4"/><file name="col-move-bottom.gif" hash="9c38bcb5cee1dc9b4ce64ad9ab1386f8"/><file name="col-move-top.gif" hash="c4584202d5172464050f675d396d1c6f"/><file name="dirty.gif" hash="decca3b96e2c37cf6eb04ddb0d9f669b"/><file name="done.gif" hash="365266930a93451414fe51ffc524a196"/><file name="drop-no.gif" hash="b53ca86d60fbcc7a45c8917299218bfd"/><file name="drop-yes.gif" hash="af96f4c3b32a470db2f38abb521b5c97"/><file name="footer-bg.gif" hash="65ed63e44c6149f1127ad3b4be4e0108"/><file name="grid-blue-hd.gif" hash="dd35d5c1202c440c2d1a945b335984d3"/><file name="grid-blue-split.gif" hash="0494ba49974ff2bc1bf81e1d82dfee18"/><file name="grid-hrow.gif" hash="55972a5063d80f35fb6b95a79bb0018a"/><file name="grid-loading.gif" hash="9ac6f737eb9b15272f12b00bfeb3c3c6"/><file name="grid-split.gif" hash="3ef419d4b9421d8e94f673a6238dc4c0"/><file name="grid-vista-hd.gif" hash="675f403e8a9cb5ab4bed725da9fe2023"/><file name="grid3-hd-btn.gif" hash="e3e77072c16a6b27556236961f29c552"/><file name="grid3-hrow-over.gif" hash="a92d8f6c106943995720f2884634670e"/><file name="grid3-hrow.gif" hash="4c58074bb961c8f184522355f1b0eb90"/><file name="grid3-special-col-bg.gif" hash="c9df03a1c107360128da89fa47066405"/><file name="grid3-special-col-sel-bg.gif" hash="a94039f89dec164896ceff1fbdf6dbc5"/><file name="hd-pop.gif" hash="e5f27a2f68cc2d13b11cf41c46d298dc"/><file name="hmenu-asc.gif" hash="048e0bc30f7c39d473dad5dabcbe03f2"/><file name="hmenu-desc.gif" hash="f0a987b34b003b25a7c82624d41f018a"/><file name="hmenu-lock.gif" hash="bcef18e25342c69c37c44dab87086065"/><file name="hmenu-lock.png" hash="2a3b0b441834f443c1086930939efdae"/><file name="hmenu-unlock.gif" hash="8cc8205dafa587ef02d8a86903ae8074"/><file name="hmenu-unlock.png" hash="c1f61df70b98c5498ea81e7e7b9effbb"/><file name="invalid_line.gif" hash="04a88e97b56e8a8ece4a66d49cc78828"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="mso-hd.gif" hash="37fba9c02f0eefe57f655890eef1c4a1"/><file name="nowait.gif" hash="23c91166dbb16ba8655363321bf5a400"/><file name="page-first-disabled.gif" hash="8d3185028c541cbcce67b5909c04824e"/><file name="page-first.gif" hash="16ec00fa770d860b768cf5034ddfca96"/><file name="page-last-disabled.gif" hash="1d123237ceeb5109a1b9274f0cf19d73"/><file name="page-last.gif" hash="ef524dd0b8dfe4eefecffaa1c0bb8edd"/><file name="page-next-disabled.gif" hash="0f4b8681772c91921fa93ede9c755ea0"/><file name="page-next.gif" hash="f6f9d2209dfc99912ffc9848d97646db"/><file name="page-prev-disabled.gif" hash="eefcbed15c8d37a89618b08f7b224297"/><file name="page-prev.gif" hash="80daad880483eed682b22ec70514ecc4"/><file name="pick-button.gif" hash="b431fdf306f1e2f033d0a431996de93f"/><file name="refresh.gif" hash="8dae08d3581dcd9a04ca73877eab4b53"/><file name="row-check-sprite.gif" hash="2d0aa7e501c3e6f97a97faf75e35d3c3"/><file name="row-expand-sprite.gif" hash="be81199d9d4fa69bef47a8f036a5a7d8"/><file name="row-over.gif" hash="f639094bd0560aefabc86e51a825f23d"/><file name="row-sel.gif" hash="ca87d6b950386edd5e17c985769d9101"/><file name="sort_asc.gif" hash="cc186187e31b0c39abbb7d2394916292"/><file name="sort_desc.gif" hash="fcfe91243fac2e5f24d05bb44f78ded4"/><file name="wait.gif" hash="b0cd5a5dc070c705ebf8814a909802c3"/></dir><dir name="layout"><file name="collapse.gif" hash="dfcec0803d488a783916c750fd83a897"/><file name="expand.gif" hash="c9c9b0ea5311c3dc016c69dc234912bc"/><file name="gradient-bg.gif" hash="e117fca9d088e4cd5bbbcec7b99a8408"/><file name="ns-collapse.gif" hash="efa9fbd7a1f3f0f1f22360391e16126f"/><file name="ns-expand.gif" hash="da1f9d40c091d3b6dc7a8dee4fc02ac6"/><file name="panel-close.gif" hash="b185da1837344529bfb684a96d8371b5"/><file name="panel-title-bg.gif" hash="b66384c309a397963389a76b07e9ecd4"/><file name="panel-title-light-bg.gif" hash="688d3a263442db125da170e5d3aebf70"/><file name="stick.gif" hash="be9e67ae0b61b01cfd15928ca7a3da51"/><file name="stuck.gif" hash="745e0cacb51250ea0216efc4a1cb50cb"/><file name="tab-close-on.gif" hash="0ae2c978e85391a69f0dce8da18d8b23"/><file name="tab-close.gif" hash="f92107cc6b4cb78af084648a628e01d2"/></dir><dir name="menu"><file name="checked.gif" hash="692bc97badf50c05495f6109143b4b11"/><file name="group-checked.gif" hash="f7973443d91e5e074013f1b07ee79479"/><file name="menu-parent.gif" hash="d303ad7e3ced891736e80f77e1d4e51d"/><file name="menu.gif" hash="5d34732294bbe06a862961dd02bcc962"/><file name="unchecked.gif" hash="9b90ed7c9e8f0892ce09f3b35b19db53"/></dir><dir name="panel"><file name="corners-sprite.gif" hash="06daef2335218cdfd900ce8bf7a68738"/><file name="left-right.gif" hash="49344fefef7c6f866f910b9067f0990f"/><file name="tool-sprite-tpl.gif" hash="e0449768cd5dce80b18fac904818ab33"/><file name="tool-sprites.gif" hash="31ccd74ac8dab4b5669887310a2341df"/><file name="top-bottom.gif" hash="d9a86e8466a31bd1cb87aae2cf55faf2"/><file name="white-corners-sprite.gif" hash="de8b3036676d19b9635f319a8a4aad36"/><file name="white-left-right.gif" hash="77a6389c6737ad507ca5330ad8816524"/><file name="white-top-bottom.gif" hash="f865d7237bff3c45fd4a8c448f97d236"/></dir><dir name="qtip"><file name="bg.gif" hash="49c0a530cc16357bb39d51c13065a88f"/><file name="close.gif" hash="0379d036250096cae2e42b427b3df2e7"/><file name="tip-sprite.gif" hash="11637a20b1f3f2331bf0627146c2f433"/></dir><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/><file name="shadow-c.png" hash="3abbfce345687daada53445adf6fddc7"/><file name="shadow-lr.png" hash="986270d8ab4330fa7499dc33ed135598"/><file name="shadow.png" hash="860bf4f690d2ea2aba7b11500925da62"/><dir name="shared"><file name="calendar.gif" hash="81296cff1f97f5365524f2b9dcf626da"/><file name="glass-bg.gif" hash="bc2cd5c5ac9b3874d956c892d23f2119"/><file name="left-btn.gif" hash="6bf30c6cf0b5d70436c3e463b5532b35"/><file name="right-btn.gif" hash="e7ad3a7f4814791cecf1b90e77e9e139"/><file name="warning.gif" hash="448dc934a7f0dd6092b51f88a1e47b2d"/></dir><dir name="sizer"><file name="e-handle-dark.gif" hash="b86289f41d7ad1a7401dd2b2a9b3c3d8"/><file name="e-handle.gif" hash="510edc95ebaa36306916c50ca10596f7"/><file name="ne-handle-dark.gif" hash="115f71b851c7f0b5f354caa7b8dfff15"/><file name="ne-handle.gif" hash="8e268b962dc909d275997b572ff17a72"/><file name="nw-handle-dark.gif" hash="4a361e6920b2e34a39fd425a515c83b9"/><file name="nw-handle.gif" hash="1120600505249c38c3d1cc2ab120cd13"/><file name="s-handle-dark.gif" hash="4a6bf15d308a4ae580dd03cbd431a95c"/><file name="s-handle.gif" hash="5e3338cb09e9df7f52383d6b1423fc86"/><file name="se-handle-dark.gif" hash="f3d8d8aac23e3e9633072e2366cda847"/><file name="se-handle.gif" hash="71edc3f63f79f447d2c81ee09e1fbbc3"/><file name="square.gif" hash="4431ea1954bfd2a9cea0931f07fc7ffa"/><file name="sw-handle-dark.gif" hash="44b2400d873cf8a23d84424827cde44d"/><file name="sw-handle.gif" hash="c3e0befc4208a51180344765fd7deeda"/></dir><dir name="tabs"><file name="tab-btm-inactive-left-bg.gif" hash="4f141a6abf25d3c9409b6c381333c138"/><file name="tab-btm-inactive-right-bg.gif" hash="eb2423d3b9dd072976ce955ab0c683d6"/><file name="tab-btm-left-bg.gif" hash="a36eb9382ed8b858eff2c5d4e5d7011a"/><file name="tab-btm-right-bg.gif" hash="9e4245776f0f7b6b6c7ddbf40a43103a"/><file name="tab-sprite.gif" hash="6a7d481bf5b74acfbfa0b01a35bd6620"/></dir><dir name="toolbar"><file name="btn-arrow-light.gif" hash="fa49b39a0fd88ef26264da44a2b4edea"/><file name="btn-arrow.gif" hash="12bda29a4c8016cfa047e852c4353f59"/><file name="btn-over-bg.gif" hash="faddf9b24cefa721326ba3f87f3ef31f"/><file name="gray-bg.gif" hash="cf2d9408f320e696e607d8472afa7ff0"/><file name="tb-bg.gif" hash="5309337fd7a22cab9d9467fd9eaa0a0c"/><file name="tb-btn-sprite.gif" hash="3aed28dd646d22e215c8a6a3e983322f"/></dir><dir name="tree"><file name="drop-add.gif" hash="95eb34ac70a1a3c95ef39ab826a89491"/><file name="drop-between.gif" hash="edb544a0de58547d4a39c526e06e3c82"/><file name="drop-no.gif" hash="67f83ea04a2eb1c50614a96faf625f25"/><file name="drop-over.gif" hash="d6b303cfa3de8784057d9d7e66cdaa86"/><file name="drop-under.gif" hash="55e5dbc9451cfa91423832260b0753aa"/><file name="drop-yes.gif" hash="f3216326c00890259e84f1726dd1043f"/><file name="elbow-end-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-end-minus.gif" hash="a469f6a4394d797c2efeffc70409f6db"/><file name="elbow-end-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-end-plus.gif" hash="ec1482391363612d9e5f8c7087fddaba"/><file name="elbow-end.gif" hash="345551384aa325189ba28a1c20f3405e"/><file name="elbow-line.gif" hash="90e478158df476dc989a60daaafc87e6"/><file name="elbow-minus-nl.gif" hash="5e5bffba157eceee7989db95b919e4d5"/><file name="elbow-minus.gif" hash="71bb1bd44b1274c60d30dba1de472ed7"/><file name="elbow-plus-nl.gif" hash="f0f50c0dd3ee6dd4b11c1f245b36eb01"/><file name="elbow-plus.gif" hash="945572d06a74b5f952251a86c595f2da"/><file name="elbow.gif" hash="27679f3b1222ba95d9925885d7d82d02"/><file name="folder-open.gif" hash="c569141d6ae7c61d838ed8af26aa9380"/><file name="folder.gif" hash="b7209740bb4a825a06beb8698d92c2b1"/><file name="leaf.gif" hash="23757d6e353f343e3c7edfe28428f198"/><file name="loading.gif" hash="00ef871b291bc03a497d608a5bd8ec99"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/></dir><dir name="window"><file name="corners-sprite.gif" hash="b485d6e69678822a0fb77cc312487874"/><file name="left-right.gif" hash="3fe626d6ca2f71d36fc62c32cb1cc52a"/><file name="top-bottom.gif" hash="8a227016c401438e602c2f770a611d5b"/></dir></dir><dir name="magento"><dir name="basic-dialog"><file name="collapse-on.gif" hash="b60dfdc0d00cfb30a8a622e0c22eed84"/><file name="collapse.gif" hash="8525b9d2e93d31e0b071b1f9bf9550e5"/><file name="expand-on.gif" hash="0dfb4ac6d626cdcaa931c14dbb45848e"/><file name="expand.gif" hash="0eb5c03da8b8415e0568784c959e536a"/><file name="hd-sprite.gif" hash="035bf2296afd70af7020cf06b60bf3f6"/><file name="ns-collapse-on.gif" hash="88ed8b7578c803f68d9f1eb171454e00"/><file name="ns-collapse.gif" hash="44b91376c040f91672aaa98c1fcc062b"/><file name="ns-expand-on.gif" hash="587c2ce90066280e5e6cd731bb9d346c"/><file name="ns-expand.gif" hash="57b479b168f8a54200bd1770b5591630"/><file name="panel_close.gif" hash="686c6dfcf341de25487ab4d8ea5954ce"/><file name="pop_close.gif" hash="dd3605531f9959901eff6f089f084bdc"/><file name="pop_collapse.gif" hash="2b8007242ae1c9ae9f26c60a878a63f7"/></dir><dir name="grid"><file name="grid-body-bg.gif" hash="b5fe585c01f57b2171a2b723abcc4a38"/><file name="grid-split.gif" hash="32e210451e8dc4295b53cf7ca13bb4a6"/></dir><dir name="layout"><file name="checkered-bg.gif" hash="f0a0cd29a6120377c289fd39e2ee7e80"/><file name="icon-catalog.gif" hash="435ff2300ddefb9f8a4bad8ee806fb1a"/><file name="icon-category.gif" hash="ce2a146851bb5ec1e41670b68183b56a"/><file name="icon-my-tasks.gif" hash="0ecb888b160701845e25a7140d038af0"/><file name="icon-product.gif" hash="a0707878c5221052209e5ae6a4de0bd2"/></dir><file name="loading_bg.gif" hash="e202ef7e03d0ef3e9beac7480dae65bf"/><dir name="tabs"><file name="tab-sprite.gif" hash="049fb2f4186b6dc9de747ad96456b1ab"/></dir><dir name="toolbar"><file name="btn-arrow.gif" hash="938cffb6de5cc8b1febfd1851fd983c2"/><file name="header_bg.gif" hash="3696842a32740fa159484cabc3340d13"/><file name="toolbar-bg.gif" hash="8d1b465c2a75963407b536d9081f649f"/></dir><dir name="tree"><file name="elbow-end-minus-nl.gif" hash="6dc08c43109cc6a365bd0270f05e2f1c"/><file name="elbow-end-minus.gif" hash="3dbdb88a9297fe5631e832f046b0350b"/><file name="elbow-end-plus-nl.gif" hash="6dc08c43109cc6a365bd0270f05e2f1c"/><file name="elbow-end-plus.gif" hash="5470e5712a9742ba666c26cb429baaeb"/><file name="elbow-end.gif" hash="63fe879440e2784e0cc0d316ce017745"/><file name="elbow-line.gif" hash="b316a39455304e20e01dbc437f57fd32"/><file name="elbow-minus-nl.gif" hash="0e3129bff70475c8f7f297e0e59d1608"/><file name="elbow-minus.gif" hash="e7b18ff6800e65c6e171bbb2a911762e"/><file name="elbow-plus-nl.gif" hash="78a8f737941fa658f1e770258a3791cd"/><file name="elbow-plus.gif" hash="b02cb264df55aef2105b1b245d075e56"/><file name="elbow.gif" hash="b6bd0e0237e3cd413fa2dac27701c724"/><file name="folder-open.gif" hash="e3cd196406d4857dc0c926807f16c409"/><file name="folder.gif" hash="03eb26c42137ac792609822862ef4d0f"/><file name="leaf.gif" hash="e3cd196406d4857dc0c926807f16c409"/><file name="s.gif" hash="df3e567d6f16d040326c7a0ea29a4f41"/></dir></dir></dir></dir></dir></dir><file name="ranking.js" hash="bbdbf7077ae6ffeb65b5f0b50bb3204f"/><file name="vendorhistory.css" hash="1c6ac4db45e2f234749b8b71f285fe00"/></dir></dir><dir name="includes"><dir name="src"><dir name="Logicbroker"><dir name="Dropship360"><dir name="controllers"><dir name="Adminhtml"><dir name="Logicbroker"><file name="InventoryController.php" hash="961c77f6cc362a57302fdf524827698c"/><file name="LogicbrokerController.php" hash="d8fb861cf2d73adaa0589a05fa120307"/><file name="RankingController.php" hash="eef377b4c7310d7694dbfa3691a376a7"/><file name="ReportController.php" hash="51927a073fef936699037499ce9a1455"/><file name="SourcingController.php" hash="d156da62a0c1cc8644e04da759d7615e"/><file name="UploadController.php" hash="08ce7fbc961c94285d5b6f7efdc18aae"/></dir></dir></dir></dir></dir><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory.php" hash="99a5d1a58c1dc6ef2cc56ae9fc5b6481"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Addvendorfield.php" hash="af6a5039e07a8f610a50baaceec5465b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Lbvendor.php" hash="67d2d2b7e825f63bff4d343bc1cf8aa4"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Tab_Vendortabhistory.php" hash="69fbc5a2cd3fb1d010a613943f7a951c"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortab.php" hash="2d527ae0b61912525b0c59ccc9c5bb51"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Edit_Vendortabhistory.php" hash="5d4df7f9445759a7943c4dfead927d6d"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Inventory_Grid.php" hash="8b43f6e012cfb9f278d14ddd4fa762ff"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Logicbroker.php" hash="239a7cefa7386a8d3b40ad78422d1ae4"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Notification.php" hash="18d8754907908e0262c087d573f934a5"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Ranking.php" hash="42e39843931b6030840f8c3161ec84b6"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Ranking_Grid.php" hash="52407d6d50481bc32c391e3e09e2a7a1"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor.php" hash="750b5adec9792b9bdc593921b3e86a16"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Email.php" hash="b153871bad4a1599a2f9b4165c4287f2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Form.php" hash="33d12cac623619efaaac0325f19452b8"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Grid.php" hash="fd9a2f6af14688fdc19a72803e319ece"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Activitymonitor_Periodopen.php" hash="6297aefbe9fc2f7c9449e1b461afe075"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Form_Timestatus.php" hash="ef5b8206b1c0e71cd1d3ad6c31923a8a"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Reports_Staticemailgrid.php" hash="078130167406426bad0e577d1fc4b0ce"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sales_Order_View_Items.php" hash="acb46509068da360104a0c8cada453da"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Showhistory.php" hash="a82540104538beaa185238b4931fdb14"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing.php" hash="5dbf26e493b5ede38087c4c98b708083"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit.php" hash="767bcde378baf0ff1196598e0c466fc5"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Form.php" hash="e6b0312f4fc38b771089fbb1815578ef"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Tab_Form.php" hash="d0d9a417b1e59d06030ff7a65c6cbc88"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Edit_Tabs.php" hash="5298c26c63035ff916a986c8072c8d0b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Grid.php" hash="8c1ab115b99ea39900dccd60ee7ac651"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_Renderer_Action.php" hash="edea4e5929b246ff70d063aa5845b3f9"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View.php" hash="02be1363be1b4610bdee1dbc7cc2ba34"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View_Form.php" hash="9da38c9ec7e580f660155ec62d7e0eeb"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_History_View_Tabs.php" hash="94ffa503cf28c9fa63076f84c02b9cee"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Sourcing_Pomanagment.php" hash="dcc67bb9439abc2bb4ec86cc1b8fe720"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Crontime.php" hash="b81ffae42850e8171d357f911a0e11fc"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Fieldset_Hint.php" hash="72f6124a380765b0142ebecd9cbfb6cf"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Ftpconnectionbutton.php" hash="e8ee1b4007e476b4d11600b74eb034ea"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Helplink.php" hash="0d0427b473f8a343efa394c4a0853942"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Singuplink.php" hash="a6927e292ac86b35339a5029034b5ac2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Submitbutton.php" hash="7ce0fade94eede8db6ff04c0dbe50dac"/><file name="Logicbroker_Dropship360_Block_Adminhtml_System_Config_Time.php" hash="74a40038b4a50994296b0cb7fce2947f"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload.php" hash="6121221ac90f5b9e92c10ec8df4f4727"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Bulkassign.php" hash="bd462fdca45aec2dc8e762237ceefe1b"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Button.php" hash="7b98d1326c1f93bc643e1463242224a2"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Upload_Edit_Form.php" hash="263dba517dd240926fb9d04154d8c2ea"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Vendorproductuploadhistory.php" hash="165ad202a5ae993300ba6494989ada67"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Nameaction.php" hash="bd171423eec53f92fda759bf4d3624f1"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Orderaction.php" hash="842701da280c25c3c552b05d7c06413e"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Skuaction.php" hash="0c4477b7bdabcc81da134929b2926ef7"/><file name="Logicbroker_Dropship360_Block_Adminhtml_Widget_Grid_Column_Textaction.php" hash="9855312bb0dcac85104f7f0cd4a51054"/><file name="Logicbroker_Dropship360_Helper_Data.php" hash="5e719220290f4eb534d87f4ae39eb69d"/><file name="Logicbroker_Dropship360_Model_Api2_Createroleandrule.php" hash="71ece80df5c5c87e13075841a1f9f4e1"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory.php" hash="9d08c98e36b9c232b9d796a418aac383"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest.php" hash="b7e996ed201e1d1e0239d6d226ef1007"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Admin_V1.php" hash="a6a58df3d657dbe8b8f42da5e107a212"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Customer_V1.php" hash="c0327118b69995896f78acd7907fa71f"/><file name="Logicbroker_Dropship360_Model_Api2_Inventory_Rest_Guest_V1.php" hash="1c3f3a1a87ccd9bd1120138d8369229d"/><file name="Logicbroker_Dropship360_Model_Api2_Product.php" hash="5ced4e9d325db0cf6f748a13c8384298"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest.php" hash="f423598eb3ae1871d8b4a326f7dda181"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Admin_V1.php" hash="6f4acb240c2875694c9a710bfec844c4"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Customer_V1.php" hash="c0327118b69995896f78acd7907fa71f"/><file name="Logicbroker_Dropship360_Model_Api2_Product_Rest_Guest_V1.php" hash="0f4c46ad1ef2e6fefd1fdbda4034ad85"/><file name="Logicbroker_Dropship360_Model_Csvparser.php" hash="010e13e9015a36358c05758227738182"/><file name="Logicbroker_Dropship360_Model_Import.php" hash="b56a7ea12a97c46dcd0b53b20a8b3cd8"/><file name="Logicbroker_Dropship360_Model_Import_Base.php" hash="e4b244a10ac2ab1ae952d7d6cc4b9864"/><file name="Logicbroker_Dropship360_Model_Import_Ftp.php" hash="5f72205e2525a320abc308439efe8527"/><file name="Logicbroker_Dropship360_Model_Import_Ftpimport.php" hash="835c6e3a3878d8f6d742fe00314a5547"/><file name="Logicbroker_Dropship360_Model_Import_Manualimport.php" hash="be55148fbf4b5b368fe5b43610da9677"/><file name="Logicbroker_Dropship360_Model_Import_Productsetup.php" hash="1b6140bf65787e16faf791f909641d98"/><file name="Logicbroker_Dropship360_Model_Inventory.php" hash="65753e4c7be5a526b1d56c87de71dd84"/><file name="Logicbroker_Dropship360_Model_Inventorylog.php" hash="e3a0444251b18237f663aabf4c054d7a"/><file name="Logicbroker_Dropship360_Model_Logicbroker.php" hash="99124a4b0cf794f894e9725bf4d7589b"/><file name="Logicbroker_Dropship360_Model_Observer.php" hash="5a56365880d0537ad84965719242fc3a"/><file name="Logicbroker_Dropship360_Model_Order_Api.php" hash="4dc38ebb1e39a7b0a150c72e3ad7c19c"/><file name="Logicbroker_Dropship360_Model_Orderitems.php" hash="986c257f9bb3fc23266617f86db000f2"/><file name="Logicbroker_Dropship360_Model_Ordersourcing.php" hash="d7eaaad82897268eadbfb51383ca01f8"/><file name="Logicbroker_Dropship360_Model_Productimport.php" hash="d32d63662c3ce93d4559475c2d3fdd11"/><file name="Logicbroker_Dropship360_Model_Ranking.php" hash="10ebabf55aa45db3e9e03f0fc0754d6b"/><file name="Logicbroker_Dropship360_Model_Rankinglog.php" hash="094334cf66c9ce7304c87082570a496d"/><file name="Logicbroker_Dropship360_Model_Report.php" hash="ae7188a15da1892667de020648d6b4af"/><file name="Logicbroker_Dropship360_Model_Resource_Inventory.php" hash="105f54b381ac6cde7ba6e4ff01435083"/><file name="Logicbroker_Dropship360_Model_Resource_Inventory_Collection.php" hash="4a0707fc5d728c872a7df48a372e3411"/><file name="Logicbroker_Dropship360_Model_Resource_Inventorylog.php" hash="9821c43afd97cef8608b08c634456dd3"/><file name="Logicbroker_Dropship360_Model_Resource_Inventorylog_Collection.php" hash="1a24af879a980509fc049106dfa7ed17"/><file name="Logicbroker_Dropship360_Model_Resource_Orderitems.php" hash="f1b0d3a6c9efcdbe4ec182e5f2a452f2"/><file name="Logicbroker_Dropship360_Model_Resource_Orderitems_Collection.php" hash="09ca1baa286ba8dbe2d8636041afc183"/><file name="Logicbroker_Dropship360_Model_Resource_Ordersourcing.php" hash="6c9903c47b98b1032ed262578b15d5f2"/><file name="Logicbroker_Dropship360_Model_Resource_Ordersourcing_Collection.php" hash="a4341add3d2e4ed0d4fec5b5ead2b391"/><file name="Logicbroker_Dropship360_Model_Resource_Ranking.php" hash="e728c7db906f4257c9fa2828f3b1889c"/><file name="Logicbroker_Dropship360_Model_Resource_Ranking_Collection.php" hash="2c5f73589c3cf1cc61d82ff3184e9180"/><file name="Logicbroker_Dropship360_Model_Resource_Rankinglog.php" hash="280ca665631b7dfdc5fd65bdd37dd977"/><file name="Logicbroker_Dropship360_Model_Resource_Rankinglog_Collection.php" hash="847f4a313b4c57f1943667a743fb1876"/><file name="Logicbroker_Dropship360_Model_Resource_Setup.php" hash="db1b106449549a4d6a94e115b35f36d3"/><file name="Logicbroker_Dropship360_Model_Resource_Uploadvendor.php" hash="cdea6d41186776859dd4ff1b903631e0"/><file name="Logicbroker_Dropship360_Model_Resource_Uploadvendor_Collection.php" hash="c00c646cd30ea2846eaf64aebfa60d81"/><file name="Logicbroker_Dropship360_Model_Resource_Vendorimportlog.php" hash="5612cc9ad31e26537854803cf48cd83c"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Oudatedinventory_Email.php" hash="3c0a74ca609f55dcbffb9eec2ec61eaa"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Report_Email.php" hash="b8add0d41e93c027e056103eb2ffd784"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Sourcing_Cronbackorder.php" hash="b653137f284099cda52229ca4a03032a"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Sourcing_Cronsourcing.php" hash="e344d67cb474c67d39453cbfb90ae010"/><file name="Logicbroker_Dropship360_Model_System_Config_Backend_Uploadvendor_Cron.php" hash="d7ab43d34129359aaca41be3f8510e7a"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Attributecodes.php" hash="f97c33f5918714fccab7eb49119a8b95"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Category.php" hash="c5b9a7f9b613f8abe98c2419d802ab5c"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ediqualifier.php" hash="ac6c52c324204bd2062c0361c64e27b6"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ftptype.php" hash="66fc7d9ba1926a043060557f8ce87061"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Optionvalues.php" hash="48dc60144b3e8dae327e42c5bb567608"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Ranktype.php" hash="4a2a731340fd142ab77b75d64ac91ef8"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Store.php" hash="eaa19dfd1575ac6f851f115dd501fbf2"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Time.php" hash="7ccf6ebc62220eb3861b6ae3c91e7cfa"/><file name="Logicbroker_Dropship360_Model_System_Config_Source_Vendorlist.php" hash="28e75832378ea85a4eb037b029fcad32"/><file name="Logicbroker_Dropship360_Model_Uploadvendor.php" hash="2ba69f904a795307c6a66c4b38b30ae7"/><file name="Logicbroker_Dropship360_Model_Versions_Api.php" hash="7fc94e25af730bd4b8f48dbc8603bf7b"/><file name="Logicbroker_Dropship360_Model_Versions_Api_V2.php" hash="6def122e3c99344db1d10dc0b4ccfaa3"/></dir></dir><dir name="media"><dir name="logicbroker"><file name="Supplier_Ranking.png" hash="4390fdd6c9a3813ba716d50aa3a0dc2c"/><file name="System_Setup_Update.png" hash="b70cfea7eb0a4b02562d3d851c8a90a0"/><file name="System_Setup_Update_Step2.png" hash="719655c99dbaa771654551e1c496a708"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|