|
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 Category |
|
24
|
|
|
* |
|
25
|
|
|
* @package Smalot\Magento\Catalog |
|
26
|
|
|
*/ |
|
27
|
|
|
class Category extends MagentoModuleAbstract |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Retrieve the list of products assigned to a required category. |
|
31
|
|
|
* |
|
32
|
|
|
* @param int $categoryId |
|
33
|
|
|
* |
|
34
|
|
|
* @return ActionInterface |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getAssignedProducts($categoryId) |
|
|
|
|
|
|
37
|
|
|
{ |
|
38
|
|
|
return $this->__createAction('catalog_category.assignedProducts', func_get_args()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Assign a product to the required category. |
|
43
|
|
|
* |
|
44
|
|
|
* @param int $categoryId |
|
45
|
|
|
* @param string $productId |
|
46
|
|
|
* @param string $position |
|
47
|
|
|
* @param string $identifierType |
|
48
|
|
|
* |
|
49
|
|
|
* @return ActionInterface |
|
50
|
|
|
*/ |
|
51
|
|
|
public function assignProduct($categoryId, $productId, $position = null, $identifierType = null) |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
|
|
return $this->__createAction('catalog_category.assignProduct', func_get_args()); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Create a new category and return its ID. |
|
58
|
|
|
* |
|
59
|
|
|
* @param int $parentId |
|
60
|
|
|
* @param array $categoryData |
|
61
|
|
|
* @param string $storeView |
|
62
|
|
|
* |
|
63
|
|
|
* @return ActionInterface |
|
64
|
|
|
*/ |
|
65
|
|
|
public function create($parentId, $categoryData, $storeView = null) |
|
|
|
|
|
|
66
|
|
|
{ |
|
67
|
|
|
return $this->__createAction('catalog_category.create', func_get_args()); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Allows you to set/get the current store view. |
|
72
|
|
|
* |
|
73
|
|
|
* @param string $storeView |
|
74
|
|
|
* |
|
75
|
|
|
* @return ActionInterface |
|
76
|
|
|
*/ |
|
77
|
|
|
public function setCurrentStore($storeView) |
|
|
|
|
|
|
78
|
|
|
{ |
|
79
|
|
|
return $this->__createAction('catalog_category.currentStore', func_get_args()); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Allows you to delete the required category. |
|
84
|
|
|
* |
|
85
|
|
|
* @param int $categoryId |
|
86
|
|
|
* |
|
87
|
|
|
* @return ActionInterface |
|
88
|
|
|
*/ |
|
89
|
|
|
public function delete($categoryId) |
|
|
|
|
|
|
90
|
|
|
{ |
|
91
|
|
|
return $this->__createAction('catalog_category.delete', func_get_args()); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Allows you to retrieve information about the required category. |
|
96
|
|
|
* |
|
97
|
|
|
* @param int $categoryId |
|
98
|
|
|
* @param string $storeView |
|
99
|
|
|
* @param array $attributes |
|
100
|
|
|
* |
|
101
|
|
|
* @return ActionInterface |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getInfo($categoryId, $storeView = null, $attributes = null) |
|
|
|
|
|
|
104
|
|
|
{ |
|
105
|
|
|
return $this->__createAction('catalog_category.info', func_get_args()); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Allows you to retrieve one level of categories by a website, a store view, or a parent category. |
|
110
|
|
|
* |
|
111
|
|
|
* @param string $website |
|
112
|
|
|
* @param string $storeView |
|
113
|
|
|
* @param string $parentCategory |
|
114
|
|
|
* |
|
115
|
|
|
* @return ActionInterface |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getLevel($website, $storeView = null, $parentCategory = null) |
|
|
|
|
|
|
118
|
|
|
{ |
|
119
|
|
|
return $this->__createAction('catalog_category.level', func_get_args()); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Allows you to move the required category in the category tree. |
|
124
|
|
|
* |
|
125
|
|
|
* @param int $categoryId |
|
126
|
|
|
* @param int $parentId |
|
127
|
|
|
* @param string $afterId |
|
128
|
|
|
* |
|
129
|
|
|
* @return ActionInterface |
|
130
|
|
|
*/ |
|
131
|
|
|
public function move($categoryId, $parentId, $afterId = null) |
|
|
|
|
|
|
132
|
|
|
{ |
|
133
|
|
|
return $this->__createAction('catalog_category.move', func_get_args()); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Allows you to remove the product assignment from the category. |
|
138
|
|
|
* |
|
139
|
|
|
* @param int $categoryId |
|
140
|
|
|
* @param string $productId |
|
141
|
|
|
* @param string $identifierType |
|
142
|
|
|
* |
|
143
|
|
|
* @return ActionInterface |
|
144
|
|
|
*/ |
|
145
|
|
|
public function removeProduct($categoryId, $productId, $identifierType = null) |
|
|
|
|
|
|
146
|
|
|
{ |
|
147
|
|
|
return $this->__createAction('catalog_category.removeProduct', func_get_args()); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Allows you to retrieve the hierarchical tree of categories. |
|
152
|
|
|
* |
|
153
|
|
|
* @param string $parentId |
|
154
|
|
|
* @param string $storeView |
|
155
|
|
|
* |
|
156
|
|
|
* @return ActionInterface |
|
157
|
|
|
*/ |
|
158
|
|
|
public function getTree($parentId = null, $storeView = null) |
|
|
|
|
|
|
159
|
|
|
{ |
|
160
|
|
|
return $this->__createAction('catalog_category.tree', func_get_args()); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* Update the required category. Note that you should specify only those parameters which you want to be updated. |
|
165
|
|
|
* |
|
166
|
|
|
* @param int $categoryId |
|
167
|
|
|
* @param array $categoryData |
|
168
|
|
|
* @param string $storeView |
|
169
|
|
|
* |
|
170
|
|
|
* @return ActionInterface |
|
171
|
|
|
*/ |
|
172
|
|
|
public function update($categoryId, $categoryData, $storeView = null) |
|
|
|
|
|
|
173
|
|
|
{ |
|
174
|
|
|
return $this->__createAction('catalog_category.update', func_get_args()); |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* Allows you to update the product assigned to a category. The product position is updated. |
|
179
|
|
|
* |
|
180
|
|
|
* @param int $categoryId |
|
181
|
|
|
* @param string $productId |
|
182
|
|
|
* @param string $position |
|
183
|
|
|
* @param string $identifierType |
|
184
|
|
|
* |
|
185
|
|
|
* @return ActionInterface |
|
186
|
|
|
*/ |
|
187
|
|
|
public function updateProduct($categoryId, $productId, $position = null, $identifierType = null) |
|
|
|
|
|
|
188
|
|
|
{ |
|
189
|
|
|
return $this->__createAction('catalog_category.updateProduct', func_get_args()); |
|
190
|
|
|
} |
|
191
|
|
|
} |
|
192
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.