-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmagento.php
More file actions
2112 lines (1803 loc) · 70.1 KB
/
magento.php
File metadata and controls
2112 lines (1803 loc) · 70.1 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* PHP Library for Magento SOAP API
*
* http://www.magentocommerce.com/api/soap/introduction.html
*
* @author Benton Snyder
* @website http://www.bensnyde.me
* @created 5/19/2013
* @updated 4/2/2015
*/
class Magento
{
private $_api_instance; //Magento API instance
private $_api_session_key; //Magento login session key
/**
* Constructor
*
* @access public
* @param string wsdl url, string username, string password
* @return
*/
function __construct($wsdl_url, $username, $password) {
if(!extension_loaded('soap'))
die('Missing SOAP extension');
$this->initialize($wsdl_url, $username, $password);
}
/**
* SOAP authentication request
*
* @access private
* @param
* @return
*/
private function initialize($wsdl_url, $username, $password) {
$this->_api_instance = new SoapClient($wsdl_url);
try {
$this->_api_session_key = $this->_api_instance->login($username, $password);
}
catch(SoapFault $soap_ex) {
die($soap_ex->getMessage());
}
catch(Exception $ex) {
die($ex->getMessage());
}
}
/**
* Calls SOAP request
*
* @access private
* @param string api path, array arguments
* @return soap response
*/
private function mQuery($command, $args = array()) {
try {
return $this->_api_instance->call($this->_api_session_key, $command, $args);
}
catch(SoapFault $soap_ex) {
die($soap_ex->getMessage());
}
catch(Exception $ex) {
die($ex->getMessage());
}
}
# ***** catalog_category *****
/**
* Allows you to set/get the current store view
*
* @access public
* @param string storeViewID
* @return int storeViewID
*/
public function catalogCategory_currentStore($storeViewID) {
return $this->mQuery("catalog_category.currentStore", array("storeView" => $storeViewID));
}
/**
* Allows you to retrieve the hierarchical tree of categories
*
* @access public
* @param *string parentID, *string storeViewID
* @return array catalogCategoryTree
*/
public function catalogCategory_tree($parentID = null, $storeViewID = null) {
$data = array();
$data['parentId'] = $parentID;
$data['storeView'] = $storeViewID;
return $this->mQuery("catalog_category.tree", $data);
}
/**
* Allows you to retrieve one level of categories by a website, a store view, or a parent category
*
* @access public
* @param *string websiteID, *string storeViewID, *string parentCategory
* @return array CatalogCategoryEntitiesNoChildren
*/
public function catalogCategory_level($websiteID = null, $storeViewID = null, $parentCategoryID = null) {
$data = array();
$data['website'] = $websiteID;
$data['storeView'] = $storeViewID;
$data['parentCategory'] = $parentCategoryID;
return $this->mQuery("catalog_category.level", $data);
}
/**
* Allows you to retrieve information about the required category
*
* @access public
* @param int categoryID, *string storeViewID, *ArrayOfString attributes
* @return array catalogCategoryInfo
*/
public function catalogCategory_info($categoryID, $storeViewID = null, Array $attributes = array()) {
$data = array();
$data['categoryId'] = (int)$categoryID;
$data['attributes'] = $attributes;
$data['storeView'] = $storeViewID;
return $this->mQuery("catalog_category.info", $data);
}
/**
* Create a new category and return its ID
*
* @access public
* @param int parent category id, array catalogCategoryEntityCreate, *string store view id
* @return int attribute id
*/
public function catalogCategory_create($parentID, Array $categoryData, $storeID = null) {
$data = array();
$data['parentId'] = $parentID;
$data['categoryData'] = $categoryData;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_category.create", $data);
}
/**
* Update the required category
*
* @access public
* @param int category id, array catalogCategoryEntityCreate, *string store view id
* @return boolean result
*/
public function catalogCategory_update($categoryID, Array $categoryData, $storeID = null) {
$data = array();
$data['categoryId'] = $categoryID;
$data['categoryData'] = $categoryData;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_category.update", $data);
}
/**
* Allows you to move the required category in the category tree
*
* @access public
* @param int category id to be moved, int id of new parent category, *id of category after which required category will be moved
* @return
*/
public function catalogCategory_move($categoryID, $parentID, $afterID = null) {
$data = array();
$data['categoryId'] = $categoryID;
$data['parentId'] = $parentID;
$data['afterId'] = $afterID;
return $this->mQuery("catalog_category.move", $data);
}
/**
* Allows you to delete the required category
*
* @access public
* @param int category id
* @return boolean result
*/
public function catalogCategory_delete($categoryID) {
return $this->mQuery("catalog_category.delete", array("categoryId" => $categoryID));
}
/**
* Retrieve the list of products assigned to a required category
*
* @access public
* @param int category id
* @return array catalogAssignedProduct
*/
public function catalogCategory_assignedProducts($categoryID) {
return $this->mQuery("catalog_category.assignedProducts", array("categoryId" => $categoryID));
}
/**
* Assign a product to the required category
*
* @access public
* @param int category id, string product ID/SKU, *string position of product in category, string whether productID/SKU is passed in 'product' argument
* @return boolean result
*/
public function catalogCategory_assignProduct($categoryID, $productID, $position = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['categoryId'] = $categoryID;
$data['productId'] = $productID;
$data['position'] = $position;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_category.assignProduct", $data);
}
/**
* Allows you to update the product assigned to a category
*
* @access public
* @param int category id, string product ID/SKU, *string position of product in category, string whether productID/SKU is passed in 'product' argument
* @return boolean result
*/
public function catalogCategory_updateProduct($categoryID, $productID, $position = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['categoryId'] = $categoryID;
$data['productId'] = $productID;
$data['position'] = $position;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_category.updateProduct", $data);
}
/**
* Allows you to remove the product assignment from the category
*
* @access public
* @param int category id, string product ID/SKU, *string whether productID/SKU is passed in 'product' argument
* @return boolean result
*/
public function catalogCategory_removeProduct($categoryID, $productID, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['categoryId'] = $categoryID;
$data['productId'] = $productID;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_category.removeProduct", $data);
}
# ***** catalog_category_attribute *****
/**
* Allows you to set/get the current store view
*
* @access public
* @param *string store view id
* @return int store view id
*/
public function catalogCategoryAttribute_currentStore($storeID = null) {
return $this->mQuery("catalog_product_attribute.currentStore", array('storeView'=>$storeID));
}
/**
* Allows you to retrieve the list of category attributes
*
* @access public
* @param
* @return array catalogAttributeEntity
*/
public function catalogCategoryAttribute_list() {
return $this->mQuery("catalog_product_attribute.list");
}
/**
* Allows you to retrieve the attribute options
*
* @access public
* @param string attribute id, string store view id
* @return array catalogAttributeOptionEntity
*/
public function catalogCategoryAttribute_options($attributeID, $storeID) {
$data = array();
$data['attributeId'] = $attributeID;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_category_attribute.options", $data);
}
# ***** catalog_product *****
/**
* Allows you to set/get the current store view
*
* @access public
* @param *string store view id
* @return string store view id
*/
public function catalogProduct_currentStore($storeID = null) {
return $this->mQuery("catalog_product.currentStore", array('storeView' => $storeID));
}
/**
* Allows you to retrieve the list of products
*
* @access public
* @param *array filters by attributes, *string store view id
* @return array catalogProductEntity
*/
public function catalogProduct_list($filters = array(), $storeID = null) {
$data = array();
$data['filters'] = $filters;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product.list", $data);
}
/**
* Allows you to retrieve information about the required product
*
* @access public
* @param string product id, *string store view id, *array catalogProductRequestAttributes, *string product identifier type
* @return array catalogProductReturnEntity
*/
public function catalogProduct_info($productID, $storeID = null, Array $attributes = array(), $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['product'] = $productID;
$data['productIdentifierType'] = $productIdentifierType;
$data['attributes'] = $attributes;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product.info", $data);
}
/**
* Allows you to create a new product and return ID of the created product
*
* @access public
* @param string product type, string set id, string product sku, array catalogProductCreateEntity, string store view id
* @return int id of created product
*/
public function catalogProduct_create($type, $setID, $sku, Array $productData, $storeID) {
$data = array();
$data['type'] = $type;
$data['set'] = $setID;
$data['sku'] = $sku;
$data['productData'] = $productData;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product.create", $data);
}
/**
* Allows you to update the required product. Note that you should specify only those parameters which you want to be updated
*
* @access public
* @param string product id, array catalogProductCreateEntity, *string store view id, *string product identifier type
* @return boolean result
*/
public function catalogProduct_update($productID, Array $productData, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['productData'] = $productData;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product.update", $data);
}
/**
* Allows you to set the product special price
*
* @access public
* @param string product id, string product special price, sring start date, string end date, *string store view id, *string product identifier type
* @return boolean result
*/
public function catalogProduct_setSpecialPrice($productID, $specialPrice, $fromDate, $toDate, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['product'] = $productID;
$data['specialPrice'] = $specialPrice;
$data['fromDate'] = $fromDate;
$data['toDate'] = $toDate;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product.setSpecialPrice", $data);
}
/**
* Allows you to get the product special price data
*
* @access public
* @param string product id, string store view id, string product identifier type
* @return
*/
public function catalogProduct_getSpecialPrice($productID, $storeID, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['storeView'] = $storeID;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product.getSpecialPrice", $data);
}
/**
* Allows you to delete the required product
*
* @access public
* @param string product id, *string product identifier type
* @return boolean result
*/
public function catalogProduct_delete($productId, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productId;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product.delete", $data);
}
/**
* Get the list of additional attributes. Additional attributes are attributes that are not in the default set of attributes
*
* @access public
* @param string product type, string attribute set id
* @return array
*/
public function catalogProduct_listOfAdditionalAttributes($productType, $attributeSetID) {
$data = array();
$data['productType'] = $productType;
$data['attributeSetId'] = $attributeSetID;
return $this->mQuery("catalog_product.listOfAdditionalAttributes", $data);
}
# ***** product_attribute *****
/**
* Allows you to set/get the current store view
*
* @access public
* @param *string store view id
* @return int store view id
*/
public function productAttribute_currentStore($storeID = null) {
return $this->mQuery("catalog_product_attribute.currentStore", array('storeView' => $storeID));
}
/**
* Allows you to retrieve the list of product attributes
*
* @access public
* @param int set id
* @return array catalogAttributeEntity
*/
public function productAttribute_list($setID) {
return $this->mQuery("catalog_product_attribute.list", array('setId' => $setID));
}
/**
* Allows you to retrieve the product attribute options
*
* @access public
* @param string attribute id, *string store view id
* @return array catalogAttributeOptionEntity
*/
public function productAttribute_options($attributeID, $storeID = null) {
$data = array();
$data['attributeId'] = $attributeID;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product_attribute.options", $data);
}
/**
* Allows you to add a new option for attributes with selectable fields
*
* @access public
* @param string attribute id, array catalogProductAttributeOptionEntityToAdd
* @return boolean result
*/
public function productAttribute_addOption($attributeID, Array $data) {
$data = array();
$data['attribute'] = $attributeID;
$data['data'] = $data;
return $this->mQuery("product_attribute.addOption", $data);
}
/**
* Allows you to create a new product attribute
*
* @access public
* @param array catalogProductAttributeEntityToCreate
* @return int result
*/
public function productAttribute_create(Array $data) {
return $this->mQuery("product_attribute.create", array("data" => $data));
}
/**
* Allows you to get full information about a required attribute with the list of options
*
* @access public
* @param string attribute id
* @return array catalogProductAttributeEntity
*/
public function productAttribute_info($attributeID) {
return $this->mQuery("product_attribute.info", array('attribute' => $attributeID));
}
/**
* Allows you to remove the required attribute from a product
*
* @access public
* @param string attribute id
* @return boolean result
*/
public function productAttribute_remove($attributeID) {
return $this->mQuery("product_attribute.remove", array('attribute' => $attributeID));
}
/**
* Allows you to remove the option for an attribute
*
* @access public
* @param string attribute id, string option id
* @return boolean result
*/
public function productAttribute_removeOption($attributeID, $optionID) {
$data = array();
$data['attribute'] = $attributeID;
$data['optionId'] = $optionID;
return $this->mQuery("product_attribute.removeOption", $data);
}
/**
* Allows you to retrieve the list of possible attribute types
*
* @access public
* @param
* @return array catalogAttributeOptionEntity
*/
public function productAttribute_types() {
return $this->mQuery("product_attribute.types");
}
/**
* Allows you to update the required attribute
*
* @access public
* @param string attribute id, array catalogProductAttributeEntityToUpdate
* @return boolean result
*/
public function productAttribute_update($attributeID, Array $data) {
$data = array();
$data['attribute'] = $attributeID;
$data['data'] = $data;
return $this->mQuery("product_attribute.update", $data);
}
# ***** product_attribute_set *****
/**
* Allows you to retrieve the list of product attribute sets
*
* @access public
* @param
* @return array catalogProductAttributeSetEntity
*/
public function productAttributeSet_list() {
return $this->mQuery("catalog_product_attribute_set.list");
}
/**
* Allows you to add an existing attribute to an attribute set
*
* @access public
* @param string attribute id, string attribute set id, *string attribute group id, *string sortOrder
* @return boolean result
*/
public function productAttributeSet_attributeAdd($attributeID, $attributeSetID, $attributeGroupID = null, $sortOrder = null) {
$data = array();
$data['attributeId'] = $attributeID;
$data['attributeSetId'] = $attributeSetID;
$data['attributeGroupId'] = $attributeGroupID;
$data['sortOrder'] = $sortOrder;
return $this->mQuery("catalog_product_attribute_set.attributeAdd", $data);
}
/**
* Allows you to remove an existing attribute from an attribute set
*
* @access public
* @param string attribute id, string attribute set id
* @return boolean result
*/
public function productAttributeSet_attributeRemove($attributeID, $attributeSetID) {
$data = array();
$data['attributeId'] = $attributeID;
$data['attributeSetId'] = $attributeSetID;
return $this->mQuery("product_attribute_set.attributeRemove", $data);
}
/**
* Allows you to create a new attribute set based on another attribute set
*
* @access public
* @param string attribute set name, string skeleton set id
* @return int set id
*/
public function productAttributeSet_create($attributeSetName, $skeletonSetID) {
$data = array();
$data['attributeSetName'] = $attributeSetName;
$data['skeletonSetId'] = $skeletonSetID;
return $this->mQuery("product_attribute_set.create", $data);
}
/**
* Allows you to add a new group for attributes to the attribute set
*
* @access public
* @param string attribute set id, string group name
* @return int result
*/
public function productAttributeSet_groupAdd($attributeSetID, $groupName) {
$data = array();
$data['attributeSetId'] = $attributeSetID;
$data['groupName'] = $groupName;
return $this->mQuery("product_attribute_set.groupAdd", $data);
}
/**
* Allows you to remove a group from an attribute set
*
* @access public
* @param string attribute group id
* @return boolean result
*/
public function productAttributeSet_groupRemove($attributeGroupID) {
return $this->mQuery("product_attribute_set.groupRemove", array('attributeGroupId' => $attributeGroupID));
}
/**
* Allows you to rename a group in the attribute set
*
* @access public
* @param string group id, string new name for group
* @return boolean result
*/
public function productAttributeSet_groupRename($groupID, $groupName) {
$data = array();
$data['groupId'] = $groupID;
$data['groupName'] = $groupName;
return $this->mQuery("product_attribute_set.groupRename". $data);
}
/**
* Allows you to remove an existing attribute set
*
* @access public
* @param string attribute set id, *string force product remove flag
* @return boolean result
*/
public function productAttributeSet_remove($attributeSetID, $forceProductsRemove = null) {
$data = array();
$data['attributeSetId'] = $attributeSetID;
$data['forceProductsRemove'] = $forceProductsRemove;
return $this->mQuery("product_attribute_set.remove", $data);
}
# ***** catalog_product_type *****
/**
* Allows you to retrieve the list of product types
*
* @access public
* @param
* @return array catalogProductTypeEntity
*/
public function productCatalogType_list() {
return $this->mQuery("catalog_product_type.list");
}
# ***** catalog_product_attribute_media *****
/**
* Allows you to set/get the current store view
*
* @access public
* @param *string store view id
* @return int store view id
*/
public function catalogProductAttributeMedia_currentStore($storeID = null) {
return $this->mQuery("catalog_product_attribute_media.currentStore", array('storeView' => $storeID));
}
/**
* Allows you to retrieve the list of product images
*
* @access public
* @param string product id, *string store view id, *string product identifier type
* @return
*/
public function catalogProductAttributeMedia_list($productID, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType !="sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product_attribute_media.list", $data);
}
/**
* Allows you to retrieve information about the specified product image
*
* @access public
* @param string product id, string name of the image file, *string store view id, *string product identifier type
* @return array catalogProductImageEntity
*/
public function catalogProductAttributeMedia_info($productID, $file, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType !="sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['file'] = $file;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product_attribute_media.info", $data);
}
/**
* Allows you to retrieve product image types including standard image, small_image, thumbnail, etc.
*
* @access public
* @param string id of the product attribute set
* @return array catalogProductAttributeMediaTypeEntity
*/
public function catalogProductAttributeMedia_types($setID) {
return $this->mQuery("catalog_product_attribute_media.types", array('setId' => $setID));
}
/**
* Allows you to upload a new product image
*
* @access public
* @param string product id, array catalogProductAttributeMediaCreateEntity, *string store view id, *string product identifier type
* @return string resulting image name
*/
public function catalogProductAttributeMedia_create($productID, Array $data, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType !="sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['product'] = $productID;
$data['data'] = $data;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product_attribute_media.create", $data);
}
/**
* Allows you to update the product image
*
* @access public
* @param string product id, string image file name, array catalogProductAttributeMediaCreateEntity, *string store view id, *string product identifier
* @return boolean result
*/
public function catalogProductAttributeMedia_update($productID, $file, Array $data, $storeID = null, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType !="sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['file'] = $file;
$data['data'] = $data;
$data['productIdentifierType'] = $productIdentifierType;
$data['storeView'] = $storeID;
return $this->mQuery("catalog_product_attribute_media.update", $data);
}
/**
* Allows you to remove the image from a product
*
* @access public
* @param string product id, string file image name, *string product identifier type
* @return boolean result
*/
public function catalogProductAttributeMedia_remove($productID, $file, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType !="sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['file'] = $file;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_attribute_media.remove", $data);
}
# ***** catalog_product_attribute_tier_price *****
/**
* Allows you to retrieve information about product tier prices
*
* @access public
* @param string product id, *string product identifier type
* @return array catalogProductTierPriceEntity
*/
public function catalogProductAttributeTierPrice_info($productID, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_attribute_tier_price.info", $data);
}
/**
* Allows you to update the product tier prices
*
* @access public
* @param string product id, array catalogProductTierPriceEntity, *string product identifier type
* @return boolean result
*/
public function catalogProductAttributeTierPrice_update($productID, Array $tierPrices, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
$data = array();
$data['productId'] = $productID;
$data['tierPrices'] = $tierPrices;
$data['productIdentifiertype'] = $productIdentifierType;
return $this->mQuery("catalog_product_attribute_tier_price.update", $data);
}
# ***** catalog_product_link *****
/**
* Allows you to retrieve the list of linked products for a specific product
*
* @access public
* @param string link type, string product id, *string product identifier type
* @return array catalogProductLinkEntity
*/
public function catalogProductLink_list($type, $productID, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
if(!in_array($type, array("cross_sell", "up_sell", "related", "grouped")))
throw new Exception("Invalid type");
$data = array();
$data['type'] = $type;
$data['productId'] = $productID;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_link.list", $data);
}
/**
* Allows you to assign a product link (related, cross-sell, up-sell, or grouped) to another product
*
* @access public
* @param string type of link, string product id, string linked product id, array catalogProductLinkEntity, *string product identifier type
* @return boolean result
*/
public function catalogProductLink_assign($type, $productID, $linkedProductID, Array $data, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
if(!in_array($type, array("cross_sell", "up_sell", "related", "grouped")))
throw new Exception("Invalid type");
$data = array();
$data['type'] = $type;
$data['productId'] = $productID;
$data['linkedProductId'] = $linkedProductID;
$data['data'] = $data;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_link.assign", $data);
}
/**
* Allows you to update the product link
*
* @access public
* @param string type of link, string product id, string linked product id, array catalogProductLinkEntity, *string product identifier type
* @return boolean result
*/
public function catalogProductLink_update($type, $productID, $linkedProductID, Array $data, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
if(!in_array($type, array("cross_sell", "up_sell", "related", "grouped")))
throw new Exception("Invalid type");
$data = array();
$data['type'] = $type;
$data['productId'] = $productID;
$data['linkedProductId'] = $linkedProductID;
$data['data'] = $data;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_link.update", $data);
}
/**
* Allows you to remove the product link from a specific product
*
* @access public
* @param string type of link, string product id, string linked product id, *string product identifier type
* @return
*/
public function catalogProductLink_remove($type, $productID, $linkedProductID, $productIdentifierType = "id") {
if($productIdentifierType != "id" || $productIdentifierType != "sku")
throw new Exception("Invalid productIdentifierType");
if(!in_array($type, array("cross_sell", "up_sell", "related", "grouped")))
throw new Exception("Invalid type");
$data = array();
$data['type'] = $type;
$data['productId'] = $productID;
$data['linkedProductId'] = $linkedProductID;
$data['productIdentifierType'] = $productIdentifierType;
return $this->mQuery("catalog_product_link.update", $data);
}
/**
* Allows you to retrieve the list of product link types
*
* @access public
* @param
* @return array of link types
*/
public function catalogProductLink_types() {
return $this->mQuery("catalog_product_link.types");
}
/**
* Allows you to retrieve the product link type attributes
*
* @access public
* @param string type of link
* @return array catalogProductLinkAttributeEntity