sellbrite - Version 1.1.0

Version Notes

Major overhaul to extension, which enables greater capabilities within the Sellbrite platform. Better support for configurable products and orders.

Download this release

Release Info

Developer Sellbrite
Extension sellbrite
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.3 to 1.1.0

app/code/community/Sellbrite/Api/Block/Adminhtml/System/Config/Fieldset/Hint.php CHANGED
@@ -1,13 +1,178 @@
1
  <?php
2
-
 
 
 
 
3
  class Sellbrite_Api_Block_Adminhtml_System_Config_Fieldset_Hint
4
  extends Mage_Adminhtml_Block_Abstract
5
  implements Varien_Data_Form_Element_Renderer_Interface
6
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  protected $_template = 'sellbrite/api/system/config/fieldset/hint.phtml';
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  public function render(Varien_Data_Form_Element_Abstract $element)
10
  {
11
  return $this->toHtml();
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
1
  <?php
2
+ /**
3
+ * Class Sellbrite_Api_Block_Adminhtml_System_Config_Fieldset_Hint
4
+ *
5
+ * Sellbrite API fieldset renderer
6
+ */
7
  class Sellbrite_Api_Block_Adminhtml_System_Config_Fieldset_Hint
8
  extends Mage_Adminhtml_Block_Abstract
9
  implements Varien_Data_Form_Element_Renderer_Interface
10
  {
11
+ /**
12
+ * Minimal supported Magento version
13
+ *
14
+ * @var string
15
+ */
16
+ protected $minVersion = '1.7.0.0';
17
+
18
+ /**
19
+ * Maximum supported Magento version
20
+ *
21
+ * @var string
22
+ */
23
+ protected $maxVersion = '1.9.1.1';
24
+
25
+ /**
26
+ * Fieldset render template
27
+ *
28
+ * @var string
29
+ */
30
  protected $_template = 'sellbrite/api/system/config/fieldset/hint.phtml';
31
 
32
+ /**
33
+ * @var Sellbrite_Api_Model_Credentials
34
+ */
35
+ protected $credentials;
36
+
37
+ /**
38
+ * @param array $args
39
+ */
40
+ public function __construct(array $args = array())
41
+ {
42
+ parent::__construct($args);
43
+ $this->credentials = Mage::getSingleton('sellbrite_api/credentials');
44
+ }
45
+
46
+ /**
47
+ * Render fieldset
48
+ *
49
+ * @param Varien_Data_Form_Element_Abstract $element
50
+ * @return string
51
+ */
52
  public function render(Varien_Data_Form_Element_Abstract $element)
53
  {
54
  return $this->toHtml();
55
  }
56
+
57
+ /**
58
+ * Get min version
59
+ *
60
+ * @return string
61
+ */
62
+ public function getMinVersion()
63
+ {
64
+ return $this->minVersion;
65
+ }
66
+
67
+ /**
68
+ * Get max version
69
+ *
70
+ * @return string
71
+ */
72
+ public function getMaxVersion()
73
+ {
74
+ return $this->maxVersion;
75
+ }
76
+
77
+ /**
78
+ * Check if current Magento version is supported by extension
79
+ *
80
+ * @return bool
81
+ */
82
+ public function isSupportedVersion()
83
+ {
84
+ $version = $this->getMagentoVersion();
85
+ return version_compare($version, $this->minVersion, '>=') && version_compare($version, $this->maxVersion, '<=');
86
+ }
87
+
88
+ /**
89
+ * Get current Magento version
90
+ *
91
+ * @return string
92
+ */
93
+ public function getMagentoVersion()
94
+ {
95
+ return Mage::getVersion();
96
+ }
97
+
98
+ /**
99
+ * Get consumer key
100
+ *
101
+ * @return string
102
+ */
103
+ public function getConsumerKey()
104
+ {
105
+ return $this->credentials->getConsumerKey();
106
+ }
107
+
108
+ /**
109
+ * Get consumer secret
110
+ *
111
+ * @return string
112
+ */
113
+ public function getConsumerSecret()
114
+ {
115
+ return $this->credentials->getConsumerSecret();
116
+ }
117
+
118
+ /**
119
+ * Get access key
120
+ *
121
+ * @return string
122
+ */
123
+ public function getAccessToken()
124
+ {
125
+ return $this->credentials->getAccessToken();
126
+ }
127
+
128
+ /**
129
+ * Get access secret
130
+ *
131
+ * @return string
132
+ */
133
+ public function getAccessSecret()
134
+ {
135
+ return $this->credentials->getAccessSecret();
136
+ }
137
+
138
+ /**
139
+ * Get SOAP user
140
+ *
141
+ * @return string
142
+ */
143
+ public function getSoapUser()
144
+ {
145
+ return $this->credentials->getSoapUser();
146
+ }
147
+
148
+
149
+ /**
150
+ * Get site URL
151
+ *
152
+ * @return string
153
+ */
154
+ public function getSiteURL()
155
+ {
156
+ return $this->credentials->getSiteURL();
157
+ }
158
+
159
+ /**
160
+ * Get Sellbrite end point URL
161
+ *
162
+ * @return string
163
+ */
164
+ public function getEndPointUrl()
165
+ {
166
+ return $this->credentials->getEndPointUrl();
167
+ }
168
+
169
+ /**
170
+ * Get API Key
171
+ *
172
+ * @return string
173
+ */
174
+ public function getApiKey()
175
+ {
176
+ return $this->credentials->getApiKey();
177
+ }
178
  }
app/code/community/Sellbrite/Api/Helper/Catalog/Product.php DELETED
@@ -1,232 +0,0 @@
1
- <?php
2
-
3
- class Sellbrite_Api_Helper_Catalog_Product extends Mage_Core_Helper_Abstract
4
- {
5
- const CATEGORIES_SEPARATOR_PATH_XML = 'sellbrite_api/config/categories_separator';
6
-
7
- /**
8
- * @param Mage_Catalog_Model_Product $product
9
- * @param array $simpleSkus
10
- * @param array $priceChanges
11
- * @return Sellbrite_Api_Helper_Catalog_Product
12
- */
13
- public function associateProducts(Mage_Catalog_Model_Product $product, $simpleSkus, $priceChanges = array(), $configurableAttributes = array())
14
- {
15
- if (!empty($simpleSkus)) {
16
- $newProductIds = Mage::getModel('catalog/product')->getCollection()
17
- ->addFieldToFilter('sku', array('in' => (array) $simpleSkus))
18
- ->addFieldToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
19
- ->getAllIds();
20
-
21
- $oldProductIds = Mage::getModel('catalog/product_type_configurable')->setProduct($product)->getUsedProductCollection()
22
- ->addAttributeToSelect('*')
23
- ->addFilterByRequiredOptions()
24
- ->getAllIds();
25
-
26
- $usedProductIds = array_unique(array_merge($newProductIds, $oldProductIds));
27
-
28
- if (!empty($usedProductIds)) {
29
- if ($product->isConfigurable()) {
30
- $this->_initConfigurableAttributesData($product, $usedProductIds, $priceChanges, $configurableAttributes);
31
- } elseif ($product->isGrouped()) {
32
- $relations = array_fill_keys($usedProductIds, array('qty' => 0, 'position' => 0));
33
- $product->setGroupedLinkData($relations);
34
- }
35
- }
36
- }
37
-
38
- return $this;
39
- }
40
-
41
- /**
42
- * @param array $categoryNames
43
- * @return array
44
- */
45
- public function getCategoryIdsByNames($categoryNames)
46
- {
47
- $categories = array();
48
- $separator = $this->_getCatagoriesSeparator();
49
- foreach ($categoryNames as $category) {
50
- if (is_string($category) && !is_numeric($category)) {
51
- $pieces = explode($separator, $category);
52
- $addCategories = array();
53
- $parentIds = array();
54
- foreach ($pieces as $level => $name) {
55
- $collection = Mage::getModel('catalog/category')->getCollection()
56
- ->setStoreId(0)
57
- ->addFieldToFilter('level', $level + 2)
58
- ->addAttributeToFilter('name', $name);
59
- if (!empty($parentIds)) {
60
- $collection->getSelect()->where('parent_id IN (?)', $parentIds);
61
- }
62
- if ($collection->count()) {
63
- foreach ($collection as $category) {
64
- $addCategories[] = (int) $category->getId();
65
- if ($level > 0) {
66
- $addCategories[] = (int) $category->getParentId();
67
- }
68
- $parentIds[] = $category->getId();
69
- }
70
- } else {
71
- if ($level > 0) {
72
- $parentId = end($parentIds);
73
- } else {
74
- $parentId = Mage::app()->getWebsite(1)->getDefaultStore()->getRootCategoryId();
75
- }
76
- $newCategoryId = $this->createCategory($name, $parentId);
77
- $addCategories[] = $newCategoryId;
78
- $parentIds[] = $newCategoryId;
79
- }
80
- }
81
- if (!empty($addCategories)) {
82
- $categories = array_merge($categories, $addCategories);
83
- }
84
- }
85
- }
86
-
87
- return !empty($categories) ? $categories : $categoryNames;
88
- }
89
-
90
- /**
91
- * @param string $name
92
- * @param int|string $parentId
93
- * @return string
94
- */
95
- public function createCategory($name, $parentId)
96
- {
97
- $category = Mage::getModel('catalog/category');
98
- $parentCategory = Mage::getModel('catalog/category')->load($parentId);
99
-
100
- $category->setName($name)
101
- ->setIsActive(1)
102
- ->setPath($parentCategory->getPath());
103
- $category->save();
104
-
105
- return $category->getId();
106
- }
107
-
108
- /**
109
- * @param string $attributeCode
110
- * @param string $label
111
- * @return mixed
112
- */
113
- public function getOptionKeyByLabel($attributeCode, $label)
114
- {
115
- $attribute = Mage::getModel('catalog/product')->getResource()
116
- ->getAttribute($attributeCode);
117
- if ($attribute && $attribute->getId() && $attribute->usesSource()) {
118
- foreach ($attribute->getSource()->getAllOptions(true, true) as $option) {
119
- if ($label == $option['label'] || $label == $option['value']) {
120
- return $option['value'];
121
- }
122
- }
123
- }
124
-
125
- // if ($newOptionId = $this->createOption($attribute, $label)) {
126
- // return $newOptionId;
127
- // }
128
-
129
- return $label;
130
- }
131
-
132
- /**
133
- * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
134
- * @param string $label
135
- * @return string|null
136
- */
137
- public function createOption(Mage_Catalog_Model_Resource_Eav_Attribute $attribute, $label)
138
- {
139
- $option = array(
140
- 'value' => array(
141
- 'option' => array($label)
142
- )
143
- );
144
- $attribute->setOption($option);
145
- $attribute->save();
146
-
147
- $optionId = Mage::getModel('eav/entity_attribute_source_table')
148
- ->setAttribute($attribute)
149
- ->getOptionId($label);
150
-
151
- return $optionId;
152
- }
153
-
154
- protected function _getCatagoriesSeparator()
155
- {
156
- return Mage::getStoreConfig(self::CATEGORIES_SEPARATOR_PATH_XML);
157
- }
158
-
159
- /**
160
- * @param Mage_Catalog_Model_Product $mainProduct
161
- * @param array $simpleProductIds
162
- * @param array $priceChanges
163
- * @return Sellbrite_Api_Helper_Catalog_Product
164
- */
165
- protected function _initConfigurableAttributesData(Mage_Catalog_Model_Product $mainProduct, $simpleProductIds, $priceChanges = array(), $configurableAttributes = array())
166
- {
167
- if (!$mainProduct->isConfigurable() || empty($simpleProductIds)) {
168
- return $this;
169
- }
170
-
171
- $mainProduct->setConfigurableProductsData(array_flip($simpleProductIds));
172
- $productType = $mainProduct->getTypeInstance(true);
173
- $productType->setProduct($mainProduct);
174
- $attributesData = $productType->getConfigurableAttributesAsArray();
175
-
176
- if (empty($attributesData)) {
177
- // Auto generation if configurable product has no attribute
178
- $attributeIds = array();
179
- foreach ($productType->getSetAttributes() as $attribute) {
180
- if ($productType->canUseAttribute($attribute)) {
181
- $attributeIds[] = $attribute->getAttributeId();
182
- }
183
- }
184
- $productType->setUsedProductAttributeIds($attributeIds);
185
- $attributesData = $productType->getConfigurableAttributesAsArray();
186
- }
187
- if (!empty($configurableAttributes)){
188
- foreach ($attributesData as $idx => $val) {
189
- if (!in_array($val['attribute_code'], $configurableAttributes)) {
190
- unset($attributesData[$idx]);
191
- }
192
- }
193
- }
194
-
195
- $products = Mage::getModel('catalog/product')->getCollection()
196
- ->addIdFilter($simpleProductIds);
197
-
198
- if (count($products)) {
199
- foreach ($attributesData as &$attribute) {
200
- $attribute['label'] = $attribute['frontend_label'];
201
- $attributeCode = $attribute['attribute_code'];
202
- foreach ($products as $product) {
203
- $product->load($product->getId());
204
- $optionId = $product->getData($attributeCode);
205
- $isPercent = 0;
206
- $priceChange = 0;
207
- if (!empty($priceChanges) && isset($priceChanges[$attributeCode])) {
208
- $optionText = $product->getResource()
209
- ->getAttribute($attribute['attribute_code'])
210
- ->getSource()
211
- ->getOptionText($optionId);
212
- if (isset($priceChanges[$attributeCode][$optionText])) {
213
- if (false !== strpos($priceChanges[$attributeCode][$optionText], '%')) {
214
- $isPercent = 1;
215
- }
216
- $priceChange = preg_replace('/[^0-9\.,-]/', '', $priceChanges[$attributeCode][$optionText]);
217
- $priceChange = (float) str_replace(',', '.', $priceChange);
218
- }
219
- }
220
- $attribute['values'][$optionId] = array(
221
- 'value_index' => $optionId,
222
- 'is_percent' => $isPercent,
223
- 'pricing_value' => $priceChange,
224
- );
225
- }
226
- }
227
- $mainProduct->setConfigurableAttributesData($attributesData);
228
- }
229
-
230
- return $this;
231
- }
232
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sellbrite/Api/Helper/Data.php CHANGED
@@ -1,14 +1,8 @@
1
  <?php
2
-
3
- class Sellbrite_Api_Helper_Data extends Mage_Core_Helper_Abstract
 
 
4
  {
5
- /**
6
- * @param string $attrSetName
7
- * @return string
8
- */
9
- public function getAttributeSetIdByName($attrSetName, $entityType = 'catalog_product')
10
- {
11
- return Mage::getSingleton('catalog/config')
12
- ->getAttributeSetId($entityType, $attrSetName);
13
- }
14
  }
1
  <?php
2
+ /**
3
+ * Class Sellbrite_Api_Helper_Data
4
+ */
5
+ class Sellbrite_Api_Helper_Data extends Mage_Core_Helper_Data
6
  {
7
+
 
 
 
 
 
 
 
 
8
  }
app/code/community/Sellbrite/Api/Model/Catalog/Api2/Product/Rest/Admin/V1/Interceptor.php ADDED
@@ -0,0 +1,1037 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Catalog_Api2_Product_Rest_Admin_V1_Interceptor
4
+ *
5
+ * How To Extend a Logic of This Class?
6
+ *
7
+ * This class is designed to provide new extension points for overridden class Mage_Catalog_Model_Api2_Product_Rest_Admin_V1
8
+ * Every extension can decorate/pluginize all methods of Mage_Catalog_Model_Api2_Product_Rest_Admin_V1 (public and protected)
9
+ * using config.xml file. Please, declare your configuration in the following format:
10
+ * <config>
11
+ * <global>
12
+ * <catalog_product_list_item_plugins>
13
+ * <{intercepted_method_name}>
14
+ * <{strategy_type}>
15
+ * <any_node_name>namespace_module/class_name</any_node_name>
16
+ * </{strategy_type}>
17
+ * </{intercepted_method_name}>
18
+ * </catalog_product_list_item_plugins>
19
+ * </global>
20
+ * </config>
21
+ *
22
+ * where {intercepted_method_name} - one of the method of Mage_Catalog_Model_Api2_Product_Rest_Admin_V1,
23
+ * {strategy_type} - interception strategy type:
24
+ * - before (method invokeBefore of your class will be called before original call),
25
+ * - after (method invokeAfter of your class will be called after original call),
26
+ * - around (method invokeAround of your class will be called instead of original call)
27
+ */
28
+ class Sellbrite_Api_Model_Catalog_Api2_Product_Rest_Admin_V1_Interceptor extends
29
+ Mage_Catalog_Model_Api2_Product_Rest_Admin_V1
30
+ {
31
+ const LISTENER_BEFORE = 'before';
32
+ const LISTENER_AROUND = 'around';
33
+ const LISTENER_AFTER = 'after';
34
+
35
+ /**
36
+ * Get declared plugins
37
+ *
38
+ * @param string $methodName
39
+ * @return array|null
40
+ */
41
+ protected function _getPluginsInfo($methodName)
42
+ {
43
+ $pluginInfo = Mage::getConfig()->getNode(
44
+ 'global/catalog_product_list_item_plugins/' . $methodName
45
+ );
46
+
47
+ if (!$pluginInfo) {
48
+ return null;
49
+ }
50
+ return $pluginInfo->asArray();
51
+ }
52
+
53
+ /**
54
+ * Call plugins
55
+ *
56
+ * @param string $method
57
+ * @param array $arguments
58
+ * @param array $pluginInfo
59
+ * @return mixed
60
+ */
61
+ protected function ___callPlugins($method, array $arguments, array $pluginInfo)
62
+ {
63
+ $result = null;
64
+ if (isset($pluginInfo[self::LISTENER_BEFORE])) {
65
+ // Call 'before' listeners
66
+ foreach ($pluginInfo[self::LISTENER_BEFORE] as $code) {
67
+ $beforeResult = call_user_func_array(array(Mage::getSingleton($code), 'invokeBefore'), $arguments);
68
+ if ($beforeResult) {
69
+ $arguments = $beforeResult;
70
+ }
71
+ }
72
+ }
73
+
74
+ if (isset($pluginInfo[self::LISTENER_AROUND])) {
75
+ // Call 'around' listener
76
+ foreach ($pluginInfo[self::LISTENER_AFTER] as $code) {
77
+ $result = call_user_func_array(
78
+ array(Mage::getSingleton($code), 'invokeAround'),
79
+ array_merge($arguments, $result)
80
+ );
81
+ }
82
+ } else {
83
+ // Call original method
84
+ $result = call_user_func_array(array('parent', $method), $arguments);
85
+ }
86
+
87
+ if (isset($pluginInfo[self::LISTENER_AFTER])) {
88
+ // Call 'after' listeners
89
+ foreach ($pluginInfo[self::LISTENER_AFTER] as $code) {
90
+ $result = call_user_func_array(array(Mage::getSingleton($code), 'invokeAfter'), array($result));
91
+ }
92
+ }
93
+ return $result;
94
+ }
95
+
96
+
97
+ //======================================= Start Auto-generated Code ======================================//
98
+
99
+ /**
100
+ * {@inheritdoc}
101
+ */
102
+ public function getAvailableAttributes($userType, $operation)
103
+ {
104
+ $pluginInfo = $this->_getPluginsInfo('getAvailableAttributes');
105
+ if (!$pluginInfo) {
106
+ return parent::getAvailableAttributes($userType, $operation);
107
+ } else {
108
+ return $this->___callPlugins('getAvailableAttributes', func_get_args(), $pluginInfo);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * {@inheritdoc}
114
+ */
115
+ protected function _isAttributeVisible(Mage_Catalog_Model_Resource_Eav_Attribute $attribute, $userType)
116
+ {
117
+ $pluginInfo = $this->_getPluginsInfo('_isAttributeVisible');
118
+ if (!$pluginInfo) {
119
+ return parent::_isAttributeVisible($attribute, $userType);
120
+ } else {
121
+ return $this->___callPlugins('_isAttributeVisible', func_get_args(), $pluginInfo);
122
+ }
123
+ }
124
+
125
+ /**
126
+ * {@inheritdoc}
127
+ */
128
+ public function dispatch()
129
+ {
130
+ $pluginInfo = $this->_getPluginsInfo('dispatch');
131
+ if (!$pluginInfo) {
132
+ parent::dispatch();
133
+ } else {
134
+ return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
135
+ }
136
+ }
137
+
138
+ /**
139
+ * {@inheritdoc}
140
+ */
141
+ protected function _errorIfMethodNotExist($methodName)
142
+ {
143
+ $pluginInfo = $this->_getPluginsInfo('_errorIfMethodNotExist');
144
+ if (!$pluginInfo) {
145
+ parent::_errorIfMethodNotExist($methodName);
146
+ } else {
147
+ return $this->___callPlugins('_errorIfMethodNotExist', func_get_args(), $pluginInfo);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * {@inheritdoc}
153
+ */
154
+ protected function _checkMethodExist($methodName)
155
+ {
156
+ $pluginInfo = $this->_getPluginsInfo('_checkMethodExist');
157
+ if (!$pluginInfo) {
158
+ return parent::_checkMethodExist($methodName);
159
+ } else {
160
+ return $this->___callPlugins('_checkMethodExist', func_get_args(), $pluginInfo);
161
+ }
162
+ }
163
+
164
+ /**
165
+ * {@inheritdoc}
166
+ */
167
+ public function getRequest()
168
+ {
169
+ $pluginInfo = $this->_getPluginsInfo('getRequest');
170
+ if (!$pluginInfo) {
171
+ return parent::getRequest();
172
+ } else {
173
+ return $this->___callPlugins('getRequest', func_get_args(), $pluginInfo);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * {@inheritdoc}
179
+ */
180
+ public function setRequest(Mage_Api2_Model_Request $request)
181
+ {
182
+ $pluginInfo = $this->_getPluginsInfo('setRequest');
183
+ if (!$pluginInfo) {
184
+ return parent::setRequest($request);
185
+ } else {
186
+ return $this->___callPlugins('setRequest', func_get_args(), $pluginInfo);
187
+ }
188
+ }
189
+
190
+ /**
191
+ * {@inheritdoc}
192
+ */
193
+ public function getResourceType()
194
+ {
195
+ $pluginInfo = $this->_getPluginsInfo('getResourceType');
196
+ if (!$pluginInfo) {
197
+ return parent::getResourceType();
198
+ } else {
199
+ return $this->___callPlugins('getResourceType', func_get_args(), $pluginInfo);
200
+ }
201
+ }
202
+
203
+ /**
204
+ * {@inheritdoc}
205
+ */
206
+ public function setResourceType($resourceType)
207
+ {
208
+ $pluginInfo = $this->_getPluginsInfo('setResourceType');
209
+ if (!$pluginInfo) {
210
+ return parent::setResourceType($resourceType);
211
+ } else {
212
+ return $this->___callPlugins('setResourceType', func_get_args(), $pluginInfo);
213
+ }
214
+ }
215
+
216
+ /**
217
+ * {@inheritdoc}
218
+ */
219
+ public function getApiType()
220
+ {
221
+ $pluginInfo = $this->_getPluginsInfo('getApiType');
222
+ if (!$pluginInfo) {
223
+ return parent::getApiType();
224
+ } else {
225
+ return $this->___callPlugins('getApiType', func_get_args(), $pluginInfo);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * {@inheritdoc}
231
+ */
232
+ public function setApiType($apiType)
233
+ {
234
+ $pluginInfo = $this->_getPluginsInfo('setApiType');
235
+ if (!$pluginInfo) {
236
+ return parent::setApiType($apiType);
237
+ } else {
238
+ return $this->___callPlugins('setApiType', func_get_args(), $pluginInfo);
239
+ }
240
+ }
241
+
242
+ /**
243
+ * {@inheritdoc}
244
+ */
245
+ public function getVersion()
246
+ {
247
+ $pluginInfo = $this->_getPluginsInfo('getVersion');
248
+ if (!$pluginInfo) {
249
+ return parent::getVersion();
250
+ } else {
251
+ return $this->___callPlugins('getVersion', func_get_args(), $pluginInfo);
252
+ }
253
+ }
254
+
255
+ /**
256
+ * {@inheritdoc}
257
+ */
258
+ public function setVersion($version)
259
+ {
260
+ $pluginInfo = $this->_getPluginsInfo('setVersion');
261
+ if (!$pluginInfo) {
262
+ parent::setVersion($version);
263
+ } else {
264
+ return $this->___callPlugins('setVersion', func_get_args(), $pluginInfo);
265
+ }
266
+ }
267
+
268
+ /**
269
+ * {@inheritdoc}
270
+ */
271
+ public function getResponse()
272
+ {
273
+ $pluginInfo = $this->_getPluginsInfo('getResponse');
274
+ if (!$pluginInfo) {
275
+ return parent::getResponse();
276
+ } else {
277
+ return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo);
278
+ }
279
+ }
280
+
281
+ /**
282
+ * {@inheritdoc}
283
+ */
284
+ public function setResponse(Mage_Api2_Model_Response $response)
285
+ {
286
+ $pluginInfo = $this->_getPluginsInfo('setResponse');
287
+ if (!$pluginInfo) {
288
+ parent::setResponse($response);
289
+ } else {
290
+ return $this->___callPlugins('setResponse', func_get_args(), $pluginInfo);
291
+ }
292
+ }
293
+
294
+ /**
295
+ * {@inheritdoc}
296
+ */
297
+ public function getFilter()
298
+ {
299
+ $pluginInfo = $this->_getPluginsInfo('getFilter');
300
+ if (!$pluginInfo) {
301
+ return parent::getFilter();
302
+ } else {
303
+ return $this->___callPlugins('getFilter', func_get_args(), $pluginInfo);
304
+ }
305
+ }
306
+
307
+ /**
308
+ * {@inheritdoc}
309
+ */
310
+ public function setFilter(Mage_Api2_Model_Acl_Filter $filter)
311
+ {
312
+ $pluginInfo = $this->_getPluginsInfo('setFilter');
313
+ if (!$pluginInfo) {
314
+ parent::setFilter($filter);
315
+ } else {
316
+ return $this->___callPlugins('setFilter', func_get_args(), $pluginInfo);
317
+ }
318
+ }
319
+
320
+ /**
321
+ * {@inheritdoc}
322
+ */
323
+ public function getRenderer()
324
+ {
325
+ $pluginInfo = $this->_getPluginsInfo('getRenderer');
326
+ if (!$pluginInfo) {
327
+ return parent::getRenderer();
328
+ } else {
329
+ return $this->___callPlugins('getRenderer', func_get_args(), $pluginInfo);
330
+ }
331
+ }
332
+
333
+ /**
334
+ * {@inheritdoc}
335
+ */
336
+ public function setRenderer(Mage_Api2_Model_Renderer_Interface $renderer)
337
+ {
338
+ $pluginInfo = $this->_getPluginsInfo('setRenderer');
339
+ if (!$pluginInfo) {
340
+ parent::setRenderer($renderer);
341
+ } else {
342
+ return $this->___callPlugins('setRenderer', func_get_args(), $pluginInfo);
343
+ }
344
+ }
345
+
346
+ /**
347
+ * {@inheritdoc}
348
+ */
349
+ public function getUserType()
350
+ {
351
+ $pluginInfo = $this->_getPluginsInfo('getUserType');
352
+ if (!$pluginInfo) {
353
+ return parent::getUserType();
354
+ } else {
355
+ return $this->___callPlugins('getUserType', func_get_args(), $pluginInfo);
356
+ }
357
+ }
358
+
359
+ /**
360
+ * {@inheritdoc}
361
+ */
362
+ public function setUserType($userType)
363
+ {
364
+ $pluginInfo = $this->_getPluginsInfo('setUserType');
365
+ if (!$pluginInfo) {
366
+ return parent::setUserType($userType);
367
+ } else {
368
+ return $this->___callPlugins('setUserType', func_get_args(), $pluginInfo);
369
+ }
370
+ }
371
+
372
+ /**
373
+ * {@inheritdoc}
374
+ */
375
+ public function getApiUser()
376
+ {
377
+ $pluginInfo = $this->_getPluginsInfo('getApiUser');
378
+ if (!$pluginInfo) {
379
+ return parent::getApiUser();
380
+ } else {
381
+ return $this->___callPlugins('getApiUser', func_get_args(), $pluginInfo);
382
+ }
383
+ }
384
+
385
+ /**
386
+ * {@inheritdoc}
387
+ */
388
+ public function setApiUser(Mage_Api2_Model_Auth_User_Abstract $apiUser)
389
+ {
390
+ $pluginInfo = $this->_getPluginsInfo('setApiUser');
391
+ if (!$pluginInfo) {
392
+ return parent::setApiUser($apiUser);
393
+ } else {
394
+ return $this->___callPlugins('setApiUser', func_get_args(), $pluginInfo);
395
+ }
396
+ }
397
+
398
+ /**
399
+ * {@inheritdoc}
400
+ */
401
+ public function getActionType()
402
+ {
403
+ $pluginInfo = $this->_getPluginsInfo('getActionType');
404
+ if (!$pluginInfo) {
405
+ return parent::getActionType();
406
+ } else {
407
+ return $this->___callPlugins('getActionType', func_get_args(), $pluginInfo);
408
+ }
409
+ }
410
+
411
+ /**
412
+ * {@inheritdoc}
413
+ */
414
+ public function setActionType($actionType)
415
+ {
416
+ $pluginInfo = $this->_getPluginsInfo('setActionType');
417
+ if (!$pluginInfo) {
418
+ return parent::setActionType($actionType);
419
+ } else {
420
+ return $this->___callPlugins('setActionType', func_get_args(), $pluginInfo);
421
+ }
422
+ }
423
+
424
+ /**
425
+ * {@inheritdoc}
426
+ */
427
+ public function getOperation()
428
+ {
429
+ $pluginInfo = $this->_getPluginsInfo('getOperation');
430
+ if (!$pluginInfo) {
431
+ return parent::getOperation();
432
+ } else {
433
+ return $this->___callPlugins('getOperation', func_get_args(), $pluginInfo);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * {@inheritdoc}
439
+ */
440
+ public function setOperation($operation)
441
+ {
442
+ $pluginInfo = $this->_getPluginsInfo('setOperation');
443
+ if (!$pluginInfo) {
444
+ return parent::setOperation($operation);
445
+ } else {
446
+ return $this->___callPlugins('setOperation', func_get_args(), $pluginInfo);
447
+ }
448
+ }
449
+
450
+ /**
451
+ * {@inheritdoc}
452
+ */
453
+ public function getConfig()
454
+ {
455
+ $pluginInfo = $this->_getPluginsInfo('getConfig');
456
+ if (!$pluginInfo) {
457
+ return parent::getConfig();
458
+ } else {
459
+ return $this->___callPlugins('getConfig', func_get_args(), $pluginInfo);
460
+ }
461
+ }
462
+
463
+ /**
464
+ * {@inheritdoc}
465
+ */
466
+ public function getWorkingModel()
467
+ {
468
+ $pluginInfo = $this->_getPluginsInfo('getWorkingModel');
469
+ if (!$pluginInfo) {
470
+ return parent::getWorkingModel();
471
+ } else {
472
+ return $this->___callPlugins('getWorkingModel', func_get_args(), $pluginInfo);
473
+ }
474
+ }
475
+
476
+ /**
477
+ * {@inheritdoc}
478
+ */
479
+ protected function _render($data)
480
+ {
481
+ $pluginInfo = $this->_getPluginsInfo('_render');
482
+ if (!$pluginInfo) {
483
+ parent::_render($data);
484
+ } else {
485
+ return $this->___callPlugins('_render', func_get_args(), $pluginInfo);
486
+ }
487
+ }
488
+
489
+ /**
490
+ * {@inheritdoc}
491
+ */
492
+ protected function _critical($message, $code = null)
493
+ {
494
+ $pluginInfo = $this->_getPluginsInfo('_critical');
495
+ if (!$pluginInfo) {
496
+ parent::_critical($message, $code);
497
+ } else {
498
+ return $this->___callPlugins('_critical', func_get_args(), $pluginInfo);
499
+ }
500
+ }
501
+
502
+ /**
503
+ * {@inheritdoc}
504
+ */
505
+ protected function _getCriticalErrors()
506
+ {
507
+ $pluginInfo = $this->_getPluginsInfo('_getCriticalErrors');
508
+ if (!$pluginInfo) {
509
+ return parent::_getCriticalErrors();
510
+ } else {
511
+ return $this->___callPlugins('_getCriticalErrors', func_get_args(), $pluginInfo);
512
+ }
513
+ }
514
+
515
+ /**
516
+ * {@inheritdoc}
517
+ */
518
+ protected function _error($message, $code)
519
+ {
520
+ $pluginInfo = $this->_getPluginsInfo('_error');
521
+ if (!$pluginInfo) {
522
+ return parent::_error($message, $code);
523
+ } else {
524
+ return $this->___callPlugins('_error', func_get_args(), $pluginInfo);
525
+ }
526
+ }
527
+
528
+ /**
529
+ * {@inheritdoc}
530
+ */
531
+ protected function _successMessage($message, $code, $params = array())
532
+ {
533
+ $pluginInfo = $this->_getPluginsInfo('_successMessage');
534
+ if (!$pluginInfo) {
535
+ return parent::_successMessage($message, $code, $params);
536
+ } else {
537
+ return $this->___callPlugins('_successMessage', func_get_args(), $pluginInfo);
538
+ }
539
+ }
540
+
541
+ /**
542
+ * {@inheritdoc}
543
+ */
544
+ protected function _errorMessage($message, $code, $params = array())
545
+ {
546
+ $pluginInfo = $this->_getPluginsInfo('_errorMessage');
547
+ if (!$pluginInfo) {
548
+ return parent::_errorMessage($message, $code, $params);
549
+ } else {
550
+ return $this->___callPlugins('_errorMessage', func_get_args(), $pluginInfo);
551
+ }
552
+ }
553
+
554
+ /**
555
+ * {@inheritdoc}
556
+ */
557
+ protected function _applyFilter(Varien_Data_Collection_Db $collection)
558
+ {
559
+ $pluginInfo = $this->_getPluginsInfo('_applyFilter');
560
+ if (!$pluginInfo) {
561
+ return parent::_applyFilter($collection);
562
+ } else {
563
+ return $this->___callPlugins('_applyFilter', func_get_args(), $pluginInfo);
564
+ }
565
+ }
566
+
567
+ /**
568
+ * {@inheritdoc}
569
+ */
570
+ protected function _multicall($resourceInstanceId)
571
+ {
572
+ $pluginInfo = $this->_getPluginsInfo('_multicall');
573
+ if (!$pluginInfo) {
574
+ return parent::_multicall($resourceInstanceId);
575
+ } else {
576
+ return $this->___callPlugins('_multicall', func_get_args(), $pluginInfo);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * {@inheritdoc}
582
+ */
583
+ protected function _getSubModel($resourceId, array $requestParams)
584
+ {
585
+ $pluginInfo = $this->_getPluginsInfo('_getSubModel');
586
+ if (!$pluginInfo) {
587
+ return parent::_getSubModel($resourceId, $requestParams);
588
+ } else {
589
+ return $this->___callPlugins('_getSubModel', func_get_args(), $pluginInfo);
590
+ }
591
+ }
592
+
593
+ /**
594
+ * {@inheritdoc}
595
+ */
596
+ protected function _isSubCallAllowed($resourceId)
597
+ {
598
+ $pluginInfo = $this->_getPluginsInfo('_isSubCallAllowed');
599
+ if (!$pluginInfo) {
600
+ return parent::_isSubCallAllowed($resourceId);
601
+ } else {
602
+ return $this->___callPlugins('_isSubCallAllowed', func_get_args(), $pluginInfo);
603
+ }
604
+ }
605
+
606
+ /**
607
+ * {@inheritdoc}
608
+ */
609
+ public function setReturnData($flag)
610
+ {
611
+ $pluginInfo = $this->_getPluginsInfo('setReturnData');
612
+ if (!$pluginInfo) {
613
+ return parent::setReturnData($flag);
614
+ } else {
615
+ return $this->___callPlugins('setReturnData', func_get_args(), $pluginInfo);
616
+ }
617
+ }
618
+
619
+ /**
620
+ * {@inheritdoc}
621
+ */
622
+ protected function _getLocation($resource)
623
+ {
624
+ $pluginInfo = $this->_getPluginsInfo('_getLocation');
625
+ if (!$pluginInfo) {
626
+ return parent::_getLocation($resource);
627
+ } else {
628
+ return $this->___callPlugins('_getLocation', func_get_args(), $pluginInfo);
629
+ }
630
+ }
631
+
632
+ /**
633
+ * {@inheritdoc}
634
+ */
635
+ protected function _getResourceAttributes()
636
+ {
637
+ $pluginInfo = $this->_getPluginsInfo('_getResourceAttributes');
638
+ if (!$pluginInfo) {
639
+ return parent::_getResourceAttributes();
640
+ } else {
641
+ return $this->___callPlugins('_getResourceAttributes', func_get_args(), $pluginInfo);
642
+ }
643
+ }
644
+
645
+ /**
646
+ * {@inheritdoc}
647
+ */
648
+ public function getExcludedAttributes($userType, $operation)
649
+ {
650
+ $pluginInfo = $this->_getPluginsInfo('getExcludedAttributes');
651
+ if (!$pluginInfo) {
652
+ return parent::getExcludedAttributes($userType, $operation);
653
+ } else {
654
+ return $this->___callPlugins('getExcludedAttributes', func_get_args(), $pluginInfo);
655
+ }
656
+ }
657
+
658
+ /**
659
+ * {@inheritdoc}
660
+ */
661
+ public function getForcedAttributes()
662
+ {
663
+ $pluginInfo = $this->_getPluginsInfo('getForcedAttributes');
664
+ if (!$pluginInfo) {
665
+ return parent::getForcedAttributes();
666
+ } else {
667
+ return $this->___callPlugins('getForcedAttributes', func_get_args(), $pluginInfo);
668
+ }
669
+ }
670
+
671
+ /**
672
+ * {@inheritdoc}
673
+ */
674
+ public function getIncludedAttributes($userType, $operationType)
675
+ {
676
+ $pluginInfo = $this->_getPluginsInfo('getIncludedAttributes');
677
+ if (!$pluginInfo) {
678
+ return parent::getIncludedAttributes($userType, $operationType);
679
+ } else {
680
+ return $this->___callPlugins('getIncludedAttributes', func_get_args(), $pluginInfo);
681
+ }
682
+ }
683
+
684
+ /**
685
+ * {@inheritdoc}
686
+ */
687
+ public function getEntityOnlyAttributes($userType, $operationType)
688
+ {
689
+ $pluginInfo = $this->_getPluginsInfo('getEntityOnlyAttributes');
690
+ if (!$pluginInfo) {
691
+ return parent::getEntityOnlyAttributes($userType, $operationType);
692
+ } else {
693
+ return $this->___callPlugins('getEntityOnlyAttributes', func_get_args(), $pluginInfo);
694
+ }
695
+ }
696
+
697
+ /**
698
+ * {@inheritdoc}
699
+ */
700
+ public function getAvailableAttributesFromConfig()
701
+ {
702
+ $pluginInfo = $this->_getPluginsInfo('getAvailableAttributesFromConfig');
703
+ if (!$pluginInfo) {
704
+ return parent::getAvailableAttributesFromConfig();
705
+ } else {
706
+ return $this->___callPlugins('getAvailableAttributesFromConfig', func_get_args(), $pluginInfo);
707
+ }
708
+ }
709
+
710
+ /**
711
+ * {@inheritdoc}
712
+ */
713
+ public function getDbAttributes()
714
+ {
715
+ $pluginInfo = $this->_getPluginsInfo('getDbAttributes');
716
+ if (!$pluginInfo) {
717
+ return parent::getDbAttributes();
718
+ } else {
719
+ return $this->___callPlugins('getDbAttributes', func_get_args(), $pluginInfo);
720
+ }
721
+ }
722
+
723
+ /**
724
+ * {@inheritdoc}
725
+ */
726
+ public function getEavAttributes($onlyVisible = false, $excludeSystem = false)
727
+ {
728
+ $pluginInfo = $this->_getPluginsInfo('getEavAttributes');
729
+ if (!$pluginInfo) {
730
+ return parent::getEavAttributes($onlyVisible, $excludeSystem);
731
+ } else {
732
+ return $this->___callPlugins('getEavAttributes', func_get_args(), $pluginInfo);
733
+ }
734
+ }
735
+
736
+ /**
737
+ * {@inheritdoc}
738
+ */
739
+ protected function _getStore()
740
+ {
741
+ $pluginInfo = $this->_getPluginsInfo('_getStore');
742
+ if (!$pluginInfo) {
743
+ return parent::_getStore();
744
+ } else {
745
+ return $this->___callPlugins('_getStore', func_get_args(), $pluginInfo);
746
+ }
747
+ }
748
+
749
+ /**
750
+ * {@inheritdoc}
751
+ */
752
+ protected function _retrieve()
753
+ {
754
+ $pluginInfo = $this->_getPluginsInfo('_retrieve');
755
+ if (!$pluginInfo) {
756
+ return parent::_retrieve();
757
+ } else {
758
+ return $this->___callPlugins('_retrieve', func_get_args(), $pluginInfo);
759
+ }
760
+ }
761
+
762
+ /**
763
+ * {@inheritdoc}
764
+ */
765
+ protected function _applyCategoryFilter(Mage_Catalog_Model_Resource_Product_Collection $collection)
766
+ {
767
+ $pluginInfo = $this->_getPluginsInfo('_applyCategoryFilter');
768
+ if (!$pluginInfo) {
769
+ parent::_applyCategoryFilter($collection);
770
+ } else {
771
+ return $this->___callPlugins('_applyCategoryFilter', func_get_args(), $pluginInfo);
772
+ }
773
+ }
774
+
775
+ /**
776
+ * {@inheritdoc}
777
+ */
778
+ protected function _getProduct()
779
+ {
780
+ $pluginInfo = $this->_getPluginsInfo('_getProduct');
781
+ if (!$pluginInfo) {
782
+ return parent::_getProduct();
783
+ } else {
784
+ return $this->___callPlugins('_getProduct', func_get_args(), $pluginInfo);
785
+ }
786
+ }
787
+
788
+ /**
789
+ * {@inheritdoc}
790
+ */
791
+ protected function _setProduct(Mage_Catalog_Model_Product $product)
792
+ {
793
+ $pluginInfo = $this->_getPluginsInfo('_setProduct');
794
+ if (!$pluginInfo) {
795
+ parent::_setProduct($product);
796
+ } else {
797
+ return $this->___callPlugins('_setProduct', func_get_args(), $pluginInfo);
798
+ }
799
+ }
800
+
801
+ /**
802
+ * {@inheritdoc}
803
+ */
804
+ protected function _getCategoryById($categoryId)
805
+ {
806
+ $pluginInfo = $this->_getPluginsInfo('_getCategoryById');
807
+ if (!$pluginInfo) {
808
+ return parent::_getCategoryById($categoryId);
809
+ } else {
810
+ return $this->___callPlugins('_getCategoryById', func_get_args(), $pluginInfo);
811
+ }
812
+ }
813
+
814
+ /**
815
+ * {@inheritdoc}
816
+ */
817
+ protected function _getPrice($price, $includingTax = null, $shippingAddress = null,
818
+ $billingAddress = null, $ctc = null, $priceIncludesTax = null
819
+ )
820
+ {
821
+ $pluginInfo = $this->_getPluginsInfo('_getPrice');
822
+ if (!$pluginInfo) {
823
+ return parent::_getPrice($price, $includingTax, $shippingAddress, $billingAddress, $ctc, $priceIncludesTax);
824
+ } else {
825
+ return $this->___callPlugins('_getPrice', func_get_args(), $pluginInfo);
826
+ }
827
+ }
828
+
829
+ /**
830
+ * {@inheritdoc}
831
+ */
832
+ protected function _calculatePrice($price, $percent, $includeTax)
833
+ {
834
+ $pluginInfo = $this->_getPluginsInfo('_calculatePrice');
835
+ if (!$pluginInfo) {
836
+ return parent::_calculatePrice($price, $percent, $includeTax);
837
+ } else {
838
+ return $this->___callPlugins('_calculatePrice', func_get_args(), $pluginInfo);
839
+ }
840
+ }
841
+
842
+ /**
843
+ * {@inheritdoc}
844
+ */
845
+ protected function _getTierPrices()
846
+ {
847
+ $pluginInfo = $this->_getPluginsInfo('_getTierPrices');
848
+ if (!$pluginInfo) {
849
+ return parent::_getTierPrices();
850
+ } else {
851
+ return $this->___callPlugins('_getTierPrices', func_get_args(), $pluginInfo);
852
+ }
853
+ }
854
+
855
+ /**
856
+ * {@inheritdoc}
857
+ */
858
+ protected function _getCustomerGroupId()
859
+ {
860
+ $pluginInfo = $this->_getPluginsInfo('_getCustomerGroupId');
861
+ if (!$pluginInfo) {
862
+ return parent::_getCustomerGroupId();
863
+ } else {
864
+ return $this->___callPlugins('_getCustomerGroupId', func_get_args(), $pluginInfo);
865
+ }
866
+ }
867
+
868
+ /**
869
+ * {@inheritdoc}
870
+ */
871
+ protected function _applyTaxToPrice($price, $withTax = true)
872
+ {
873
+ $pluginInfo = $this->_getPluginsInfo('_applyTaxToPrice');
874
+ if (!$pluginInfo) {
875
+ return parent::_applyTaxToPrice($price, $withTax);
876
+ } else {
877
+ return $this->___callPlugins('_applyTaxToPrice', func_get_args(), $pluginInfo);
878
+ }
879
+ }
880
+
881
+ /**
882
+ * {@inheritdoc}
883
+ */
884
+ protected function _prepareProductForResponse(Mage_Catalog_Model_Product $product)
885
+ {
886
+ $pluginInfo = $this->_getPluginsInfo('_prepareProductForResponse');
887
+ if (!$pluginInfo) {
888
+ parent::_prepareProductForResponse($product);
889
+ } else {
890
+ return $this->___callPlugins('_prepareProductForResponse', func_get_args(), $pluginInfo);
891
+ }
892
+ }
893
+
894
+ /**
895
+ * {@inheritdoc}
896
+ */
897
+ protected function _filterOutArrayKeys(array $array, array $keys, $dropOrigKeys = false)
898
+ {
899
+ $pluginInfo = $this->_getPluginsInfo('_filterOutArrayKeys');
900
+ if (!$pluginInfo) {
901
+ return parent::_filterOutArrayKeys($array, $keys, $dropOrigKeys);
902
+ } else {
903
+ return $this->___callPlugins('_filterOutArrayKeys', func_get_args(), $pluginInfo);
904
+ }
905
+ }
906
+
907
+ /**
908
+ * {@inheritdoc}
909
+ */
910
+ protected function _retrieveCollection()
911
+ {
912
+ $pluginInfo = $this->_getPluginsInfo('_retrieveCollection');
913
+ if (!$pluginInfo) {
914
+ return parent::_retrieveCollection();
915
+ } else {
916
+ return $this->___callPlugins('_retrieveCollection', func_get_args(), $pluginInfo);
917
+ }
918
+ }
919
+
920
+ /**
921
+ * {@inheritdoc}
922
+ */
923
+ protected function _delete()
924
+ {
925
+ $pluginInfo = $this->_getPluginsInfo('_delete');
926
+ if (!$pluginInfo) {
927
+ parent::_delete();
928
+ } else {
929
+ return $this->___callPlugins('_delete', func_get_args(), $pluginInfo);
930
+ }
931
+ }
932
+
933
+ /**
934
+ * {@inheritdoc}
935
+ */
936
+ protected function _create(array $data)
937
+ {
938
+ $pluginInfo = $this->_getPluginsInfo('_create');
939
+ if (!$pluginInfo) {
940
+ return parent::_create($data);
941
+ } else {
942
+ return $this->___callPlugins('_create', func_get_args(), $pluginInfo);
943
+ }
944
+ }
945
+
946
+ /**
947
+ * {@inheritdoc}
948
+ */
949
+ protected function _update(array $data)
950
+ {
951
+ $pluginInfo = $this->_getPluginsInfo('_update');
952
+ if (!$pluginInfo) {
953
+ parent::_update($data);
954
+ } else {
955
+ return $this->___callPlugins('_update', func_get_args(), $pluginInfo);
956
+ }
957
+ }
958
+
959
+ /**
960
+ * {@inheritdoc}
961
+ */
962
+ protected function _isManageStockEnabled($stockData)
963
+ {
964
+ $pluginInfo = $this->_getPluginsInfo('_isManageStockEnabled');
965
+ if (!$pluginInfo) {
966
+ return parent::_isManageStockEnabled($stockData);
967
+ } else {
968
+ return $this->___callPlugins('_isManageStockEnabled', func_get_args(), $pluginInfo);
969
+ }
970
+ }
971
+
972
+ /**
973
+ * {@inheritdoc}
974
+ */
975
+ protected function _isConfigValueUsed($data, $field)
976
+ {
977
+ $pluginInfo = $this->_getPluginsInfo('_isConfigValueUsed');
978
+ if (!$pluginInfo) {
979
+ return parent::_isConfigValueUsed($data, $field);
980
+ } else {
981
+ return $this->___callPlugins('_isConfigValueUsed', func_get_args(), $pluginInfo);
982
+ }
983
+ }
984
+
985
+ /**
986
+ * {@inheritdoc}
987
+ */
988
+ protected function _prepareDataForSave($product, $productData)
989
+ {
990
+ $pluginInfo = $this->_getPluginsInfo('_prepareDataForSave');
991
+ if (!$pluginInfo) {
992
+ parent::_prepareDataForSave($product, $productData);
993
+ } else {
994
+ return $this->___callPlugins('_prepareDataForSave', func_get_args(), $pluginInfo);
995
+ }
996
+ }
997
+
998
+ /**
999
+ * {@inheritdoc}
1000
+ */
1001
+ protected function _filterStockData(&$stockData)
1002
+ {
1003
+ $pluginInfo = $this->_getPluginsInfo('_filterStockData');
1004
+ if (!$pluginInfo) {
1005
+ parent::_filterStockData($stockData);
1006
+ } else {
1007
+ return $this->___callPlugins('_filterStockData', func_get_args(), $pluginInfo);
1008
+ }
1009
+ }
1010
+
1011
+ /**
1012
+ * {@inheritdoc}
1013
+ */
1014
+ protected function _filterConfigValueUsed(&$data, $fields)
1015
+ {
1016
+ $pluginInfo = $this->_getPluginsInfo('_filterConfigValueUsed');
1017
+ if (!$pluginInfo) {
1018
+ parent::_filterConfigValueUsed($data, $fields);
1019
+ } else {
1020
+ return $this->___callPlugins('_filterConfigValueUsed', func_get_args(), $pluginInfo);
1021
+ }
1022
+ }
1023
+
1024
+ /**
1025
+ * {@inheritdoc}
1026
+ */
1027
+ protected function _isAllowedAttribute($attribute, $attributes = null)
1028
+ {
1029
+ $pluginInfo = $this->_getPluginsInfo('_isAllowedAttribute');
1030
+ if (!$pluginInfo) {
1031
+ return parent::_isAllowedAttribute($attribute, $attributes);
1032
+ } else {
1033
+ return $this->___callPlugins('_isAllowedAttribute', func_get_args(), $pluginInfo);
1034
+ }
1035
+ }
1036
+ //======================================= Start Auto-generated Code ======================================//
1037
+ }
app/code/community/Sellbrite/Api/Model/Catalog/Product/Api.php DELETED
@@ -1,109 +0,0 @@
1
- <?php
2
-
3
- class Sellbrite_Api_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api
4
- {
5
- public function create($type, $set, $sku, $productData, $store = null)
6
- {
7
- // Allow attribute set name instead of id
8
- if (is_string($set) && !is_numeric($set)) {
9
- $set = Mage::helper('sellbrite_api')->getAttributeSetIdByName($set);
10
- }
11
-
12
- return parent::create($type, $set, $sku, $productData, $store);
13
- }
14
-
15
- protected function _prepareDataForSave($product, $productData)
16
- {
17
- /* @var $product Mage_Catalog_Model_Product */
18
-
19
- if (isset($productData['categories'])) {
20
- $categoryIds = Mage::helper('sellbrite_api/catalog_product')
21
- ->getCategoryIdsByNames((array) $productData['categories']);
22
- if (!empty($categoryIds)) {
23
- $productData['categories'] = array_unique($categoryIds);
24
- }
25
- }
26
-
27
- if (isset($productData['website_ids'])) {
28
- $websiteIds = $productData['website_ids'];
29
- foreach ($websiteIds as $i => $websiteId) {
30
- if (!is_numeric($websiteId)) {
31
- $website = Mage::app()->getWebsite($websiteId);
32
- if ($website->getId()) {
33
- $websiteIds[$i] = $website->getId();
34
- }
35
- }
36
- }
37
- $product->setWebsiteIds($websiteIds);
38
- unset($productData['website_ids']);
39
- }
40
-
41
- foreach ($productData as $code => $value) {
42
- $productData[$code] = Mage::helper('sellbrite_api/catalog_product')
43
- ->getOptionKeyByLabel($code, $value);
44
- }
45
-
46
- parent::_prepareDataForSave($product, $productData);
47
-
48
- if (isset($productData['associated_skus'])) {
49
- $simpleSkus = $productData['associated_skus'];
50
- $priceChanges = isset($productData['price_changes']) ? $productData['price_changes'] : array();
51
- $configurableAttributes = isset($productData['configurable_attributes']) ? $productData['configurable_attributes'] : array();
52
- Mage::helper('sellbrite_api/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges, $configurableAttributes);
53
- }
54
- }
55
-
56
- /**
57
- * Retrieve product info
58
- *
59
- * @param int|string $productId
60
- * @param string|int $store
61
- * @param array $attributes
62
- * @param string $identifierType
63
- * @return array
64
- */
65
- public function info($productId, $store = null, $attributes = null, $identifierType = null)
66
- {
67
- // make sku flag case-insensitive
68
- if (!empty($identifierType)) {
69
- $identifierType = strtolower($identifierType);
70
- }
71
-
72
- $product = $this->_getProduct($productId, $store, $identifierType);
73
-
74
- $result = array( // Basic product data
75
- 'product_id' => $product->getId(),
76
- // 'sku' => $product->getSku(),
77
- 'set' => $product->getAttributeSetId(),
78
- 'type' => $product->getTypeId(),
79
- 'categories' => $product->getCategoryIds(),
80
- 'websites' => $product->getWebsiteIds()
81
- );
82
-
83
- if ($product->isConfigurable()) {
84
- $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
85
-
86
- $result['configurable_attributes'] = array();
87
- $configurableAttributes = $conf->getConfigurableAttributesAsArray();
88
- foreach ($configurableAttributes as $confAttr) {
89
- $result['configurable_attributes'][] = $confAttr['attribute_code'];
90
- }
91
-
92
- $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
93
-
94
- $result['associated_skus'] = array();
95
- foreach($simple_collection as $simple_product){
96
- $result['associated_skus'][] = $simple_product->getSku();
97
- }
98
- }
99
-
100
- foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
101
- if ($this->_isAllowedAttribute($attribute, $attributes)) {
102
- $result[$attribute->getAttributeCode()] = $product->getData(
103
- $attribute->getAttributeCode());
104
- }
105
- }
106
-
107
- return $result;
108
- }
109
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sellbrite/Api/Model/Catalog/Product/Api/V2.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
-
3
- class Sellbrite_Api_Model_Catalog_Product_Api_V2 extends Mage_Catalog_Model_Product_Api_V2
4
- {
5
- public function create($type, $set, $sku, $productData, $store = null)
6
- {
7
- // Allow attribute set name instead of id
8
- if (is_string($set) && !is_numeric($set)) {
9
- $set = Mage::helper('sellbrite_api')->getAttributeSetIdByName($set);
10
- }
11
-
12
- return parent::create($type, $set, $sku, $productData, $store);
13
- }
14
-
15
- protected function _prepareDataForSave($product, $productData)
16
- {
17
- /* @var $product Mage_Catalog_Model_Product */
18
-
19
- if (property_exists($productData, 'categories')) {
20
- $categoryIds = Mage::helper('sellbrite_api/catalog_product')
21
- ->getCategoryIdsByNames((array) $productData->categories);
22
- if (!empty($categoryIds)) {
23
- $productData->categories = array_unique($categoryIds);
24
- }
25
- }
26
-
27
- if (property_exists($productData, 'additional_attributes')) {
28
- $singleDataExists = property_exists((object) $productData->additional_attributes, 'single_data');
29
- $multiDataExists = property_exists((object) $productData->additional_attributes, 'multi_data');
30
- if ($singleDataExists || $multiDataExists) {
31
- if ($singleDataExists) {
32
- foreach ($productData->additional_attributes->single_data as $_attribute) {
33
- $_attrCode = $_attribute->key;
34
- $productData->$_attrCode = Mage::helper('sellbrite_api/catalog_product')
35
- ->getOptionKeyByLabel($_attrCode, $_attribute->value);
36
- }
37
- }
38
- if ($multiDataExists) {
39
- foreach ($productData->additional_attributes->multi_data as $_attribute) {
40
- $_attrCode = $_attribute->key;
41
- $productData->$_attrCode = Mage::helper('sellbrite_api/catalog_product')
42
- ->getOptionKeyByLabel($_attrCode, $_attribute->value);
43
- }
44
- }
45
- } else {
46
- foreach ($productData->additional_attributes as $_attrCode => $_value) {
47
- $productData->$_attrCode = Mage::helper('sellbrite_api/catalog_product')
48
- ->getOptionKeyByLabel($_attrCode, $_value);
49
- }
50
- }
51
- unset($productData->additional_attributes);
52
- }
53
-
54
- if (property_exists($productData, 'website_ids')) {
55
- $websiteIds = (array) $productData->website_ids;
56
- foreach ($websiteIds as $i => $websiteId) {
57
- if (!is_numeric($websiteId)) {
58
- $website = Mage::app()->getWebsite($websiteId);
59
- if ($website->getId()) {
60
- $websiteIds[$i] = $website->getId();
61
- }
62
- }
63
- }
64
- $product->setWebsiteIds($websiteIds);
65
- unset($productData->website_ids);
66
- }
67
-
68
- parent::_prepareDataForSave($product, $productData);
69
-
70
- if (property_exists($productData, 'associated_skus')) {
71
- $simpleSkus = (array) $productData->associated_skus;
72
- $priceChanges = array();
73
- if (property_exists($productData, 'price_changes')) {
74
- if (key($productData->price_changes) === 0) {
75
- $priceChanges = $productData->price_changes[0];
76
- } else {
77
- $priceChanges = $productData->price_changes;
78
- }
79
- }
80
- $configurableAttributes = array();
81
- if (property_exists($productData, 'configurable_attributes')) {
82
- $configurableAttributes = $productData->configurable_attributes;
83
- }
84
- Mage::helper('sellbrite_api/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges, $configurableAttributes);
85
- }
86
- }
87
-
88
- /**
89
- * Retrieve product info
90
- *
91
- * @param int|string $productId
92
- * @param string|int $store
93
- * @param array $attributes
94
- * @param string $identifierType
95
- * @return array
96
- */
97
- public function info($productId, $store = null, $attributes = null, $identifierType = null)
98
- {
99
- // make sku flag case-insensitive
100
- if (!empty($identifierType)) {
101
- $identifierType = strtolower($identifierType);
102
- }
103
-
104
- $product = $this->_getProduct($productId, $store, $identifierType);
105
-
106
- $result = array( // Basic product data
107
- 'product_id' => $product->getId(),
108
- // 'sku' => $product->getSku(),
109
- 'set' => $product->getAttributeSetId(),
110
- 'type' => $product->getTypeId(),
111
- 'categories' => $product->getCategoryIds(),
112
- 'websites' => $product->getWebsiteIds(),
113
- 'prod_options' => $product->getProductOptionCollection(),
114
- );
115
-
116
- if ($product->isConfigurable()) {
117
- $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
118
-
119
- $result['configurable_attributes'] = array();
120
- $configurableAttributes = $conf->getConfigurableAttributesAsArray();
121
- foreach ($configurableAttributes as $confAttr) {
122
- $result['configurable_attributes'][] = $confAttr['attribute_code'];
123
- }
124
-
125
- $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
126
-
127
- foreach($simple_collection as $simple_product){
128
- $result['associated_product_ids'][] = $simple_product->getId();
129
- }
130
- }
131
-
132
- foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
133
- if ($this->_isAllowedAttribute($attribute, $attributes)) {
134
- $result[$attribute->getAttributeCode()] = $product->getData(
135
- $attribute->getAttributeCode());
136
- }
137
- }
138
-
139
- $allAttributes = array();
140
- if (!empty($attributes->attributes)) {
141
- $allAttributes = array_merge($allAttributes, $attributes->attributes);
142
- } else {
143
- foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
144
- if ($this->_isAllowedAttribute($attribute, $attributes)) {
145
- $allAttributes[] = $attribute->getAttributeCode();
146
- }
147
- }
148
- }
149
-
150
- $_additionalAttributeCodes = array();
151
- if (!empty($attributes->additional_attributes)) {
152
- foreach ($attributes->additional_attributes as $k => $_attributeCode) {
153
- $allAttributes[] = $_attributeCode;
154
- $_additionalAttributeCodes[] = $_attributeCode;
155
- }
156
- }
157
-
158
- $_additionalAttribute = 0;
159
- foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
160
- if ($this->_isAllowedAttribute($attribute, $allAttributes)) {
161
- if (in_array($attribute->getAttributeCode(), $_additionalAttributeCodes)) {
162
- $result['additional_attributes'][$_additionalAttribute]['key'] = $attribute->getAttributeCode();
163
- $result['additional_attributes'][$_additionalAttribute]['value'] = $product
164
- ->getData($attribute->getAttributeCode());
165
- $_additionalAttribute++;
166
- } else {
167
- $result[$attribute->getAttributeCode()] = $product->getData($attribute->getAttributeCode());
168
- }
169
- }
170
- }
171
-
172
- return $result;
173
- }
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sellbrite/Api/Model/Catalog/Product/Format/ProductType/Configurable.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Catalog_Product_Format_ProductType_Configurable
4
+ *
5
+ * REST API output format decorator for Configurable product type
6
+ */
7
+ class Sellbrite_Api_Model_Catalog_Product_Format_ProductType_Configurable
8
+ {
9
+ /**
10
+ * Extend product item data with variations information
11
+ *
12
+ * @param array $productData
13
+ * @return array
14
+ */
15
+ public function apply($productData)
16
+ {
17
+ /** @var Mage_Catalog_Model_Product $product */
18
+ $product = Mage::getModel('catalog/product')->load($productData['entity_id']);
19
+ /** @var Mage_Catalog_Model_Product_Type_Configurable $typeInstance */
20
+ $typeInstance = $product->getTypeInstance();
21
+ $attributes = $typeInstance->getConfigurableAttributesAsArray($product);
22
+ $variationKeys = array_map(
23
+ function ($item) {
24
+ return $item['attribute_code'];
25
+ },
26
+ $attributes
27
+ );
28
+ $variationPrices = array();
29
+ foreach ($attributes as $attribute) {
30
+ foreach ($attribute['values'] as $value) {
31
+ $variationPrices[$value['value_index']] = array(
32
+ 'price' => $value['pricing_value'],
33
+ 'is_percent' => $value['is_percent']
34
+ );
35
+ }
36
+ }
37
+ $productData['variation_keys'] = $variationKeys;
38
+ $variations = array_map(
39
+ function (Mage_Catalog_Model_Product $productItem) use ($variationKeys, $variationPrices, $product) {
40
+ $result = array(
41
+ 'entity_id' => $productItem->getId(),
42
+ 'sku' => $productItem->getSku(),
43
+ 'price' => 0,
44
+ );
45
+ foreach ($variationKeys as $key) {
46
+ $result['variation_fields'][$key] = $productItem->getAttributeText($key);
47
+ $priceKey = $productItem->getData($key);
48
+ if (isset($variationPrices[$priceKey])) {
49
+ $priceData = $variationPrices[$priceKey];
50
+ if ($priceData['is_percent']) {
51
+ $optionPrice = $product->getFinalPrice() * ($priceData['price'] / 100.00);
52
+ } else {
53
+ $optionPrice = $priceData['price'];
54
+ }
55
+ $result['price'] += $optionPrice;
56
+ }
57
+ }
58
+ $result['price'] += $product->getFinalPrice();
59
+
60
+ /** @var Mage_CatalogInventory_Model_Stock_Item $stock */
61
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productItem);
62
+ $result['quantity'] = $stock->getQty();
63
+ return $result;
64
+ },
65
+ $typeInstance->getUsedProducts(null, $product)
66
+ );
67
+ $productData['variations'] = $variationPrices;
68
+ $productData['variations'] = $variations;
69
+ return $productData;
70
+ }
71
+ }
app/code/community/Sellbrite/Api/Model/Catalog/Product/Plugin.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Catalog_Product_Plugin
4
+ *
5
+ * How To Extend a Logic of This Class?
6
+ *
7
+ * This class is designed as a Plugin for Mage_Catalog_Model_Api2_Product_Rest_Admin_V1 model
8
+ * Decorates REST API output format for all product types.
9
+ *
10
+ * If you need to add/override output decorator for any product type, please, add configuration to the config.xml file
11
+ * in the following format:
12
+ * <config>
13
+ * <global>
14
+ * <compositions>
15
+ * <product_type_plugin>
16
+ * <{product_type_id}>namespace_module/class_name</{product_type_id}>
17
+ * </product_type_plugin>
18
+ * </compositions>
19
+ * </global>
20
+ * </config>
21
+ *
22
+ * where {product_type_id} - Product Type Code: simple, configurable, grouped, virtual, etc...
23
+ */
24
+ class Sellbrite_Api_Model_Catalog_Product_Plugin
25
+ {
26
+ /**
27
+ * Customize output product format
28
+ *
29
+ * @param array $item
30
+ * @return array
31
+ */
32
+ public function invokeAfter(array $item)
33
+ {
34
+ $composition = Mage::getConfig()->getNode('global/compositions/product_type_plugin')->asArray();
35
+ if (isset($composition[$item['type_id']])) {
36
+ $item = Mage::getSingleton($composition[$item['type_id']])->apply($item);
37
+ }
38
+ return $item;
39
+ }
40
+ }
app/code/community/Sellbrite/Api/Model/Catalog/ProductCollection/Plugin.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Catalog_ProductCollection_Plugin
4
+ *
5
+ * How To Extend a Logic of This Class?
6
+ *
7
+ * This class is designed as a Plugin for Mage_Catalog_Model_Api2_Product_Rest_Admin_V1 model
8
+ * Decorates REST API output format for all product types.
9
+ *
10
+ * If you need to add/override output decorator for any product type, please, add configuration to the config.xml file
11
+ * in the following format:
12
+ * <config>
13
+ * <global>
14
+ * <compositions>
15
+ * <product_type_plugin>
16
+ * <{product_type_id}>namespace_module/class_name</{product_type_id}>
17
+ * </product_type_plugin>
18
+ * </compositions>
19
+ * </global>
20
+ * </config>
21
+ *
22
+ * where {product_type_id} - Product Type Code: simple, configurable, grouped, virtual, etc...
23
+ */
24
+ class Sellbrite_Api_Model_Catalog_ProductCollection_Plugin
25
+ {
26
+ /**
27
+ * Customize output product format
28
+ *
29
+ * @param array $result
30
+ * @return array
31
+ */
32
+ public function invokeAfter(array $result)
33
+ {
34
+ $composition = Mage::getConfig()->getNode('global/compositions/product_type_plugin')->asArray();
35
+
36
+ foreach ($result as &$item) {
37
+ if (isset($composition[$item['type_id']])) {
38
+ $item = Mage::getSingleton($composition[$item['type_id']])->apply($item);
39
+ }
40
+ }
41
+ return $result;
42
+ }
43
+ }
app/code/community/Sellbrite/Api/Model/Credentials.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Credentials
4
+ *
5
+ * Data Model for API credentials
6
+ */
7
+ class Sellbrite_Api_Model_Credentials
8
+ {
9
+ const AUTH_NAME = 'Sellbrite';
10
+
11
+ /**
12
+ * Sellbrite end point URL
13
+ *
14
+ * @var string
15
+ */
16
+ private $endPointURL;
17
+
18
+ /**
19
+ * Merchant API key
20
+ *
21
+ * @var string
22
+ */
23
+ protected $apiKey;
24
+
25
+ /**
26
+ * Merchant site URL
27
+ *
28
+ * @var string
29
+ */
30
+ protected $siteURL;
31
+
32
+ /**
33
+ * Consumer key
34
+ *
35
+ * @var string
36
+ */
37
+ protected $consumerKey;
38
+
39
+ /**
40
+ * Consumer secret
41
+ *
42
+ * @var string
43
+ */
44
+ protected $consumerSecret;
45
+
46
+ /**
47
+ * Get access token
48
+ *
49
+ * @var string
50
+ */
51
+ protected $accessToken;
52
+
53
+ /**
54
+ * Get SOAP user
55
+ *
56
+ * @var string
57
+ */
58
+ protected $soapUser;
59
+
60
+ /**
61
+ * Get access secret
62
+ *
63
+ * @var string
64
+ */
65
+ protected $accessSecret;
66
+
67
+ public function __construct()
68
+ {
69
+ $this->apiKey = Mage::getStoreConfig('sellbrite_api/config/api_key');
70
+ $this->siteURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
71
+
72
+ $apiUser = Mage::getModel('api/user');
73
+ $apiUser->loadByUsername(self::AUTH_NAME);
74
+ $this->soapUser = $apiUser->getUsername();
75
+
76
+ /** @var $consumer Mage_Oauth_Model_Consumer */
77
+ $consumer = Mage::getModel('oauth/consumer');
78
+ $consumer->load(self::AUTH_NAME, 'name');
79
+ $this->consumerKey = $consumer->getKey();
80
+ $this->consumerSecret = $consumer->getSecret();
81
+
82
+ /** @var Mage_Admin_Model_User $adminUser */
83
+ $adminUser = Mage::getModel('admin/user');
84
+ $adminUser->loadByUsername(self::AUTH_NAME);
85
+
86
+ /** @var Mage_Oauth_Model_Resource_Token_Collection $collection */
87
+ $collection = Mage::getResourceModel('oauth/token_collection');
88
+ $collection->addFilterByAdminId((int) $adminUser->getId());
89
+ $collection->addFilterByConsumerId((int) $consumer->getId());
90
+ /** @var Mage_Oauth_Model_Token $token */
91
+ $token = $collection->getFirstItem();
92
+ $this->accessToken = $token->getToken();
93
+ $this->accessSecret = $token->getSecret();
94
+ $this->endPointURL = (string) Mage::getConfig()->getNode('default/sellbrite_endpoint_url');
95
+ }
96
+
97
+ /**
98
+ * Get API Key
99
+ *
100
+ * @return string
101
+ */
102
+ public function getApiKey()
103
+ {
104
+ return $this->apiKey;
105
+ }
106
+
107
+ /**
108
+ * Get Soap User Name
109
+ *
110
+ * @return string
111
+ */
112
+ public function getSoapUser()
113
+ {
114
+ return $this->soapUser;
115
+ }
116
+
117
+ /**
118
+ * Get site URL
119
+ *
120
+ * @return string
121
+ */
122
+ public function getSiteURL()
123
+ {
124
+ return $this->siteURL;
125
+ }
126
+
127
+ /**
128
+ * Get end point URL
129
+ *
130
+ * @return string
131
+ */
132
+ public function getEndPointURL()
133
+ {
134
+ return $this->endPointURL;
135
+ }
136
+
137
+ /**
138
+ * Get consumer key
139
+ *
140
+ * @return string
141
+ */
142
+ public function getConsumerKey()
143
+ {
144
+ return $this->consumerKey;
145
+ }
146
+
147
+ /**
148
+ * Get consumer secret
149
+ *
150
+ * @return string
151
+ */
152
+ public function getConsumerSecret()
153
+ {
154
+ return $this->consumerSecret;
155
+ }
156
+
157
+ /**
158
+ * Get access secret
159
+ *
160
+ * @return string
161
+ */
162
+ public function getAccessSecret()
163
+ {
164
+ return $this->accessSecret;
165
+ }
166
+
167
+ /**
168
+ * Get access key
169
+ *
170
+ * @return string
171
+ */
172
+ public function getAccessToken()
173
+ {
174
+ return $this->accessToken;
175
+ }
176
+ }
app/code/community/Sellbrite/Api/Model/Resource/Token.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Resource_Token
4
+ */
5
+ class Sellbrite_Api_Model_Resource_Token extends Mage_Oauth_Model_Resource_Token
6
+ {
7
+ /**
8
+ * Retrieve oauth token using customer id
9
+ *
10
+ * @param Mage_Oauth_Model_Token $token
11
+ * @return Mage_Oauth_Model_Token
12
+ */
13
+ public function getTokenForCustomer(Mage_Oauth_Model_Token $token)
14
+ {
15
+ if (!$token->getId() || !$token->getCustomerId()) {
16
+ //return original data
17
+ return $token;
18
+ }
19
+ $_oldCallbackUrl = $token->getCallbackUrl();
20
+ $select = $this->_getWriteAdapter()->select()
21
+ ->from($this->getMainTable(), array('entity_id'))
22
+ ->where('authorized = 1')
23
+ ->where('type = ?', 'access')
24
+ ->where('entity_id <> ?', $token->getId())
25
+ ->where('customer_id = ?', $token->getCustomerId());
26
+ $tokenId = $this->_getWriteAdapter()->fetchOne($select);
27
+ if ($tokenId) {
28
+ $this->load($token,$tokenId);
29
+ $token->setCallbackUrl($_oldCallbackUrl);
30
+ }
31
+ return $this;
32
+ }
33
+ }
app/code/community/Sellbrite/Api/Model/Token.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Sellbrite_Api_Model_Token
4
+ *
5
+ * @method Sellbrite_Api_Model_Resource_Token getResource
6
+ */
7
+ class Sellbrite_Api_Model_Token extends Mage_Oauth_Model_Token
8
+ {
9
+ /**
10
+ * Authorize token
11
+ *
12
+ * @param int $userId Authorization user identifier
13
+ * @param string $userType Authorization user type
14
+ * @return Mage_Oauth_Model_Token
15
+ */
16
+ public function authorize($userId, $userType)
17
+ {
18
+ if (!$this->getId() || !$this->getConsumerId()) {
19
+ Mage::throwException('Token is not ready to be authorized');
20
+ }
21
+ if ($this->getAuthorized()) {
22
+ Mage::throwException('Token is already authorized');
23
+ }
24
+ if (self::USER_TYPE_ADMIN == $userType) {
25
+ $this->setAdminId($userId);
26
+ } elseif (self::USER_TYPE_CUSTOMER == $userType) {
27
+ $this->setCustomerId($userId);
28
+ } else {
29
+ Mage::throwException('User type is unknown');
30
+ }
31
+ /** @var $helper Mage_Oauth_Helper_Data */
32
+ $helper = Mage::helper('oauth');
33
+ if ($this->getCustomerId()) {
34
+ /**
35
+ * override parent logic not to return different token for the same customer account
36
+ */
37
+ $this->getResource()->getTokenForCustomer($this);
38
+ }
39
+ if (!$this->getCustomerId() || ($this->getCustomerId() && $this->getType() != self::TYPE_ACCESS)) {
40
+ $this->setVerifier($helper->generateVerifier());
41
+ }
42
+
43
+ $this->setAuthorized(1);
44
+ $this->save();
45
+ $this->getResource()->cleanOldAuthorizedTokensExcept($this);
46
+
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * Convert token to access type
52
+ *
53
+ * @return Mage_Oauth_Model_Token
54
+ */
55
+ public function convertToAccess()
56
+ {
57
+ /**
58
+ * customization to allow the same token for difference devices
59
+ */
60
+ if ($this->getType() != self::TYPE_ACCESS && self::TYPE_REQUEST != $this->getType()) {
61
+ Mage::throwException('Can not convert due to token is not request type');
62
+ }
63
+
64
+ /** @var $helper Mage_Oauth_Helper_Data */
65
+ $helper = Mage::helper('oauth');
66
+ /**
67
+ * customization to allow the same token
68
+ * we will only save when it is a new token
69
+ */
70
+ if ($this->getType() != self::TYPE_ACCESS) {
71
+ $this->setType(self::TYPE_ACCESS);
72
+ $this->setToken($helper->generateToken());
73
+ $this->setSecret($helper->generateTokenSecret());
74
+ $this->save();
75
+ }
76
+ return $this;
77
+ }
78
+ }
app/code/community/Sellbrite/Api/data/sellbrite_setup/data-install-1.1.0.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Install Sellbrite API data fixtures
4
+ * Required entities:
5
+ * - Consumer APP
6
+ * - Grand Admin user type with ALL privileges
7
+ * - Rest Role with all privileges granted
8
+ * - Rest User
9
+ * - Access Token
10
+ */
11
+
12
+ //I. Create REST API Credentials
13
+ $chars = Mage_Core_Helper_Data::CHARS_PASSWORD_LOWERS
14
+ . Mage_Core_Helper_Data::CHARS_PASSWORD_UPPERS
15
+ . Mage_Core_Helper_Data::CHARS_PASSWORD_DIGITS
16
+ . Mage_Core_Helper_Data::CHARS_PASSWORD_SPECIALS;
17
+ /** @var $helper Mage_Oauth_Helper_Data */
18
+ $helper = Mage::helper('oauth');
19
+ /** @var Mage_Core_Helper_Data $generator */
20
+ $generator = Mage::helper('core');
21
+
22
+ //======================= Predefined values ======================//
23
+ $authName = Sellbrite_Api_Model_Credentials::AUTH_NAME;
24
+ $adminEmail = 'magento@sellbrite.com';
25
+ $callBackURL = Mage::getBaseUrl();
26
+ $adminPassword = $generator->getRandomString(8, $chars);
27
+ //================================================================//
28
+
29
+ /** 1. Create consumer app in Magento */
30
+ /** @var $consumer Mage_Oauth_Model_Consumer */
31
+ $consumer = Mage::getModel('oauth/consumer');
32
+ $consumer->load($authName, 'name');
33
+ if (!$consumer->getId()) {
34
+ $consumer->setKey($helper->generateConsumerKey());
35
+ $consumer->setSecret($helper->generateConsumerSecret());
36
+ $consumer->setName($authName);
37
+ $consumer->save();
38
+ }
39
+
40
+ /** 2. Update REST admin attributes to have access to All */
41
+ /** @var $attribute Mage_Api2_Model_Acl_Filter_Attribute */
42
+ $attribute = Mage::getModel('api2/acl_filter_attribute');
43
+ /** @var $collection Mage_Api2_Model_Resource_Acl_Filter_Attribute_Collection */
44
+ $collection = $attribute->getCollection();
45
+ //Clean up existing resources if any
46
+ $collection->addFilterByUserType('admin');
47
+ /** @var $model Mage_Api2_Model_Acl_Filter_Attribute */
48
+ foreach ($collection as $model) {
49
+ $model->delete();
50
+ }
51
+ $attribute->setUserType('admin');
52
+ $attribute->setResourceId(Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL);
53
+ $attribute->save();
54
+
55
+ /** 3. Create REST role with all permissions */
56
+
57
+ /** @var $role Mage_Api2_Model_Acl_Global_Role */
58
+ $role = Mage::getModel('api2/acl_global_role');
59
+ $role->load($authName, 'role_name');
60
+ if (!$role->getId()) {
61
+ $role->setRoleName($authName);
62
+ $role->save();
63
+ } else {
64
+ //Remove existing rule if any
65
+ /** @var Mage_Api2_Model_Resource_Acl_Global_Rule_Collection $ruleCollection */
66
+ $ruleCollection = Mage::getResourceModel('api2/acl_global_rule_collection');
67
+ $ruleCollection->addFilterByRoleId($role->getId());
68
+ /** @var $ruleModel Mage_Api2_Model_Acl_Global_Rule */
69
+ foreach ($collection as $ruleModel) {
70
+ $ruleModel->delete();
71
+ }
72
+ }
73
+ //Create new rule
74
+ /** @var $rule Mage_Api2_Model_Acl_Global_Rule */
75
+ $rule = Mage::getModel('api2/acl_global_rule');
76
+ $rule->setRoleId($role->getId());
77
+ $rule->setResourceId(Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL);
78
+ $rule->save();
79
+
80
+ /** 4. Create admin user and associate with REST role */
81
+ /** @var Mage_Admin_Model_User $adminUser */
82
+ $adminUser = Mage::getModel('admin/user');
83
+ $adminUser->loadByUsername($authName);
84
+ if (!$adminUser->getId()) {
85
+ $adminUser->setUsername($authName);
86
+ $adminUser->setFirstname($authName);
87
+ $adminUser->setLastname($authName);
88
+ $adminUser->setEmail($adminEmail);
89
+ $adminUser->setPassword($adminPassword);
90
+ $adminUser->setIsActive(1);
91
+ $adminUser->save();
92
+ }
93
+
94
+ /** @var $resourceModel Mage_Api2_Model_Resource_Acl_Global_Role */
95
+ $resourceModel = Mage::getResourceModel('api2/acl_global_role');
96
+ //Create/update relation row of admin user to API2 role
97
+ $resourceModel->saveAdminToRoleRelation($adminUser->getId(), $role->getId());
98
+
99
+
100
+ /** 5. Associate this admin user to work with the created app */
101
+ /** @var Mage_Oauth_Model_Token $token */
102
+ $token = Mage::getModel('oauth/token');
103
+ $token->setConsumerId($consumer->getId());
104
+ $token->setAdminId($adminUser->getId());
105
+ $token->setType(Mage_Oauth_Model_Token::TYPE_ACCESS);
106
+ $token->setToken($helper->generateToken());
107
+ $token->setSecret($helper->generateTokenSecret());
108
+ $token->setCallbackUrl($callBackURL);
109
+ $token->setVerifier($helper->generateVerifier());
110
+ $token->setAuthorized(1);
111
+ $token->save();
112
+
113
+ //Clean up old authorized tokens for specified consumer-user pairs
114
+ $token->getResource()->cleanOldAuthorizedTokensExcept($token);
115
+
116
+ //II. Create SOAP API Credentials
117
+ //1. Generate API key
118
+ $apiKey = Mage::getStoreConfig('sellbrite_api/config/api_key');
119
+ if( !$apiKey || strlen($apiKey) < 32 ){
120
+ $apiKey = md5(uniqid(rand(), true));
121
+ $config = new Mage_Core_Model_Config();
122
+ $config ->saveConfig('sellbrite_api/config/api_key', $apiKey, 'default', 0);
123
+ }
124
+
125
+ //2. Create API Role
126
+ /** @var Mage_Api_Model_Resource_Roles_Collection $roleCollection */
127
+ $roleCollection = Mage::getModel('api/roles')->getCollection();
128
+ $roleCollection->addFieldToFilter('role_name', $authName);
129
+ $roleCollection->setPageSize(1);
130
+ $apiRole = $roleCollection->fetchItem();
131
+ if (!$apiRole) {
132
+ //create new role
133
+ /** @var Mage_Api_Model_Roles $role */
134
+ $apiRole = Mage::getModel("api/roles");
135
+ $apiRole->setName($authName);
136
+ $apiRole->setRoleType('G');
137
+ $apiRole->save();
138
+
139
+ //give "all" privileges to role
140
+ /** @var Mage_Api_Model_Rules $rule */
141
+ $rule = Mage::getModel("api/rules");
142
+ $rule->setRoleId($apiRole->getId());
143
+ $rule->setResources(array(Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL));
144
+ $rule->saveRel();
145
+ }
146
+
147
+ //3. Create SOAP Api User
148
+ //create user if it does not exist
149
+ $apiUser = Mage::getModel('api/user');
150
+ $apiUser->loadByUsername($authName);
151
+ if ($apiUser->getId()) {
152
+ //update api key
153
+ $apiUser->setApiKey($apiKey);
154
+ $apiUser->save();
155
+ }else{
156
+ /** @var Mage_Api_Model_User $apiUser */
157
+ $apiUser = Mage::getModel('api/user')
158
+ ->setData(array(
159
+ 'username' => $authName,
160
+ 'firstname' => $authName,
161
+ 'lastname' => $authName,
162
+ 'email' => $adminEmail,
163
+ 'api_key' => $apiKey,
164
+ 'api_key_confirmation' => $apiKey,
165
+ 'is_active' => 1,
166
+ 'user_roles' => '',
167
+ 'assigned_user_role' => '',
168
+ 'role_name' => '',
169
+ 'roles' => array($apiRole->getId()) // your created custom role
170
+ ));
171
+ $apiUser->save();
172
+
173
+ //assign role to user
174
+ $apiUser
175
+ ->setRoleIds(array($apiRole->getId())) // your created custom role
176
+ ->setRoleUserId($apiUser->getUserId())
177
+ ->saveRelations();
178
+ }
app/code/community/Sellbrite/Api/etc/adminhtml.xml CHANGED
@@ -3,11 +3,11 @@
3
  <menu>
4
  <system>
5
  <children>
6
- <sellbrite_api module="sellbrite_api">
7
- <title>Sellbrite</title>
8
- <sort_order>9999</sort_order>
9
- <action>adminhtml/system_config/edit/section/sellbrite_api</action>
10
- </sellbrite_api>
11
  </children>
12
  </system>
13
  </menu>
@@ -20,7 +20,7 @@
20
  <children>
21
  <config>
22
  <children>
23
- <sellbrite_api>
24
  <title>Sellbrite</title>
25
  </sellbrite_api>
26
  </children>
3
  <menu>
4
  <system>
5
  <children>
6
+ <sellbrite_api module="sellbrite_api" translate="title">
7
+ <title>Sellbrite</title>
8
+ <sort_order>9999</sort_order>
9
+ <action>adminhtml/system_config/edit/section/sellbrite_api</action>
10
+ </sellbrite_api>
11
  </children>
12
  </system>
13
  </menu>
20
  <children>
21
  <config>
22
  <children>
23
+ <sellbrite_api module="sellbrite_api" translate="title">
24
  <title>Sellbrite</title>
25
  </sellbrite_api>
26
  </children>
app/code/community/Sellbrite/Api/etc/api2.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <api2>
4
+ <resources>
5
+ <product translate="title" module="api2">
6
+ <attributes translate="variations variation_keys" module="sellbrite_api">
7
+ <variations>Product Variations</variations>
8
+ <variation_keys>Product Variation Keys</variation_keys>
9
+ </attributes>
10
+ </product>>
11
+ <order>
12
+ <attributes translate="updated_at state" module="sellbrite_api">
13
+ <updated_at>Order Update Date</updated_at>
14
+ <state>Order State</state>
15
+ </attributes>
16
+ </order>
17
+ </resources>
18
+ </api2>
19
+ </config>
app/code/community/Sellbrite/Api/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Sellbrite_Api>
5
- <version>1.0.0</version>
6
  </Sellbrite_Api>
7
  </modules>
8
  <global>
@@ -12,10 +12,26 @@
12
  </sellbrite_api>
13
  </helpers>
14
  <models>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  <catalog>
16
  <rewrite>
17
- <product_api>Sellbrite_Api_Model_Catalog_Product_Api</product_api>
18
- <product_api_v2>Sellbrite_Api_Model_Catalog_Product_Api_V2</product_api_v2>
19
  </rewrite>
20
  </catalog>
21
  </models>
@@ -24,12 +40,46 @@
24
  <class>Sellbrite_Api_Block</class>
25
  </sellbrite_api>
26
  </blocks>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  </global>
28
  <default>
29
- <sellbrite_api>
30
- <config>
31
- <api_key><![CDATA[//]]></api_key>
32
- </config>
33
- </sellbrite_api>
34
  </default>
35
  </config>
2
  <config>
3
  <modules>
4
  <Sellbrite_Api>
5
+ <version>1.1.0</version>
6
  </Sellbrite_Api>
7
  </modules>
8
  <global>
12
  </sellbrite_api>
13
  </helpers>
14
  <models>
15
+ <sellbrite_api>
16
+ <class>Sellbrite_Api_Model</class>
17
+ <resourceModel>sellbrite_api_resource</resourceModel>
18
+ </sellbrite_api>
19
+ <sellbrite_api_resource>
20
+ <class>Sellbrite_Api_Model_Resource</class>
21
+ </sellbrite_api_resource>
22
+ <oauth>
23
+ <rewrite>
24
+ <token>Sellbrite_Api_Model_Token</token>
25
+ </rewrite>
26
+ </oauth>
27
+ <oauth_resource>
28
+ <rewrite>
29
+ <token>Sellbrite_Api_Model_Resource_Token</token>
30
+ </rewrite>
31
+ </oauth_resource>
32
  <catalog>
33
  <rewrite>
34
+ <api2_product_rest_admin_v1>Sellbrite_Api_Model_Catalog_Api2_Product_Rest_Admin_V1_Interceptor</api2_product_rest_admin_v1>
 
35
  </rewrite>
36
  </catalog>
37
  </models>
40
  <class>Sellbrite_Api_Block</class>
41
  </sellbrite_api>
42
  </blocks>
43
+ <resources>
44
+ <sellbrite_setup>
45
+ <setup>
46
+ <module>Sellbrite_Api</module>
47
+ </setup>
48
+ </sellbrite_setup>
49
+ </resources>
50
+ <catalog_product_list_item_plugins>
51
+ <!--
52
+ Plugins configuration format:
53
+ <method_name>
54
+ <before|after|around>
55
+ <some_plugin_class_name>module/class_name</some_plugin_class_name>
56
+ </before|after|around>
57
+ </method_name>
58
+ -->
59
+ <_retrieveCollection>
60
+ <after>
61
+ <product_type_plugin>sellbrite_api/catalog_productCollection_plugin</product_type_plugin>
62
+ </after>
63
+ </_retrieveCollection>
64
+ <_retrieve>
65
+ <after>
66
+ <product_type_plugin>sellbrite_api/catalog_product_plugin</product_type_plugin>
67
+ </after>
68
+ </_retrieve>
69
+ </catalog_product_list_item_plugins>
70
+ <compositions>
71
+ <!--
72
+ Composition configuration format:
73
+ <some_plugin_class_name> - reference to plugins configuration
74
+ <some_item_name>module/class_name</some_item_name>
75
+ </some_plugin_class_name>
76
+ -->
77
+ <product_type_plugin>
78
+ <configurable>sellbrite_api/catalog_product_format_productType_configurable</configurable>
79
+ </product_type_plugin>
80
+ </compositions>
81
  </global>
82
  <default>
83
+ <sellbrite_endpoint_url>https://app.sellbrite.com/merchants/magento/init</sellbrite_endpoint_url>
 
 
 
 
84
  </default>
85
  </config>
app/code/community/Sellbrite/Api/etc/system.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
- <sellbrite translate="label">
5
  <label><![CDATA[<div><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" alt="Sellbrite" title="Sellbrite" height="23" style="display:block;" /></div>]]></label>
6
  <sort_order>1000</sort_order>
7
  </sellbrite>
1
  <?xml version="1.0"?>
2
  <config>
3
  <tabs>
4
+ <sellbrite translate="label" module="sellbrite_api">
5
  <label><![CDATA[<div><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" alt="Sellbrite" title="Sellbrite" height="23" style="display:block;" /></div>]]></label>
6
  <sort_order>1000</sort_order>
7
  </sellbrite>
app/code/community/Sellbrite/Api/etc/wsdl.xml DELETED
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
4
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
5
- xmlns="http://schemas.xmlsoap.org/wsdl/"
6
- name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
7
- <types>
8
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
9
- <complexType name="catalogProductCreateEntity">
10
- <all>
11
- <element name="associated_skus" type="typens:ArrayOfString" minOccurs="0"/>
12
- <element name="configurable_attributes" type="typens:ArrayOfString" minOccurs="0"/>
13
- <element name="price_changes" type="typens:associativeArray" minOccurs="0" />
14
- </all>
15
- </complexType>
16
- <complexType name="catalogProductReturnEntity">
17
- <all>
18
- <element name="associated_product_ids" type="typens:ArrayOfString" minOccurs="0"/>
19
- <element name="configurable_attributes" type="typens:ArrayOfString" minOccurs="0"/>
20
- <element name="price_changes" type="typens:associativeArray" minOccurs="0" />
21
- </all>
22
- </complexType>
23
- </schema>
24
- </types>
25
- </definitions>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sellbrite/Api/etc/wsi.xml DELETED
@@ -1,31 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
3
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
5
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
6
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
7
- name="{{var wsdl.name}}"
8
- targetNamespace="urn:{{var wsdl.name}}">
9
- <wsdl:types>
10
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
11
- <xsd:complexType name="complexMultiFilter">
12
- <xsd:sequence>
13
- <xsd:element name="key" type="xsd:string" />
14
- <xsd:element name="value" type="typens:associativeArray" />
15
- </xsd:sequence>
16
- </xsd:complexType>
17
- <xsd:complexType name="complexMultiArray">
18
- <xsd:sequence>
19
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:complexMultiFilter" />
20
- </xsd:sequence>
21
- </xsd:complexType>
22
- <xsd:complexType name="catalogProductCreateEntity">
23
- <xsd:sequence>
24
- <xsd:element name="associated_skus" type="typens:ArrayOfString" minOccurs="0" />
25
- <xsd:element name="configurable_attributes" type="typens:ArrayOfString" minOccurs="0" />
26
- <xsd:element name="price_changes" type="typens:complexMultiArray" minOccurs="0" />
27
- </xsd:sequence>
28
- </xsd:complexType>
29
- </xsd:schema>
30
- </wsdl:types>
31
- </wsdl:definitions>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/base/default/template/sellbrite/api/system/config/fieldset/hint.phtml CHANGED
@@ -1,23 +1,17 @@
1
  <?php
2
  /**
3
- * @var $this Sellbrite_Api_Block_Adminhtml_System_Config_Fieldset_Hint
4
  */
5
-
6
- $mage_ver = Mage::getVersion();
7
- $min_version = '1.8';
8
- $max_version = '1.9.0.1';
9
-
10
- if( $mage_ver < $min_version || $mage_ver > $max_version ){
11
  ?>
12
-
13
  <div class="box">
14
  <div>
15
  <a href="https://www.sellbrite.com" target="_blank"><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" height='50' alt="Sellbrite" title="Sellbrite" /></a><br>
16
 
17
  <br>
18
  <h2 style='color: red'>Sorry, but we don't currently support your Magento version.</h2>
19
- <b>Your Magento Version:</b> <code><?= $mage_ver ?></code><br>
20
- <b>Supported Versions:</b> <code><?= $min_version ?> - <?= $max_version ?></code><br><br>
21
 
22
  We are working hard to add support for more versions. So stay tuned!
23
 
@@ -25,110 +19,44 @@
25
 
26
  </div>
27
  </div>
28
-
29
- <?php
30
- return;
31
- }
32
-
33
- $api_key = Mage::getStoreConfig('sellbrite_api/config/api_key');
34
- $site_url = Mage::helper('core/url')->getHomeUrl();
35
-
36
- if( !$api_key || strlen($api_key) < 32 ){
37
- $api_key = md5(uniqid(rand(), true));
38
-
39
- $config = new Mage_Core_Model_Config();
40
- $config ->saveConfig('sellbrite_api/config/api_key', $api_key, 'default', 0);
41
- }
42
-
43
-
44
-
45
-
46
-
47
- function createApiRole(){
48
- //create new role
49
- $role = Mage::getModel("api/roles")
50
- ->setName('Sellbrite')
51
- ->setRoleType('G')
52
- ->save();
53
-
54
- //give "all" privileges to role
55
- Mage::getModel("api/rules")
56
- ->setRoleId($role->getId())
57
- ->setResources(array("all"))
58
- ->saveRel();
59
-
60
- return $role;
61
- }
62
-
63
- function createApiUser($api_key, $role){
64
- $apiuser = Mage::getModel('api/user')
65
- ->setData(array(
66
- 'username' => 'Sellbrite',
67
- 'firstname' => 'Sellbrite',
68
- 'lastname' => 'Sellbrite',
69
- 'email' => 'magento@sellbrite.com',
70
- 'api_key' => $api_key,
71
- 'api_key_confirmation' => $api_key,
72
- 'is_active' => 1,
73
- 'user_roles' => '',
74
- 'assigned_user_role' => '',
75
- 'role_name' => '',
76
- 'roles' => array($role->getId()) // your created custom role
77
- ));
78
- $apiuser->save();
79
-
80
- //assign role to user
81
- $apiuser
82
- ->setRoleIds( array($role->getId()) ) // your created custom role
83
- ->setRoleUserId($apiuser->getUserId())
84
- ->saveRelations();
85
-
86
- return $apiuser;
87
- }
88
-
89
- $roles = Mage::getModel('api/roles')->getCollection();
90
- $role = null;
91
- foreach($roles as $r){
92
- $data = $r->getData();
93
- if($data['role_name'] == 'Sellbrite'){
94
- $role = $r;
95
- }
96
- }
97
-
98
- if (!$role) {
99
- $role = createApiRole();
100
- }
101
-
102
-
103
- //create user if it does not exist
104
- $apiuser = Mage::getModel('api/user');
105
- $apiuser->loadByUsername('Sellbrite');
106
- if ($apiuser->getId()) {
107
- //update api key
108
- $apiuser->setApiKey($api_key);
109
-
110
- $apiuser->save();
111
- }else{
112
- createApiUser($api_key, $role);
113
- }
114
-
115
-
116
-
117
- ?>
118
- <div class="box">
119
- <div>
120
- <a href="https://www.sellbrite.com" target="_blank"><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" height='50' alt="Sellbrite" title="Sellbrite" /></a><br>
121
-
122
- <br>
123
- <b>Your API Key:</b> <code><?= $api_key ?></code><br><br>
124
- <b>Your Magento Version:</b> <code><?= $mage_ver ?></code><br><br>
125
-
126
- <a href='https://app.sellbrite.com/merchants/auth/magento?api_key=<?= $api_key ?>&site_url=<?= $site_url ?>' style='display: inline-block; color: white; border-radius: 5px; padding: 10px 20px; background: #6fcc37; -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
127
- box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); font-weight: bold; font-size: 14px; text-decoration: none;'>Connect to Sellbrite</a>
128
-
129
- <div style='clear: both;'></div>
130
-
131
  </div>
132
- </div>
133
 
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * @var Sellbrite_Api_Block_Adminhtml_System_Config_Fieldset_Hint $this
4
  */
 
 
 
 
 
 
5
  ?>
6
+ <?php if(!$this->isSupportedVersion()) : ?>
7
  <div class="box">
8
  <div>
9
  <a href="https://www.sellbrite.com" target="_blank"><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" height='50' alt="Sellbrite" title="Sellbrite" /></a><br>
10
 
11
  <br>
12
  <h2 style='color: red'>Sorry, but we don't currently support your Magento version.</h2>
13
+ <b>Your Magento Version:</b> <code><?php echo $this->getMagentoVersion(); ?></code><br>
14
+ <b>Supported Versions:</b> <code><?php echo $this->getMinVersion(); ?> - <?php echo $this->getMaxVersion(); ?></code><br><br>
15
 
16
  We are working hard to add support for more versions. So stay tuned!
17
 
19
 
20
  </div>
21
  </div>
22
+ <?php else : ?>
23
+ <div class="box">
24
+ <div>
25
+ <a href="https://www.sellbrite.com" target="_blank"><img src="http://sellbrite.com/wp-content/uploads/sellbrite-logo-300@2x1.png" height='50' alt="Sellbrite" title="Sellbrite" /></a><br>
26
+
27
+ <fieldset>
28
+ <h2>REST API Credentials</h2>
29
+ <b>Consumer Key:</b> <code><?php echo $this->getConsumerKey(); ?></code><br><br>
30
+ <b>Consumer Secret:</b> <code><?php echo $this->getConsumerSecret(); ?></code><br><br>
31
+ <b>Access Token:</b> <code><?php echo $this->getAccessToken(); ?></code><br><br>
32
+ <b>Access Secret:</b> <code><?php echo $this->getAccessSecret(); ?></code><br><br>
33
+ </fieldset>
34
+ <fieldset>
35
+ <h2>SOAP API Credentials</h2>
36
+ <b>Api User:</b> <code><?php echo $this->getSoapUser(); ?></code><br><br>
37
+ <b>API Key:</b> <code><?php echo $this->getApiKey(); ?></code><br><br>
38
+ </fieldset>
39
+ <a onclick="$('sellbrite_connection_form').submit();" style='display: inline-block; color: white; border-radius: 5px; padding: 10px 20px; background: #6fcc37; -webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
40
+ box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); font-weight: bold; font-size: 14px; text-decoration: none;' onmouseover="this.style.cursor='pointer'">Connect to Sellbrite</a>
41
+ <div style='clear: both;'></div>
42
+
43
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </div>
 
45
 
46
 
47
+ <script type="text/javascript">
48
+ document.observe('dom:loaded', function(){
49
+ $('config_edit_form').insert({
50
+ 'after': '<form method="post" action="<?php echo $this->getEndPointUrl(); ?>" id="sellbrite_connection_form">'
51
+ + '<input type="hidden" name="consumer_key" value="<?php echo $this->getConsumerKey(); ?>" />'
52
+ + '<input type="hidden" name="consumer_secret" value="<?php echo $this->getConsumerSecret(); ?>" />'
53
+ + '<input type="hidden" name="access_token" value="<?php echo $this->getAccessToken(); ?>" />'
54
+ + '<input type="hidden" name="access_secret" value="<?php echo $this->getAccessSecret(); ?>" />'
55
+ + '<input type="hidden" name="api_key" value="<?php echo $this->getApiKey(); ?>" />'
56
+ + '<input type="hidden" name="api_user" value="<?php echo $this->getSoapUser(); ?>" />'
57
+ + '<input type="hidden" name="site_url" value="<?php echo $this->getSiteURL(); ?>" />'
58
+ + '</form>'
59
+ });
60
+ });
61
+ </script>
62
+ <?php endif; ?>
app/etc/modules/Sellbrite_Api.xml CHANGED
@@ -4,6 +4,10 @@
4
  <Sellbrite_Api>
5
  <active>true</active>
6
  <codePool>community</codePool>
 
 
 
 
7
  </Sellbrite_Api>
8
  </modules>
9
  </config>
4
  <Sellbrite_Api>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Catalog />
9
+ <Mage_Oauth />
10
+ </depends>
11
  </Sellbrite_Api>
12
  </modules>
13
  </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>sellbrite</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license>MIT License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Simplified Multi-channel selling.</summary>
10
  <description>List your products on more channels, access more customers and maximize your sales, quickly and easily.</description>
11
- <notes>Magento version check</notes>
12
  <authors><author><name>Sellbrite</name><user>machineboy2045</user><email>machineboy2045@gmail.com</email></author></authors>
13
- <date>2015-03-02</date>
14
- <time>18:37:29</time>
15
- <contents><target name="magecommunity"><dir name="Sellbrite"><dir name="Api"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="eee09d85dc2ddf0dc49a9b3c788eb2cd"/></dir></dir></dir></dir></dir><dir name="Helper"><dir name="Catalog"><file name="Product.php" hash="1e0567fd4fc6da68635c5153749c1659"/></dir><file name="Data.php" hash="10776abef0d3e369c6dec5566de5dfed"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="001e4766191ba2e6bb630fc2ee9d015d"/></dir><file name="Api.php" hash="bb344211ad4623774c10ec85ed5e7458"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ba6e97e5e14d3b00fd281cf1c07c3958"/><file name="config.xml" hash="5fa352976f061989324bfb6f3b28261c"/><file name="system.xml" hash="5b61898dd5be81781c6b908738eaa6fb"/><file name="wsdl.xml" hash="22bfa736fad32b8ed5013cccb4aabc9d"/><file name="wsi.xml" hash="f06f9b1374aac0f2585d3fc1c916d7ec"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="sellbrite"><dir name="api"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="2823b09003c42d4f8cc8e0b69dc2ab1a"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sellbrite_Api.xml" hash="eb836727e6b1e328091e7ccd9003294f"/></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>sellbrite</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license>MIT License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Simplified Multi-channel selling.</summary>
10
  <description>List your products on more channels, access more customers and maximize your sales, quickly and easily.</description>
11
+ <notes>Major overhaul to extension, which enables greater capabilities within the Sellbrite platform. Better support for configurable products and orders.</notes>
12
  <authors><author><name>Sellbrite</name><user>machineboy2045</user><email>machineboy2045@gmail.com</email></author></authors>
13
+ <date>2015-06-25</date>
14
+ <time>21:39:25</time>
15
+ <contents><target name="magecommunity"><dir name="Sellbrite"><dir name="Api"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="ce4fbc0a40d1afc4513e6b35ecd99ed4"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fc1bc420427fc76d541930ff49d25e81"/></dir><dir name="Model"><dir name="Catalog"><dir name="Api2"><dir name="Product"><dir name="Rest"><dir name="Admin"><dir name="V1"><file name="Interceptor.php" hash="63175b4f187b6e4a0c0f5828b9cf0691"/></dir></dir></dir></dir></dir><dir name="Product"><dir name="Format"><dir name="ProductType"><file name="Configurable.php" hash="3ed6fc1e0db3e621570698805e7494a2"/></dir></dir><file name="Plugin.php" hash="143dd633a91f4d59655246ee0628c153"/></dir><dir name="ProductCollection"><file name="Plugin.php" hash="fefd50d1e5bcf314ad1b964ae0ff7ea9"/></dir></dir><file name="Credentials.php" hash="de514640f59d93920513d92ad946bf68"/><dir name="Resource"><file name="Token.php" hash="1235bd275aa329bf394f8fe74328c1a2"/></dir><file name="Token.php" hash="b639a039cf7b936b4b18eff6421f2602"/></dir><dir name="data"><dir name="sellbrite_setup"><file name="data-install-1.1.0.php" hash="9602a56f78e5aa5afae3f64ce272a7b6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d15a171ae1cede0f46acfd8b2d31f12c"/><file name="api2.xml" hash="16aea70942e0b4c4a4bce1fb4c0128b0"/><file name="config.xml" hash="694f1b4ab449ab70dacde49c4220ae64"/><file name="system.xml" hash="34a4d1c88115c78887e65bc14d8ef06e"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="sellbrite"><dir name="api"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="243f1c7bde19a19fbcd50623d39bfd92"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sellbrite_Api.xml" hash="1caa543c8db9bc2e24dc4bd4e07cf1a7"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.0</min><max>1.9.1.1</max></package></required></dependencies>
18
  </package>