forked from erplyopensource/magento-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Import.php
executable file
·56 lines (54 loc) · 1.96 KB
/
Import.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* NB! This is a BETA release of Erply Connector.
*
* Use with caution and at your own risk.
*
* The author does not take any responsibility for any loss or damage to business
* or customers or anything at all. These terms may change without further notice.
*
* License terms are subject to change. License is all-restrictive until
* said otherwise.
*
* @author Eepohs Ltd
*/
/**
* Created by Rauno Väli
* Date: 27.03.12
* Time: 10:25
*/
class Eepohs_Erply_Model_Import extends Eepohs_Erply_Model_Erply
{
private $type = array(
'product_update' => 'getProducts',
'inventory_update' => 'getProductStock',
'product_import' => 'getProducts',
'category_import' => 'getProductGroups',
'category_update' => 'getProductGroups',
'image_import' => 'getProducts',
'price_update'=>'getPriceLists');
public function getTotalRecords($storeId, $importType, $params = array()) {
$this->verifyUser($storeId);
$parameters = array_merge(array(
'recordsOnPage' => 1,
'pageNo' => 1,
'displayedInWebshop' => 1,
'active' => 1,
), $params);
if($importType == 'price_update') {
$parameters["pricelistID"] = Mage::getStoreConfig('eepohs_erply/product/pricelist', $storeId);
} elseif($importType == 'inventory_update') {
$parameters["warehouseID"] = Mage::getStoreConfig('eepohs_erply/product/warehouse', $storeId);
}
$results = json_decode($this->sendRequest($this->type[$importType], $parameters), true);
Mage::helper('Erply')->log($this->type[$importType]);
Mage::helper('Erply')->log($parameters);
Mage::helper('Erply')->log($results["status"]);
if($importType == 'price_update') {
$return = count($results["records"][0]["pricelistRules"]);
} else {
$return = $results["status"]["recordsTotal"];
}
return $return;
}
}