|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @file |
|
5
|
|
|
* Magento API Client (SOAP v1). |
|
6
|
|
|
* Allows wrappers for each call, dependencies injections |
|
7
|
|
|
* and code completion. |
|
8
|
|
|
* |
|
9
|
|
|
* @author Sébastien MALOT <[email protected]> |
|
10
|
|
|
* @license MIT |
|
11
|
|
|
* @url <https://github.com/smalot/magento-client> |
|
12
|
|
|
* |
|
13
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
14
|
|
|
* file that was distributed with this source code. |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
namespace Smalot\Magento\Catalog; |
|
18
|
|
|
|
|
19
|
|
|
use Smalot\Magento\ActionInterface; |
|
20
|
|
|
use Smalot\Magento\MagentoModuleAbstract; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Class Product |
|
24
|
|
|
* |
|
25
|
|
|
* @package Smalot\Magento\Catalog |
|
26
|
|
|
*/ |
|
27
|
|
|
class Product extends MagentoModuleAbstract |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Allows you to create a new product and return ID of the created product. |
|
31
|
|
|
* |
|
32
|
|
|
* @param string $type |
|
33
|
|
|
* @param string $set |
|
34
|
|
|
* @param string $sku |
|
35
|
|
|
* @param array $productData |
|
36
|
|
|
* @param string $storeView |
|
37
|
|
|
* |
|
38
|
|
|
* @return ActionInterface |
|
39
|
|
|
*/ |
|
40
|
|
|
public function create($type, $set, $sku, $productData, $storeView = null) |
|
|
|
|
|
|
41
|
|
|
{ |
|
42
|
|
|
return $this->__createAction('catalog_product.create', func_get_args()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Allows you to set/get the current store view. |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $storeView |
|
49
|
|
|
* |
|
50
|
|
|
* @return ActionInterface |
|
51
|
|
|
*/ |
|
52
|
|
|
public function setCurrentStore($storeView) |
|
|
|
|
|
|
53
|
|
|
{ |
|
54
|
|
|
return $this->__createAction('catalog_product.currentStore', func_get_args()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Allows you to delete the required product. |
|
60
|
|
|
* |
|
61
|
|
|
* @param string $productId |
|
62
|
|
|
* @param string $identifierType |
|
63
|
|
|
* |
|
64
|
|
|
* @return ActionInterface |
|
65
|
|
|
*/ |
|
66
|
|
|
public function delete($productId, $identifierType = null) |
|
|
|
|
|
|
67
|
|
|
{ |
|
68
|
|
|
return $this->__createAction('catalog_product.delete', func_get_args()); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Allows you to get the product special price data. |
|
73
|
|
|
* |
|
74
|
|
|
* @param string $productId |
|
75
|
|
|
* @param string $storeView |
|
76
|
|
|
* @param string $identifierType |
|
77
|
|
|
* |
|
78
|
|
|
* @return ActionInterface |
|
79
|
|
|
*/ |
|
80
|
|
|
public function getSpecialPrice($productId, $storeView = null, $identifierType = null) |
|
|
|
|
|
|
81
|
|
|
{ |
|
82
|
|
|
return $this->__createAction('catalog_product.getSpecialPrice', func_get_args()); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Allows you to retrieve information about the required product. |
|
87
|
|
|
* |
|
88
|
|
|
* @param string $productId |
|
89
|
|
|
* @param string $storeView |
|
90
|
|
|
* @param string $attributes |
|
91
|
|
|
* @param string $identifierType |
|
92
|
|
|
* |
|
93
|
|
|
* @return ActionInterface |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getInfo($productId, $storeView = null, $attributes = null, $identifierType = null) |
|
|
|
|
|
|
96
|
|
|
{ |
|
97
|
|
|
return $this->__createAction('catalog_product.info', func_get_args()); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Allows you to retrieve the list of products. |
|
102
|
|
|
* |
|
103
|
|
|
* @param array $filters |
|
104
|
|
|
* @param string $storeView |
|
105
|
|
|
* |
|
106
|
|
|
* @return ActionInterface |
|
107
|
|
|
*/ |
|
108
|
|
|
public function getList($filters, $storeView = null) |
|
|
|
|
|
|
109
|
|
|
{ |
|
110
|
|
|
return $this->__createAction('catalog_product.list', func_get_args()); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* Get the list of additional attributes. |
|
115
|
|
|
* Additional attributes are attributes that are not in the default set of attributes. |
|
116
|
|
|
* |
|
117
|
|
|
* @param string $productType |
|
118
|
|
|
* @param string $attributeSetId |
|
119
|
|
|
* |
|
120
|
|
|
* @return ActionInterface |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getListOfAdditionalAttributes($productType, $attributeSetId) |
|
|
|
|
|
|
123
|
|
|
{ |
|
124
|
|
|
return $this->__createAction('catalog_product.listOfAdditionalAttributes', func_get_args()); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Allows you to set the product special price. |
|
129
|
|
|
* |
|
130
|
|
|
* @param string $productId |
|
131
|
|
|
* @param string $specialPrice |
|
132
|
|
|
* @param string $fromDate |
|
133
|
|
|
* @param string $toDate |
|
134
|
|
|
* @param string $storeView |
|
135
|
|
|
* @param string $productIdentifierType |
|
136
|
|
|
* |
|
137
|
|
|
* @return ActionInterface |
|
138
|
|
|
*/ |
|
139
|
|
|
public function setSpecialPrice( |
|
140
|
|
|
$productId, |
|
|
|
|
|
|
141
|
|
|
$specialPrice, |
|
|
|
|
|
|
142
|
|
|
$fromDate, |
|
|
|
|
|
|
143
|
|
|
$toDate, |
|
|
|
|
|
|
144
|
|
|
$storeView = null, |
|
|
|
|
|
|
145
|
|
|
$productIdentifierType = null |
|
|
|
|
|
|
146
|
|
|
) { |
|
147
|
|
|
return $this->__createAction('catalog_product.setSpecialPrice', func_get_args()); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Allows you to update the required product. |
|
152
|
|
|
* Note that you should specify only those parameters which you want to be updated. |
|
153
|
|
|
* |
|
154
|
|
|
* @param string $productId |
|
155
|
|
|
* @param array $productData |
|
156
|
|
|
* @param string $storeView |
|
157
|
|
|
* @param string $identifierType |
|
158
|
|
|
* |
|
159
|
|
|
* @return ActionInterface |
|
160
|
|
|
*/ |
|
161
|
|
|
public function update($productId, $productData, $storeView = null, $identifierType = null) |
|
|
|
|
|
|
162
|
|
|
{ |
|
163
|
|
|
return $this->__createAction('catalog_product.update', func_get_args()); |
|
164
|
|
|
} |
|
165
|
|
|
} |
|
166
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.