Merge lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev into lp:magentoerpconnect/oerp6.1-oldstable
- magento-module-dev
- Merge into trunk_version
Status: | Rejected |
---|---|
Rejected by: | Guewen Baconnier @ Camptocamp |
Proposed branch: | lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev |
Merge into: | lp:magentoerpconnect/oerp6.1-oldstable |
Diff against target: |
3185 lines (+3033/-0) 24 files modified
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php (+6/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php (+80/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php (+24/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php (+111/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php (+109/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php (+167/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php (+58/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php (+71/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php (+289/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php (+142/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php (+142/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php (+171/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php (+241/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php (+142/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php (+142/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php (+163/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php (+116/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php (+61/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php (+5/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml (+526/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml (+88/-0) Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php (+54/-0) Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml (+41/-0) package.xml (+84/-0) |
To merge this branch: | bzr merge lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guewen Baconnier @ Camptocamp | Disapprove | ||
Review via email: mp+80985@code.launchpad.net |
Commit message
Description of the change
- 28. By monahhas <monahhas@midgard>
-
[ADD] Compatibility with magento 1.3.x.x added, if version of magento is 1.3.x.x the module will :
- add an order attribute called 'imported' instead of column for magento 1.4.x.x and higher.
- add an observer for the event 'sales_order_place_ after' which initialize the value of 'imported' to 0 every time an order is placed, if there any problem during the initialization, a log called OpenErp_ Connector. log will be created in [yourmagento] /var/log/ , this log contains information about the problem, increment_id, error message,...
- function retreive() compatibility with 1.3.x.x fixed
- allow you to initialize the value of the attribute 'imported' to 0 for all orders placed before installing the module, so they can be imported in OpenErp, this script can be called via this Url : http://[base_url]/index. php/connector/ adminhtml_ init/orders/
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
Thierry (tboulogne) wrote : | # |
Hello Guewen,
Does your message related to
https:/
too ?
> Guewen Baconnier @ Camptocamp <mailto:<email address hidden>>
> 21 novembre 2011 14:18
> Review: Disapprove
>
> Hello,
>
> This merge proposal is invalid as this branch must be merged into
> lp:magentoerpconnect/magento-module (Magento module) and not into
> lp:magentoerpconnect (OpenERP module).
>
> Also, the reviewer of lp:magentoerpconnect/magento-module is Sharoon
> Thomas and not the "MagentoERPConnect core Editors" Team.
>
> A merge proposal is currently pending on this branch on the behalf of
> Mohammed Nahhas as requestor and of Sharoon Thomas as reviewer :
> https:/
Unmerged revisions
- 28. By monahhas <monahhas@midgard>
-
[ADD] Compatibility with magento 1.3.x.x added, if version of magento is 1.3.x.x the module will :
- add an order attribute called 'imported' instead of column for magento 1.4.x.x and higher.
- add an observer for the event 'sales_order_place_ after' which initialize the value of 'imported' to 0 every time an order is placed, if there any problem during the initialization, a log called OpenErp_ Connector. log will be created in [yourmagento] /var/log/ , this log contains information about the problem, increment_id, error message,...
- function retreive() compatibility with 1.3.x.x fixed
- allow you to initialize the value of the attribute 'imported' to 0 for all orders placed before installing the module, so they can be imported in OpenErp, this script can be called via this Url : http://[base_url]/index. php/connector/ adminhtml_ init/orders/ - 27. By monahhas <monahhas@midgard>
-
[ADD] create Configurable and Bundle product
- 26. By Mohammed <email address hidden>
-
[ADD] Missing files for previous revision (25th)
- 25. By Mohammed <email address hidden>
-
[ADD] Flag for imported orders
- 24. By Raimon Esteve (www.zikzakmedia.com)
-
[IMP] Newsletter Subscribers. WebServices (part 2)
- 23. By Raimon Esteve (www.zikzakmedia.com)
-
[IMP] Newsletter Subscribers. WebServices:
- list
- info
- create
- update
- delete (unsubscriber)
note: magento core not avaible webservice for Newsletter Subscribers - 22. By Raphaël Valyi - http://www.akretion.com
-
[IMP] send attribute scope as we would eventually use it, especially to find out which attributes are translatable (scope=='store'), though that might be overkill
- 21. By Sharoon Thomas http://openlabs.co.in
-
[FIX]The attributes.list method now gives the details
- 20. By Sharoon Thomas http://openlabs.co.in
-
[ADD]Attribute set fixed
- 19. By Sharoon Thomas http://openlabs.co.in
-
[ADD]Api for tier price & customer
Preview Diff
1 | === added directory 'Openlabs_OpenERPConnector-1.1.0' | |||
2 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs' | |||
3 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector' | |||
4 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper' | |||
5 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php' | |||
6 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php 1970-01-01 00:00:00 +0000 | |||
7 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php 2011-11-09 09:54:26 +0000 | |||
8 | @@ -0,0 +1,6 @@ | |||
9 | 1 | <?php | ||
10 | 2 | class Openlabs_OpenERPConnector_Helper_Data extends Mage_Core_Helper_Abstract | ||
11 | 3 | { | ||
12 | 4 | //Linux4ever_MagentoXtender_Model_Api | ||
13 | 5 | } | ||
14 | 6 | ?> | ||
15 | 0 | \ No newline at end of file | 7 | \ No newline at end of file |
16 | 1 | 8 | ||
17 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model' | |||
18 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog' | |||
19 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product' | |||
20 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php' | |||
21 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php 1970-01-01 00:00:00 +0000 | |||
22 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php 2011-11-09 09:54:26 +0000 | |||
23 | @@ -0,0 +1,80 @@ | |||
24 | 1 | <?php | ||
25 | 2 | |||
26 | 3 | /** | ||
27 | 4 | * @author Mohammed NAHHAS | ||
28 | 5 | * @package Openlabs_OpenERPConnector | ||
29 | 6 | */ | ||
30 | 7 | |||
31 | 8 | class Openlabs_OpenERPConnector_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api | ||
32 | 9 | { | ||
33 | 10 | /** | ||
34 | 11 | * Set additional data before product saved | ||
35 | 12 | * | ||
36 | 13 | * @param Mage_Catalog_Model_Product $product | ||
37 | 14 | * @param array $productData | ||
38 | 15 | * @return object | ||
39 | 16 | */ | ||
40 | 17 | protected function _prepareDataForSave ($product, $productData) | ||
41 | 18 | { | ||
42 | 19 | if (isset($productData['categories']) && is_array($productData['categories'])) { | ||
43 | 20 | $product->setCategoryIds($productData['categories']); | ||
44 | 21 | } | ||
45 | 22 | |||
46 | 23 | if (isset($productData['websites']) && is_array($productData['websites'])) { | ||
47 | 24 | foreach ($productData['websites'] as &$website) { | ||
48 | 25 | if (is_string($website)) { | ||
49 | 26 | try { | ||
50 | 27 | $website = Mage::app()->getWebsite($website)->getId(); | ||
51 | 28 | } catch (Exception $e) { } | ||
52 | 29 | } | ||
53 | 30 | } | ||
54 | 31 | $product->setWebsiteIds($productData['websites']); | ||
55 | 32 | } | ||
56 | 33 | |||
57 | 34 | if (Mage::app()->isSingleStoreMode()) { | ||
58 | 35 | $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId())); | ||
59 | 36 | } | ||
60 | 37 | |||
61 | 38 | if (isset($productData['stock_data']) && is_array($productData['stock_data'])) { | ||
62 | 39 | $product->setStockData($productData['stock_data']); | ||
63 | 40 | } else { | ||
64 | 41 | $product->setStockData(array('use_config_manage_stock' => 0)); | ||
65 | 42 | } | ||
66 | 43 | |||
67 | 44 | if (isset($productData['tier_price']) && is_array($productData['tier_price'])) { | ||
68 | 45 | $tierPrices = Mage::getModel('catalog/product_attribute_tierprice_api')->prepareTierPrices($product, $productData['tier_price']); | ||
69 | 46 | $product->setData(Mage_Catalog_Model_Product_Attribute_Tierprice_Api::ATTRIBUTE_CODE, $tierPrices); | ||
70 | 47 | } | ||
71 | 48 | |||
72 | 49 | /* | ||
73 | 50 | * Check if configurable product data array passed | ||
74 | 51 | */ | ||
75 | 52 | if(isset($productData['configurable_products_data']) && is_array($productData['configurable_products_data'])) { | ||
76 | 53 | $product->setConfigurableProductsData($productData['configurable_products_data']); | ||
77 | 54 | } | ||
78 | 55 | |||
79 | 56 | if(isset($productData['configurable_attributes_data']) && is_array($productData['configurable_attributes_data'])) { | ||
80 | 57 | foreach($productData['configurable_attributes_data'] as $key => $data) { | ||
81 | 58 | |||
82 | 59 | //Check to see if these values exist, otherwise try and populate from existing values | ||
83 | 60 | $data['label'] = (!empty($data['label'])) ? $data['label'] : $product->getResource()->getAttribute($data['attribute_code'])->getStoreLabel(); | ||
84 | 61 | $data['frontend_label'] = (!empty($data['frontend_label'])) ? $data['frontend_label'] : $product->getResource()->getAttribute($data['attribute_code'])->getFrontendLabel(); | ||
85 | 62 | $productData['configurable_attributes_data'][$key] = $data; | ||
86 | 63 | } | ||
87 | 64 | $product->setConfigurableAttributesData($productData['configurable_attributes_data']); | ||
88 | 65 | $product->setCanSaveConfigurableAttributes(true); | ||
89 | 66 | } | ||
90 | 67 | |||
91 | 68 | /* | ||
92 | 69 | * Check if bundle product data, options and bundle items arrays passed | ||
93 | 70 | */ | ||
94 | 71 | if(isset($productData['bundle_items_data']) && isset($productData['options_data']) && is_array($productData['bundle_items_data']) && is_array($productData['options_data'])) { | ||
95 | 72 | |||
96 | 73 | $product->setBundleOptionsData($productData['options_data']); | ||
97 | 74 | $product->setBundleSelectionsData($productData['bundle_items_data']); | ||
98 | 75 | $product->setCanSaveBundleSelections(true); | ||
99 | 76 | $product->setAffectBundleProductSelections(true); | ||
100 | 77 | Mage::register('product', $product); // product must be registred in order to get the store_id, see _beforeSave() in Mage/Bundle/Model/Selection.php | ||
101 | 78 | } | ||
102 | 79 | } | ||
103 | 80 | } | ||
104 | 0 | \ No newline at end of file | 81 | \ No newline at end of file |
105 | 1 | 82 | ||
106 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php' | |||
107 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php 1970-01-01 00:00:00 +0000 | |||
108 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php 2011-11-09 09:54:26 +0000 | |||
109 | @@ -0,0 +1,24 @@ | |||
110 | 1 | <?php | ||
111 | 2 | /** | ||
112 | 3 | * | ||
113 | 4 | * @author Mohammed NAHHAS | ||
114 | 5 | * @package Openlabs_OpenERPConnector | ||
115 | 6 | * | ||
116 | 7 | */ | ||
117 | 8 | |||
118 | 9 | class Openlabs_OpenERPConnector_Model_Observer extends Mage_Core_Model_Abstract { | ||
119 | 10 | |||
120 | 11 | /* Initialize attribtue 'imported' if version < 1.4.0.0 */ | ||
121 | 12 | public function initImported($observer) { | ||
122 | 13 | if(str_replace('.','',Mage::getVersion()) < 1400) { | ||
123 | 14 | $order = $observer->getOrder(); | ||
124 | 15 | try { | ||
125 | 16 | $order->setImported(0)->save(); | ||
126 | 17 | }catch (Exception $e) { | ||
127 | 18 | /* If logs are enabled (backend : system->configuration->developer->logSettings), it creates a file named OpenErp_Connector.log in /var/log/ which contains the errors */ | ||
128 | 19 | Mage::log('Error, order increment_id = '.$order->getIncrementId().', attribute "imported" was not initialized - error : '.$e->getMessage(), null, 'OpenErp_Connector.log'); | ||
129 | 20 | } | ||
130 | 21 | $order->setImported(0)->save(); | ||
131 | 22 | } | ||
132 | 23 | } | ||
133 | 24 | } | ||
134 | 0 | \ No newline at end of file | 25 | \ No newline at end of file |
135 | 1 | 26 | ||
136 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog' | |||
137 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php' | |||
138 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php 1970-01-01 00:00:00 +0000 | |||
139 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php 2011-11-09 09:54:26 +0000 | |||
140 | @@ -0,0 +1,111 @@ | |||
141 | 1 | <?php | ||
142 | 2 | |||
143 | 3 | |||
144 | 4 | /** | ||
145 | 5 | * @author Sharoon Thomas | ||
146 | 6 | * Inspired from Dieter's Magento Extender | ||
147 | 7 | * @copyright 2009 | ||
148 | 8 | */ | ||
149 | 9 | |||
150 | 10 | class Openlabs_OpenERPConnector_Model_Olcatalog_Categories extends Mage_Catalog_Model_Api_Resource | ||
151 | 11 | { | ||
152 | 12 | public function items($filters = null) { | ||
153 | 13 | try { | ||
154 | 14 | $collection = Mage :: getModel('catalog/category/attribute')->getCollection()->addAttributeToSelect('image'); | ||
155 | 15 | } catch (Mage_Core_Exception $e) { | ||
156 | 16 | $this->_fault('category_not_exists'); | ||
157 | 17 | } | ||
158 | 18 | if (is_array($filters)) { | ||
159 | 19 | try { | ||
160 | 20 | foreach ($filters as $field => $value) { | ||
161 | 21 | $collection->addFieldToFilter($field, $value); | ||
162 | 22 | } | ||
163 | 23 | } catch (Mage_Core_Exception $e) { | ||
164 | 24 | $this->_fault('filters_invalid', $e->getMessage()); | ||
165 | 25 | // If we are adding filter on non-existent attribute | ||
166 | 26 | } | ||
167 | 27 | } | ||
168 | 28 | $result = array (); | ||
169 | 29 | foreach ($collection as $category) { | ||
170 | 30 | //$result[] = $customer->toArray(); | ||
171 | 31 | $result[] = array ( | ||
172 | 32 | 'category_id' => $category->getId(), | ||
173 | 33 | 'image' => $category->getImage(), | ||
174 | 34 | ); | ||
175 | 35 | } | ||
176 | 36 | return $result; | ||
177 | 37 | } | ||
178 | 38 | |||
179 | 39 | public function info($categoryId = null) { | ||
180 | 40 | if (is_numeric($categoryId)) { | ||
181 | 41 | try { | ||
182 | 42 | $collection = Mage :: getModel('catalog/category/attribute')->load($categoryId)->getCollection()->addAttributeToSelect('image'); | ||
183 | 43 | $result = array (); | ||
184 | 44 | foreach ($collection as $category) { | ||
185 | 45 | //$result[] = $customer->toArray(); | ||
186 | 46 | if ($category->getId() == $categoryId) { | ||
187 | 47 | $image = $category->getImage(); | ||
188 | 48 | if ($image) { | ||
189 | 49 | $path = Mage :: getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS; | ||
190 | 50 | $fullpath = $path . $image; | ||
191 | 51 | try { | ||
192 | 52 | $fp = fopen($fullpath, "rb"); | ||
193 | 53 | $imagebin = fread($fp, filesize($fullpath)); | ||
194 | 54 | $img_data = base64_encode($imagebin); | ||
195 | 55 | fclose($fp); | ||
196 | 56 | } catch (Exception $e) { | ||
197 | 57 | $this->_fault('not_media'); | ||
198 | 58 | } | ||
199 | 59 | } | ||
200 | 60 | $result[] = array ( | ||
201 | 61 | 'category_id' => $category->getId(), | ||
202 | 62 | 'image' => $category->getImage(), | ||
203 | 63 | 'image_data' => $img_data | ||
204 | 64 | ); | ||
205 | 65 | } | ||
206 | 66 | } | ||
207 | 67 | |||
208 | 68 | return $result; | ||
209 | 69 | |||
210 | 70 | } catch (Mage_Core_Exception $e) { | ||
211 | 71 | $this->_fault('group_not_exists'); | ||
212 | 72 | } | ||
213 | 73 | |||
214 | 74 | } | ||
215 | 75 | |||
216 | 76 | } | ||
217 | 77 | |||
218 | 78 | public function create($filename,$imgdata) { | ||
219 | 79 | if ($filename) | ||
220 | 80 | { | ||
221 | 81 | $path = Mage :: getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS; | ||
222 | 82 | $fullpath = $path . $filename; | ||
223 | 83 | try | ||
224 | 84 | { | ||
225 | 85 | $fp = fopen($fullpath, "w"); | ||
226 | 86 | if ($fp==false) | ||
227 | 87 | { | ||
228 | 88 | return "Error in file creation"; | ||
229 | 89 | } | ||
230 | 90 | $img_data = base64_decode($imgdata); | ||
231 | 91 | $imagebin = fwrite($fp,$img_data); | ||
232 | 92 | fclose($fp); | ||
233 | 93 | return $imagebin; | ||
234 | 94 | } | ||
235 | 95 | catch (Exception $e) | ||
236 | 96 | { | ||
237 | 97 | $this->_fault('not_created'); | ||
238 | 98 | } | ||
239 | 99 | return False; | ||
240 | 100 | } | ||
241 | 101 | } | ||
242 | 102 | public function update($something=null) | ||
243 | 103 | { | ||
244 | 104 | return "Not implemented yet"; | ||
245 | 105 | } | ||
246 | 106 | public function remove($something=null) | ||
247 | 107 | { | ||
248 | 108 | return "Not implemented yet"; | ||
249 | 109 | } | ||
250 | 110 | } | ||
251 | 111 | ?> | ||
252 | 0 | 112 | ||
253 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product' | |||
254 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php' | |||
255 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php 1970-01-01 00:00:00 +0000 | |||
256 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php 2011-11-09 09:54:26 +0000 | |||
257 | @@ -0,0 +1,109 @@ | |||
258 | 1 | <?php | ||
259 | 2 | |||
260 | 3 | |||
261 | 4 | /** | ||
262 | 5 | * @author Sharoon Thomas | ||
263 | 6 | * Inspired from Dieter's Magento Extender | ||
264 | 7 | * @copyright 2009 | ||
265 | 8 | */ | ||
266 | 9 | |||
267 | 10 | class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attribute extends Mage_Catalog_Model_Api_Resource { | ||
268 | 11 | public function __construct() { | ||
269 | 12 | $this->_storeIdSessionField = 'product_store_id'; | ||
270 | 13 | $this->_ignoredAttributeCodes[] = 'type_id'; | ||
271 | 14 | $this->_ignoredAttributeTypes[] = 'gallery'; | ||
272 | 15 | $this->_ignoredAttributeTypes[] = 'media_image'; | ||
273 | 16 | } | ||
274 | 17 | |||
275 | 18 | /** | ||
276 | 19 | * Retrieve attributes from specified attribute set | ||
277 | 20 | * | ||
278 | 21 | * @param int $setId | ||
279 | 22 | * @return array | ||
280 | 23 | */ | ||
281 | 24 | public function relations($setId){ | ||
282 | 25 | $attributes = Mage :: getModel('catalog/product')->getResource()->loadAllAttributes()->getSortedAttributes($setId); | ||
283 | 26 | $result = array (); | ||
284 | 27 | foreach ($attributes as $attribute){ | ||
285 | 28 | $result[] = Array( | ||
286 | 29 | 'attribute_id' => $attribute->getId() | ||
287 | 30 | ); | ||
288 | 31 | } | ||
289 | 32 | return $result; | ||
290 | 33 | |||
291 | 34 | } | ||
292 | 35 | public function items($setId) { | ||
293 | 36 | $attributes = Mage :: getModel('catalog/product')->getResource()->loadAllAttributes()->getSortedAttributes($setId); | ||
294 | 37 | $result = array (); | ||
295 | 38 | |||
296 | 39 | foreach ($attributes as $attribute) { | ||
297 | 40 | /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ | ||
298 | 41 | if ((!$attribute->getId() || $attribute->isInSet($setId)) && $this->_isAllowedAttribute($attribute)) { | ||
299 | 42 | |||
300 | 43 | if (!$attribute->getId() || $attribute->isScopeGlobal()) { | ||
301 | 44 | $scope = 'global'; | ||
302 | 45 | } | ||
303 | 46 | elseif ($attribute->isScopeWebsite()) { | ||
304 | 47 | $scope = 'website'; | ||
305 | 48 | } else { | ||
306 | 49 | $scope = 'store'; | ||
307 | 50 | } | ||
308 | 51 | |||
309 | 52 | /*$result[] = array ( | ||
310 | 53 | 'attribute_id' => $attribute->getId(), | ||
311 | 54 | 'code' => $attribute->getAttributeCode(), | ||
312 | 55 | 'type' => $attribute->getFrontendInput(), | ||
313 | 56 | 'required' => $attribute->getIsRequired(), | ||
314 | 57 | 'attributeset' => $attribute->getattribute_set_info(), | ||
315 | 58 | 'scope' => $scope | ||
316 | 59 | );*/ | ||
317 | 60 | //Override hooray | ||
318 | 61 | $attribute['scope'] = $scope; | ||
319 | 62 | $result[]=$attribute->toArray(); | ||
320 | 63 | } | ||
321 | 64 | } | ||
322 | 65 | |||
323 | 66 | return $result; | ||
324 | 67 | } | ||
325 | 68 | |||
326 | 69 | public function info($attributeId) { | ||
327 | 70 | try { | ||
328 | 71 | return 'hello'; | ||
329 | 72 | $attribute = Mage :: getModel('catalog/product')->getResource()->getAttribute($attributeId); | ||
330 | 73 | return $attribute->toArray(); | ||
331 | 74 | } catch (Exception $e) { | ||
332 | 75 | $this->_fault('not_exists'); | ||
333 | 76 | } | ||
334 | 77 | } | ||
335 | 78 | /** | ||
336 | 79 | * Retrieve attribute options | ||
337 | 80 | * | ||
338 | 81 | * @param int $attributeId | ||
339 | 82 | * @param string|int $store | ||
340 | 83 | * @return array | ||
341 | 84 | */ | ||
342 | 85 | public function options($attributeId, $store = null) { | ||
343 | 86 | $storeId = $this->_getStoreId($store); | ||
344 | 87 | $attribute = Mage :: getModel('catalog/product')->setStoreId($storeId)->getResource()->getAttribute($attributeId)->setStoreId($storeId); | ||
345 | 88 | |||
346 | 89 | /* @var $attribute Mage_Catalog_Model_Entity_Attribute */ | ||
347 | 90 | if (!$attribute) { | ||
348 | 91 | $this->_fault('not_exists'); | ||
349 | 92 | } | ||
350 | 93 | |||
351 | 94 | $options = array (); | ||
352 | 95 | foreach ($attribute->getSource()->getAllOptions() as $optionId => $optionValue) { | ||
353 | 96 | if (is_array($optionValue)) { | ||
354 | 97 | $options[] = $optionValue; | ||
355 | 98 | } | ||
356 | 99 | else { | ||
357 | 100 | $options[] = array ( | ||
358 | 101 | 'value' => $optionId, | ||
359 | 102 | 'label' => $optionValue | ||
360 | 103 | ); | ||
361 | 104 | } | ||
362 | 105 | } | ||
363 | 106 | return $options; | ||
364 | 107 | } | ||
365 | 108 | } | ||
366 | 109 | ?> | ||
367 | 0 | 110 | ||
368 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php' | |||
369 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php 1970-01-01 00:00:00 +0000 | |||
370 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php 2011-11-09 09:54:26 +0000 | |||
371 | @@ -0,0 +1,167 @@ | |||
372 | 1 | <?php | ||
373 | 2 | |||
374 | 3 | |||
375 | 4 | /** | ||
376 | 5 | * @author Sharoon Thomas | ||
377 | 6 | * Inspired from Dieter's Magento Extender | ||
378 | 7 | * @copyright 2009 | ||
379 | 8 | */ | ||
380 | 9 | |||
381 | 10 | class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attributegroup extends Mage_Catalog_Model_Api_Resource { | ||
382 | 11 | public function olditems($setId = null) { | ||
383 | 12 | $groups = Mage :: getModel('eav/entity_attribute_group')->getResourceCollection(); | ||
384 | 13 | |||
385 | 14 | if (!is_null($setId) && !empty ($setId) && is_numeric($setId)) { | ||
386 | 15 | $groups->setAttributeSetFilter($setId); | ||
387 | 16 | } | ||
388 | 17 | |||
389 | 18 | $groups->load(); | ||
390 | 19 | |||
391 | 20 | $arrGroups = array (); | ||
392 | 21 | |||
393 | 22 | foreach ($groups as $group) { | ||
394 | 23 | $arrGroups[] = array ( | ||
395 | 24 | 'attribute_group_id' => $group->getAttributeGroupId(), | ||
396 | 25 | 'attribute_set_id' => $group->getAttributeSetId(), | ||
397 | 26 | 'attribute_group_name' => $group->getAttributeGroupName(), | ||
398 | 27 | 'sort_order' => $group->getSortOrder(), | ||
399 | 28 | 'default_id' => $group->getDefaultId() | ||
400 | 29 | ); | ||
401 | 30 | } | ||
402 | 31 | |||
403 | 32 | return $arrGroups; | ||
404 | 33 | } | ||
405 | 34 | |||
406 | 35 | public function items($filters = null) { | ||
407 | 36 | try { | ||
408 | 37 | $collection = Mage :: getModel('eav/entity_attribute_group')->getCollection(); | ||
409 | 38 | } catch (Mage_Core_Exception $e) { | ||
410 | 39 | $this->_fault('group_not_exists'); | ||
411 | 40 | } | ||
412 | 41 | |||
413 | 42 | if (is_array($filters)) { | ||
414 | 43 | try { | ||
415 | 44 | foreach ($filters as $field => $value) { | ||
416 | 45 | $collection->addFieldToFilter($field, $value); | ||
417 | 46 | } | ||
418 | 47 | } catch (Mage_Core_Exception $e) { | ||
419 | 48 | $this->_fault('filters_invalid', $e->getMessage()); | ||
420 | 49 | // If we are adding filter on non-existent attribute | ||
421 | 50 | } | ||
422 | 51 | } | ||
423 | 52 | |||
424 | 53 | $result = array (); | ||
425 | 54 | foreach ($collection as $collection_item) { | ||
426 | 55 | $result[] = $collection_item->toArray(); | ||
427 | 56 | } | ||
428 | 57 | |||
429 | 58 | return $result; | ||
430 | 59 | |||
431 | 60 | } | ||
432 | 61 | /* | ||
433 | 62 | <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param> | ||
434 | 63 | <param><value><string>catalog_product_attribute_group.create</string></value></param> | ||
435 | 64 | <param> | ||
436 | 65 | <value> | ||
437 | 66 | <array> | ||
438 | 67 | <data> | ||
439 | 68 | <value><i4>26</i4></value> | ||
440 | 69 | <value><string>Leonelle</string></value> | ||
441 | 70 | </data> | ||
442 | 71 | </array> | ||
443 | 72 | </value> | ||
444 | 73 | </param> | ||
445 | 74 | */ | ||
446 | 75 | public function create($setId, array $data) { | ||
447 | 76 | try { | ||
448 | 77 | // $attrOption = Mage_Eav_Model_Entity_Attribute_Group | ||
449 | 78 | $attrOption = Mage :: getModel("eav/entity_attribute_group"); | ||
450 | 79 | |||
451 | 80 | $attrOption->addData($data); | ||
452 | 81 | |||
453 | 82 | // check if there already exists a group with the give groupname | ||
454 | 83 | if ($attrOption->itemExists()) { | ||
455 | 84 | $this->_fault("group_already_exists"); | ||
456 | 85 | } | ||
457 | 86 | |||
458 | 87 | $attrOption->save(); | ||
459 | 88 | |||
460 | 89 | return (int) $attrOption->getAttributeGroupId(); | ||
461 | 90 | } catch (Exception $ex) { | ||
462 | 91 | return false; | ||
463 | 92 | } | ||
464 | 93 | } | ||
465 | 94 | /* | ||
466 | 95 | <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param> | ||
467 | 96 | <param><value><string>catalog_product_attribute_group.update</string></value></param> | ||
468 | 97 | <param> | ||
469 | 98 | <value> | ||
470 | 99 | <array> | ||
471 | 100 | <data> | ||
472 | 101 | <value><i4>85</i4></value> | ||
473 | 102 | <value><string>Leonelle2</string></value> | ||
474 | 103 | <value><i4>85</i4></value> | ||
475 | 104 | <value><i4>85</i4></value> | ||
476 | 105 | </data> | ||
477 | 106 | </array> | ||
478 | 107 | </value> | ||
479 | 108 | </param> | ||
480 | 109 | */ | ||
481 | 110 | public function update(array $data) { | ||
482 | 111 | try { | ||
483 | 112 | // $attrOption = Mage_Eav_Model_Entity_Attribute_Group | ||
484 | 113 | $attrOption = Mage :: getModel("eav/entity_attribute_group"); | ||
485 | 114 | |||
486 | 115 | $attrOption->load($data["attribute_group_id"]); | ||
487 | 116 | |||
488 | 117 | // check if the requested group exists... | ||
489 | 118 | if (!$attrOption->getAttributeGroupId()) { | ||
490 | 119 | $this->_fault("group_not_exists"); | ||
491 | 120 | } | ||
492 | 121 | |||
493 | 122 | $attrOption->addData($data); | ||
494 | 123 | |||
495 | 124 | $attrOption->save(); | ||
496 | 125 | |||
497 | 126 | return true; | ||
498 | 127 | } catch (Exception $ex) { | ||
499 | 128 | return false; | ||
500 | 129 | } | ||
501 | 130 | } | ||
502 | 131 | |||
503 | 132 | /* | ||
504 | 133 | <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param> | ||
505 | 134 | <param><value><string>catalog_product_attribute_group.delete</string></value></param> | ||
506 | 135 | <param> | ||
507 | 136 | <value> | ||
508 | 137 | <array> | ||
509 | 138 | <data> | ||
510 | 139 | <value><i4>85</i4></value> | ||
511 | 140 | </data> | ||
512 | 141 | </array> | ||
513 | 142 | </value> | ||
514 | 143 | </param> | ||
515 | 144 | */ | ||
516 | 145 | public function delete($groupId) { | ||
517 | 146 | try { | ||
518 | 147 | // $attrOption = Mage_Eav_Model_Entity_Attribute_Group | ||
519 | 148 | $attrOption = Mage :: getModel("eav/entity_attribute_group"); | ||
520 | 149 | |||
521 | 150 | $attrOption->load($groupId); | ||
522 | 151 | |||
523 | 152 | // check if the requested group exists... | ||
524 | 153 | if (!$attrOption->getAttributeGroupId()) { | ||
525 | 154 | $this->_fault("group_not_exists"); | ||
526 | 155 | } | ||
527 | 156 | |||
528 | 157 | // save data | ||
529 | 158 | $attrOption->delete(); | ||
530 | 159 | |||
531 | 160 | return true; | ||
532 | 161 | } catch (Exception $ex) { | ||
533 | 162 | return false; | ||
534 | 163 | } | ||
535 | 164 | } | ||
536 | 165 | |||
537 | 166 | } | ||
538 | 167 | ?> | ||
539 | 0 | 168 | ||
540 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php' | |||
541 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php 1970-01-01 00:00:00 +0000 | |||
542 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php 2011-11-09 09:54:26 +0000 | |||
543 | @@ -0,0 +1,58 @@ | |||
544 | 1 | <?php | ||
545 | 2 | /** | ||
546 | 3 | * Magento | ||
547 | 4 | * | ||
548 | 5 | * NOTICE OF LICENSE | ||
549 | 6 | * | ||
550 | 7 | * This source file is subject to the Open Software License (OSL 3.0) | ||
551 | 8 | * that is bundled with this package in the file LICENSE.txt. | ||
552 | 9 | * It is also available through the world-wide-web at this URL: | ||
553 | 10 | * http://opensource.org/licenses/osl-3.0.php | ||
554 | 11 | * If you did not receive a copy of the license and are unable to | ||
555 | 12 | * obtain it through the world-wide-web, please send an email | ||
556 | 13 | * to license@magentocommerce.com so we can send you a copy immediately. | ||
557 | 14 | * | ||
558 | 15 | * DISCLAIMER | ||
559 | 16 | * | ||
560 | 17 | * Do not edit or add to this file if you wish to upgrade Magento to newer | ||
561 | 18 | * versions in the future. If you wish to customize Magento for your | ||
562 | 19 | * needs please refer to http://www.magentocommerce.com for more information. | ||
563 | 20 | * | ||
564 | 21 | * @category Mage | ||
565 | 22 | * @package Mage_Catalog | ||
566 | 23 | * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) | ||
567 | 24 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
568 | 25 | */ | ||
569 | 26 | |||
570 | 27 | /** | ||
571 | 28 | * Catalog product attribute set api | ||
572 | 29 | * | ||
573 | 30 | * @category Mage | ||
574 | 31 | * @package Mage_Catalog | ||
575 | 32 | * @author Magento Core Team <core@magentocommerce.com> | ||
576 | 33 | */ | ||
577 | 34 | class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attributeset extends Mage_Api_Model_Resource_Abstract | ||
578 | 35 | { | ||
579 | 36 | /** | ||
580 | 37 | * Retrieve attribute set list | ||
581 | 38 | * | ||
582 | 39 | * @return array | ||
583 | 40 | */ | ||
584 | 41 | public function items() | ||
585 | 42 | { | ||
586 | 43 | $entityType = Mage::getModel('catalog/product')->getResource()->getEntityType(); | ||
587 | 44 | $collection = Mage::getResourceModel('eav/entity_attribute_set_collection') | ||
588 | 45 | ->setEntityTypeFilter($entityType->getId()); | ||
589 | 46 | |||
590 | 47 | $result = array(); | ||
591 | 48 | foreach ($collection as $attributeSet) { | ||
592 | 49 | $result[] = array( | ||
593 | 50 | 'attribute_set_id' => $attributeSet->getId(), | ||
594 | 51 | 'attribute_set_name' => $attributeSet->getAttributeSetName() | ||
595 | 52 | ); | ||
596 | 53 | |||
597 | 54 | } | ||
598 | 55 | |||
599 | 56 | return $result; | ||
600 | 57 | } | ||
601 | 58 | } // Class Mage_Catalog_Model_Product_Attribute_Set_Api End | ||
602 | 0 | \ No newline at end of file | 59 | \ No newline at end of file |
603 | 1 | 60 | ||
604 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php' | |||
605 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php 1970-01-01 00:00:00 +0000 | |||
606 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php 2011-11-09 09:54:26 +0000 | |||
607 | @@ -0,0 +1,71 @@ | |||
608 | 1 | <?php | ||
609 | 2 | |||
610 | 3 | /** | ||
611 | 4 | * Magento | ||
612 | 5 | * | ||
613 | 6 | * NOTICE OF LICENSE | ||
614 | 7 | * | ||
615 | 8 | * This source file is subject to the Open Software License (OSL 3.0) | ||
616 | 9 | * that is bundled with this package in the file LICENSE.txt. | ||
617 | 10 | * It is also available through the world-wide-web at this URL: | ||
618 | 11 | * http://opensource.org/licenses/osl-3.0.php | ||
619 | 12 | * If you did not receive a copy of the license and are unable to | ||
620 | 13 | * obtain it through the world-wide-web, please send an email | ||
621 | 14 | * to license@magentocommerce.com so we can send you a copy immediately. | ||
622 | 15 | * | ||
623 | 16 | * DISCLAIMER | ||
624 | 17 | * | ||
625 | 18 | * Do not edit or add to this file if you wish to upgrade Magento to newer | ||
626 | 19 | * versions in the future. If you wish to customize Magento for your | ||
627 | 20 | * needs please refer to http://www.magentocommerce.com for more information. | ||
628 | 21 | * | ||
629 | 22 | * @category Mage | ||
630 | 23 | * @package Mage_Catalog | ||
631 | 24 | * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) | ||
632 | 25 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
633 | 26 | */ | ||
634 | 27 | |||
635 | 28 | /** | ||
636 | 29 | * Catalog Product tier price api | ||
637 | 30 | * | ||
638 | 31 | * @category Mage | ||
639 | 32 | * @package Mage_Catalog | ||
640 | 33 | * @author Magento Core Team <core@magentocommerce.com> | ||
641 | 34 | */ | ||
642 | 35 | class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Tierprice extends Mage_Catalog_Model_Api_Resource { | ||
643 | 36 | const ATTRIBUTE_CODE = 'tier_price'; | ||
644 | 37 | |||
645 | 38 | |||
646 | 39 | public function items($productIds=null) { | ||
647 | 40 | if (is_array($productIds)) { | ||
648 | 41 | $result = array (); | ||
649 | 42 | foreach ($productIds as $productId) { | ||
650 | 43 | $product = Mage :: getModel('catalog/product')->load($productId); | ||
651 | 44 | if (!$product->getId()) { | ||
652 | 45 | $this->_fault('product_not_exists'); | ||
653 | 46 | } | ||
654 | 47 | $tierPrices = $product->getData(self :: ATTRIBUTE_CODE); | ||
655 | 48 | $result[$productId] = $tierPrices; | ||
656 | 49 | } | ||
657 | 50 | } | ||
658 | 51 | return $result; | ||
659 | 52 | |||
660 | 53 | } | ||
661 | 54 | |||
662 | 55 | public function items2($productIds=null) { | ||
663 | 56 | $product = Mage :: getModel('catalog/product_attribute_backend_tierprice')->_get_set_go(); | ||
664 | 57 | if (!$product->getId()) { | ||
665 | 58 | $this->_fault('product_not_exists'); | ||
666 | 59 | } | ||
667 | 60 | |||
668 | 61 | $tierPrices = $product->getPriceModel()->getTierPriceCount(); | ||
669 | 62 | return 'hello'; | ||
670 | 63 | $result[$productIds] = $tierPrices; | ||
671 | 64 | |||
672 | 65 | |||
673 | 66 | return $result; | ||
674 | 67 | |||
675 | 68 | |||
676 | 69 | } | ||
677 | 70 | |||
678 | 71 | } | ||
679 | 0 | \ No newline at end of file | 72 | \ No newline at end of file |
680 | 1 | 73 | ||
681 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php' | |||
682 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php 1970-01-01 00:00:00 +0000 | |||
683 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php 2011-11-09 09:54:26 +0000 | |||
684 | @@ -0,0 +1,289 @@ | |||
685 | 1 | <?php | ||
686 | 2 | |||
687 | 3 | class Openlabs_OpenERPConnector_Model_Olcatalog_Products extends Mage_Catalog_Model_Api_Resource | ||
688 | 4 | { | ||
689 | 5 | protected $_filtersMap = array( | ||
690 | 6 | 'product_id' => 'entity_id', | ||
691 | 7 | 'set' => 'attribute_set_id', | ||
692 | 8 | 'type' => 'type_id' | ||
693 | 9 | ); | ||
694 | 10 | |||
695 | 11 | public function __construct() | ||
696 | 12 | { | ||
697 | 13 | $this->_storeIdSessionField = 'product_store_id'; | ||
698 | 14 | $this->_ignoredAttributeTypes[] = 'gallery'; | ||
699 | 15 | $this->_ignoredAttributeTypes[] = 'media_image'; | ||
700 | 16 | } | ||
701 | 17 | |||
702 | 18 | /** | ||
703 | 19 | * Retrieve list of products with basic info (id, sku, type, set, name) | ||
704 | 20 | * | ||
705 | 21 | * @param array $filters | ||
706 | 22 | * @param string|int $store | ||
707 | 23 | * @return array | ||
708 | 24 | */ | ||
709 | 25 | public function items($filters = null, $store = null) | ||
710 | 26 | { | ||
711 | 27 | $collection = Mage::getModel('catalog/product')->getCollection() | ||
712 | 28 | ->setStoreId($this->_getStoreId($store)) | ||
713 | 29 | ->addAttributeToSelect('name'); | ||
714 | 30 | |||
715 | 31 | if (is_array($filters)) { | ||
716 | 32 | try { | ||
717 | 33 | foreach ($filters as $field => $value) { | ||
718 | 34 | if (isset($this->_filtersMap[$field])) { | ||
719 | 35 | $field = $this->_filtersMap[$field]; | ||
720 | 36 | } | ||
721 | 37 | |||
722 | 38 | $collection->addFieldToFilter($field, $value); | ||
723 | 39 | } | ||
724 | 40 | } catch (Mage_Core_Exception $e) { | ||
725 | 41 | $this->_fault('filters_invalid', $e->getMessage()); | ||
726 | 42 | } | ||
727 | 43 | } | ||
728 | 44 | |||
729 | 45 | $result = array(); | ||
730 | 46 | |||
731 | 47 | foreach ($collection as $product) { | ||
732 | 48 | // $result[] = $product->getData(); | ||
733 | 49 | $result[] = array( // Basic product data | ||
734 | 50 | 'product_id' => $product->getId(), | ||
735 | 51 | 'sku' => $product->getSku(), | ||
736 | 52 | 'name' => $product->getName(), | ||
737 | 53 | 'set' => $product->getAttributeSetId(), | ||
738 | 54 | 'type' => $product->getTypeId(), | ||
739 | 55 | 'category_ids' => $product->getCategoryIds() | ||
740 | 56 | ); | ||
741 | 57 | } | ||
742 | 58 | |||
743 | 59 | return $result; | ||
744 | 60 | } | ||
745 | 61 | |||
746 | 62 | /** | ||
747 | 63 | * Retrieve product info | ||
748 | 64 | * | ||
749 | 65 | * @param int|string $productId | ||
750 | 66 | * @param string|int $store | ||
751 | 67 | * @param array $attributes | ||
752 | 68 | * @return array | ||
753 | 69 | */ | ||
754 | 70 | public function biglist($productId, $store = null, $filters = null) | ||
755 | 71 | { | ||
756 | 72 | $collection = Mage::getModel('catalog/product')->getCollection() | ||
757 | 73 | ->setStoreId($this->_getStoreId($store)) | ||
758 | 74 | ->addAttributeToSelect('name'); | ||
759 | 75 | |||
760 | 76 | if (is_array($filters)) { | ||
761 | 77 | try { | ||
762 | 78 | foreach ($filters as $field => $value) { | ||
763 | 79 | if (isset($this->_filtersMap[$field])) { | ||
764 | 80 | $field = $this->_filtersMap[$field]; | ||
765 | 81 | } | ||
766 | 82 | |||
767 | 83 | $collection->addFieldToFilter($field, $value); | ||
768 | 84 | } | ||
769 | 85 | } catch (Mage_Core_Exception $e) { | ||
770 | 86 | $this->_fault('filters_invalid', $e->getMessage()); | ||
771 | 87 | } | ||
772 | 88 | } | ||
773 | 89 | foreach ($collection as $product) { | ||
774 | 90 | $data = array(); | ||
775 | 91 | $data = array( // Basic product data | ||
776 | 92 | 'product_id' => $product->getId(), | ||
777 | 93 | 'sku' => $product->getSku(), | ||
778 | 94 | 'set' => $product->getAttributeSetId(), | ||
779 | 95 | 'type' => $product->getTypeId(), | ||
780 | 96 | 'categories' => $product->getCategoryIds(), | ||
781 | 97 | 'websites' => $product->getWebsiteIds() | ||
782 | 98 | ); | ||
783 | 99 | |||
784 | 100 | foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) { | ||
785 | 101 | $data[$attribute->getAttributeCode()] = $product->getData($attribute->getAttributeCode()); | ||
786 | 102 | } | ||
787 | 103 | $result[]=$data; | ||
788 | 104 | } | ||
789 | 105 | return $result; | ||
790 | 106 | } | ||
791 | 107 | |||
792 | 108 | /** | ||
793 | 109 | * Create new product. | ||
794 | 110 | * | ||
795 | 111 | * @param string $type | ||
796 | 112 | * @param int $set | ||
797 | 113 | * @param array $productData | ||
798 | 114 | * @return int | ||
799 | 115 | */ | ||
800 | 116 | public function create($type, $set, $sku, $productData) | ||
801 | 117 | { | ||
802 | 118 | if (!$type || !$set || !$sku) { | ||
803 | 119 | $this->_fault('data_invalid'); | ||
804 | 120 | } | ||
805 | 121 | |||
806 | 122 | $product = Mage::getModel('catalog/product'); | ||
807 | 123 | /* @var $product Mage_Catalog_Model_Product */ | ||
808 | 124 | $product->setStoreId($this->_getStoreId($store)) | ||
809 | 125 | ->setAttributeSetId($set) | ||
810 | 126 | ->setTypeId($type) | ||
811 | 127 | ->setSku($sku); | ||
812 | 128 | |||
813 | 129 | if (isset($productData['website_ids']) && is_array($productData['website_ids'])) { | ||
814 | 130 | $product->setWebsiteIds($productData['website_ids']); | ||
815 | 131 | } | ||
816 | 132 | |||
817 | 133 | foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) { | ||
818 | 134 | if ($this->_isAllowedAttribute($attribute) | ||
819 | 135 | && isset($productData[$attribute->getAttributeCode()])) { | ||
820 | 136 | $product->setData( | ||
821 | 137 | $attribute->getAttributeCode(), | ||
822 | 138 | $productData[$attribute->getAttributeCode()] | ||
823 | 139 | ); | ||
824 | 140 | } | ||
825 | 141 | } | ||
826 | 142 | |||
827 | 143 | $this->_prepareDataForSave($product, $productData); | ||
828 | 144 | |||
829 | 145 | if (is_array($errors = $product->validate())) { | ||
830 | 146 | $this->_fault('data_invalid', implode("\n", $errors)); | ||
831 | 147 | } | ||
832 | 148 | |||
833 | 149 | try { | ||
834 | 150 | $product->save(); | ||
835 | 151 | } catch (Mage_Core_Exception $e) { | ||
836 | 152 | $this->_fault('data_invalid', $e->getMessage()); | ||
837 | 153 | } | ||
838 | 154 | |||
839 | 155 | return $product->getId(); | ||
840 | 156 | } | ||
841 | 157 | |||
842 | 158 | /** | ||
843 | 159 | * Update product data | ||
844 | 160 | * | ||
845 | 161 | * @param int|string $productId | ||
846 | 162 | * @param array $productData | ||
847 | 163 | * @param string|int $store | ||
848 | 164 | * @return boolean | ||
849 | 165 | */ | ||
850 | 166 | public function update($productId, $productData = array(), $store = null) | ||
851 | 167 | { | ||
852 | 168 | $product = $this->_getProduct($productId, $store); | ||
853 | 169 | |||
854 | 170 | if (!$product->getId()) { | ||
855 | 171 | $this->_fault('not_exists'); | ||
856 | 172 | } | ||
857 | 173 | |||
858 | 174 | if (isset($productData['website_ids']) && is_array($productData['website_ids'])) { | ||
859 | 175 | $product->setWebsiteIds($productData['website_ids']); | ||
860 | 176 | } | ||
861 | 177 | |||
862 | 178 | foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) { | ||
863 | 179 | if ($this->_isAllowedAttribute($attribute) | ||
864 | 180 | && isset($productData[$attribute->getAttributeCode()])) { | ||
865 | 181 | $product->setData( | ||
866 | 182 | $attribute->getAttributeCode(), | ||
867 | 183 | $productData[$attribute->getAttributeCode()] | ||
868 | 184 | ); | ||
869 | 185 | } | ||
870 | 186 | } | ||
871 | 187 | |||
872 | 188 | $this->_prepareDataForSave($product, $productData); | ||
873 | 189 | |||
874 | 190 | try { | ||
875 | 191 | if (is_array($errors = $product->validate())) { | ||
876 | 192 | $this->_fault('data_invalid', implode("\n", $errors)); | ||
877 | 193 | } | ||
878 | 194 | } catch (Mage_Core_Exception $e) { | ||
879 | 195 | $this->_fault('data_invalid', $e->getMessage()); | ||
880 | 196 | } | ||
881 | 197 | |||
882 | 198 | try { | ||
883 | 199 | $product->save(); | ||
884 | 200 | } catch (Mage_Core_Exception $e) { | ||
885 | 201 | $this->_fault('data_invalid', $e->getMessage()); | ||
886 | 202 | } | ||
887 | 203 | |||
888 | 204 | return true; | ||
889 | 205 | } | ||
890 | 206 | |||
891 | 207 | /** | ||
892 | 208 | * Set additional data before product saved | ||
893 | 209 | * | ||
894 | 210 | * @param Mage_Catalog_Model_Product $product | ||
895 | 211 | * @param array $productData | ||
896 | 212 | * @return object | ||
897 | 213 | */ | ||
898 | 214 | protected function _prepareDataForSave ($product, $productData) | ||
899 | 215 | { | ||
900 | 216 | if (isset($productData['categories']) && is_array($productData['categories'])) { | ||
901 | 217 | $product->setCategoryIds($productData['categories']); | ||
902 | 218 | } | ||
903 | 219 | |||
904 | 220 | if (isset($productData['websites']) && is_array($productData['websites'])) { | ||
905 | 221 | foreach ($productData['websites'] as &$website) { | ||
906 | 222 | if (is_string($website)) { | ||
907 | 223 | try { | ||
908 | 224 | $website = Mage::app()->getWebsite($website)->getId(); | ||
909 | 225 | } catch (Exception $e) { } | ||
910 | 226 | } | ||
911 | 227 | } | ||
912 | 228 | $product->setWebsiteIds($productData['websites']); | ||
913 | 229 | } | ||
914 | 230 | |||
915 | 231 | if (isset($productData['stock_data']) && is_array($productData['stock_data'])) { | ||
916 | 232 | $product->setStockData($productData['stock_data']); | ||
917 | 233 | } | ||
918 | 234 | } | ||
919 | 235 | |||
920 | 236 | /** | ||
921 | 237 | * Update product special price | ||
922 | 238 | * | ||
923 | 239 | * @param int|string $productId | ||
924 | 240 | * @param float $specialPrice | ||
925 | 241 | * @param string $fromDate | ||
926 | 242 | * @param string $toDate | ||
927 | 243 | * @param string|int $store | ||
928 | 244 | * @return boolean | ||
929 | 245 | */ | ||
930 | 246 | public function setSpecialPrice($productId, $specialPrice = null, $fromDate = null, $toDate = null, $store = null) | ||
931 | 247 | { | ||
932 | 248 | return $this->update($productId, array( | ||
933 | 249 | 'special_price' => $specialPrice, | ||
934 | 250 | 'special_from_date' => $fromDate, | ||
935 | 251 | 'special_to_date' => $toDate | ||
936 | 252 | ), $store); | ||
937 | 253 | } | ||
938 | 254 | |||
939 | 255 | /** | ||
940 | 256 | * Retrieve product special price | ||
941 | 257 | * | ||
942 | 258 | * @param int|string $productId | ||
943 | 259 | * @param string|int $store | ||
944 | 260 | * @return array | ||
945 | 261 | */ | ||
946 | 262 | public function getSpecialPrice($productId, $store = null) | ||
947 | 263 | { | ||
948 | 264 | return $this->info($productId, $store, array('special_price', 'special_from_date', 'special_to_date')); | ||
949 | 265 | } | ||
950 | 266 | |||
951 | 267 | /** | ||
952 | 268 | * Delete product | ||
953 | 269 | * | ||
954 | 270 | * @param int|string $productId | ||
955 | 271 | * @return boolean | ||
956 | 272 | */ | ||
957 | 273 | public function delete($productId) | ||
958 | 274 | { | ||
959 | 275 | $product = $this->_getProduct($productId); | ||
960 | 276 | |||
961 | 277 | if (!$product->getId()) { | ||
962 | 278 | $this->_fault('not_exists'); | ||
963 | 279 | } | ||
964 | 280 | |||
965 | 281 | try { | ||
966 | 282 | $product->delete(); | ||
967 | 283 | } catch (Mage_Core_Exception $e) { | ||
968 | 284 | $this->_fault('not_deleted', $e->getMessage()); | ||
969 | 285 | } | ||
970 | 286 | |||
971 | 287 | return true; | ||
972 | 288 | } | ||
973 | 289 | } // Class Mage_Catalog_Model_Product_Api End | ||
974 | 0 | \ No newline at end of file | 290 | \ No newline at end of file |
975 | 1 | 291 | ||
976 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore' | |||
977 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php' | |||
978 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php 1970-01-01 00:00:00 +0000 | |||
979 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php 2011-11-09 09:54:26 +0000 | |||
980 | @@ -0,0 +1,142 @@ | |||
981 | 1 | <?php | ||
982 | 2 | |||
983 | 3 | /** | ||
984 | 4 | * @author Sharoon Thomas | ||
985 | 5 | * Inspired from Dieter's Magento Extender | ||
986 | 6 | * @copyright 2009 | ||
987 | 7 | */ | ||
988 | 8 | |||
989 | 9 | class Openlabs_OpenERPConnector_Model_Olcore_Groups extends Mage_Catalog_Model_Api_Resource | ||
990 | 10 | { | ||
991 | 11 | public function items($filters=null) | ||
992 | 12 | { | ||
993 | 13 | try | ||
994 | 14 | { | ||
995 | 15 | $collection = Mage::getModel('core/store_group')->getCollection();//->addAttributeToSelect('*'); | ||
996 | 16 | } | ||
997 | 17 | catch (Mage_Core_Exception $e) | ||
998 | 18 | { | ||
999 | 19 | $this->_fault('group_not_exists'); | ||
1000 | 20 | } | ||
1001 | 21 | |||
1002 | 22 | if (is_array($filters)) { | ||
1003 | 23 | try { | ||
1004 | 24 | foreach ($filters as $field => $value) { | ||
1005 | 25 | $collection->addFieldToFilter($field, $value); | ||
1006 | 26 | } | ||
1007 | 27 | } catch (Mage_Core_Exception $e) { | ||
1008 | 28 | $this->_fault('filters_invalid', $e->getMessage()); | ||
1009 | 29 | // If we are adding filter on non-existent attribute | ||
1010 | 30 | } | ||
1011 | 31 | } | ||
1012 | 32 | |||
1013 | 33 | $result = array(); | ||
1014 | 34 | foreach ($collection as $customer) { | ||
1015 | 35 | $result[] = $customer->toArray(); | ||
1016 | 36 | } | ||
1017 | 37 | |||
1018 | 38 | return $result; | ||
1019 | 39 | } | ||
1020 | 40 | |||
1021 | 41 | public function info($groupIds = null) | ||
1022 | 42 | { | ||
1023 | 43 | $groups = array(); | ||
1024 | 44 | |||
1025 | 45 | if(is_array($groupIds)) | ||
1026 | 46 | { | ||
1027 | 47 | foreach($groupIds as $groupId) | ||
1028 | 48 | { | ||
1029 | 49 | try | ||
1030 | 50 | { | ||
1031 | 51 | $groups[] = Mage::getModel('core/store_group')->load($groupId)->toArray(); | ||
1032 | 52 | } | ||
1033 | 53 | catch (Mage_Core_Exception $e) | ||
1034 | 54 | { | ||
1035 | 55 | $this->_fault('group_not_exists'); | ||
1036 | 56 | } | ||
1037 | 57 | } | ||
1038 | 58 | return $groups; | ||
1039 | 59 | } | ||
1040 | 60 | elseif(is_numeric($groupIds)) | ||
1041 | 61 | { | ||
1042 | 62 | try | ||
1043 | 63 | { | ||
1044 | 64 | return Mage::getModel('core/store_group')->load($groupIds)->toArray(); | ||
1045 | 65 | } | ||
1046 | 66 | catch (Mage_Core_Exception $e) | ||
1047 | 67 | { | ||
1048 | 68 | $this->_fault('group_not_exists'); | ||
1049 | 69 | } | ||
1050 | 70 | |||
1051 | 71 | } | ||
1052 | 72 | |||
1053 | 73 | } | ||
1054 | 74 | |||
1055 | 75 | public function create($groupdata) | ||
1056 | 76 | { | ||
1057 | 77 | try | ||
1058 | 78 | { | ||
1059 | 79 | $group = Mage::getModel('core/store_group') | ||
1060 | 80 | ->setData($groupdata) | ||
1061 | 81 | ->save(); | ||
1062 | 82 | |||
1063 | 83 | } | ||
1064 | 84 | catch (Magento_Core_Exception $e) | ||
1065 | 85 | { | ||
1066 | 86 | $this->_fault('data_invalid',$e->getMessage()); | ||
1067 | 87 | } | ||
1068 | 88 | catch (Exception $e) | ||
1069 | 89 | { | ||
1070 | 90 | $this->_fault('data_invalid',$e->getMessage()); | ||
1071 | 91 | } | ||
1072 | 92 | return $group->getId(); | ||
1073 | 93 | } | ||
1074 | 94 | |||
1075 | 95 | public function update($groupid,$groupdata) | ||
1076 | 96 | { | ||
1077 | 97 | try | ||
1078 | 98 | { | ||
1079 | 99 | $group = Mage::getModel('core/store_group') | ||
1080 | 100 | ->load($groupid); | ||
1081 | 101 | if (!$group->getId()) | ||
1082 | 102 | { | ||
1083 | 103 | $this->_fault('group_not_exists'); | ||
1084 | 104 | } | ||
1085 | 105 | $group->addData($groupdata)->save(); | ||
1086 | 106 | } | ||
1087 | 107 | catch (Magento_Core_Exception $e) | ||
1088 | 108 | { | ||
1089 | 109 | $this->_fault('data_invalid',$e->getMessage()); | ||
1090 | 110 | } | ||
1091 | 111 | catch (Exception $e) | ||
1092 | 112 | { | ||
1093 | 113 | $this->_fault('data_invalid',$e->getMessage()); | ||
1094 | 114 | } | ||
1095 | 115 | return true; | ||
1096 | 116 | } | ||
1097 | 117 | |||
1098 | 118 | public function delete($groupid) | ||
1099 | 119 | { | ||
1100 | 120 | try | ||
1101 | 121 | { | ||
1102 | 122 | $group = Mage::getModel('core/store_group') | ||
1103 | 123 | ->load($groupid); | ||
1104 | 124 | if (!$group->getId()) | ||
1105 | 125 | { | ||
1106 | 126 | $this->_fault('group_not_exists'); | ||
1107 | 127 | } | ||
1108 | 128 | $group->delete(); | ||
1109 | 129 | |||
1110 | 130 | } | ||
1111 | 131 | catch (Magento_Core_Exception $e) | ||
1112 | 132 | { | ||
1113 | 133 | $this->_fault('data_invalid',$e->getMessage()); | ||
1114 | 134 | } | ||
1115 | 135 | catch (Exception $e) | ||
1116 | 136 | { | ||
1117 | 137 | $this->_fault('data_invalid',$e->getMessage()); | ||
1118 | 138 | } | ||
1119 | 139 | return true; | ||
1120 | 140 | } | ||
1121 | 141 | } | ||
1122 | 142 | ?> | ||
1123 | 0 | 143 | ||
1124 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php' | |||
1125 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php 1970-01-01 00:00:00 +0000 | |||
1126 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php 2011-11-09 09:54:26 +0000 | |||
1127 | @@ -0,0 +1,142 @@ | |||
1128 | 1 | <?php | ||
1129 | 2 | |||
1130 | 3 | /** | ||
1131 | 4 | * @author Sharoon Thomas | ||
1132 | 5 | * Inspired from Dieter's Magento Extender | ||
1133 | 6 | * @copyright 2009 | ||
1134 | 7 | */ | ||
1135 | 8 | |||
1136 | 9 | class Openlabs_OpenERPConnector_Model_Olcore_Storeviews extends Mage_Catalog_Model_Api_Resource | ||
1137 | 10 | { | ||
1138 | 11 | public function items($filters=null) | ||
1139 | 12 | { | ||
1140 | 13 | try | ||
1141 | 14 | { | ||
1142 | 15 | $collection = Mage::getModel('core/store')->getCollection();//->addAttributeToSelect('*'); | ||
1143 | 16 | } | ||
1144 | 17 | catch (Mage_Core_Exception $e) | ||
1145 | 18 | { | ||
1146 | 19 | $this->_fault('store_not_exists'); | ||
1147 | 20 | } | ||
1148 | 21 | |||
1149 | 22 | if (is_array($filters)) { | ||
1150 | 23 | try { | ||
1151 | 24 | foreach ($filters as $field => $value) { | ||
1152 | 25 | $collection->addFieldToFilter($field, $value); | ||
1153 | 26 | } | ||
1154 | 27 | } catch (Mage_Core_Exception $e) { | ||
1155 | 28 | $this->_fault('filters_invalid', $e->getMessage()); | ||
1156 | 29 | // If we are adding filter on non-existent attribute | ||
1157 | 30 | } | ||
1158 | 31 | } | ||
1159 | 32 | |||
1160 | 33 | $result = array(); | ||
1161 | 34 | foreach ($collection as $customer) { | ||
1162 | 35 | $result[] = $customer->toArray(); | ||
1163 | 36 | } | ||
1164 | 37 | |||
1165 | 38 | return $result; | ||
1166 | 39 | } | ||
1167 | 40 | |||
1168 | 41 | public function info($storeIds = null) | ||
1169 | 42 | { | ||
1170 | 43 | $stores = array(); | ||
1171 | 44 | |||
1172 | 45 | if(is_array($storeIds)) | ||
1173 | 46 | { | ||
1174 | 47 | foreach($storeIds as $storeId) | ||
1175 | 48 | { | ||
1176 | 49 | try | ||
1177 | 50 | { | ||
1178 | 51 | $stores[] = Mage::getModel('core/store')->load($storeId)->toArray(); | ||
1179 | 52 | } | ||
1180 | 53 | catch (Mage_Core_Exception $e) | ||
1181 | 54 | { | ||
1182 | 55 | $this->_fault('store_not_exists'); | ||
1183 | 56 | } | ||
1184 | 57 | } | ||
1185 | 58 | return $stores; | ||
1186 | 59 | } | ||
1187 | 60 | elseif(is_numeric($storeIds)) | ||
1188 | 61 | { | ||
1189 | 62 | try | ||
1190 | 63 | { | ||
1191 | 64 | return Mage::getModel('core/store')->load($storeIds)->toArray(); | ||
1192 | 65 | } | ||
1193 | 66 | catch (Mage_Core_Exception $e) | ||
1194 | 67 | { | ||
1195 | 68 | $this->_fault('store_not_exists'); | ||
1196 | 69 | } | ||
1197 | 70 | |||
1198 | 71 | } | ||
1199 | 72 | |||
1200 | 73 | } | ||
1201 | 74 | |||
1202 | 75 | public function create($storedata) | ||
1203 | 76 | { | ||
1204 | 77 | try | ||
1205 | 78 | { | ||
1206 | 79 | $store = Mage::getModel('core/store') | ||
1207 | 80 | ->setData($storedata) | ||
1208 | 81 | ->save(); | ||
1209 | 82 | |||
1210 | 83 | } | ||
1211 | 84 | catch (Magento_Core_Exception $e) | ||
1212 | 85 | { | ||
1213 | 86 | $this->_fault('data_invalid',$e->getMessage()); | ||
1214 | 87 | } | ||
1215 | 88 | catch (Exception $e) | ||
1216 | 89 | { | ||
1217 | 90 | $this->_fault('data_invalid',$e->getMessage()); | ||
1218 | 91 | } | ||
1219 | 92 | return $store->getId(); | ||
1220 | 93 | } | ||
1221 | 94 | |||
1222 | 95 | public function update($storeid,$storedata) | ||
1223 | 96 | { | ||
1224 | 97 | try | ||
1225 | 98 | { | ||
1226 | 99 | $store = Mage::getModel('core/store') | ||
1227 | 100 | ->load($storeid); | ||
1228 | 101 | if (!$store->getId()) | ||
1229 | 102 | { | ||
1230 | 103 | $this->_fault('store_not_exists'); | ||
1231 | 104 | } | ||
1232 | 105 | $store->addData($storedata)->save(); | ||
1233 | 106 | } | ||
1234 | 107 | catch (Magento_Core_Exception $e) | ||
1235 | 108 | { | ||
1236 | 109 | $this->_fault('data_invalid',$e->getMessage()); | ||
1237 | 110 | } | ||
1238 | 111 | catch (Exception $e) | ||
1239 | 112 | { | ||
1240 | 113 | $this->_fault('data_invalid',$e->getMessage()); | ||
1241 | 114 | } | ||
1242 | 115 | return true; | ||
1243 | 116 | } | ||
1244 | 117 | |||
1245 | 118 | public function delete($storeid) | ||
1246 | 119 | { | ||
1247 | 120 | try | ||
1248 | 121 | { | ||
1249 | 122 | $store = Mage::getModel('core/store') | ||
1250 | 123 | ->load($storeid); | ||
1251 | 124 | if (!$store->getId()) | ||
1252 | 125 | { | ||
1253 | 126 | $this->_fault('store_not_exists'); | ||
1254 | 127 | } | ||
1255 | 128 | $store->delete(); | ||
1256 | 129 | |||
1257 | 130 | } | ||
1258 | 131 | catch (Magento_Core_Exception $e) | ||
1259 | 132 | { | ||
1260 | 133 | $this->_fault('data_invalid',$e->getMessage()); | ||
1261 | 134 | } | ||
1262 | 135 | catch (Exception $e) | ||
1263 | 136 | { | ||
1264 | 137 | $this->_fault('data_invalid',$e->getMessage()); | ||
1265 | 138 | } | ||
1266 | 139 | return true; | ||
1267 | 140 | } | ||
1268 | 141 | } | ||
1269 | 142 | ?> | ||
1270 | 0 | 143 | ||
1271 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php' | |||
1272 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php 1970-01-01 00:00:00 +0000 | |||
1273 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php 2011-11-09 09:54:26 +0000 | |||
1274 | @@ -0,0 +1,171 @@ | |||
1275 | 1 | <?php | ||
1276 | 2 | |||
1277 | 3 | /** | ||
1278 | 4 | * @author Sharoon Thomas | ||
1279 | 5 | * Inspired from Dieter's Magento Extender | ||
1280 | 6 | * @copyright 2009 | ||
1281 | 7 | */ | ||
1282 | 8 | |||
1283 | 9 | class Openlabs_OpenERPConnector_Model_Olcore_Website extends Mage_Catalog_Model_Api_Resource | ||
1284 | 10 | { | ||
1285 | 11 | |||
1286 | 12 | public function items($filters=null) | ||
1287 | 13 | { | ||
1288 | 14 | try | ||
1289 | 15 | { | ||
1290 | 16 | $collection = Mage::getModel('core/website')->getCollection();//->addAttributeToSelect('*'); | ||
1291 | 17 | } | ||
1292 | 18 | catch (Mage_Core_Exception $e) | ||
1293 | 19 | { | ||
1294 | 20 | $this->_fault('store_not_exists'); | ||
1295 | 21 | } | ||
1296 | 22 | |||
1297 | 23 | if (is_array($filters)) { | ||
1298 | 24 | try { | ||
1299 | 25 | foreach ($filters as $field => $value) { | ||
1300 | 26 | $collection->addFieldToFilter($field, $value); | ||
1301 | 27 | } | ||
1302 | 28 | } catch (Mage_Core_Exception $e) { | ||
1303 | 29 | $this->_fault('filters_invalid', $e->getMessage()); | ||
1304 | 30 | // If we are adding filter on non-existent attribute | ||
1305 | 31 | } | ||
1306 | 32 | } | ||
1307 | 33 | |||
1308 | 34 | $result = array(); | ||
1309 | 35 | foreach ($collection as $customer) { | ||
1310 | 36 | $result[] = $customer->toArray(); | ||
1311 | 37 | } | ||
1312 | 38 | |||
1313 | 39 | return $result; | ||
1314 | 40 | } | ||
1315 | 41 | |||
1316 | 42 | public function info($storeIds = null) | ||
1317 | 43 | { | ||
1318 | 44 | $stores = array(); | ||
1319 | 45 | |||
1320 | 46 | if(is_array($storeIds)) | ||
1321 | 47 | { | ||
1322 | 48 | foreach($storeIds as $storeId) | ||
1323 | 49 | { | ||
1324 | 50 | try | ||
1325 | 51 | { | ||
1326 | 52 | $stores[] = Mage::getModel('core/website')->load($storeId)->toArray(); | ||
1327 | 53 | } | ||
1328 | 54 | catch (Mage_Core_Exception $e) | ||
1329 | 55 | { | ||
1330 | 56 | $this->_fault('store_not_exists'); | ||
1331 | 57 | } | ||
1332 | 58 | } | ||
1333 | 59 | return $stores; | ||
1334 | 60 | } | ||
1335 | 61 | elseif(is_numeric($storeIds)) | ||
1336 | 62 | { | ||
1337 | 63 | try | ||
1338 | 64 | { | ||
1339 | 65 | return Mage::getModel('core/website')->load($storeIds)->toArray(); | ||
1340 | 66 | } | ||
1341 | 67 | catch (Mage_Core_Exception $e) | ||
1342 | 68 | { | ||
1343 | 69 | $this->_fault('store_not_exists'); | ||
1344 | 70 | } | ||
1345 | 71 | |||
1346 | 72 | } | ||
1347 | 73 | |||
1348 | 74 | } | ||
1349 | 75 | //This is a protected function used by items & info for fetching website information | ||
1350 | 76 | |||
1351 | 77 | public function create($websitedata) | ||
1352 | 78 | { | ||
1353 | 79 | try | ||
1354 | 80 | { | ||
1355 | 81 | $website = Mage::getModel('core/website') | ||
1356 | 82 | ->setData($websitedata) | ||
1357 | 83 | ->save(); | ||
1358 | 84 | |||
1359 | 85 | } | ||
1360 | 86 | catch (Magento_Core_Exception $e) | ||
1361 | 87 | { | ||
1362 | 88 | $this->_fault('data_invalid',$e->getMessage()); | ||
1363 | 89 | } | ||
1364 | 90 | catch (Exception $e) | ||
1365 | 91 | { | ||
1366 | 92 | $this->_fault('data_invalid',$e->getMessage()); | ||
1367 | 93 | } | ||
1368 | 94 | return $website->getId(); | ||
1369 | 95 | } | ||
1370 | 96 | |||
1371 | 97 | public function update($websiteid,$websitedata) | ||
1372 | 98 | { | ||
1373 | 99 | try | ||
1374 | 100 | { | ||
1375 | 101 | $website = Mage::getModel('core/website') | ||
1376 | 102 | ->load($websiteid); | ||
1377 | 103 | if (!$website->getId()) | ||
1378 | 104 | { | ||
1379 | 105 | $this->_fault('website_not_exists'); | ||
1380 | 106 | } | ||
1381 | 107 | $website->addData($websitedata)->save(); | ||
1382 | 108 | } | ||
1383 | 109 | catch (Magento_Core_Exception $e) | ||
1384 | 110 | { | ||
1385 | 111 | $this->_fault('data_invalid',$e->getMessage()); | ||
1386 | 112 | } | ||
1387 | 113 | catch (Exception $e) | ||
1388 | 114 | { | ||
1389 | 115 | $this->_fault('data_invalid',$e->getMessage()); | ||
1390 | 116 | } | ||
1391 | 117 | return true; | ||
1392 | 118 | } | ||
1393 | 119 | |||
1394 | 120 | public function delete($websiteid) | ||
1395 | 121 | { | ||
1396 | 122 | try | ||
1397 | 123 | { | ||
1398 | 124 | $website = Mage::getModel('core/website') | ||
1399 | 125 | ->load($websiteid); | ||
1400 | 126 | if (!$website->getId()) | ||
1401 | 127 | { | ||
1402 | 128 | $this->_fault('website_not_exists'); | ||
1403 | 129 | } | ||
1404 | 130 | $website->delete(); | ||
1405 | 131 | |||
1406 | 132 | } | ||
1407 | 133 | catch (Magento_Core_Exception $e) | ||
1408 | 134 | { | ||
1409 | 135 | $this->_fault('data_invalid',$e->getMessage()); | ||
1410 | 136 | } | ||
1411 | 137 | catch (Exception $e) | ||
1412 | 138 | { | ||
1413 | 139 | $this->_fault('data_invalid',$e->getMessage()); | ||
1414 | 140 | } | ||
1415 | 141 | return true; | ||
1416 | 142 | } | ||
1417 | 143 | |||
1418 | 144 | public function tree() | ||
1419 | 145 | { | ||
1420 | 146 | $tree = array(); | ||
1421 | 147 | |||
1422 | 148 | $websites = $this->websites(); | ||
1423 | 149 | |||
1424 | 150 | foreach($websites as $website) | ||
1425 | 151 | { | ||
1426 | 152 | $groups = $this->groups($website['group_ids']); | ||
1427 | 153 | $tree[$website['code']] = $website; | ||
1428 | 154 | foreach($groups as $group) | ||
1429 | 155 | { | ||
1430 | 156 | $stores = $this->stores($group["store_ids"]); | ||
1431 | 157 | |||
1432 | 158 | $tree[$website['code']]['groups']['group_'.$group['group_id']] = $group; | ||
1433 | 159 | |||
1434 | 160 | foreach($stores as $store) | ||
1435 | 161 | { | ||
1436 | 162 | $tree[$website['code']]['groups']['group_'.$group['group_id']]['stores'][$store['code']] = $store; | ||
1437 | 163 | } | ||
1438 | 164 | } | ||
1439 | 165 | } | ||
1440 | 166 | |||
1441 | 167 | return $tree; | ||
1442 | 168 | } | ||
1443 | 169 | |||
1444 | 170 | } | ||
1445 | 171 | ?> | ||
1446 | 0 | \ No newline at end of file | 172 | \ No newline at end of file |
1447 | 1 | 173 | ||
1448 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer' | |||
1449 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php' | |||
1450 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php 1970-01-01 00:00:00 +0000 | |||
1451 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php 2011-11-09 09:54:26 +0000 | |||
1452 | @@ -0,0 +1,241 @@ | |||
1453 | 1 | <?php | ||
1454 | 2 | /** | ||
1455 | 3 | * Magento | ||
1456 | 4 | * | ||
1457 | 5 | * NOTICE OF LICENSE | ||
1458 | 6 | * | ||
1459 | 7 | * This source file is subject to the Open Software License (OSL 3.0) | ||
1460 | 8 | * that is bundled with this package in the file LICENSE.txt. | ||
1461 | 9 | * It is also available through the world-wide-web at this URL: | ||
1462 | 10 | * http://opensource.org/licenses/osl-3.0.php | ||
1463 | 11 | * If you did not receive a copy of the license and are unable to | ||
1464 | 12 | * obtain it through the world-wide-web, please send an email | ||
1465 | 13 | * to license@magentocommerce.com so we can send you a copy immediately. | ||
1466 | 14 | * | ||
1467 | 15 | * DISCLAIMER | ||
1468 | 16 | * | ||
1469 | 17 | * Do not edit or add to this file if you wish to upgrade Magento to newer | ||
1470 | 18 | * versions in the future. If you wish to customize Magento for your | ||
1471 | 19 | * needs please refer to http://www.magentocommerce.com for more information. | ||
1472 | 20 | * | ||
1473 | 21 | * @category Mage | ||
1474 | 22 | * @package Mage_Customer | ||
1475 | 23 | * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) | ||
1476 | 24 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
1477 | 25 | */ | ||
1478 | 26 | |||
1479 | 27 | /** | ||
1480 | 28 | * Customer address api | ||
1481 | 29 | * | ||
1482 | 30 | * @category Mage | ||
1483 | 31 | * @package Mage_Customer | ||
1484 | 32 | * @author Magento Core Team <core@magentocommerce.com> | ||
1485 | 33 | */ | ||
1486 | 34 | class Openlabs_OpenERPConnector_Model_Olcustomer_Address extends Mage_Customer_Model_Api_Resource | ||
1487 | 35 | { | ||
1488 | 36 | protected $_mapAttributes = array( | ||
1489 | 37 | 'customer_id' => 'entity_id' | ||
1490 | 38 | ); | ||
1491 | 39 | |||
1492 | 40 | public function __construct() | ||
1493 | 41 | { | ||
1494 | 42 | $this->_ignoredAttributeCodes[] = 'parent_id'; | ||
1495 | 43 | } | ||
1496 | 44 | |||
1497 | 45 | /** | ||
1498 | 46 | * Retrive customer addresses list | ||
1499 | 47 | * | ||
1500 | 48 | * @param int $customerId | ||
1501 | 49 | * @return array | ||
1502 | 50 | */ | ||
1503 | 51 | public function items($customerId) | ||
1504 | 52 | { | ||
1505 | 53 | $customer = Mage::getModel('customer/customer') | ||
1506 | 54 | ->load($customerId); | ||
1507 | 55 | /* @var $customer Mage_Customer_Model_Customer */ | ||
1508 | 56 | |||
1509 | 57 | if (!$customer->getId()) { | ||
1510 | 58 | $this->_fault('customer_not_exists'); | ||
1511 | 59 | } | ||
1512 | 60 | |||
1513 | 61 | $result = array(); | ||
1514 | 62 | foreach ($customer->getAddresses() as $address) { | ||
1515 | 63 | $data = $address->toArray(); | ||
1516 | 64 | $data['default_billing'] = $customer->getDefaultBilling() == $address->getId(); | ||
1517 | 65 | $data['default_shipping'] = $customer->getDefaultShipping() == $address->getId(); | ||
1518 | 66 | $result[] = $data; | ||
1519 | 67 | /*$data = $address->toArray(); | ||
1520 | 68 | $row = array(); | ||
1521 | 69 | |||
1522 | 70 | foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) { | ||
1523 | 71 | $row[$attributeAlias] = isset($data[$attributeCode]) ? $data[$attributeCode] : null; | ||
1524 | 72 | } | ||
1525 | 73 | |||
1526 | 74 | foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) { | ||
1527 | 75 | if (isset($data[$attributeCode])) { | ||
1528 | 76 | $row[$attributeCode] = $data[$attributeCode]; | ||
1529 | 77 | } | ||
1530 | 78 | } | ||
1531 | 79 | |||
1532 | 80 | $row['is_default_billing'] = $customer->getDefaultBillingAddress() == $address->getId(); | ||
1533 | 81 | $row['is_default_shipping'] = $customer->getDefaultShippingAddress() == $address->getId(); | ||
1534 | 82 | |||
1535 | 83 | $result[] = $row;*/ | ||
1536 | 84 | |||
1537 | 85 | } | ||
1538 | 86 | |||
1539 | 87 | return $result; | ||
1540 | 88 | } | ||
1541 | 89 | |||
1542 | 90 | /** | ||
1543 | 91 | * Create new address for customer | ||
1544 | 92 | * | ||
1545 | 93 | * @param int $customerId | ||
1546 | 94 | * @param array $addressData | ||
1547 | 95 | * @return int | ||
1548 | 96 | */ | ||
1549 | 97 | public function create($customerId, $addressData) | ||
1550 | 98 | { | ||
1551 | 99 | $customer = Mage::getModel('customer/customer') | ||
1552 | 100 | ->load($customerId); | ||
1553 | 101 | /* @var $customer Mage_Customer_Model_Customer */ | ||
1554 | 102 | |||
1555 | 103 | if (!$customer->getId()) { | ||
1556 | 104 | $this->_fault('customer_not_exists'); | ||
1557 | 105 | } | ||
1558 | 106 | |||
1559 | 107 | $address = Mage::getModel('customer/address'); | ||
1560 | 108 | |||
1561 | 109 | foreach ($this->getAllowedAttributes($address) as $attributeCode=>$attribute) { | ||
1562 | 110 | if (isset($addressData[$attributeCode])) { | ||
1563 | 111 | $address->setData($attributeCode, $addressData[$attributeCode]); | ||
1564 | 112 | } | ||
1565 | 113 | } | ||
1566 | 114 | |||
1567 | 115 | if (isset($addressData['is_default_billing'])) { | ||
1568 | 116 | $address->setIsDefaultBilling($addressData['is_default_billing']); | ||
1569 | 117 | } | ||
1570 | 118 | |||
1571 | 119 | if (isset($addressData['is_default_shipping'])) { | ||
1572 | 120 | $address->setIsDefaultShipping($addressData['is_default_shipping']); | ||
1573 | 121 | } | ||
1574 | 122 | |||
1575 | 123 | $address->setCustomerId($customer->getId()); | ||
1576 | 124 | |||
1577 | 125 | $valid = $address->validate(); | ||
1578 | 126 | |||
1579 | 127 | if (is_array($valid)) { | ||
1580 | 128 | $this->_fault('data_invalid', implode("\n", $valid)); | ||
1581 | 129 | } | ||
1582 | 130 | |||
1583 | 131 | try { | ||
1584 | 132 | $address->save(); | ||
1585 | 133 | } catch (Mage_Core_Exception $e) { | ||
1586 | 134 | $this->_fault('data_invalid', $e->getMessage()); | ||
1587 | 135 | } | ||
1588 | 136 | |||
1589 | 137 | return $address->getId(); | ||
1590 | 138 | } | ||
1591 | 139 | |||
1592 | 140 | /** | ||
1593 | 141 | * Retrieve address data | ||
1594 | 142 | * | ||
1595 | 143 | * @param int $addressId | ||
1596 | 144 | * @return array | ||
1597 | 145 | */ | ||
1598 | 146 | public function info($addressId) | ||
1599 | 147 | { | ||
1600 | 148 | $address = Mage::getModel('customer/address') | ||
1601 | 149 | ->load($addressId); | ||
1602 | 150 | |||
1603 | 151 | if (!$address->getId()) { | ||
1604 | 152 | $this->_fault('not_exists'); | ||
1605 | 153 | } | ||
1606 | 154 | |||
1607 | 155 | $result = array(); | ||
1608 | 156 | |||
1609 | 157 | foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) { | ||
1610 | 158 | $result[$attributeAlias] = $address->getData($attributeCode); | ||
1611 | 159 | } | ||
1612 | 160 | |||
1613 | 161 | foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) { | ||
1614 | 162 | $result[$attributeCode] = $address->getData($attributeCode); | ||
1615 | 163 | } | ||
1616 | 164 | |||
1617 | 165 | |||
1618 | 166 | if ($customer = $address->getCustomer()) { | ||
1619 | 167 | $result['is_default_billing'] = $customer->getDefaultBillingAddress() == $address->getId(); | ||
1620 | 168 | $result['is_default_shipping'] = $customer->getDefaultShippingAddress() == $address->getId(); | ||
1621 | 169 | } | ||
1622 | 170 | |||
1623 | 171 | return $result; | ||
1624 | 172 | } | ||
1625 | 173 | |||
1626 | 174 | /** | ||
1627 | 175 | * Update address data | ||
1628 | 176 | * | ||
1629 | 177 | * @param int $addressId | ||
1630 | 178 | * @param array $addressData | ||
1631 | 179 | * @return boolean | ||
1632 | 180 | */ | ||
1633 | 181 | public function update($addressId, $addressData) | ||
1634 | 182 | { | ||
1635 | 183 | $address = Mage::getModel('customer/address') | ||
1636 | 184 | ->load($addressId); | ||
1637 | 185 | |||
1638 | 186 | if (!$address->getId()) { | ||
1639 | 187 | $this->_fault('not_exists'); | ||
1640 | 188 | } | ||
1641 | 189 | |||
1642 | 190 | foreach ($this->getAllowedAttributes($address) as $attributeCode=>$attribute) { | ||
1643 | 191 | if (isset($addressData[$attributeCode])) { | ||
1644 | 192 | $address->setData($attributeCode, $addressData[$attributeCode]); | ||
1645 | 193 | } | ||
1646 | 194 | } | ||
1647 | 195 | |||
1648 | 196 | if (isset($addressData['is_default_billing'])) { | ||
1649 | 197 | $address->setIsDefaultBilling($addressData['is_default_billing']); | ||
1650 | 198 | } | ||
1651 | 199 | |||
1652 | 200 | if (isset($addressData['is_default_shipping'])) { | ||
1653 | 201 | $address->setIsDefaultShipping($addressData['is_default_shipping']); | ||
1654 | 202 | } | ||
1655 | 203 | |||
1656 | 204 | $valid = $address->validate(); | ||
1657 | 205 | if (is_array($valid)) { | ||
1658 | 206 | $this->_fault('data_invalid', implode("\n", $valid)); | ||
1659 | 207 | } | ||
1660 | 208 | |||
1661 | 209 | try { | ||
1662 | 210 | $address->save(); | ||
1663 | 211 | } catch (Mage_Core_Exception $e) { | ||
1664 | 212 | $this->_fault('data_invalid', $e->getMessage()); | ||
1665 | 213 | } | ||
1666 | 214 | |||
1667 | 215 | return true; | ||
1668 | 216 | } | ||
1669 | 217 | |||
1670 | 218 | /** | ||
1671 | 219 | * Delete address | ||
1672 | 220 | * | ||
1673 | 221 | * @param int $addressId | ||
1674 | 222 | * @return boolean | ||
1675 | 223 | */ | ||
1676 | 224 | public function delete($addressId) | ||
1677 | 225 | { | ||
1678 | 226 | $address = Mage::getModel('customer/address') | ||
1679 | 227 | ->load($addressId); | ||
1680 | 228 | |||
1681 | 229 | if (!$address->getId()) { | ||
1682 | 230 | $this->_fault('not_exists'); | ||
1683 | 231 | } | ||
1684 | 232 | |||
1685 | 233 | try { | ||
1686 | 234 | $address->delete(); | ||
1687 | 235 | } catch (Mage_Core_Exception $e) { | ||
1688 | 236 | $this->_fault('not_deleted', $e->getMessage()); | ||
1689 | 237 | } | ||
1690 | 238 | |||
1691 | 239 | return true; | ||
1692 | 240 | } | ||
1693 | 241 | } // Class Mage_Customer_Model_Address_Api End | ||
1694 | 0 | \ No newline at end of file | 242 | \ No newline at end of file |
1695 | 1 | 243 | ||
1696 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php' | |||
1697 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php 1970-01-01 00:00:00 +0000 | |||
1698 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php 2011-11-09 09:54:26 +0000 | |||
1699 | @@ -0,0 +1,142 @@ | |||
1700 | 1 | <?php | ||
1701 | 2 | |||
1702 | 3 | /** | ||
1703 | 4 | * @author Sharoon Thomas | ||
1704 | 5 | * Inspired from Dieter's Magento Extender | ||
1705 | 6 | * @copyright 2009 | ||
1706 | 7 | */ | ||
1707 | 8 | |||
1708 | 9 | class Openlabs_OpenERPConnector_Model_Olcustomer_Customer extends Mage_Catalog_Model_Api_Resource | ||
1709 | 10 | { | ||
1710 | 11 | public function items($filters=null) | ||
1711 | 12 | { | ||
1712 | 13 | try | ||
1713 | 14 | { | ||
1714 | 15 | $collection = Mage::getModel('customer')->getCollection();//->addAttributeToSelect('*'); | ||
1715 | 16 | } | ||
1716 | 17 | catch (Mage_Core_Exception $e) | ||
1717 | 18 | { | ||
1718 | 19 | $this->_fault('customer_not_exists'); | ||
1719 | 20 | } | ||
1720 | 21 | |||
1721 | 22 | if (is_array($filters)) { | ||
1722 | 23 | try { | ||
1723 | 24 | foreach ($filters as $field => $value) { | ||
1724 | 25 | $collection->addFieldToFilter($field, $value); | ||
1725 | 26 | } | ||
1726 | 27 | } catch (Mage_Core_Exception $e) { | ||
1727 | 28 | $this->_fault('filters_invalid', $e->getMessage()); | ||
1728 | 29 | // If we are adding filter on non-existent attribute | ||
1729 | 30 | } | ||
1730 | 31 | } | ||
1731 | 32 | |||
1732 | 33 | $result = array(); | ||
1733 | 34 | foreach ($collection as $customer) { | ||
1734 | 35 | $result[] = $customer->toArray(); | ||
1735 | 36 | } | ||
1736 | 37 | |||
1737 | 38 | return $result; | ||
1738 | 39 | } | ||
1739 | 40 | |||
1740 | 41 | public function info($groupIds = null) | ||
1741 | 42 | { | ||
1742 | 43 | $groups = array(); | ||
1743 | 44 | |||
1744 | 45 | if(is_array($groupIds)) | ||
1745 | 46 | { | ||
1746 | 47 | foreach($groupIds as $groupId) | ||
1747 | 48 | { | ||
1748 | 49 | try | ||
1749 | 50 | { | ||
1750 | 51 | $groups[] = Mage::getModel('customer')->load($groupId)->toArray(); | ||
1751 | 52 | } | ||
1752 | 53 | catch (Mage_Core_Exception $e) | ||
1753 | 54 | { | ||
1754 | 55 | $this->_fault('customer_not_exists'); | ||
1755 | 56 | } | ||
1756 | 57 | } | ||
1757 | 58 | return $groups; | ||
1758 | 59 | } | ||
1759 | 60 | elseif(is_numeric($groupIds)) | ||
1760 | 61 | { | ||
1761 | 62 | try | ||
1762 | 63 | { | ||
1763 | 64 | return Mage::getModel('customer')->load($groupIds)->toArray(); | ||
1764 | 65 | } | ||
1765 | 66 | catch (Mage_Core_Exception $e) | ||
1766 | 67 | { | ||
1767 | 68 | $this->_fault('customer_not_exists'); | ||
1768 | 69 | } | ||
1769 | 70 | |||
1770 | 71 | } | ||
1771 | 72 | |||
1772 | 73 | } | ||
1773 | 74 | |||
1774 | 75 | public function create($groupdata) | ||
1775 | 76 | { | ||
1776 | 77 | try | ||
1777 | 78 | { | ||
1778 | 79 | $group = Mage::getModel('customer') | ||
1779 | 80 | ->setData($groupdata) | ||
1780 | 81 | ->save(); | ||
1781 | 82 | |||
1782 | 83 | } | ||
1783 | 84 | catch (Magento_Core_Exception $e) | ||
1784 | 85 | { | ||
1785 | 86 | $this->_fault('data_invalid',$e->getMessage()); | ||
1786 | 87 | } | ||
1787 | 88 | catch (Exception $e) | ||
1788 | 89 | { | ||
1789 | 90 | $this->_fault('data_invalid',$e->getMessage()); | ||
1790 | 91 | } | ||
1791 | 92 | return $group->getId(); | ||
1792 | 93 | } | ||
1793 | 94 | |||
1794 | 95 | public function update($groupid,$groupdata) | ||
1795 | 96 | { | ||
1796 | 97 | try | ||
1797 | 98 | { | ||
1798 | 99 | $group = Mage::getModel('customer') | ||
1799 | 100 | ->load($groupid); | ||
1800 | 101 | if (!$group->getId()) | ||
1801 | 102 | { | ||
1802 | 103 | $this->_fault('customer_not_exists'); | ||
1803 | 104 | } | ||
1804 | 105 | $group->addData($groupdata)->save(); | ||
1805 | 106 | } | ||
1806 | 107 | catch (Magento_Core_Exception $e) | ||
1807 | 108 | { | ||
1808 | 109 | $this->_fault('data_invalid',$e->getMessage()); | ||
1809 | 110 | } | ||
1810 | 111 | catch (Exception $e) | ||
1811 | 112 | { | ||
1812 | 113 | $this->_fault('data_invalid',$e->getMessage()); | ||
1813 | 114 | } | ||
1814 | 115 | return true; | ||
1815 | 116 | } | ||
1816 | 117 | |||
1817 | 118 | public function delete($groupid) | ||
1818 | 119 | { | ||
1819 | 120 | try | ||
1820 | 121 | { | ||
1821 | 122 | $group = Mage::getModel('customer') | ||
1822 | 123 | ->load($groupid); | ||
1823 | 124 | if (!$group->getId()) | ||
1824 | 125 | { | ||
1825 | 126 | $this->_fault('customer_not_exists'); | ||
1826 | 127 | } | ||
1827 | 128 | $group->delete(); | ||
1828 | 129 | |||
1829 | 130 | } | ||
1830 | 131 | catch (Magento_Core_Exception $e) | ||
1831 | 132 | { | ||
1832 | 133 | $this->_fault('data_invalid',$e->getMessage()); | ||
1833 | 134 | } | ||
1834 | 135 | catch (Exception $e) | ||
1835 | 136 | { | ||
1836 | 137 | $this->_fault('data_invalid',$e->getMessage()); | ||
1837 | 138 | } | ||
1838 | 139 | return true; | ||
1839 | 140 | } | ||
1840 | 141 | } | ||
1841 | 142 | ?> | ||
1842 | 0 | 143 | ||
1843 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php' | |||
1844 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php 1970-01-01 00:00:00 +0000 | |||
1845 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php 2011-11-09 09:54:26 +0000 | |||
1846 | @@ -0,0 +1,142 @@ | |||
1847 | 1 | <?php | ||
1848 | 2 | |||
1849 | 3 | /** | ||
1850 | 4 | * @author Sharoon Thomas | ||
1851 | 5 | * Inspired from Dieter's Magento Extender | ||
1852 | 6 | * @copyright 2009 | ||
1853 | 7 | */ | ||
1854 | 8 | |||
1855 | 9 | class Openlabs_OpenERPConnector_Model_Olcustomer_Group extends Mage_Catalog_Model_Api_Resource | ||
1856 | 10 | { | ||
1857 | 11 | public function items($filters=null) | ||
1858 | 12 | { | ||
1859 | 13 | try | ||
1860 | 14 | { | ||
1861 | 15 | $collection = Mage::getModel('customer/group')->getCollection();//->addAttributeToSelect('*'); | ||
1862 | 16 | } | ||
1863 | 17 | catch (Mage_Core_Exception $e) | ||
1864 | 18 | { | ||
1865 | 19 | $this->_fault('group_not_exists'); | ||
1866 | 20 | } | ||
1867 | 21 | |||
1868 | 22 | if (is_array($filters)) { | ||
1869 | 23 | try { | ||
1870 | 24 | foreach ($filters as $field => $value) { | ||
1871 | 25 | $collection->addFieldToFilter($field, $value); | ||
1872 | 26 | } | ||
1873 | 27 | } catch (Mage_Core_Exception $e) { | ||
1874 | 28 | $this->_fault('filters_invalid', $e->getMessage()); | ||
1875 | 29 | // If we are adding filter on non-existent attribute | ||
1876 | 30 | } | ||
1877 | 31 | } | ||
1878 | 32 | |||
1879 | 33 | $result = array(); | ||
1880 | 34 | foreach ($collection as $customer) { | ||
1881 | 35 | $result[] = $customer->toArray(); | ||
1882 | 36 | } | ||
1883 | 37 | |||
1884 | 38 | return $result; | ||
1885 | 39 | } | ||
1886 | 40 | |||
1887 | 41 | public function info($groupIds = null) | ||
1888 | 42 | { | ||
1889 | 43 | $groups = array(); | ||
1890 | 44 | |||
1891 | 45 | if(is_array($groupIds)) | ||
1892 | 46 | { | ||
1893 | 47 | foreach($groupIds as $groupId) | ||
1894 | 48 | { | ||
1895 | 49 | try | ||
1896 | 50 | { | ||
1897 | 51 | $groups[] = Mage::getModel('customer/group')->load($groupId)->toArray(); | ||
1898 | 52 | } | ||
1899 | 53 | catch (Mage_Core_Exception $e) | ||
1900 | 54 | { | ||
1901 | 55 | $this->_fault('group_not_exists'); | ||
1902 | 56 | } | ||
1903 | 57 | } | ||
1904 | 58 | return $groups; | ||
1905 | 59 | } | ||
1906 | 60 | elseif(is_numeric($groupIds)) | ||
1907 | 61 | { | ||
1908 | 62 | try | ||
1909 | 63 | { | ||
1910 | 64 | return Mage::getModel('customer/group')->load($groupIds)->toArray(); | ||
1911 | 65 | } | ||
1912 | 66 | catch (Mage_Core_Exception $e) | ||
1913 | 67 | { | ||
1914 | 68 | $this->_fault('group_not_exists'); | ||
1915 | 69 | } | ||
1916 | 70 | |||
1917 | 71 | } | ||
1918 | 72 | |||
1919 | 73 | } | ||
1920 | 74 | |||
1921 | 75 | public function create($groupdata) | ||
1922 | 76 | { | ||
1923 | 77 | try | ||
1924 | 78 | { | ||
1925 | 79 | $group = Mage::getModel('customer/group') | ||
1926 | 80 | ->setData($groupdata) | ||
1927 | 81 | ->save(); | ||
1928 | 82 | |||
1929 | 83 | } | ||
1930 | 84 | catch (Magento_Core_Exception $e) | ||
1931 | 85 | { | ||
1932 | 86 | $this->_fault('data_invalid',$e->getMessage()); | ||
1933 | 87 | } | ||
1934 | 88 | catch (Exception $e) | ||
1935 | 89 | { | ||
1936 | 90 | $this->_fault('data_invalid',$e->getMessage()); | ||
1937 | 91 | } | ||
1938 | 92 | return $group->getId(); | ||
1939 | 93 | } | ||
1940 | 94 | |||
1941 | 95 | public function update($groupid,$groupdata) | ||
1942 | 96 | { | ||
1943 | 97 | try | ||
1944 | 98 | { | ||
1945 | 99 | $group = Mage::getModel('customer/group') | ||
1946 | 100 | ->load($groupid); | ||
1947 | 101 | if (!$group->getId()) | ||
1948 | 102 | { | ||
1949 | 103 | $this->_fault('group_not_exists'); | ||
1950 | 104 | } | ||
1951 | 105 | $group->addData($groupdata)->save(); | ||
1952 | 106 | } | ||
1953 | 107 | catch (Magento_Core_Exception $e) | ||
1954 | 108 | { | ||
1955 | 109 | $this->_fault('data_invalid',$e->getMessage()); | ||
1956 | 110 | } | ||
1957 | 111 | catch (Exception $e) | ||
1958 | 112 | { | ||
1959 | 113 | $this->_fault('data_invalid',$e->getMessage()); | ||
1960 | 114 | } | ||
1961 | 115 | return true; | ||
1962 | 116 | } | ||
1963 | 117 | |||
1964 | 118 | public function delete($groupid) | ||
1965 | 119 | { | ||
1966 | 120 | try | ||
1967 | 121 | { | ||
1968 | 122 | $group = Mage::getModel('customer/group') | ||
1969 | 123 | ->load($groupid); | ||
1970 | 124 | if (!$group->getId()) | ||
1971 | 125 | { | ||
1972 | 126 | $this->_fault('group_not_exists'); | ||
1973 | 127 | } | ||
1974 | 128 | $group->delete(); | ||
1975 | 129 | |||
1976 | 130 | } | ||
1977 | 131 | catch (Magento_Core_Exception $e) | ||
1978 | 132 | { | ||
1979 | 133 | $this->_fault('data_invalid',$e->getMessage()); | ||
1980 | 134 | } | ||
1981 | 135 | catch (Exception $e) | ||
1982 | 136 | { | ||
1983 | 137 | $this->_fault('data_invalid',$e->getMessage()); | ||
1984 | 138 | } | ||
1985 | 139 | return true; | ||
1986 | 140 | } | ||
1987 | 141 | } | ||
1988 | 142 | ?> | ||
1989 | 0 | 143 | ||
1990 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php' | |||
1991 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php 1970-01-01 00:00:00 +0000 | |||
1992 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php 2011-11-09 09:54:26 +0000 | |||
1993 | @@ -0,0 +1,163 @@ | |||
1994 | 1 | <?php | ||
1995 | 2 | /** | ||
1996 | 3 | * Magento | ||
1997 | 4 | * | ||
1998 | 5 | * NOTICE OF LICENSE | ||
1999 | 6 | * | ||
2000 | 7 | * This source file is subject to the Open Software License (OSL 3.0) | ||
2001 | 8 | * that is bundled with this package in the file LICENSE.txt. | ||
2002 | 9 | * It is also available through the world-wide-web at this URL: | ||
2003 | 10 | * http://opensource.org/licenses/osl-3.0.php | ||
2004 | 11 | * If you did not receive a copy of the license and are unable to | ||
2005 | 12 | * obtain it through the world-wide-web, please send an email | ||
2006 | 13 | * to license@magentocommerce.com so we can send you a copy immediately. | ||
2007 | 14 | * | ||
2008 | 15 | * DISCLAIMER | ||
2009 | 16 | * | ||
2010 | 17 | * Do not edit or add to this file if you wish to upgrade Magento to newer | ||
2011 | 18 | * versions in the future. If you wish to customize Magento for your | ||
2012 | 19 | * needs please refer to http://www.magentocommerce.com for more information. | ||
2013 | 20 | * | ||
2014 | 21 | * @category Mage | ||
2015 | 22 | * @package Mage_Customer | ||
2016 | 23 | * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) | ||
2017 | 24 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
2018 | 25 | */ | ||
2019 | 26 | |||
2020 | 27 | /** | ||
2021 | 28 | * Customer address api | ||
2022 | 29 | * | ||
2023 | 30 | * @category Mage | ||
2024 | 31 | * @package Mage_Customer | ||
2025 | 32 | * @author Magento Core Team <core@magentocommerce.com> | ||
2026 | 33 | */ | ||
2027 | 34 | class Openlabs_OpenERPConnector_Model_Olcustomer_Subscriber extends Mage_Customer_Model_Api_Resource | ||
2028 | 35 | { | ||
2029 | 36 | protected $_mapAttributes = array( | ||
2030 | 37 | 'customer_id' => 'entity_id' | ||
2031 | 38 | ); | ||
2032 | 39 | |||
2033 | 40 | public function __construct() | ||
2034 | 41 | { | ||
2035 | 42 | $this->_ignoredAttributeCodes[] = 'parent_id'; | ||
2036 | 43 | } | ||
2037 | 44 | |||
2038 | 45 | /** | ||
2039 | 46 | * Retrive subscriber list | ||
2040 | 47 | * | ||
2041 | 48 | * @param int $filters | ||
2042 | 49 | * @return array | ||
2043 | 50 | */ | ||
2044 | 51 | public function items($filters=null) | ||
2045 | 52 | { | ||
2046 | 53 | $collection = Mage::getModel('customer/customer')->getCollection() | ||
2047 | 54 | ->addAttributeToSelect('*'); | ||
2048 | 55 | |||
2049 | 56 | |||
2050 | 57 | if (is_array($filters)) { | ||
2051 | 58 | try { | ||
2052 | 59 | foreach ($filters as $field => $value) { | ||
2053 | 60 | $collection->addFieldToFilter($field, $value); | ||
2054 | 61 | } | ||
2055 | 62 | } catch (Mage_Core_Exception $e) { | ||
2056 | 63 | $this->_fault('filters_invalid', $e->getMessage()); | ||
2057 | 64 | // If we are adding filter on non-existent attribute | ||
2058 | 65 | } | ||
2059 | 66 | } | ||
2060 | 67 | |||
2061 | 68 | $result = array(); | ||
2062 | 69 | |||
2063 | 70 | foreach ($collection as $customer) { | ||
2064 | 71 | $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer['email']); | ||
2065 | 72 | if($subscriber->getId()) | ||
2066 | 73 | $result[] = $subscriber->getId(); | ||
2067 | 74 | } | ||
2068 | 75 | |||
2069 | 76 | return $result; | ||
2070 | 77 | } | ||
2071 | 78 | |||
2072 | 79 | /** | ||
2073 | 80 | * Create new address for customer | ||
2074 | 81 | * | ||
2075 | 82 | * @param int $customerId | ||
2076 | 83 | * @param array $email | ||
2077 | 84 | * @return int | ||
2078 | 85 | */ | ||
2079 | 86 | public function create($customerId,$email) | ||
2080 | 87 | { | ||
2081 | 88 | if($customerId && $email): | ||
2082 | 89 | $customer = Mage::getModel("newsletter/subscriber"); | ||
2083 | 90 | |||
2084 | 91 | $customer->setCustomerId($customerId); | ||
2085 | 92 | $customer->setEmail($email); | ||
2086 | 93 | $customer->subscriber_status = "1"; | ||
2087 | 94 | |||
2088 | 95 | $customer->save(); | ||
2089 | 96 | |||
2090 | 97 | return $customer->getId(); | ||
2091 | 98 | else: | ||
2092 | 99 | return False; | ||
2093 | 100 | endif; | ||
2094 | 101 | } | ||
2095 | 102 | |||
2096 | 103 | /** | ||
2097 | 104 | * Retrieve subscriber data | ||
2098 | 105 | * | ||
2099 | 106 | * @param int $subscriberId | ||
2100 | 107 | * @return array | ||
2101 | 108 | */ | ||
2102 | 109 | public function info($subscriberId) | ||
2103 | 110 | { | ||
2104 | 111 | $subscriber = Mage::getModel('newsletter/subscriber')->load($subscriberId); | ||
2105 | 112 | |||
2106 | 113 | if($subscriber->getId()): | ||
2107 | 114 | $result[] = $subscriber->toArray(); | ||
2108 | 115 | endif; | ||
2109 | 116 | |||
2110 | 117 | return $result; | ||
2111 | 118 | } | ||
2112 | 119 | |||
2113 | 120 | /** | ||
2114 | 121 | * Update subscriber data (subscriber) | ||
2115 | 122 | * | ||
2116 | 123 | * @param $email | ||
2117 | 124 | * @return boolean | ||
2118 | 125 | */ | ||
2119 | 126 | public function update($email) | ||
2120 | 127 | { | ||
2121 | 128 | if($email): | ||
2122 | 129 | $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email); | ||
2123 | 130 | |||
2124 | 131 | if($subscriber->getId()): | ||
2125 | 132 | $customer = Mage::getModel("newsletter/subscriber")->load($subscriber->getId()); | ||
2126 | 133 | $customer->subscriber_status = "1"; | ||
2127 | 134 | $customer->save(); | ||
2128 | 135 | endif; | ||
2129 | 136 | |||
2130 | 137 | return $subscriber->getId(); | ||
2131 | 138 | else: | ||
2132 | 139 | return False; | ||
2133 | 140 | endif; | ||
2134 | 141 | } | ||
2135 | 142 | |||
2136 | 143 | /** | ||
2137 | 144 | * Delete subscriber (unsubscriber) | ||
2138 | 145 | * | ||
2139 | 146 | * @param $email | ||
2140 | 147 | * @return boolean | ||
2141 | 148 | */ | ||
2142 | 149 | public function delete($email) | ||
2143 | 150 | { | ||
2144 | 151 | if($email): | ||
2145 | 152 | $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email); | ||
2146 | 153 | |||
2147 | 154 | if($subscriber->getId()): | ||
2148 | 155 | Mage::getModel('newsletter/subscriber')->load($subscriber->getId())->unsubscribe(); | ||
2149 | 156 | endif; | ||
2150 | 157 | |||
2151 | 158 | return $subscriber->getId(); | ||
2152 | 159 | else: | ||
2153 | 160 | return False; | ||
2154 | 161 | endif; | ||
2155 | 162 | } | ||
2156 | 163 | } // Class Mage_Customer_Model_Address_Api End | ||
2157 | 0 | 164 | ||
2158 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales' | |||
2159 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order' | |||
2160 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php' | |||
2161 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php 1970-01-01 00:00:00 +0000 | |||
2162 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php 2011-11-09 09:54:26 +0000 | |||
2163 | @@ -0,0 +1,116 @@ | |||
2164 | 1 | <?php | ||
2165 | 2 | |||
2166 | 3 | /** | ||
2167 | 4 | * | ||
2168 | 5 | * @author Mohammed NAHHAS | ||
2169 | 6 | * @package Openlabs_OpenERPConnector | ||
2170 | 7 | * | ||
2171 | 8 | */ | ||
2172 | 9 | |||
2173 | 10 | class Openlabs_OpenERPConnector_Model_Sales_Order_Api extends Mage_Sales_Model_Order_Api { | ||
2174 | 11 | |||
2175 | 12 | /** | ||
2176 | 13 | * | ||
2177 | 14 | * Retrieve orders data based on the value of the flag 'imported' | ||
2178 | 15 | * @param array | ||
2179 | 16 | * @return array | ||
2180 | 17 | */ | ||
2181 | 18 | public function retrieveOrders($data) { | ||
2182 | 19 | |||
2183 | 20 | $result = array(); | ||
2184 | 21 | if(isset($data['imported'])) { | ||
2185 | 22 | |||
2186 | 23 | $collection = Mage::getModel("sales/order")->getCollection() | ||
2187 | 24 | ->addAttributeToSelect('*') | ||
2188 | 25 | ->addAttributeToFilter('imported', array('eq' => $data['imported'])); | ||
2189 | 26 | |||
2190 | 27 | /* addAddressFields() is called only if version >= 1400 */ | ||
2191 | 28 | if(str_replace('.','',Mage::getVersion()) >= 1400) { | ||
2192 | 29 | $collection->addAddressFields(); | ||
2193 | 30 | } | ||
2194 | 31 | |||
2195 | 32 | if(isset($data['limit'])) { | ||
2196 | 33 | $collection->setPageSize($data['limit']); | ||
2197 | 34 | $collection->setOrder('entity_id', 'ASC'); | ||
2198 | 35 | } | ||
2199 | 36 | |||
2200 | 37 | if(isset($data['filters']) && is_array($data['filters'])) { | ||
2201 | 38 | $filters = $data['filters']; | ||
2202 | 39 | foreach($filters as $field => $value) { | ||
2203 | 40 | $collection->addAttributeToFilter($field, $value); | ||
2204 | 41 | } | ||
2205 | 42 | } | ||
2206 | 43 | |||
2207 | 44 | foreach ($collection as $order) { | ||
2208 | 45 | $tmp = $this->_getAttributes($order, 'order'); | ||
2209 | 46 | |||
2210 | 47 | /* if version < 1400, billing and shipping information are added manually to order data */ | ||
2211 | 48 | if(str_replace('.','',Mage::getVersion()) < 1400) { | ||
2212 | 49 | $address_data = $this->_getAttributes($order->getShippingAddress(), 'order_address'); | ||
2213 | 50 | if(!empty($address_data)) { | ||
2214 | 51 | $tmp['shipping_firstname'] = $address_data['firstname']; | ||
2215 | 52 | $tmp['shipping_lastname'] = $address_data['lastname']; | ||
2216 | 53 | } | ||
2217 | 54 | |||
2218 | 55 | $address_data = $this->_getAttributes($order->getBillingAddress(), 'order_address'); | ||
2219 | 56 | if(!empty($address_data)) { | ||
2220 | 57 | $tmp['billing_firstname'] = $address_data['firstname']; | ||
2221 | 58 | $tmp['billing_lastname'] = $address_data['lastname']; | ||
2222 | 59 | } | ||
2223 | 60 | } | ||
2224 | 61 | |||
2225 | 62 | $result[] = $tmp; | ||
2226 | 63 | } | ||
2227 | 64 | return $result; | ||
2228 | 65 | }else{ | ||
2229 | 66 | $this->_fault('data_invalid', "Error, the attribut 'imported' need to be specified"); | ||
2230 | 67 | } | ||
2231 | 68 | } | ||
2232 | 69 | |||
2233 | 70 | public function setFlagForOrder($incrementId) { | ||
2234 | 71 | $_order = $this->_initOrder($incrementId); | ||
2235 | 72 | $_order->setImported(1); | ||
2236 | 73 | try { | ||
2237 | 74 | $_order->save(); | ||
2238 | 75 | return true; | ||
2239 | 76 | } catch (Mage_Core_Exception $e) { | ||
2240 | 77 | $this->_fault('data_invalid', $e->getMessage()); | ||
2241 | 78 | } | ||
2242 | 79 | } | ||
2243 | 80 | |||
2244 | 81 | /* Retrieve increment_id of the child order */ | ||
2245 | 82 | public function getOrderChild($incrementId) { | ||
2246 | 83 | |||
2247 | 84 | $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); | ||
2248 | 85 | /** | ||
2249 | 86 | * Check order existing | ||
2250 | 87 | */ | ||
2251 | 88 | if (!$order->getId()) { | ||
2252 | 89 | $this->_fault('order_not_exists'); | ||
2253 | 90 | } | ||
2254 | 91 | |||
2255 | 92 | if($order->getRelationChildId()) { | ||
2256 | 93 | return $order->getRelationChildRealId(); | ||
2257 | 94 | }else{ | ||
2258 | 95 | return false; | ||
2259 | 96 | } | ||
2260 | 97 | } | ||
2261 | 98 | |||
2262 | 99 | /* Retrieve increment_id of the parent order */ | ||
2263 | 100 | public function getOrderParent($incrementId) { | ||
2264 | 101 | |||
2265 | 102 | $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); | ||
2266 | 103 | /** | ||
2267 | 104 | * Check order existing | ||
2268 | 105 | */ | ||
2269 | 106 | if (!$order->getId()) { | ||
2270 | 107 | $this->_fault('order_not_exists'); | ||
2271 | 108 | } | ||
2272 | 109 | |||
2273 | 110 | if($order->getRelationParentId()) { | ||
2274 | 111 | return $order->getRelationParentRealId(); | ||
2275 | 112 | }else{ | ||
2276 | 113 | return false; | ||
2277 | 114 | } | ||
2278 | 115 | } | ||
2279 | 116 | } | ||
2280 | 0 | \ No newline at end of file | 117 | \ No newline at end of file |
2281 | 1 | 118 | ||
2282 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers' | |||
2283 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml' | |||
2284 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php' | |||
2285 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php 1970-01-01 00:00:00 +0000 | |||
2286 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php 2011-11-09 09:54:26 +0000 | |||
2287 | @@ -0,0 +1,61 @@ | |||
2288 | 1 | <?php | ||
2289 | 2 | |||
2290 | 3 | /** | ||
2291 | 4 | * | ||
2292 | 5 | * @author Mohammed NAHHAS | ||
2293 | 6 | * @package Openlabs_OpenERPConnector | ||
2294 | 7 | * | ||
2295 | 8 | */ | ||
2296 | 9 | |||
2297 | 10 | class Openlabs_OpenERPConnector_Adminhtml_InitController extends Mage_Adminhtml_Controller_Action | ||
2298 | 11 | { | ||
2299 | 12 | protected $_imported = 'imported'; | ||
2300 | 13 | |||
2301 | 14 | /* Initialize the Attribute 'Imported' for orders placed before installing Openlabs_OpenERPConnector Extension */ | ||
2302 | 15 | public function ordersAction() { | ||
2303 | 16 | /* 'imported' value will be initialized if magento version is < 1.4.0.0 */ | ||
2304 | 17 | if(str_replace('.','',Mage::getVersion()) < 1400) { | ||
2305 | 18 | $orders = array(); | ||
2306 | 19 | |||
2307 | 20 | /* 'imported' attribute values are stored in sales_order_int */ | ||
2308 | 21 | $imported_attribute_table_name = 'sales_order_int'; | ||
2309 | 22 | |||
2310 | 23 | /* retrieve entity_type_id for order */ | ||
2311 | 24 | $entity_type = Mage::getModel('eav/entity_type')->loadByCode('order'); | ||
2312 | 25 | |||
2313 | 26 | /* Load 'imported' attribute to get its attribute_id */ | ||
2314 | 27 | $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection') | ||
2315 | 28 | ->setCodeFilter($this->_imported) | ||
2316 | 29 | ->setEntityTypeFilter($entity_type->getEntityTypeId()) | ||
2317 | 30 | ->getFirstItem(); | ||
2318 | 31 | |||
2319 | 32 | /* load order collection */ | ||
2320 | 33 | $collection = Mage::getResourceModel('sales/order_collection') | ||
2321 | 34 | ->addAttributeToSelect($this->_imported); | ||
2322 | 35 | |||
2323 | 36 | if(count($collection->getItems()) > 0) { | ||
2324 | 37 | foreach($collection as $order) { | ||
2325 | 38 | try{ | ||
2326 | 39 | $test = $order->getResource()->getAttribute($this->_imported); | ||
2327 | 40 | $orders[] = $order->getIncrementId(); | ||
2328 | 41 | $order->setImported(0)->save(); | ||
2329 | 42 | $request = "INSERT IGNORE INTO ".$imported_attribute_table_name." (entity_type_id, attribute_id, entity_id, value) VALUES (".$entity_type->getEntityTypeId().", ".$attributeInfo->getAttributeId().", ".$order->getEntityId().", 0)"; | ||
2330 | 43 | $write = Mage::getSingleton('core/resource')->getConnection('core_write'); | ||
2331 | 44 | $query = $write->query($request); | ||
2332 | 45 | }catch (Exception $e) { | ||
2333 | 46 | echo 'Error : '.$e->getMessage(); | ||
2334 | 47 | } | ||
2335 | 48 | } | ||
2336 | 49 | |||
2337 | 50 | echo 'Number of Orders Initialized : '.count($collection->getItems()) .'<br />'; | ||
2338 | 51 | echo 'Orders List : '.'<br />'; | ||
2339 | 52 | echo '<pre>'; | ||
2340 | 53 | print_r($orders); | ||
2341 | 54 | echo '</pre>'; | ||
2342 | 55 | } | ||
2343 | 56 | }else{ | ||
2344 | 57 | echo 'Magento Version : '.Mage::getVersion().'<br />'; | ||
2345 | 58 | echo 'There is no need to initialize orders'; | ||
2346 | 59 | } | ||
2347 | 60 | } | ||
2348 | 61 | } | ||
2349 | 0 | \ No newline at end of file | 62 | \ No newline at end of file |
2350 | 1 | 63 | ||
2351 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php' | |||
2352 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php 1970-01-01 00:00:00 +0000 | |||
2353 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php 2011-11-09 09:54:26 +0000 | |||
2354 | @@ -0,0 +1,5 @@ | |||
2355 | 1 | <?php | ||
2356 | 2 | class Openlabs_OpenERPConnector_OpenerpconnectorController extends Mage_Core_Controller_Front_Action | ||
2357 | 3 | { | ||
2358 | 4 | |||
2359 | 5 | } | ||
2360 | 0 | 6 | ||
2361 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc' | |||
2362 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml' | |||
2363 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml 1970-01-01 00:00:00 +0000 | |||
2364 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml 2011-11-09 09:54:26 +0000 | |||
2365 | @@ -0,0 +1,526 @@ | |||
2366 | 1 | |||
2367 | 2 | <config> | ||
2368 | 3 | <api> | ||
2369 | 4 | <resources> | ||
2370 | 5 | <ol_websites translate="title" module="core"> | ||
2371 | 6 | <title>Website Management</title> | ||
2372 | 7 | <model>openerpconnector/olcore_website</model> | ||
2373 | 8 | <acl>core/store</acl> | ||
2374 | 9 | <methods> | ||
2375 | 10 | <list translate="title" module="core"> | ||
2376 | 11 | <title>Enumerate websites</title> | ||
2377 | 12 | <method>items</method> | ||
2378 | 13 | </list> | ||
2379 | 14 | <create translate="title" module="core"> | ||
2380 | 15 | <title>Create Websites</title> | ||
2381 | 16 | <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids--> | ||
2382 | 17 | <method>create</method> | ||
2383 | 18 | </create> | ||
2384 | 19 | <info translate="title" module="core"> | ||
2385 | 20 | <title>Fetch detail of websites</title> | ||
2386 | 21 | <method>info</method> | ||
2387 | 22 | </info> | ||
2388 | 23 | <update translate="title" module="core"> | ||
2389 | 24 | <title>Update websites info</title> | ||
2390 | 25 | <method>update</method> | ||
2391 | 26 | </update> | ||
2392 | 27 | <delete translate="title" module="core"> | ||
2393 | 28 | <title>Delete websites</title> | ||
2394 | 29 | <method>delete</method> | ||
2395 | 30 | </delete> | ||
2396 | 31 | </methods> | ||
2397 | 32 | <faults module="core"> | ||
2398 | 33 | <website_not_exists> | ||
2399 | 34 | <code>101</code> | ||
2400 | 35 | <message>Requested website not found.</message> | ||
2401 | 36 | </website_not_exists> | ||
2402 | 37 | <data_invalid> | ||
2403 | 38 | <code>102</code> | ||
2404 | 39 | <message>Website creation failed due to invalid data.</message> | ||
2405 | 40 | </data_invalid> | ||
2406 | 41 | </faults> | ||
2407 | 42 | </ol_websites> | ||
2408 | 43 | <ol_groups translate="title" module="core"> | ||
2409 | 44 | <title>Groups Management</title> | ||
2410 | 45 | <model>openerpconnector/olcore_groups</model> | ||
2411 | 46 | <acl>core/store</acl> | ||
2412 | 47 | <methods> | ||
2413 | 48 | <list translate="title" module="core"> | ||
2414 | 49 | <title>Enumerate groups</title> | ||
2415 | 50 | <method>items</method> | ||
2416 | 51 | </list> | ||
2417 | 52 | <create translate="title" module="core"> | ||
2418 | 53 | <title>Create groups</title> | ||
2419 | 54 | <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids--> | ||
2420 | 55 | <method>create</method> | ||
2421 | 56 | </create> | ||
2422 | 57 | <info translate="title" module="core"> | ||
2423 | 58 | <title>Fetch detail of groups</title> | ||
2424 | 59 | <method>info</method> | ||
2425 | 60 | </info> | ||
2426 | 61 | <update translate="title" module="core"> | ||
2427 | 62 | <title>Update groups info</title> | ||
2428 | 63 | <method>update</method> | ||
2429 | 64 | </update> | ||
2430 | 65 | <delete translate="title" module="core"> | ||
2431 | 66 | <title>Delete groups</title> | ||
2432 | 67 | <method>delete</method> | ||
2433 | 68 | </delete> | ||
2434 | 69 | </methods> | ||
2435 | 70 | <faults module="core"> | ||
2436 | 71 | <group_not_exists> | ||
2437 | 72 | <code>101</code> | ||
2438 | 73 | <message>Requested group not found.</message> | ||
2439 | 74 | </group_not_exists> | ||
2440 | 75 | <data_invalid> | ||
2441 | 76 | <code>102</code> | ||
2442 | 77 | <message>group creation failed due to invalid data.</message> | ||
2443 | 78 | </data_invalid> | ||
2444 | 79 | <filters_invalid> | ||
2445 | 80 | <code>103</code> | ||
2446 | 81 | <message>Invalid data fetch filter.</message> | ||
2447 | 82 | </filters_invalid> | ||
2448 | 83 | </faults> | ||
2449 | 84 | </ol_groups> | ||
2450 | 85 | <ol_storeviews translate="title" module="core"> | ||
2451 | 86 | <title>Stores Management</title> | ||
2452 | 87 | <model>openerpconnector/olcore_storeviews</model> | ||
2453 | 88 | <acl>core/store</acl> | ||
2454 | 89 | <methods> | ||
2455 | 90 | <list translate="title" module="core"> | ||
2456 | 91 | <title>Enumerate stores</title> | ||
2457 | 92 | <method>items</method> | ||
2458 | 93 | </list> | ||
2459 | 94 | <create translate="title" module="core"> | ||
2460 | 95 | <title>Create stores</title> | ||
2461 | 96 | <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids--> | ||
2462 | 97 | <method>create</method> | ||
2463 | 98 | </create> | ||
2464 | 99 | <info translate="title" module="core"> | ||
2465 | 100 | <title>Fetch detail of stores</title> | ||
2466 | 101 | <method>info</method> | ||
2467 | 102 | </info> | ||
2468 | 103 | <update translate="title" module="core"> | ||
2469 | 104 | <title>Update stores info</title> | ||
2470 | 105 | <method>update</method> | ||
2471 | 106 | </update> | ||
2472 | 107 | <delete translate="title" module="core"> | ||
2473 | 108 | <title>Delete stores</title> | ||
2474 | 109 | <method>delete</method> | ||
2475 | 110 | </delete> | ||
2476 | 111 | </methods> | ||
2477 | 112 | <faults module="core"> | ||
2478 | 113 | <store_not_exists> | ||
2479 | 114 | <code>101</code> | ||
2480 | 115 | <message>Requested store not found.</message> | ||
2481 | 116 | </store_not_exists> | ||
2482 | 117 | <data_invalid> | ||
2483 | 118 | <code>102</code> | ||
2484 | 119 | <message>Store creation failed due to invalid data.</message> | ||
2485 | 120 | </data_invalid> | ||
2486 | 121 | <filters_invalid> | ||
2487 | 122 | <code>103</code> | ||
2488 | 123 | <message>Invalid data fetch filter.</message> | ||
2489 | 124 | </filters_invalid> | ||
2490 | 125 | </faults> | ||
2491 | 126 | </ol_storeviews> | ||
2492 | 127 | <ol_catalog_category_media translate="title" module="catalog"> | ||
2493 | 128 | <title>Product Images API</title> | ||
2494 | 129 | <model>openerpconnector/olcatalog_categories</model> | ||
2495 | 130 | <acl>catalog/category</acl> | ||
2496 | 131 | <methods> | ||
2497 | 132 | <list translate="title" module="catalog"> | ||
2498 | 133 | <title>Retrieve product image list</title> | ||
2499 | 134 | <method>items</method> | ||
2500 | 135 | </list> | ||
2501 | 136 | <info translate="title" module="catalog"> | ||
2502 | 137 | <title>Retrieve product category image</title> | ||
2503 | 138 | </info> | ||
2504 | 139 | <types translate="title" module="catalog"> | ||
2505 | 140 | <title>Retrieve product category image types</title> | ||
2506 | 141 | </types> | ||
2507 | 142 | <create translate="title" module="catalog"> | ||
2508 | 143 | <title>Upload new product category image </title> | ||
2509 | 144 | <acl>catalog/product/media/create</acl> | ||
2510 | 145 | </create> | ||
2511 | 146 | <update translate="title" module="catalog"> | ||
2512 | 147 | <title>Update product category image</title> | ||
2513 | 148 | <acl>catalog/product/media/update</acl> | ||
2514 | 149 | </update> | ||
2515 | 150 | <remove translate="title" module="catalog"> | ||
2516 | 151 | <title>Remove product category image</title> | ||
2517 | 152 | <acl>catalog/product/media/remove</acl> | ||
2518 | 153 | </remove> | ||
2519 | 154 | </methods> | ||
2520 | 155 | <faults module="catalog"> | ||
2521 | 156 | <create_failure> | ||
2522 | 157 | <code>100</code> | ||
2523 | 158 | <message>Could not create file, check permissions.</message> | ||
2524 | 159 | </create_failure> | ||
2525 | 160 | <category_not_exists> | ||
2526 | 161 | <code>101</code> | ||
2527 | 162 | <message>Product not exists.</message> | ||
2528 | 163 | </category_not_exists> | ||
2529 | 164 | <data_invalid> | ||
2530 | 165 | <code>102</code> | ||
2531 | 166 | <message>Invalid data given. Details in error message.</message> | ||
2532 | 167 | </data_invalid> | ||
2533 | 168 | <not_exists> | ||
2534 | 169 | <code>103</code> | ||
2535 | 170 | <message>Requested image not exists in product images' gallery.</message> | ||
2536 | 171 | </not_exists> | ||
2537 | 172 | <not_created> | ||
2538 | 173 | <code>104</code> | ||
2539 | 174 | <message>Image creation failed. Details in error message.</message> | ||
2540 | 175 | </not_created> | ||
2541 | 176 | <not_updated> | ||
2542 | 177 | <code>105</code> | ||
2543 | 178 | <message>Image not updated. Details in error message.</message> | ||
2544 | 179 | </not_updated> | ||
2545 | 180 | <not_removed> | ||
2546 | 181 | <code>106</code> | ||
2547 | 182 | <message>Image not removed. Details in error message.</message> | ||
2548 | 183 | </not_removed> | ||
2549 | 184 | <not_media> | ||
2550 | 185 | <code>107</code> | ||
2551 | 186 | <message>Error in opening image file</message> | ||
2552 | 187 | </not_media> | ||
2553 | 188 | <filters_invalid> | ||
2554 | 189 | <code>108</code> | ||
2555 | 190 | <message>Invalid data fetch filter.</message> | ||
2556 | 191 | </filters_invalid> | ||
2557 | 192 | </faults> | ||
2558 | 193 | </ol_catalog_category_media> | ||
2559 | 194 | <ol_catalog_product_attribute translate="title" module="catalog"> | ||
2560 | 195 | <title>Product Images API</title> | ||
2561 | 196 | <model>openerpconnector/olcatalog_product_attribute</model> | ||
2562 | 197 | <acl>catalog/category</acl> | ||
2563 | 198 | <methods> | ||
2564 | 199 | <list translate="title" module="catalog"> | ||
2565 | 200 | <title>Retrieve attribute list</title> | ||
2566 | 201 | <method>items</method> | ||
2567 | 202 | </list> | ||
2568 | 203 | <relations translate="title" module="catalog"> | ||
2569 | 204 | <title>Retrieve attribute sets attribute ids</title> | ||
2570 | 205 | <method>relations</method> | ||
2571 | 206 | </relations> | ||
2572 | 207 | <info translate="title" module="catalog"> | ||
2573 | 208 | <title>Retrieve full attribute details</title> | ||
2574 | 209 | <method>info</method> | ||
2575 | 210 | </info> | ||
2576 | 211 | <options translate="title" module="catalog"> | ||
2577 | 212 | <title>Retrieve options of attributes</title> | ||
2578 | 213 | <method>options</method> | ||
2579 | 214 | </options> | ||
2580 | 215 | </methods> | ||
2581 | 216 | <faults> | ||
2582 | 217 | </faults> | ||
2583 | 218 | </ol_catalog_product_attribute> | ||
2584 | 219 | <ol_catalog_product_attribute_group translate="title" module="catalog"> | ||
2585 | 220 | <title>Product Images API</title> | ||
2586 | 221 | <model>openerpconnector/olcatalog_product_attributegroup</model> | ||
2587 | 222 | <acl>catalog/category</acl> | ||
2588 | 223 | <methods> | ||
2589 | 224 | <list translate="title" module="catalog"> | ||
2590 | 225 | <title>Retrieve attribute group list</title> | ||
2591 | 226 | <method>items</method> | ||
2592 | 227 | </list> | ||
2593 | 228 | <info translate="title" module="catalog"> | ||
2594 | 229 | <title>Retrieve full attribute details</title> | ||
2595 | 230 | <method>info</method> | ||
2596 | 231 | </info> | ||
2597 | 232 | </methods> | ||
2598 | 233 | <faults> | ||
2599 | 234 | </faults> | ||
2600 | 235 | </ol_catalog_product_attribute_group> | ||
2601 | 236 | <ol_customer_groups translate="title" module="core"> | ||
2602 | 237 | <title>Groups Management</title> | ||
2603 | 238 | <model>openerpconnector/olcustomer_group</model> | ||
2604 | 239 | <acl>customer/group</acl> | ||
2605 | 240 | <methods> | ||
2606 | 241 | <list translate="title" module="core"> | ||
2607 | 242 | <title>Enumerate groups</title> | ||
2608 | 243 | <method>items</method> | ||
2609 | 244 | </list> | ||
2610 | 245 | <create translate="title" module="core"> | ||
2611 | 246 | <title>Create groups</title> | ||
2612 | 247 | <method>create</method> | ||
2613 | 248 | </create> | ||
2614 | 249 | <info translate="title" module="core"> | ||
2615 | 250 | <title>Fetch detail of groups</title> | ||
2616 | 251 | <method>info</method> | ||
2617 | 252 | </info> | ||
2618 | 253 | <update translate="title" module="core"> | ||
2619 | 254 | <title>Update groups info</title> | ||
2620 | 255 | <method>update</method> | ||
2621 | 256 | </update> | ||
2622 | 257 | <delete translate="title" module="core"> | ||
2623 | 258 | <title>Delete groups</title> | ||
2624 | 259 | <method>delete</method> | ||
2625 | 260 | </delete> | ||
2626 | 261 | </methods> | ||
2627 | 262 | <faults module="core"> | ||
2628 | 263 | <group_not_exists> | ||
2629 | 264 | <code>101</code> | ||
2630 | 265 | <message>Requested group not found.</message> | ||
2631 | 266 | </group_not_exists> | ||
2632 | 267 | <data_invalid> | ||
2633 | 268 | <code>102</code> | ||
2634 | 269 | <message>group creation failed due to invalid data.</message> | ||
2635 | 270 | </data_invalid> | ||
2636 | 271 | <filters_invalid> | ||
2637 | 272 | <code>103</code> | ||
2638 | 273 | <message>Invalid data fetch filter.</message> | ||
2639 | 274 | </filters_invalid> | ||
2640 | 275 | </faults> | ||
2641 | 276 | </ol_customer_groups> | ||
2642 | 277 | <ol_customer_address translate="title" module="core"> | ||
2643 | 278 | <title>Address Management</title> | ||
2644 | 279 | <model>openerpconnector/olcustomer_address</model> | ||
2645 | 280 | <acl>customer/group</acl> | ||
2646 | 281 | <methods> | ||
2647 | 282 | <list translate="title" module="core"> | ||
2648 | 283 | <title>Enumerate groups</title> | ||
2649 | 284 | <method>items</method> | ||
2650 | 285 | </list> | ||
2651 | 286 | <create translate="title" module="core"> | ||
2652 | 287 | <title>Create groups</title> | ||
2653 | 288 | <method>create</method> | ||
2654 | 289 | </create> | ||
2655 | 290 | <info translate="title" module="core"> | ||
2656 | 291 | <title>Fetch detail of groups</title> | ||
2657 | 292 | <method>info</method> | ||
2658 | 293 | </info> | ||
2659 | 294 | <update translate="title" module="core"> | ||
2660 | 295 | <title>Update groups info</title> | ||
2661 | 296 | <method>update</method> | ||
2662 | 297 | </update> | ||
2663 | 298 | <delete translate="title" module="core"> | ||
2664 | 299 | <title>Delete groups</title> | ||
2665 | 300 | <method>delete</method> | ||
2666 | 301 | </delete> | ||
2667 | 302 | </methods> | ||
2668 | 303 | <faults module="core"> | ||
2669 | 304 | <customer_not_exists> | ||
2670 | 305 | <code>101</code> | ||
2671 | 306 | <message>Requested Customer not found.</message> | ||
2672 | 307 | </customer_not_exists> | ||
2673 | 308 | <data_invalid> | ||
2674 | 309 | <code>102</code> | ||
2675 | 310 | <message>group creation failed due to invalid data.</message> | ||
2676 | 311 | </data_invalid> | ||
2677 | 312 | <filters_invalid> | ||
2678 | 313 | <code>103</code> | ||
2679 | 314 | <message>Invalid data fetch filter.</message> | ||
2680 | 315 | </filters_invalid> | ||
2681 | 316 | </faults> | ||
2682 | 317 | </ol_customer_address> | ||
2683 | 318 | <ol_customer_subscriber translate="title" module="core"> | ||
2684 | 319 | <title>Subscriber Management</title> | ||
2685 | 320 | <model>openerpconnector/olcustomer_subscriber</model> | ||
2686 | 321 | <acl>customer/group</acl> | ||
2687 | 322 | <methods> | ||
2688 | 323 | <list translate="title" module="core"> | ||
2689 | 324 | <title>Enumerate subscriber</title> | ||
2690 | 325 | <method>items</method> | ||
2691 | 326 | </list> | ||
2692 | 327 | <create translate="title" module="core"> | ||
2693 | 328 | <title>Create subscriber</title> | ||
2694 | 329 | <method>create</method> | ||
2695 | 330 | </create> | ||
2696 | 331 | <info translate="title" module="core"> | ||
2697 | 332 | <title>Fetch detail of subscriber</title> | ||
2698 | 333 | <method>info</method> | ||
2699 | 334 | </info> | ||
2700 | 335 | <update translate="title" module="core"> | ||
2701 | 336 | <title>Update subscriber info</title> | ||
2702 | 337 | <method>update</method> | ||
2703 | 338 | </update> | ||
2704 | 339 | <delete translate="title" module="core"> | ||
2705 | 340 | <title>Delete subscriber</title> | ||
2706 | 341 | <method>delete</method> | ||
2707 | 342 | </delete> | ||
2708 | 343 | </methods> | ||
2709 | 344 | <faults module="core"> | ||
2710 | 345 | <customer_not_exists> | ||
2711 | 346 | <code>101</code> | ||
2712 | 347 | <message>Requested Customer not found.</message> | ||
2713 | 348 | </customer_not_exists> | ||
2714 | 349 | <data_invalid> | ||
2715 | 350 | <code>102</code> | ||
2716 | 351 | <message>group creation failed due to invalid data.</message> | ||
2717 | 352 | </data_invalid> | ||
2718 | 353 | <filters_invalid> | ||
2719 | 354 | <code>103</code> | ||
2720 | 355 | <message>Invalid data fetch filter.</message> | ||
2721 | 356 | </filters_invalid> | ||
2722 | 357 | </faults> | ||
2723 | 358 | </ol_customer_subscriber> | ||
2724 | 359 | <ol_customer translate="title" module="core"> | ||
2725 | 360 | <title>Customers Management</title> | ||
2726 | 361 | <model>openerpconnector/olcustomer_customer</model> | ||
2727 | 362 | <acl>customer/group</acl> | ||
2728 | 363 | <methods> | ||
2729 | 364 | <list translate="title" module="core"> | ||
2730 | 365 | <title>Enumerate Customers</title> | ||
2731 | 366 | <method>items</method> | ||
2732 | 367 | </list> | ||
2733 | 368 | <create translate="title" module="core"> | ||
2734 | 369 | <title>Create Customers</title> | ||
2735 | 370 | <method>create</method> | ||
2736 | 371 | </create> | ||
2737 | 372 | <info translate="title" module="core"> | ||
2738 | 373 | <title>Fetch detail of customers</title> | ||
2739 | 374 | <method>info</method> | ||
2740 | 375 | </info> | ||
2741 | 376 | <update translate="title" module="core"> | ||
2742 | 377 | <title>Update customers info</title> | ||
2743 | 378 | <method>update</method> | ||
2744 | 379 | </update> | ||
2745 | 380 | <delete translate="title" module="core"> | ||
2746 | 381 | <title>Delete customers</title> | ||
2747 | 382 | <method>delete</method> | ||
2748 | 383 | </delete> | ||
2749 | 384 | </methods> | ||
2750 | 385 | <faults module="core"> | ||
2751 | 386 | <customer_not_exists> | ||
2752 | 387 | <code>101</code> | ||
2753 | 388 | <message>Requested customer not found.</message> | ||
2754 | 389 | </customer_not_exists> | ||
2755 | 390 | <data_invalid> | ||
2756 | 391 | <code>102</code> | ||
2757 | 392 | <message>Customer creation failed due to invalid data.</message> | ||
2758 | 393 | </data_invalid> | ||
2759 | 394 | <filters_invalid> | ||
2760 | 395 | <code>103</code> | ||
2761 | 396 | <message>Invalid data fetch filter.</message> | ||
2762 | 397 | </filters_invalid> | ||
2763 | 398 | </faults> | ||
2764 | 399 | </ol_customer> | ||
2765 | 400 | <ol_catalog_product_tierprice translate="title" module="catalog"> | ||
2766 | 401 | <title>Product Tier Price API</title> | ||
2767 | 402 | <model>openerpconnector/olcatalog_product_tierprice</model> | ||
2768 | 403 | <acl>catalog/category</acl> | ||
2769 | 404 | <methods> | ||
2770 | 405 | <list translate="title" module="catalog"> | ||
2771 | 406 | <title>Retrieve attribute list</title> | ||
2772 | 407 | <method>items</method> | ||
2773 | 408 | </list> | ||
2774 | 409 | <items2 translate="title" module="catalog"> | ||
2775 | 410 | <title>Retrieve attribute list</title> | ||
2776 | 411 | <method>items2</method> | ||
2777 | 412 | </items2> | ||
2778 | 413 | </methods> | ||
2779 | 414 | <faults> | ||
2780 | 415 | <product_not_exists> | ||
2781 | 416 | <code>101</code> | ||
2782 | 417 | <message>Requested product not found.</message> | ||
2783 | 418 | </product_not_exists> | ||
2784 | 419 | <filters_invalid> | ||
2785 | 420 | <code>103</code> | ||
2786 | 421 | <message>Invalid data fetch filter.</message> | ||
2787 | 422 | </filters_invalid> | ||
2788 | 423 | </faults> | ||
2789 | 424 | </ol_catalog_product_tierprice> | ||
2790 | 425 | <ol_catalog_product translate="title" module="core"> | ||
2791 | 426 | <title>Address Management</title> | ||
2792 | 427 | <model>openerpconnector/olcatalog_products</model> | ||
2793 | 428 | <acl>catalog/product</acl> | ||
2794 | 429 | <methods> | ||
2795 | 430 | <list translate="title" module="core"> | ||
2796 | 431 | <title>Enumerate Products</title> | ||
2797 | 432 | <method>items</method> | ||
2798 | 433 | </list> | ||
2799 | 434 | <create translate="title" module="core"> | ||
2800 | 435 | <title>Create Products</title> | ||
2801 | 436 | <method>create</method> | ||
2802 | 437 | </create> | ||
2803 | 438 | <biglist translate="title" module="core"> | ||
2804 | 439 | <title>Fetch detail of products</title> | ||
2805 | 440 | <method>biglist</method> | ||
2806 | 441 | </biglist> | ||
2807 | 442 | <update translate="title" module="core"> | ||
2808 | 443 | <title>Update groups info</title> | ||
2809 | 444 | <method>update</method> | ||
2810 | 445 | </update> | ||
2811 | 446 | <delete translate="title" module="core"> | ||
2812 | 447 | <title>Delete groups</title> | ||
2813 | 448 | <method>delete</method> | ||
2814 | 449 | </delete> | ||
2815 | 450 | </methods> | ||
2816 | 451 | <faults module="core"> | ||
2817 | 452 | <customer_not_exists> | ||
2818 | 453 | <code>101</code> | ||
2819 | 454 | <message>Requested Customer not found.</message> | ||
2820 | 455 | </customer_not_exists> | ||
2821 | 456 | <data_invalid> | ||
2822 | 457 | <code>102</code> | ||
2823 | 458 | <message>group creation failed due to invalid data.</message> | ||
2824 | 459 | </data_invalid> | ||
2825 | 460 | <filters_invalid> | ||
2826 | 461 | <code>103</code> | ||
2827 | 462 | <message>Invalid data fetch filter.</message> | ||
2828 | 463 | </filters_invalid> | ||
2829 | 464 | </faults> | ||
2830 | 465 | </ol_catalog_product> | ||
2831 | 466 | <ol_catalog_product_attributeset translate="title" module="core"> | ||
2832 | 467 | <title>Attribute Set Management</title> | ||
2833 | 468 | <model>openerpconnector/olcatalog_product_attributeset</model> | ||
2834 | 469 | <acl>catalog/product</acl> | ||
2835 | 470 | <methods> | ||
2836 | 471 | <list translate="title" module="core"> | ||
2837 | 472 | <title>Enumerate Attribute sets</title> | ||
2838 | 473 | <method>items</method> | ||
2839 | 474 | </list> | ||
2840 | 475 | </methods> | ||
2841 | 476 | <faults module="core"> | ||
2842 | 477 | <customer_not_exists> | ||
2843 | 478 | <code>101</code> | ||
2844 | 479 | <message>Requested Customer not found.</message> | ||
2845 | 480 | </customer_not_exists> | ||
2846 | 481 | <data_invalid> | ||
2847 | 482 | <code>102</code> | ||
2848 | 483 | <message>group creation failed due to invalid data.</message> | ||
2849 | 484 | </data_invalid> | ||
2850 | 485 | <filters_invalid> | ||
2851 | 486 | <code>103</code> | ||
2852 | 487 | <message>Invalid data fetch filter.</message> | ||
2853 | 488 | </filters_invalid> | ||
2854 | 489 | </faults> | ||
2855 | 490 | </ol_catalog_product_attributeset> | ||
2856 | 491 | <sales_order translate="title" module="Openlabs_OpenERPConnector"> | ||
2857 | 492 | <model>sales/order_api</model> | ||
2858 | 493 | <title>Custom Sales Orders API</title> | ||
2859 | 494 | <methods> | ||
2860 | 495 | <retrieve translate="title" module="Openlabs_OpenERPConnector"> | ||
2861 | 496 | <title>Retrieve list of orders by filters, nb max, etc...</title> | ||
2862 | 497 | <method>retrieveOrders</method> | ||
2863 | 498 | </retrieve> | ||
2864 | 499 | <done translate="title" module="Openlabs_OpenERPConnector"> | ||
2865 | 500 | <title>Set Flag to TRUE for imported orders</title> | ||
2866 | 501 | <method>setFlagForOrder</method> | ||
2867 | 502 | </done> | ||
2868 | 503 | <get_child translate="title" module="Openlabs_OpenERPConnector"> | ||
2869 | 504 | <title>get The Child of The Order Edited</title> | ||
2870 | 505 | <method>getOrderChild</method> | ||
2871 | 506 | </get_child> | ||
2872 | 507 | <get_parent translate="title" module="Openlabs_OpenERPConnector"> | ||
2873 | 508 | <title>get The Parent of the order annulated</title> | ||
2874 | 509 | <method>getOrderParent</method> | ||
2875 | 510 | </get_parent> | ||
2876 | 511 | </methods> | ||
2877 | 512 | </sales_order> | ||
2878 | 513 | <catalog_product translate="title" module="catalog"> | ||
2879 | 514 | <title>Product API</title> | ||
2880 | 515 | <model>catalog/product_api</model> | ||
2881 | 516 | <acl>catalog/product</acl> | ||
2882 | 517 | <methods> | ||
2883 | 518 | <create_bundle translate="title" module="Openlabs_OpenERPConnector"> | ||
2884 | 519 | <title>Create Bundle Products with Custom Options and Bundle Items</title> | ||
2885 | 520 | <method>createBundleProducts</method> | ||
2886 | 521 | </create_bundle> | ||
2887 | 522 | </methods> | ||
2888 | 523 | </catalog_product> | ||
2889 | 524 | </resources> | ||
2890 | 525 | </api> | ||
2891 | 526 | </config> | ||
2892 | 0 | 527 | ||
2893 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml' | |||
2894 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml 1970-01-01 00:00:00 +0000 | |||
2895 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml 2011-11-09 09:54:26 +0000 | |||
2896 | @@ -0,0 +1,88 @@ | |||
2897 | 1 | <?xml version="1.0"?> | ||
2898 | 2 | <config> | ||
2899 | 3 | <modules> | ||
2900 | 4 | <Openlabs_OpenERPConnector> | ||
2901 | 5 | <version>0.0.1</version> | ||
2902 | 6 | </Openlabs_OpenERPConnector> | ||
2903 | 7 | </modules> | ||
2904 | 8 | <frontend> | ||
2905 | 9 | <routers> | ||
2906 | 10 | <openerpconnector> | ||
2907 | 11 | <use>standard</use> | ||
2908 | 12 | <args> | ||
2909 | 13 | <module>Openlabs_OpenERPConnector</module> | ||
2910 | 14 | <frontName>openerpconnector</frontName> | ||
2911 | 15 | </args> | ||
2912 | 16 | </openerpconnector> | ||
2913 | 17 | </routers> | ||
2914 | 18 | </frontend> | ||
2915 | 19 | <global> | ||
2916 | 20 | <models> | ||
2917 | 21 | <openerpconnector> | ||
2918 | 22 | <class>Openlabs_OpenERPConnector_Model</class> | ||
2919 | 23 | </openerpconnector> | ||
2920 | 24 | <sales> | ||
2921 | 25 | <rewrite> | ||
2922 | 26 | <order_api>Openlabs_OpenERPConnector_Model_Sales_Order_Api</order_api> | ||
2923 | 27 | </rewrite> | ||
2924 | 28 | </sales> | ||
2925 | 29 | <catalog> | ||
2926 | 30 | <rewrite> | ||
2927 | 31 | <product_api>Openlabs_OpenERPConnector_Model_Catalog_Product_Api</product_api> | ||
2928 | 32 | </rewrite> | ||
2929 | 33 | </catalog> | ||
2930 | 34 | </models> | ||
2931 | 35 | <resources> | ||
2932 | 36 | <openerpconnector_setup> | ||
2933 | 37 | <setup> | ||
2934 | 38 | <module>Openlabs_OpenERPConnector</module> | ||
2935 | 39 | </setup> | ||
2936 | 40 | <connection> | ||
2937 | 41 | <use>core_setup</use> | ||
2938 | 42 | </connection> | ||
2939 | 43 | </openerpconnector_setup> | ||
2940 | 44 | <openerpconnector_write> | ||
2941 | 45 | <connection> | ||
2942 | 46 | <use>core_write</use> | ||
2943 | 47 | </connection> | ||
2944 | 48 | </openerpconnector_write> | ||
2945 | 49 | <openerpconnector_read> | ||
2946 | 50 | <connection> | ||
2947 | 51 | <use>core_read</use> | ||
2948 | 52 | </connection> | ||
2949 | 53 | </openerpconnector_read> | ||
2950 | 54 | </resources> | ||
2951 | 55 | <blocks> | ||
2952 | 56 | <openerpconnector> | ||
2953 | 57 | <class>Openlabs_OpenERPConnector_Block</class> | ||
2954 | 58 | </openerpconnector> | ||
2955 | 59 | </blocks> | ||
2956 | 60 | <helpers> | ||
2957 | 61 | <openerpconnector> | ||
2958 | 62 | <class>Openlabs_OpenERPConnector_Helper</class> | ||
2959 | 63 | </openerpconnector> | ||
2960 | 64 | </helpers> | ||
2961 | 65 | <events> | ||
2962 | 66 | <sales_order_place_after> | ||
2963 | 67 | <observers> | ||
2964 | 68 | <init_imported_after_place_order> | ||
2965 | 69 | <type>singleton</type> | ||
2966 | 70 | <class>openerpconnector/observer</class> | ||
2967 | 71 | <method>initImported</method> | ||
2968 | 72 | </init_imported_after_place_order> | ||
2969 | 73 | </observers> | ||
2970 | 74 | </sales_order_place_after> | ||
2971 | 75 | </events> | ||
2972 | 76 | </global> | ||
2973 | 77 | <admin> | ||
2974 | 78 | <routers> | ||
2975 | 79 | <openerpconnector> | ||
2976 | 80 | <use>admin</use> | ||
2977 | 81 | <args> | ||
2978 | 82 | <module>Openlabs_OpenERPConnector</module> | ||
2979 | 83 | <frontName>connector</frontName> | ||
2980 | 84 | </args> | ||
2981 | 85 | </openerpconnector> | ||
2982 | 86 | </routers> | ||
2983 | 87 | </admin> | ||
2984 | 88 | </config> | ||
2985 | 0 | \ No newline at end of file | 89 | \ No newline at end of file |
2986 | 1 | 90 | ||
2987 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql' | |||
2988 | === added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup' | |||
2989 | === added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php' | |||
2990 | --- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php 1970-01-01 00:00:00 +0000 | |||
2991 | +++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php 2011-11-09 09:54:26 +0000 | |||
2992 | @@ -0,0 +1,54 @@ | |||
2993 | 1 | <?php | ||
2994 | 2 | /** | ||
2995 | 3 | * | ||
2996 | 4 | * @author Mohammed NAHHAS | ||
2997 | 5 | * @package Openlabs_OpenERPConnector | ||
2998 | 6 | * | ||
2999 | 7 | */ | ||
3000 | 8 | |||
3001 | 9 | /* Retrieve the version of Magento */ | ||
3002 | 10 | $version = Mage::getVersion(); | ||
3003 | 11 | |||
3004 | 12 | /* Need to add a sales_order attribute if the version < 1.4.x.x - sales_order is an EAV Model */ | ||
3005 | 13 | /* Else add a simple column to sales_flat_order Table */ | ||
3006 | 14 | $version = str_replace('.','',$version); | ||
3007 | 15 | if($version >= 1400) { | ||
3008 | 16 | $installer = $this; | ||
3009 | 17 | $installer->startSetup(); | ||
3010 | 18 | $tableName='sales_flat_order'; | ||
3011 | 19 | $db = $installer->getConnection(); | ||
3012 | 20 | |||
3013 | 21 | /* Delete the column if it exists before re-create it */ | ||
3014 | 22 | if($db->tableColumnExists($this->getTable($tableName), 'imported')) { | ||
3015 | 23 | $installer->run("ALTER TABLE {$this->getTable($tableName)} drop column imported"); | ||
3016 | 24 | } | ||
3017 | 25 | |||
3018 | 26 | /* re-create 'imported' column */ | ||
3019 | 27 | if(!$db->tableColumnExists($this->getTable($tableName), 'imported')) { | ||
3020 | 28 | $installer->run(" | ||
3021 | 29 | ALTER TABLE {$this->getTable($tableName)} ADD imported tinyint(1) unsigned NOT NULL default '0'; | ||
3022 | 30 | "); | ||
3023 | 31 | } | ||
3024 | 32 | }else{ | ||
3025 | 33 | $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); | ||
3026 | 34 | $installer->startSetup(); | ||
3027 | 35 | |||
3028 | 36 | /* Attribute Data */ | ||
3029 | 37 | $attribute_data = array( | ||
3030 | 38 | 'type' => 'int', | ||
3031 | 39 | 'default' => 0, | ||
3032 | 40 | 'visible' => false, | ||
3033 | 41 | 'required' => false, | ||
3034 | 42 | 'user_defined' => false, | ||
3035 | 43 | 'searchable' => false, | ||
3036 | 44 | 'filterable' => false, | ||
3037 | 45 | 'comparable' => false | ||
3038 | 46 | ); | ||
3039 | 47 | /* Add a sales_order attribute named 'imported' */ | ||
3040 | 48 | $installer->addAttribute('order', 'imported', $attribute_data); | ||
3041 | 49 | |||
3042 | 50 | } | ||
3043 | 51 | |||
3044 | 52 | |||
3045 | 53 | /* End */ | ||
3046 | 54 | $installer->endSetup(); | ||
3047 | 0 | \ No newline at end of file | 55 | \ No newline at end of file |
3048 | 1 | 56 | ||
3049 | === added directory 'Openlabs_OpenERPConnector-1.1.0/app' | |||
3050 | === added directory 'Openlabs_OpenERPConnector-1.1.0/app/etc' | |||
3051 | === added directory 'Openlabs_OpenERPConnector-1.1.0/app/etc/modules' | |||
3052 | === added file 'Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml' | |||
3053 | --- Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml 1970-01-01 00:00:00 +0000 | |||
3054 | +++ Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml 2011-11-09 09:54:26 +0000 | |||
3055 | @@ -0,0 +1,41 @@ | |||
3056 | 1 | <?xml version="1.0"?> | ||
3057 | 2 | |||
3058 | 3 | <!-- | ||
3059 | 4 | ############################################################################## | ||
3060 | 5 | # | ||
3061 | 6 | # OpenERP, Open Source Management Solution | ||
3062 | 7 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | ||
3063 | 8 | # Sharoon Thomas | ||
3064 | 9 | # | ||
3065 | 10 | # This program is free software: you can redistribute it and/or modify | ||
3066 | 11 | # it under the terms of the GNU General Public License as published by | ||
3067 | 12 | # the Free Software Foundation, either version 3 of the License, or | ||
3068 | 13 | # (at your option) any later version. | ||
3069 | 14 | # | ||
3070 | 15 | # This program is distributed in the hope that it will be useful, | ||
3071 | 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3072 | 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3073 | 18 | # GNU General Public License for more details. | ||
3074 | 19 | # | ||
3075 | 20 | # You should have received a copy of the GNU General Public License | ||
3076 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3077 | 22 | # | ||
3078 | 23 | ############################################################################## | ||
3079 | 24 | # * @category Community | ||
3080 | 25 | # * @package | ||
3081 | 26 | # * @copyright Copyright (c) 2009 Sharoon Thomas, openlabs.co.in | ||
3082 | 27 | # * @license GPL-3 | ||
3083 | 28 | # */ | ||
3084 | 29 | --> | ||
3085 | 30 | <config> | ||
3086 | 31 | <modules> | ||
3087 | 32 | <Openlabs_OpenERPConnector> | ||
3088 | 33 | <codePool>community</codePool> | ||
3089 | 34 | <active>true</active> | ||
3090 | 35 | <depends> | ||
3091 | 36 | <Mage_Api /> | ||
3092 | 37 | <Mage_Catalog /> | ||
3093 | 38 | </depends> | ||
3094 | 39 | </Openlabs_OpenERPConnector> | ||
3095 | 40 | </modules> | ||
3096 | 41 | </config> | ||
3097 | 0 | 42 | ||
3098 | === added file 'package.xml' | |||
3099 | --- package.xml 1970-01-01 00:00:00 +0000 | |||
3100 | +++ package.xml 2011-11-09 09:54:26 +0000 | |||
3101 | @@ -0,0 +1,84 @@ | |||
3102 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
3103 | 2 | <package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 | ||
3104 | 3 | http://pear.php.net/dtd/tasks-1.0.xsd | ||
3105 | 4 | http://pear.php.net/dtd/package-2.0 | ||
3106 | 5 | http://pear.php.net/dtd/package-2.0.xsd"> | ||
3107 | 6 | <name>Openlabs_OpenERPConnector</name> | ||
3108 | 7 | <channel>connect.magentocommerce.com/community</channel> | ||
3109 | 8 | <summary>Magento extension for multiwebsite Open ERP connector by Open Labs</summary> | ||
3110 | 9 | <description>This magento extension provides additional API methods for use by the Multi website, Multi Store, Multi Product category synchronization connector. | ||
3111 | 10 | |||
3112 | 11 | Contents: | ||
3113 | 12 | |||
3114 | 13 | Magento Websites API | ||
3115 | 14 | Magento Stores(groups) API | ||
3116 | 15 | Magento Store Views API | ||
3117 | 16 | Magento Category Images API (Partial : list, info, create) | ||
3118 | 17 | |||
3119 | 18 | Contact sharoon.thomas@openlabs.co.in for further details</description> | ||
3120 | 19 | <lead> | ||
3121 | 20 | <name>Sharoon Thomas</name> | ||
3122 | 21 | <user>sharoonthomas</user> | ||
3123 | 22 | <email>sharoonthomas@teagarden.in</email> | ||
3124 | 23 | <active>yes</active> | ||
3125 | 24 | </lead> | ||
3126 | 25 | <date>2009-08-27</date> | ||
3127 | 26 | <time>15:23:56</time> | ||
3128 | 27 | <version> | ||
3129 | 28 | <release>1.1.0</release> | ||
3130 | 29 | <api>2.0</api> | ||
3131 | 30 | </version> | ||
3132 | 31 | <stability> | ||
3133 | 32 | <release>beta</release> | ||
3134 | 33 | <api>beta</api> | ||
3135 | 34 | </stability> | ||
3136 | 35 | <license>GPL</license> | ||
3137 | 36 | <notes>Magento Websites API | ||
3138 | 37 | Magento Stores(groups) API | ||
3139 | 38 | Magento Store Views API | ||
3140 | 39 | Magento Category Images API</notes> | ||
3141 | 40 | <contents> | ||
3142 | 41 | <dir name="/"> | ||
3143 | 42 | <dir name="app"> | ||
3144 | 43 | <dir name="etc"> | ||
3145 | 44 | <dir name="modules"> | ||
3146 | 45 | <file md5sum="fc14d089cce44cc1e2ac08fa6c6c20a6" name="Openlabs_OpenERPConnector.xml" role="mage" /> | ||
3147 | 46 | </dir> <!-- /app/etc/modules --> | ||
3148 | 47 | </dir> <!-- /app/etc --> | ||
3149 | 48 | </dir> <!-- /app --> | ||
3150 | 49 | <dir name="Openlabs"> | ||
3151 | 50 | <dir name="OpenERPConnector"> | ||
3152 | 51 | <dir name="etc"> | ||
3153 | 52 | <file md5sum="12668c63dc2e626940c5651510acdd95" name="api.xml" role="magecommunity" /> | ||
3154 | 53 | <file md5sum="c9ab22309066dc8d181061a0f158dc6f" name="config.xml" role="magecommunity" /> | ||
3155 | 54 | </dir> <!-- /Openlabs/OpenERPConnector/etc --> | ||
3156 | 55 | <dir name="Helper"> | ||
3157 | 56 | <file md5sum="a2ea05cfc56bcd06be442f75844e3fc1" name="Data.php" role="magecommunity" /> | ||
3158 | 57 | </dir> <!-- /Openlabs/OpenERPConnector/Helper --> | ||
3159 | 58 | <dir name="Model"> | ||
3160 | 59 | <dir name="Olcatalog"> | ||
3161 | 60 | <file md5sum="43c11c180f0f1ccfc576bb0d8b238015" name="Categories.php" role="magecommunity" /> | ||
3162 | 61 | </dir> <!-- /Openlabs/OpenERPConnector/Model/Olcatalog --> | ||
3163 | 62 | <dir name="Olcore"> | ||
3164 | 63 | <file md5sum="568a59414cd61bb14dd9899bd3d74edc" name="Groups.php" role="magecommunity" /> | ||
3165 | 64 | <file md5sum="03e476e465b5794d8deee99fd027d35c" name="Storeviews.php" role="magecommunity" /> | ||
3166 | 65 | <file md5sum="5abd4c8db3b68b4dfd5bdd7ebbb7ec93" name="Website.php" role="magecommunity" /> | ||
3167 | 66 | </dir> <!-- /Openlabs/OpenERPConnector/Model/Olcore --> | ||
3168 | 67 | </dir> <!-- /Openlabs/OpenERPConnector/Model --> | ||
3169 | 68 | </dir> <!-- /Openlabs/OpenERPConnector --> | ||
3170 | 69 | </dir> <!-- /Openlabs --> | ||
3171 | 70 | </dir> <!-- / --> | ||
3172 | 71 | </contents> | ||
3173 | 72 | <dependencies> | ||
3174 | 73 | <required> | ||
3175 | 74 | <php> | ||
3176 | 75 | <min>5.2.0</min> | ||
3177 | 76 | <max>6.0.0</max> | ||
3178 | 77 | </php> | ||
3179 | 78 | <pearinstaller> | ||
3180 | 79 | <min>1.6.2</min> | ||
3181 | 80 | </pearinstaller> | ||
3182 | 81 | </required> | ||
3183 | 82 | </dependencies> | ||
3184 | 83 | <phprelease /> | ||
3185 | 84 | </package> |
Hello,
This merge proposal is invalid as this branch must be merged into lp:magentoerpconnect/magento-module (Magento module) and not into lp:magentoerpconnect (OpenERP module).
Also, the reviewer of lp:magentoerpconnect/magento-module is Sharoon Thomas and not the "MagentoERPConnect core Editors" Team.
A merge proposal is currently pending on this branch on the behalf of Mohammed Nahhas as requestor and of Sharoon Thomas as reviewer : https:/ /code.launchpad .net/~mohammed- nahhas/ magentoerpconne ct/magento- module- dev/+merge/ 63859