Innobyte_EmagMarketplace - Version 1.1.9

Version Notes

Download this release

Release Info

Developer Florin Mihai Savici
Extension Innobyte_EmagMarketplace
Version 1.1.9
Comparing to
See all releases


Code changes from version 1.0.4 to 1.1.9

Files changed (75) hide show
  1. README.md +0 -215
  2. User Guide eMAG Marketplace.pdf +0 -0
  3. app/code/local/Innobyte/Core/Block/Shop.php +0 -234
  4. app/code/local/Innobyte/Core/Block/System/Config/Button.php +0 -57
  5. app/code/local/Innobyte/Core/Block/System/Config/Form/Fieldset/Extensions.php +0 -7
  6. app/code/local/Innobyte/Core/Block/System/Config/Form/Fieldset/Shop.php +0 -11
  7. app/code/local/Innobyte/Core/Block/System/Config/Form/Renderer/Field.php +0 -37
  8. app/code/local/Innobyte/Core/Block/System/Config/Form/Renderer/Website.php +0 -75
  9. app/code/local/Innobyte/Core/Helper/Config.php +0 -9
  10. app/code/local/Innobyte/Core/Helper/Data.php +0 -8
  11. app/code/local/Innobyte/Core/Helper/Versions.php +0 -272
  12. app/code/local/Innobyte/Core/Model/Data.php +0 -91
  13. app/code/local/Innobyte/Core/Model/Debug.php +0 -248
  14. app/code/local/Innobyte/Core/Model/Feed.php +0 -249
  15. app/code/local/Innobyte/Core/Model/Source/Config/Enabledisable.php +0 -31
  16. app/code/local/Innobyte/Core/Model/Source/Feed/Type.php +0 -72
  17. app/code/local/Innobyte/Core/controllers/Adminhtml/IndexController.php +0 -34
  18. app/code/local/Innobyte/Core/etc/config.xml +0 -135
  19. app/code/local/Innobyte/Core/etc/system.xml +0 -145
  20. app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Catalog/Product/Edit/Tab/EmagMarketplace.php +44 -1
  21. app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Sales/Order/Grid/Column/Filter.php +25 -0
  22. app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Sales/Order/Grid/Column/Renderer.php +26 -0
  23. app/code/local/Innobyte/EmagMarketplace/Helper/Data.php +93 -36
  24. app/code/local/Innobyte/EmagMarketplace/Model/Api/Abstract.php +5 -1
  25. app/code/local/Innobyte/EmagMarketplace/Model/Api/Product.php +162 -112
  26. app/code/local/Innobyte/EmagMarketplace/Model/Catalog/Product/Observer.php +163 -61
  27. app/code/local/Innobyte/EmagMarketplace/Model/Cron.php +0 -1
  28. app/code/local/Innobyte/EmagMarketplace/Model/Invoice/Pdf/Total/Voucher.php +3 -1
  29. app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Abstract.php +1 -1
  30. app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Emag.php +120 -27
  31. app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Emag/Update.php +13 -2
  32. app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Magento.php +42 -36
  33. app/code/local/Innobyte/EmagMarketplace/Model/Sales/Invoice.php +11 -1
  34. app/code/local/Innobyte/EmagMarketplace/Model/Sales/Observer.php +145 -13
  35. app/code/local/Innobyte/EmagMarketplace/Model/Sales/Order/Creditmemo/Total.php +5 -2
  36. app/code/local/Innobyte/EmagMarketplace/Model/Sales/Order/Invoice/Total.php +5 -2
  37. app/code/local/Innobyte/EmagMarketplace/Model/Sales/Quote/Address/Total/Voucher.php +5 -2
  38. app/code/local/Innobyte/EmagMarketplace/Model/Source/Attribute/Sync/Status.php +68 -0
  39. app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Abstract.php +6 -1
  40. app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Creditmemo.php +1 -1
  41. app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Invoice.php +1 -1
  42. app/code/local/Innobyte/EmagMarketplace/controllers/Adminhtml/Emag/ProductController.php +12 -0
  43. app/code/local/Innobyte/EmagMarketplace/controllers/Adminhtml/Sales/OrderController.php +181 -23
  44. app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_product_setup/data-upgrade-1.1.5-1.1.6.php +5 -0
  45. app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_product_setup/data-upgrade-1.1.6-1.1.7.php +18 -0
  46. app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_setup/data-upgrade-1.1.4-1.1.5.php +30 -0
  47. app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_setup/data-upgrade-1.1.7-1.1.8.php +11 -0
  48. app/code/local/Innobyte/EmagMarketplace/etc/config.xml +73 -1
  49. app/code/local/Innobyte/EmagMarketplace/etc/system.xml +80 -87
  50. app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_product_setup/upgrade-1.1.5-1.1.6.php +38 -0
  51. app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.0.6-1.1.0.php +90 -0
  52. app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.4-1.1.5.php +26 -0
  53. app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.7-1.1.8.php +25 -0
  54. app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.8-1.1.9.php +41 -0
  55. app/design/adminhtml/default/default/layout/innobyte/core.xml +0 -8
  56. app/design/adminhtml/default/default/layout/innobyte/emag_marketplace.xml +28 -2
  57. app/design/adminhtml/default/default/template/innobyte/core/button.phtml +0 -23
  58. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/cron.phtml +0 -49
  59. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/disabled_extensions.phtml +0 -13
  60. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/general.phtml +0 -11
  61. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/inno_config_data.phtml +0 -20
  62. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/inno_extensions.phtml +0 -13
  63. app/design/adminhtml/default/default/template/innobyte/core/debugger_email/rewrites.phtml +0 -31
  64. app/design/adminhtml/default/default/template/innobyte/core/shop.phtml +0 -37
  65. app/design/adminhtml/default/default/template/innobyte/emag_marketplace/sales/order/create/totals/voucher.phtml +3 -2
  66. app/design/adminhtml/default/default/template/innobyte/emag_marketplace/sales/order/totals.phtml +5 -1
  67. app/etc/modules/Innobyte_Core.xml +0 -9
  68. app/etc/modules/Innobyte_EmagMarketplace.xml +0 -1
  69. app/locale/en_US/Innobyte_EmagMarketplace.csv +25 -4
  70. app/locale/en_US/template/email/innobyte/core/debug.html +0 -99
  71. js/innobyte/core/init.js +0 -11
  72. package.xml +2 -18
  73. skin/adminhtml/default/default/images/innobyte/core/error_msg_icon.gif +0 -0
  74. skin/adminhtml/default/default/images/innobyte/core/icon-enabled.png +0 -0
  75. skin/adminhtml/default/default/images/innobyte/core/note_msg_icon.gif +0 -0
README.md DELETED
@@ -1,215 +0,0 @@
1
- eMAG Marketplace [1.0.0]
2
- ========================
3
-
4
- ### 1. Description
5
- - This module integrantes eMAG Marketplace API into Magento.
6
- - DEMO: http://demo.innobyte.com/emag_marketplace
7
-
8
- ### 2. Features
9
- - Enable/Disable eMAG Marketplace module.
10
- - Supports different eMAG vendors (per store).
11
- - Import eMAG categories, VATs, localities (from `eMAG Marketplace` admin menu).
12
- - New tab on product edit page available on store view level for saving eMAG product data.
13
- - Entire product documentation sending or just offer sending.
14
- - Autocomplete city available on order edit page / system config shipping settings origin city.
15
- - AWB generation through eMAG for an order (settings must be first set from `System` -> `Configuration` -> `eMAG Marketplace` -> `Shipping Settings`)
16
-
17
- ### 3. Compatible with
18
- - Magento CE >= 1.7.0.2
19
-
20
- ### 4. Usage
21
- 1. Go to `System`->`Configuration`->`Innobyte Extensions`->`eMAG Marketplace` fill in the licence key and set extension options. Be aware that some/most of the options are available only on store view level.
22
- 2. Refresh your cache and verify if everything works as described (go to admin `eMAG Marketplace` menu and import vats, categories, localities, then go to catalog and send some products to eMAG. After some orders have been placed on eMAG platform, cron should read them and orders should appear also in Magento).
23
-
24
-
25
- ### 5. Technical specification
26
- API Integration documentation can be found in `docs/` folder.
27
- On local env / not public server in order to send a product set this variable INNO_EMAG_MKTP_LOCAL in order to use a public hardcoded image. On apache put this in vhost like below:
28
-
29
- SetEnv INNO_EMAG_MKTP_LOCAL on
30
-
31
- ###### Rewrites
32
- - Models
33
- - *customer_form*: remove eMAG attributes from forms if emag_order_id is not available
34
- - *sales_order_status*: added eventPrefix and eventObject properties
35
- - *sales_resource_order_item_collection*: added eventPrefix and eventObject properties
36
- - Blocks
37
- - *adminhtml_catalog_product_edit*: added 3 more buttons on product edit page
38
-
39
- ###### Event observers
40
- - *sales_quote_save_after*: save eMAG quote attributes to database
41
- - *sales_order_save_after*: save eMAG order attributes to database
42
- - *sales_order_creditmemo_save_after*: update eMAG order with storno invoice
43
- - *sales_quote_load_after*: add eMAG quote attribute to quote collection
44
- - *sales_order_load_after*: add eMAG order attribute to order collection
45
- - *sales_order_invoice_load_after*: attach vouchers to invoice
46
- - *sales_order_creditmemo_load_after*: attach vouchers to creditmemo
47
- - *sales_quote_address_save_after*: save eMAG quote address attributes to database
48
- - *sales_order_address_save_after*: save eMAG order address attributes to database
49
- - *sales_quote_address_collection_load_after*: add eMAG quote address attribute to quote address collection
50
- - *sales_order_address_collection_load_after*: add eMAG order address attribute to order address collection
51
- - *core_copy_fieldset_customer_account_to_quote*: copy eMAG customer attributes to quote
52
- - *core_copy_fieldset_customer_address_to_quote_address*: copy eMAG customer address attributes to quote address
53
- - *core_copy_fieldset_sales_convert_quote_to_order*: copy eMAG attributes from quote to order
54
- - *core_copy_fieldset_sales_convert_quote_address_to_order_address*: copy eMAG attributes from quote address to order address
55
- - *core_copy_fieldset_sales_convert_quote_address_to_customer_address*: copy eMAG attributes from quote address to customer address
56
- - *core_copy_fieldset_checkout_onepage_quote_to_customer*: copy eMAG attributes from quote to customer
57
- - *core_copy_fieldset_sales_copy_order_to_edit*: copy eMAG attributes from original order to new order
58
- - *core_copy_fieldset_sales_convert_order_to_invoice*: copy eMAG attributes from order to invoice
59
- - *core_copy_fieldset_sales_convert_order_to_cm*: copy eMAG attributes from order to creditmemo
60
- - *core_copy_fieldset_sales_copy_order_billing_address_to_order*: copy eMAG attributes from billing address to order
61
- - *core_copy_fieldset_sales_copy_order_shipping_address_to_order*: copy eMAG attributes from shipping address to order
62
- - *catalog_product_save_after*: saves eMAG specific product data.
63
- - *adminhtml_catalog_product_grid_prepare_massaction*: add 3 more mass actions on products grid.
64
-
65
- ###### Cron jobs
66
- - `innobyte_emag_marketplace_cron`: pull orders from eMAG API (runs every 5 minutes)
67
-
68
- ###### Dispatched events
69
- - `innobyte_emag_marketplace_compute_api_product_data` is dispatched in *Innobyte_EmagMarketplace_Model_Api_Product* class in order to customize (if needed by clients) product data sent for a product to eMAG API.
70
- - `innobyte_emag_marketplace_compute_api_offer_data` is dispatched in *Innobyte_EmagMarketplace_Model_Api_Product* class in order to customize (if needed by clients) product offer data sent for a product to eMAG API.
71
- - `innobyte_emag_marketplace_prepare_emag_product_form` is dispatched in *Innobyte_EmagMarketplace_Block_Adminhtml_Catalog_Product_Edit_Tab_EmagMarketplace* class in order to customize (if needed by clients) eMAG product form fields.
72
- - `innobyte_emag_marketplace_compute_api_awb_data` is dispatched in *Innobyte_EmagMarketplace_Model_Api_Awb* class in order to customize (if needed by clients) AWB data to be sent to eMAG API.
73
-
74
- ###### Api Settings:
75
- - Admin->*System*->*Configuration*->*eMAG Marketplace*->*API Settings* (store view level):
76
- - api url: marketplace API URL
77
- - api username: vendor 's username
78
- - api password: vendor 's password
79
- - client code: vendor 's code
80
-
81
- ###### eMAG Statuses:
82
- - Add 6 new statuses for eMAG and map the with corresponding magento states (emag_status[magento_state]):
83
- - emag_new[new]
84
- - emag_in_progress[processing]
85
- - emag_prepared[processing]
86
- - emag_finalized[processing]
87
- - emag_canceled[processing]
88
- - emag_returned[closed]
89
-
90
- ###### Vouchers:
91
- - New tables:
92
- - innobyte_emag_marketplace_sales_flat_order_voucher
93
- - innobyte_emag_marketplace_sales_flat_quote_voucher
94
- Columns:
95
- - id: ID
96
- - entity_id: Entity Id, quote/order
97
- - emag_id: eMAG ID
98
- - emag_voucher_id: eMAG Voucher ID
99
- - emag_voucher_name: eMAG Voucher Name
100
- - emag_sale_price: eMAG Sale Price
101
- - base_emag_sale_price: eMAG Sale Price in base currency
102
- - emag_sale_price_vat: eMAG Sale Price VAT
103
- - base_emag_sale_price_vat: eMAG Sale Price VAT in base currency
104
- - emag_status: eMAG Status
105
- - emag_vat: eMAG VAT
106
- - emag_created: eMAG Creation Time
107
- - emag_modified: eMAG Modification Time
108
- - Added custom layout for admin to show eMAG vouchers in order/invoice/creditmemo totals.
109
- - New PDF Total model to display voucher discount in invoice PDF.
110
-
111
- ###### Attibutes:
112
- - Customer attributes: (visible in forms: adminhtml_customer)
113
- - emag_order_id
114
- - emag_customer_id
115
- - emag_customer_comment
116
- - emag_customer_gender
117
- - emag_payment_status
118
- - emag_order_date
119
- - Customer address attributes: (visible in forms: adminhtml_customer_address)
120
- - emag_company_code
121
- - emag_company_reg_no
122
- - emag_bank
123
- - emag_iban
124
- - emag_legal_entity
125
- - emag_is_vat_payer
126
- - emag_telephone_2
127
- - emag_telephone_3
128
- - emag_locality_id
129
-
130
- ###### Invoice:
131
- - Added system config field for invoice and creditmemo incement prefix. It updates increment_id column from eav_entity_store table. Can only be edited at store level.
132
- - Added new button in admin order view page:
133
- - invoice upload
134
- - invoice download
135
- - invoice delete
136
- - Added custom layout to modify invoice totals
137
- - New model for <global><sales><order_invoice><totals> that handles vouchers and applies correct grand total
138
-
139
- ###### Refunds:
140
- - New model for <global><sales><order_creditmemo><totals> that handles vouchers and applies correct grand total
141
- - Added custom layout to modify creditmemo totals
142
-
143
- ###### Api:
144
- - Models for each resource containing all 4 methods:
145
- - read
146
- - save
147
- - count
148
- - acknowledge
149
- For those resources that do not have the method implemented exception will be thrown.
150
- - Api response model
151
-
152
- ###### Orders:
153
- - Sync:
154
- - convert to magento order:
155
- - reserve increment id for new order and set eMAG order id, store id, date and status
156
- - apply global, base, store, order currency to order
157
- - prepare currency rates that will be applied to order
158
- - convert eMAG order products into magento order items and set order totals according to each product price
159
- - if product currency does not match store currency sync will fail
160
- - if product is canceled do not add it to magento order
161
- - if product could not be loaded(missing from magento or wrong id from eMAG) sync will fail
162
- - apply eMAG vouchers to magento order and recalculate totals based on voucher values
163
- - apply guest customer to magento order(set dummy email address as email is not provided by eMAG)
164
- - assign billing address
165
- - assign shipping address
166
- - apply shipping cost to magento order and recalculate totals
167
- - prepare payment method
168
- - apply customer comment to magento order
169
- - automatically generate order invoice if eMAG payment method is credit card and status is "paid"
170
- - convert to eMAG order:
171
- - set eMAG order id, status, date
172
- - assign customer data
173
- - convert magento billing address to eMAG address
174
- - convert magento shipping address to eMAG address
175
- - convert order products to eMAG products
176
- - assign invoices/creditmemos to eMAG order
177
- - assign vouchers to eMAG order
178
- - apply payment
179
- - apply customer comment
180
- - add attachements
181
- - Edit:
182
- - new model for <global><sales><quote><totals> that handles vouchers and applies correct grand total
183
- - added custom layout to modify order product grid in order to display product prices from original order
184
- - added custom layout to modify order totals
185
- - View:
186
- - new model for <global><sales><quote><totals> that handles vouchers and applies correct grand total
187
- - added eMAG statuses buttons
188
- - added custom layout to add customer comments
189
- - added custom layout to modify order totals
190
-
191
- ###### Shipping:
192
- New shipping method with custom price (visible only in admin)
193
-
194
- ###### Payment:
195
- New payment methods added for eMAG(visible only in admin):
196
- - bank transfer
197
- - cash on delivery
198
- - credit card
199
- - unknown (used for exceptions, when eMAG payment is not available on eMAG order)
200
-
201
- ###### Catalog Product
202
- - On edit page, on store view level, *eMAG Marketplace* tab should be available for simple & configurable products.
203
- - Edit block is rewritten, also its template file has been changed (added 3 more buttons) from layout.
204
- - On configurable products, an extra field 'Family Type' is present, it represents the modality of grouping some products (its associated products) on eMAG. When a configurable product is sent to eMAG all it 's associated products are sent with family type - the family type of parent configurable product, family name - the name of parent configurable product, family id - the magento id of the parent configurable product. Be aware that if you sent an associated product from it 's own edit page, no family will be set for it.
205
-
206
- ### 6. Install
207
- - Copy files / folders (design/skin files should be put in the default theme of your current package)
208
- - Refresh your cache, log out from admin and log back in.
209
-
210
-
211
- ### CHANGE LOG
212
- - 1.0.1 - Cron config bug fix
213
- - 1.0.2 - Added status filter to order synchronizing cron
214
- - 1.0.3 - Fix for eMAG order field checks while synchronizing
215
- - 1.0.4 - Product synchronization - commission type bug fix
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
User Guide eMAG Marketplace.pdf ADDED
Binary file
app/code/local/Innobyte/Core/Block/Shop.php DELETED
@@ -1,234 +0,0 @@
1
- <?php
2
- class Innobyte_Core_Block_Shop extends Mage_Adminhtml_Block_Template
3
- {
4
- public $configPage = '';
5
- private $_extensionsCache = array();
6
- private $_shopData = null;
7
-
8
-
9
- protected function _prepareLayout()
10
- {
11
- $this->configPage = $this->getAction()->getRequest()
12
- ->getParam('section', false);
13
- if ($this->configPage == 'innobyte_core') {
14
- $this->getLayout()
15
- ->getBlock('head')
16
- ->addJs('innobyte/core/init.js')
17
- ;
18
- $this->setData('extensions', $this->_initExtensions());
19
- } elseif ($this->configPage == 'innobyte_shop') {
20
- // Innobyte extensions shop
21
- $this->getLayout()
22
- ->getBlock('head')
23
- ->addJs('innobyte/core/init.js')
24
- ;
25
- $this->setData('shop_data', $this->_getShopData());
26
- }
27
- parent::_prepareLayout();
28
- }
29
-
30
- protected function _toHtml()
31
- {
32
- if ($this->configPage == 'innobyte_core' || $this->configPage == 'innobyte_shop') {
33
- return parent::_toHtml();
34
- } else {
35
- return '';
36
- }
37
- }
38
-
39
- protected function _initExtensions()
40
- {
41
- $extensions = array();
42
-
43
- $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
44
- sort($modules);
45
-
46
- foreach ($modules as $moduleName) {
47
- if ($moduleName == 'Innobyte_Core') {
48
- continue;
49
- }
50
- if (strstr($moduleName, 'Innobyte_') === false) {
51
- continue;
52
- }
53
-
54
- // Detect extension platform
55
- try {
56
- $platform = Mage::getConfig()->getNode('modules/'.$moduleName.'/platform');
57
- if ($platform) {
58
- $platform = strtolower($platform);
59
- $ignore_platform = false;
60
- } else {
61
- throw new Exception();
62
- }
63
- } catch (Exception $e) {
64
- $platform = 'ce';
65
- $ignore_platform = true;
66
- }
67
- $platform = Innobyte_Core_Helper_Versions::convertPlatform($platform);
68
-
69
- // Detect installed version
70
- $ver = Mage::getConfig()->getModuleConfig($moduleName)->version;
71
- $isPlatformValid = false;
72
- if ($platform >= $this->getPlatform()) {
73
- $isPlatformValid = true;
74
- }
75
- $feedInfo = $this->getExtensionInfo($moduleName);
76
-
77
- if ( ! $feedInfo->getData() ) {
78
- $feedInfo->setDisplayName($moduleName);
79
- $feedInfo->setUrl('http://shop.innobyte.com');
80
- $feedInfo->setVersion($ver);
81
- }
82
-
83
- $feedExtensionVersion = $this->_convertVersion($feedInfo->getLatestVersion());
84
- $installedExtVersion = $this->_convertVersion($ver);
85
- $upgradeAvailable = false;
86
- if (($feedExtensionVersion - $installedExtVersion) > 0) {
87
- $upgradeAvailable = true;
88
- }
89
-
90
- $extensionData = array(
91
- 'version' => $ver,
92
- 'name' => $moduleName,
93
- 'is_platform_valid' => $isPlatformValid,
94
- 'platform' => $platform,
95
- 'feed_info' => $feedInfo,
96
- 'upgrade_available' => $upgradeAvailable
97
- );
98
- $extensions[] = new Varien_Object($extensionData);
99
- }
100
-
101
- return $extensions;
102
- }
103
-
104
- /**
105
- * Convert version to comparable integer
106
- * @param $version
107
- * @return int
108
- */
109
- protected function _convertVersion($version)
110
- {
111
- $digits = @explode(".", $version);
112
- $version = 0;
113
- if (is_array($digits)) {
114
- foreach ($digits as $k => $version) {
115
- $version += ($version * pow(10, max(0, (3 - $k))));
116
- }
117
- }
118
- return $version;
119
- }
120
-
121
-
122
- /**
123
- * Get extension info from cached feed
124
- * @param $moduleName
125
- * @return bool|Varien_Object
126
- */
127
- public function getExtensionInfo($moduleName)
128
- {
129
- if (!sizeof($this->_extensionsCache)) {
130
- // Mage::app()->removeCache('innobytecore_extensions_feed');
131
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
132
- if ($displayNames) {
133
- $this->_extensionsCache = @unserialize($displayNames);
134
- } else {
135
- $model = Mage::getModel('innobyte_core/feed')
136
- ->refreshExtensions();
137
- if ($model) {
138
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
139
- if ($displayNames) {
140
- $this->_extensionsCache = @unserialize($displayNames);
141
- }
142
- }
143
- }
144
- }
145
- if (array_key_exists($moduleName, $this->_extensionsCache)) {
146
- $data = array(
147
- 'url' => @$this->_extensionsCache[$moduleName]['url'],
148
- 'display_name' => @$this->_extensionsCache[$moduleName]['display_name'],
149
- 'latest_version' => @$this->_extensionsCache[$moduleName]['version']
150
- );
151
- return new Varien_Object($data);
152
- }
153
- return new Varien_Object();
154
- }
155
-
156
- /**
157
- * Return icon for installed extension
158
- * @param $extension
159
- * @return Varien_Object
160
- */
161
- public function getIcon($extension)
162
- {
163
- if ($extension->getUpgradeAvailable()) {
164
- $iconPic = 'images/innobyte/core/error_msg_icon.gif';
165
- $title = "Update available";
166
- } elseif (!$extension->getIsPlatformValid()) {
167
- $iconPic = 'images/innobyte/core/note_msg_icon.gif';
168
- $title = "Wrong Extension Platform";
169
- } else {
170
- $iconPic = 'images/innobyte/core/icon-enabled.png';
171
- $title = "Installed and up to date";
172
- }
173
- $icon = new Varien_Object();
174
- $data = array(
175
- 'title' => $title,
176
- 'source' => $this->getSkinUrl($iconPic));
177
- $icon->setData($data);
178
- return $icon;
179
- }
180
-
181
- /**
182
- * Fetch store data and return as Varien Object
183
- * @return Varien_Object
184
- */
185
- protected function _getShopData()
186
- {
187
- if (!is_null($this->_shopData)) {
188
- return $this->_shopData;
189
- }
190
- $connection = $this->_getShopConnection();
191
- $shopResponse = $connection->read();
192
-
193
- if ($shopResponse !== false) {
194
- $shopResponse = preg_split('/^\r?$/m', $shopResponse, 2);
195
- $shopResponse = trim($shopResponse[1]);
196
- Mage::app()->saveCache($shopResponse, Innobyte_Core_Helper_Config::SHOP_CACHE_KEY);
197
- }
198
- else {
199
- $shopResponse = Mage::app()->loadCache(Innobyte_Core_Helper_Config::SHOP_CACHE_KEY);
200
- if (!$shopResponse) {
201
- Mage::getSingleton('adminhtml/session')
202
- ->addError($this->__('Sorry, but Extensions Shop is not available now. Please try again in a few minutes.'));
203
- }
204
- }
205
-
206
- $connection->close();
207
- $this->_shopData = new Varien_Object(array('text_response' => $shopResponse));
208
- return $this->_shopData;
209
- }
210
-
211
- /**
212
- * Returns URL to store
213
- * @return Varien_Http_Adapter_Curl
214
- */
215
- protected function _getShopConnection()
216
- {
217
- $params = array();
218
- $url = array();
219
- foreach ($params as $k => $v) {
220
- $url[] = urlencode($k) . "=" . urlencode($v);
221
- }
222
- $url = rtrim(Innobyte_Core_Helper_Config::SHOP_URL)
223
- . (sizeof($url) ? ("?" . implode("&", $url)) : "");
224
-
225
- $curl = new Varien_Http_Adapter_Curl();
226
- $curl->setConfig(array('timeout' => 5));
227
- $curl->write(Zend_Http_Client::GET, $url, '1.0');
228
-
229
- return $curl;
230
- }
231
-
232
-
233
- }
234
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Block/System/Config/Button.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * System Configuration Button Block
5
- *
6
- * @category Innobyte
7
- * @package Innobyte_Core
8
- * @author Daniel Horobeanu <daniel.horobeanu@innobyte.com>
9
- */
10
- class Innobyte_Core_Block_System_Config_Button
11
- extends Mage_Adminhtml_Block_System_Config_Form_Field
12
- {
13
-
14
- protected function _construct()
15
- {
16
- parent::_construct();
17
- $this->setTemplate('innobyte/core/button.phtml');
18
- }
19
-
20
- /**
21
- * Return element html
22
- *
23
- * @param Varien_Data_Form_Element_Abstract $element
24
- * @return string
25
- */
26
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
27
- {
28
- return $this->_toHtml();
29
- }
30
-
31
- /**
32
- * Return ajax url for button
33
- *
34
- * @return string
35
- */
36
- public function getAjaxSendReportUrl()
37
- {
38
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_index/innoCoreSendReport', array('_current' => true));
39
- }
40
-
41
- /**
42
- * "Send email" button html
43
- *
44
- * @return string
45
- */
46
- public function getButtonHtml()
47
- {
48
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
49
- ->setData(array(
50
- 'id' => 'innobyte_core_send_email_button',
51
- 'label' => $this->helper('adminhtml')->__('Send email'),
52
- 'onclick' => 'inno.core.sendReport(); return false;'
53
- ));
54
- return $button->toHtml();
55
- }
56
-
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Block/System/Config/Form/Fieldset/Extensions.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Block_System_Config_Form_Fieldset_Extensions
4
- extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
5
- {
6
-
7
- }
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Block/System/Config/Form/Fieldset/Shop.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Block_System_Config_Form_Fieldset_Shop
4
- extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
5
- {
6
-
7
- public function render(Varien_Data_Form_Element_Abstract $element)
8
- {
9
- return '<div id="' . $element->getId() . '"></div>';
10
- }
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Block/System/Config/Form/Renderer/Field.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Block_System_Config_Form_Renderer_Field
4
- extends Mage_Adminhtml_Block_System_Config_Form_Field
5
- {
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
- {
9
- $value = 1;
10
- Mage::register('inno-',$element->getHint());
11
- $websites = Mage::helper('innobyte_core/versions')
12
- ->getAvailableWebsites($element->getHint());
13
- if (!empty($websites)) {
14
- $scopeWebsiteCode = $this->getRequest()->getParam('website');
15
- $scopeWebsite = Mage::getModel('core/website')
16
- ->load($this->getRequest()->getParam('website'), 'code');
17
- $url = $scopeWebsite->getConfig('web/unsecure/base_url');
18
- $domain = trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url));
19
- if ($domain && $scopeWebsite && in_array($domain, $websites)) {
20
- $html = '<strong class="ok">' . $this->__('Licensed') . '</strong>';
21
- } elseif (!$scopeWebsiteCode) {
22
- $domains = Mage::helper('innobyte_core/versions')->getAllStoreDomains();
23
- $html = '<strong class="ok">' . $this->__('Licensed') . '</strong>';
24
- } elseif ($scopeWebsiteCode && in_array($scopeWebsiteCode, $websites)) {
25
- $html = '<strong class="ok">' . $this->__('Licensed') .$scopeWebsiteCode. '</strong>';
26
- } else {
27
- $html = '<strong class="required">' . $this->__('Please buy additional licence for the domain :') .'<br/>'.$domain. '</strong>';
28
- }
29
- } else {
30
- Mage::getModel('core/config')->saveConfig(Innobyte_Core_Helper_Versions::INSTALLED.$element->getHint(), $value );
31
- Mage::getConfig()->reinit();
32
- Mage::app()->reinitStores();
33
- $html = '<strong class="required">' . $this->__('Please enter a valid key') . '</strong>';
34
- }
35
- return $html;
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Block/System/Config/Form/Renderer/Website.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Block_System_Config_Form_Renderer_Website
4
- extends Mage_Adminhtml_Block_System_Config_Form_Field
5
- {
6
-
7
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
- {
9
- $html = '';
10
- $r = Mage::getStoreConfig($element->getHint().'/license/ar');
11
- $value = explode(',', str_replace($r, '', Mage::helper('core')->decrypt($element->getValue())));
12
-
13
- $nameprefix = $element->getName();
14
- $idprefix = $element->getId();
15
-
16
- $element->setName($nameprefix . '[]');
17
- $info = Mage::helper('innobyte_core/versions')->avs($element->getHint());
18
-
19
- if (isset($info['d']) && isset($info['c']) && intval($info['c']) > 0) {
20
- foreach (Mage::app()->getWebsites() as $website) {
21
- $element->setChecked(false);
22
-
23
- $id = $website->getId();
24
- $name = $website->getName();
25
-
26
- $element->setId($idprefix . '_' . $id);
27
- $element->setValue($id);
28
- $element->setClass('innobyte-available-sites');
29
-
30
- if (in_array($id, $value) !== false) {
31
- $element->setChecked(true);
32
- }
33
-
34
- if ($id != 0) {
35
- $html .= '<div><label>' . $element->getElementHtml() . ' ' . $name . ' </label></div>';
36
- }
37
- }
38
-
39
- $html .= '
40
- <input id="' . $idprefix . '_diasbled" type="hidden" disabled="disabled" name="' . $nameprefix . '" />
41
- <script type="text/javascript">
42
-
43
- function updateInnobyteWebsites(){
44
- $("' . $idprefix . '_diasbled").disabled = "disabled";
45
- if($$(".innobyte-available-sites:checked").length >= ' . intval($info['c']) . '){
46
- $$(".innobyte-available-sites").each(function(e){
47
- if(!e.checked){
48
- e.disabled = "disabled";
49
- }
50
- });
51
- }else {
52
- $$(".innobyte-available-sites").each(function(e){
53
- if(!e.checked){
54
- e.disabled = "";
55
- }
56
- });
57
- if($$(".innobyte-available-sites:checked").length == 0){
58
- $("' . $idprefix . '_diasbled").disabled = "";
59
- }
60
- }
61
- }
62
- $$(".innobyte-available-sites").each(function(e){
63
- e.observe("click", function(){
64
- updateInnobyteWebsites();
65
- });
66
- });
67
- updateInnobyteWebsites();
68
- </script>';
69
- } else {
70
- $html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
71
- }
72
-
73
- return $html;
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Helper/Config.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Helper_Config extends Mage_Core_Helper_Abstract
4
- {
5
- const SHOP_URL = 'shop.innobyte.com/feeds/shop.html';
6
- const SHOP_CACHE_KEY = 'innobyte_core_shop_cache_key';
7
- const UPDATES_FEED_URL = 'http://shop.innobyte.com/feeds/updates.xml';
8
- const EXTENSIONS_FEED_URL = 'http://shop.innobyte.com/feeds/extensions.xml';
9
- }
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Helper/Data.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
- class Innobyte_Core_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
-
5
-
6
- }
7
-
8
-
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Helper/Versions.php DELETED
@@ -1,272 +0,0 @@
1
- <?php
2
-
3
-
4
- class Innobyte_Core_Helper_Versions extends Mage_Core_Helper_Abstract
5
- {
6
- const EE_PLATFORM = 2;
7
- const PE_PLATFORM = 1;
8
- const CE_PLATFORM = 0;
9
- const ENTERPRISE = 'Enterprise';
10
- const ENTERPRISE_DETECT_EXTENSION = 'Enterprise';
11
- const ENTERPRISE_DESIGN_NAME = "enterprise";
12
- const PROFESSIONAL_DESIGN_NAME = "pro";
13
- const INSTALLED = 'advanced/modules_disable_output/';
14
-
15
- protected static $_platform = -1;
16
- protected $_m = 'innobyte_core';
17
-
18
- private function _e($m)
19
- {
20
- $se = $m;
21
- if (!Mage::getStoreConfig($se.'/license/installed')
22
- || (intval(Mage::getStoreConfig($se.'/license/count')) > 20
23
- )) {
24
- return array();
25
- }
26
-
27
- $timeToUpdate = 60 * 60 * 24 * 15;
28
-
29
- $r = Mage::getStoreConfig($se.'/license/ar');
30
- $t = Mage::getStoreConfig($se.'/license/time');
31
- $s = Mage::getStoreConfig($se.'/license/websites');
32
-
33
- $lastCheck = str_replace($r, '', Mage::helper('core')->decrypt($t));
34
-
35
- $allsites = explode(',', str_replace($r, '', Mage::helper('core')->decrypt($s)));
36
- $allsites = array_diff($allsites, array(""));
37
-
38
- if (($lastCheck + $timeToUpdate) < time()) {
39
- $key = Mage::getStoreConfig($se.'/license/key');
40
- $this->a($key, intval(Mage::getStoreConfig($m.'/license/count')), $s, $se);
41
- }
42
-
43
- return $allsites;
44
- }
45
-
46
- public static function getPlatform()
47
- {
48
- if (self::$_platform == -1) {
49
- $pathToClaim = BP . DS . "app" . DS . "etc" . DS . "modules"
50
- . DS . self::ENTERPRISE . "_"
51
- . self::ENTERPRISE_DETECT_EXTENSION . ".xml";
52
- $pathToEEConfig = BP . DS . "app" . DS . "code" . DS . "core"
53
- . DS . self::ENTERPRISE . DS
54
- . self::ENTERPRISE_DETECT_EXTENSION . DS . "etc"
55
- . DS . "config.xml";
56
- $isCommunity = !file_exists($pathToClaim) || !file_exists($pathToEEConfig);
57
- if ($isCommunity) {
58
- self::$_platform = self::CE_PLATFORM;
59
- } else {
60
- $_xml = @simplexml_load_file($pathToEEConfig,'SimpleXMLElement', LIBXML_NOCDATA);
61
- if(!$_xml===FALSE) {
62
- $package = (string)$_xml->default->design->package->name;
63
- $theme = (string)$_xml->install->design->theme->default;
64
- $skin = (string)$_xml->stores->admin->design->theme->skin;
65
- $isProffessional = ($package == self::PROFESSIONAL_DESIGN_NAME) && ($theme == self::PROFESSIONAL_DESIGN_NAME) && ($skin == self::PROFESSIONAL_DESIGN_NAME);
66
- if ($isProffessional) {
67
- self::$_platform = self::PE_PLATFORM;
68
- return self::$_platform;
69
- }
70
- }
71
- self::$_platform = self::EE_PLATFORM;
72
- }
73
- }
74
- return self::$_platform;
75
- }
76
-
77
- /**
78
- * Convert platform from string to int and backwards
79
- * @static
80
- * @param $platformCode
81
- * @return int|string
82
- */
83
- public static function convertPlatform($platformCode)
84
- {
85
- if (is_numeric($platformCode)) {
86
- // Convert predefined to letters code
87
- $platform = ($platformCode == self::EE_PLATFORM ? 'ee' : ($platformCode == self::PE_PLATFORM ? 'pe'
88
- : 'ce'));
89
- } else if (is_string($platformCode)) {
90
- $platformCode = strtolower($platformCode);
91
- $platform = ($platformCode == 'ee' ? self::EE_PLATFORM : ($platformCode == 'pe' ? self::PE_PLATFORM
92
- : self::CE_PLATFORM));
93
- }else{$platform = self::CE_PLATFORM;}
94
- return $platform;
95
- }
96
-
97
- public function getAvailableWebsites($m)
98
- {
99
- return $this->_e($m);
100
- }
101
-
102
-
103
- public static function convertVersion($v)
104
- {
105
- $digits = @explode(".", $v);
106
- $version = 0;
107
- if (is_array($digits)) {
108
- foreach ($digits as $k => $v) {
109
- $version += ($v * pow(10, max(0, (3 - $k))));
110
- }
111
-
112
- }
113
- return $version;
114
- }
115
-
116
- public function a($k, $c = 0, $s = '', $m = '')
117
- {
118
- $value = 1;
119
- if (!$this->_m || $this->_m == 'innobyte_core'){
120
- $this->_m = $m;
121
- }
122
-
123
- if (!$k) {
124
- $e = Mage::helper('core');
125
- $se = $this->_m;
126
- $value1 = Mage::getStoreConfig($se.'/license/ar');
127
- $value2 =(string) '';//Mage::getStoreConfig($se.'/license/websites');
128
- $groups = array(
129
- 'license' => array(
130
- 'fields' => array(
131
- 'ar' => array('value' => $value1),
132
- 'websites' => array('value' => $value2),
133
- 'enabled' => array('value' => !$value),
134
- 'time' => array(
135
- 'value' => (string) $e->encrypt($value1 . (time() - (60 * 60 * 24 * 15 - 1800)) . $value1)
136
- ),
137
- 'count' => array('value' => $value)
138
- )
139
- )
140
- );
141
-
142
- Mage::getModel('adminhtml/config_data')
143
- ->setSection($se)
144
- ->setGroups($groups)
145
- ->save();
146
- Mage::getModel('core/config')->saveConfig(self::INSTALLED.$this->_m, $value );
147
- Mage::getConfig()->reinit();
148
- Mage::app()->reinitStores();
149
- return;
150
- }
151
-
152
- try {
153
- $ch = curl_init();
154
- curl_setopt($ch, CURLOPT_URL, sprintf('http://shop.innobyte.com/feeds/l.php'));
155
- curl_setopt($ch, CURLOPT_POST, true);
156
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'k='.urlencode($k)
157
- . '&m='.$this->_m.'&d='
158
- . urlencode(implode(',', $this->getAllStoreDomains()))
159
- . '&p='.$this->getPlatform()
160
- . '&x='.((Mage::getStoreConfigFlag(self::INSTALLED.$this->_m)==1)?'0':'1')
161
- );
162
- curl_setopt($ch, CURLOPT_TIMEOUT, 7);
163
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
164
-
165
- $content = curl_exec($ch);
166
- if (false === $content) {
167
- Mage::throwException(curl_error($ch));
168
- }
169
-
170
- $r = Zend_Json::decode($content);
171
- } catch (Exception $e){
172
- Mage::throwException($this->__('Please try again later. '.$e->getMessage()));
173
- return;
174
- }
175
-
176
- $e = Mage::helper('core');
177
- $se = $this->_m;
178
-
179
- $value = 1;
180
- if (empty($r)) {
181
- $value1 = Mage::getStoreConfig($se.'/license/ar');
182
- $value2 =(string) '';
183
- $groups = array(
184
- 'license' => array(
185
- 'fields' => array(
186
- 'ar' => array('value' => $value1),
187
- 'websites' => array('value' => $value2),
188
- 'enabled' => array('value' => !$value),
189
- 'time' => array(
190
- 'value' => (string) $e->encrypt($value1 . (time() - (60 * 60 * 24 * 15 - 1800)) . $value1)
191
- ),
192
- 'count' => array('value' => $c + 1)
193
- )
194
- )
195
- );
196
-
197
-
198
- Mage::getModel('adminhtml/config_data')
199
- ->setSection($se)
200
- ->setGroups($groups)
201
- ->save();
202
- Mage::getModel('core/config')->saveConfig('advanced/modules_disable_output/'.$this->_m, $value );
203
- Mage::getConfig()->reinit();
204
- Mage::app()->reinitStores();
205
-
206
- return;
207
- }
208
-
209
- $value1 = '';
210
- $value2 = '';
211
- if (isset($r['d']) && isset($r['c'])) {
212
- $value1 = $e->encrypt(base64_encode(Zend_Json::encode($r)));
213
- if (!$s) {
214
- $s = Mage::getStoreConfig($se.'/license/websites');
215
- }
216
- $s = array_slice(explode(',', $r['d']), 0, $r['c']);
217
- $value2 = $e->encrypt($value1 . implode(',', $s) . $value1);
218
- $value = 0;
219
- Mage::getModel('core/config')->saveConfig('advanced/modules_disable_output/'.$this->_m, 0 );
220
- }
221
- $groups = array(
222
- 'license' => array(
223
- 'fields' => array(
224
- 'ar' => array('value' => $value1),
225
- 'websites' => array('value' => (string) $value2),
226
- 'time' => array(
227
- 'value' => (string) $e->encrypt($value1 . time() . $value1)
228
- ),
229
- 'enabled' => array('value' => !$value),
230
- 'installed' => array('value' => 1),
231
- 'count' => array('value' => 0)
232
- )
233
- )
234
- );
235
-
236
- Mage::getModel('adminhtml/config_data')
237
- ->setSection($se)
238
- ->setGroups($groups)
239
- ->save();
240
-
241
- Mage::getConfig()->reinit();
242
- Mage::app()->reinitStores();
243
- }
244
-
245
- public function getAllStoreDomains()
246
- {
247
- $domains = array();
248
- foreach (Mage::app()->getWebsites() as $website) {
249
- $url = $website->getConfig('web/unsecure/base_url');
250
- if($domain = trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url))){
251
- $domains[] = $domain;
252
- }
253
- $url = $website->getConfig('web/secure/base_url');
254
- if($domain = trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url))){
255
- $domains[] = $domain;
256
- }
257
- }
258
-
259
- return array_unique($domains);
260
- }
261
-
262
- public function getAvailabelsWebsites($m = null)
263
- {
264
- $this->_m = $m;
265
- return $this->_e($m);
266
- }
267
-
268
- public function avs($m)
269
- {
270
- return Zend_Json::decode(base64_decode(Mage::helper('core')->decrypt(Mage::getStoreConfig($m.'/license/ar'))));
271
- }
272
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Model/Data.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
- /**
3
- * Data model
4
- *
5
- * @category Innobyte
6
- * @package Innobyte_Core
7
- * @author Daniel Horobeanu <daniel.horobeanu@innobyte.com>
8
- */
9
- class Innobyte_Core_Model_Data extends Mage_Core_Model_Abstract
10
- {
11
- private $_extensionsCache = array();
12
-
13
- public function install($event)
14
- {
15
- $s = $event->getEvent()->getSection();
16
-
17
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
18
- if ($displayNames) {
19
- $this->_extensionsCache = @unserialize($displayNames);
20
- } else {
21
- $model = Mage::getModel('innobyte_core/feed')
22
- ->refreshExtensions();
23
- if ($model) {
24
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
25
- if ($displayNames) {
26
- $this->_extensionsCache = @unserialize($displayNames);
27
- }
28
- }
29
- }
30
-
31
- if (array_key_exists(strtolower($s), array_change_key_case($this->_extensionsCache))) {
32
- $j = Mage::getStoreConfig($s.'/license/key');
33
- $c = 0;
34
- // $c = Mage::getStoreConfig($s.'/license/count');
35
- Mage::helper('innobyte_core/versions')->a($j, $c, '', $s);
36
- }
37
- }
38
-
39
- public function init($event)
40
- {
41
- if ($event->getEvent()->getObject()->getData('section') == 'advanced') {
42
- $g = $event->getEvent()->getObject()->getData('groups');
43
- $ms = $g['modules_disable_output']['fields'];
44
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
45
- if ($displayNames) {
46
- $this->_extensionsCache = @unserialize($displayNames);
47
- } else {
48
- $model = Mage::getModel('innobyte_core/feed')
49
- ->refreshExtensions();
50
- if ($model) {
51
- $displayNames = Mage::app()->loadCache('innobytecore_extensions_feed');
52
- if ($displayNames) {
53
- $this->_extensionsCache = @unserialize($displayNames);
54
- }
55
- }
56
- }
57
-
58
- $data = $event->getEvent()->getObject()->getData();
59
- foreach ($ms as $m=>$v) {
60
-
61
-
62
- if ($m == 'Innobyte_Core') {
63
- continue;
64
- }
65
- if (strstr($m, 'Innobyte_') === false) {
66
- continue;
67
- }
68
- if (array_key_exists(strtolower($m), array_change_key_case($this->_extensionsCache))) {
69
- $j = Mage::getStoreConfig($m.'/license/key');
70
- $info = Mage::helper('innobyte_core/versions')->avs($m);
71
- $r = Mage::getStoreConfig($m.'/license/enabled');
72
-
73
- if (isset($info['d']) && isset($info['c']) && intval($info['c']) > 0) {
74
- foreach (Mage::app()->getWebsites() as $website) {
75
- $id = $website->getId();
76
- if ($r !== '1') {
77
- $data['groups']['modules_disable_output']['fields'][$m]['value'] = '1';
78
- break;
79
- }
80
- }
81
- } else {
82
- if ( ! $r ) {
83
- $data['groups']['modules_disable_output']['fields'][$m]['value'] = '1';
84
- }
85
- }
86
- }
87
- }
88
- $event->getEvent()->getObject()->setData($data);
89
- }
90
- }
91
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Model/Debug.php DELETED
@@ -1,248 +0,0 @@
1
- <?php
2
- /**
3
- * Debugger model.
4
- *
5
- * @category Innobyte
6
- * @package Innobyte_Core
7
- * @author Daniel Horobeanu <daniel.horobeanu@innobyte.com>
8
- */
9
- class Innobyte_Core_Model_Debug
10
- extends Mage_Core_Model_Abstract
11
- {
12
- const XML_RECIPIENTS_EMAIL_PATH = 'innobyte_core/debugger/email';
13
-
14
- public function sendEmail($message)
15
- {
16
- $templateId = Mage::getStoreConfig('innobyte_core/debugger/email_template');
17
- if (!$templateId) {
18
- $templateId = 'innobyte_core_debugger_email_template';
19
- }
20
-
21
- $sender = $this->getSenderInfo();
22
- $recepientEmail = $this->getRecipients();
23
- $recepientName = '';
24
- // Set variables that can be used in email template
25
- $vars = $this->getEmailVars($message);
26
-
27
- // Send Transactional Email
28
- $translate = Mage::getSingleton('core/translate');
29
- $mailTemplate = Mage::getModel('core/email_template');
30
- // add attachments
31
- $folder = Mage::getBaseDir('var').'/log/';
32
- $files = glob($folder.'*');
33
- foreach ($files as $file) {
34
- $mailTemplate->getMail()->createAttachment(
35
- file_get_contents($file),
36
- Zend_Mime::TYPE_OCTETSTREAM,
37
- Zend_Mime::DISPOSITION_ATTACHMENT,
38
- Zend_Mime::ENCODING_BASE64,
39
- basename($file)
40
- );
41
- }
42
- $mailTemplate->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars);
43
- $translate->setTranslateInline(true);
44
- }
45
-
46
- public function getSenderInfo()
47
- {
48
- $senderName = 'Innobyte Debugger';
49
- $senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
50
- $sender = array(
51
- 'name' => $senderName,
52
- 'email' => $senderEmail
53
- );
54
-
55
- return $sender;
56
- }
57
-
58
- /**
59
- * Get email receivers.
60
- *
61
- * @param null $storeId
62
- * @return string
63
- */
64
- public function getRecipients()
65
- {
66
- $configInfo = Mage::getStoreConfig(self::XML_RECIPIENTS_EMAIL_PATH);
67
- $recipients = explode(',', $configInfo);
68
- if (!empty($recipients[0])) {
69
- return $recipients;
70
- }
71
- return false;
72
- }
73
-
74
-
75
- public function getEmailVars($message)
76
- {
77
- $magento = array (
78
- 'edition' => 'NA / assuming Community',
79
- 'version' => Mage::getVersion(),
80
- 'domains' => Mage::helper('innobyte_core/versions')->getAllStoreDomains(),
81
- 'compilation' => $this->getCompilerStatus(),
82
- 'inno_extensions' => $this->getInnobyteExtensions(),
83
- 'inno_extensions_info' => $this->getConfigInnoData(),
84
- 'disabled_modules' => $this->getDisabledModules(),
85
- 'rewrites' => $this->getRewrites(),
86
- 'crontab' => $this->getCrontabInfo(),
87
- 'crons' => $this->getCrons(),
88
- );
89
-
90
- if (method_exists('Mage','getEdition')) {
91
- $magento['edition'] = Mage::getEdition();
92
- }
93
-
94
- ob_start();
95
- phpinfo();
96
- $phpInfo = ob_get_contents();
97
- ob_get_clean();
98
-
99
- $vars = array(
100
- 'php_info' => $phpInfo,
101
- 'magento' => $magento,
102
- 'explanation_message' => $message,
103
- );
104
-
105
- return $vars;
106
- }
107
-
108
- public function getCompilerStatus()
109
- {
110
- if (defined('COMPILER_INCLUDE_PATH')) {
111
- return '<span style="color:green">Enabled</span>';
112
- } else {
113
- return 'Disabled';
114
- }
115
- }
116
-
117
- public function getInnobyteExtensions()
118
- {
119
- $extensions = array();
120
-
121
- $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
122
- sort($modules);
123
-
124
- foreach ($modules as $moduleName) {
125
- if (strstr($moduleName, 'Innobyte_') === false) {
126
- continue;
127
- }
128
-
129
- // Detect installed version
130
- $ver = Mage::getConfig()->getModuleConfig($moduleName)->version;
131
- $extensionData = array(
132
- 'version' => $ver,
133
- 'name' => $moduleName,
134
- );
135
- $extensions[] = $extensionData;
136
- }
137
-
138
- return $extensions;
139
- }
140
-
141
- public function getDisabledModules()
142
- {
143
- $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
144
- $dispatchResult = new Varien_Object($modules);
145
- $modules = $dispatchResult->toArray();
146
-
147
- sort($modules);
148
- $disabledModules = array();
149
- foreach ($modules as $moduleName) {
150
- $path = 'advanced/modules_disable_output/'.$moduleName;
151
- if (Mage::getStoreConfig($path)) {
152
- $disabledModules[] = $moduleName;
153
- }
154
- }
155
-
156
- return $disabledModules;
157
- }
158
-
159
- public function getRewrites()
160
- {
161
- $folders = array('app/code/local/', 'app/code/community/');
162
- $configFiles = array();
163
- foreach ($folders as $folder){
164
- $files = glob($folder.'*/*/etc/config.xml');
165
- $configFiles = array_merge($configFiles, $files);
166
- }
167
- $rewrites = array();
168
-
169
- foreach ($configFiles as $file){
170
- $dom = new DOMDocument;
171
- $dom->loadXML(file_get_contents($file));
172
- $xpath = new DOMXPath($dom);
173
- $path = '//rewrite/*';
174
- $text = $xpath->query($path);
175
- foreach ($text as $rewriteElement){
176
- //what is overwritten (model, block, helper)
177
- $type = $rewriteElement->parentNode->parentNode->parentNode->tagName;
178
- //module identifier that is being rewritten (core, catalog, sales, ...)
179
- $parent = $rewriteElement->parentNode->parentNode->tagName;
180
- //element that is rewritten (layout, product, category, order)
181
- $name = $rewriteElement->tagName;
182
- foreach ($rewriteElement->childNodes as $element){
183
- $rewrites[$type][$parent.'/'.$name][] = $element->textContent;//class that rewrites it
184
- }
185
- }
186
- }
187
- return $rewrites;
188
- }
189
-
190
- public function getCrons()
191
- {
192
- $results = array();
193
- $jobs = (array)Mage::getConfig()->getNode('crontab/jobs');
194
- $collection = Mage::getResourceModel('cron/schedule_collection');
195
- foreach ($collection as $item) {
196
- $job = $jobs[$item['job_code']];
197
- $results[$item['job_code']]['info'] = array (
198
- 'cron_expr' => $job->schedule->cron_expr,
199
- 'model' => $job->run->model
200
- );
201
- $results[$item['job_code']]['schedule'] = array(
202
- 'messages' => $item['messages'],
203
- 'created_at' => $item['created_at'],
204
- 'scheduled_at' => $item['scheduled_at'],
205
- 'executed_at' => $item['executed_at'],
206
- 'finished_at' => $item['finished_at'],
207
- 'status' => $item['status'],
208
- );
209
- }
210
-
211
- return $results;
212
- }
213
-
214
- public function getCrontabInfo()
215
- {
216
- $result = array();
217
- if(function_exists('exec')) {
218
- exec('crontab -l', $result);
219
- $user = array();
220
- exec('whoami', $user);
221
- if (!isset($user[0])) {
222
- $user[0] = '';
223
- }
224
- if(!count($result)) {
225
- $result[] = 'No cron jobs found in crontab - for web server user "'.$user[0].'"... maybe is added on other user';
226
- }
227
- } else {
228
- $result[] = 'EXEC is disabled so we cannot see if Magento cron is active';
229
- }
230
- return $result;
231
- }
232
-
233
- public function getConfigInnoData()
234
- {
235
- $collection = Mage::getModel('core/config_data')->getCollection()
236
- ->addFieldToFilter('path', array('like' => '%innobyte%'))
237
- ->load();
238
- $results = array();
239
- foreach($collection as $item){
240
- $results[$item->getConfigId()] = array(
241
- 'path' => $item->getPath(),
242
- 'value' => $item->getValue(),
243
- );
244
- }
245
-
246
- return $results;
247
- }
248
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Model/Feed.php DELETED
@@ -1,249 +0,0 @@
1
- <?php
2
- /**
3
- * AdminNotification Feed model
4
- *
5
- * @category Innobyte
6
- * @package Innobyte_Core
7
- * @author Daniel Horobeanu <daniel.horobeanu@innobyte.com>
8
- */
9
- class Innobyte_Core_Model_Feed extends Mage_AdminNotification_Model_Feed
10
- {
11
- const XML_USE_HTTPS_PATH = 'innobyte_core/adminnotification/use_https';
12
- const XML_FEED_URL_PATH = 'innobyte_core/adminnotification/url';
13
- const XML_FREQUENCY_PATH = 'innobyte_core/adminnotification/frequency';
14
- const XML_LAST_UPDATE_PATH = 'innobyte_core/adminnotification/last_update';
15
-
16
- /**
17
- * Get news from Innobyte Magento blog posts feed
18
- *
19
- * @return Mage_AdminNotification_Model_Feed
20
- */
21
- public function news()
22
- {
23
- if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
24
- return $this;
25
- }
26
- $feedData = array();
27
- $feedXml = $this->getFeedData();
28
- if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
29
- foreach ($feedXml->channel->item as $item) {
30
- $feedData[] = array(
31
- 'severity' => (int)$item->severity?(int)$item->severity:Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE,
32
- 'date_added' => $this->getDate((string)$item->pubDate),
33
- 'title' => (string)$item->title,
34
- 'description' => (string)$item->description,
35
- 'url' => (string)$item->link,
36
- );
37
- }
38
- if ($feedData) {
39
- Mage::getModel('adminnotification/inbox')
40
- ->parse(array_reverse($feedData));
41
- }
42
- }
43
- $this->setLastUpdate();
44
-
45
- return $this;
46
- }
47
-
48
-
49
- public function checkExtensions()
50
- {
51
- $passedTime = time() - Mage::app()->loadCache('innobytecore_extensions_lastcheck');
52
- if (!(Mage::app()->loadCache('innobytecore_extensions_feed'))
53
- || $passedTime > Mage::getStoreConfig(self::XML_FREQUENCY_PATH)) {
54
- $this->refreshExtensions();
55
- }
56
- }
57
-
58
- public function refreshExtensions()
59
- {
60
- $exts = array();
61
- try {
62
- $node = $this->getFeedData(Innobyte_Core_Helper_Config::EXTENSIONS_FEED_URL);
63
- if (!$node){
64
- return false;
65
- }
66
- foreach ($node->children() as $ext) {
67
- $exts[(string)$ext->name] = array(
68
- 'display_name' => (string)$ext->display_name,
69
- 'version' => (string)$ext->version,
70
- 'url' => (string)$ext->url
71
- );
72
- }
73
-
74
- Mage::app()->saveCache(serialize($exts), 'innobytecore_extensions_feed');
75
- Mage::app()->saveCache(time(), 'innobytecore_extensions_lastcheck');
76
- return true;
77
- } catch (Exception $e) {
78
- return false;
79
- }
80
- }
81
-
82
-
83
- public function checkUpdates()
84
- {
85
- $passedTime = time() - Mage::app()->loadCache('innobytecore_updates_lastcheck');
86
- if ($passedTime > Mage::getStoreConfig(self::XML_FREQUENCY_PATH)) {
87
- $this->refreshUpdates();
88
- }
89
- }
90
-
91
- public function refreshUpdates()
92
- {
93
- $feedData = array();
94
- try {
95
- $node = $this->getFeedData(Innobyte_Core_Helper_Config::UPDATES_FEED_URL);
96
- if (!$node) {
97
- return false;
98
- }
99
- foreach ($node->children() as $item) {
100
- if ($this->isInteresting($item)) {
101
- $date = strtotime((string)$item->date);
102
- if (!Mage::getStoreConfig('innobyte_core/install/run')
103
- || (Mage::getStoreConfig('innobyte_core/install/run') < $date)
104
- ) {
105
- $feedData[] = array(
106
- 'severity' => (int)$item->severity?(int)$item->severity:Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE,
107
- 'date_added' => $this->getDate((string)$item->date),
108
- 'title' => (string)$item->title,
109
- 'description' => (string)$item->content,
110
- 'url' => (string)$item->url,
111
- );
112
- }
113
- }
114
- }
115
-
116
- $adminnotificationModel = Mage::getModel('adminnotification/inbox');
117
- if ($feedData && is_object($adminnotificationModel)) {
118
- $adminnotificationModel->parse($feedData);
119
- }
120
-
121
- Mage::app()->saveCache(time(), 'innobytecore_updates_lastcheck');
122
- return true;
123
- } catch (Exception $e) {
124
- return false;
125
- }
126
- }
127
-
128
- public function isInteresting($item)
129
- {
130
- $interests = @explode(',', Mage::getStoreConfig('innobyte_core/adminnotification/feeds'));
131
-
132
- $types = @explode(",", (string)$item->type);
133
- $exts = @explode(",", (string)$item->extensions);
134
-
135
- foreach($types as $type){
136
- if(array_search($type, $interests) !== false){
137
- return true;
138
- }
139
- if($type == Innobyte_Core_Model_Source_Feed_Type::TYPE_RELEASE){
140
- foreach($exts as $ext){
141
- if ($this->isExtensionInstalled($ext)) {
142
- return true;
143
- }
144
- }
145
- }
146
- }
147
- return false;
148
- }
149
-
150
- public function isExtensionInstalled($code)
151
- {
152
- $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
153
-
154
- foreach ($modules as $moduleName) {
155
- if ($moduleName == $code) {
156
- return true;
157
- }
158
- }
159
- return false;
160
- }
161
-
162
- /**
163
- * Retrieve DB date from RSS date
164
- *
165
- * @param string $rssDate
166
- * @return string YYYY-MM-DD YY:HH:SS
167
- */
168
- public function getDate($rssDate)
169
- {
170
- return gmdate('Y-m-d H:i:s', strtotime($rssDate));
171
- }
172
-
173
- /**
174
- * Retrieve Update Frequency
175
- *
176
- * @return int
177
- */
178
- public function getFrequency()
179
- {
180
- return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
181
- }
182
-
183
- public function getLastUpdate()
184
- {
185
- return Mage::app()->loadCache('innobytecore_notifications_lastcheck');
186
- }
187
-
188
- public function setLastUpdate()
189
- {
190
- Mage::app()->saveCache(time(), 'innobytecore_notifications_lastcheck');
191
-
192
- return $this;
193
- }
194
-
195
- /**
196
- * Retrieve feed data as XML element
197
- *
198
- * @return SimpleXMLElement
199
- */
200
- public function getFeedData($url = null)
201
- {
202
- if (!$url){
203
- $url = $this->getFeedUrl();
204
- }
205
- $curl = new Varien_Http_Adapter_Curl();
206
- $curl->setConfig(array(
207
- 'timeout' => 2
208
- ));
209
- $curl->write(Zend_Http_Client::GET, $url, '1.0');
210
- $data = $curl->read();
211
-
212
- if (Zend_Http_Response::extractCode($data) != 200){
213
- $url = 'www.innobyte.com/blog/category/magento/feed/';
214
- $curl->write(Zend_Http_Client::GET, $url, '1.0');
215
- $data = $curl->read();
216
- }
217
-
218
- if (Zend_Http_Response::extractCode($data) != 200){
219
- return false;
220
- }
221
- if ($data === false) {
222
- return false;
223
- }
224
- $data = preg_split('/^\r?$/m', $data, 2);
225
- $data = trim($data[1]);
226
- $curl->close();
227
-
228
- try {
229
- libxml_use_internal_errors(true);
230
- $xml = new SimpleXMLElement($data);
231
- } catch (Exception $e) {
232
- return false;
233
- }
234
-
235
- return $xml;
236
- }
237
-
238
- public function getFeedUrl()
239
- {
240
- if (is_null($this->_feedUrl)) {
241
- $prot = 'http://';
242
- if (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH)) {
243
- $prot = 'https://';
244
- }
245
- $this->_feedUrl = $prot.Mage::getStoreConfig(self::XML_FEED_URL_PATH);
246
- }
247
- return $this->_feedUrl;
248
- }
249
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Model/Source/Config/Enabledisable.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class Innobyte_Core_Model_Source_Config_Enabledisable {
4
-
5
- /**
6
- * Options getter
7
- *
8
- * @return int
9
- */
10
- public function toOptionArray()
11
- {
12
- $options = array(
13
- array(
14
- 'value' => 0,
15
- 'label' => Mage::helper('innobyte_core')->__('No')),
16
- );
17
-
18
- $ext = Mage::registry('inno-');
19
- if ($ext) {
20
- $websites = Mage::helper('innobyte_core/versions')->getAvailabelsWebsites($ext);
21
- }
22
- if (empty($websites)) {
23
- $options[] = array(
24
- 'value' => 1,
25
- 'label' => Mage::helper('innobyte_core')->__('Yes')
26
- );
27
- }
28
-
29
- return $options;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/Model/Source/Feed/Type.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- class Innobyte_Core_Model_Source_Feed_Type
3
- extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
- {
5
-
6
- const TYPE_INFO = 'info'; // Innobyte info
7
- const TYPE_PROMO = 'promo'; // Promotions/Discounts
8
- const TYPE_RELEASE = 'release'; // New Releases
9
- const TYPE_UPDATE = 'update'; // Extensions updates
10
-
11
-
12
- public function toOptionArray()
13
- {
14
- return array(
15
- array(
16
- 'value' => self::TYPE_UPDATE,
17
- 'label' => Mage::helper('innobyte_core')->__('Extensions updates')),
18
- array(
19
- 'value' => self::TYPE_RELEASE,
20
- 'label' => Mage::helper('innobyte_core')->__('New Releases')),
21
- array(
22
- 'value' => self::TYPE_PROMO,
23
- 'label' => Mage::helper('innobyte_core')->__('Promotions/Discounts')),
24
- array(
25
- 'value' => self::TYPE_INFO,
26
- 'label' => Mage::helper('innobyte_core')->__('Other information'))
27
- );
28
- }
29
-
30
- /**
31
- * Retrive all attribute options
32
- *
33
- * @return array
34
- */
35
- public function getAllOptions()
36
- {
37
- return $this->toOptionArray();
38
- }
39
-
40
-
41
- /**
42
- * Returns label for value
43
- *
44
- * @param string $value
45
- * @return string
46
- */
47
- public function getLabel($value)
48
- {
49
- $options = $this->toOptionArray();
50
- foreach ($options as $v) {
51
- if ($v['value'] == $value) {
52
- return $v['label'];
53
- }
54
- }
55
- return '';
56
- }
57
-
58
- /**
59
- * Returns array ready for use by grid
60
- *
61
- * @return array
62
- */
63
- public function getGridOptions()
64
- {
65
- $items = $this->getAllOptions();
66
- $out = array();
67
- foreach ($items as $item) {
68
- $out[$item['value']] = $item['label'];
69
- }
70
- return $out;
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/controllers/Adminhtml/IndexController.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Adminhtml Core IndexController.
5
- *
6
- * @category Innobyte
7
- * @package Innobyte_Core
8
- * @author Daniel Horobeanu <daniel.horobeanu@innobyte.com>
9
- *
10
- */
11
- class Innobyte_Core_Adminhtml_IndexController
12
- extends Mage_Adminhtml_Controller_Action
13
- {
14
-
15
- /**
16
- * Send report
17
- */
18
- public function innoCoreSendReportAction()
19
- {
20
- $result['code'] = 'success';
21
- $result['message'] = 'Report was successfully sent.';
22
- try {
23
- $message = $this->getRequest()->getPost('message', 'No message');
24
- $model = Mage::getModel('innobyte_core/debug');
25
- $model->sendEmail($message);
26
- } catch (Exception $e) {
27
- $result['code'] = 'error';
28
- $result['message'] = $e->getMessage();
29
- }
30
-
31
- Mage::app()->getResponse()->setBody(json_encode($result));
32
- }
33
-
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/etc/config.xml DELETED
@@ -1,135 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Innobyte_Core>
5
- <version>0.0.1</version>
6
- </Innobyte_Core>
7
- </modules>
8
- <global>
9
- <models>
10
- <innobyte_core>
11
- <class>Innobyte_Core_Model</class>
12
- </innobyte_core>
13
- </models>
14
- <helpers>
15
- <innobyte_core>
16
- <class>Innobyte_Core_Helper</class>
17
- </innobyte_core>
18
- </helpers>
19
- <blocks>
20
- <innobyte_core>
21
- <class>Innobyte_Core_Block</class>
22
- </innobyte_core>
23
- </blocks>
24
- <template>
25
- <email>
26
- <innobyte_core_debugger_email_template translate="label" module="innobyte_core">
27
- <label>Innobyte Core - Debug</label>
28
- <file>innobyte/core/debug.html</file>
29
- <type>html</type>
30
- </innobyte_core_debugger_email_template>
31
- </email>
32
- </template>
33
- </global>
34
- <default>
35
- <innobyte_core>
36
- <adminnotification>
37
- <url>www.innobyte.com/category/magento/feed/</url>
38
- <use_https>0</use_https>
39
- <frequency>86400</frequency>
40
- <enabled>1</enabled>
41
- <feeds>info,promo,update,release</feeds>
42
- </adminnotification>
43
- <debugger>
44
- <email>shop@innobyte.com</email>
45
- <explanation_message>No message</explanation_message>
46
- </debugger>
47
- </innobyte_core>
48
- </default>
49
- <admin>
50
- <routers>
51
- <adminhtml>
52
- <args>
53
- <modules>
54
- <innobyte_core after="Mage_Adminhtml">Innobyte_Core</innobyte_core>
55
- </modules>
56
- </args>
57
- </adminhtml>
58
- </routers>
59
- </admin>
60
- <adminhtml>
61
- <layout>
62
- <updates>
63
- <innobyte_core module="Innobyte_Core">
64
- <file>innobyte/core.xml</file>
65
- </innobyte_core>
66
- </updates>
67
- </layout>
68
-
69
- <acl>
70
- <resources>
71
- <all>
72
- <title>Allow Everything</title>
73
- </all>
74
- <admin>
75
- <children>
76
- <system>
77
- <children>
78
- <config>
79
- <children>
80
- <innobyte_core>
81
- <title>Innobyte - All</title>
82
- </innobyte_core>
83
- <innobyte_shop>
84
- <title>Innobyte - Shop</title>
85
- </innobyte_shop>
86
- </children>
87
- </config>
88
- </children>
89
- </system>
90
- </children>
91
- </admin>
92
- </resources>
93
- </acl>
94
- <events>
95
- <controller_action_predispatch>
96
- <observers>
97
- <innobyte_core_feed>
98
- <type>singleton</type>
99
- <class>innobyte_core/feed</class>
100
- <method>news</method>
101
- </innobyte_core_feed>
102
- <innobyte_core_updates>
103
- <type>singleton</type>
104
- <class>innobyte_core/feed</class>
105
- <method>checkUpdates</method>
106
- </innobyte_core_updates>
107
- <innobyte_core_extensions>
108
- <type>singleton</type>
109
- <class>innobyte_core/feed</class>
110
- <method>checkExtensions</method>
111
- </innobyte_core_extensions>
112
- </observers>
113
- </controller_action_predispatch>
114
-
115
- <admin_system_config_section_save_after>
116
- <observers>
117
- <innobyte_core_install>
118
- <type>model</type>
119
- <class>innobyte_core/data</class>
120
- <method>install</method>
121
- </innobyte_core_install>
122
- </observers>
123
- </admin_system_config_section_save_after>
124
- <model_config_data_save_before>
125
- <observers>
126
- <innobyte_core_init_setup>
127
- <type>model</type>
128
- <class>innobyte_core/data</class>
129
- <method>init</method>
130
- </innobyte_core_init_setup>
131
- </observers>
132
- </model_config_data_save_before>
133
- </events>
134
- </adminhtml>
135
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/Core/etc/system.xml DELETED
@@ -1,145 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <innobyte_core translate="label" module="innobyte_core">
5
- <label>Innobyte Extensions</label>
6
- <sort_order>1</sort_order>
7
- </innobyte_core>
8
- </tabs>
9
- <sections>
10
- <innobyte_core translate="label" module="innobyte_core">
11
- <label>Info</label>
12
- <tab>innobyte_core</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>99999</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <extensions translate="label">
20
- <label>Installed Innobyte Extensions</label>
21
- <frontend_type>text</frontend_type>
22
- <frontend_model>innobyte_core/system_config_form_fieldset_extensions</frontend_model>
23
- <sort_order>2</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>1</show_in_store>
27
- </extensions>
28
- <adminnotification>
29
- <label>Innobyte Notifications</label>
30
- <frontend_type>text</frontend_type>
31
- <sort_order>60</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- <fields>
36
- <feeds translate="label">
37
- <label>I'd like to be informed about:</label>
38
- <comment></comment>
39
- <frontend_type>multiselect</frontend_type>
40
- <sort_order>100</sort_order>
41
- <show_in_default>1</show_in_default>
42
- <show_in_website>1</show_in_website>
43
- <show_in_store>1</show_in_store>
44
- <can_be_empty>1</can_be_empty>
45
- <source_model>innobyte_core/source_feed_type</source_model>
46
- </feeds>
47
-
48
- </fields>
49
- </adminnotification>
50
- <debugger>
51
- <label>Debugger / Contact Us</label>
52
- <frontend_type>text</frontend_type>
53
- <sort_order>70</sort_order>
54
- <show_in_default>1</show_in_default>
55
- <show_in_website>1</show_in_website>
56
- <show_in_store>1</show_in_store>
57
- <fields>
58
- <email translate="label">
59
- <label>Send Debug Info to</label>
60
- <comment><![CDATA[
61
- email address that will receive the debug report. You have to "Save Config" first then "Send email".
62
- ]]>
63
- </comment>
64
- <frontend_type>text</frontend_type>
65
- <sort_order>100</sort_order>
66
- <show_in_default>1</show_in_default>
67
- <show_in_website>0</show_in_website>
68
- <show_in_store>0</show_in_store>
69
- <can_be_empty>1</can_be_empty>
70
- <source_model>innobyte_core/source_feed_type</source_model>
71
- </email>
72
-
73
- <email_template translate="label">
74
- <label>Email Template</label>
75
- <frontend_type>select</frontend_type>
76
- <source_model>adminhtml/system_config_source_email_template</source_model>
77
- <sort_order>110</sort_order>
78
- <show_in_default>1</show_in_default>
79
- <show_in_website>0</show_in_website>
80
- <show_in_store>0</show_in_store>
81
- <comment>
82
- <![CDATA[
83
- if you create and select a custom email template (not recommended). You have to "Save Config" first then "Send email".
84
- ]]>
85
- </comment>
86
- </email_template>
87
-
88
- <explanation_message translate="label">
89
- <label>Message</label>
90
- <frontend_type>textarea</frontend_type>
91
- <sort_order>120</sort_order>
92
- <show_in_default>1</show_in_default>
93
- <show_in_website>0</show_in_website>
94
- <show_in_store>0</show_in_store>
95
- <comment>
96
- <![CDATA[
97
- this message will help us better understand your problem.
98
- ]]>
99
- </comment>
100
- </explanation_message>
101
-
102
- <send_now translate="label comment">
103
- <label></label>
104
- <frontend_type>button</frontend_type>
105
- <frontend_model>innobyte_core/system_config_button</frontend_model>
106
- <sort_order>140</sort_order>
107
- <show_in_default>1</show_in_default>
108
- <show_in_website>0</show_in_website>
109
- <show_in_store>0</show_in_store>
110
- <comment>
111
- <![CDATA[
112
- it will instantly send a troubleshooter report to the above email address.
113
- The email contains information regarding your Magento edition, version, rewrites, cron jobs,
114
- PHP information, Innobyte extensions configuration data and all the log files found in Magento log folder.
115
- ]]>
116
- </comment>
117
- </send_now>
118
-
119
- </fields>
120
- </debugger>
121
- </groups>
122
- </innobyte_core>
123
- <innobyte_shop>
124
- <label>Shop</label>
125
- <tab>innobyte_core</tab>
126
- <class>innobyte-shop</class>
127
- <frontend_type>text</frontend_type>
128
- <sort_order>9999</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>1</show_in_store>
132
- <groups>
133
- <extensions translate="label">
134
- <label>Innobyte Extensions Shop</label>
135
- <frontend_type>text</frontend_type>
136
- <frontend_model>innobyte_core/system_config_form_fieldset_shop</frontend_model>
137
- <sort_order>2</sort_order>
138
- <show_in_default>1</show_in_default>
139
- <show_in_website>1</show_in_website>
140
- <show_in_store>1</show_in_store>
141
- </extensions>
142
- </groups>
143
- </innobyte_shop>
144
- </sections>
145
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Catalog/Product/Edit/Tab/EmagMarketplace.php CHANGED
@@ -11,6 +11,7 @@ class Innobyte_EmagMarketplace_Block_Adminhtml_Catalog_Product_Edit_Tab_EmagMark
11
  extends Mage_Adminhtml_Block_Widget_Form
12
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
13
  {
 
14
  /**
15
  * Current store scope.
16
  *
@@ -176,7 +177,17 @@ class Innobyte_EmagMarketplace_Block_Adminhtml_Catalog_Product_Edit_Tab_EmagMark
176
  && ($descElem = $form->getElement('description'))) {
177
  $descElem->setValue($this->getMageProduct()->getDescription());
178
  }
179
-
 
 
 
 
 
 
 
 
 
 
180
  $this->setForm($form);
181
 
182
  $this->setChild(
@@ -566,6 +577,37 @@ class Innobyte_EmagMarketplace_Block_Adminhtml_Catalog_Product_Edit_Tab_EmagMark
566
  //]]>
567
  </script>'
568
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
 
570
  $optVat = Mage::getSingleton('innobyte_emag_marketplace/source_vat')
571
  ->toOptionArray($this->_storeId);
@@ -755,4 +797,5 @@ class Innobyte_EmagMarketplace_Block_Adminhtml_Catalog_Product_Edit_Tab_EmagMark
755
  }
756
  return false;
757
  }
 
758
  }
11
  extends Mage_Adminhtml_Block_Widget_Form
12
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
13
  {
14
+
15
  /**
16
  * Current store scope.
17
  *
177
  && ($descElem = $form->getElement('description'))) {
178
  $descElem->setValue($this->getMageProduct()->getDescription());
179
  }
180
+
181
+ $priceElem = $form->getElement('price');
182
+ if (!is_null($this->getEmagProduct()->getPrice())) {
183
+ $priceElem->setValue(number_format($this->getEmagProduct()->getPrice(), 2));
184
+ }
185
+
186
+ $specialPriceElem = $form->getElement('special_price');
187
+ if (!is_null($this->getEmagProduct()->getSpecialPrice())) {
188
+ $specialPriceElem->setValue(number_format($this->getEmagProduct()->getSpecialPrice(), 2));
189
+ }
190
+
191
  $this->setForm($form);
192
 
193
  $this->setChild(
577
  //]]>
578
  </script>'
579
  );
580
+
581
+
582
+ $fieldset->addField(
583
+ 'price',
584
+ 'text',
585
+ array(
586
+ 'label' => $this->__('Price') . ':',
587
+ 'title' => $this->__('Price'),
588
+ 'name' => 'price',
589
+ 'required' => false,
590
+ 'note' => $this->__(
591
+ 'eMAG Marketplace sell price. Leave blank to use default Magento Price. <br /> <strong>Note</strong>: <span style="color: red">VAT is calculated based on <a href="%s">Tax->Calculation Settings->Catalog Prices</a>.</span>',
592
+ $this->getUrl('adminhtml/system_config/edit/section/tax')
593
+ ),
594
+ )
595
+ );
596
+
597
+ $fieldset->addField(
598
+ 'special_price',
599
+ 'text',
600
+ array(
601
+ 'label' => $this->__('Special Price') . ':',
602
+ 'title' => $this->__('Special Price'),
603
+ 'name' => 'special_price',
604
+ 'required' => false,
605
+ 'note' => $this->__(
606
+ 'eMAG Marketplace special price. Leave blank to use default Magento Special Price. <br /> <strong>Note</strong>: <span style="color: red">VAT is calculated based on <a href="%s">Tax->Calculation Settings->Catalog Prices</a>.</span>',
607
+ $this->getUrl('adminhtml/system_config/edit/section/tax')
608
+ ),
609
+ )
610
+ );
611
 
612
  $optVat = Mage::getSingleton('innobyte_emag_marketplace/source_vat')
613
  ->toOptionArray($this->_storeId);
797
  }
798
  return false;
799
  }
800
+
801
  }
app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Sales/Order/Grid/Column/Filter.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Innobyte_EmagMarketplace_Block_Adminhtml_Sales_Order_Grid_Column_Filter
5
+ *
6
+ * @category Innobyte
7
+ * @package Innobyte_EmagMarketplace
8
+ *
9
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
10
+ */
11
+ class Innobyte_EmagMarketplace_Block_Adminhtml_Sales_Order_Grid_Column_Filter
12
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text
13
+ {
14
+
15
+ /**
16
+ * Column filter
17
+ *
18
+ * @return string
19
+ */
20
+ public function getHtml()
21
+ {
22
+ return parent::getHtml();
23
+ }
24
+
25
+ }
app/code/local/Innobyte/EmagMarketplace/Block/Adminhtml/Sales/Order/Grid/Column/Renderer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Innobyte_EmagMarketplace_Block_Adminhtml_Sales_Order_Grid_Column_Renderer
5
+ *
6
+ * @category Innobyte
7
+ * @package Innobyte_EmagMarketplace
8
+ *
9
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
10
+ */
11
+ class Innobyte_EmagMarketplace_Block_Adminhtml_Sales_Order_Grid_Column_Renderer
12
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+
15
+ /**
16
+ * Render column
17
+ *
18
+ * @param Varien_Object $row
19
+ * @return mixed|string
20
+ */
21
+ public function render(Varien_Object $row)
22
+ {
23
+ return $this->_getValue($row);
24
+ }
25
+
26
+ }
app/code/local/Innobyte/EmagMarketplace/Helper/Data.php CHANGED
@@ -17,6 +17,8 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
17
  const CONFIG_PATH = 'Innobyte_EmagMarketplace/';
18
  const CONFIG_PATH_GENERAL_SETTINGS = 'general_settings/';
19
  const CONFIG_PATH_API_SETTINGS = 'api_settings/';
 
 
20
  const CONFIG_PATH_SHIP_ORIGIN_EMAG_LOCALITY_ID = 'shipping/origin/emag_locality_id';
21
  const CONFIG_PATH_COURIER_ACCOUNT_ID = 'Innobyte_EmagMarketplace/shipping_settings/courier_account_id';
22
  const CONFIG_PATH_AWB_PDF_URL = 'Innobyte_EmagMarketplace/shipping_settings/awb_pdf_url';
@@ -53,7 +55,29 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
53
  */
54
  public function isDebug($storeId = null)
55
  {
56
- return (bool)$this->getConfig(self::CONFIG_PATH_GENERAL_SETTINGS . 'debug', $storeId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
@@ -132,7 +156,7 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
132
  */
133
  public function getApiPassword($storeId = null)
134
  {
135
- return (string) $this->getConfig(self::CONFIG_PATH_API_SETTINGS . 'password', $storeId);
136
  }
137
 
138
  /**
@@ -146,6 +170,17 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
146
  return (string)$this->getConfig(self::CONFIG_PATH_API_SETTINGS . 'code', $storeId);
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
 
149
  /**
150
  * Get formatted voucher label
151
  *
@@ -207,8 +242,7 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
207
  return $returnValue;
208
  }
209
 
210
-
211
-
212
  /**
213
  * Retrieve current store scope.
214
  *
@@ -217,18 +251,22 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
217
  public function getCurrStoreId()
218
  {
219
  $returnValue = Mage::app()->getStore()->getId();
220
- $store = Mage::app()->getRequest()->getParam('store');
221
- if ($store && Mage::app()->getStore($store)->getStoreId()) {
222
- $returnValue = Mage::app()->getStore($store)->getStoreId();
 
 
 
 
223
  }
 
224
  return $returnValue;
225
  }
226
 
227
-
228
-
229
  /**
230
  * Perform different checks to see if product action is eligible to continue.
231
- *
232
  * @param Mage_Catalog_Model_Product $product
233
  * @return bool
234
  */
@@ -241,12 +279,11 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
241
  && ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
242
  || $product->isConfigurable()));
243
  }
244
-
245
-
246
-
247
  /**
248
  * Checks api settings to be configured and extension to be enabled.
249
- *
250
  * @param int|Mage_Core_Model_Store $storeId
251
  * @return bool
252
  */
@@ -258,9 +295,8 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
258
  && strlen($this->getApiPassword($storeId))
259
  && strlen($this->getClientCode($storeId)));
260
  }
261
-
262
-
263
-
264
  /**
265
  * Check if limited stock flag is enabled to be taken into consideration.
266
  *
@@ -271,9 +307,8 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
271
  {
272
  return (bool)$this->getConfig(self::CONFIG_PATH_GENERAL_SETTINGS . 'enable_limited_stock', $storeId);
273
  }
274
-
275
-
276
-
277
  /**
278
  * Retrieve qty limit under which product, if "in stock", should be considered as "limited stock".
279
  *
@@ -294,10 +329,10 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
294
  */
295
  public function getShipOriginEmagLocalityId($storeId = null)
296
  {
297
- return (int) Mage::getStoreConfig(self::CONFIG_PATH_SHIP_ORIGIN_EMAG_LOCALITY_ID, $storeId);
298
  }
299
-
300
-
301
  /**
302
  * Check if real stock qty shoud be sent to eMAG.
303
  *
@@ -308,14 +343,13 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
308
  {
309
  return (bool)$this->getConfig(self::CONFIG_PATH_GENERAL_SETTINGS . 'send_stock_qty', $storeId);
310
  }
311
-
312
-
313
-
314
  /**
315
  * Try to retrieve Magento region id based on eMAG region name.
316
- * "Try" means that exact match is searched, otherwise the region with a
317
  * single letter difference, if only one is found.
318
- *
319
  * @param string $regionName
320
  * @param string $countryCode
321
  * @return Mage_Directory_Model_Region|null can be null if no matching was found.
@@ -334,11 +368,11 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
334
  ->load();
335
  if (!$collection->getSize()) {
336
  return null;
337
- }
338
  $shortest = -1; // shortest levenshtein dist found.
339
  $shortestCnt = 1; // how many had the shortest distance.
340
  $closest = null; // the region model that has the shortest distance
341
-
342
  foreach ($collection as $region) {
343
  $regName = $this->getAsciiTranslitVal($region->getName());
344
  if ($regionName == $regName) {
@@ -354,11 +388,11 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
354
  $shortestCnt = 1;
355
  }
356
  // set the closest match, and shortest distance
357
- $closest = $region;
358
  $shortest = $lev;
359
  }
360
  }
361
- }
362
  if (0 == $shortest && $closest->getId() > 0) { // found exact match
363
  return $closest;
364
  } elseif (1 == $shortest && 1 == $shortestCnt && $closest->getId() > 0) {
@@ -371,7 +405,6 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
371
  }
372
 
373
 
374
-
375
  /**
376
  * Retrieve ASCII/TRANSLIT value of a string.
377
  * @param string $string
@@ -389,9 +422,8 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
389
  }
390
  return $returnValue;
391
  }
392
-
393
-
394
-
395
  /**
396
  * Retrieve courier account id.
397
  *
@@ -413,4 +445,29 @@ class Innobyte_EmagMarketplace_Helper_Data extends Mage_Core_Helper_Data
413
  {
414
  return trim(Mage::getStoreConfig(self::CONFIG_PATH_AWB_PDF_URL, $storeId));
415
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  }
17
  const CONFIG_PATH = 'Innobyte_EmagMarketplace/';
18
  const CONFIG_PATH_GENERAL_SETTINGS = 'general_settings/';
19
  const CONFIG_PATH_API_SETTINGS = 'api_settings/';
20
+ const CONFIG_PATH_INVOICE_CREDITMEMO_SETTINGS = 'invoice_creditmemo_settings/';
21
+ const CONFIG_PATH_DEBUG_SETTINGS = 'debug_settings/';
22
  const CONFIG_PATH_SHIP_ORIGIN_EMAG_LOCALITY_ID = 'shipping/origin/emag_locality_id';
23
  const CONFIG_PATH_COURIER_ACCOUNT_ID = 'Innobyte_EmagMarketplace/shipping_settings/courier_account_id';
24
  const CONFIG_PATH_AWB_PDF_URL = 'Innobyte_EmagMarketplace/shipping_settings/awb_pdf_url';
55
  */
56
  public function isDebug($storeId = null)
57
  {
58
+ return (bool)$this->getConfig(self::CONFIG_PATH_DEBUG_SETTINGS . 'enabled', $storeId);
59
+ }
60
+
61
+ /**
62
+ * Check if curl ssl verify is disabled
63
+ *
64
+ * @param null $storeId
65
+ * @return bool
66
+ */
67
+ public function isSslVerifyDisabled($storeId = null)
68
+ {
69
+ return (bool)$this->getConfig(self::CONFIG_PATH_DEBUG_SETTINGS . 'curl_ssl_verify', $storeId);
70
+ }
71
+
72
+ /**
73
+ * Check if curl verbose mode is enabled
74
+ *
75
+ * @param null $storeId
76
+ * @return bool
77
+ */
78
+ public function isVerboseMode($storeId = null)
79
+ {
80
+ return (bool)$this->getConfig(self::CONFIG_PATH_DEBUG_SETTINGS . 'curl_verbose_mode', $storeId);
81
  }
82
 
83
  /**
156
  */
157
  public function getApiPassword($storeId = null)
158
  {
159
+ return (string)$this->getConfig(self::CONFIG_PATH_API_SETTINGS . 'password', $storeId);
160
  }
161
 
162
  /**
170
  return (string)$this->getConfig(self::CONFIG_PATH_API_SETTINGS . 'code', $storeId);
171
  }
172
 
173
+ /**
174
+ * Check if third party invoices should be used
175
+ *
176
+ * @param null $storeId
177
+ * @return bool
178
+ */
179
+ public function useThirdPartyInvoices($storeId = null)
180
+ {
181
+ return (bool)$this->getConfig(self::CONFIG_PATH_INVOICE_CREDITMEMO_SETTINGS . 'use_third_party_invoices', $storeId);
182
+ }
183
+
184
  /**
185
  * Get formatted voucher label
186
  *
242
  return $returnValue;
243
  }
244
 
245
+
 
246
  /**
247
  * Retrieve current store scope.
248
  *
251
  public function getCurrStoreId()
252
  {
253
  $returnValue = Mage::app()->getStore()->getId();
254
+ if (Mage::app()->isSingleStoreMode()) {
255
+ $returnValue = Mage::app()->getStore(true)->getId();
256
+ } else {
257
+ $store = Mage::app()->getRequest()->getParam('store');
258
+ if (($store && $store != 'undefined') && Mage::app()->getStore($store)->getStoreId()) {
259
+ $returnValue = Mage::app()->getStore($store)->getStoreId();
260
+ }
261
  }
262
+
263
  return $returnValue;
264
  }
265
 
266
+
 
267
  /**
268
  * Perform different checks to see if product action is eligible to continue.
269
+ *
270
  * @param Mage_Catalog_Model_Product $product
271
  * @return bool
272
  */
279
  && ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
280
  || $product->isConfigurable()));
281
  }
282
+
283
+
 
284
  /**
285
  * Checks api settings to be configured and extension to be enabled.
286
+ *
287
  * @param int|Mage_Core_Model_Store $storeId
288
  * @return bool
289
  */
295
  && strlen($this->getApiPassword($storeId))
296
  && strlen($this->getClientCode($storeId)));
297
  }
298
+
299
+
 
300
  /**
301
  * Check if limited stock flag is enabled to be taken into consideration.
302
  *
307
  {
308
  return (bool)$this->getConfig(self::CONFIG_PATH_GENERAL_SETTINGS . 'enable_limited_stock', $storeId);
309
  }
310
+
311
+
 
312
  /**
313
  * Retrieve qty limit under which product, if "in stock", should be considered as "limited stock".
314
  *
329
  */
330
  public function getShipOriginEmagLocalityId($storeId = null)
331
  {
332
+ return (int)Mage::getStoreConfig(self::CONFIG_PATH_SHIP_ORIGIN_EMAG_LOCALITY_ID, $storeId);
333
  }
334
+
335
+
336
  /**
337
  * Check if real stock qty shoud be sent to eMAG.
338
  *
343
  {
344
  return (bool)$this->getConfig(self::CONFIG_PATH_GENERAL_SETTINGS . 'send_stock_qty', $storeId);
345
  }
346
+
347
+
 
348
  /**
349
  * Try to retrieve Magento region id based on eMAG region name.
350
+ * "Try" means that exact match is searched, otherwise the region with a
351
  * single letter difference, if only one is found.
352
+ *
353
  * @param string $regionName
354
  * @param string $countryCode
355
  * @return Mage_Directory_Model_Region|null can be null if no matching was found.
368
  ->load();
369
  if (!$collection->getSize()) {
370
  return null;
371
+ }
372
  $shortest = -1; // shortest levenshtein dist found.
373
  $shortestCnt = 1; // how many had the shortest distance.
374
  $closest = null; // the region model that has the shortest distance
375
+
376
  foreach ($collection as $region) {
377
  $regName = $this->getAsciiTranslitVal($region->getName());
378
  if ($regionName == $regName) {
388
  $shortestCnt = 1;
389
  }
390
  // set the closest match, and shortest distance
391
+ $closest = $region;
392
  $shortest = $lev;
393
  }
394
  }
395
+ }
396
  if (0 == $shortest && $closest->getId() > 0) { // found exact match
397
  return $closest;
398
  } elseif (1 == $shortest && 1 == $shortestCnt && $closest->getId() > 0) {
405
  }
406
 
407
 
 
408
  /**
409
  * Retrieve ASCII/TRANSLIT value of a string.
410
  * @param string $string
422
  }
423
  return $returnValue;
424
  }
425
+
426
+
 
427
  /**
428
  * Retrieve courier account id.
429
  *
445
  {
446
  return trim(Mage::getStoreConfig(self::CONFIG_PATH_AWB_PDF_URL, $storeId));
447
  }
448
+
449
+ /**
450
+ * Template conflict fix while eMAG Marketplace module is installed
451
+ *
452
+ * @return string
453
+ */
454
+ public function setTemplate()
455
+ {
456
+ $block = Mage::app()->getLayout()->getBlock('shipment_packaging');
457
+ $template = $block->getTemplate();
458
+
459
+ /** @var $shipment Mage_Sales_Model_Order_Shipment */
460
+ $shipment = Mage::registry('current_shipment');
461
+ $shippingCarrier = $shipment->getOrder()->getShippingCarrier();
462
+
463
+ if ($shippingCarrier && $shippingCarrier->getCarrierCode() == 'innobytefancourier') {
464
+ $template = 'innobyte/fancourier/sales/order/shipment/packaging/popup.phtml';
465
+ } elseif ($shipment->getOrder()->getEmagOrderId()
466
+ && Innobyte_EmagMarketplace_Model_Shipping_Carrier_Emag::EMAG_SHIPPING == $shippingCarrier->getCarrierCode()
467
+ ) {
468
+ $template = 'innobyte/emag_marketplace/sales/order/shipment/packaging/popup.phtml';
469
+ }
470
+
471
+ return $template;
472
+ }
473
  }
app/code/local/Innobyte/EmagMarketplace/Model/Api/Abstract.php CHANGED
@@ -405,8 +405,12 @@ abstract class Innobyte_EmagMarketplace_Model_Api_Abstract
405
  $config = array(
406
  'adapter' => $this->getHelper()->getMakeHttpCallAdapter(),
407
  'timeout' => $this->getHelper()->getMakeHttpCallTimeout(),
 
 
 
 
408
  );
409
-
410
  $webClient = new Zend_Http_Client();
411
  $webClient->setUri($url)
412
  ->setConfig($config)
405
  $config = array(
406
  'adapter' => $this->getHelper()->getMakeHttpCallAdapter(),
407
  'timeout' => $this->getHelper()->getMakeHttpCallTimeout(),
408
+ 'curloptions' => array(
409
+ CURLOPT_SSL_VERIFYPEER => !$this->getHelper()->isSslVerifyDisabled($this->getHelper()->getCurrStoreId()),
410
+ CURLOPT_VERBOSE => $this->getHelper()->isVerboseMode($this->getHelper()->getCurrStoreId())
411
+ )
412
  );
413
+
414
  $webClient = new Zend_Http_Client();
415
  $webClient->setUri($url)
416
  ->setConfig($config)
app/code/local/Innobyte/EmagMarketplace/Model/Api/Product.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Handles product api related operations.
4
  *
@@ -6,7 +7,6 @@
6
  * @package Innobyte_EmagMarketplace
7
  * @author Bogdan Constantinescu <bogdan.constantinescu@innobyte.com>
8
  */
9
-
10
  class Innobyte_EmagMarketplace_Model_Api_Product
11
  extends Innobyte_EmagMarketplace_Model_Api_Abstract
12
  {
@@ -14,7 +14,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
14
  * Product resource name
15
  */
16
  const PRODUCT_RESOURCE_NAME = 'product_offer';
17
-
18
  /**
19
  * Default wharehouse id.
20
  */
@@ -26,16 +26,15 @@ class Innobyte_EmagMarketplace_Model_Api_Product
26
  * @var Innobyte_EmagMarketplace_Model_Product
27
  */
28
  protected $_emagProduct;
29
-
30
  /**
31
  * Flag that indicates that whole product data should be sent.
32
  *
33
  * @var Innobyte_EmagMarketplace_Model_Product
34
  */
35
  protected $_sendProduct = true;
36
-
37
-
38
-
39
  /**
40
  * Read PRODUCT resource
41
  *
@@ -46,8 +45,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
46
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
47
  }
48
 
49
-
50
-
51
  /**
52
  * Save PRODUCT resource
53
  * Set eMAG product previous to call this method with #setEmagProduct()
@@ -68,9 +66,8 @@ class Innobyte_EmagMarketplace_Model_Api_Product
68
  }
69
  return $this->_makeApiCall();
70
  }
71
-
72
-
73
-
74
  /**
75
  * Count PRODUCT resource
76
  *
@@ -81,8 +78,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
81
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
82
  }
83
 
84
-
85
-
86
  /**
87
  * Acknowledge PRODUCT resource
88
  *
@@ -93,8 +89,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
93
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
94
  }
95
 
96
-
97
-
98
  /**
99
  * Get resource name
100
  *
@@ -104,9 +99,8 @@ class Innobyte_EmagMarketplace_Model_Api_Product
104
  {
105
  return self::PRODUCT_RESOURCE_NAME;
106
  }
107
-
108
-
109
-
110
  /**
111
  * Save whole product.
112
  *
@@ -115,12 +109,11 @@ class Innobyte_EmagMarketplace_Model_Api_Product
115
  */
116
  public function saveProduct()
117
  {
118
- $this->_sendProduct = true;
119
- return $this->save();
120
  }
121
-
122
-
123
-
124
  /**
125
  * Save product offer.
126
  *
@@ -129,12 +122,11 @@ class Innobyte_EmagMarketplace_Model_Api_Product
129
  */
130
  public function saveOffer()
131
  {
132
- $this->_sendProduct = false;
133
- return $this->save();
134
  }
135
-
136
-
137
-
138
  /**
139
  * Handle product saving.
140
  *
@@ -144,7 +136,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
144
  public function _getProductSavingData()
145
  {
146
  $returnValue = array();
147
-
148
  // for configurable send all child products
149
  $mageProduct = $this->getEmagProduct()->getMagentoProduct();
150
  if (!is_null($mageProduct) && $mageProduct->isConfigurable()) {
@@ -160,10 +152,11 @@ class Innobyte_EmagMarketplace_Model_Api_Product
160
  )->loadByProdIdAndStore(
161
  $childId,
162
  $this->getEmagProduct()->getStoreId()
163
- );
164
  try {
165
  if ($childEmagProduct->getId()
166
- && $childEmagProduct->getCategoryId() != $this->getEmagProduct()->getCategoryId()) {
 
167
  throw new Innobyte_EmagMarketplace_Exception(
168
  'Associated product \'s category does not match parent configurable product \'s category'
169
  );
@@ -191,18 +184,18 @@ class Innobyte_EmagMarketplace_Model_Api_Product
191
  }
192
  return $returnValue;
193
  }
194
-
195
-
196
  /**
197
  * Handle offer saving.
198
- *
199
  * @return array
200
  * @throws Innobyte_EmagMarketplace_Exception
201
  */
202
  public function _getOfferSavingData()
203
  {
204
  $returnValue = array();
205
-
206
  // for configurable send all child products
207
  $mageProduct = $this->getEmagProduct()->getMagentoProduct();
208
  if (!is_null($mageProduct) && $mageProduct->isConfigurable()) {
@@ -221,12 +214,13 @@ class Innobyte_EmagMarketplace_Model_Api_Product
221
  );
222
  try {
223
  if ($childEmagProduct->getId()
224
- && $childEmagProduct->getCategoryId() != $this->getEmagProduct()->getCategoryId()) {
 
225
  throw new Innobyte_EmagMarketplace_Exception(
226
  'Associated product \'s category does not match parent configurable product \'s category'
227
  );
228
  }
229
-
230
  $returnValue[] = $this->_computeApiOfferData(
231
  $childEmagProduct
232
  );
@@ -249,9 +243,8 @@ class Innobyte_EmagMarketplace_Model_Api_Product
249
  }
250
  return $returnValue;
251
  }
252
-
253
-
254
-
255
  /**
256
  * Compute api data to be sent to api (product description & offer).
257
  *
@@ -278,28 +271,32 @@ class Innobyte_EmagMarketplace_Model_Api_Product
278
  );
279
  }
280
  }
281
-
 
282
  $mageProduct = $emagProduct->getMagentoProduct();
283
  $returnValue = array(
284
- 'id' => (int) $mageProduct->getId(),
285
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  if ($emagProduct->getPartNumberKey()) {
287
  $returnValue['part_number_key'] = $emagProduct->getPartNumberKey();
288
  } else {
289
- if (!$emagProduct->getName()) {
290
- throw new Innobyte_EmagMarketplace_Exception(
291
- 'No eMAG product name.'
292
- );
293
- }
294
- $returnValue['name'] = $emagProduct->getName();
295
- if (!$emagProduct->getBrand()) {
296
- throw new Innobyte_EmagMarketplace_Exception(
297
- 'No eMAG product brand.'
298
- );
299
- }
300
- $returnValue['brand'] = $emagProduct->getBrand();
301
  if (!$emagProduct->getCategoryId()
302
- || !$emagProduct->getCategory()) {
 
303
  throw new Innobyte_EmagMarketplace_Exception(
304
  'No eMAG category id.'
305
  );
@@ -314,7 +311,8 @@ class Innobyte_EmagMarketplace_Model_Api_Product
314
  foreach ($emagProduct->getCategory()->getCharacteristics() as $char) {
315
  $key = 'category_characteristic' . $char->getId();
316
  if (!array_key_exists($key, $emagProduct->getData())
317
- || !strlen($emagProduct->getData($key))) {
 
318
  throw new Innobyte_EmagMarketplace_Exception(
319
  Mage::helper('innobyte_emag_marketplace')->__(
320
  'No category characteristic "%s" value found.',
@@ -322,28 +320,34 @@ class Innobyte_EmagMarketplace_Model_Api_Product
322
  )
323
  );
324
  }
325
- $characteristics[] = array(
326
- 'id' => $char->getEmagId(),
327
- 'value' => strval($emagProduct->getData($key)),
328
- );
 
 
 
 
329
  }
 
330
  $returnValue['characteristics'] = $characteristics;
331
-
332
  if (!is_null($parentProduct)) {
333
  if ($parentProduct->getFamilyTypeId() < 1
334
- || $parentProduct->getFamilyType()->getEmagId() < 1) {
 
335
  throw new Innobyte_EmagMarketplace_Exception(
336
  'No family type found.'
337
  );
338
  }
339
  $returnValue['family'] = array(
340
- 'id' => (int) $parentProduct->getId(),
341
  'name' => $parentProduct->getName(),
342
- 'family_type_id' => (int) $parentProduct->getFamilyType()
343
  ->getEmagId()
344
  );
345
  }
346
-
347
  $returnValue['part_number'] = $mageProduct->getSku();
348
  }
349
  if (!$mageProduct->getProductUrl()) {
@@ -353,16 +357,17 @@ class Innobyte_EmagMarketplace_Model_Api_Product
353
  }
354
  $returnValue['url'] = $mageProduct->getProductUrl();
355
  if ($mageProduct->getWeight()) {
356
- $returnValue['weight'] = (float) $mageProduct->getWeight();
357
  }
358
  if ($emagProduct->getDescription()) {
359
  $returnValue['description'] = $emagProduct->getDescription();
360
  }
361
  if (is_array($emagProduct->getBarcodes())
362
- && count($emagProduct->getBarcodes())) {
 
363
  $returnValue['barcode'] = $emagProduct->getBarcodes();
364
  }
365
-
366
  if (isset($_SERVER['INNO_EMAG_MKTP_LOCAL'])) {
367
  // local / not public server => use hardcoded image
368
  $images = array(
@@ -373,38 +378,37 @@ class Innobyte_EmagMarketplace_Model_Api_Product
373
  );
374
  } else {
375
  $images = array();
 
376
  $imageHelper = Mage::helper('catalog/image');
377
- if ($mageProduct->getImage()
378
- && $mageProduct->getImage() != 'no_selection')
379
- {
380
  $images[] = array(
381
  'display_type' => Innobyte_EmagMarketplace_Model_Product::IMAGE_DISPLAY_TYPE_MAIN,
382
- 'url' => (string) $imageHelper->init($mageProduct, 'image'),
383
  );
384
  }
385
  if (count($mageProduct->getMediaGalleryImages())) {
386
  foreach ($mageProduct->getMediaGalleryImages() as $image) {
 
 
 
 
387
  $images[] = array(
388
  'display_type' => Innobyte_EmagMarketplace_Model_Product::IMAGE_DISPLAY_TYPE_SECONDARY,
389
- 'url' => (string) $imageHelper->init(
390
- $mageProduct,
391
- 'image',
392
- $image->getFile()
393
- ),
394
  );
395
  }
396
  }
397
- }
398
-
399
  if (count($images)) {
400
  $returnValue['images'] = $images;
401
  }
402
-
403
  $returnValue = array_merge(
404
  $returnValue,
405
  $this->_computeApiOfferData($emagProduct)
406
  );
407
-
408
  // dispatch event in case customizations needs to be done by clients
409
  $returnValueObj = new Varien_Object($returnValue);
410
  Mage::dispatchEvent(
@@ -415,12 +419,21 @@ class Innobyte_EmagMarketplace_Model_Api_Product
415
  'offer_data' => $returnValueObj,
416
  )
417
  );
418
-
419
  return $returnValueObj->toArray();
420
  }
421
-
422
-
423
-
 
 
 
 
 
 
 
 
 
424
  /**
425
  * Compute offer api data to be sent to api.
426
  *
@@ -475,9 +488,9 @@ class Innobyte_EmagMarketplace_Model_Api_Product
475
  ),
476
  'warranty' => intval($emagProduct->getWarranty())
477
  );
478
-
479
  $helper = Mage::helper('innobyte_emag_marketplace');
480
-
481
  // attach availability info
482
  $returnValue['availability'] = array(
483
  array('warehouse_id' => self::DEFAULT_WHAREHOUSE_ID)
@@ -486,16 +499,18 @@ class Innobyte_EmagMarketplace_Model_Api_Product
486
  if ($mageProduct->isAvailable()) {
487
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_IN_STOCK;
488
  if ($helper->isLimitedStockEnabled($emagProduct->getStoreId())
489
- && $stockQty <= $helper->getLimitedStockLimit($emagProduct->getStoreId())) {
 
490
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_LIMITED_STOCK;
491
  }
492
  } else {
493
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_OUT_OF_STOCK;
494
  }
495
-
496
  // attach stock info
497
  if ($helper->sendStockQty($emagProduct->getStoreId())
498
- && $stockQty >= 0 && $stockQty < 65535) {
 
499
  $returnValue['stock'] = array(
500
  array(
501
  'warehouse_id' => self::DEFAULT_WHAREHOUSE_ID,
@@ -503,7 +518,7 @@ class Innobyte_EmagMarketplace_Model_Api_Product
503
  ),
504
  );
505
  }
506
-
507
  // attach offer start date
508
  if ($emagProduct->getStartDate()) {
509
  try {
@@ -518,36 +533,73 @@ class Innobyte_EmagMarketplace_Model_Api_Product
518
  }
519
  $now = new Zend_Date(null, Varien_Date::DATE_INTERNAL_FORMAT);
520
  if (!$zendDate->isLater($now)
521
- || !$zendDate->isEarlier($now->addDay(61))) {
 
522
  throw new Innobyte_EmagMarketplace_Exception(
523
  'Offer start date can be as far as 60 days in the future and cannot be earlier than tomorrow.'
524
  );
525
  }
526
  $returnValue['start_date'] = $zendDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
527
  }
528
-
 
529
  // attach prices
 
 
 
530
  $taxHelper = Mage::helper('tax');
531
- $price = $taxHelper->getPrice(
 
 
 
 
 
 
 
 
 
532
  $mageProduct,
533
- $mageProduct->getPrice(),
534
  false
535
  );
536
- $finalPrice = $taxHelper->getPrice(
537
  $mageProduct,
538
- $mageProduct->getFinalPrice(),
539
  false
540
  );
541
- $store = $mageProduct->getStore();
542
- $price = $store->roundPrice($store->convertPrice($price, 0, 0));
543
- $finalPrice = $store->roundPrice($store->convertPrice($finalPrice, 0, 0));
544
- if ($finalPrice < $price) {
545
- $returnValue['sale_price'] = $finalPrice;
546
- $returnValue['recommended_price'] = $price;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  } else {
548
- $returnValue['sale_price'] = $finalPrice;
 
 
 
 
549
  }
550
-
551
  // dispatch event in case customizations needs to be done by clients
552
  $returnValueObj = new Varien_Object($returnValue);
553
  Mage::dispatchEvent(
@@ -557,12 +609,11 @@ class Innobyte_EmagMarketplace_Model_Api_Product
557
  'offer_data' => $returnValueObj,
558
  )
559
  );
560
-
561
  return $returnValueObj->toArray();
562
  }
563
-
564
-
565
-
566
  /**
567
  * Setter method for emag product.
568
  *
@@ -580,9 +631,8 @@ class Innobyte_EmagMarketplace_Model_Api_Product
580
  $this->_emagProduct = $product;
581
  return $this;
582
  }
583
-
584
-
585
-
586
  /**
587
  * Getter method for emag product.
588
  *
1
  <?php
2
+
3
  /**
4
  * Handles product api related operations.
5
  *
7
  * @package Innobyte_EmagMarketplace
8
  * @author Bogdan Constantinescu <bogdan.constantinescu@innobyte.com>
9
  */
 
10
  class Innobyte_EmagMarketplace_Model_Api_Product
11
  extends Innobyte_EmagMarketplace_Model_Api_Abstract
12
  {
14
  * Product resource name
15
  */
16
  const PRODUCT_RESOURCE_NAME = 'product_offer';
17
+
18
  /**
19
  * Default wharehouse id.
20
  */
26
  * @var Innobyte_EmagMarketplace_Model_Product
27
  */
28
  protected $_emagProduct;
29
+
30
  /**
31
  * Flag that indicates that whole product data should be sent.
32
  *
33
  * @var Innobyte_EmagMarketplace_Model_Product
34
  */
35
  protected $_sendProduct = true;
36
+
37
+
 
38
  /**
39
  * Read PRODUCT resource
40
  *
45
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
46
  }
47
 
48
+
 
49
  /**
50
  * Save PRODUCT resource
51
  * Set eMAG product previous to call this method with #setEmagProduct()
66
  }
67
  return $this->_makeApiCall();
68
  }
69
+
70
+
 
71
  /**
72
  * Count PRODUCT resource
73
  *
78
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
79
  }
80
 
81
+
 
82
  /**
83
  * Acknowledge PRODUCT resource
84
  *
89
  throw new Innobyte_EmagMarketplace_Exception('Not implemented');
90
  }
91
 
92
+
 
93
  /**
94
  * Get resource name
95
  *
99
  {
100
  return self::PRODUCT_RESOURCE_NAME;
101
  }
102
+
103
+
 
104
  /**
105
  * Save whole product.
106
  *
109
  */
110
  public function saveProduct()
111
  {
112
+ $this->_sendProduct = true;
113
+ return $this->save();
114
  }
115
+
116
+
 
117
  /**
118
  * Save product offer.
119
  *
122
  */
123
  public function saveOffer()
124
  {
125
+ $this->_sendProduct = false;
126
+ return $this->save();
127
  }
128
+
129
+
 
130
  /**
131
  * Handle product saving.
132
  *
136
  public function _getProductSavingData()
137
  {
138
  $returnValue = array();
139
+
140
  // for configurable send all child products
141
  $mageProduct = $this->getEmagProduct()->getMagentoProduct();
142
  if (!is_null($mageProduct) && $mageProduct->isConfigurable()) {
152
  )->loadByProdIdAndStore(
153
  $childId,
154
  $this->getEmagProduct()->getStoreId()
155
+ );
156
  try {
157
  if ($childEmagProduct->getId()
158
+ && $childEmagProduct->getCategoryId() != $this->getEmagProduct()->getCategoryId()
159
+ ) {
160
  throw new Innobyte_EmagMarketplace_Exception(
161
  'Associated product \'s category does not match parent configurable product \'s category'
162
  );
184
  }
185
  return $returnValue;
186
  }
187
+
188
+
189
  /**
190
  * Handle offer saving.
191
+ *
192
  * @return array
193
  * @throws Innobyte_EmagMarketplace_Exception
194
  */
195
  public function _getOfferSavingData()
196
  {
197
  $returnValue = array();
198
+
199
  // for configurable send all child products
200
  $mageProduct = $this->getEmagProduct()->getMagentoProduct();
201
  if (!is_null($mageProduct) && $mageProduct->isConfigurable()) {
214
  );
215
  try {
216
  if ($childEmagProduct->getId()
217
+ && $childEmagProduct->getCategoryId() != $this->getEmagProduct()->getCategoryId()
218
+ ) {
219
  throw new Innobyte_EmagMarketplace_Exception(
220
  'Associated product \'s category does not match parent configurable product \'s category'
221
  );
222
  }
223
+
224
  $returnValue[] = $this->_computeApiOfferData(
225
  $childEmagProduct
226
  );
243
  }
244
  return $returnValue;
245
  }
246
+
247
+
 
248
  /**
249
  * Compute api data to be sent to api (product description & offer).
250
  *
271
  );
272
  }
273
  }
274
+
275
+ /** @var $mageProduct Mage_Catalog_Model_Product */
276
  $mageProduct = $emagProduct->getMagentoProduct();
277
  $returnValue = array(
278
+ 'id' => (int)$mageProduct->getId(),
279
  );
280
+
281
+ if (!$emagProduct->getName()) {
282
+ throw new Innobyte_EmagMarketplace_Exception(
283
+ 'No eMAG product name.'
284
+ );
285
+ }
286
+ $returnValue['name'] = $emagProduct->getName();
287
+ if (!$emagProduct->getBrand()) {
288
+ throw new Innobyte_EmagMarketplace_Exception(
289
+ 'No eMAG product brand.'
290
+ );
291
+ }
292
+ $returnValue['brand'] = $emagProduct->getBrand();
293
+
294
  if ($emagProduct->getPartNumberKey()) {
295
  $returnValue['part_number_key'] = $emagProduct->getPartNumberKey();
296
  } else {
 
 
 
 
 
 
 
 
 
 
 
 
297
  if (!$emagProduct->getCategoryId()
298
+ || !$emagProduct->getCategory()
299
+ ) {
300
  throw new Innobyte_EmagMarketplace_Exception(
301
  'No eMAG category id.'
302
  );
311
  foreach ($emagProduct->getCategory()->getCharacteristics() as $char) {
312
  $key = 'category_characteristic' . $char->getId();
313
  if (!array_key_exists($key, $emagProduct->getData())
314
+ || !strlen($emagProduct->getData($key))
315
+ ) {
316
  throw new Innobyte_EmagMarketplace_Exception(
317
  Mage::helper('innobyte_emag_marketplace')->__(
318
  'No category characteristic "%s" value found.',
320
  )
321
  );
322
  }
323
+
324
+ $options = explode('|', $emagProduct->getData($key));
325
+ foreach($options as $option) {
326
+ $characteristics[] = array(
327
+ 'id' => $char->getEmagId(),
328
+ 'value' => strval($option),
329
+ );
330
+ }
331
  }
332
+
333
  $returnValue['characteristics'] = $characteristics;
334
+
335
  if (!is_null($parentProduct)) {
336
  if ($parentProduct->getFamilyTypeId() < 1
337
+ || $parentProduct->getFamilyType()->getEmagId() < 1
338
+ ) {
339
  throw new Innobyte_EmagMarketplace_Exception(
340
  'No family type found.'
341
  );
342
  }
343
  $returnValue['family'] = array(
344
+ 'id' => (int)$parentProduct->getId(),
345
  'name' => $parentProduct->getName(),
346
+ 'family_type_id' => (int)$parentProduct->getFamilyType()
347
  ->getEmagId()
348
  );
349
  }
350
+
351
  $returnValue['part_number'] = $mageProduct->getSku();
352
  }
353
  if (!$mageProduct->getProductUrl()) {
357
  }
358
  $returnValue['url'] = $mageProduct->getProductUrl();
359
  if ($mageProduct->getWeight()) {
360
+ $returnValue['weight'] = (float)$mageProduct->getWeight();
361
  }
362
  if ($emagProduct->getDescription()) {
363
  $returnValue['description'] = $emagProduct->getDescription();
364
  }
365
  if (is_array($emagProduct->getBarcodes())
366
+ && count($emagProduct->getBarcodes())
367
+ ) {
368
  $returnValue['barcode'] = $emagProduct->getBarcodes();
369
  }
370
+
371
  if (isset($_SERVER['INNO_EMAG_MKTP_LOCAL'])) {
372
  // local / not public server => use hardcoded image
373
  $images = array(
378
  );
379
  } else {
380
  $images = array();
381
+ /** @var $imageHelper Mage_Catalog_Helper_Image */
382
  $imageHelper = Mage::helper('catalog/image');
383
+ if ($mageProduct->getImage() && $mageProduct->getImage() != 'no_selection') {
 
 
384
  $images[] = array(
385
  'display_type' => Innobyte_EmagMarketplace_Model_Product::IMAGE_DISPLAY_TYPE_MAIN,
386
+ 'url' => (string)$this->_getImagePath($mageProduct->getImage())
387
  );
388
  }
389
  if (count($mageProduct->getMediaGalleryImages())) {
390
  foreach ($mageProduct->getMediaGalleryImages() as $image) {
391
+ // skip images that are identical to main image
392
+ if ($this->_getImagePath($mageProduct->getImage()) == $this->_getImagePath($image->getFile())) {
393
+ continue;
394
+ }
395
  $images[] = array(
396
  'display_type' => Innobyte_EmagMarketplace_Model_Product::IMAGE_DISPLAY_TYPE_SECONDARY,
397
+ 'url' => (string)$this->_getImagePath($image->getFile())
 
 
 
 
398
  );
399
  }
400
  }
401
+ }
402
+
403
  if (count($images)) {
404
  $returnValue['images'] = $images;
405
  }
406
+
407
  $returnValue = array_merge(
408
  $returnValue,
409
  $this->_computeApiOfferData($emagProduct)
410
  );
411
+
412
  // dispatch event in case customizations needs to be done by clients
413
  $returnValueObj = new Varien_Object($returnValue);
414
  Mage::dispatchEvent(
419
  'offer_data' => $returnValueObj,
420
  )
421
  );
422
+
423
  return $returnValueObj->toArray();
424
  }
425
+
426
+ /**
427
+ * Get non-cached image path
428
+ *
429
+ * @param $filename
430
+ * @return string
431
+ */
432
+ protected function _getImagePath($filename)
433
+ {
434
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $filename;
435
+ }
436
+
437
  /**
438
  * Compute offer api data to be sent to api.
439
  *
488
  ),
489
  'warranty' => intval($emagProduct->getWarranty())
490
  );
491
+
492
  $helper = Mage::helper('innobyte_emag_marketplace');
493
+
494
  // attach availability info
495
  $returnValue['availability'] = array(
496
  array('warehouse_id' => self::DEFAULT_WHAREHOUSE_ID)
499
  if ($mageProduct->isAvailable()) {
500
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_IN_STOCK;
501
  if ($helper->isLimitedStockEnabled($emagProduct->getStoreId())
502
+ && $stockQty <= $helper->getLimitedStockLimit($emagProduct->getStoreId())
503
+ ) {
504
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_LIMITED_STOCK;
505
  }
506
  } else {
507
  $returnValue['availability'][0]['id'] = Innobyte_EmagMarketplace_Model_Product::AVAILABILITY_OUT_OF_STOCK;
508
  }
509
+
510
  // attach stock info
511
  if ($helper->sendStockQty($emagProduct->getStoreId())
512
+ && $stockQty >= 0 && $stockQty < 65535
513
+ ) {
514
  $returnValue['stock'] = array(
515
  array(
516
  'warehouse_id' => self::DEFAULT_WHAREHOUSE_ID,
518
  ),
519
  );
520
  }
521
+
522
  // attach offer start date
523
  if ($emagProduct->getStartDate()) {
524
  try {
533
  }
534
  $now = new Zend_Date(null, Varien_Date::DATE_INTERNAL_FORMAT);
535
  if (!$zendDate->isLater($now)
536
+ || !$zendDate->isEarlier($now->addDay(61))
537
+ ) {
538
  throw new Innobyte_EmagMarketplace_Exception(
539
  'Offer start date can be as far as 60 days in the future and cannot be earlier than tomorrow.'
540
  );
541
  }
542
  $returnValue['start_date'] = $zendDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
543
  }
544
+
545
+
546
  // attach prices
547
+ $store = $mageProduct->getStore();
548
+
549
+ /** @var $taxHelper Mage_Tax_Helper_Data */
550
  $taxHelper = Mage::helper('tax');
551
+
552
+ // get magento product price if eMAG price is not available
553
+ if (!is_null($emagProduct->getPrice())) {
554
+ $productPrice = (float)$emagProduct->getPrice();
555
+ $finalPrice = $productPrice;
556
+ } else {
557
+ $productPrice = (float)$mageProduct->getPrice();
558
+ $finalPrice = (float)$mageProduct->getFinalPrice();
559
+ }
560
+ $priceExclTax = $taxHelper->getPrice(
561
  $mageProduct,
562
+ $productPrice,
563
  false
564
  );
565
+ $finalPriceExclTax = $taxHelper->getPrice(
566
  $mageProduct,
567
+ $finalPrice,
568
  false
569
  );
570
+
571
+ // get magento product final price if eMAG special price is not available
572
+ if (!is_null($emagProduct->getSpecialPrice())) {
573
+ $productSpecialPrice = (float)$emagProduct->getSpecialPrice();
574
+ } else {
575
+ // if eMAG price is available force usage of eMAG special price else use magento final price
576
+ if (!is_null($emagProduct->getPrice())) {
577
+ $productSpecialPrice = (float)$emagProduct->getPrice();
578
+ } else {
579
+ $productSpecialPrice = (float)$mageProduct->getFinalPrice();
580
+ }
581
+ }
582
+ $specialPriceExclTax = $taxHelper->getPrice(
583
+ $mageProduct,
584
+ $productSpecialPrice,
585
+ false
586
+ );
587
+
588
+ $recommendedPrice = $store->roundPrice($store->convertPrice($priceExclTax, 0, 0));
589
+ $finalPrice = $store->roundPrice($store->convertPrice($finalPriceExclTax, 0, 0));
590
+ $salePrice = $store->roundPrice($store->convertPrice($specialPriceExclTax, 0, 0));
591
+
592
+ if ($salePrice < $recommendedPrice) {
593
+ $returnValue['sale_price'] = $salePrice;
594
+ $returnValue['recommended_price'] = $recommendedPrice;
595
  } else {
596
+ // if eMAG product price is not available use Magento final price
597
+ if (is_null($emagProduct->getPrice())) {
598
+ $salePrice = $finalPrice;
599
+ }
600
+ $returnValue['sale_price'] = $salePrice;
601
  }
602
+
603
  // dispatch event in case customizations needs to be done by clients
604
  $returnValueObj = new Varien_Object($returnValue);
605
  Mage::dispatchEvent(
609
  'offer_data' => $returnValueObj,
610
  )
611
  );
612
+
613
  return $returnValueObj->toArray();
614
  }
615
+
616
+
 
617
  /**
618
  * Setter method for emag product.
619
  *
631
  $this->_emagProduct = $product;
632
  return $this;
633
  }
634
+
635
+
 
636
  /**
637
  * Getter method for emag product.
638
  *
app/code/local/Innobyte/EmagMarketplace/Model/Catalog/Product/Observer.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Observer that handles product related events.
4
  *
@@ -6,7 +7,6 @@
6
  * @package Innobyte_EmagMarketplace
7
  * @author Bogdan Constantinescu <bogdan.constantinescu@innobyte.com>
8
  */
9
-
10
  class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
11
  {
12
  /**
@@ -15,9 +15,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
15
  * @var Innobyte_EmagMarketplace_Helper_Data
16
  */
17
  protected $_helper;
18
-
19
-
20
-
21
  /**
22
  * Constructor; initializes stuffs.
23
  */
@@ -25,9 +24,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
25
  {
26
  $this->_helper = Mage::helper('innobyte_emag_marketplace');
27
  }
28
-
29
-
30
-
31
  /**
32
  * Getter method for helper property.
33
  *
@@ -37,9 +35,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
37
  {
38
  return $this->_helper;
39
  }
40
-
41
-
42
-
43
  /**
44
  * Saves product emag data.
45
  * Triggered on catalog_product_save_after event.
@@ -54,16 +51,18 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
54
  $product = Mage::getModel('catalog/product')->setStoreId($storeId)
55
  ->load($observer->getEvent()->getProduct()->getId());
56
  if (!$this->_getHelper()->isProductActionValid($product)
57
- || !Mage::app()->getRequest()->isPost()) {
 
58
  return $this;
59
  }
60
-
61
  $data = Mage::app()->getRequest()->getPost('product', array());
62
  if (!array_key_exists('inno_emag_mktp', $data)
63
- || !is_array($data['inno_emag_mktp'])) {
 
64
  return $this;
65
  }
66
-
67
  $emagData = $data['inno_emag_mktp'];
68
  $emagProduct = Mage::getModel('innobyte_emag_marketplace/product')
69
  ->loadByProdIdAndStore($product->getId(), $storeId);
@@ -71,6 +70,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
71
  $this->_checkFilterEmagProductData($emagData, $product);
72
  $emagProduct->addData($emagData)
73
  ->setProductId($product->getId())
 
74
  ->setStoreId($storeId);
75
  // save data also on non-filled associated products if config prod
76
  if ($product->isConfigurable()) {
@@ -86,6 +86,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
86
  $childEmagProduct->addData($emagData)
87
  ->unsFamilyTypeId()
88
  ->setProductId($childId)
 
89
  ->setStoreId($storeId);
90
  $emagProduct->addRelatedObject($childEmagProduct);
91
  }
@@ -100,17 +101,31 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
100
  );
101
  throw $ex;
102
  }
103
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  return $this;
105
  }
106
-
107
-
108
-
109
  /**
110
  * Check / filter emag product form data.
111
  *
112
- * @param array $emagData Product post data.
113
- * @param Mage_Catalog_Model_Product $product Magento product.
114
  * @throws Mage_Core_Exception
115
  */
116
  protected function _checkFilterEmagProductData(
@@ -119,11 +134,11 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
119
  )
120
  {
121
  $storeId = $this->_getHelper()->getCurrStoreId();
122
-
123
  if (is_null($product) || !$product->getId()) {
124
  Mage::throwException($this->_getHelper()->__('Invalid product id.'));
125
  }
126
-
127
  if (array_key_exists('part_number_key', $emagData)) {
128
  $emagData['part_number_key'] = trim($emagData['part_number_key']);
129
  if (empty($emagData['part_number_key'])) {
@@ -132,7 +147,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
132
  } else {
133
  $emagData['part_number_key'] = null;
134
  }
135
-
136
  if (array_key_exists('name', $emagData)) {
137
  $emagData['name'] = trim($emagData['name']);
138
  if (empty($emagData['name'])) {
@@ -146,7 +161,33 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
146
  $this->_getHelper()->__('Please fill eMAG product name.')
147
  );
148
  }
149
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  if (array_key_exists('brand', $emagData)) {
151
  $emagData['brand'] = trim($emagData['brand']);
152
  if (empty($emagData['brand'])) {
@@ -160,7 +201,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
160
  $this->_getHelper()->__('Please fill eMAG product brand.')
161
  );
162
  }
163
-
164
  if (array_key_exists('description', $emagData)) {
165
  $emagData['description'] = trim($emagData['description']);
166
  if (empty($emagData['description'])) {
@@ -169,7 +210,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
169
  } else {
170
  $emagData['description'] = null;
171
  }
172
-
173
  if (array_key_exists('barcodes', $emagData)) {
174
  if (is_array($emagData['barcodes'])) {
175
  $emagData['barcodes'] = array_filter(
@@ -183,7 +224,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
183
  } else {
184
  $emagData['barcodes'] = array();
185
  }
186
-
187
  $categoryId = null;
188
  $emagCategory = Mage::getModel('innobyte_emag_marketplace/category');
189
  if (array_key_exists('category_id', $emagData)) {
@@ -223,12 +264,13 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
223
  $skipChars[] = $ftChar->getMageIdEmagChar();
224
  }
225
  }
226
-
227
  foreach ($emagCategory->getCharacteristics() as $characteristic) {
228
  $charKey = 'category_characteristic' . $characteristic->getId();
229
  if ((!array_key_exists($charKey, $emagData)
230
- || !strlen(trim($emagData[$charKey])))
231
- && !in_array($characteristic->getId(), $skipChars)) {
 
232
  Mage::throwException(
233
  $this->_getHelper()->__(
234
  'No category characteristic "%s" value found.',
@@ -242,18 +284,19 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
242
  }
243
  }
244
  }
245
-
246
  $validOfferStatuses = Mage::getSingleton('innobyte_emag_marketplace/source_offerStatus')
247
  ->toArray();
248
  if (!array_key_exists('status', $emagData)
249
- || !in_array($emagData['status'], $validOfferStatuses)) {
 
250
  Mage::throwException(
251
  $this->_getHelper()->__('Please choose eMAG offer status.')
252
  );
253
  }
254
-
255
  if (array_key_exists('warranty', $emagData)) {
256
- $emagData['warranty'] = (int) $emagData['warranty'];
257
  if ($emagData['warranty'] < 0 || $emagData['warranty'] > 255) {
258
  Mage::throwException(
259
  $this->_getHelper()->__(
@@ -265,9 +308,10 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
265
  $emagData['warranty'] = null;
266
  }
267
  }
268
-
269
  if (!array_key_exists('commission_type', $emagData)
270
- || empty($emagData['commission_type'])) {
 
271
  Mage::throwException(
272
  $this->_getHelper()->__('Please choose eMAG commission type.')
273
  );
@@ -277,16 +321,17 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
277
  } catch (Innobyte_EmagMarketplace_Exception $ex) {
278
  Mage::throwException($this->_getHelper()->__($ex->getMessage()));
279
  }
280
-
281
  if (!array_key_exists('commission_value', $emagData)) {
282
  Mage::throwException(
283
  $this->_getHelper()->__('Please fill eMAG commission value.')
284
  );
285
  }
286
  if (Innobyte_EmagMarketplace_Model_Source_CommissionTypes::TYPE_PERCENTAGE == $commissionType) {
287
- $emagData['commission_value'] = (int) $emagData['commission_value'];
288
  if ($emagData['commission_value'] < 0
289
- || $emagData['commission_value'] > 100) {
 
290
  Mage::throwException(
291
  $this->_getHelper()->__(
292
  'Invalid eMAG commission value. Should be a percentage between 0 and 100.'
@@ -294,7 +339,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
294
  );
295
  }
296
  } else {
297
- $emagData['commission_value'] = (float) $emagData['commission_value'];
298
  if ($emagData['commission_value'] < 0) {
299
  Mage::throwException(
300
  $this->_getHelper()->__(
@@ -303,11 +348,12 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
303
  );
304
  }
305
  }
306
-
307
  if (array_key_exists('handling_time', $emagData)) {
308
- $emagData['handling_time'] = (int) $emagData['handling_time'];
309
  if ($emagData['handling_time'] < 0
310
- || $emagData['handling_time'] > 255) {
 
311
  Mage::throwException(
312
  $this->_getHelper()->__(
313
  'Invalid eMAG handling time. Should be a real number equal to or greater than 0 and smaller than 255.'
@@ -318,7 +364,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
318
  $emagData['handling_time'] = null;
319
  }
320
  }
321
-
322
  $date = null;
323
  if (array_key_exists('start_date', $emagData)) {
324
  $filterInput = new Zend_Filter_LocalizedToNormalized(
@@ -332,7 +378,7 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
332
  );
333
  $date = $filterInput->filter($emagData['start_date']);
334
  $date = $filterInternal->filter($date);
335
-
336
  if ($date) {
337
  try {
338
  $zendDate = new Zend_Date($date, Varien_Date::DATE_INTERNAL_FORMAT);
@@ -343,7 +389,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
343
  }
344
  $now = new Zend_Date(null, Varien_Date::DATE_INTERNAL_FORMAT);
345
  if (!$zendDate->isLater($now)
346
- || !$zendDate->isEarlier($now->addDay(61))) {
 
347
  Mage::throwException(
348
  $this->_getHelper()->__(
349
  'Offer start date can be as far as 60 days in the future and cannot be earlier than tomorrow.'
@@ -357,10 +404,10 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
357
  } else {
358
  $emagData['start_date'] = null;
359
  }
360
-
361
  $vatId = null;
362
  if (array_key_exists('vat_id', $emagData)) {
363
- $vatId = (int) $emagData['vat_id'];
364
  $vats = Mage::getSingleton('innobyte_emag_marketplace/source_vat')
365
  ->getIdsArray($storeId);
366
  if (!in_array($vatId, $vats)) {
@@ -390,9 +437,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
390
  );
391
  }
392
  }
393
-
394
-
395
-
396
  /**
397
  * Add eMAG related mass actions to products grid.
398
  * Triggered on adminhtml_catalog_product_grid_prepare_massaction event.
@@ -404,19 +450,20 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
404
  public function addEmagProductMassActions(Varien_Event_Observer $observer)
405
  {
406
  $gridBlock = $observer->getEvent()->getBlock();
407
-
408
  $storeId = $this->_getHelper()->getCurrStoreId();
409
  if (!($gridBlock instanceof Mage_Adminhtml_Block_Catalog_Product_Grid)
410
  || $storeId == Mage_Core_Model_App::ADMIN_STORE_ID
411
- || !$this->_getHelper()->isExtensionEnabled($storeId)) {
 
412
  return $this;
413
  }
414
-
415
  $gridBlock->getMassactionBlock()->addItem(
416
  'emag_send_product_mass',
417
  array(
418
- 'label'=> $this->_getHelper()->__('Send eMAG product'),
419
- 'url' => $gridBlock->getUrl(
420
  'adminhtml/emag_product/massSendProduct',
421
  array('_current' => 1)
422
  ),
@@ -425,8 +472,8 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
425
  $gridBlock->getMassactionBlock()->addItem(
426
  'emag_send_offer_mass',
427
  array(
428
- 'label'=> $this->_getHelper()->__('Send eMAG offer'),
429
- 'url' => $gridBlock->getUrl(
430
  'adminhtml/emag_product/massSendOffer',
431
  array('_current' => 1)
432
  ),
@@ -435,14 +482,69 @@ class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
435
  $gridBlock->getMassactionBlock()->addItem(
436
  'emag_deactivate_offer_mass',
437
  array(
438
- 'label'=> $this->_getHelper()->__('Deactivate eMAG offer'),
439
- 'url' => $gridBlock->getUrl(
440
  'adminhtml/emag_product/massDeactivateOffer',
441
  array('_current' => 1)
442
  ),
443
  )
444
  );
445
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  return $this;
447
  }
 
448
  }
1
  <?php
2
+
3
  /**
4
  * Observer that handles product related events.
5
  *
7
  * @package Innobyte_EmagMarketplace
8
  * @author Bogdan Constantinescu <bogdan.constantinescu@innobyte.com>
9
  */
 
10
  class Innobyte_EmagMarketplace_Model_Catalog_Product_Observer
11
  {
12
  /**
15
  * @var Innobyte_EmagMarketplace_Helper_Data
16
  */
17
  protected $_helper;
18
+
19
+
 
20
  /**
21
  * Constructor; initializes stuffs.
22
  */
24
  {
25
  $this->_helper = Mage::helper('innobyte_emag_marketplace');
26
  }
27
+
28
+
 
29
  /**
30
  * Getter method for helper property.
31
  *
35
  {
36
  return $this->_helper;
37
  }
38
+
39
+
 
40
  /**
41
  * Saves product emag data.
42
  * Triggered on catalog_product_save_after event.
51
  $product = Mage::getModel('catalog/product')->setStoreId($storeId)
52
  ->load($observer->getEvent()->getProduct()->getId());
53
  if (!$this->_getHelper()->isProductActionValid($product)
54
+ || !Mage::app()->getRequest()->isPost()
55
+ ) {
56
  return $this;
57
  }
58
+
59
  $data = Mage::app()->getRequest()->getPost('product', array());
60
  if (!array_key_exists('inno_emag_mktp', $data)
61
+ || !is_array($data['inno_emag_mktp'])
62
+ ) {
63
  return $this;
64
  }
65
+
66
  $emagData = $data['inno_emag_mktp'];
67
  $emagProduct = Mage::getModel('innobyte_emag_marketplace/product')
68
  ->loadByProdIdAndStore($product->getId(), $storeId);
70
  $this->_checkFilterEmagProductData($emagData, $product);
71
  $emagProduct->addData($emagData)
72
  ->setProductId($product->getId())
73
+ ->setSku($product->getSku())
74
  ->setStoreId($storeId);
75
  // save data also on non-filled associated products if config prod
76
  if ($product->isConfigurable()) {
86
  $childEmagProduct->addData($emagData)
87
  ->unsFamilyTypeId()
88
  ->setProductId($childId)
89
+ ->setSku($product->getSku())
90
  ->setStoreId($storeId);
91
  $emagProduct->addRelatedObject($childEmagProduct);
92
  }
101
  );
102
  throw $ex;
103
  }
104
+
105
+ // update "emag_is_synced" product attribute; used in rendering correctly column "eMAG Synced"
106
+ if (!$product->getEmagIsSynced()) {
107
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
108
+ array($product->getId()),
109
+ array('emag_is_synced' => Innobyte_EmagMarketplace_Model_Product::IS_NOT_SYNCED),
110
+ Mage_Core_Model_App::ADMIN_STORE_ID
111
+ );
112
+
113
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
114
+ array($product->getId()),
115
+ array('emag_is_synced' => Innobyte_EmagMarketplace_Model_Product::IS_NOT_SYNCED),
116
+ $storeId
117
+ );
118
+ }
119
+
120
  return $this;
121
  }
122
+
123
+
 
124
  /**
125
  * Check / filter emag product form data.
126
  *
127
+ * @param array $emagData Product post data.
128
+ * @param Mage_Catalog_Model_Product $product Magento product.
129
  * @throws Mage_Core_Exception
130
  */
131
  protected function _checkFilterEmagProductData(
134
  )
135
  {
136
  $storeId = $this->_getHelper()->getCurrStoreId();
137
+
138
  if (is_null($product) || !$product->getId()) {
139
  Mage::throwException($this->_getHelper()->__('Invalid product id.'));
140
  }
141
+
142
  if (array_key_exists('part_number_key', $emagData)) {
143
  $emagData['part_number_key'] = trim($emagData['part_number_key']);
144
  if (empty($emagData['part_number_key'])) {
147
  } else {
148
  $emagData['part_number_key'] = null;
149
  }
150
+
151
  if (array_key_exists('name', $emagData)) {
152
  $emagData['name'] = trim($emagData['name']);
153
  if (empty($emagData['name'])) {
161
  $this->_getHelper()->__('Please fill eMAG product name.')
162
  );
163
  }
164
+
165
+ // check price
166
+ if (array_key_exists('price', $emagData)) {
167
+ $emagData['price'] = trim($emagData['price']);
168
+ if (empty($emagData['price'])) {
169
+ $emagData['price'] = null;
170
+ }
171
+ } else {
172
+ $emagData['price'] = null;
173
+ }
174
+
175
+ // check special price
176
+ if (array_key_exists('special_price', $emagData)) {
177
+ $emagData['special_price'] = trim($emagData['special_price']);
178
+ if (empty($emagData['special_price'])) {
179
+ $emagData['special_price'] = null;
180
+ }
181
+ } else {
182
+ $emagData['special_price'] = null;
183
+ }
184
+
185
+ if (!empty($emagData['special_price']) && !empty($emagData['price']) && ($emagData['special_price'] >= $emagData['price'])) {
186
+ Mage::throwException(
187
+ $this->_getHelper()->__('eMAG product special price can not be equal or greater than eMAG product price.')
188
+ );
189
+ }
190
+
191
  if (array_key_exists('brand', $emagData)) {
192
  $emagData['brand'] = trim($emagData['brand']);
193
  if (empty($emagData['brand'])) {
201
  $this->_getHelper()->__('Please fill eMAG product brand.')
202
  );
203
  }
204
+
205
  if (array_key_exists('description', $emagData)) {
206
  $emagData['description'] = trim($emagData['description']);
207
  if (empty($emagData['description'])) {
210
  } else {
211
  $emagData['description'] = null;
212
  }
213
+
214
  if (array_key_exists('barcodes', $emagData)) {
215
  if (is_array($emagData['barcodes'])) {
216
  $emagData['barcodes'] = array_filter(
224
  } else {
225
  $emagData['barcodes'] = array();
226
  }
227
+
228
  $categoryId = null;
229
  $emagCategory = Mage::getModel('innobyte_emag_marketplace/category');
230
  if (array_key_exists('category_id', $emagData)) {
264
  $skipChars[] = $ftChar->getMageIdEmagChar();
265
  }
266
  }
267
+
268
  foreach ($emagCategory->getCharacteristics() as $characteristic) {
269
  $charKey = 'category_characteristic' . $characteristic->getId();
270
  if ((!array_key_exists($charKey, $emagData)
271
+ || !strlen(trim($emagData[$charKey])))
272
+ && !in_array($characteristic->getId(), $skipChars)
273
+ ) {
274
  Mage::throwException(
275
  $this->_getHelper()->__(
276
  'No category characteristic "%s" value found.',
284
  }
285
  }
286
  }
287
+
288
  $validOfferStatuses = Mage::getSingleton('innobyte_emag_marketplace/source_offerStatus')
289
  ->toArray();
290
  if (!array_key_exists('status', $emagData)
291
+ || !in_array($emagData['status'], $validOfferStatuses)
292
+ ) {
293
  Mage::throwException(
294
  $this->_getHelper()->__('Please choose eMAG offer status.')
295
  );
296
  }
297
+
298
  if (array_key_exists('warranty', $emagData)) {
299
+ $emagData['warranty'] = (int)$emagData['warranty'];
300
  if ($emagData['warranty'] < 0 || $emagData['warranty'] > 255) {
301
  Mage::throwException(
302
  $this->_getHelper()->__(
308
  $emagData['warranty'] = null;
309
  }
310
  }
311
+
312
  if (!array_key_exists('commission_type', $emagData)
313
+ || empty($emagData['commission_type'])
314
+ ) {
315
  Mage::throwException(
316
  $this->_getHelper()->__('Please choose eMAG commission type.')
317
  );
321
  } catch (Innobyte_EmagMarketplace_Exception $ex) {
322
  Mage::throwException($this->_getHelper()->__($ex->getMessage()));
323
  }
324
+
325
  if (!array_key_exists('commission_value', $emagData)) {
326
  Mage::throwException(
327
  $this->_getHelper()->__('Please fill eMAG commission value.')
328
  );
329
  }
330
  if (Innobyte_EmagMarketplace_Model_Source_CommissionTypes::TYPE_PERCENTAGE == $commissionType) {
331
+ $emagData['commission_value'] = (int)$emagData['commission_value'];
332
  if ($emagData['commission_value'] < 0
333
+ || $emagData['commission_value'] > 100
334
+ ) {
335
  Mage::throwException(
336
  $this->_getHelper()->__(
337
  'Invalid eMAG commission value. Should be a percentage between 0 and 100.'
339
  );
340
  }
341
  } else {
342
+ $emagData['commission_value'] = (float)$emagData['commission_value'];
343
  if ($emagData['commission_value'] < 0) {
344
  Mage::throwException(
345
  $this->_getHelper()->__(
348
  );
349
  }
350
  }
351
+
352
  if (array_key_exists('handling_time', $emagData)) {
353
+ $emagData['handling_time'] = (int)$emagData['handling_time'];
354
  if ($emagData['handling_time'] < 0
355
+ || $emagData['handling_time'] > 255
356
+ ) {
357
  Mage::throwException(
358
  $this->_getHelper()->__(
359
  'Invalid eMAG handling time. Should be a real number equal to or greater than 0 and smaller than 255.'
364
  $emagData['handling_time'] = null;
365
  }
366
  }
367
+
368
  $date = null;
369
  if (array_key_exists('start_date', $emagData)) {
370
  $filterInput = new Zend_Filter_LocalizedToNormalized(
378
  );
379
  $date = $filterInput->filter($emagData['start_date']);
380
  $date = $filterInternal->filter($date);
381
+
382
  if ($date) {
383
  try {
384
  $zendDate = new Zend_Date($date, Varien_Date::DATE_INTERNAL_FORMAT);
389
  }
390
  $now = new Zend_Date(null, Varien_Date::DATE_INTERNAL_FORMAT);
391
  if (!$zendDate->isLater($now)
392
+ || !$zendDate->isEarlier($now->addDay(61))
393
+ ) {
394
  Mage::throwException(
395
  $this->_getHelper()->__(
396
  'Offer start date can be as far as 60 days in the future and cannot be earlier than tomorrow.'
404
  } else {
405
  $emagData['start_date'] = null;
406
  }
407
+
408
  $vatId = null;
409
  if (array_key_exists('vat_id', $emagData)) {
410
+ $vatId = (int)$emagData['vat_id'];
411
  $vats = Mage::getSingleton('innobyte_emag_marketplace/source_vat')
412
  ->getIdsArray($storeId);
413
  if (!in_array($vatId, $vats)) {
437
  );
438
  }
439
  }
440
+
441
+
 
442
  /**
443
  * Add eMAG related mass actions to products grid.
444
  * Triggered on adminhtml_catalog_product_grid_prepare_massaction event.
450
  public function addEmagProductMassActions(Varien_Event_Observer $observer)
451
  {
452
  $gridBlock = $observer->getEvent()->getBlock();
453
+
454
  $storeId = $this->_getHelper()->getCurrStoreId();
455
  if (!($gridBlock instanceof Mage_Adminhtml_Block_Catalog_Product_Grid)
456
  || $storeId == Mage_Core_Model_App::ADMIN_STORE_ID
457
+ || !$this->_getHelper()->isExtensionEnabled($storeId)
458
+ ) {
459
  return $this;
460
  }
461
+
462
  $gridBlock->getMassactionBlock()->addItem(
463
  'emag_send_product_mass',
464
  array(
465
+ 'label' => $this->_getHelper()->__('Send eMAG product'),
466
+ 'url' => $gridBlock->getUrl(
467
  'adminhtml/emag_product/massSendProduct',
468
  array('_current' => 1)
469
  ),
472
  $gridBlock->getMassactionBlock()->addItem(
473
  'emag_send_offer_mass',
474
  array(
475
+ 'label' => $this->_getHelper()->__('Send eMAG offer'),
476
+ 'url' => $gridBlock->getUrl(
477
  'adminhtml/emag_product/massSendOffer',
478
  array('_current' => 1)
479
  ),
482
  $gridBlock->getMassactionBlock()->addItem(
483
  'emag_deactivate_offer_mass',
484
  array(
485
+ 'label' => $this->_getHelper()->__('Deactivate eMAG offer'),
486
+ 'url' => $gridBlock->getUrl(
487
  'adminhtml/emag_product/massDeactivateOffer',
488
  array('_current' => 1)
489
  ),
490
  )
491
  );
492
+
493
+ return $this;
494
+ }
495
+
496
+ /**
497
+ * Add eMAG custom columns to product grid
498
+ * - core_block_abstract_prepare_layout_after
499
+ *
500
+ * @param Varien_Event_Observer $observer
501
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
502
+ */
503
+ public function addGridColumns(Varien_Event_Observer $observer)
504
+ {
505
+ $storeId = $this->_getHelper()->getCurrStoreId();
506
+ if (!$storeId) {
507
+ return $this;
508
+ }
509
+
510
+ $block = $observer->getBlock();
511
+ if ($block instanceof Mage_Adminhtml_Block_Catalog_Product_Grid) {
512
+ /* @var $block Mage_Adminhtml_Block_Catalog_Product_Grid */
513
+ $block->addColumnAfter(
514
+ 'emag_is_synced',
515
+ array(
516
+ 'header' => 'eMAG Synced',
517
+ 'width' => '100px',
518
+ 'type' => 'options',
519
+ 'options' => Mage::getModel('innobyte_emag_marketplace/source_attribute_sync_status')->toOptionArray(),
520
+ 'index' => 'emag_is_synced',
521
+ ),
522
+ 'status'
523
+ );
524
+ }
525
+
526
+ return $this;
527
+ }
528
+
529
+ /**
530
+ * Add eMAG custom columns to product grid select
531
+ * - catalog_product_collection_load_before
532
+ *
533
+ * @param Varien_Event_Observer $observer
534
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
535
+ */
536
+ public function addGridColumnsToSelect(Varien_Event_Observer $observer)
537
+ {
538
+ $storeId = $this->_getHelper()->getCurrStoreId();
539
+ if (!$storeId) {
540
+ return $this;
541
+ }
542
+
543
+ /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
544
+ $collection = $observer->getCollection();
545
+ $collection->addAttributeToSelect('emag_is_synced');
546
+
547
  return $this;
548
  }
549
+
550
  }
app/code/local/Innobyte/EmagMarketplace/Model/Cron.php CHANGED
@@ -139,7 +139,6 @@ class Innobyte_EmagMarketplace_Model_Cron extends Mage_Core_Model_Abstract
139
  )
140
  );
141
 
142
-
143
  /** @var $response Innobyte_EmagMarketplace_Model_Api_Response */
144
  $response = $api->count();
145
 
139
  )
140
  );
141
 
 
142
  /** @var $response Innobyte_EmagMarketplace_Model_Api_Response */
143
  $response = $api->count();
144
 
app/code/local/Innobyte/EmagMarketplace/Model/Invoice/Pdf/Total/Voucher.php CHANGED
@@ -37,9 +37,11 @@ class Innobyte_EmagMarketplace_Model_Invoice_Pdf_Total_Voucher extends Mage_Sale
37
 
38
  $total = array();
39
  foreach ($vouchers as $voucher) {
 
 
40
  $total[] = array(
41
  'label' => $voucher['emag_voucher_name'] . ':',
42
- 'amount' => $this->getOrder()->formatPriceTxt($voucher['emag_sale_price']),
43
  'font_size' => $fontSize,
44
  );
45
  }
37
 
38
  $total = array();
39
  foreach ($vouchers as $voucher) {
40
+ $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'];
41
+
42
  $total[] = array(
43
  'label' => $voucher['emag_voucher_name'] . ':',
44
+ 'amount' => $this->getOrder()->formatPriceTxt($salePriceInclVat),
45
  'font_size' => $fontSize,
46
  );
47
  }
app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Abstract.php CHANGED
@@ -374,7 +374,7 @@ abstract class Innobyte_EmagMarketplace_Model_Order_Convert_Abstract extends Var
374
  */
375
  public function reReadEmagOrder(Mage_Sales_Model_Order $sales)
376
  {
377
- Mage::register('is_emag_order_updated', true);
378
 
379
  /** @var $store Mage_Core_Model_Store */
380
  $store = $sales->getStore();
374
  */
375
  public function reReadEmagOrder(Mage_Sales_Model_Order $sales)
376
  {
377
+ $sales->setData('is_emag_order_updated', true);
378
 
379
  /** @var $store Mage_Core_Model_Store */
380
  $store = $sales->getStore();
app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Emag.php CHANGED
@@ -212,17 +212,35 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
212
 
213
  $order = $this->getOrder();
214
 
 
 
 
 
 
 
 
215
  $transaction->addObject($order);
216
 
217
  $transaction->addCommitCallback(array($order, 'place'));
218
  $transaction->addCommitCallback(array($order, 'save'));
219
  $transaction->save();
220
 
 
 
 
 
 
 
 
221
  $this->acknowledgeEmagOrder($this->getOrder());
222
 
223
  } catch (Innobyte_EmagMarketplace_Exception $e) {
 
 
224
  throw new Innobyte_EmagMarketplace_Exception($e->getMessage());
225
  } catch (Exception $e) {
 
 
226
  throw new Innobyte_EmagMarketplace_Exception($e->getMessage());
227
  }
228
  }
@@ -259,7 +277,9 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
259
  ->setState(Mage_Sales_Model_Order::STATE_NEW)
260
  ->setStatus($status)
261
  ->setEmagOrderId($emagOrderId)
262
- ->setEmagOrderDate($emagOrderDate);
 
 
263
 
264
  return $this;
265
  }
@@ -386,6 +406,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
386
  ->setQtyOrdered($quantity)
387
  ->setName($_product->getName())
388
  ->setSku($_product->getSku())
 
389
  ->setPrice($price)
390
  ->setBasePrice($basePrice)
391
  ->setOriginalPrice($originalPrice)
@@ -399,13 +420,27 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
399
  ->setBasePriceInclTax($basePriceInclTax)
400
  ->setRowTotalInclTax($rowTotalInclTax)
401
  ->setBaseTotalInclTax($baseRowTotalInclTax)
 
 
 
 
 
 
 
 
 
 
402
  ->setEmagDetails(json_encode($emagProduct['details']))
403
  ->setEmagCreated($emagProduct['created'])
404
- ->setEmagModified($emagProduct['modified']);
 
 
405
 
406
  $this->getOrder()
407
  ->addItem($orderItem);
408
 
 
 
409
  $subTotal += $rowTotal;
410
  $baseSubTotal += $baseRowTotal;
411
  $subtotalInclTax += $rowTotalInclTax;
@@ -468,8 +503,8 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
468
  }
469
  $vouchers[] = $voucher;
470
 
471
- $salePrice = $emagVoucher['sale_price'];
472
- $voucherDiscount += $salePrice;
473
  }
474
 
475
  $grandTotal = $this->getOrder()->getGrandTotal() + $voucherDiscount;
@@ -606,27 +641,42 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
606
  * Prepare shipping
607
  *
608
  * @return Innobyte_EmagMarketplace_Model_Order_Convert_Emag
 
609
  */
610
  protected function _prepareShipping()
611
  {
612
- $shippingAmount = $this->getEmagOrder('shipping_tax');
613
- $baseShippingAmount = $this->_convertPriceToBaseCurrency($shippingAmount);
 
 
 
 
 
 
 
 
 
 
614
 
615
- $grandTotal = $this->getOrder()->getGrandTotal() + $shippingAmount;
616
- $baseGrandTotal = $this->getOrder()->getBaseGrandTotal() + $baseShippingAmount;
 
 
 
 
617
 
618
- $rateResult = Mage::getModel('innobyte_emag_marketplace/shipping_carrier_emag')
619
- ->collectRates(null);
620
- if (is_object($rateResult)) {
621
- $rate = current($rateResult->getAllRates());
 
 
 
 
 
 
 
622
  }
623
- $this->getOrder()
624
- ->setShippingMethod($rate->getCarrier() . '_' . $rate->getMethod())
625
- ->setShippingAmount($shippingAmount)
626
- ->setShippingDescription(trim($rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle(), '-'))
627
- ->setBaseShippingAmount($baseShippingAmount)
628
- ->setGrandTotal($grandTotal)
629
- ->setBaseGrandTotal($baseGrandTotal);
630
 
631
  return $this;
632
  }
@@ -694,20 +744,25 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
694
  * @param float $price
695
  * @param bool $round
696
  * @return float
 
697
  */
698
  protected function _convertPriceToBaseCurrency($price, $round = true)
699
  {
700
- $baseCurrency = $this->getBaseCurrency()->getCode();
701
- $currentCurrency = $this->getCurrentCurrency()->getCode();
 
702
 
703
- $rates = $this->_getCurrencyRates($baseCurrency);
704
- $price = $price / $rates[$currentCurrency];
705
 
706
- if ($round) {
707
- return $this->getStore()->roundPrice($price);
708
- }
709
 
710
- return $price;
 
 
 
711
  }
712
 
713
  /**
@@ -738,6 +793,27 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
738
  . '@' . $this->getHelper()->getEmagDomain($this->getStore()->getId());
739
  }
740
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  /**
742
  * Acknowledge eMAG order
743
  *
@@ -767,4 +843,21 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag
767
  return $this;
768
  }
769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  }
212
 
213
  $order = $this->getOrder();
214
 
215
+ Mage::dispatchEvent(
216
+ 'innobyte_emag_marketplace_emag_order_save_before',
217
+ array(
218
+ 'order' => $order
219
+ )
220
+ );
221
+
222
  $transaction->addObject($order);
223
 
224
  $transaction->addCommitCallback(array($order, 'place'));
225
  $transaction->addCommitCallback(array($order, 'save'));
226
  $transaction->save();
227
 
228
+ Mage::dispatchEvent(
229
+ 'innobyte_emag_marketplace_emag_order_save_after',
230
+ array(
231
+ 'order' => $order
232
+ )
233
+ );
234
+
235
  $this->acknowledgeEmagOrder($this->getOrder());
236
 
237
  } catch (Innobyte_EmagMarketplace_Exception $e) {
238
+ $this->_restoreItemQty();
239
+
240
  throw new Innobyte_EmagMarketplace_Exception($e->getMessage());
241
  } catch (Exception $e) {
242
+ $this->_restoreItemQty();
243
+
244
  throw new Innobyte_EmagMarketplace_Exception($e->getMessage());
245
  }
246
  }
277
  ->setState(Mage_Sales_Model_Order::STATE_NEW)
278
  ->setStatus($status)
279
  ->setEmagOrderId($emagOrderId)
280
+ ->setEmagOrderDate($emagOrderDate)
281
+ ->setCreatedAt($this->_getGmtDate($emagOrderDate))
282
+ ->setUpdatedAt($this->_getGmtDate($emagOrderDate));
283
 
284
  return $this;
285
  }
406
  ->setQtyOrdered($quantity)
407
  ->setName($_product->getName())
408
  ->setSku($_product->getSku())
409
+ ->setWeight($_product->getWeight())
410
  ->setPrice($price)
411
  ->setBasePrice($basePrice)
412
  ->setOriginalPrice($originalPrice)
420
  ->setBasePriceInclTax($basePriceInclTax)
421
  ->setRowTotalInclTax($rowTotalInclTax)
422
  ->setBaseTotalInclTax($baseRowTotalInclTax)
423
+ ->setGiftMessageAvailable(0)
424
+ ->setBaseWeeeTaxAppliedAmount(0)
425
+ ->setBaseWeeeTaxAppliedRowAmnt(0)
426
+ ->setWeeeTaxAppliedAmount(0)
427
+ ->setWeeeTaxAppliedRowAmount(0)
428
+ ->setWeeeTaxApplied(serialize(array()))
429
+ ->setWeeeTaxDisposition(0)
430
+ ->setWeeeTaxRowDisposition(0)
431
+ ->setBaseWeeeTaxDisposition(0)
432
+ ->setBaseWeeeTaxRowDisposition(0)
433
  ->setEmagDetails(json_encode($emagProduct['details']))
434
  ->setEmagCreated($emagProduct['created'])
435
+ ->setEmagModified($emagProduct['modified'])
436
+ ->setCreatedAt($this->_getGmtDate($emagProduct['created']))
437
+ ->setUpdatedAt($this->_getGmtDate($emagProduct['modified']));
438
 
439
  $this->getOrder()
440
  ->addItem($orderItem);
441
 
442
+ $this->_registerItemSale($orderItem);
443
+
444
  $subTotal += $rowTotal;
445
  $baseSubTotal += $baseRowTotal;
446
  $subtotalInclTax += $rowTotalInclTax;
503
  }
504
  $vouchers[] = $voucher;
505
 
506
+ $salePriceInclVat = $emagVoucher['sale_price'] + $emagVoucher['sale_price_vat'];
507
+ $voucherDiscount += $salePriceInclVat;
508
  }
509
 
510
  $grandTotal = $this->getOrder()->getGrandTotal() + $voucherDiscount;
641
  * Prepare shipping
642
  *
643
  * @return Innobyte_EmagMarketplace_Model_Order_Convert_Emag
644
+ * @throws Innobyte_EmagMarketplace_Exception
645
  */
646
  protected function _prepareShipping()
647
  {
648
+ try {
649
+ $shippingAmount = $this->getEmagOrder('shipping_tax');
650
+ $baseShippingAmount = $this->_convertPriceToBaseCurrency($shippingAmount);
651
+
652
+ $grandTotal = $this->getOrder()->getGrandTotal() + $shippingAmount;
653
+ $baseGrandTotal = $this->getOrder()->getBaseGrandTotal() + $baseShippingAmount;
654
+
655
+ /** @var $carrier Innobyte_EmagMarketplace_Model_Shipping_Carrier_Emag */
656
+ $carrier = Mage::getModel('innobyte_emag_marketplace/shipping_carrier_emag');
657
+ /** @var $request Mage_Shipping_Model_Rate_Request */
658
+ $request = Mage::getModel('shipping/rate_request');
659
+ $rates = $carrier->collectRates($request);
660
 
661
+ if ($rates) {
662
+ $rate = current($rates->getAllRates());
663
+ $this->getOrder()
664
+ ->setShippingMethod($rate->getCarrier() . '_' . $rate->getMethod())
665
+ ->setShippingDescription(trim($rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle(), '-'));
666
+ }
667
 
668
+ $this->getOrder()
669
+ ->setShippingAmount($shippingAmount)
670
+ ->setBaseShippingAmount($baseShippingAmount)
671
+ ->setGrandTotal($grandTotal)
672
+ ->setBaseGrandTotal($baseGrandTotal);
673
+ } catch (Exception $e) {
674
+ throw new Innobyte_EmagMarketplace_Exception(
675
+ $this->getHelper()->__(
676
+ 'Unable to apply shipping method. ERROR: %s', $e->getMessage()
677
+ )
678
+ );
679
  }
 
 
 
 
 
 
 
680
 
681
  return $this;
682
  }
744
  * @param float $price
745
  * @param bool $round
746
  * @return float
747
+ * @throws Innobyte_EmagMarketplace_Exception
748
  */
749
  protected function _convertPriceToBaseCurrency($price, $round = true)
750
  {
751
+ try {
752
+ $baseCurrency = $this->getBaseCurrency()->getCode();
753
+ $currentCurrency = $this->getCurrentCurrency()->getCode();
754
 
755
+ $rates = $this->_getCurrencyRates($baseCurrency);
756
+ $price = $price / $rates[$currentCurrency];
757
 
758
+ if ($round) {
759
+ return $this->getStore()->roundPrice($price);
760
+ }
761
 
762
+ return $price;
763
+ } catch (Innobyte_EmagMarketplace_Exception $e) {
764
+ throw new Innobyte_EmagMarketplace_Exception('Invalid currency settings. Please check you currency rates.');
765
+ }
766
  }
767
 
768
  /**
793
  . '@' . $this->getHelper()->getEmagDomain($this->getStore()->getId());
794
  }
795
 
796
+ /**
797
+ * Decrease magento stocks for current item
798
+ *
799
+ * @param $item
800
+ */
801
+ private function _registerItemSale(Mage_Sales_Model_Order_Item $item)
802
+ {
803
+ Mage::getSingleton('cataloginventory/stock')->registerItemSale($item);
804
+ }
805
+
806
+ /**
807
+ * Restore order item quantities
808
+ */
809
+ private function _restoreItemQty()
810
+ {
811
+ /** @var $item Mage_Sales_Model_Order_Item */
812
+ foreach ($this->getOrder()->getAllItems() as $item) {
813
+ Mage::getSingleton('cataloginventory/stock')->backItemQty($item->getProductId(), $item->getQtyOrdered());
814
+ }
815
+ }
816
+
817
  /**
818
  * Acknowledge eMAG order
819
  *
843
  return $this;
844
  }
845
 
846
+ /**
847
+ * Get GMT date
848
+ *
849
+ * @param $time
850
+ * @return bool|string
851
+ */
852
+ protected function _getGmtDate($time)
853
+ {
854
+ $timezone = new DateTimeZone(
855
+ Mage::app()->getStore($this->getOrder()->getStore())
856
+ ->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE)
857
+ );
858
+ $date = new DateTime($time, $timezone);
859
+
860
+ return date('Y-m-d H:i:s', $date->getTimestamp());
861
+ }
862
+
863
  }
app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Emag/Update.php CHANGED
@@ -116,7 +116,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag_Update
116
  }
117
  $state = $this->getStatusState($status);
118
 
119
- $this->getOrder()->setState($state);
120
  $this->getOrder()->setStatus($status);
121
 
122
  return $this;
@@ -185,7 +185,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag_Update
185
  );
186
  }
187
 
188
- $quantity = (float)$emagProduct['quantity'];
189
  $vat = (float)$emagProduct['vat'];
190
 
191
  $price = (float)$emagProduct['sale_price'];
@@ -215,6 +215,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag_Update
215
  ->setQtyOrdered($quantity)
216
  ->setName($_product->getName())
217
  ->setSku($_product->getSku())
 
218
  ->setPrice($price)
219
  ->setBasePrice($basePrice)
220
  ->setOriginalPrice($originalPrice)
@@ -228,6 +229,16 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Emag_Update
228
  ->setBasePriceInclTax($basePriceInclTax)
229
  ->setRowTotalInclTax($rowTotalInclTax)
230
  ->setBaseTotalInclTax($baseRowTotalInclTax)
 
 
 
 
 
 
 
 
 
 
231
  ->setEmagDetails(json_encode($emagProduct['details']))
232
  ->setEmagCreated($emagProduct['created'])
233
  ->setEmagModified($emagProduct['modified']);
116
  }
117
  $state = $this->getStatusState($status);
118
 
119
+ $this->getOrder()->setData('state', $state);
120
  $this->getOrder()->setStatus($status);
121
 
122
  return $this;
185
  );
186
  }
187
 
188
+ $quantity = (float)$emagProduct['quantity'] + $orderItem->getQtyRefunded();
189
  $vat = (float)$emagProduct['vat'];
190
 
191
  $price = (float)$emagProduct['sale_price'];
215
  ->setQtyOrdered($quantity)
216
  ->setName($_product->getName())
217
  ->setSku($_product->getSku())
218
+ ->setWeight($_product->getWeight())
219
  ->setPrice($price)
220
  ->setBasePrice($basePrice)
221
  ->setOriginalPrice($originalPrice)
229
  ->setBasePriceInclTax($basePriceInclTax)
230
  ->setRowTotalInclTax($rowTotalInclTax)
231
  ->setBaseTotalInclTax($baseRowTotalInclTax)
232
+ ->setGiftMessageAvailable(0)
233
+ ->setBaseWeeeTaxAppliedAmount(0)
234
+ ->setBaseWeeeTaxAppliedRowAmnt(0)
235
+ ->setWeeeTaxAppliedAmount(0)
236
+ ->setWeeeTaxAppliedRowAmount(0)
237
+ ->setWeeeTaxApplied(serialize(array()))
238
+ ->setWeeeTaxDisposition(0)
239
+ ->setWeeeTaxRowDisposition(0)
240
+ ->setBaseWeeeTaxDisposition(0)
241
+ ->setBaseWeeeTaxRowDisposition(0)
242
  ->setEmagDetails(json_encode($emagProduct['details']))
243
  ->setEmagCreated($emagProduct['created'])
244
  ->setEmagModified($emagProduct['modified']);
app/code/local/Innobyte/EmagMarketplace/Model/Order/Convert/Magento.php CHANGED
@@ -343,8 +343,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
343
  $this->_prepareShippingAddress();
344
  $this->_prepareShipping();
345
  $this->_prepareProducts();
346
- //TODO: uncomment if magento native invoices need to be sent to eMAG
347
- //$this->_prepareInvoices();
348
  $this->_prepareVouchers();
349
  $this->_preparePayment();
350
  $this->_prepareCustomerComment();
@@ -393,7 +392,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
393
  $orderDate = $this->getOrder()->getEmagOrderDate();
394
  $orderStatus = $this->getOrderStatus();
395
 
396
- if (!$orderStatus) {
397
  throw new Innobyte_EmagMarketplace_Exception(
398
  $this->getHelper()->__(
399
  'Invalid Magento order status: %s', $this->getOrder()->getStatus()
@@ -502,7 +501,7 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
502
  $product = array(
503
  'product_id' => $item->getProductId(),
504
  'part_number' => $item->getSku(),
505
- 'quantity' => $item->getQtyOrdered(),
506
  'sale_price' => $item->getPrice,
507
  'currency' => $this->getCurrency()->getCode(),
508
  'created' => $item->getEmagCreated(),
@@ -705,6 +704,11 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
705
  */
706
  protected function _prepareInvoices()
707
  {
 
 
 
 
 
708
  try {
709
  $invoices = $this->getOrder()->getInvoiceCollection();
710
  foreach ($invoices as $invoice) {
@@ -740,10 +744,10 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
740
  private function _processInvoice($entity, $storno = false)
741
  {
742
  $type = Innobyte_EmagMarketplace_Model_Sales_Invoice::EMAG_INVOICE_NORMAL;
743
- $entityType = Mage_Sales_Model_Order::ACTION_FLAG_INVOICE;
744
  if ($storno) {
745
  $type = Innobyte_EmagMarketplace_Model_Sales_Invoice::EMAG_INVOICE_STORNO;
746
- $entityType = Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO;
747
  }
748
 
749
  // get entity prefix(series)
@@ -820,37 +824,39 @@ class Innobyte_EmagMarketplace_Model_Order_Convert_Magento
820
  {
821
  $attachments = array();
822
  try {
823
- $thirdPartyInvoices = $this->_getThirdPartyInvoices();
824
- foreach ($thirdPartyInvoices as $invoice) {
825
- $attachments[] = array(
826
- 'name' => $invoice->getEmagInvoiceName(),
827
- 'url' => $this->_getFileUrl($invoice->getId(), Innobyte_EmagMarketplace_Model_Sales_Invoice::THIRD_PARTY_INVOICE),
828
- 'type' => 1
829
- );
830
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
 
832
- //TODO: uncomment if magento native invoices need to be sent to eMAG
833
- // $magentoInvoices = $this->_getMagentoInvoices();
834
- // foreach ($magentoInvoices as $invoice) {
835
- // $this->_generateInvoice($invoice);
836
- //
837
- // $attachments[] = array(
838
- // 'name' => $this->getInvoiceFileName($invoice, Mage_Sales_Model_Order::ACTION_FLAG_INVOICE),
839
- // 'url' => $this->_getFileUrl($invoice->getId(), Mage_Sales_Model_Order::ACTION_FLAG_INVOICE),
840
- // 'type' => 1
841
- // );
842
- // }
843
- //
844
- // $magentoCreditmemos = $this->_getMagentoCreditmemos();
845
- // foreach ($magentoCreditmemos as $creditmemo) {
846
- // $this->_generateCreditmemo($creditmemo);
847
- //
848
- // $attachments[] = array(
849
- // 'name' => $this->getInvoiceFileName($creditmemo, Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO),
850
- // 'url' => $this->_getFileUrl($creditmemo->getId(), Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO),
851
- // 'type' => 1
852
- // );
853
- // }
854
 
855
  $this->getEmagOrder()
856
  ->setAttachments($attachments);
343
  $this->_prepareShippingAddress();
344
  $this->_prepareShipping();
345
  $this->_prepareProducts();
346
+ $this->_prepareInvoices();
 
347
  $this->_prepareVouchers();
348
  $this->_preparePayment();
349
  $this->_prepareCustomerComment();
392
  $orderDate = $this->getOrder()->getEmagOrderDate();
393
  $orderStatus = $this->getOrderStatus();
394
 
395
+ if ($orderStatus === false) {
396
  throw new Innobyte_EmagMarketplace_Exception(
397
  $this->getHelper()->__(
398
  'Invalid Magento order status: %s', $this->getOrder()->getStatus()
501
  $product = array(
502
  'product_id' => $item->getProductId(),
503
  'part_number' => $item->getSku(),
504
+ 'quantity' => $item->getQtyOrdered() - $item->getQtyRefunded(),
505
  'sale_price' => $item->getPrice,
506
  'currency' => $this->getCurrency()->getCode(),
507
  'created' => $item->getEmagCreated(),
704
  */
705
  protected function _prepareInvoices()
706
  {
707
+ // exit if third party invoices should be used
708
+ if ($this->getHelper()->useThirdPartyInvoices($this->getStoreId())) {
709
+ return $this;
710
+ }
711
+
712
  try {
713
  $invoices = $this->getOrder()->getInvoiceCollection();
714
  foreach ($invoices as $invoice) {
744
  private function _processInvoice($entity, $storno = false)
745
  {
746
  $type = Innobyte_EmagMarketplace_Model_Sales_Invoice::EMAG_INVOICE_NORMAL;
747
+ $entityType = Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_INVOICE;
748
  if ($storno) {
749
  $type = Innobyte_EmagMarketplace_Model_Sales_Invoice::EMAG_INVOICE_STORNO;
750
+ $entityType = Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_INVOICE;
751
  }
752
 
753
  // get entity prefix(series)
824
  {
825
  $attachments = array();
826
  try {
827
+ // check if third party or magento invoices should be used
828
+ if ($this->getHelper()->useThirdPartyInvoices($this->getStoreId())) {
829
+ $thirdPartyInvoices = $this->_getThirdPartyInvoices();
830
+ foreach ($thirdPartyInvoices as $invoice) {
831
+ $attachments[] = array(
832
+ 'name' => $invoice->getEmagInvoiceName(),
833
+ 'url' => $this->_getFileUrl($invoice->getId(), Innobyte_EmagMarketplace_Model_Sales_Invoice::THIRD_PARTY_INVOICE),
834
+ 'type' => 1
835
+ );
836
+ }
837
+ } else {
838
+ $magentoInvoices = $this->_getMagentoInvoices();
839
+ foreach ($magentoInvoices as $invoice) {
840
+ $this->_generateInvoice($invoice);
841
+
842
+ $attachments[] = array(
843
+ 'name' => $this->getInvoiceFileName($invoice, Mage_Sales_Model_Order::ACTION_FLAG_INVOICE),
844
+ 'url' => $this->_getFileUrl($invoice->getId(), Mage_Sales_Model_Order::ACTION_FLAG_INVOICE),
845
+ 'type' => 1
846
+ );
847
+ }
848
+
849
+ $magentoCreditmemos = $this->_getMagentoCreditmemos();
850
+ foreach ($magentoCreditmemos as $creditmemo) {
851
+ $this->_generateCreditmemo($creditmemo);
852
 
853
+ $attachments[] = array(
854
+ 'name' => $this->getInvoiceFileName($creditmemo, Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO),
855
+ 'url' => $this->_getFileUrl($creditmemo->getId(), Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO),
856
+ 'type' => 1
857
+ );
858
+ }
859
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
 
861
  $this->getEmagOrder()
862
  ->setAttachments($attachments);
app/code/local/Innobyte/EmagMarketplace/Model/Sales/Invoice.php CHANGED
@@ -11,6 +11,16 @@
11
  class Innobyte_EmagMarketplace_Model_Sales_Invoice extends Mage_Core_Model_Abstract
12
  {
13
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Prefix of model events names
16
  *
@@ -134,7 +144,7 @@ class Innobyte_EmagMarketplace_Model_Sales_Invoice extends Mage_Core_Model_Abstr
134
  */
135
  public function getInvoiceBaseDirectory()
136
  {
137
- return Mage::getBaseDir('media') . DS . $this->getInvoiceDirectory();
138
  }
139
 
140
  /**
11
  class Innobyte_EmagMarketplace_Model_Sales_Invoice extends Mage_Core_Model_Abstract
12
  {
13
 
14
+ /**
15
+ * Invoice entity type code
16
+ */
17
+ const ENTITY_TYPE_CODE_INVOICE = 'emag_invoice';
18
+
19
+ /**
20
+ * Creditmemo entity type code
21
+ */
22
+ const ENTITY_TYPE_CODE_CREDITMEMO = 'emag_creditmemo';
23
+
24
  /**
25
  * Prefix of model events names
26
  *
144
  */
145
  public function getInvoiceBaseDirectory()
146
  {
147
+ return Mage::getBaseDir('media') . DS . $this->getInvoiceDirectory();
148
  }
149
 
150
  /**
app/code/local/Innobyte/EmagMarketplace/Model/Sales/Observer.php CHANGED
@@ -257,8 +257,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
257
  return $this;
258
  }
259
 
260
- // for edit mode order state and status is not available; apply it
261
- if (!$order->getState()) {
 
 
 
262
  $order->setState(
263
  Mage_Sales_Model_Order::STATE_PROCESSING,
264
  Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_IN_PROGRESS
@@ -276,10 +279,10 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
276
  );
277
  }
278
 
279
- //TODO: check if status is set correctly after performing a magento default action; if not set is manually
280
- //if (!in_array($order->getStatus(), $model->getEmagOrderStatuses())) {
281
- // $order->setStatus($order->getOrigData('status'));
282
- //}
283
 
284
  if (
285
  !$order->isCanceled()
@@ -291,8 +294,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
291
  0 == $order->getBaseGrandTotal()
292
  || $order->canCreditmemo()
293
  ) {
294
- $emagOrderStatus = $this->getConfig()
295
- ->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_COMPLETE);
 
 
 
296
  } /**
297
  * Order can be closed just in case when we have refunded amount.
298
  * In case of "0" grand total order checking ForcedCanCreditmemo flag
@@ -359,9 +365,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
359
  ->saveVoucherData($order);
360
  }
361
 
362
- // update eMAG order only if state is processing
363
- if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
364
- if (!Mage::registry('is_emag_order_updated')) {
 
 
365
  $this->_updateEmagOrder($order);
366
  }
367
  }
@@ -904,7 +912,7 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
904
 
905
  $message = $this->_getHelper()->__('This action will update order in eMAG Marketplace. Are you sure?');
906
  if ($model->canPrepare($order)) {
907
- $url = $block->getUrl('*/*/emagprepare');
908
  $block->addButton(
909
  'emag_prepared',
910
  array(
@@ -915,8 +923,20 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
915
  );
916
  }
917
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  if ($model->canCancel($order)) {
919
- $url = $block->getUrl('*/*/emagcancel');
920
  $block->addButton(
921
  'emag_canceled',
922
  array(
@@ -931,4 +951,116 @@ class Innobyte_EmagMarketplace_Model_Sales_Observer
931
  return $this;
932
  }
933
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  }
257
  return $this;
258
  }
259
 
260
+ // apply state/status if not set; on edit mode change state/status if status is new
261
+ if (!$order->getState()
262
+ || ($order->getStatus() == Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_NEW
263
+ && $order->getRelationParentId())
264
+ ) {
265
  $order->setState(
266
  Mage_Sales_Model_Order::STATE_PROCESSING,
267
  Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_IN_PROGRESS
279
  );
280
  }
281
 
282
+ // check if status is set correctly after performing a magento default action; if not set is manually
283
+ if (!in_array($order->getStatus(), $model->getEmagOrderStatuses())) {
284
+ $order->setStatus($order->getOrigData('status'));
285
+ }
286
 
287
  if (
288
  !$order->isCanceled()
294
  0 == $order->getBaseGrandTotal()
295
  || $order->canCreditmemo()
296
  ) {
297
+ if (in_array($order->getStatus(), $model->getEmagOrderStatuses())) {
298
+ $emagOrderStatus = $order->getStatus();
299
+ } else {
300
+ $emagOrderStatus = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_FINALIZED;
301
+ }
302
  } /**
303
  * Order can be closed just in case when we have refunded amount.
304
  * In case of "0" grand total order checking ForcedCanCreditmemo flag
365
  ->saveVoucherData($order);
366
  }
367
 
368
+ // update eMAG order only if state is processing or fully refunded
369
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
370
+ || $order->getStatus() == Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_RETURNED
371
+ ) {
372
+ if (!$order->getData('is_emag_order_updated')) {
373
  $this->_updateEmagOrder($order);
374
  }
375
  }
912
 
913
  $message = $this->_getHelper()->__('This action will update order in eMAG Marketplace. Are you sure?');
914
  if ($model->canPrepare($order)) {
915
+ $url = $block->getUrl('*/*/emagPrepare');
916
  $block->addButton(
917
  'emag_prepared',
918
  array(
923
  );
924
  }
925
 
926
+ if ($model->canFinalize($order)) {
927
+ $url = $block->getUrl('*/*/emagFinalize');
928
+ $block->addButton(
929
+ 'emag_finalized',
930
+ array(
931
+ 'label' => $this->_getHelper()->__('eMAG Finalized'),
932
+ 'onclick' => "confirmSetLocation('" . $message . "', '" . $url . "')",
933
+ 'class' => 'go'
934
+ )
935
+ );
936
+ }
937
+
938
  if ($model->canCancel($order)) {
939
+ $url = $block->getUrl('*/*/emagCancel');
940
  $block->addButton(
941
  'emag_canceled',
942
  array(
951
  return $this;
952
  }
953
 
954
+ /**
955
+ * Add eMAG custom columns to sales order grid select
956
+ * - sales_order_grid_collection_load_before
957
+ *
958
+ * @param Varien_Event_Observer $observer
959
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
960
+ */
961
+ public function addGridColumnsToSelect(Varien_Event_Observer $observer)
962
+ {
963
+ $collection = $observer->getOrderGridCollection();
964
+ $collection->getSelect()->joinLeft(
965
+ array(
966
+ 'emag_orders' => Mage::getSingleton('core/resource')->getTableName('innobyte_emag_marketplace/sales_order')
967
+ ),
968
+ 'main_table.entity_id = emag_orders.entity_id',
969
+ array(
970
+ 'emag_orders.emag_order_id'
971
+ ),
972
+ null
973
+ );
974
+
975
+ return $this;
976
+ }
977
+
978
+ /**
979
+ * Add eMAG mass actions to sales order grid on:
980
+ * - core_block_abstract_prepare_layout_before
981
+ *
982
+ * @param Varien_Event_Observer $observer
983
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
984
+ */
985
+ public function addOrderMassActions(Varien_Event_Observer $observer)
986
+ {
987
+ $block = $observer->getEvent()->getBlock();
988
+ if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction
989
+ && $block->getRequest()->getControllerName() == 'sales_order'
990
+ ) {
991
+ $block->addItem('emag_prepared', array(
992
+ 'label' => $this->_getHelper()->__('eMAG Prepared'),
993
+ 'url' => $block->getUrl('*/*/massEmagPrepare'),
994
+ ));
995
+ $block->addItem('emag_finalized', array(
996
+ 'label' => $this->_getHelper()->__('eMAG Finalized'),
997
+ 'url' => $block->getUrl('*/*/massEmagFinalize'),
998
+ ));
999
+ $block->addItem('emag_canceled', array(
1000
+ 'label' => $this->_getHelper()->__('eMAG Cancel'),
1001
+ 'url' => $block->getUrl('*/*/massEmagCancel'),
1002
+ ));
1003
+ }
1004
+
1005
+ return $this;
1006
+ }
1007
+
1008
+ /**
1009
+ * Set increment id for invoice on:
1010
+ * - sales_order_invoice_save_before
1011
+ *
1012
+ * @param Varien_Event_Observer $observer
1013
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
1014
+ */
1015
+ public function invoiceBeforeSave(Varien_Event_Observer $observer)
1016
+ {
1017
+ /** @var Mage_Sales_Model_Order_Invoice $invoice */
1018
+ $invoice = $observer->getEvent()->getInvoice();
1019
+
1020
+ /** @var Mage_Sales_Model_Order $order */
1021
+ $order = $invoice->getOrder();
1022
+ if (!$order->getEmagOrderId()) {
1023
+ return $this;
1024
+ }
1025
+
1026
+ if (!$invoice->getIncrementId()) {
1027
+ /* @var $entityType Mage_Eav_Model_Entity_Type */
1028
+ $entityType = Mage::getModel('eav/entity_type')
1029
+ ->loadByCode(Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_INVOICE);
1030
+
1031
+ $invoice->setIncrementId($entityType->fetchNewIncrementId($invoice->getStoreId()));
1032
+ }
1033
+
1034
+ return $this;
1035
+ }
1036
+
1037
+ /**
1038
+ * Set increment id for creditmemo on:
1039
+ * - sales_order_creditmemo_save_before
1040
+ *
1041
+ * @param Varien_Event_Observer $observer
1042
+ * @return Innobyte_EmagMarketplace_Model_Sales_Observer
1043
+ */
1044
+ public function creditmemoBeforeSave(Varien_Event_Observer $observer)
1045
+ {
1046
+ /** @var Mage_Sales_Model_Order_Creditmemo $creditmemo */
1047
+ $creditmemo = $observer->getEvent()->getCreditmemo();
1048
+
1049
+ /** @var Mage_Sales_Model_Order $order */
1050
+ $order = $creditmemo->getOrder();
1051
+ if (!$order->getEmagOrderId()) {
1052
+ return $this;
1053
+ }
1054
+
1055
+ if (!$creditmemo->getIncrementId()) {
1056
+ /* @var $entityType Mage_Eav_Model_Entity_Type */
1057
+ $entityType = Mage::getModel('eav/entity_type')
1058
+ ->loadByCode(Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_CREDITMEMO);
1059
+
1060
+ $creditmemo->setIncrementId($entityType->fetchNewIncrementId($creditmemo->getStoreId()));
1061
+ }
1062
+
1063
+ return $this;
1064
+ }
1065
+
1066
  }
app/code/local/Innobyte/EmagMarketplace/Model/Sales/Order/Creditmemo/Total.php CHANGED
@@ -35,8 +35,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Order_Creditmemo_Total
35
  }
36
 
37
  foreach ($vouchers as $voucher) {
38
- $emagVouchersValue += $voucher['emag_sale_price'];
39
- $baseEmagVouchersValue += $voucher['base_emag_sale_price'];
 
 
 
40
  }
41
 
42
  $grandTotal = $creditmemo->getGrandTotal() + $emagVouchersValue;
35
  }
36
 
37
  foreach ($vouchers as $voucher) {
38
+ $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'];
39
+ $baseSalePriceInclVat = $voucher['base_emag_sale_price'] + $voucher['base_emag_sale_price_vat'];
40
+
41
+ $emagVouchersValue += $salePriceInclVat;
42
+ $baseEmagVouchersValue += $baseSalePriceInclVat;
43
  }
44
 
45
  $grandTotal = $creditmemo->getGrandTotal() + $emagVouchersValue;
app/code/local/Innobyte/EmagMarketplace/Model/Sales/Order/Invoice/Total.php CHANGED
@@ -35,8 +35,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Order_Invoice_Total
35
  }
36
 
37
  foreach ($vouchers as $voucher) {
38
- $emagVouchersValue += $voucher['emag_sale_price'];
39
- $baseEmagVouchersValue += $voucher['base_emag_sale_price'];
 
 
 
40
  }
41
 
42
  $grandTotal = $invoice->getGrandTotal() + $emagVouchersValue;
35
  }
36
 
37
  foreach ($vouchers as $voucher) {
38
+ $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'];
39
+ $baseSalePriceInclVat = $voucher['base_emag_sale_price'] + $voucher['base_emag_sale_price_vat'];
40
+
41
+ $emagVouchersValue += $salePriceInclVat;
42
+ $baseEmagVouchersValue += $baseSalePriceInclVat;
43
  }
44
 
45
  $grandTotal = $invoice->getGrandTotal() + $emagVouchersValue;
app/code/local/Innobyte/EmagMarketplace/Model/Sales/Quote/Address/Total/Voucher.php CHANGED
@@ -41,8 +41,11 @@ class Innobyte_EmagMarketplace_Model_Sales_Quote_Address_Total_Voucher
41
  }
42
 
43
  foreach ($vouchers as $voucher) {
44
- $emagVouchersValue += $voucher['emag_sale_price'];
45
- $baseEmagVouchersValue += $voucher['base_emag_sale_price'];
 
 
 
46
  }
47
 
48
  $grandTotal = $address->getGrandTotal() + $emagVouchersValue;
41
  }
42
 
43
  foreach ($vouchers as $voucher) {
44
+ $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'];
45
+ $baseSalePriceInclVat = $voucher['base_emag_sale_price'] + $voucher['base_emag_sale_price_vat'];
46
+
47
+ $emagVouchersValue += $salePriceInclVat;
48
+ $baseEmagVouchersValue += $baseSalePriceInclVat;
49
  }
50
 
51
  $grandTotal = $address->getGrandTotal() + $emagVouchersValue;
app/code/local/Innobyte/EmagMarketplace/Model/Source/Attribute/Sync/Status.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Innobyte_EmagMarketplace_Model_Source_Attribute_Sync_Status
5
+ *
6
+ * @category Innobyte
7
+ * @package Innobyte_EmagMarketplace
8
+ *
9
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
10
+ */
11
+ class Innobyte_EmagMarketplace_Model_Source_Attribute_Sync_Status
12
+ {
13
+
14
+ /**
15
+ * Attribute options
16
+ *
17
+ * @var null
18
+ */
19
+ protected $_options = null;
20
+
21
+ /**
22
+ * Retrieve data helper
23
+ *
24
+ * @return Innobyte_EmagMarketplace_Helper_Data
25
+ */
26
+ protected function _getHelper()
27
+ {
28
+ return Mage::helper('innobyte_emag_marketplace');
29
+ }
30
+
31
+ /**
32
+ * Retrieve option array
33
+ *
34
+ * @return array
35
+ */
36
+ public function getAllOptions()
37
+ {
38
+ if (is_null($this->_options)) {
39
+ $this->_options = array(
40
+ array(
41
+ 'value' => Innobyte_EmagMarketplace_Model_Product::IS_SYNCED,
42
+ 'label' => $this->_getHelper()->__('Yes')
43
+ ),
44
+ array(
45
+ 'value' => Innobyte_EmagMarketplace_Model_Product::IS_NOT_SYNCED,
46
+ 'label' => $this->_getHelper()->__('No')
47
+ ),
48
+ );
49
+ }
50
+
51
+ return $this->_options;
52
+ }
53
+
54
+ /**
55
+ * Retrieve option array
56
+ *
57
+ * @return array
58
+ */
59
+ public function toOptionArray()
60
+ {
61
+ $_options = array();
62
+ foreach ($this->getAllOptions() as $option) {
63
+ $_options[$option['value']] = $option['label'];
64
+ }
65
+ return $_options;
66
+ }
67
+
68
+ }
app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Abstract.php CHANGED
@@ -79,7 +79,7 @@ class Innobyte_EmagMarketplace_Model_System_Config_Backend_Prefix_Abstract exten
79
  $storeCode = Mage::app()->getRequest()->getParam('store');
80
 
81
  // exit if invoice prefix is not defined
82
- if (!$prefix) {
83
  return $this;
84
  }
85
 
@@ -98,6 +98,11 @@ class Innobyte_EmagMarketplace_Model_System_Config_Backend_Prefix_Abstract exten
98
  return $this;
99
  }
100
 
 
 
 
 
 
101
  try {
102
  $entityType = $this->getEntityType();
103
  $entityTypeModel = $this->getEntityTypeModel($entityType);
79
  $storeCode = Mage::app()->getRequest()->getParam('store');
80
 
81
  // exit if invoice prefix is not defined
82
+ if (!$prefix && !$this->isValueChanged()) {
83
  return $this;
84
  }
85
 
98
  return $this;
99
  }
100
 
101
+ // set store id as value if prefix is empty
102
+ if (!$prefix && $this->isValueChanged()) {
103
+ $prefix = $store->getId();
104
+ }
105
+
106
  try {
107
  $entityType = $this->getEntityType();
108
  $entityTypeModel = $this->getEntityTypeModel($entityType);
app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Creditmemo.php CHANGED
@@ -17,7 +17,7 @@ class Innobyte_EmagMarketplace_Model_System_Config_Backend_Prefix_Creditmemo
17
  *
18
  * @var array
19
  */
20
- protected $_entityType = 'creditmemo';
21
 
22
  /**
23
  * Set prefix value
17
  *
18
  * @var array
19
  */
20
+ protected $_entityType = 'emag_creditmemo';
21
 
22
  /**
23
  * Set prefix value
app/code/local/Innobyte/EmagMarketplace/Model/System/Config/Backend/Prefix/Invoice.php CHANGED
@@ -17,7 +17,7 @@ class Innobyte_EmagMarketplace_Model_System_Config_Backend_Prefix_Invoice
17
  *
18
  * @var array
19
  */
20
- protected $_entityType = 'invoice';
21
 
22
  /**
23
  * Set prefix value
17
  *
18
  * @var array
19
  */
20
+ protected $_entityType = 'emag_invoice';
21
 
22
  /**
23
  * Set prefix value
app/code/local/Innobyte/EmagMarketplace/controllers/Adminhtml/Emag/ProductController.php CHANGED
@@ -172,6 +172,12 @@ class Innobyte_EmagMarketplace_Adminhtml_Emag_ProductController
172
  $emagProduct
173
  ->setIsSynced(Innobyte_EmagMarketplace_Model_Product::IS_SYNCED)
174
  ->save();
 
 
 
 
 
 
175
  }
176
  if (!count($apiResp->getMessages())) { // check for warnings
177
  if ('product' === $sendType) {
@@ -311,6 +317,12 @@ class Innobyte_EmagMarketplace_Adminhtml_Emag_ProductController
311
  $emagProd
312
  ->setIsSynced(Innobyte_EmagMarketplace_Model_Product::IS_SYNCED)
313
  ->save();
 
 
 
 
 
 
314
  }
315
  $successfullySentIds[] = $prodId;
316
  }
172
  $emagProduct
173
  ->setIsSynced(Innobyte_EmagMarketplace_Model_Product::IS_SYNCED)
174
  ->save();
175
+
176
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
177
+ array($productId),
178
+ array('emag_is_synced' => Innobyte_EmagMarketplace_Model_Product::IS_SYNCED),
179
+ $emagProduct->getStoreId()
180
+ );
181
  }
182
  if (!count($apiResp->getMessages())) { // check for warnings
183
  if ('product' === $sendType) {
317
  $emagProd
318
  ->setIsSynced(Innobyte_EmagMarketplace_Model_Product::IS_SYNCED)
319
  ->save();
320
+
321
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
322
+ array($prodId),
323
+ array('emag_is_synced' => Innobyte_EmagMarketplace_Model_Product::IS_SYNCED),
324
+ $storeId
325
+ );
326
  }
327
  $successfullySentIds[] = $prodId;
328
  }
app/code/local/Innobyte/EmagMarketplace/controllers/Adminhtml/Sales/OrderController.php CHANGED
@@ -61,7 +61,7 @@ class Innobyte_EmagMarketplace_Adminhtml_Sales_OrderController extends Mage_Admi
61
 
62
  if ($response->isError()) {
63
  $this->_getSession()->addError(
64
- $this->getHelper()->__(
65
  'eMAG Api Response => %s', implode(',', $response->getMessages())
66
  )
67
  );
@@ -95,36 +95,202 @@ class Innobyte_EmagMarketplace_Adminhtml_Sales_OrderController extends Mage_Admi
95
  * Change order status to:
96
  * - emag_prepared
97
  */
98
- public function emagprepareAction()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  {
100
  $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_PREPARED;
101
- $this->_updateStatus($status);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
  /**
105
  * Change order status to:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  * - emag_canceled
107
  */
108
- public function emagcancelAction()
109
  {
110
  $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_CANCELED;
111
- $this->_updateStatus($status);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
 
114
  /**
115
  * Update eMAG order status
116
  *
117
- * @param $status
 
118
  */
119
- public function _updateStatus($status)
120
  {
121
- $orderId = $this->getRequest()->getParam('order_id');
122
  /** @var $order Mage_Sales_Model_Order */
123
  $order = Mage::getModel('sales/order')->load($orderId);
124
  if (!$order->getEmagOrderId()) {
125
- $this->_getSession()->addError('Not an eMAG order!');
126
- $this->_redirect('*/*/view', array('_current' => true));
127
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
 
130
  try {
@@ -133,17 +299,9 @@ class Innobyte_EmagMarketplace_Adminhtml_Sales_OrderController extends Mage_Admi
133
  $order->setOrderId($orderId);
134
  $order->setStatus($status);
135
  $order->convert();
136
-
137
- $this->_getSession()->addSuccess(
138
- $this->_getHelper()->__('Order successfully synced with eMAG.')
139
- );
140
  } catch (Exception $e) {
141
- $this->_getSession()->addError(
142
- $this->_getHelper()->__($e->getMessage())
143
- );
144
  }
145
-
146
- $this->_redirect('*/*/view', array('_current' => true));
147
  }
148
 
149
  /**
@@ -155,13 +313,13 @@ class Innobyte_EmagMarketplace_Adminhtml_Sales_OrderController extends Mage_Admi
155
  {
156
  $action = strtolower($this->getRequest()->getActionName());
157
  switch ($action) {
158
- case 'emagacknowledge':
159
  $aclResource = 'sales/order/actions/emag_acknowledge';
160
  break;
161
- case 'emagprepare':
162
  $aclResource = 'sales/order/actions/emag_prepare';
163
  break;
164
- case 'emagcancel':
165
  $aclResource = 'sales/order/actions/emag_cancel';
166
  break;
167
  default:
61
 
62
  if ($response->isError()) {
63
  $this->_getSession()->addError(
64
+ $this->_getHelper()->__(
65
  'eMAG Api Response => %s', implode(',', $response->getMessages())
66
  )
67
  );
95
  * Change order status to:
96
  * - emag_prepared
97
  */
98
+ public function emagPrepareAction()
99
+ {
100
+ try {
101
+ $orderId = $this->getRequest()->getParam('order_id');
102
+ $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_PREPARED;
103
+ $this->_updateStatus($status, $orderId);
104
+
105
+ $this->_getSession()->addSuccess(
106
+ $this->_getHelper()->__('Order successfully synced with eMAG.')
107
+ );
108
+ } catch (Exception $e) {
109
+ $this->_getSession()->addError(
110
+ $this->_getHelper()->__($e->getMessage())
111
+ );
112
+ }
113
+
114
+ $this->_redirect('*/*/view', array('_current' => true));
115
+ }
116
+
117
+ /**
118
+ * Mass change order status to:
119
+ * - emag_prepared
120
+ */
121
+ public function massEmagPrepareAction()
122
  {
123
  $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_PREPARED;
124
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
125
+ $countPrepareOrder = 0;
126
+ $countNonPrepareOrder = 0;
127
+ foreach ($orderIds as $orderId) {
128
+ try{
129
+ $this->_updateStatus($status, $orderId);
130
+ $countPrepareOrder++;
131
+ }
132
+ catch(Exception $e) {
133
+ $countNonPrepareOrder++;
134
+ }
135
+ }
136
+ if ($countNonPrepareOrder) {
137
+ if ($countPrepareOrder) {
138
+ $this->_getSession()->addError($this->__('%s order(s) cannot be prepared.', $countNonPrepareOrder));
139
+ } else {
140
+ $this->_getSession()->addError($this->__('The order(s) cannot be prepared.'));
141
+ }
142
+ }
143
+ if ($countPrepareOrder) {
144
+ $this->_getSession()->addSuccess($this->__('%s order(s) have been prepared.', $countPrepareOrder));
145
+ }
146
+
147
+ $this->_redirect('*/*/');
148
  }
149
 
150
  /**
151
  * Change order status to:
152
+ * - emag_finalized
153
+ */
154
+ public function emagFinalizeAction()
155
+ {
156
+ try {
157
+ $orderId = $this->getRequest()->getParam('order_id');
158
+ $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_FINALIZED;
159
+ $this->_updateStatus($status, $orderId);
160
+
161
+ $this->_getSession()->addSuccess(
162
+ $this->_getHelper()->__('Order successfully synced with eMAG.')
163
+ );
164
+ } catch (Exception $e) {
165
+ $this->_getSession()->addError(
166
+ $this->_getHelper()->__($e->getMessage())
167
+ );
168
+ }
169
+
170
+ $this->_redirect('*/*/view', array('_current' => true));
171
+ }
172
+
173
+ /**
174
+ * Mass change order status to:
175
+ * - emag_finalized
176
+ */
177
+ public function massEmagFinalizeAction()
178
+ {
179
+ $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_FINALIZED;
180
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
181
+ $countFinalizeOrder = 0;
182
+ $countNonFinalizeOrder = 0;
183
+ foreach ($orderIds as $orderId) {
184
+ try{
185
+ $this->_updateStatus($status, $orderId);
186
+ $countFinalizeOrder++;
187
+ }
188
+ catch(Exception $e) {
189
+ $countNonFinalizeOrder++;
190
+ }
191
+ }
192
+ if ($countNonFinalizeOrder) {
193
+ if ($countFinalizeOrder) {
194
+ $this->_getSession()->addError($this->__('%s order(s) cannot be finalized.', $countNonFinalizeOrder));
195
+ } else {
196
+ $this->_getSession()->addError($this->__('The order(s) cannot be finalized.'));
197
+ }
198
+ }
199
+ if ($countFinalizeOrder) {
200
+ $this->_getSession()->addSuccess($this->__('%s order(s) have been finalized.', $countFinalizeOrder));
201
+ }
202
+
203
+ $this->_redirect('*/*/');
204
+ }
205
+
206
+ /**
207
+ * Change order status to:
208
+ * - emag_canceled
209
+ */
210
+ public function emagCancelAction()
211
+ {
212
+ try {
213
+ $orderId = $this->getRequest()->getParam('order_id');
214
+ $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_CANCELED;
215
+ $this->_updateStatus($status, $orderId);
216
+
217
+ $this->_getSession()->addSuccess(
218
+ $this->_getHelper()->__('Order successfully synced with eMAG.')
219
+ );
220
+ } catch (Exception $e) {
221
+ $this->_getSession()->addError(
222
+ $this->_getHelper()->__($e->getMessage())
223
+ );
224
+ }
225
+
226
+ $this->_redirect('*/*/view', array('_current' => true));
227
+ }
228
+
229
+ /**
230
+ * Mass change order status to:
231
  * - emag_canceled
232
  */
233
+ public function massEmagCancelAction()
234
  {
235
  $status = Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_CANCELED;
236
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
237
+ $countCancelOrder = 0;
238
+ $countNonCancelOrder = 0;
239
+ foreach ($orderIds as $orderId) {
240
+ try{
241
+ $this->_updateStatus($status, $orderId);
242
+ $countCancelOrder++;
243
+ }
244
+ catch(Exception $e) {
245
+ $countNonCancelOrder++;
246
+ }
247
+ }
248
+ if ($countNonCancelOrder) {
249
+ if ($countCancelOrder) {
250
+ $this->_getSession()->addError($this->__('%s order(s) cannot be canceled.', $countNonCancelOrder));
251
+ } else {
252
+ $this->_getSession()->addError($this->__('The order(s) cannot be canceled.'));
253
+ }
254
+ }
255
+ if ($countCancelOrder) {
256
+ $this->_getSession()->addSuccess($this->__('%s order(s) have been canceled.', $countCancelOrder));
257
+ }
258
+
259
+ $this->_redirect('*/*/');
260
  }
261
 
262
  /**
263
  * Update eMAG order status
264
  *
265
+ * @param string $status
266
+ * @param int $orderId
267
  */
268
+ public function _updateStatus($status, $orderId)
269
  {
 
270
  /** @var $order Mage_Sales_Model_Order */
271
  $order = Mage::getModel('sales/order')->load($orderId);
272
  if (!$order->getEmagOrderId()) {
273
+ Mage::throwException('Not an eMAG order!');
274
+ }
275
+
276
+ /** @var $model Innobyte_EmagMarketplace_Model_Sales_Order */
277
+ $model = Mage::getModel('innobyte_emag_marketplace/sales_order');
278
+ switch ($status) {
279
+ case Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_PREPARED:
280
+ if (!$model->canPrepare($order)) {
281
+ Mage::throwException('Order #%s can not be prepared!', $order->getIncrementId());
282
+ }
283
+ break;
284
+ case Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_FINALIZED:
285
+ if (!$model->canFinalize($order)) {
286
+ Mage::throwException('Order #%s can not be finalized!', $order->getIncrementId());
287
+ }
288
+ break;
289
+ case Innobyte_EmagMarketplace_Model_Order_Convert_Abstract::STATUS_CANCELED:
290
+ if (!$model->canCancel($order)) {
291
+ Mage::throwException('Order #%s can not be canceled!', $order->getIncrementId());
292
+ }
293
+ break;
294
  }
295
 
296
  try {
299
  $order->setOrderId($orderId);
300
  $order->setStatus($status);
301
  $order->convert();
 
 
 
 
302
  } catch (Exception $e) {
303
+ Mage::throwException($e->getMessage());
 
 
304
  }
 
 
305
  }
306
 
307
  /**
313
  {
314
  $action = strtolower($this->getRequest()->getActionName());
315
  switch ($action) {
316
+ case 'emagAcknowledge':
317
  $aclResource = 'sales/order/actions/emag_acknowledge';
318
  break;
319
+ case 'emagPrepare':
320
  $aclResource = 'sales/order/actions/emag_prepare';
321
  break;
322
+ case 'emagCancel':
323
  $aclResource = 'sales/order/actions/emag_cancel';
324
  break;
325
  default:
app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_product_setup/data-upgrade-1.1.5-1.1.6.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @deprecated since version 1.1.7
5
+ */
app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_product_setup/data-upgrade-1.1.6-1.1.7.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Update emag_is_synced product attribute
4
+ $collection = Mage::getModel('innobyte_emag_marketplace/product')->getCollection();
5
+ foreach ($collection as $product) {
6
+
7
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
8
+ array($product->getProductId()),
9
+ array('emag_is_synced' => $product->getIsSynced()),
10
+ Mage_Core_Model_App::ADMIN_STORE_ID
11
+ );
12
+
13
+ Mage::getResourceSingleton('catalog/product_action')->updateAttributes(
14
+ array($product->getProductId()),
15
+ array('emag_is_synced' => $product->getIsSynced()),
16
+ $product->getStoreId()
17
+ );
18
+ }
app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_setup/data-upgrade-1.1.4-1.1.5.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Update weee tax for eMAG order items
4
+ $collection = Mage::getModel('sales/order')->getCollection();
5
+ $collection->getSelect()->joinInner(array(
6
+ 'emag_sales_order' => Mage::getSingleton('core/resource')->getTableName('innobyte_emag_marketplace/sales_order')),
7
+ 'main_table.entity_id = emag_sales_order.entity_id',
8
+ array('emag_sales_order.emag_order_id'),
9
+ null
10
+ );
11
+
12
+ foreach ($collection as $order) {
13
+ if (!$order->getEmagOrderId()) {
14
+ continue;
15
+ }
16
+ /** @var $item Mage_Sales_Model_Order_Item */
17
+ foreach ($order->getAllItems() as $item) {
18
+ $item->setGiftMessageAvailable(0)
19
+ ->setBaseWeeeTaxAppliedAmount(0)
20
+ ->setBaseWeeeTaxAppliedRowAmnt(0)
21
+ ->setWeeeTaxAppliedAmount(0)
22
+ ->setWeeeTaxAppliedRowAmount(0)
23
+ ->setWeeeTaxApplied(serialize(array()))
24
+ ->setWeeeTaxDisposition(0)
25
+ ->setWeeeTaxRowDisposition(0)
26
+ ->setBaseWeeeTaxDisposition(0)
27
+ ->setBaseWeeeTaxRowDisposition(0);
28
+ $item->save();
29
+ }
30
+ }
app/code/local/Innobyte/EmagMarketplace/data/innobyte_emag_marketplace_setup/data-upgrade-1.1.7-1.1.8.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Populate sku column for eMAG products table
4
+ $collection = Mage::getModel('innobyte_emag_marketplace/product')->getCollection();
5
+ foreach ($collection as $product) {
6
+
7
+ /** @var $magentoProduct Mage_Catalog_Model_Product */
8
+ $magentoProduct = Mage::getModel('catalog/product')->load($product->getProductId());
9
+ $product->setSku($magentoProduct->getSku());
10
+ $product->save();
11
+ }
app/code/local/Innobyte/EmagMarketplace/etc/config.xml CHANGED
@@ -1,7 +1,7 @@
1
  <config>
2
  <modules>
3
  <Innobyte_EmagMarketplace>
4
- <version>1.0.4</version>
5
  </Innobyte_EmagMarketplace>
6
  </modules>
7
  <global>
@@ -106,6 +106,15 @@
106
  <use>core_setup</use>
107
  </connection>
108
  </innobyte_emag_marketplace_setup>
 
 
 
 
 
 
 
 
 
109
  <innobyte_emag_marketplace_write>
110
  <connection>
111
  <use>core_write</use>
@@ -250,6 +259,24 @@
250
  </observers>
251
  </sales_order_creditmemo_load_after>
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  <!--ENTITY ADDRESS AFTER SAVE-->
254
  <sales_quote_address_save_after>
255
  <observers>
@@ -463,6 +490,47 @@
463
  </innobyte_emag_marketplace>
464
  </observers>
465
  </adminhtml_sales_order_create_process_data_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  </events>
467
  <layout>
468
  <updates>
@@ -550,11 +618,15 @@
550
 
551
  <Innobyte_EmagMarketplace>
552
  <general_settings>
 
553
  <template>Innobyte_EmagMarketplace_general_settings_template</template>
554
  </general_settings>
555
  <api_settings>
556
  <password backend_model="adminhtml/system_config_backend_encrypted"/>
557
  </api_settings>
 
 
 
558
  </Innobyte_EmagMarketplace>
559
 
560
  <!-- api call settings, can be overridden easely in modules that <depends> on this one -->
1
  <config>
2
  <modules>
3
  <Innobyte_EmagMarketplace>
4
+ <version>1.1.9</version>
5
  </Innobyte_EmagMarketplace>
6
  </modules>
7
  <global>
106
  <use>core_setup</use>
107
  </connection>
108
  </innobyte_emag_marketplace_setup>
109
+ <innobyte_emag_marketplace_product_setup>
110
+ <setup>
111
+ <module>Innobyte_EmagMarketplace</module>
112
+ <class>Mage_Catalog_Model_Resource_Setup</class>
113
+ </setup>
114
+ <connection>
115
+ <use>core_setup</use>
116
+ </connection>
117
+ </innobyte_emag_marketplace_product_setup>
118
  <innobyte_emag_marketplace_write>
119
  <connection>
120
  <use>core_write</use>
259
  </observers>
260
  </sales_order_creditmemo_load_after>
261
 
262
+ <!--SALES ENTITY BEFORE SAVE-->
263
+ <sales_order_invoice_save_before>
264
+ <observers>
265
+ <innobyte_emag_marketplace>
266
+ <class>innobyte_emag_marketplace/sales_observer</class>
267
+ <method>invoiceBeforeSave</method>
268
+ </innobyte_emag_marketplace>
269
+ </observers>
270
+ </sales_order_invoice_save_before>
271
+ <sales_order_creditmemo_save_before>
272
+ <observers>
273
+ <innobyte_emag_marketplace>
274
+ <class>innobyte_emag_marketplace/sales_observer</class>
275
+ <method>creditmemoBeforeSave</method>
276
+ </innobyte_emag_marketplace>
277
+ </observers>
278
+ </sales_order_creditmemo_save_before>
279
+
280
  <!--ENTITY ADDRESS AFTER SAVE-->
281
  <sales_quote_address_save_after>
282
  <observers>
490
  </innobyte_emag_marketplace>
491
  </observers>
492
  </adminhtml_sales_order_create_process_data_before>
493
+
494
+ <!--ADD eMAG ORDER ID COLUMN TO SALES ORDER GRID-->
495
+ <sales_order_grid_collection_load_before>
496
+ <observers>
497
+ <innobyte_emag_marketplace>
498
+ <model>innobyte_emag_marketplace/sales_observer</model>
499
+ <method>addGridColumnsToSelect</method>
500
+ </innobyte_emag_marketplace>
501
+ </observers>
502
+ </sales_order_grid_collection_load_before>
503
+ <!--END ADD eMAG ORDER ID COLUMN TO SALES ORDER GRID-->
504
+
505
+ <!--ADD eMAG mass actions TO SALES ORDER GRID-->
506
+ <core_block_abstract_prepare_layout_before>
507
+ <observers>
508
+ <innobyte_emag_marketplace_order_massactions>
509
+ <class>innobyte_emag_marketplace/sales_observer</class>
510
+ <method>addOrderMassActions</method>
511
+ </innobyte_emag_marketplace_order_massactions>
512
+ </observers>
513
+ </core_block_abstract_prepare_layout_before>
514
+ <!--END ADD eMAG mass actions TO SALES ORDER GRID-->
515
+
516
+ <!--ADD eMAG is_synced COLUMN TO PRODUCT GRID-->
517
+ <core_block_abstract_prepare_layout_before>
518
+ <observers>
519
+ <innobyte_emag_marketplace>
520
+ <class>innobyte_emag_marketplace/catalog_product_observer</class>
521
+ <method>addGridColumns</method>
522
+ </innobyte_emag_marketplace>
523
+ </observers>
524
+ </core_block_abstract_prepare_layout_before>
525
+ <catalog_product_collection_load_before>
526
+ <observers>
527
+ <innobyte_emag_marketplace>
528
+ <class>innobyte_emag_marketplace/catalog_product_observer</class>
529
+ <method>addGridColumnsToSelect</method>
530
+ </innobyte_emag_marketplace>
531
+ </observers>
532
+ </catalog_product_collection_load_before>
533
+ <!--END ADD eMAG is_synced COLUMN TO PRODUCT GRID-->
534
  </events>
535
  <layout>
536
  <updates>
618
 
619
  <Innobyte_EmagMarketplace>
620
  <general_settings>
621
+ <domain>emag.ro</domain>
622
  <template>Innobyte_EmagMarketplace_general_settings_template</template>
623
  </general_settings>
624
  <api_settings>
625
  <password backend_model="adminhtml/system_config_backend_encrypted"/>
626
  </api_settings>
627
+ <invoice_creditmemo_settings>
628
+ <use_third_party_invoices>0</use_third_party_invoices>
629
+ </invoice_creditmemo_settings>
630
  </Innobyte_EmagMarketplace>
631
 
632
  <!-- api call settings, can be overridden easely in modules that <depends> on this one -->
app/code/local/Innobyte/EmagMarketplace/etc/system.xml CHANGED
@@ -1,5 +1,11 @@
1
  <?xml version="1.0"?>
2
- <config>
 
 
 
 
 
 
3
  <sections>
4
  <Innobyte_EmagMarketplace translate="label" module="innobyte_emag_marketplace">
5
  <label>eMAG Marketplace</label>
@@ -10,76 +16,6 @@
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>1</show_in_store>
12
  <groups>
13
- <license translate="label" module="innobyte_core">
14
- <label>License</label>
15
- <frontend_type>text</frontend_type>
16
- <frontend_model>innobyte_core/system_config_form_fieldset_extensions</frontend_model>
17
- <sort_order>1</sort_order>
18
- <show_in_default>1</show_in_default>
19
- <show_in_website>1</show_in_website>
20
- <show_in_store>0</show_in_store>
21
- <fields>
22
- <ar translate="label">
23
- <label>ar</label>
24
- <frontend_type>text</frontend_type>
25
- <sort_order>20</sort_order>
26
- <show_in_default>0</show_in_default>
27
- <show_in_website>0</show_in_website>
28
- <show_in_store>0</show_in_store>
29
- </ar>
30
- <websites translate="label">
31
- <label>websites</label>
32
- <frontend_type>text</frontend_type>
33
- <sort_order>20</sort_order>
34
- <show_in_default>0</show_in_default>
35
- <show_in_website>0</show_in_website>
36
- <show_in_store>0</show_in_store>
37
- </websites>
38
- <time translate="label">
39
- <label>Time</label>
40
- <frontend_type>text</frontend_type>
41
- <sort_order>20</sort_order>
42
- <show_in_default>0</show_in_default>
43
- <show_in_website>0</show_in_website>
44
- <show_in_store>0</show_in_store>
45
- </time>
46
- <installed translate="label">
47
- <label>Installed</label>
48
- <frontend_type>text</frontend_type>
49
- <sort_order>20</sort_order>
50
- <show_in_default>0</show_in_default>
51
- <show_in_website>0</show_in_website>
52
- <show_in_store>0</show_in_store>
53
- </installed>
54
- <count translate="label">
55
- <label>Installed</label>
56
- <frontend_type>text</frontend_type>
57
- <sort_order>20</sort_order>
58
- <show_in_default>0</show_in_default>
59
- <show_in_website>0</show_in_website>
60
- <show_in_store>0</show_in_store>
61
- </count>
62
- <key translate="label">
63
- <label>License key</label>
64
- <frontend_type>text</frontend_type>
65
- <sort_order>20</sort_order>
66
- <show_in_default>1</show_in_default>
67
- <show_in_website>1</show_in_website>
68
- <show_in_store>0</show_in_store>
69
- </key>
70
- <enabled translate="label">
71
- <label>Enable Extension</label>
72
- <frontend_type>select</frontend_type>
73
- <frontend_model>innobyte_core/system_config_form_renderer_field</frontend_model>
74
- <source_model>innobyte_core/source_config_enabledisable</source_model>
75
- <sort_order>10</sort_order>
76
- <show_in_default>1</show_in_default>
77
- <show_in_website>1</show_in_website>
78
- <show_in_store>0</show_in_store>
79
- <hint>Innobyte_EmagMarketplace</hint>
80
- </enabled>
81
- </fields>
82
- </license>
83
  <general_settings translate="label" module="innobyte_emag_marketplace">
84
  <label>General Settings</label>
85
  <frontend_type>text</frontend_type>
@@ -98,16 +34,6 @@
98
  <show_in_store>1</show_in_store>
99
  <comment><![CDATA[Enable/Disable extension.]]></comment>
100
  </active>
101
- <debug translate="label comment">
102
- <label>Debug</label>
103
- <frontend_type>select</frontend_type>
104
- <source_model>adminhtml/system_config_source_yesno</source_model>
105
- <sort_order>10</sort_order>
106
- <show_in_default>1</show_in_default>
107
- <show_in_website>0</show_in_website>
108
- <show_in_store>1</show_in_store>
109
- <comment><![CDATA[Enable debug mode.]]></comment>
110
- </debug>
111
  <domain translate="label comment">
112
  <label>eMAG Domain</label>
113
  <frontend_type>text</frontend_type>
@@ -116,6 +42,7 @@
116
  <show_in_website>0</show_in_website>
117
  <show_in_store>1</show_in_store>
118
  <comment><![CDATA[eMAG Marketplace domain in your country. (Ex: emag.ro)]]></comment>
 
119
  </domain>
120
  <allowed_ip_addresses>
121
  <label>Allowed IP Addresses</label>
@@ -196,8 +123,9 @@
196
  <show_in_default>0</show_in_default>
197
  <show_in_website>0</show_in_website>
198
  <show_in_store>1</show_in_store>
199
- <comment><![CDATA[Api URL provided by eMAG.]]></comment>
200
  <validate>validate-url</validate>
 
201
  </url>
202
  <username translate="label comment">
203
  <label>Api Username</label>
@@ -207,6 +135,7 @@
207
  <show_in_website>0</show_in_website>
208
  <show_in_store>1</show_in_store>
209
  <comment><![CDATA[Api username provided by eMAG.]]></comment>
 
210
  </username>
211
  <password translate="label comment">
212
  <label>Api Password</label>
@@ -217,6 +146,7 @@
217
  <show_in_website>0</show_in_website>
218
  <show_in_store>1</show_in_store>
219
  <comment><![CDATA[Api password provided by eMAG.]]></comment>
 
220
  </password>
221
  <code translate="label comment">
222
  <label>Client Code</label>
@@ -226,6 +156,7 @@
226
  <show_in_website>0</show_in_website>
227
  <show_in_store>1</show_in_store>
228
  <comment><![CDATA[Client code provided by eMAG.]]></comment>
 
229
  </code>
230
  </fields>
231
  </api_settings>
@@ -237,6 +168,16 @@
237
  <show_in_website>0</show_in_website>
238
  <show_in_store>1</show_in_store>
239
  <fields>
 
 
 
 
 
 
 
 
 
 
240
  <invoice_prefix translate="label comment">
241
  <label>Invoice Prefix</label>
242
  <frontend_type>text</frontend_type>
@@ -247,9 +188,12 @@
247
  <show_in_website>0</show_in_website>
248
  <show_in_store>1</show_in_store>
249
  <comment>
250
- <![CDATA[Define invoice prefix. Leave blank to use Magento default invoice prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style="color:orange">Maximum length 10 characters.</span>]]>
251
  </comment>
252
- <validate>validate-length maximum-length-10</validate>
 
 
 
253
  </invoice_prefix>
254
  <creditmemo_prefix translate="label comment">
255
  <label>Creditmemo Prefix</label>
@@ -261,9 +205,12 @@
261
  <show_in_website>0</show_in_website>
262
  <show_in_store>1</show_in_store>
263
  <comment>
264
- <![CDATA[Define creditmemo prefix. Leave blank to use Magento default creditmemo prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style="color:orange">Maximum length 10 characters.</span>]]>
265
  </comment>
266
- <validate>validate-length maximum-length-10</validate>
 
 
 
267
  </creditmemo_prefix>
268
  </fields>
269
  </invoice_creditmemo_settings>
@@ -283,7 +230,7 @@
283
  <show_in_default>0</show_in_default>
284
  <show_in_website>0</show_in_website>
285
  <show_in_store>1</show_in_store>
286
- <comment><![CDATA[URL where to read AWB 's PDF from.<br/>Ex: https://mktp-stage.emag.ro/awb/read_pdf]]></comment>
287
  </awb_pdf_url>
288
  <courier_account_id translate="label comment">
289
  <label>Courier Account Id</label>
@@ -296,6 +243,52 @@
296
  </courier_account_id>
297
  </fields>
298
  </shipping_settings>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  </groups>
300
  </Innobyte_EmagMarketplace>
301
 
1
  <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <innobyte_core>
5
+ <label>Innobyte Extensions</label>
6
+ <sort_order>1</sort_order>
7
+ </innobyte_core>
8
+ </tabs>
9
  <sections>
10
  <Innobyte_EmagMarketplace translate="label" module="innobyte_emag_marketplace">
11
  <label>eMAG Marketplace</label>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <general_settings translate="label" module="innobyte_emag_marketplace">
20
  <label>General Settings</label>
21
  <frontend_type>text</frontend_type>
34
  <show_in_store>1</show_in_store>
35
  <comment><![CDATA[Enable/Disable extension.]]></comment>
36
  </active>
 
 
 
 
 
 
 
 
 
 
37
  <domain translate="label comment">
38
  <label>eMAG Domain</label>
39
  <frontend_type>text</frontend_type>
42
  <show_in_website>0</show_in_website>
43
  <show_in_store>1</show_in_store>
44
  <comment><![CDATA[eMAG Marketplace domain in your country. (Ex: emag.ro)]]></comment>
45
+ <validate>required-entry</validate>
46
  </domain>
47
  <allowed_ip_addresses>
48
  <label>Allowed IP Addresses</label>
123
  <show_in_default>0</show_in_default>
124
  <show_in_website>0</show_in_website>
125
  <show_in_store>1</show_in_store>
126
+ <comment><![CDATA[Api URL provided by eMAG.<br/><strong>Live:</strong> <span style="color:red">https://marketplace.emag.ro/api-3/</span> <br/><strong>Stage:</strong> <span style="color:red">https://mktp-stage.emag.ro/api-3/</span>]]></comment>
127
  <validate>validate-url</validate>
128
+ <validate>required-entry</validate>
129
  </url>
130
  <username translate="label comment">
131
  <label>Api Username</label>
135
  <show_in_website>0</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  <comment><![CDATA[Api username provided by eMAG.]]></comment>
138
+ <validate>required-entry</validate>
139
  </username>
140
  <password translate="label comment">
141
  <label>Api Password</label>
146
  <show_in_website>0</show_in_website>
147
  <show_in_store>1</show_in_store>
148
  <comment><![CDATA[Api password provided by eMAG.]]></comment>
149
+ <validate>required-entry</validate>
150
  </password>
151
  <code translate="label comment">
152
  <label>Client Code</label>
156
  <show_in_website>0</show_in_website>
157
  <show_in_store>1</show_in_store>
158
  <comment><![CDATA[Client code provided by eMAG.]]></comment>
159
+ <validate>required-entry</validate>
160
  </code>
161
  </fields>
162
  </api_settings>
168
  <show_in_website>0</show_in_website>
169
  <show_in_store>1</show_in_store>
170
  <fields>
171
+ <use_third_party_invoices>
172
+ <label>Use Third Party Invoices</label>
173
+ <frontend_type>select</frontend_type>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ <sort_order>1</sort_order>
176
+ <show_in_default>0</show_in_default>
177
+ <show_in_website>0</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ <comment><![CDATA[Use third party systems to generate invoices for eMAG orders. Set option to "No" to use magento invoices.]]></comment>
180
+ </use_third_party_invoices>
181
  <invoice_prefix translate="label comment">
182
  <label>Invoice Prefix</label>
183
  <frontend_type>text</frontend_type>
188
  <show_in_website>0</show_in_website>
189
  <show_in_store>1</show_in_store>
190
  <comment>
191
+ <![CDATA[Define invoice prefix. (Ex: <span style="color:red">EMAG</span>10000122) <br><strong>Note:</strong> <span style="color:orange">Maximum length 10 characters.</span>]]>
192
  </comment>
193
+ <depends>
194
+ <use_third_party_invoices>0</use_third_party_invoices>
195
+ </depends>
196
+ <validate>required-entry validate-length maximum-length-10</validate>
197
  </invoice_prefix>
198
  <creditmemo_prefix translate="label comment">
199
  <label>Creditmemo Prefix</label>
205
  <show_in_website>0</show_in_website>
206
  <show_in_store>1</show_in_store>
207
  <comment>
208
+ <![CDATA[Define creditmemo prefix. (Ex: <span style="color:red">EMAG</span>10000122) <br><strong>Note:</strong> <span style="color:orange">Maximum length 10 characters.</span>]]>
209
  </comment>
210
+ <depends>
211
+ <use_third_party_invoices>0</use_third_party_invoices>
212
+ </depends>
213
+ <validate>required-entry validate-length maximum-length-10</validate>
214
  </creditmemo_prefix>
215
  </fields>
216
  </invoice_creditmemo_settings>
230
  <show_in_default>0</show_in_default>
231
  <show_in_website>0</show_in_website>
232
  <show_in_store>1</show_in_store>
233
+ <comment><![CDATA[URL where to read AWB 's PDF from.<br/><strong>Live:</strong> <span style="color:red">https://marketplace.emag.ro/awb/read_pdf/</span> <br/><strong>Stage:</strong> <span style="color:red">https://mktp-stage.emag.ro/awb/read_pdf/</span>]]></comment>
234
  </awb_pdf_url>
235
  <courier_account_id translate="label comment">
236
  <label>Courier Account Id</label>
243
  </courier_account_id>
244
  </fields>
245
  </shipping_settings>
246
+ <debug_settings translate="label" module="innobyte_emag_marketplace">
247
+ <label>Debug Settings</label>
248
+ <frontend_type>text</frontend_type>
249
+ <sort_order>50</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>0</show_in_website>
252
+ <show_in_store>1</show_in_store>
253
+ <fields>
254
+ <enabled translate="label comment">
255
+ <label>Enable</label>
256
+ <frontend_type>select</frontend_type>
257
+ <source_model>adminhtml/system_config_source_yesno</source_model>
258
+ <sort_order>10</sort_order>
259
+ <show_in_default>1</show_in_default>
260
+ <show_in_website>0</show_in_website>
261
+ <show_in_store>1</show_in_store>
262
+ <comment><![CDATA[Enable debug mode.]]></comment>
263
+ </enabled>
264
+ <curl_ssl_verify translate="label comment">
265
+ <label>Disable SSL Verify</label>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>adminhtml/system_config_source_yesno</source_model>
268
+ <sort_order>20</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>0</show_in_website>
271
+ <show_in_store>1</show_in_store>
272
+ <depends>
273
+ <enabled>1</enabled>
274
+ </depends>
275
+ <comment><![CDATA[Disable CURL option "CURLOPT_SSL_VERIFYPEER" for API calls.]]></comment>
276
+ </curl_ssl_verify>
277
+ <curl_verbose_mode translate="label comment">
278
+ <label>Verbose Mode</label>
279
+ <frontend_type>select</frontend_type>
280
+ <source_model>adminhtml/system_config_source_yesno</source_model>
281
+ <sort_order>30</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>0</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ <depends>
286
+ <enabled>1</enabled>
287
+ </depends>
288
+ <comment><![CDATA[Enable CURL option "CURLOPT_VERBOSE" for API calls.]]></comment>
289
+ </curl_verbose_mode>
290
+ </fields>
291
+ </debug_settings>
292
  </groups>
293
  </Innobyte_EmagMarketplace>
294
 
app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_product_setup/upgrade-1.1.5-1.1.6.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add emag_is_synced product attribute
4
+ *
5
+ * @category Innobyte
6
+ * @package Innobyte_EmagMarketplace
7
+ *
8
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
9
+ */
10
+ ?>
11
+ <?php
12
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
13
+
14
+ $installer = $this;
15
+
16
+ $installer->startSetup();
17
+
18
+ $this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'emag_is_synced', array(
19
+ 'group' => 'General',
20
+ 'backend' => '',
21
+ 'frontend' => '',
22
+ 'type' => 'int',
23
+ 'input' => 'text',
24
+ 'label' => 'eMAG Synced',
25
+ 'source' => '',
26
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
27
+ 'default' => '0',
28
+ 'searchable' => false,
29
+ 'filterable' => false,
30
+ 'comparable' => false,
31
+ 'required' => false,
32
+ 'visible' => false,
33
+ 'user_defined' => false,
34
+ 'used_in_product_listing' => false,
35
+ 'unique' => false
36
+ ));
37
+
38
+ $installer->endSetup();
app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.0.6-1.1.0.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Installer script.
4
+ *
5
+ * @category Innobyte
6
+ * @package Innobyte_EmagMarketplace
7
+ *
8
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
9
+ * @author Bogdan Constantinescu <bogdan.constantinescu@innobyte.com>
10
+ */
11
+ ?>
12
+ <?php
13
+ /** @var $installer Mage_Sales_Model_Resource_Setup */
14
+ $installer = $this;
15
+
16
+ $installer->startSetup();
17
+
18
+ $emagSalesQuoteTable = $installer->getTable('innobyte_emag_marketplace/sales_quote');
19
+ $emagSalesOrderTable = $installer->getTable('innobyte_emag_marketplace/sales_order');
20
+ $emagSalesQuoteVoucherTable = $installer->getTable('innobyte_emag_marketplace/sales_quote_voucher');
21
+ $emagSalesOrderVoucherTable = $installer->getTable('innobyte_emag_marketplace/sales_order_voucher');
22
+
23
+
24
+ $installer->getConnection()->changeColumn(
25
+ $emagSalesQuoteTable,
26
+ 'emag_order_id',
27
+ 'emag_order_id',
28
+ array(
29
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
30
+ )
31
+ );
32
+ $installer->getConnection()->changeColumn(
33
+ $emagSalesQuoteTable,
34
+ 'emag_customer_id',
35
+ 'emag_customer_id',
36
+ array(
37
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
38
+ )
39
+ );
40
+ $installer->getConnection()->changeColumn(
41
+ $emagSalesOrderTable,
42
+ 'emag_order_id',
43
+ 'emag_order_id',
44
+ array(
45
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
46
+ )
47
+ );
48
+ $installer->getConnection()->changeColumn(
49
+ $emagSalesOrderTable,
50
+ 'emag_customer_id',
51
+ 'emag_customer_id',
52
+ array(
53
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
54
+ )
55
+ );
56
+ $installer->getConnection()->changeColumn(
57
+ $emagSalesQuoteVoucherTable,
58
+ 'emag_id',
59
+ 'emag_id',
60
+ array(
61
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
62
+ )
63
+ );
64
+ $installer->getConnection()->changeColumn(
65
+ $emagSalesQuoteVoucherTable,
66
+ 'emag_voucher_id',
67
+ 'emag_voucher_id',
68
+ array(
69
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
70
+ )
71
+ );
72
+ $installer->getConnection()->changeColumn(
73
+ $emagSalesOrderVoucherTable,
74
+ 'emag_id',
75
+ 'emag_id',
76
+ array(
77
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
78
+ )
79
+ );
80
+ $installer->getConnection()->changeColumn(
81
+ $emagSalesOrderVoucherTable,
82
+ 'emag_voucher_id',
83
+ 'emag_voucher_id',
84
+ array(
85
+ 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
86
+ )
87
+ );
88
+
89
+
90
+
app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.4-1.1.5.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add eMAG attribute for price attribute
4
+ *
5
+ * @category Innobyte
6
+ * @package Innobyte_EmagMarketplace
7
+ *
8
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
9
+ */
10
+ ?>
11
+ <?php
12
+ /** @var $installer Mage_Sales_Model_Resource_Setup */
13
+
14
+ $installer = $this;
15
+
16
+ $installer->startSetup();
17
+
18
+ $emagProductsTable = $installer->getTable('innobyte_emag_marketplace/product');
19
+
20
+ $installer->run("
21
+ ALTER TABLE {$emagProductsTable}
22
+ ADD COLUMN `price` DECIMAL (12,4) NULL COMMENT 'eMAG Product Price' AFTER `store_id`,
23
+ ADD COLUMN `special_price` DECIMAL (12,4) NULL COMMENT 'eMAG Product Special Price' AFTER `price`
24
+ ");
25
+
26
+ $installer->endSetup();
app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.7-1.1.8.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add eMAG attribute for price attribute
4
+ *
5
+ * @category Innobyte
6
+ * @package Innobyte_EmagMarketplace
7
+ *
8
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
9
+ */
10
+ ?>
11
+ <?php
12
+ /** @var $installer Mage_Sales_Model_Resource_Setup */
13
+
14
+ $installer = $this;
15
+
16
+ $installer->startSetup();
17
+
18
+ $emagProductsTable = $installer->getTable('innobyte_emag_marketplace/product');
19
+
20
+ $installer->run("
21
+ ALTER TABLE {$emagProductsTable}
22
+ ADD COLUMN `sku` VARCHAR (255) NULL COMMENT 'Magento Product SKU' AFTER `product_id`
23
+ ");
24
+
25
+ $installer->endSetup();
app/code/local/Innobyte/EmagMarketplace/sql/innobyte_emag_marketplace_setup/upgrade-1.1.8-1.1.9.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add eMAG entity types for invoice and creditmemo
4
+ * Update source model for attribute "emag_is_vat_payer"
5
+ *
6
+ * @category Innobyte
7
+ * @package Innobyte_EmagMarketplace
8
+ *
9
+ * @author Valentin Sandu <valentin.sandu@innobyte.com>
10
+ */
11
+ ?>
12
+ <?php
13
+ /** @var $installer Mage_Sales_Model_Resource_Setup */
14
+
15
+ $installer = $this;
16
+
17
+ $installer->startSetup();
18
+
19
+ $installer->addEntityType(Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_INVOICE, array(
20
+ 'entity_model' => 'sales/order_invoice',
21
+ 'table' => 'sales/invoice',
22
+ 'increment_model' => 'eav/entity_increment_numeric',
23
+ 'increment_per_store' => true
24
+ ));
25
+
26
+ $installer->addEntityType(Innobyte_EmagMarketplace_Model_Sales_Invoice::ENTITY_TYPE_CODE_CREDITMEMO, array(
27
+ 'entity_model' => 'sales/order_creditmemo',
28
+ 'table' => 'sales/creditmemo',
29
+ 'increment_model' => 'eav/entity_increment_numeric',
30
+ 'increment_per_store' => true
31
+ ));
32
+
33
+
34
+ $installer->updateAttribute(
35
+ 'customer_address',
36
+ 'emag_is_vat_payer',
37
+ 'source_model',
38
+ 'eav/entity_attribute_source_boolean'
39
+ );
40
+
41
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/innobyte/core.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <adminhtml_system_config_edit>
4
- <reference name="content">
5
- <block type="innobyte_core/shop" name="innobyte_core_shop" template="innobyte/core/shop.phtml"></block>
6
- </reference>
7
- </adminhtml_system_config_edit>
8
- </layout>
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/innobyte/emag_marketplace.xml CHANGED
@@ -240,7 +240,7 @@
240
  </reference>
241
  <reference name="shipment_packaging">
242
  <action method="setTemplate">
243
- <template>innobyte/emag_marketplace/sales/order/shipment/packaging/popup.phtml</template>
244
  </action>
245
  </reference>
246
  </adminhtml_sales_order_shipment_new>
@@ -254,7 +254,7 @@
254
  </reference>
255
  <reference name="shipment_packaging">
256
  <action method="setTemplate">
257
- <template>innobyte/emag_marketplace/sales/order/shipment/packaging/popup.phtml</template>
258
  </action>
259
  </reference>
260
  </adminhtml_sales_order_shipment_view>
@@ -334,4 +334,30 @@
334
  <action method="setTemplate"><path>innobyte/emag_marketplace/catalog/product/edit.phtml</path></action>
335
  </reference>
336
  </adminhtml_catalog_product_edit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  </layout>
240
  </reference>
241
  <reference name="shipment_packaging">
242
  <action method="setTemplate">
243
+ <template helper="innobyte_emag_marketplace/data/setTemplate"/>
244
  </action>
245
  </reference>
246
  </adminhtml_sales_order_shipment_new>
254
  </reference>
255
  <reference name="shipment_packaging">
256
  <action method="setTemplate">
257
+ <template helper="innobyte_emag_marketplace/data/setTemplate"/>
258
  </action>
259
  </reference>
260
  </adminhtml_sales_order_shipment_view>
334
  <action method="setTemplate"><path>innobyte/emag_marketplace/catalog/product/edit.phtml</path></action>
335
  </reference>
336
  </adminhtml_catalog_product_edit>
337
+
338
+ <!-- add eMAG columns to sales order grid -->
339
+ <add_order_grid_column_handle>
340
+ <reference name="sales_order.grid">
341
+ <action method="addColumnAfter">
342
+ <columnId>emag_order_id</columnId>
343
+ <arguments module="sales" translate="header">
344
+ <header>eMAG Order #</header>
345
+ <index>emag_order_id</index>
346
+ <type>text</type>
347
+ <filter>innobyte_emag_marketplace/adminhtml_sales_order_grid_column_filter</filter>
348
+ <renderer>innobyte_emag_marketplace/adminhtml_sales_order_grid_column_renderer</renderer>
349
+ <width>100</width>
350
+ <filter_index>emag_orders.emag_order_id</filter_index>
351
+ </arguments>
352
+ <after>real_order_id</after>
353
+ </action>
354
+ </reference>
355
+ </add_order_grid_column_handle>
356
+ <adminhtml_sales_order_grid>
357
+ <update handle="add_order_grid_column_handle" />
358
+ </adminhtml_sales_order_grid>
359
+ <adminhtml_sales_order_index>
360
+ <update handle="add_order_grid_column_handle" />
361
+ </adminhtml_sales_order_index>
362
+
363
  </layout>
app/design/adminhtml/default/default/template/innobyte/core/button.phtml DELETED
@@ -1,23 +0,0 @@
1
-
2
- <?php echo $this->getButtonHtml();?>
3
-
4
- <script type="text/javascript">
5
- //<![CDATA[
6
- // init inno namespace if case
7
- var inno = inno || {};
8
- // init core namespace if case
9
- inno.core = inno.core || {} ;
10
- inno.core.sendReport = function () {
11
- new Ajax.Request('<?php echo $this->getAjaxSendReportUrl() ?>', {
12
- method: 'POST',
13
- parameters: {'message':$('innobyte_core_debugger_explanation_message').value},
14
- onSuccess: function (transport) {
15
- var response = transport.responseText.evalJSON();
16
- if (response.code) {
17
- alert(response.message);
18
- }
19
- }
20
- });
21
- }
22
- //]]>
23
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/cron.phtml DELETED
@@ -1,49 +0,0 @@
1
-
2
- <?php $_magento = $this->getMagento(); ?>
3
- <?php if (isset($_magento['crontab'])) : ?>
4
- <?php foreach ($_magento['crontab'] as $_code=>$_info): ?>
5
- <li style="list-style:none inside; padding:0 0 0 10px; margin-top: 15px;">
6
- <div style="display:block; overflow: hidden;">
7
- <?php echo $_info; ?><br/>
8
- </div>
9
- </li>
10
- <?php endforeach; ?>
11
- <?php endif; ?>
12
-
13
- <hr/>
14
-
15
-
16
-
17
- <?php if (isset($_magento['crons'])) : ?>
18
- <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
19
- <?php foreach ($_magento['crons'] as $_code=>$_info): ?>
20
- <li style="list-style:none inside; padding:0 0 0 10px; margin-top: 15px;">
21
- <div style="display:block; overflow: hidden;">
22
- <div style="width:38%;float:left;">
23
- <strong><?php echo $_code; ?></strong><br/>
24
- &nbsp; <?php echo $_info['info']['cron_expr']; ?></br>
25
- <?php echo $_info['info']['model']; ?>
26
- </div>
27
- <div style="width:12%;float:left;">
28
- <?php if (isset($_info['schedule'])) : ?>
29
- <?php echo $_info['schedule']['status']; ?>
30
- <?php endif; ?>
31
-
32
- </div>
33
- <div style="width:50%;float:left;font-family:monospace;">
34
- <?php if (isset($_info['schedule'])) : ?>
35
- messages&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo $_info['schedule']['messages']; ?><br/>
36
- created_at&nbsp;&nbsp;: <?php echo $_info['schedule']['created_at']; ?><br/>
37
- scheduled_at: <?php echo $_info['schedule']['scheduled_at']; ?><br/>
38
- executed_at&nbsp;: <?php echo $_info['schedule']['executed_at']; ?><br/>
39
- finished_at&nbsp;: <?php echo $_info['schedule']['finished_at']; ?><br/>
40
- <?php endif; ?>
41
- </div>
42
-
43
- </div>
44
- </li>
45
- <?php endforeach; ?>
46
- </ul>
47
- <?php else: ?>
48
- --- No cron jobs found
49
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/disabled_extensions.phtml DELETED
@@ -1,13 +0,0 @@
1
- <?php $_magento = $this->getMagento(); ?>
2
-
3
- <?php if (isset($_magento['disabled_modules'])) : ?>
4
- <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
5
- <?php foreach ($_magento['disabled_modules'] as $_key=>$_extension): ?>
6
- <li style="list-style:none inside; padding:0 0 0 10px;">
7
- &ndash; <?php echo $_extension; ?>
8
- </li>
9
- <?php endforeach; ?>
10
- </ul>
11
- <?php else: ?>
12
- --- no extension found
13
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/general.phtml DELETED
@@ -1,11 +0,0 @@
1
- <?php $_magento = $this->getMagento(); ?>
2
-
3
- <strong>Magento edition</strong>: <?php echo $_magento['edition'] ?><br/>
4
- <strong>Magento version</strong>: <?php echo $_magento['version'] ?><br/>
5
- <strong>Compilation</strong>: <?php echo $_magento['compilation'] ?><br/>
6
- <strong>Magento Domains</strong>:
7
-
8
-
9
- <?php foreach ($_magento['domains'] as $_key=>$_domain): ?>
10
- <?php echo $_domain; ?><br/>
11
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/inno_config_data.phtml DELETED
@@ -1,20 +0,0 @@
1
- <?php $_magento = $this->getMagento(); ?>
2
-
3
- <?php if (isset($_magento['inno_extensions_info'])) : ?>
4
- <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
5
- <?php foreach ($_magento['inno_extensions_info'] as $_key=>$_item): ?>
6
- <li style="list-style:none inside; padding:0 0 0 10px;">
7
- <div style="width: 300px;float:left;font-family:monospace;">
8
- <?php echo $_item['path']; ?>
9
- </div>
10
- <div style="width: 200px;float:left;margin-bottom: 15px;">
11
- <?php echo $_item['value']; ?>
12
- </div>
13
- <div style="clear: both"></div>
14
- </li>
15
- <?php endforeach; ?>
16
- </ul>
17
- <?php else: ?>
18
- --- no innobyte extension config data found
19
- <?php endif; ?>
20
- <div style="clear: both"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/inno_extensions.phtml DELETED
@@ -1,13 +0,0 @@
1
- <?php $_magento = $this->getMagento(); ?>
2
-
3
- <?php if (isset($_magento['inno_extensions'])) : ?>
4
- <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
5
- <?php foreach ($_magento['inno_extensions'] as $_key=>$_extension): ?>
6
- <li style="list-style:none inside; padding:0 0 0 10px;">
7
- &ndash; <?php echo $_extension['name']; ?> - v<?php echo $_extension['version']; ?>
8
- </li>
9
- <?php endforeach; ?>
10
- </ul>
11
- <?php else: ?>
12
- --- no extension found
13
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/debugger_email/rewrites.phtml DELETED
@@ -1,31 +0,0 @@
1
-
2
- <?php $_magento = $this->getMagento(); ?>
3
-
4
- <?php if (isset($_magento['rewrites']) && !empty($_magento['rewrites']) ) : ?>
5
- <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
6
- <?php foreach ($_magento['rewrites'] as $_type=>$_rewrite): ?>
7
- <li style="list-style:none inside; padding:0 0 0 10px; margin-top: 15px;">
8
- <div style="display:block; overflow: hidden;">
9
- <div style="border-bottom: 1px solid #CCCCCC;font-weight: bold;">
10
- &ndash; <?php echo $_type; ?><br/>
11
- </div>
12
-
13
- <div style="margin-left:25px">
14
- <?php foreach ($_rewrite as $_class=>$_rewrites): ?>
15
- <div style="width: 30%;float:left;font-family:monospace;">
16
- <?php echo $_class; ?>
17
- </div>
18
- <div style="width: 70%;float:left;margin-bottom: 15px;">
19
- <?php foreach ($_rewrites as $_key=>$_rewriteClass): ?>
20
- <?php echo $_rewriteClass; ?><br/>
21
- <?php endforeach; ?>
22
- </div>
23
- <?php endforeach; ?>
24
- </div>
25
- </div>
26
- </li>
27
- <?php endforeach; ?>
28
- </ul>
29
- <?php else: ?>
30
- --- no rewrites
31
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/core/shop.phtml DELETED
@@ -1,37 +0,0 @@
1
- <?php if ($this->configPage == 'innobyte_core'): ?>
2
- <div id="innobyte_core_extensions_hidden" style="display:none;">
3
- <table class="form-list">
4
- <tbody>
5
- <?php foreach ($this->getExtensions() as $extension): ?>
6
- <tr>
7
- <td>
8
- <img src="<?php echo $this->getIcon($extension)->getSource()?>"
9
- alt="<?php echo $this->getIcon($extension)->getTitle()?>"/>
10
- </td>
11
- <td>
12
- <a href="<?php echo $extension->getFeedInfo()->getUrl()?>"
13
- onclick="this.target = '_blank'"><?php echo $extension->getFeedInfo()->getDisplayName()?></a>
14
- </td>
15
- <td><?php echo $extension->getVersion()?></td>
16
- <?php /*
17
- <td>
18
- <a href="http://shop.innobyte.com/extensions/<?php echo $extension->getName()?>-<?php echo $extension->getVersion()?>/readme.html"
19
- onclick="this.target = '_blank'"><img src="<?php echo $this->getSkinUrl('innobyte/core/images/readme.png')?>"/></a>
20
- </td>
21
- */
22
- ?>
23
- </tr>
24
- <?php endforeach; ?>
25
- </tbody>
26
- </table>
27
- </div>
28
- <?php endif; ?>
29
- <?php if ($this->configPage == 'innobyte_shop'): ?>
30
- <div id="innobyte_shop" style="display:none;">
31
- <?php echo $this->_getShopData()->getTextResponse()?>
32
- </div>
33
- <?php endif; ?>
34
-
35
- <script type="text/javascript">
36
- innobyte_core_admin_section = '<?php echo $this->configPage?>';
37
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/innobyte/emag_marketplace/sales/order/create/totals/voucher.phtml CHANGED
@@ -13,9 +13,10 @@
13
  title="<?php echo Mage::helper('innobyte_emag_marketplace')->__('Remove') ?>"/>
14
  </td>
15
  <td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
 
16
  <?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
17
- <?php echo $this->formatPrice($voucher['emag_sale_price']) ?>
18
- <?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
19
  </td>
20
  </tr>
21
  <?php endforeach; ?>
13
  title="<?php echo Mage::helper('innobyte_emag_marketplace')->__('Remove') ?>"/>
14
  </td>
15
  <td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
16
+ <?php $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'] ?>
17
  <?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
18
+ <?php echo $this->formatPrice($salePriceInclVat) ?>
19
+ <?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
20
  </td>
21
  </tr>
22
  <?php endforeach; ?>
app/design/adminhtml/default/default/template/innobyte/emag_marketplace/sales/order/totals.phtml CHANGED
@@ -9,7 +9,11 @@
9
  <?php echo $helper->getFormattedVoucherLabel($voucher['emag_voucher_name']) ?>
10
  </td>
11
  <td>
12
- <?php echo $this->displayPrices($voucher['base_emag_sale_price'], $voucher['emag_sale_price']); ?>
 
 
 
 
13
  </td>
14
  </tr>
15
  <?php endforeach ?>
9
  <?php echo $helper->getFormattedVoucherLabel($voucher['emag_voucher_name']) ?>
10
  </td>
11
  <td>
12
+ <?php
13
+ $baseSalePriceInclVat = $voucher['base_emag_sale_price'] + $voucher['base_emag_sale_price_vat'];
14
+ $salePriceInclVat = $voucher['emag_sale_price'] + $voucher['emag_sale_price_vat'];
15
+ ?>
16
+ <?php echo $this->displayPrices($baseSalePriceInclVat, $salePriceInclVat) ?>
17
  </td>
18
  </tr>
19
  <?php endforeach ?>
app/etc/modules/Innobyte_Core.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Innobyte_Core>
5
- <active>true</active>
6
- <codePool>local</codePool>
7
- </Innobyte_Core>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/etc/modules/Innobyte_EmagMarketplace.xml CHANGED
@@ -8,7 +8,6 @@
8
  <Mage_Sales/>
9
  <Mage_Catalog/>
10
  <Mage_Customer/>
11
- <Innobyte_Core/>
12
  </depends>
13
  </Innobyte_EmagMarketplace>
14
  </modules>
8
  <Mage_Sales/>
9
  <Mage_Catalog/>
10
  <Mage_Customer/>
 
11
  </depends>
12
  </Innobyte_EmagMarketplace>
13
  </modules>
app/locale/en_US/Innobyte_EmagMarketplace.csv CHANGED
@@ -56,6 +56,15 @@
56
  "Invoice not found!","Invoice not found!"
57
  "Invoice successfully deleted.","Invoice successfully deleted."
58
  "Order successfully synced with eMAG.","Order successfully synced with eMAG."
 
 
 
 
 
 
 
 
 
59
  "Invalid order status!","Invalid order status!"
60
  "Only eMAG orders can be acknowledged!","Only eMAG orders can be acknowledged!"
61
  "Order successfully acknowledged.","Order successfully acknowledged."
@@ -84,7 +93,7 @@
84
  "Send also magento real stock qty, not only availability flags as ""limited stock"", ""in stock"", ""out of stock""","Send also magento real stock qty, not only availability flags as ""limited stock"", ""in stock"", ""out of stock"""
85
  "Api Settings","Api Settings"
86
  "Api URL","Api URL"
87
- "Api URL provided by eMAG.","Api URL provided by eMAG."
88
  "Api Username","Api Username"
89
  "Api username provided by eMAG.","Api username provided by eMAG."
90
  "Api Password","Api Password"
@@ -93,12 +102,16 @@
93
  "Client code provided by eMAG.","Client code provided by eMAG."
94
  "Invoice / Creditmemo Settings","Invoice / Creditmemo Settings"
95
  "Invoice Prefix","Invoice Prefix"
96
- "Define invoice prefix. Leave blank to use Magento default invoice prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>","Define invoice prefix. Leave blank to use Magento default invoice prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>"
97
  "Creditmemo Prefix","Creditmemo Prefix"
98
- "Define creditmemo prefix. Leave blank to use Magento default creditmemo prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>","Define creditmemo prefix. Leave blank to use Magento default creditmemo prefix. (Ex: PREFIX10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>"
99
  "Shipping Settings","Shipping Settings"
100
  "Courier Account Id","Courier Account Id"
101
  "Unique identifier for vendor 's courier account. If not provided, a default account will be used when creating AWBs.","Unique identifier for vendor 's courier account. If not provided, a default account will be used when creating AWBs."
 
 
 
 
102
  "eMAG Bank Transfer","eMAG Bank Transfer"
103
  "Payment Title","Payment Title"
104
  "New Order Status","New Order Status"
@@ -171,6 +184,7 @@
171
  "No products found in eMAG order!","No products found in eMAG order!"
172
  "Store currency and eMAG currency codes do not match!","Store currency and eMAG currency codes do not match!"
173
  "Customer not found in eMAG order!","Customer not found in eMAG order!"
 
174
  "There was an error while processing order products!","There was an error while processing order products!"
175
  "There was an error while processing vouchers!","There was an error while processing vouchers!"
176
  "There was an error while processing order attachments","There was an error while processing order attachments"
@@ -208,6 +222,11 @@
208
  "Handling time, in number of days counted from the day the order was received. If handling_time = 0 the order will be shipped the same day it is received.","Handling time, in number of days counted from the day the order was received. If handling_time = 0 the order will be shipped the same day it is received."
209
  "Start Date","Start Date"
210
  "If it's a new offer, it represents the date your offer will be available from.<br />For offer updates, it schedules value updates for the following data: sale_price, recommended_price, stock, handling_time, commission, vat_id, warranty, status, availability.<br />All other data will be updated on the fly.<br />Using Start Date, for example, you can schedule the inactivation of an offer, a price update, etc.","If it's a new offer, it represents the date your offer will be available from.<br />For offer updates, it schedules value updates for the following data: sale_price, recommended_price, stock, handling_time, commission, vat_id, warranty, status, availability.<br />All other data will be updated on the fly.<br />Using Start Date, for example, you can schedule the inactivation of an offer, a price update, etc."
 
 
 
 
 
211
  "VAT","VAT"
212
  "If not set, will be automatically calculated based on product 's class tax and store shipping origin address.","If not set, will be automatically calculated based on product 's class tax and store shipping origin address."
213
  "Save","Save"
@@ -233,6 +252,7 @@
233
  "There was an error while processing vouchers: %s","There was an error while processing vouchers: %s"
234
  "Invalid eMag payment method: %s","Invalid eMag payment method: %s"
235
  "There was an error while processing payment: %s","There was an error while processing payment: %s"
 
236
  "Invalid Magento order status: %s","Invalid Magento order status: %s"
237
  "Invalid Magento payment method: %s","Invalid Magento payment method: %s"
238
  "Unable to write to media folder: %s","Unable to write to media folder: %s"
@@ -244,7 +264,7 @@
244
  "There was an error while creating order invoice: %s","There was an error while creating order invoice: %s"
245
  "Cannot create invoice for eMAG order #%s","Cannot create invoice for eMAG order #%s"
246
  "AWB PDF URL","AWB PDF URL"
247
- "URL where to read AWB 's PDF from.<br/>Ex: https://mktp-stage.emag.ro/awb/read_pdf","URL where to read AWB 's PDF from.<br/>Ex: https://mktp-stage.emag.ro/awb/read_pdf"
248
  "Invalid API awb response","Invalid API awb response"
249
  "Read AWB PDF URL was not set in system config.","Read AWB PDF URL was not set in system config."
250
  "Please confirm product sending. All data that hasn't been saved will be lost.","Please confirm product sending. All data that hasn't been saved will be lost."
@@ -278,3 +298,4 @@
278
  "Product Offer","Product Offer"
279
  "percentage","percentage"
280
  "absolute","absolute"
 
56
  "Invoice not found!","Invoice not found!"
57
  "Invoice successfully deleted.","Invoice successfully deleted."
58
  "Order successfully synced with eMAG.","Order successfully synced with eMAG."
59
+ "%s order(s) cannot be prepared.","%s order(s) cannot be prepared."
60
+ "The order(s) cannot be prepared.","The order(s) cannot be prepared."
61
+ "%s order(s) cannot be finalized.","%s order(s) cannot be finalized."
62
+ "The order(s) cannot be finalized.","The order(s) cannot be finalized."
63
+ "%s order(s) cannot be canceled.","%s order(s) cannot be canceled."
64
+ "The order(s) cannot be canceled.","The order(s) cannot be canceled."
65
+ "Order #%s can not be prepared!","Order #%s can not be prepared!"
66
+ "Order #%s can not be finalized!","Order #%s can not be finalized!"
67
+ "Order #%s can not be canceled!","Order #%s can not be canceled!"
68
  "Invalid order status!","Invalid order status!"
69
  "Only eMAG orders can be acknowledged!","Only eMAG orders can be acknowledged!"
70
  "Order successfully acknowledged.","Order successfully acknowledged."
93
  "Send also magento real stock qty, not only availability flags as ""limited stock"", ""in stock"", ""out of stock""","Send also magento real stock qty, not only availability flags as ""limited stock"", ""in stock"", ""out of stock"""
94
  "Api Settings","Api Settings"
95
  "Api URL","Api URL"
96
+ "Api URL provided by eMAG.<br/><strong>Live:</strong> <span style=""color:red"">https://marketplace.emag.ro/api-3</span> <br/><strong>Stage:</strong> <span style=""color:red"">https://mktp-stage.emag.ro/api-3/</span>","Api URL provided by eMAG.<br/><strong>Live:</strong> <span style=""color:red"">https://marketplace.emag.ro/api-3</span> <br/><strong>Stage:</strong> <span style=""color:red"">https://mktp-stage.emag.ro/api-3/</span>"
97
  "Api Username","Api Username"
98
  "Api username provided by eMAG.","Api username provided by eMAG."
99
  "Api Password","Api Password"
102
  "Client code provided by eMAG.","Client code provided by eMAG."
103
  "Invoice / Creditmemo Settings","Invoice / Creditmemo Settings"
104
  "Invoice Prefix","Invoice Prefix"
105
+ "Define invoice prefix. (Ex: <span style=""color:red"">EMAG</span>10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>","Define invoice prefix. (Ex: <span style=""color:red"">EMAG</span>10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>"
106
  "Creditmemo Prefix","Creditmemo Prefix"
107
+ "Define creditmemo prefix. (Ex: <span style=""color:red"">EMAG</span>10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>","Define invoice prefix. (Ex: <span style=""color:red"">EMAG</span>10000122) <br><strong>Note:</strong> <span style=""color:orange"">Maximum length 10 characters.</span>"
108
  "Shipping Settings","Shipping Settings"
109
  "Courier Account Id","Courier Account Id"
110
  "Unique identifier for vendor 's courier account. If not provided, a default account will be used when creating AWBs.","Unique identifier for vendor 's courier account. If not provided, a default account will be used when creating AWBs."
111
+ "Disable SSL Verify","Disable SSL Verify"
112
+ "Disable CURL option ""CURLOPT_SSL_VERIFYPEER"" for API calls.","Disable CURL option ""CURLOPT_SSL_VERIFYPEER"" for API calls."
113
+ "Verbose Mode","Verbose Mode"
114
+ "Enable CURL option ""CURLOPT_VERBOSE"" for API calls.","Enable CURL option ""CURLOPT_VERBOSE"" for API calls."
115
  "eMAG Bank Transfer","eMAG Bank Transfer"
116
  "Payment Title","Payment Title"
117
  "New Order Status","New Order Status"
184
  "No products found in eMAG order!","No products found in eMAG order!"
185
  "Store currency and eMAG currency codes do not match!","Store currency and eMAG currency codes do not match!"
186
  "Customer not found in eMAG order!","Customer not found in eMAG order!"
187
+ "Unable to apply shipping method. ERROR: %s","Unable to apply shipping method. ERROR: %s"
188
  "There was an error while processing order products!","There was an error while processing order products!"
189
  "There was an error while processing vouchers!","There was an error while processing vouchers!"
190
  "There was an error while processing order attachments","There was an error while processing order attachments"
222
  "Handling time, in number of days counted from the day the order was received. If handling_time = 0 the order will be shipped the same day it is received.","Handling time, in number of days counted from the day the order was received. If handling_time = 0 the order will be shipped the same day it is received."
223
  "Start Date","Start Date"
224
  "If it's a new offer, it represents the date your offer will be available from.<br />For offer updates, it schedules value updates for the following data: sale_price, recommended_price, stock, handling_time, commission, vat_id, warranty, status, availability.<br />All other data will be updated on the fly.<br />Using Start Date, for example, you can schedule the inactivation of an offer, a price update, etc.","If it's a new offer, it represents the date your offer will be available from.<br />For offer updates, it schedules value updates for the following data: sale_price, recommended_price, stock, handling_time, commission, vat_id, warranty, status, availability.<br />All other data will be updated on the fly.<br />Using Start Date, for example, you can schedule the inactivation of an offer, a price update, etc."
225
+ "Price","Price"
226
+ "eMAG Marketplace sell price. Leave blank to use default Magento Price. <br /> <strong>Note</strong>: <span style=""color: red"">VAT is calculated based on <a href=""%s"">Tax->Calculation Settings->Catalog Prices</a>.</span>","eMAG Marketplace sell price. Leave blank to use default Magento Price. <br /> <strong>Note</strong>: <span style=""color: red"">Product Tax is calculated based on <a href=""%s"">Tax->Calculation Settings->Catalog Prices</a>.</span>"
227
+ "Special Price","Special Price"
228
+ "eMAG Marketplace special price. Leave blank to use default Magento Special Price. <br /> <strong>Note</strong>: <span style=""color: red"">VAT is calculated based on <a href=""%s"">Tax->Calculation Settings->Catalog Prices</a>.</span>"
229
+ "eMAG product special price can not be equal or greater than eMAG product price.","eMAG product special price can not be equal or greater than eMAG product price."
230
  "VAT","VAT"
231
  "If not set, will be automatically calculated based on product 's class tax and store shipping origin address.","If not set, will be automatically calculated based on product 's class tax and store shipping origin address."
232
  "Save","Save"
252
  "There was an error while processing vouchers: %s","There was an error while processing vouchers: %s"
253
  "Invalid eMag payment method: %s","Invalid eMag payment method: %s"
254
  "There was an error while processing payment: %s","There was an error while processing payment: %s"
255
+ "Invalid currency settings. Please check you currency rates.","Invalid currency settings. Please check you currency rates."
256
  "Invalid Magento order status: %s","Invalid Magento order status: %s"
257
  "Invalid Magento payment method: %s","Invalid Magento payment method: %s"
258
  "Unable to write to media folder: %s","Unable to write to media folder: %s"
264
  "There was an error while creating order invoice: %s","There was an error while creating order invoice: %s"
265
  "Cannot create invoice for eMAG order #%s","Cannot create invoice for eMAG order #%s"
266
  "AWB PDF URL","AWB PDF URL"
267
+ "URL where to read AWB 's PDF from.<br/><strong>Live:</strong> <span style=""color:red"">https://marketplace.emag.ro/awb/read_pdf/</span> <br/><strong>Stage:</strong> <span style=""color:red"">https://mktp-stage.emag.ro/awb/read_pdf/</span>","URL where to read AWB 's PDF from.<br/><strong>Live:</strong> <span style=""color:red"">https://marketplace.emag.ro/awb/read_pdf/</span> <br/><strong>Stage:</strong> <span style=""color:red"">https://mktp-stage.emag.ro/awb/read_pdf/</span>"
268
  "Invalid API awb response","Invalid API awb response"
269
  "Read AWB PDF URL was not set in system config.","Read AWB PDF URL was not set in system config."
270
  "Please confirm product sending. All data that hasn't been saved will be lost.","Please confirm product sending. All data that hasn't been saved will be lost."
298
  "Product Offer","Product Offer"
299
  "percentage","percentage"
300
  "absolute","absolute"
301
+ "eMAG Order #","eMAG Order #"
app/locale/en_US/template/email/innobyte/core/debug.html DELETED
@@ -1,99 +0,0 @@
1
- <!--@subject Troubleshooter email for {{var store.getFrontendName()}}! @-->
2
- <!--@vars
3
- {"store url=\"\"":"Store Url",
4
- "var logo_url":"Email Logo Image Url",
5
- "var magento":"Magento information",
6
- "var explanation_message":"Explanation message",
7
- "var php_info":"PHP info"}
8
- @-->
9
-
10
- <!--@styles
11
- body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
12
- @-->
13
-
14
- <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
15
- <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
- <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
17
- <tr>
18
- <td align="center" valign="top" style="padding:20px 0 20px 0">
19
- <!-- [ header starts here] -->
20
- <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
21
- <tr>
22
- <td valign="top">
23
- <a href="{{store url=""}}">
24
- <img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/>
25
- </a>
26
- </td>
27
- </tr>
28
- <!-- [ middle starts here] -->
29
- <tr>
30
- <td valign="top">
31
- <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello,</h1>
32
- <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">
33
- This email contains informations regarding <a href="{{store url=""}}">{{var store.getFrontendName()}}</a>.
34
- </p>
35
-
36
- <p style="font-style: italic;">{{var explanation_message}}</p>
37
- <p></p>
38
- <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
39
- {{block type='core/template'
40
- area='adminhtml'
41
- template='innobyte/core/debugger_email/general.phtml'
42
- magento=$magento}}
43
- </p>
44
-
45
-
46
- <h2>Installed Innobyte Extension</h2>
47
- {{block type='core/template'
48
- area='adminhtml'
49
- template='innobyte/core/debugger_email/inno_extensions.phtml'
50
- magento=$magento}}
51
-
52
-
53
- <h2>Disabled output</h2>
54
- {{block type='core/template'
55
- area='adminhtml'
56
- template='innobyte/core/debugger_email/disabled_extensions.phtml'
57
- magento=$magento}}
58
-
59
-
60
- <h2>Rewrites</h2>
61
- {{block type='core/template'
62
- area='adminhtml'
63
- template='innobyte/core/debugger_email/rewrites.phtml'
64
- magento=$magento}}
65
-
66
- <h2>Cron</h2>
67
- {{block type='core/template'
68
- area='adminhtml'
69
- template='innobyte/core/debugger_email/cron.phtml'
70
- magento=$magento}}
71
-
72
- <hr/>
73
-
74
- {{var php_info}}
75
-
76
- <!-- <h2>Installed Innobyte Extensions Config Data</h2>
77
- {{block type='core/template'
78
- area='adminhtml'
79
- template='innobyte/core/debugger_email/inno_config_data.phtml'
80
- magento=$magento}}-->
81
-
82
- </td>
83
- </tr>
84
- <!-- [ footer starts here] -->
85
- <tr>
86
- <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;">
87
- <center>
88
- <p style="font-size:12px; margin:0;">
89
- Thank you, <strong>{{var store.getFrontendName()}}</strong>
90
- </p>
91
- </center>
92
- </td>
93
- </tr>
94
- </table>
95
- </td>
96
- </tr>
97
- </table>
98
- </div>
99
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/innobyte/core/init.js DELETED
@@ -1,11 +0,0 @@
1
- function initInnoCore(){
2
- if(innobyte_core_admin_section == 'innobyte_core'){
3
- $('innobyte_core_extensions').update($('innobyte_core_extensions_hidden').innerHTML)
4
- }
5
- if(innobyte_core_admin_section == 'innobyte_shop'){
6
- $('innobyte_shop_extensions').update($('innobyte_shop').innerHTML)
7
- }
8
- }
9
- Event.observe(window, 'load', function() {
10
- initInnoCore();
11
- });
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,19 +1,3 @@
1
  <?xml version="1.0"?>
2
- <package>
3
- <name>Innobyte_EmagMarketplace</name>
4
- <version>1.0.4</version>
5
- <stability>stable</stability>
6
- <license>Innobyte License</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>Being the fastest growing marketplace in Romania, Bulgaria and Hungary, eMAG Marketplace will bring your store&#x2019;s sales to the next level by opening a new and efficient sales channel.</summary>
10
- <description>Being the fastest growing marketplace in Romania, Bulgaria and Hungary, eMAG Marketplace will bring your store&#x2019;s sales to the next level by opening a new and efficient sales channel.&#xD;
11
- eMAG Marketplace integration extension by Innobyte helps Magento store owners publish their products on eMAG Marketplace and build up their reputation.</description>
12
- <notes>-</notes>
13
- <authors><author><name>Florin Mihai Savici</name><user>innobyte</user><email>management@innobyte.com</email></author></authors>
14
- <date>2015-05-26</date>
15
- <time>13:45:22</time>
16
- <contents><target name="magelocal"><dir name="Innobyte"><dir name="EmagMarketplace"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="EmagMarketplace.php" hash="84d28e6371a85f378038e5412158ebb3"/></dir></dir><file name="Edit.php" hash="56121505211aee840a3f896283b3cd05"/></dir></dir><dir name="Category"><file name="Grid.php" hash="17d5e61840283e320e455796b063b85b"/></dir><file name="Category.php" hash="b28cf6ff81b68b26299ea2d94f19ef1e"/><dir name="Form"><dir name="Element"><file name="Barcodes.php" hash="029b5cabf48a1475378ff9ec83242c72"/><file name="File.php" hash="2d19999b0bf01b33e07a1667e89bc5c3"/></dir><dir name="Field"><file name="LocalityId.php" hash="fda3d9e04a2aab30d3affcc377770571"/></dir></dir><dir name="Locality"><file name="Grid.php" hash="9d3c565f261f93d6b38d196be6b9fa20"/></dir><file name="Locality.php" hash="244d56f08dbfcb14924c6dc3607a12c3"/><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Billing"><dir name="Method"><file name="Form.php" hash="6242c0e1592f5ee96cb2e179aecaf3b1"/></dir></dir><dir name="Items"><file name="Grid.php" hash="c58d1f3342f10014fd8cf2b9fa2a7380"/></dir><dir name="Shipping"><dir name="Method"><file name="Form.php" hash="c6596c59ebfb7b7e73ab06da32c7adf5"/></dir></dir><dir name="Totals"><file name="Voucher.php" hash="547dbfe0c4107d8a041cd35d0d0358d5"/></dir></dir><dir name="View"><file name="Comment.php" hash="39a50c5d6ecf9622523f0948f7d1052a"/><dir name="Invoice"><file name="Popup.php" hash="e936b3a67ad5f4bd41cb3458978973e3"/><dir name="Upload"><file name="Form.php" hash="08661772c4b2d4dad04ac41b1bc6f2b0"/></dir><file name="Upload.php" hash="e7d9468ab75a4da81ad947ee35ea99aa"/></dir></dir></dir></dir><dir name="Vat"><file name="Grid.php" hash="6cf11cb0e2568052512dcd9af8a47416"/></dir><file name="Vat.php" hash="af6380f2b1a91540a85717d8f7cc024c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6729a41a90e4152ce08a63f1c4fe02db"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="04fa602912f05d53f76839a7057b27f1"/><file name="Awb.php" hash="7427827fe386c1fd48c47698d076cada"/><file name="Category.php" hash="abcaa037eca294794c7586a9324c7874"/><file name="Locality.php" hash="9229328cbd3387cfa41e3be79b79de87"/><file name="Order.php" hash="5dd5599ae6747cbe7912b47b78a9754a"/><file name="Product.php" hash="b047daef630abe87ba0520797bec0191"/><file name="Response.php" hash="96586001de9ca54796479701694a6f30"/><file name="Vat.php" hash="1dadec377d4b25cad027b6299ece0f78"/></dir><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="e57ab404faa3111b1e379e83e3ef2a5e"/></dir></dir><dir name="Category"><file name="Characteristic.php" hash="c861ac8bb0485228056139ec2a5b2b1b"/><file name="Familytype.php" hash="c6ac762fa2f20261774c02490a157226"/></dir><file name="Category.php" hash="ebaf767fa33ad5af408286614dd20ef0"/><file name="Cron.php" hash="a7517f636098255fdc4ea2db56a53483"/><dir name="Customer"><file name="Attributes.php" hash="04866547213ce95f7c2caa5d426ba681"/><file name="Form.php" hash="259c8eba0ff64f7aa2559f46f9bd0bd4"/></dir><dir name="Invoice"><dir name="Pdf"><dir name="Total"><file name="Voucher.php" hash="e92be3b9b90677f0ff7ede6721eab3bc"/></dir></dir></dir><dir name="Locality"><file name="Flag.php" hash="a4e04313b24d2f32e9a7c101b7a3ebf4"/></dir><file name="Locality.php" hash="9eebf51b580234af3279d22801368c24"/><dir name="Order"><dir name="Convert"><file name="Abstract.php" hash="7d487712955771f834bd2daaaaf891d4"/><dir name="Emag"><file name="Update.php" hash="1140b2b3b114f24ec31b619e8d2d9501"/></dir><file name="Emag.php" hash="dba46141f4aa5be6f7f977c51d622059"/><file name="Magento.php" hash="735502541dfab539c8b306bc2f8f991e"/></dir></dir><dir name="Payment"><dir name="Method"><file name="Banktransfer.php" hash="de16ae6d2bfbe44efae91de5cb51c9c9"/><file name="Cashondelivery.php" hash="31d5608e9b4c2e47b03b70d922114ee1"/><file name="Cc.php" hash="054e75f54dbdb92dd92c79cc69e6006a"/><file name="Unknown.php" hash="c2bfa3c318a5d14867589a6d162d3014"/></dir></dir><file name="Product.php" hash="c8c910e60151bb1bb22c40ebaf12bc75"/><dir name="Resource"><dir name="Category"><dir name="Characteristic"><file name="Collection.php" hash="199a72bfe17fc978980cc466df2e6bf1"/></dir><file name="Characteristic.php" hash="a6a7f440c274a8dc70e21601461faa43"/><file name="Collection.php" hash="58380ccc531ad65837eda3d1ec326279"/><dir name="Familytype"><file name="Collection.php" hash="b51fb1747d1c563605801a52cddbc807"/></dir><file name="Familytype.php" hash="252f23169c78af34f1101c5c1ef00429"/></dir><file name="Category.php" hash="d0b00b7a79d42b1c8264215af8f6f25d"/><dir name="Locality"><file name="Collection.php" hash="919d2ec66fde1bfdfdba7a4351ec6e5b"/></dir><file name="Locality.php" hash="984483f1f254c773dc03f84e7ecfc842"/><dir name="Product"><file name="Collection.php" hash="2b269b788215822b1e836f1685eef1c6"/></dir><file name="Product.php" hash="8086bddef12d45e3b700e64f7a5154cd"/><dir name="Sales"><file name="Abstract.php" hash="4e28e8cea40a92c8551b9bb61fcc9168"/><dir name="Address"><file name="Abstract.php" hash="c95b407223fec1067ea66080fdf10677"/></dir><dir name="Invoice"><file name="Collection.php" hash="be9a2e37e986174327d4e532175a1a98"/></dir><file name="Invoice.php" hash="729574058005ed24ac39da04366d6c51"/><dir name="Item"><file name="Abstract.php" hash="a750e4cfcb85af0781047fa917e78d5c"/></dir><dir name="Order"><file name="Address.php" hash="ded5c157ac93c958d2c8149e97ab7b8a"/><dir name="Item"><file name="Collection.php" hash="cc749faeb2b194bab19c8b2f6657bf23"/></dir><file name="Item.php" hash="192143c67ae67ce77d5a69c07edc5f11"/><dir name="Voucher"><file name="Collection.php" hash="1e99b2c9e29eae6a7ae58d2f56acd01d"/></dir><file name="Voucher.php" hash="307aba5c74dbcd3a99ba37f8f0c72df2"/></dir><file name="Order.php" hash="f560e8f1bf96e2e6a41a692d5fb6c024"/><dir name="Quote"><file name="Address.php" hash="dd2ed7664775fe2d017a62e99f185b8b"/><dir name="Voucher"><file name="Collection.php" hash="d92263c78194131f1f93b965309dea04"/></dir><file name="Voucher.php" hash="75da1101f5ef453b6f796a127120b0d2"/></dir><file name="Quote.php" hash="2e451c02bd215c279a39f33156e464e4"/><dir name="Voucher"><file name="Abstract.php" hash="c4c39040b36e50120a227b6e39138fa5"/></dir></dir><dir name="Vat"><file name="Collection.php" hash="960899654592afb847d3bbf08a812d4d"/></dir><file name="Vat.php" hash="bd96a9809e1732c0192835443474a41b"/></dir><dir name="Sales"><file name="Abstract.php" hash="a631cb89d8d3f1613e332573330539e8"/><dir name="Address"><file name="Abstract.php" hash="ba8a438491d2b5de442bee67541594d0"/></dir><file name="Invoice.php" hash="70a156a393c81c2704e510af89e13631"/><dir name="Item"><file name="Abstract.php" hash="d308f8ad6b1aeaa1eade7c7457ab0ef4"/></dir><file name="Observer.php" hash="08f7c72a45db4b2ef17652b8ad6aa5ed"/><dir name="Order"><file name="Address.php" hash="60ae8af915f7ef591a99ce963ace9c70"/><dir name="Creditmemo"><file name="Total.php" hash="2ae049c6b5d3e97b2df36c532eaf1079"/></dir><dir name="Invoice"><file name="Total.php" hash="a0749ac2cdaef5242f90e377cfb22094"/></dir><file name="Item.php" hash="56fd503ed25e09569b4b220f1ed828cd"/><file name="Status.php" hash="2cc44f61150581a931c76a7224402724"/><file name="Voucher.php" hash="bde2d05e031f136aaf59478b842d68e6"/></dir><file name="Order.php" hash="e345960b8361cf62e57f4e10cbc890a1"/><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Voucher.php" hash="360834496dd8e6ba2f2ebe5481cb5357"/></dir></dir><file name="Address.php" hash="9e8e4ee7aa202b4940e1d532205db098"/><file name="Voucher.php" hash="e1364b975930aa4bc13fb5d4348ceb55"/></dir><file name="Quote.php" hash="30ad86af4d35ecb361feda0892f1ad78"/><dir name="Voucher"><file name="Abstract.php" hash="5db452297c71ba7cb2452347e8950131"/></dir></dir><dir name="Shipping"><dir name="Carrier"><file name="Emag.php" hash="70808be244b81ac6829e87a4a6e3349c"/></dir></dir><dir name="Source"><file name="Category.php" hash="1c23985bd28e00317bf9b85b6ec10741"/><file name="CommissionTypes.php" hash="e7c14db1490db8b4b9c0413d4f4f40aa"/><dir name="Customer"><dir name="Address"><dir name="Attributes"><file name="Legalentity.php" hash="996caae77c6a7cf32e92343ab5a0ab4e"/></dir></dir></dir><file name="FamilyType.php" hash="170f2cdc201c2e0d41adfaefa5309840"/><file name="OfferStatus.php" hash="0d08ef9e0379014e97f732b3ebd3bb71"/><file name="Vat.php" hash="74fc94ccf2fc63fb22697e44f610a9c7"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Prefix"><file name="Abstract.php" hash="18fbf03dc6505be1cfb260cde745b953"/><file name="Creditmemo.php" hash="adc1566bb71632f033ef90fcd2c7fc81"/><file name="Invoice.php" hash="369df8e80686fc436864bba9ec1f96bd"/></dir></dir></dir></dir><file name="Vat.php" hash="6f8024e5bfc76ccd1c827d81bda48d25"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Emag"><file name="CategoryController.php" hash="e42dd195c112b1d2230ff805abed16f3"/><file name="LocalityController.php" hash="181dd7289b8c45b377e3a696470ee7df"/><file name="ProductController.php" hash="4b2e8dcdcc2d41b9d7256e339defbb39"/><file name="VatController.php" hash="16f558732b4fa7a2bb08b7583816b017"/><file name="VoucherController.php" hash="19bf0a8a753c171447b8bf98069ad26f"/></dir><dir name="Sales"><dir name="Invoice"><file name="UploadController.php" hash="888399443eb8b0f28c91e698b34d9f0e"/></dir><file name="OrderController.php" hash="b502d7b8b7a2fa59c1c9ac32cbfe41fb"/></dir></dir><file name="InvoiceController.php" hash="8df75fd59d862afaaa7675d7831b9202"/></dir><dir name="data"><dir name="innobyte_emag_marketplace_setup"><file name="data-install-1.0.0.php" hash="e5d5342a60398c63955fe537b63699e3"/></dir></dir><dir name="docs"><file name="eMAG Markeplace API documentation v3.6.docx" hash="e5cf25307fc1111c12d2e10825aff517"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aea476a16999dabe7c929151a86493a7"/><file name="config.xml" hash="2de3edc56f20e435eae01e85b31f15b5"/><file name="jstranslator.xml" hash="2bad6817b7f348bcba8048d2c44004f3"/><file name="system.xml" hash="0776627962229b463003f7d4fa9325af"/></dir><dir name="sql"><dir name="innobyte_emag_marketplace_setup"><file name="install-1.0.0.php" hash="ea105ca65a3328b3e7228a630583b7ce"/></dir></dir></dir><file name="Exception.php" hash="8dd468af95b0bc4dedb6563e962f06e4"/></dir><dir name="Core"><dir><dir name="Block"><file name="Shop.php" hash="9fb4bf22cb95f3de1c62fdcf699d06b5"/><dir name="System"><dir name="Config"><file name="Button.php" hash="cb37bfd01290995adbe71e12afaf0871"/><dir name="Form"><dir name="Fieldset"><file name="Extensions.php" hash="5d026a00ef966334874c14aa66bacc29"/><file name="Shop.php" hash="3f888c968145b6969a252e4d54605bce"/></dir><dir name="Renderer"><file name="Field.php" hash="933192bb4da4eb0ba4b69deceec3c4a8"/><file name="Website.php" hash="779612dbd02ccd216ecc295fb6f00485"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="9cf989d6077f4f6d896c7969fb70e4f3"/><file name="Data.php" hash="8e46d8fddeab5556b075d9dd24902233"/><file name="Versions.php" hash="3e7125101f4c191d53f01deb2a1dfe16"/></dir><dir name="Model"><file name="Data.php" hash="f82288d94a83518737e28a1f2addb2ec"/><file name="Debug.php" hash="92223602c9d3d907bc13b57294f6d390"/><file name="Feed.php" hash="ce1f5b9c91a5e248c2baefdbfbdb89d0"/><dir name="Source"><dir name="Config"><file name="Enabledisable.php" hash="b9a4230779dd6f1f89d87c9a9dc2417f"/></dir><dir name="Feed"><file name="Type.php" hash="1fd10cc387061e08661faa540d5bb64e"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="f9647f277d74e473970fa67e6e1465f3"/></dir></dir><dir name="etc"><file name="config.xml" hash="6b6bcccfd131be35210c716ae75e747e"/><file name="system.xml" hash="2d15facb3d7ada2e74940eb90fe41afd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Innobyte_EmagMarketplace.xml" hash="da8e2a8d64721eb5d9f512fe72fa1dde"/><file name="Innobyte_Core.xml" hash="0f11fbe094b94c3fd2233e8e96aa972d"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="innobyte"><file name="emag_marketplace.xml" hash="1233947fb7451a46a922d48c7a3f2ffd"/><file name="core.xml" hash="93f1070ea6bdbf4d84e7892a5ac0f400"/></dir></dir><dir name="template"><dir name="innobyte"><dir name="emag_marketplace"><dir><dir name="catalog"><dir name="product"><dir name="edit"><dir name="tab"><file name="emag_marketplace_form_after.phtml" hash="d5c2f3121179ff57ec656b3f118b9767"/></dir></dir><file name="edit.phtml" hash="eecad18f7709d130032067d24739c7ee"/></dir></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="form"><file name="address.phtml" hash="a9b386c72699305a98393b5cd0d74943"/></dir><dir name="items"><file name="grid.phtml" hash="d38172cd6a2336ea908a811e4add9eee"/></dir><dir name="shipping"><dir name="method"><file name="form.phtml" hash="83231a4b5f764ce9ba0a025e923133a8"/></dir></dir><dir name="totals"><file name="voucher.phtml" hash="cad64614d2d39235749d609acfaa0d7e"/></dir></dir><dir name="shipment"><dir name="packaging"><file name="popup.phtml" hash="23745250ff3dd4097c2db02724da86a5"/></dir></dir><file name="totals.phtml" hash="75721998e3b54102f00e5811035c5635"/><dir name="view"><file name="comment.phtml" hash="077590b70fdca143bdacdf6417eafe59"/><dir name="invoice"><file name="popup.phtml" hash="3e66f62b99db17b25508cb2ea5d98d75"/></dir><dir name="tab"><file name="info.phtml" hash="cb3cb174b4cc53b2f027133fac258603"/></dir></dir></dir></dir></dir><file name="city-autocomplete.phtml" hash="d65cdd8eb3da972acd5d1034d9d6fb5c"/></dir><dir name="core"><file name="button.phtml" hash="69d0764414ca2f5479fa33cb959938ff"/><dir><dir name="debugger_email"><file name="cron.phtml" hash="579efa83212bc5c40040661bfa5f6f85"/><file name="disabled_extensions.phtml" hash="c3ad7a6601ec3e0728f7e8f0b6f954a7"/><file name="general.phtml" hash="55f57190f950090953dced36f29327bc"/><file name="inno_config_data.phtml" hash="404e799ac17b746af9b839cf5355cd2e"/><file name="inno_extensions.phtml" hash="f3f2cdc4de54d9fd0bbc16662b8b9130"/><file name="rewrites.phtml" hash="4d5ef250221d78738b517805376593be"/></dir></dir><file name="shop.phtml" hash="c01bda6de32abd29133e21314464a378"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Innobyte_EmagMarketplace.csv" hash="90af690df55103cacfae3a8785eab751"/><dir name="template"><dir name="email"><dir name="innobyte"><dir name="emag_marketplace"><file name="errors.html" hash="3ee9c66da915736970df64fd9997b134"/></dir><dir name="core"><file name="debug.html" hash="d676f5c3000f50f8ff1253be2a550ff1"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="innobyte"><dir name="emag_marketplace"><file name="style.css" hash="5848cd48fb6ad98ab5ce7017b2893187"/></dir></dir></dir><dir name="images"><dir name="innobyte"><dir name="emag_marketplace"><file name="pdf_icon.png" hash="28cdd201144351e73035a9a0e87873c0"/><file name="trash.png" hash="50967defe5ec53849432c8aa9088a0f4"/></dir><dir name="core"><file name="error_msg_icon.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="icon-enabled.png" hash="5fa7c06b312cbea3675e844686e434af"/><file name="note_msg_icon.gif" hash="e774ee481a2820789c1a77112377c4e0"/></dir></dir></dir><dir name="js"><dir name="innobyte"><dir name="emag_marketplace"><file name="category.js" hash="93e14d1fd6ead1dc89bd61cde22cb3be"/><file name="locality.js" hash="fd0d491529f49caeca258805dd6da7e0"/><file name="packaging.js" hash="2f7f4b636461a2d9ddfbb84690726a66"/><file name="product.js" hash="6475229cd509c55c63f676297f4579d3"/><dir><dir name="protolicius"><file name="README.rdoc" hash="94cf4a315a18d6a7e2b4a16081001549"/><file name="event.simulate.js" hash="ff2cb029b4f6579bbf7caec22d4d07ee"/></dir></dir><file name="vat.js" hash="93d3ff86c70a2e4297bcd1e7fbd62cf0"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="innobyte"><dir name="core"><file name="init.js" hash="48517ed746f15553e7adc8f86983f51f"/></dir></dir></dir><dir name="."><file name="README.md" hash="0b064710af30dadcd170dcb2585b2161"/></dir></target></contents>
17
- <compatible/>
18
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
19
- </package>
1
  <?xml version="1.0"?>
2
+ <package><name>Innobyte_EmagMarketplace</name><version>1.1.9</version><stability>stable</stability><license>Innobyte License</license><channel>community</channel><extends></extends><summary>Being the fastest growing marketplace in Romania, Bulgaria and Hungary, eMAG Marketplace will bring your store&#x2019;s sales to the next level by opening a new and efficient sales channel.</summary><description>Being the fastest growing marketplace in Romania, Bulgaria and Hungary, eMAG Marketplace will bring your store&#x2019;s sales to the next level by opening a new and efficient sales channel.
3
+ eMAG Marketplace integration extension by Innobyte helps Magento store owners publish their products on eMAG Marketplace and build up their reputation.</description><notes></notes><authors><author><name>Florin Mihai Savici</name><user>innobyte</user><email>management@innobyte.com</email></author></authors><date>2015-09-16</date><time>5:17:28</time><compatible></compatible><dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><file name="package.xml" hash="d9eeca78be22e8e78e61cf1e5bd3ae6e"/><file name="User Guide eMAG Marketplace.pdf" hash="e8f68868800eee3dea7e7bcdfada1c87"/><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="innobyte"><dir name="emag_marketplace"><file name="pdf_icon.png" hash="28cdd201144351e73035a9a0e87873c0"/><file name="trash.png" hash="50967defe5ec53849432c8aa9088a0f4"/></dir></dir></dir><dir name="js"><dir name="innobyte"><dir name="emag_marketplace"><file name="category.js" hash="93e14d1fd6ead1dc89bd61cde22cb3be"/><file name="locality.js" hash="fd0d491529f49caeca258805dd6da7e0"/><file name="packaging.js" hash="2f7f4b636461a2d9ddfbb84690726a66"/><file name="product.js" hash="6475229cd509c55c63f676297f4579d3"/><file name="vat.js" hash="93d3ff86c70a2e4297bcd1e7fbd62cf0"/><dir name="protolicius"><file name="event.simulate.js" hash="ff2cb029b4f6579bbf7caec22d4d07ee"/><file name="README.rdoc" hash="94cf4a315a18d6a7e2b4a16081001549"/></dir></dir></dir></dir><dir name="css"><dir name="innobyte"><dir name="emag_marketplace"><file name="style.css" hash="5848cd48fb6ad98ab5ce7017b2893187"/></dir></dir></dir></dir></dir></dir></dir><dir name="app"><dir name="locale"><dir name="en_US"><file name="Innobyte_EmagMarketplace.csv" hash="b1d6b5311109a05c983e44a14ef14576"/><dir name="template"><dir name="email"><dir name="innobyte"><dir name="emag_marketplace"><file name="errors.html" hash="3ee9c66da915736970df64fd9997b134"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="innobyte"><file name="emag_marketplace.xml" hash="0390552260d5432c69184f0066e1515b"/></dir></dir><dir name="template"><dir name="innobyte"><dir name="emag_marketplace"><file name="city-autocomplete.phtml" hash="d65cdd8eb3da972acd5d1034d9d6fb5c"/><dir name="catalog"><dir name="product"><file name="edit.phtml" hash="eecad18f7709d130032067d24739c7ee"/><dir name="edit"><dir name="tab"><file name="emag_marketplace_form_after.phtml" hash="d5c2f3121179ff57ec656b3f118b9767"/></dir></dir></dir></dir><dir name="sales"><dir name="order"><file name="totals.phtml" hash="5f9a8e99049f93e31bbad436773c35d6"/><dir name="shipment"><dir name="packaging"><file name="popup.phtml" hash="23745250ff3dd4097c2db02724da86a5"/></dir></dir><dir name="view"><file name="comment.phtml" hash="077590b70fdca143bdacdf6417eafe59"/><dir name="invoice"><file name="popup.phtml" hash="3e66f62b99db17b25508cb2ea5d98d75"/></dir><dir name="tab"><file name="info.phtml" hash="cb3cb174b4cc53b2f027133fac258603"/></dir></dir><dir name="create"><dir name="items"><file name="grid.phtml" hash="d38172cd6a2336ea908a811e4add9eee"/></dir><dir name="totals"><file name="voucher.phtml" hash="83584297ec57704c07f0f7482bfdd106"/></dir><dir name="form"><file name="address.phtml" hash="a9b386c72699305a98393b5cd0d74943"/></dir><dir name="shipping"><dir name="method"><file name="form.phtml" hash="83231a4b5f764ce9ba0a025e923133a8"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="code"><dir name="local"><dir name="Innobyte"><dir name="EmagMarketplace"><file name="Exception.php" hash="8dd468af95b0bc4dedb6563e962f06e4"/><dir name="Helper"><file name="Data.php" hash="1ce839f33b990555efc959ff757efad9"/></dir><dir name="Model"><file name="Category.php" hash="ebaf767fa33ad5af408286614dd20ef0"/><file name="Cron.php" hash="1ef1ed3b24553a49fe6130527e7b6f5c"/><file name="Locality.php" hash="9eebf51b580234af3279d22801368c24"/><file name="Product.php" hash="c8c910e60151bb1bb22c40ebaf12bc75"/><file name="Vat.php" hash="6f8024e5bfc76ccd1c827d81bda48d25"/><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="6b2fd18774f751f8a8616f0fc5a80ec0"/></dir></dir><dir name="Source"><file name="Category.php" hash="1c23985bd28e00317bf9b85b6ec10741"/><file name="CommissionTypes.php" hash="e7c14db1490db8b4b9c0413d4f4f40aa"/><file name="FamilyType.php" hash="170f2cdc201c2e0d41adfaefa5309840"/><file name="OfferStatus.php" hash="0d08ef9e0379014e97f732b3ebd3bb71"/><file name="Vat.php" hash="74fc94ccf2fc63fb22697e44f610a9c7"/><dir name="Attribute"><dir name="Sync"><file name="Status.php" hash="7866207168f3a3251d9bb38cd5126aed"/></dir></dir><dir name="Customer"><dir name="Address"><dir name="Attributes"><file name="Legalentity.php" hash="996caae77c6a7cf32e92343ab5a0ab4e"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Prefix"><file name="Abstract.php" hash="f8472875f771d4de639c660ba02357e4"/><file name="Creditmemo.php" hash="f95e01282ec052b3e23a88c1fbbeef96"/><file name="Invoice.php" hash="e04ebef0636ab0e9f246a1f7a75a03ed"/></dir></dir></dir></dir><dir name="Order"><dir name="Convert"><file name="Abstract.php" hash="75a329505909db850cb322af3dbb9656"/><file name="Emag.php" hash="a45429d7ff1a2f8284fa2e549cebe749"/><file name="Magento.php" hash="638b426e9d36c226c2df0f1b0753cce7"/><dir name="Emag"><file name="Update.php" hash="8d37dfbca65a7648930d5fbcb18764d3"/></dir></dir></dir><dir name="Customer"><file name="Attributes.php" hash="04866547213ce95f7c2caa5d426ba681"/><file name="Form.php" hash="259c8eba0ff64f7aa2559f46f9bd0bd4"/></dir><dir name="Category"><file name="Characteristic.php" hash="c861ac8bb0485228056139ec2a5b2b1b"/><file name="Familytype.php" hash="c6ac762fa2f20261774c02490a157226"/></dir><dir name="Api"><file name="Abstract.php" hash="ffebd562f865052667b1a7e830c58867"/><file name="Awb.php" hash="7427827fe386c1fd48c47698d076cada"/><file name="Category.php" hash="abcaa037eca294794c7586a9324c7874"/><file name="Locality.php" hash="9229328cbd3387cfa41e3be79b79de87"/><file name="Order.php" hash="5dd5599ae6747cbe7912b47b78a9754a"/><file name="Product.php" hash="b20a954debe6aee6f6d53f06ec9d8fa2"/><file name="Response.php" hash="96586001de9ca54796479701694a6f30"/><file name="Vat.php" hash="1dadec377d4b25cad027b6299ece0f78"/></dir><dir name="Sales"><file name="Abstract.php" hash="a631cb89d8d3f1613e332573330539e8"/><file name="Invoice.php" hash="1967cfec91cc00ec80a5ee52551cfcdb"/><file name="Observer.php" hash="8fdba77e4572c681e4e017f0095907f2"/><file name="Order.php" hash="e345960b8361cf62e57f4e10cbc890a1"/><file name="Quote.php" hash="30ad86af4d35ecb361feda0892f1ad78"/><dir name="Address"><file name="Abstract.php" hash="ba8a438491d2b5de442bee67541594d0"/></dir><dir name="Order"><file name="Address.php" hash="60ae8af915f7ef591a99ce963ace9c70"/><file name="Item.php" hash="56fd503ed25e09569b4b220f1ed828cd"/><file name="Status.php" hash="2cc44f61150581a931c76a7224402724"/><file name="Voucher.php" hash="bde2d05e031f136aaf59478b842d68e6"/><dir name="Creditmemo"><file name="Total.php" hash="647fae830f2eee8c80221460ca2b380d"/></dir><dir name="Invoice"><file name="Total.php" hash="a49d7d57de40d65d22ac2ceddc20ffa8"/></dir></dir><dir name="Item"><file name="Abstract.php" hash="d308f8ad6b1aeaa1eade7c7457ab0ef4"/></dir><dir name="Quote"><file name="Address.php" hash="9e8e4ee7aa202b4940e1d532205db098"/><file name="Voucher.php" hash="e1364b975930aa4bc13fb5d4348ceb55"/><dir name="Address"><dir name="Total"><file name="Voucher.php" hash="7a1bfc7246b499b4b47cc31984048a1c"/></dir></dir></dir><dir name="Voucher"><file name="Abstract.php" hash="5db452297c71ba7cb2452347e8950131"/></dir></dir><dir name="Invoice"><dir name="Pdf"><dir name="Total"><file name="Voucher.php" hash="b1c384787ec28e7fc9b2306d7cfa84f8"/></dir></dir></dir><dir name="Payment"><dir name="Method"><file name="Banktransfer.php" hash="de16ae6d2bfbe44efae91de5cb51c9c9"/><file name="Cashondelivery.php" hash="31d5608e9b4c2e47b03b70d922114ee1"/><file name="Cc.php" hash="054e75f54dbdb92dd92c79cc69e6006a"/><file name="Unknown.php" hash="c2bfa3c318a5d14867589a6d162d3014"/></dir></dir><dir name="Resource"><file name="Category.php" hash="d0b00b7a79d42b1c8264215af8f6f25d"/><file name="Locality.php" hash="984483f1f254c773dc03f84e7ecfc842"/><file name="Product.php" hash="8086bddef12d45e3b700e64f7a5154cd"/><file name="Vat.php" hash="bd96a9809e1732c0192835443474a41b"/><dir name="Product"><file name="Collection.php" hash="2b269b788215822b1e836f1685eef1c6"/></dir><dir name="Category"><file name="Characteristic.php" hash="a6a7f440c274a8dc70e21601461faa43"/><file name="Collection.php" hash="58380ccc531ad65837eda3d1ec326279"/><file name="Familytype.php" hash="252f23169c78af34f1101c5c1ef00429"/><dir name="Familytype"><file name="Collection.php" hash="b51fb1747d1c563605801a52cddbc807"/></dir><dir name="Characteristic"><file name="Collection.php" hash="199a72bfe17fc978980cc466df2e6bf1"/></dir></dir><dir name="Sales"><file name="Abstract.php" hash="4e28e8cea40a92c8551b9bb61fcc9168"/><file name="Invoice.php" hash="729574058005ed24ac39da04366d6c51"/><file name="Order.php" hash="f560e8f1bf96e2e6a41a692d5fb6c024"/><file name="Quote.php" hash="2e451c02bd215c279a39f33156e464e4"/><dir name="Address"><file name="Abstract.php" hash="c95b407223fec1067ea66080fdf10677"/></dir><dir name="Order"><file name="Address.php" hash="ded5c157ac93c958d2c8149e97ab7b8a"/><file name="Item.php" hash="192143c67ae67ce77d5a69c07edc5f11"/><file name="Voucher.php" hash="307aba5c74dbcd3a99ba37f8f0c72df2"/><dir name="Item"><file name="Collection.php" hash="cc749faeb2b194bab19c8b2f6657bf23"/></dir><dir name="Voucher"><file name="Collection.php" hash="1e99b2c9e29eae6a7ae58d2f56acd01d"/></dir></dir><dir name="Item"><file name="Abstract.php" hash="a750e4cfcb85af0781047fa917e78d5c"/></dir><dir name="Quote"><file name="Address.php" hash="dd2ed7664775fe2d017a62e99f185b8b"/><file name="Voucher.php" hash="75da1101f5ef453b6f796a127120b0d2"/><dir name="Voucher"><file name="Collection.php" hash="d92263c78194131f1f93b965309dea04"/></dir></dir><dir name="Voucher"><file name="Abstract.php" hash="c4c39040b36e50120a227b6e39138fa5"/></dir><dir name="Invoice"><file name="Collection.php" hash="be9a2e37e986174327d4e532175a1a98"/></dir></dir><dir name="Vat"><file name="Collection.php" hash="960899654592afb847d3bbf08a812d4d"/></dir><dir name="Locality"><file name="Collection.php" hash="919d2ec66fde1bfdfdba7a4351ec6e5b"/></dir></dir><dir name="Locality"><file name="Flag.php" hash="a4e04313b24d2f32e9a7c101b7a3ebf4"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Emag.php" hash="70808be244b81ac6829e87a4a6e3349c"/></dir></dir></dir><dir name="docs"><file name="eMAG Markeplace API documentation v3.6.docx" hash="e5cf25307fc1111c12d2e10825aff517"/></dir><dir name="sql"><dir name="innobyte_emag_marketplace_product_setup"><file name="upgrade-1.1.5-1.1.6.php" hash="9da9d02d143e1826eaaf28e52c975b9b"/></dir><dir name="innobyte_emag_marketplace_setup"><file name="install-1.0.0.php" hash="ea105ca65a3328b3e7228a630583b7ce"/><file name="upgrade-1.0.6-1.1.0.php" hash="5de1f8d5a5e514edcf6fbc764b3f4155"/><file name="upgrade-1.1.4-1.1.5.php" hash="26419944e6ce2a4fab031c9a889aec5e"/><file name="upgrade-1.1.7-1.1.8.php" hash="95b5c1c19f0effac77efe654b973cf47"/><file name="upgrade-1.1.8-1.1.9.php" hash="88342910e716d88d9d2981fa80a2ee79"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aea476a16999dabe7c929151a86493a7"/><file name="config.xml" hash="c162bea50f567cd89893cb6d33bfb862"/><file name="jstranslator.xml" hash="2bad6817b7f348bcba8048d2c44004f3"/><file name="system.xml" hash="e652cf7838a954871d6524db719e7502"/></dir><dir name="controllers"><file name="InvoiceController.php" hash="8df75fd59d862afaaa7675d7831b9202"/><dir name="Adminhtml"><dir name="Emag"><file name="CategoryController.php" hash="e42dd195c112b1d2230ff805abed16f3"/><file name="LocalityController.php" hash="181dd7289b8c45b377e3a696470ee7df"/><file name="ProductController.php" hash="a4ad9ac03f7a16154bb220fa6a85ac85"/><file name="VatController.php" hash="16f558732b4fa7a2bb08b7583816b017"/><file name="VoucherController.php" hash="19bf0a8a753c171447b8bf98069ad26f"/></dir><dir name="Sales"><file name="OrderController.php" hash="ec1bbff5d2ee20dd850dfbe6ea4d53a2"/><dir name="Invoice"><file name="UploadController.php" hash="888399443eb8b0f28c91e698b34d9f0e"/></dir></dir></dir></dir><dir name="data"><dir name="innobyte_emag_marketplace_product_setup"><file name="data-upgrade-1.1.5-1.1.6.php" hash="644a81b8dc17b687a7ae87d9f1c6579e"/><file name="data-upgrade-1.1.6-1.1.7.php" hash="2889b67b3319a14963446f007df28fa5"/></dir><dir name="innobyte_emag_marketplace_setup"><file name="data-install-1.0.0.php" hash="e5d5342a60398c63955fe537b63699e3"/><file name="data-upgrade-1.1.4-1.1.5.php" hash="df1866bf54b32195f3c9b55d7f76abda"/><file name="data-upgrade-1.1.7-1.1.8.php" hash="da0553813edc817372eeb45812cb468d"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file name="Category.php" hash="b28cf6ff81b68b26299ea2d94f19ef1e"/><file name="Locality.php" hash="244d56f08dbfcb14924c6dc3607a12c3"/><file name="Vat.php" hash="af6380f2b1a91540a85717d8f7cc024c"/><dir name="Catalog"><dir name="Product"><file name="Edit.php" hash="56121505211aee840a3f896283b3cd05"/><dir name="Edit"><dir name="Tab"><file name="EmagMarketplace.php" hash="c015e92d354e514f68d156363a4b809d"/></dir></dir></dir></dir><dir name="Form"><dir name="Element"><file name="Barcodes.php" hash="029b5cabf48a1475378ff9ec83242c72"/><file name="File.php" hash="2d19999b0bf01b33e07a1667e89bc5c3"/></dir><dir name="Field"><file name="LocalityId.php" hash="fda3d9e04a2aab30d3affcc377770571"/></dir></dir><dir name="Category"><file name="Grid.php" hash="17d5e61840283e320e455796b063b85b"/></dir><dir name="Sales"><dir name="Order"><dir name="Grid"><dir name="Column"><file name="Filter.php" hash="fe579cd7c6cd4d4260aaa6127050cb98"/><file name="Renderer.php" hash="560908074b309c1be8dc6380efea26d1"/></dir></dir><dir name="Create"><dir name="Totals"><file name="Voucher.php" hash="547dbfe0c4107d8a041cd35d0d0358d5"/></dir><dir name="Billing"><dir name="Method"><file name="Form.php" hash="6242c0e1592f5ee96cb2e179aecaf3b1"/></dir></dir><dir name="Items"><file name="Grid.php" hash="c58d1f3342f10014fd8cf2b9fa2a7380"/></dir><dir name="Shipping"><dir name="Method"><file name="Form.php" hash="c6596c59ebfb7b7e73ab06da32c7adf5"/></dir></dir></dir><dir name="View"><file name="Comment.php" hash="39a50c5d6ecf9622523f0948f7d1052a"/><dir name="Invoice"><file name="Popup.php" hash="e936b3a67ad5f4bd41cb3458978973e3"/><file name="Upload.php" hash="e7d9468ab75a4da81ad947ee35ea99aa"/><dir name="Upload"><file name="Form.php" hash="08661772c4b2d4dad04ac41b1bc6f2b0"/></dir></dir></dir></dir></dir><dir name="Vat"><file name="Grid.php" hash="6cf11cb0e2568052512dcd9af8a47416"/></dir><dir name="Locality"><file name="Grid.php" hash="9d3c565f261f93d6b38d196be6b9fa20"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Innobyte_EmagMarketplace.xml" hash="e687b367f76df4cda57c2c0493312b4a"/></dir></dir></dir></target></contents></package>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/adminhtml/default/default/images/innobyte/core/error_msg_icon.gif DELETED
Binary file
skin/adminhtml/default/default/images/innobyte/core/icon-enabled.png DELETED
Binary file
skin/adminhtml/default/default/images/innobyte/core/note_msg_icon.gif DELETED
Binary file