diglin_ricento - Version 1.0.13.1

Version Notes

## Version 1.0.13
Important fix for price products (and sales options & rules in general) when several listing processes running at same time

## Version 1.0.12
7485ad0 Prevent Exception while editing product if API problem appear while conditions options
2927622 Add translation for frontend, change payment info template
29069ea Fix wrong variable name for payment method instruction
1738457 add payment block info in frontend area too for email generated from backend
259f885 Fix issue with products grid and massaction
8d37514 Update readme file
ea18812 Redirect to edit page if error occur
0fe5a3c Implement Bank information display if ricardo.ch payment method Bank transfer is used, Remove the cleanup listing log as it is duplicate with the job cleanup
9cd82a8 Change order of the tab display 1) Synchronization 2) Listing Log instead of the opposite
bc809c0 Fix random security error message on fresh install

## Version 1.0.10
e2304ab Change the status of an item to stop if the item has not been sold. It will stop the complete list if all items are stopped.
e2c0676 Set website Id while saving new customer even if store id was also provided to be sure that the user is saved into the correct website
0d01b4a Fix missing log url in message
ff1005c Skip required option when creating an order, also for custom option
9b48ef6 Fix missing home number

## Version 1.0.9
- Fix issue with some optional API property set to 0 (like template Id)
- 0c1eb42 Revert temporary success / error in dispatcher list , improve translations of string in product grid
- 74c3284 Show a small message in sync grid while running or chunk running to allow to differentiate both kind of sync
- 68eed7f Raise to 400 items to trigger in dispatch
- 1d3a839 Prevent create a new job while having a chunk running sync list
- 3241ef0 Change the way to handle the bucket of items in the dispatcher, fix a bug while triggering the order dispatcher and getting the list of listed items
- adcbc59 Improve message display in sync grid
- 6b6c45e Fix issue with "Until Sold" feature
- 2f48ea4 Improve the way to set/get successful or error log item
- 86fcc17 Display Product list name in the sync log grid instead to put it as message
- 1219b09 Fix issue with products grid and configurable products having article inserted also as simple article
- 95efdca Fix duplicate collection item error
- 4d38ed3 Make the option Schedule Reactivation "Until Sold" better explicit and working
- 03bc9cd Update code documentation
- 658c9f6 In some cases, picture's extension is not recognized so change the logic to determine if it exists or not Catch Exception and log them in cron class
## Version 1.0.8
- b5f1afa Update translations file
- c0d3fbb Fix issue with dispatcher and completed status
- 27c48c9 Fix interface issue (invisible language was also required input) with language selection and payment method "other" which needs a payment description and shipping description field if shipping "other" is selected
- 9e0be11 Improve debugging content when dispatcher mets errors
- b994fa0 Improve grid translations for products
- 84baa1b Change order of token DEV/PROD configuration fields
- 868e576 Fix issue with product price max limit (should be only for "Buy now" and payment method with credit card)
- 379a51b Fix issue with too long strings saved into DB if error occurred
- 0eb9f8d Cosmetic code changes
- 79ce926 Change translation
- 356c909 Fix issue with job message and json encoding (some loop appeared in some use cases)
- 738f316 Better judge if some values must be retrieved from the API depending if the extension is configured or not
- cd34d94 Prevent loop when doing the dispatch
- 14d3beb fix uninstall file txt with wrong language folder package
- a5e6350 Fix translation issue in the sync grid
- 90a2f7c Fix issue if extension is disabled with payment and shipping methods
- 33055cc Add nl2br for description

## Version 1.0.7
- 42f18da Prevent warning messages for some variables, Prevent Exception when picture doesn't exist in preview, set per default the dev mode to 1 because user receives BETA API Token first and some people doesn't set correctly the configuration
- 29767d9 Add more condition to display error in case of wrong API configuration and coming from banner notification
- 57da567 Invite user to check his configuration if a problem occurs
- c514cb0 Merge branch 'develop'

## Version 1.0.6
- 6a6ca4f Do not set the status of the parent configurable product when list on ricardo.ch
- eb0d25a Handle correctly errors if done in the backend notification banner
- 68f812a add short description as fallback product description
- bb0c931 change redirect url and add error message
- c4fbe49 Check and List action: save also product listing information
- 349218a Merge branch 'develop' of git://github.com/diglin/ricento into develop
- f467eb4 Fix issue with grid of products after filter reset (missing form key hidden field)
- 4cc8e3b Revert changes done for RIC-102, display products item w/o any error
- afb9215 Add new url to register to the API
- c0b50e9 In case errors are coming from the API but it is at backend notification level, we catch the error and display it as session error message
- 7d0c803 Merge branch 'develop' of github.com:diglin/ricento into develop
- 068a409 allow to delete a job even if it is running, fix some typo translations, allow to save when clicking on "check and list" button from a product listing

## Version 1.0.5
- c1b3c90 Merge branch 'develop'
- 9f59a2f Fix definitely issue RIC-102 with product grid display
- 3c3547a Fix issue RIC-102: product grid display in product listing with some configuration provide error cause of the collection and duplicate items found
- 5d1706e Merge pull request #1 from diglin/develop

## Version 1.0.4
- ebaec62 Remove the filter collection to not get "not visible" products. Don't remember the reason of this filter, hope it doesn't have consequence with order creation (normally no)
- 90e2a93 Merge branch 'develop'

## Version 1.0.3
- c55a6dd Fix issue with wrong store id, should not be website id while getting storeConfig
- 00c2960 Update README.md

## Version 1.0.2
- 880dbfd Fix issue if API not yet configured and Product Edit Page is requested from the backend
- 5841d06 Update gitsubmodule (replace bitbucket with github)
- be2b77a Update readme file
- 9384e3c Update doc

Download this release

Release Info

Developer diglin
Extension diglin_ricento
Version 1.0.13.1
Comparing to
See all releases


Version 1.0.13.1

Files changed (210) hide show
  1. app/code/community/Diglin/Ricento/Block/Adminhtml/Config/Source/Heading.php +29 -0
  2. app/code/community/Diglin/Ricento/Block/Adminhtml/Config/Source/Hint.php +73 -0
  3. app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Account.php +105 -0
  4. app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Bestsellers.php +78 -0
  5. app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Lifetime.php +29 -0
  6. app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/News.php +63 -0
  7. app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Turnover.php +47 -0
  8. app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Checkboxes/Extensible.php +88 -0
  9. app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Fieldset/Inline.php +40 -0
  10. app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Radios/Extensible.php +119 -0
  11. app/code/community/Diglin/Ricento/Block/Adminhtml/Log.php +46 -0
  12. app/code/community/Diglin/Ricento/Block/Adminhtml/Log/Tabs.php +86 -0
  13. app/code/community/Diglin/Ricento/Block/Adminhtml/Notifications/Default.php +64 -0
  14. app/code/community/Diglin/Ricento/Block/Adminhtml/Notifications/Expiration.php +106 -0
  15. app/code/community/Diglin/Ricento/Block/Adminhtml/Page/Menu.php +124 -0
  16. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Children.php +40 -0
  17. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Form/Renderer/Categories.php +31 -0
  18. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Form/Renderer/Mapping.php +44 -0
  19. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Mapping.php +74 -0
  20. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree.php +36 -0
  21. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree/Categories.php +31 -0
  22. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree/Form.php +35 -0
  23. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing.php +37 -0
  24. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit.php +156 -0
  25. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Form.php +33 -0
  26. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs.php +60 -0
  27. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/General.php +161 -0
  28. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products.php +284 -0
  29. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Add.php +160 -0
  30. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Massaction.php +27 -0
  31. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Article.php +41 -0
  32. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Configured.php +47 -0
  33. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Customoptions.php +53 -0
  34. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Inventory.php +47 -0
  35. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Name.php +44 -0
  36. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Status.php +80 -0
  37. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Rules.php +243 -0
  38. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Selloptions.php +531 -0
  39. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Form/Abstract.php +62 -0
  40. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid.php +215 -0
  41. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid/Renderer/Status.php +55 -0
  42. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid/Renderer/Total.php +36 -0
  43. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit.php +83 -0
  44. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Form.php +83 -0
  45. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs.php +45 -0
  46. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs/Rules.php +140 -0
  47. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs/Selloptions.php +142 -0
  48. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Preview.php +363 -0
  49. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Log.php +44 -0
  50. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Log/Grid.php +198 -0
  51. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/New.php +49 -0
  52. app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/New/Form.php +64 -0
  53. app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid.php +173 -0
  54. app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid/Renderer/Progress.php +52 -0
  55. app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid/Renderer/Title.php +21 -0
  56. app/code/community/Diglin/Ricento/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php +37 -0
  57. app/code/community/Diglin/Ricento/Block/Payment/Info.php +29 -0
  58. app/code/community/Diglin/Ricento/Controller/Adminhtml/Action.php +70 -0
  59. app/code/community/Diglin/Ricento/Controller/Adminhtml/Products/Listing.php +293 -0
  60. app/code/community/Diglin/Ricento/Exception.php +62 -0
  61. app/code/community/Diglin/Ricento/Helper/Api.php +109 -0
  62. app/code/community/Diglin/Ricento/Helper/Dashboard/Turnover.php +28 -0
  63. app/code/community/Diglin/Ricento/Helper/Data.php +646 -0
  64. app/code/community/Diglin/Ricento/Helper/Price.php +122 -0
  65. app/code/community/Diglin/Ricento/Helper/Tools.php +108 -0
  66. app/code/community/Diglin/Ricento/Model/Api/Services/Abstract.php +401 -0
  67. app/code/community/Diglin/Ricento/Model/Api/Services/Customer.php +39 -0
  68. app/code/community/Diglin/Ricento/Model/Api/Services/Security.php +70 -0
  69. app/code/community/Diglin/Ricento/Model/Api/Services/Sell.php +171 -0
  70. app/code/community/Diglin/Ricento/Model/Api/Services/Selleraccount.php +37 -0
  71. app/code/community/Diglin/Ricento/Model/Api/Services/System.php +38 -0
  72. app/code/community/Diglin/Ricento/Model/Api/Token.php +112 -0
  73. app/code/community/Diglin/Ricento/Model/Config/Source/Abstract.php +53 -0
  74. app/code/community/Diglin/Ricento/Model/Config/Source/Categories.php +33 -0
  75. app/code/community/Diglin/Ricento/Model/Config/Source/Languages.php +55 -0
  76. app/code/community/Diglin/Ricento/Model/Config/Source/Products/Listing/Log.php +27 -0
  77. app/code/community/Diglin/Ricento/Model/Config/Source/Products/Listing/Status.php +28 -0
  78. app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Payment.php +49 -0
  79. app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping.php +39 -0
  80. app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Availability.php +31 -0
  81. app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Calculation.php +42 -0
  82. app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Packages.php +41 -0
  83. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Currency.php +31 -0
  84. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Days.php +44 -0
  85. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Order/Status.php +25 -0
  86. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Price/Method.php +44 -0
  87. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Price/Source.php +50 -0
  88. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Product/Condition.php +43 -0
  89. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Product/Condition/Source.php +30 -0
  90. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Promotion.php +56 -0
  91. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Reactivation.php +40 -0
  92. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Template.php +38 -0
  93. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Type.php +33 -0
  94. app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Warranty.php +37 -0
  95. app/code/community/Diglin/Ricento/Model/Config/Source/Status.php +77 -0
  96. app/code/community/Diglin/Ricento/Model/Config/Source/Store.php +40 -0
  97. app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Progress.php +31 -0
  98. app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Status.php +31 -0
  99. app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Type.php +34 -0
  100. app/code/community/Diglin/Ricento/Model/Config/Source/Website.php +37 -0
  101. app/code/community/Diglin/Ricento/Model/Cron.php +111 -0
  102. app/code/community/Diglin/Ricento/Model/Dispatcher.php +60 -0
  103. app/code/community/Diglin/Ricento/Model/Dispatcher/Abstract.php +479 -0
  104. app/code/community/Diglin/Ricento/Model/Dispatcher/Check/List.php +325 -0
  105. app/code/community/Diglin/Ricento/Model/Dispatcher/List.php +192 -0
  106. app/code/community/Diglin/Ricento/Model/Dispatcher/Order.php +761 -0
  107. app/code/community/Diglin/Ricento/Model/Dispatcher/Relist.php +113 -0
  108. app/code/community/Diglin/Ricento/Model/Dispatcher/Stop.php +138 -0
  109. app/code/community/Diglin/Ricento/Model/Dispatcher/Sync/List.php +221 -0
  110. app/code/community/Diglin/Ricento/Model/Entity/Attribute/Source/Conditions.php +42 -0
  111. app/code/community/Diglin/Ricento/Model/Filter.php +53 -0
  112. app/code/community/Diglin/Ricento/Model/Observer.php +210 -0
  113. app/code/community/Diglin/Ricento/Model/Products/Category.php +76 -0
  114. app/code/community/Diglin/Ricento/Model/Products/Category/Mapping.php +184 -0
  115. app/code/community/Diglin/Ricento/Model/Products/Listing.php +232 -0
  116. app/code/community/Diglin/Ricento/Model/Products/Listing/Item.php +710 -0
  117. app/code/community/Diglin/Ricento/Model/Products/Listing/Item/Product.php +1074 -0
  118. app/code/community/Diglin/Ricento/Model/Products/Listing/Log.php +96 -0
  119. app/code/community/Diglin/Ricento/Model/Resource/Api/Token.php +56 -0
  120. app/code/community/Diglin/Ricento/Model/Resource/Api/Token/Collection.php +28 -0
  121. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing.php +106 -0
  122. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Collection.php +26 -0
  123. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Item.php +162 -0
  124. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Item/Collection.php +145 -0
  125. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Log.php +51 -0
  126. app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Log/Collection.php +26 -0
  127. app/code/community/Diglin/Ricento/Model/Resource/Rule.php +21 -0
  128. app/code/community/Diglin/Ricento/Model/Resource/Rule/Collection.php +26 -0
  129. app/code/community/Diglin/Ricento/Model/Resource/Sales/Options.php +25 -0
  130. app/code/community/Diglin/Ricento/Model/Resource/Sales/Options/Collection.php +26 -0
  131. app/code/community/Diglin/Ricento/Model/Resource/Sales/Transaction.php +34 -0
  132. app/code/community/Diglin/Ricento/Model/Resource/Sales/Transaction/Collection.php +160 -0
  133. app/code/community/Diglin/Ricento/Model/Resource/Sync/Abstract.php +31 -0
  134. app/code/community/Diglin/Ricento/Model/Resource/Sync/Job.php +79 -0
  135. app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Collection.php +26 -0
  136. app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Listing.php +21 -0
  137. app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Listing/Collection.php +26 -0
  138. app/code/community/Diglin/Ricento/Model/Rule.php +156 -0
  139. app/code/community/Diglin/Ricento/Model/Sales/Method/Payment.php +82 -0
  140. app/code/community/Diglin/Ricento/Model/Sales/Method/Shipping.php +114 -0
  141. app/code/community/Diglin/Ricento/Model/Sales/Options.php +131 -0
  142. app/code/community/Diglin/Ricento/Model/Sales/Transaction.php +87 -0
  143. app/code/community/Diglin/Ricento/Model/SplAutoloader.php +136 -0
  144. app/code/community/Diglin/Ricento/Model/Sync/Abstract.php +50 -0
  145. app/code/community/Diglin/Ricento/Model/Sync/Job.php +156 -0
  146. app/code/community/Diglin/Ricento/Model/Sync/Job/Listing.php +59 -0
  147. app/code/community/Diglin/Ricento/Model/Validate/Products/Item.php +260 -0
  148. app/code/community/Diglin/Ricento/Model/Validate/Rules/Methods.php +208 -0
  149. app/code/community/Diglin/Ricento/Model/Validate/Sales/Increment.php +120 -0
  150. app/code/community/Diglin/Ricento/Test/Model/Rule/Validate.php +48 -0
  151. app/code/community/Diglin/Ricento/Test/Model/Rule/Validate/expectations/testPaymentMethodCombinations.yaml +89 -0
  152. app/code/community/Diglin/Ricento/Test/Model/Rule/Validate/providers/testPaymentMethodCombinations.yaml +100 -0
  153. app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment.php +48 -0
  154. app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment/expectations/testStartPriceIncrementCombination.yaml +49 -0
  155. app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment/providers/testStartPriceIncrementCombination.yaml +55 -0
  156. app/code/community/Diglin/Ricento/controllers/Adminhtml/AccountController.php +60 -0
  157. app/code/community/Diglin/Ricento/controllers/Adminhtml/ApiController.php +106 -0
  158. app/code/community/Diglin/Ricento/controllers/Adminhtml/DashboardController.php +38 -0
  159. app/code/community/Diglin/Ricento/controllers/Adminhtml/IndexController.php +22 -0
  160. app/code/community/Diglin/Ricento/controllers/Adminhtml/LogController.php +142 -0
  161. app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/CategoryController.php +147 -0
  162. app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/Listing/ItemController.php +203 -0
  163. app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/ListingController.php +574 -0
  164. app/code/community/Diglin/Ricento/controllers/Adminhtml/SupportController.php +31 -0
  165. app/code/community/Diglin/Ricento/controllers/Adminhtml/SyncController.php +109 -0
  166. app/code/community/Diglin/Ricento/data/ricento_setup/data-install-1.0.0.php +60 -0
  167. app/code/community/Diglin/Ricento/etc/adminhtml.xml +108 -0
  168. app/code/community/Diglin/Ricento/etc/config.xml +374 -0
  169. app/code/community/Diglin/Ricento/etc/jstranslator.xml +20 -0
  170. app/code/community/Diglin/Ricento/etc/system.xml +411 -0
  171. app/code/community/Diglin/Ricento/etc/uninstall.txt +18 -0
  172. app/code/community/Diglin/Ricento/sql/ricento_setup/install-1.0.0.php +481 -0
  173. app/code/community/Diglin/Ricento/sql/ricento_setup/uninstall.php +79 -0
  174. app/code/community/Diglin/Ricento/sql/ricento_setup/upgrade-1.0.8-1.0.9.php +35 -0
  175. app/design/adminhtml/default/default/layout/ricento.xml +172 -0
  176. app/design/adminhtml/default/default/template/ricento/dashboard.phtml +27 -0
  177. app/design/adminhtml/default/default/template/ricento/dashboard/account.phtml +17 -0
  178. app/design/adminhtml/default/default/template/ricento/dashboard/bestsellers.phtml +17 -0
  179. app/design/adminhtml/default/default/template/ricento/dashboard/lifeturnover.phtml +17 -0
  180. app/design/adminhtml/default/default/template/ricento/dashboard/news.phtml +30 -0
  181. app/design/adminhtml/default/default/template/ricento/dashboard/toolbar.phtml +23 -0
  182. app/design/adminhtml/default/default/template/ricento/dashboard/turnover.phtml +17 -0
  183. app/design/adminhtml/default/default/template/ricento/dashboard/turnover/graph.phtml +30 -0
  184. app/design/adminhtml/default/default/template/ricento/iframe.phtml +49 -0
  185. app/design/adminhtml/default/default/template/ricento/js/rules/validate/paymentshipping.phtml +53 -0
  186. app/design/adminhtml/default/default/template/ricento/js/salesoptions/validate/increment.phtml +49 -0
  187. app/design/adminhtml/default/default/template/ricento/js/sync/progress.phtml +37 -0
  188. app/design/adminhtml/default/default/template/ricento/log.phtml +21 -0
  189. app/design/adminhtml/default/default/template/ricento/notifications/configured.phtml +21 -0
  190. app/design/adminhtml/default/default/template/ricento/notifications/expiration.phtml +39 -0
  191. app/design/adminhtml/default/default/template/ricento/payment/info/default.phtml +31 -0
  192. app/design/adminhtml/default/default/template/ricento/payment/info/pdf/default.phtml +32 -0
  193. app/design/adminhtml/default/default/template/ricento/products/category/children.phtml +40 -0
  194. app/design/adminhtml/default/default/template/ricento/products/category/mapping.phtml +40 -0
  195. app/design/adminhtml/default/default/template/ricento/products/listing/item/edit/form.phtml +16 -0
  196. app/design/adminhtml/default/default/template/ricento/products/listing/item/preview.phtml +128 -0
  197. app/design/adminhtml/default/default/template/ricento/support.phtml +74 -0
  198. app/design/adminhtml/default/default/template/ricento/sync/check/popup.phtml +54 -0
  199. app/design/frontend/base/default/template/ricento/payment/info/default.phtml +31 -0
  200. app/etc/modules/Diglin_Ricento.xml +16 -0
  201. app/locale/de_CH/Diglin_Ricento.csv +665 -0
  202. app/locale/de_CH/template/email/ricento/admin_message.html +6 -0
  203. app/locale/de_CH/template/email/ricento/private_message.html +35 -0
  204. app/locale/de_DE/Diglin_Ricento.csv +665 -0
  205. app/locale/de_DE/template/email/ricento/admin_message.html +6 -0
  206. app/locale/de_DE/template/email/ricento/private_message.html +35 -0
  207. app/locale/en_US/Diglin_Ricento.csv +660 -0
  208. app/locale/en_US/template/email/ricento/admin_message.html +6 -0
  209. app/locale/en_US/template/email/ricento/private_message.html +35 -0
  210. app/locale/fr_FR/Diglin_Ricento.csv +268 -0
app/code/community/Diglin/Ricento/Block/Adminhtml/Config/Source/Heading.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Diglin_Ricento_Block_Adminhtml_Config_Source_Heading
13
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Heading
14
+ {
15
+ /**
16
+ * Render element html
17
+ *
18
+ * Diglin: for compatibility with older Magento version < 1.5 but also to support depends tag in system.xml
19
+ *
20
+ * @param Varien_Data_Form_Element_Abstract $element
21
+ * @return string
22
+ */
23
+ public function render(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4><input type="hidden" id="%s" name="depends-input" title="depends-input"/></td></tr>',
26
+ $element->getHtmlId(), $element->getLabel(), $element->getHtmlId()
27
+ );
28
+ }
29
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Config/Source/Hint.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Diglin_Ricento_Block_Adminhtml_Config_Source_Hint
13
+ extends Mage_Adminhtml_Block_Abstract
14
+ implements Varien_Data_Form_Element_Renderer_Interface
15
+ {
16
+ /**
17
+ * Render fieldset html
18
+ *
19
+ * @param Varien_Data_Form_Element_Abstract $element
20
+ * @return string
21
+ */
22
+ public function render(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $html = '<p><a href="http://www.diglin.com/?utm_source=magento&utm_medium=extension&utm_campaign=zopim">'
25
+ .'<img style="vertical-align:middle" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALoAAAA7CAYAAADM4pCMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADOlJREFUeNrsnV2MG1cVx++MvZs0a+9OygtI0PoBiYKAuKpUCALWI6GqpaLZvESiLY2tSlRFiK6jpg/9wLsBhdKIetPSDyIhOy0tbQR0UwVV8NB1kCDQoNahEWp5Mn2AipdOILE935wzc8Z7dzqz692d/fDu/Wuvxh7Pt3/3zP+eudfLmJCQkJCQkJCQkJCQkJCQkJBQ8pJWstIDjWre7Op5o9vNGZ12wzTMZv1gVROXU2hLgP7wuWeLlmVWTABc73SYgaWLpcv0bnfW1PXyqw/8siUuq9DAgg6Q1yzTLHpgA+Ae6AA4FlOHqaEzQ9c1wzDU14+caYpLKzRwoD907tmqbRqTC6J4x4ecAGcmTHVvamg6wH6+elbALjQ4oD/4x6cKtmXNBYD7sAPgGMUJcJxCJPemumnCa1ODqfruifMCdqFNIXmpBcB3H9TbbQAcShsgb1NE133Y9a4fyXV8DbD7xVQMw6qIyyu0WZReagGwJxMmNjYDy6KTVfGi+Hw0B7iZAdHcj+gWcxy38MLfflCATWh3fP6RTRHZM3v3zkXMLl8+d07cebY96J22glZF7/oRPAy4X3zAEXbTRMgZc2wZAW8A7HNQypsE9kLEPGUTVMAiTA6G50MFVAWi62Rd9F6GZd6uBFHd8+QAercX0X3IbUtmtp5u0CZyUBD2vLjcscpRJQwXoXUDvd1p6gHcPT+OgOsAOERx3exB7iLkpsycbrrpGqkywF2jL1ERsAttbtC7nUY4kvugmxTN5+2KBZDbCLkpq9WjX69KkluEwlsEAbvQ5gQdwD4ODVKtl1npQU6e3ELIJWYbKeZ0hgDytPrEozdXZYBcZq63A3jNCHgBu9DmBP3Vwy+2AO5y4Mf9RidFcssGu+JDbgPkjpFSn37sawS50wMcpx70/nsBu9Dmy7qgXj9ypn7joXEA3KrRAyFm2Q5ALjPLkL1I7pgp9cTjapUxt+i6LnMliWEM914zCQBn9B6KxBSYzL349hH19s99P7FsTGbv3jw14sYjsiln+9zGVMTs+uVz51p9ZE7GqU0S3m8T1p9dg0xNeF8N2E+jj2uUp3XHQx9jx7wL/WxnS4KOeuPxs/Xrvn0jRvSajZDbsh/J2z7ktePjVYC66CDWPOTea4LdhzwAHkGEisHUhACvLpGp6DeLEfWgC7/0Vsy+J2kdZbH9wnK4fjlB4A/GnFMj5vrg8hMRlSMsXKayBse7ua0Lr3dOvFEHyEsOQG7pKWZdGW7aRlp97omvVMGaFNGapCRGVsW3LrLk+LaF0esFNoYVXr44nU8gsr3FNiAdB/uuUQXrJxePgL1Cx7uexzhH12eyD8ijjre27UBHvffchbrdTZesyzualp5WX3zySwQ5B7EHMlsANX4usaACOPOVgbkTq/gSEe4N+SJg3wj4SqCt0XGvl1a7ryKd6/awLrz+/evzdfStv3/3gRp6cjQjkkt2RfJtCtoW7DMWWBfHnf9M4myNb2RWrDjI8baLt9xL3Lw9dFtOAvICRciVqhJlMTaxJuGcjy/VTtlyoKN8yP2I5nWBlDy8AWDy5OTTg3l+Y9SvAAt9PBtLsDEWNBxLMeu4CV23gzHzsXJNB31nYH8TBHXYnhXgMwWW26hRWWW6TlpEBb4vJiDgeZS2jXVB/e6dw7W423YvnUjWRIrw5iEff2mFx74vqiEWB3mClkWJOfdZ2Pd+voMYNeT2x2xqI9OrzahKhpkWPIeYu02BDbCWDfprfz9cgyhcdByX7Em0pA958xDwrAf8Slv1UVHn5Dpcs/wiUZJFwDOIt/vjMY3T7eHRz1z0IefnIexoSyRJigGe0VPRwLtzPp65jduu+9Gy8+iULouMVBvUuGsNsn+N0JYb6N436LNv3V9zbLeIeXBJ9j23HAU8k2LHLUnMf1JKXl2D6UpthhITPTeqK3CLCQ0+6KfeODRpAeSyA3Aj5K6fPsQGpx/N/cIobuOfRJ/FAK/BZ+pNn/rxIAKyR2CzBUE/+YdyzjTdqgzhOyUj6H5xgHTvoQ++jwDeQ95lUbYGb4sA+WNiVI/Q5mmMmoZT0Q2XGaZfTCyWyywststsi/lTLNgf3aH+LFzpNVzdLQH5BYHNFgS9qzsFQ3eYVwB43fSnJge93YPeZQ4HveNB3gNec1w3KchbMY3UwgZdR0WgNOigd+0cwI7AM93wITe8qTMf4c35CI9T22Y96L3xow7TAHT15k8fSySSL5LhWI/cdNQ55Cm/LjSooHc6Nut0bQTeK7oOBSN7ADsB34vyFlkbD3qG0V0D66Le8pljSduVqPz7vriFAcRcQvttxMxfTZcA8buVGw667rTaADsWD/qOQ8A7fjH4SM9FeNODXYOi3nnvX/O7x8c/+MhNX04y4p6OmFeI6U+OqsTcHRrLvJtoMZUMu7ZWwxWqzwrWXOPKKbIuS4LetRspWSqm0xIzoaRTLhsawimUtMxwfioVLi6DdbS0w9R7Dr+ZT6XdmrzDZukhe+6jE19Q35/9SxLRHWGL6iKLwO3jKgL2pYnrh73Sp7LTLPrJLEZ17ACVSJsDNAfbCjqnaVDJZgSyaxTR27pz8gpG9C5GdcezMfMR3vKifM/SUJSHhqsGUV295/638jJCPoyQO0xKO4qUcuY+duCGVUd2iqzTi3j1CpXF+mEfX+G+m4vse6Vtjqg7S46Ov7KYLRNKAPSfHao3APKZy22bIfBXCHQP+K7DWZoe8BpYGHXy4Qt5ecippYYdlh5GyG0EnQHoipxy5z5+x/VJwI4Rrr7C1UurGS4G604lCTuL6SsjtE6go04++HwZYK9fblvsSgB8x4ccI/2V+SivdXVHffDoRYjkAeQ2QW4j5FDwIZOrSJI7d8238knAjt0ISsto0GkEeT2BfSPs6iosUPgusZzzEErSowd6qfJCaf9D38Q8enEYvPkQWJEhmHqvff+uDQ+56k+e+YcP+Q4HPXkvkjME3Ifc6+8iSeCtEfa79qjvPXehuUpI6uRli8zvK56PyZagb68v0Q+8sZysCN0VGpReDAZn8+vhuc0t4zwaZFUKIcul9dGAba32fLjPG1sJ9GX/a5dbDh+oQUOUYCfQh2Rtx7CsPv9yK58a4iAfCiB3mLwAcre3Z1mWteyunerbT2/dH/qMGfChbrWR9gNvXXi9duxU6XLHrv8XbMz//KK1O5b6/KlWLjXkenYl1TfkEgPIlbFsZu7WRw94kfC7p6cL3zvzw9wWgnxCYDaAET3QF+/dH0T2mddnflVWvlr4QB62FfTkcp+QZ3ZdxQByNjo6xrKKwkavvppdlcmWnvzGI/UBALhI1iL2N1AIchyNpUTYFGk7ABY8MV5q2CCOMVjLbtYrHjP652deKX327ttYWpYu7S6MF8CL+5BTo3NRyMGgZ67aycYyIwD5KMuOjbHR3VeznSMjAwE5KUdeusLlzZvkbwtLrFtn20f5uLYCBgsuKZBnazhwJr2alS/+/NVS7s5bp1Ie4I4HOQsiubyg4dmDHLvsjuzayUYhkmchkmfGFJYlyH96W6W+Rb7UpRp60xFf+iRFfhx72uR+dOifmEal94ENmsEIya2DD8WCsbcaLT9Bx8N/NgaflSnKToa2NRVkkri7lfcLY+FjW+zOxi274NfJeKhpHQT/ID39xfl7gsjOnydta4KmLWqwFyiYtPrNnsmr/WZbv/jtlJxymgHkUiiS+2Pp3HnIPxTJd/uQ76tslyhXDndKoy9+ltKV99HsCYSSexqK76domQBShd6fJdDw9bVBpeNz/cFywU910PsZxnWNIMhzwWuCPOrYeO2hZRuhZZVQF4YFr+kanKV1W1yQCJ9nUOGm2PyglwJV0L6ZkZP45v7z2p80gHyGy5MT6MF40QDyHeDJRyCSj0IkH6NInik9NTG1HSBvUKalHmODiov00+nnLhHoUqgtoEUsdy3tazK8PB1LaxnHdpr6+BQ5gBltI+mkwiXO+lWWc73kpI7g/d+cLwPkdZmDnI/kuxDyXiSHhqfi25UBhhyjYYmmjQgP2qR5GFGvx3/Tskg6scFFrWm+Icd3/6X3Obb6h0o4eKRO+6tHHHeBa0hGHluEFfPsC5dlKoQ8dwttCW1zLNxYDTdglzhPvJOV+e2sqUcP618vvVn6xJ15hLy4APKdPuRZsitZtCuZkdLT+6cHNpJTpKwntC0EJOh5OctVpCKb/9Wx4D3fuavBRU8WmteImNfi9lckyGb5Zciv14NjiTm2cLtkgipOi1u2Ttvi9zlBFeA4d47YCQ6v48nQeQdtjVzEeSi0j9Nrnl5cTNfctQcPtAKQ53btHKYUoh/JM6NjjR0jI+UTB46KMaNC66Y1zeV+8u4b8ko2UxgdzSqZbLa5ayTbfOk7J1risgsJCQkJCQkJCQkJCQkJCQkJCQkJCQ2I/i/AAIBJRUJ5hOGjAAAAAElFTkSuQmCC">'
26
+ .'</a> Diglin GmbH | Rütistrasse 14, 8952 Schlieren - Switzerland | <a href="mailto:support@diglin.com?subject=Support Diglin Username">support@diglin.com</a></p>';
27
+
28
+ $buttonSignUp = '';
29
+ $website = $this->getRequest()->getParam('website');
30
+ $websiteId = Mage::app()->getWebsite($website)->getId();
31
+ $helper = Mage::helper('diglin_ricento');
32
+
33
+ if (!$helper->isConfigured($websiteId)) {
34
+ $buttonSignUp = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
35
+ 'label' => $this->__('Sign Up to ricardo.ch API'),
36
+ 'onclick' => "window.open('" . Mage::helper('diglin_ricento')->getRicardoSignupApiUrl() . "', '_blank');",
37
+ 'class' => 'go',
38
+ 'type' => 'button',
39
+ 'id' => 'ricardo-account',
40
+ ))
41
+ ->toHtml();
42
+ }
43
+
44
+ $buttonDashboard = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
45
+ 'label' => $this->__('ricardo.ch Assistant'),
46
+ 'onclick' => "window.open('". Mage::helper('diglin_ricento')->getRicardoAssistantUrl() ."', '_blank');",
47
+ 'class' => 'go',
48
+ 'type' => 'button',
49
+ 'id' => 'ricardo-assistant',
50
+ ))
51
+ ->toHtml();
52
+
53
+ $buttonAuthorize = null;
54
+
55
+ try {
56
+ if ($helper->isConfigured($websiteId)) {
57
+ $buttonAuthorize = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
58
+ 'label' => $this->__('API Authorization'),
59
+ 'onclick' => "window.open('". Mage::helper('diglin_ricento/api')->getValidationUrl($websiteId) ."', '_blank');",
60
+ 'class' => 'go',
61
+ 'type' => 'button',
62
+ 'id' => 'ricardo-api-authorization',
63
+ ))
64
+ ->toHtml();
65
+ }
66
+ } catch (Exception $e) {
67
+ // do nothing just don't display it as the key may be not yet configured.
68
+ }
69
+
70
+
71
+ return $html . '<p>' . $buttonSignUp . '&nbsp;' . $buttonDashboard . '&nbsp;' . $buttonAuthorize .' - <strong>Diglin_Ricento Version: '. Mage::getConfig()->getModuleConfig('Diglin_Ricento')->version .' - Powered by <a href="http://www.diglin.com/?utm_source=magento&utm_medium=extension&utm_campaign=ricento">Diglin GmbH</a></strong></p>';
72
+ }
73
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Account.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Dashboard_Account
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Dashboard_Account extends Mage_Adminhtml_Block_Dashboard_Grid
16
+ {
17
+ protected $_collection;
18
+
19
+ public function __construct()
20
+ {
21
+ parent::__construct();
22
+ $this->setId('accountGrid');
23
+ }
24
+
25
+ protected function _prepareCollection()
26
+ {
27
+ /** @var Diglin_Ricento_Model_Resource_Api_Token_Collection $collection */
28
+ $collection = Mage::getResourceModel('diglin_ricento/api_token_collection');
29
+ $collection
30
+ ->join(array('website' => 'core/website'), 'website.website_id=main_table.website_id', array('website_name' => 'name'))
31
+ ->addFieldToSelect(array('entity_id', 'token', 'website_id', 'expiration_date'))
32
+ ->addFieldToFilter('token_type', 'identified');
33
+
34
+ $this->setCollection($collection);
35
+ return parent::_prepareCollection();
36
+ }
37
+
38
+ protected function _prepareColumns()
39
+ {
40
+ $this->addColumn('website_id', array(
41
+ 'header' => $this->__('Website'),
42
+ 'index' => 'website_name',
43
+ 'type' => 'text'
44
+ ));
45
+
46
+ $this->addColumn('api_token', array(
47
+ 'header' => $this->__('Token'),
48
+ 'sortable' => false,
49
+ 'index' => 'token',
50
+ 'type' => 'text',
51
+ 'frame_callback' => array($this, 'secrecyToken')
52
+ ));
53
+
54
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
55
+ Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
56
+ );
57
+ $this->addColumn('expiration_date', array(
58
+ 'header' => $this->__('Expiration'),
59
+ 'sortable' => false,
60
+ 'index' => 'expiration_date',
61
+ 'type' => 'date',
62
+ 'width' => 100,
63
+ 'gmtoffset' => true,
64
+ 'format' => $dateFormatIso
65
+ ));
66
+
67
+ $this->addColumn('action', array(
68
+ 'header' => $this->__('Action'),
69
+ 'sortable' => false,
70
+ 'width' => '100px',
71
+ 'renderer' => 'diglin_ricento/adminhtml_widget_grid_column_renderer_button',
72
+ 'index' => 'entity_id',
73
+ 'actions' => array(
74
+ array(
75
+ 'caption' => $this->__('Unlink'),
76
+ 'url' => array('base' => '*/api/unlinkToken'),
77
+ 'confirm' => $this->__('Are you sure?'),
78
+ 'field' => 'entity_id',
79
+ 'class' => 'delete'
80
+ )),
81
+ ));
82
+ $this->setFilterVisibility(false);
83
+ $this->setPagerVisibility(false);
84
+
85
+ return parent::_prepareColumns();
86
+ }
87
+
88
+ /**
89
+ * @param $value
90
+ * @param Varien_Object $row
91
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
92
+ * @return string
93
+ */
94
+ public function secrecyToken($value, Varien_Object $row, Mage_Adminhtml_Block_Widget_Grid_Column $column)
95
+ {
96
+ if ($column->getIndex() == 'token' && !empty($value)) {
97
+ $value = explode('-', $value);
98
+ $value[1] = 'XXXX';
99
+ $value[2] = 'XXXX';
100
+ $value[3] = 'XXXX';
101
+ return implode('-', $value);
102
+ }
103
+ return $value;
104
+ }
105
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Bestsellers.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Dashboard_Bestsellers
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Dashboard_Bestsellers extends Mage_Adminhtml_Block_Dashboard_Grid
16
+ {
17
+ const LIMIT = 20;
18
+
19
+ protected $_collection;
20
+
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+ $this->setId('bestsellerGrid');
25
+ }
26
+
27
+ protected function _prepareCollection()
28
+ {
29
+ /** @var Diglin_Ricento_Model_Resource_Sales_Transaction_Collection $collection */
30
+ $collection = Mage::getResourceModel('diglin_ricento/sales_transaction_collection');
31
+ $collection->joinProducts()->setGroupByProduct(true);
32
+ $collection->getSelect()
33
+ ->columns('SUM(qty) AS qty')
34
+ ->group('product_id')
35
+ ->limit(self::LIMIT);
36
+ $collection->setOrder('qty', Varien_Data_Collection::SORT_ORDER_DESC);
37
+
38
+ $this->setCollection($collection);
39
+ return parent::_prepareCollection();
40
+ }
41
+
42
+ protected function _prepareColumns()
43
+ {
44
+ $helper = Mage::helper('diglin_ricento');
45
+
46
+ $this->addColumn('name', array(
47
+ 'header' => $helper->__('Product Name'),
48
+ 'type' => 'text',
49
+ 'index' => 'product_name'
50
+ ));
51
+
52
+ $this->addColumn('sku', array(
53
+ 'header' => $helper->__('SKU'),
54
+ 'sortable' => false,
55
+ 'type' => 'text',
56
+ 'index' => 'product_sku'
57
+ ));
58
+
59
+ $this->addColumn('price', array(
60
+ 'header' => $helper->__('Price'),
61
+ 'sortable' => false,
62
+ 'type' => 'currency',
63
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
64
+ 'index' => 'product_price'
65
+ ));
66
+
67
+ $this->addColumn('qty', array(
68
+ 'header' => $helper->__('Qty sold'),
69
+ 'sortable' => false,
70
+ 'index' => 'qty',
71
+ 'type' => 'number'
72
+ ));
73
+ $this->setFilterVisibility(false);
74
+ $this->setPagerVisibility(false);
75
+
76
+ return parent::_prepareColumns();
77
+ }
78
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Lifetime.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Dashboard_Lifetime
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Dashboard_Lifetime extends Mage_Adminhtml_Block_Template
16
+ {
17
+ /**
18
+ * Returns formatted sum of all transaction prices
19
+ *
20
+ * @return string
21
+ */
22
+ public function getValueHtml()
23
+ {
24
+ /** @var Diglin_Ricento_Model_Resource_Sales_Transaction $transactionResource */
25
+ $transactionResource = Mage::getResourceModel('diglin_ricento/sales_transaction');
26
+
27
+ return Mage::helper('core')->formatCurrency($transactionResource->getTotalSalesValue());
28
+ }
29
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/News.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Diglin_Ricento_Block_Adminhtml_Dashboard_News extends Mage_Adminhtml_Block_Template
3
+ {
4
+ const XML_PATH_NEWS_COUNT = 'ricento/rss/news_count';
5
+ const XML_PATH_NEWS_FEED = 'ricento/rss/news_feed';
6
+
7
+ public function _construct()
8
+ {
9
+ $this->setData('cache_lifetime', 86400);
10
+ parent::_construct();
11
+ }
12
+
13
+ /**
14
+ * @return Zend_Feed_Reader_EntryInterface[]
15
+ * @throws Zend_Feed_Exception
16
+ */
17
+ public function getNewsFromFeed()
18
+ {
19
+ $newsEntries = array();
20
+
21
+ $lang = Mage::helper('diglin_ricento')->getDefaultSupportedLang();
22
+ $feedConfig = Mage::getStoreConfig(self::XML_PATH_NEWS_FEED . '_' .$lang);
23
+
24
+ try {
25
+ $count = Mage::getStoreConfig(self::XML_PATH_NEWS_COUNT);
26
+ $feed = Zend_Feed_Reader::import($feedConfig);
27
+
28
+ /* @var $feedItem Zend_Feed_Reader_Entry_Rss */
29
+ foreach ($feed as $feedItem) {
30
+ if ($count-- <= 0) {
31
+ break;
32
+ }
33
+
34
+ $feedUrl = parse_url($feedConfig);
35
+ $baseUrl = $feedUrl['scheme'] . '://' . $feedUrl['host'];
36
+ $description = str_replace('src="/', 'src="'. $baseUrl .'/', $feedItem->getDescription());
37
+
38
+ $feedItem = new Varien_Object(array('title' => $feedItem->getTitle(), 'description' => $description, 'link' => $feedItem->getLink()));
39
+
40
+ $newsEntries[] = $feedItem;
41
+ }
42
+ } catch (Exception $e) {
43
+ Mage::logException($e);
44
+ }
45
+ return $newsEntries;
46
+ }
47
+
48
+ /**
49
+ * Get cache key informative items
50
+ *
51
+ * @return array
52
+ */
53
+ public function getCacheKeyInfo()
54
+ {
55
+ return array(
56
+ 'BLOCK_TPL',
57
+ Mage::app()->getStore()->getCode(),
58
+ $this->getTemplateFile(),
59
+ 'template' => $this->getTemplate(),
60
+ Mage::helper('diglin_ricento')->getDefaultSupportedLang()
61
+ );
62
+ }
63
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Dashboard/Turnover.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Dashboard_Turnover
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Dashboard_Turnover extends Mage_Adminhtml_Block_Dashboard_Graph
16
+ {
17
+ /**
18
+ * Initialize object
19
+ *
20
+ * @return void
21
+ */
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setHtmlId('turnover');
26
+ $this->setTemplate('ricento/dashboard/turnover/graph.phtml');
27
+ }
28
+
29
+ /**
30
+ * Prepare chart data
31
+ *
32
+ * @return void
33
+ */
34
+ protected function _prepareData()
35
+ {
36
+ $this->setDataHelperName('diglin_ricento/dashboard_turnover');
37
+
38
+ $this->setDataRows('revenue');
39
+ $this->_axisMaps = array(
40
+ 'x' => 'range',
41
+ 'y' => 'revenue'
42
+ );
43
+
44
+ parent::_prepareData();
45
+ $this->getDataHelper()->setParam('period', '1y');
46
+ }
47
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Checkboxes/Extensible.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Form_Element_Checkboxes_Extensible
14
+ *
15
+ * Checkboxes that may contain additional elements beside them. Also allows disabling of all checkboxes
16
+ *
17
+ */
18
+ class Diglin_Ricento_Block_Adminhtml_Form_Element_Checkboxes_Extensible extends Varien_Data_Form_Element_Checkboxes
19
+ {
20
+ public function setForm($form)
21
+ {
22
+ parent::setForm($form);
23
+ /*
24
+ * Pre-generate HTML once to add children
25
+ */
26
+ $this->getElementHtml();
27
+ foreach ($this->getElements() as $_element) {
28
+ $_element->setForm($form);
29
+ }
30
+ return $this;
31
+ }
32
+
33
+ protected function _optionToHtml($option)
34
+ {
35
+ if (isset($option['field'])) {
36
+ $field = $this->getField($option['field']);
37
+ if (strpos($option['label'], '%s') !== false) {
38
+ $html = parent::_optionToHtml($option);
39
+ return preg_replace_callback('#(<label [^>]*for="\w+"[^>]*>)(.*)</label>#', function ($matches) use ($field) {
40
+ $labelTag = $matches[1];
41
+ $labelText = $matches[2];
42
+ return $labelTag . sprintf($labelText, '</label> ' . $field->getElementHtml() . ' ' . $labelTag) . '</label>';
43
+ }, $html);
44
+ } else {
45
+ $html = parent::_optionToHtml($option);
46
+ return str_replace('</li>', ' ' . $field->getElementHtml() . '</li>', $html);
47
+ }
48
+ }
49
+ return parent::_optionToHtml($option);
50
+ }
51
+
52
+ protected function _prepareValues()
53
+ {
54
+ /*
55
+ * No conversions, to maintain 'field' in values array
56
+ */
57
+ return $this->getValues();
58
+ }
59
+
60
+ /**
61
+ * Returns child field, creates it based on definition if not exists
62
+ *
63
+ * @param $fieldDefinition
64
+ * @return null|Varien_Data_Form_Element_Abstract
65
+ */
66
+ protected function getField($fieldDefinition)
67
+ {
68
+ $field = $this->getElements()->searchById($fieldDefinition[0]);
69
+ if (!$field) {
70
+ $field = $this->addField($fieldDefinition[0], $fieldDefinition[1], $fieldDefinition[2]);
71
+ }
72
+ return $field;
73
+ }
74
+
75
+ /**
76
+ * Allow disabling of all checkboxes with disabled=true
77
+ *
78
+ * @param $value
79
+ * @return string
80
+ */
81
+ public function getDisabled($value)
82
+ {
83
+ if ($this->getData('disabled') === true) {
84
+ return 'disabled';
85
+ }
86
+ return parent::getDisabled($value);
87
+ }
88
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Fieldset/Inline.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Form_Element_Fieldset_Inline
14
+ *
15
+ * A group of elements, to be rendered inline like a single element
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Form_Element_Fieldset_Inline extends Varien_Data_Form_Element_Abstract
18
+ {
19
+ public function __construct($attributes = array())
20
+ {
21
+ parent::__construct($attributes);
22
+ $this->setType('fieldset_inline');
23
+ }
24
+
25
+ public function getElementHtml()
26
+ {
27
+ return $this->getChildrenHtml();
28
+ }
29
+
30
+ public function getChildrenHtml()
31
+ {
32
+ $html = '';
33
+ foreach ($this->getElements() as $element) {
34
+ if ($element->getType() != 'fieldset') {
35
+ $html .= $element->getElementHtml();
36
+ }
37
+ }
38
+ return $html;
39
+ }
40
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Form/Element/Radios/Extensible.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Form_Element_Radios_Extensible
14
+ *
15
+ * Radio buttons that may contain additional elements beside them. Also allows disabling.
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Form_Element_Radios_Extensible extends Varien_Data_Form_Element_Radios
18
+ {
19
+ public function __construct($attributes = array())
20
+ {
21
+ if (!empty($attributes['types'])) {
22
+ foreach ($attributes['types'] as $type => $className) {
23
+ $this->addType($type, $className);
24
+ }
25
+ }
26
+ parent::__construct($attributes);
27
+ }
28
+
29
+ public function setForm($form)
30
+ {
31
+ parent::setForm($form);
32
+ /*
33
+ * Pre-generate HTML once to add children
34
+ */
35
+ $this->getElementHtml();
36
+ foreach ($this->getElements() as $_element) {
37
+ $_element->setForm($form);
38
+ }
39
+ return $this;
40
+ }
41
+
42
+ public function getElementHtml()
43
+ {
44
+ $html = '<ul ' . $this->serialize(array('list_class', 'list_id')) . '>';
45
+ $html .= parent::getElementHtml();
46
+ $html .= '</ul>';
47
+ return $html;
48
+ }
49
+
50
+ protected function _optionToHtml($option, $selected)
51
+ {
52
+ if (isset($option['field'])) {
53
+ $field = $this->getField($option['field']);
54
+ if (strpos($option['label'], '%s') !== false) {
55
+ $html = parent::_optionToHtml($option, $selected);
56
+ return '<li>' . preg_replace_callback('#(<label [^>]*for="\w+"[^>]*>)(.*)</label>#', function ($matches) use ($field) {
57
+ $labelTag = $matches[1];
58
+ $labelText = $matches[2];
59
+ return $labelTag . sprintf($labelText, '</label> ' . $field->getElementHtml() . ' ' . $labelTag) . '</label>';
60
+ }, $html) . '</li>';
61
+ } else {
62
+ return '<li>' . $this->_UpdatedOptionToHtml($option, $selected) . ' ' . $field->getElementHtml() . '</li>';
63
+ }
64
+ }
65
+ return '<li>' . $this->_UpdatedOptionToHtml($option, $selected) . '</li>';
66
+ }
67
+
68
+ /**
69
+ * Returns child field, creates it based on definition if not exists
70
+ *
71
+ * @param $fieldDefinition
72
+ * @return null|Varien_Data_Form_Element_Abstract
73
+ */
74
+ protected function getField($fieldDefinition)
75
+ {
76
+ $field = $this->getElements()->searchById($fieldDefinition[0]);
77
+ if (!$field) {
78
+ $field = $this->addField($fieldDefinition[0], $fieldDefinition[1], $fieldDefinition[2]);
79
+ }
80
+ return $field;
81
+ }
82
+
83
+ /**
84
+ * Allow HTML attribute "disabled"
85
+ *
86
+ * @param array $attributes
87
+ * @param string $valueSeparator
88
+ * @param string $fieldSeparator
89
+ * @param string $quote
90
+ * @return string
91
+ */
92
+ public function serialize($attributes = array(), $valueSeparator = '=', $fieldSeparator = ' ', $quote = '"')
93
+ {
94
+ $attributes[] = 'disabled';
95
+ return parent::serialize($attributes, $valueSeparator, $fieldSeparator, $quote);
96
+ }
97
+
98
+ protected function _UpdatedOptionToHtml($option, $selected)
99
+ {
100
+ $html = '<input type="radio" ' . $this->serialize(array('name', 'class', 'style'));
101
+ if (is_array($option)) {
102
+ $html .= ' value="' . $this->_escape($option['value']) . '" id="' . $this->getHtmlId() . $option['value'] . '"';
103
+ if ($option['value'] == $selected) {
104
+ $html .= ' checked="checked"';
105
+ }
106
+ $html .= ' />';
107
+ $html .= '<label class="inline" for="' . $this->getHtmlId() . $option['value'] . '">' . $option['label'] . '</label>';
108
+ } elseif ($option instanceof Varien_Object) {
109
+ $html .= 'id="' . $this->getHtmlId() . $option->getValue() . '"' . $option->serialize(array('label', 'title', 'value', 'class', 'style'));
110
+ if (in_array($option->getValue(), $selected)) {
111
+ $html .= ' checked="checked"';
112
+ }
113
+ $html .= ' />';
114
+ $html .= '<label class="inline" for="' . $this->getHtmlId() . $option->getValue() . '">' . $option->getLabel() . '</label>';
115
+ }
116
+ $html .= $this->getSeparator() . "\n";
117
+ return $html;
118
+ }
119
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Log.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Log
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Container
16
+ {
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+
21
+ $this->setId('ricentoLog');
22
+ $this->setTemplate('ricento/log.phtml');
23
+
24
+ $this->_headerText = Mage::helper('diglin_ricento')->__('Logs');
25
+
26
+ $this->removeButton('back');
27
+ $this->removeButton('delete');
28
+ $this->removeButton('add');
29
+ $this->removeButton('save');
30
+ $this->removeButton('edit');
31
+
32
+ $this->addButton('show_listing', array(
33
+ 'label' => $this->__('Show Products Listing'),
34
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/products_listing/index').'\')',
35
+ ));
36
+ }
37
+
38
+ protected function _toHtml()
39
+ {
40
+ $activeTab = !is_null($this->getData('active_tab')) ? $this->getData('active_tab') : Diglin_Ricento_Block_Adminhtml_Log_Tabs::TAB_LISTING;
41
+ $tabsBlock = $this->getLayout()
42
+ ->createBlock('diglin_ricento/adminhtml_log_tabs', '', array('active_tab' => $activeTab));
43
+
44
+ return parent::_toHtml() . $tabsBlock->toHtml() . '<div id="tabs_container"></div>';
45
+ }
46
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Log/Tabs.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Log_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
12
+ {
13
+ const TAB_LISTING = 'listing';
14
+ const TAB_ORDER = 'order';
15
+ const TAB_SYNCHRONIZATION = 'synchronization';
16
+
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setTemplate('widget/tabshoriz.phtml');
21
+ $this->setId('ricentoLogTabs');
22
+ $this->setDestElementId('tabs_container');
23
+ }
24
+
25
+ protected function _prepareLayout()
26
+ {
27
+ $this->addTab(self::TAB_SYNCHRONIZATION, $this->prepareTabSynchronization());
28
+ $this->addTab(self::TAB_LISTING, $this->prepareTabListing());
29
+ //$this->addTab(self::TAB_ORDER, $this->prepareTabOrder());
30
+
31
+ $this->setActiveTab($this->getData('active_tab'));
32
+
33
+ return parent::_prepareLayout();
34
+ }
35
+
36
+ protected function prepareTabListing()
37
+ {
38
+ $helper = Mage::helper('diglin_ricento');
39
+ $tab = array(
40
+ 'label' => $helper->__('Listing'),
41
+ 'title' => $helper->__('Listing')
42
+ );
43
+
44
+ if ($this->getData('active_tab') == self::TAB_LISTING) {
45
+ $tab['content'] = $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_log_grid', 'ricento_listing_log')->toHtml();
46
+ } else {
47
+ $tab['url'] = $this->getUrl('*/log/listing');
48
+ }
49
+
50
+ return $tab;
51
+ }
52
+
53
+ protected function prepareTabSynchronization()
54
+ {
55
+ $helper = Mage::helper('diglin_ricento');
56
+ $tab = array(
57
+ 'label' => $helper->__('Synchronization'),
58
+ 'title' => $helper->__('Synchronization')
59
+ );
60
+
61
+ if ($this->getData('active_tab') == self::TAB_SYNCHRONIZATION) {
62
+ $tab['content'] = $this->getLayout()->createBlock('diglin_ricento/adminhtml_sync_log_grid', 'ricento_sync_log')->toHtml();
63
+ } else {
64
+ $tab['url'] = $this->getUrl('*/log/sync');
65
+ }
66
+
67
+ return $tab;
68
+ }
69
+
70
+ protected function prepareTabOrder()
71
+ {
72
+ $helper = Mage::helper('diglin_ricento');
73
+ $tab = array(
74
+ 'label' => $helper->__('Orders'),
75
+ 'title' => $helper->__('Orders')
76
+ );
77
+
78
+ if ($this->getData('active_tab') == self::TAB_ORDER) {
79
+ $tab['content'] = $this->getLayout()->createBlock('diglin_ricento/adminhtml_order_log_grid', 'ricento_order_log')->toHtml();
80
+ } else {
81
+ $tab['url'] = $this->getUrl('*/log/order');
82
+ }
83
+
84
+ return $tab;
85
+ }
86
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Notifications/Default.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Notifications
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Notifications_Default extends Mage_Adminhtml_Block_Template
16
+ {
17
+ /**
18
+ * Disable the block caching for this block
19
+ */
20
+ protected function _construct()
21
+ {
22
+ $this->addData(array('cache_lifetime'=> null));
23
+ }
24
+
25
+ /**
26
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
27
+ * @return bool
28
+ */
29
+ public function isEnabled($website = 0)
30
+ {
31
+ return (bool) Mage::helper('diglin_ricento')->isEnabled($website);
32
+ }
33
+
34
+ /**
35
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
36
+ * @return bool
37
+ */
38
+ public function isApiConfigured($website = 0)
39
+ {
40
+ return (bool) Mage::helper('diglin_ricento')->isConfigured($website);
41
+ }
42
+
43
+ /**
44
+ * ACL validation before html generation
45
+ *
46
+ * @return string Notification content
47
+ */
48
+ protected function _toHtml()
49
+ {
50
+ try {
51
+ if (Mage::getSingleton('admin/session')->isAllowed('system/ricento')) {
52
+ return parent::_toHtml();
53
+ }
54
+ } catch (\Diglin\Ricardo\Exceptions\CurlException $e) {
55
+ // @todo Curl Error can happens here - the addError session method is maybe too late to be defined here
56
+ if ($this->isEnabled() && $this->isApiConfigured()) {
57
+ Mage::logException($e);
58
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Error while trying to connect to the ricardo.ch API. Please, check your log files.'));
59
+ }
60
+ }
61
+
62
+ return '';
63
+ }
64
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Notifications/Expiration.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Notifications
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Notifications_Expiration extends Diglin_Ricento_Block_Adminhtml_Notifications_Default
16
+ {
17
+ protected $_apiReady;
18
+
19
+ /**
20
+ * @param string|bool|int|Mage_Core_Model_Website $website
21
+ * @return string
22
+ */
23
+ public function getValidationUrl($website)
24
+ {
25
+ return Mage::getSingleton('diglin_ricento/api_services_security')
26
+ ->setCurrentWebsite($website)
27
+ ->getValidationUrl();
28
+ }
29
+
30
+ /**
31
+ * @param string|bool|int|Mage_Core_Model_Website $website
32
+ * @return bool
33
+ */
34
+ public function isApiGoExpire($website = 0)
35
+ {
36
+ return (bool) Mage::helper('diglin_ricento/api')->isApiTokenCredentialGoingToExpire($website);
37
+ }
38
+
39
+ /**
40
+ * @param string|bool|int|Mage_Core_Model_Website $website
41
+ * @return bool
42
+ */
43
+ public function isApiCredentialTokenExist($website = 0)
44
+ {
45
+ return (bool) Mage::helper('diglin_ricento/api')->isApiTokenCredentialExists($website);
46
+ }
47
+
48
+ /**
49
+ * @param int $storeId
50
+ * @return int
51
+ */
52
+ public function getExpirationNotificationDelay($storeId = 0)
53
+ {
54
+ return (int) Mage::helper('diglin_ricento')->getExpirationNotificationDelay($storeId);
55
+ }
56
+
57
+ /**
58
+ * @return array
59
+ */
60
+ public function getWebsiteCollection()
61
+ {
62
+ return Mage::app()->getWebsites();
63
+ }
64
+
65
+ /**
66
+ * @return Mage_Core_Block_Abstract
67
+ */
68
+ protected function _beforeToHtml()
69
+ {
70
+ //@todo if support multi websites needed, find an other logic here
71
+ $website = Mage::app()->getWebsite();
72
+ try {
73
+ if ($this->isEnabled($website) && $this->isApiConfigured($website) && $this->isApiGoExpire($website)) {
74
+ $this->setApiReady(true);
75
+ } else {
76
+ $this->setApiReady(false);
77
+ }
78
+ } catch (Exception $e) {
79
+ $this->setApiReady(false);
80
+ if ($this->isEnabled($website) && $this->isApiConfigured()) {
81
+ Mage::log($e->__toString(), Diglin_Ricento_Helper_Data::LOG_FILE);
82
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Error occurred with the API. Check if the API is correctly configured: %s', $e->__toString()));
83
+ }
84
+ }
85
+
86
+ return parent::_beforeToHtml();
87
+ }
88
+
89
+ /**
90
+ * @param mixed $apiReady
91
+ * @return $this
92
+ */
93
+ public function setApiReady($apiReady)
94
+ {
95
+ $this->_apiReady = (bool) $apiReady;
96
+ return $this;
97
+ }
98
+
99
+ /**
100
+ * @return mixed
101
+ */
102
+ public function getApiReady()
103
+ {
104
+ return (bool) $this->_apiReady;
105
+ }
106
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Page/Menu.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Ricento
7
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Diglin_Ricento_Block_Adminhtml_Page_Menu extends Mage_Adminhtml_Block_Page_Menu
11
+ {
12
+ /**
13
+ * Recursive Build Menu array
14
+ * Added handling of "ifconfig" and "class" nodes
15
+ *
16
+ * @param Varien_Simplexml_Element $parent
17
+ * @param string $path
18
+ * @param int $level
19
+ * @return array
20
+ */
21
+ protected function _buildMenuArray(Varien_Simplexml_Element $parent=null, $path='', $level=0)
22
+ {
23
+ if (is_null($parent)) {
24
+ $parent = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
25
+ }
26
+
27
+ $parentArr = array();
28
+ $sortOrder = 0;
29
+ foreach ($parent->children() as $childName => $child) {
30
+ if (1 == $child->disabled) {
31
+ continue;
32
+ }
33
+
34
+ $aclResource = 'admin/' . ($child->resource ? (string)$child->resource : $path . $childName);
35
+ if (!$this->_checkAcl($aclResource)) {
36
+ continue;
37
+ }
38
+
39
+ if ($child->depends && !$this->_checkDepends($child->depends)) {
40
+ continue;
41
+ }
42
+
43
+ if ($child->ifconfig && !Mage::getStoreConfigFlag((string)$child->ifconfig)) {
44
+ continue;
45
+ }
46
+
47
+ if ($child->unlessconfig && Mage::getStoreConfigFlag((string)$child->unlessconfig)) {
48
+ continue;
49
+ }
50
+
51
+ $menuArr = array();
52
+
53
+ $menuArr['label'] = $this->_getHelperValue($child);
54
+
55
+ $menuArr['sort_order'] = $child->sort_order ? (int)$child->sort_order : $sortOrder;
56
+
57
+ $menuArr['class'] = $child->class ? (string)$child->class : '';
58
+
59
+ if ($child->action) {
60
+ $menuArr['url'] = $this->_url->getUrl((string)$child->action, array('_cache_secret_key' => true));
61
+ } else {
62
+ $menuArr['url'] = '#';
63
+ $menuArr['click'] = 'return false';
64
+ }
65
+
66
+ $menuArr['active'] = ($this->getActive()==$path.$childName)
67
+ || (strpos($this->getActive(), $path.$childName.'/')===0);
68
+
69
+ $menuArr['level'] = $level;
70
+
71
+ if ($child->children) {
72
+ $menuArr['children'] = $this->_buildMenuArray($child->children, $path.$childName.'/', $level+1);
73
+ }
74
+ $parentArr[$childName] = $menuArr;
75
+
76
+ $sortOrder++;
77
+ }
78
+
79
+ uasort($parentArr, array($this, '_sortMenu'));
80
+
81
+ while (list($key, $value) = each($parentArr)) {
82
+ $last = $key;
83
+ }
84
+ if (isset($last)) {
85
+ $parentArr[$last]['last'] = true;
86
+ }
87
+
88
+ return $parentArr;
89
+ }
90
+
91
+ /**
92
+ * Get menu level HTML code
93
+ * Added display of "class" attribute
94
+ *
95
+ * @param array $menu
96
+ * @param int $level
97
+ * @return string
98
+ */
99
+ public function getMenuLevel($menu, $level = 0)
100
+ {
101
+ $html = '<ul ' . (!$level ? 'id="nav"' : '') . '>' . PHP_EOL;
102
+ foreach ($menu as $item) {
103
+ $html .= '<li ' . (!empty($item['children']) ? 'onmouseover="Element.addClassName(this,\'over\')" '
104
+ . 'onmouseout="Element.removeClassName(this,\'over\')"' : '') . ' class="'
105
+ . (!$level && !empty($item['active']) ? ' active' : '') . ' '
106
+ . (!empty($item['class']) ? ' ' . $item['class'] : '') . ' '
107
+ . (!empty($item['children']) ? ' parent' : '')
108
+ . (!empty($level) && !empty($item['last']) ? ' last' : '')
109
+ . ' level' . $level . '"> <a href="' . $item['url'] . '" '
110
+ . (!empty($item['title']) ? 'title="' . $item['title'] . '"' : '') . ' '
111
+ . (!empty($item['click']) ? 'onclick="' . $item['click'] . '"' : '') . ' class="'
112
+ . ($level === 0 && !empty($item['active']) ? 'active' : '') . '"><span>'
113
+ . $this->escapeHtml($item['label']) . '</span></a>' . PHP_EOL;
114
+
115
+ if (!empty($item['children'])) {
116
+ $html .= $this->getMenuLevel($item['children'], $level + 1);
117
+ }
118
+ $html .= '</li>' . PHP_EOL;
119
+ }
120
+ $html .= '</ul>' . PHP_EOL;
121
+
122
+ return $html;
123
+ }
124
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Children.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Category_Children
14
+ * Children of the Ricardo categories
15
+ *
16
+ * @method int getLevel() getLevel()
17
+ * @method int getCategoryId() getCategoryId()
18
+ * @method int getSelectedCategoryId() getSelectedCategoryId()
19
+ * @method Diglin_Ricento_Block_Adminhtml_Products_Category_Children setLevel() setLevel(int $level)
20
+ * @method Diglin_Ricento_Block_Adminhtml_Products_Category_Children setCategoryId() setCategoryId(int $categoryId)
21
+ * @method Diglin_Ricento_Block_Adminhtml_Products_Category_Children setSelectedCategoryId() setSelectedCategoryId(int $categoryId)
22
+ */
23
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Children extends Mage_Adminhtml_Block_Template
24
+ {
25
+ protected $_template = 'ricento/products/category/children.phtml';
26
+
27
+ /**
28
+ * Returns child categories of current category
29
+ *
30
+ * @return Diglin_Ricento_Model_Products_Category[]
31
+ */
32
+ public function getCategories()
33
+ {
34
+ /* @var $mapping Diglin_Ricento_Model_Products_Category_Mapping */
35
+ $mapping = Mage::getModel('diglin_ricento/products_category_mapping');
36
+
37
+ return $mapping->getCategories($this->getCategoryId());
38
+ }
39
+
40
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Form/Renderer/Categories.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+
13
+ /**
14
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Category_Form_Renderer_Categories
15
+ */
16
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Form_Renderer_Categories
17
+ extends Diglin_Ricento_Block_Adminhtml_Products_Category_Tree_Categories
18
+ implements Varien_Data_Form_Element_Renderer_Interface
19
+ {
20
+ protected $_element;
21
+
22
+ public function getElement()
23
+ {
24
+ return $this->_element;
25
+ }
26
+
27
+ public function render(Varien_Data_Form_Element_Abstract $element)
28
+ {
29
+ return $this->toHtml();
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Form/Renderer/Mapping.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Form_Renderer_Mapping
12
+ extends Varien_Data_Form_Element_Button
13
+ {
14
+ /**
15
+ * Custom button to popup Ricardo Category Window
16
+ *
17
+ * @return string
18
+ */
19
+ public function getElementHtml()
20
+ {
21
+ $value = $this->getEscapedValue();
22
+ if (!empty($value) && $value != -1) {
23
+ $categoryName = Mage::getSingleton('diglin_ricento/products_category_mapping')->getCategory($value)->getCategoryName();
24
+ $text = $categoryName;
25
+ } else {
26
+ $text = Mage::helper('diglin_ricento')->__('No Selection');
27
+ }
28
+
29
+ $this->addClass('button');
30
+ $html = '<span id="'.$this->getHtmlId().'_title" class="ricardo_categories_title">' . $text . '</span>';
31
+ $html .= '<button type="button"' . $this->serialize($this->getHtmlAttributes())
32
+ . ' onclick="Ricento.categoryMappingPopup(\''
33
+ . Mage::helper('adminhtml')->getUrl('ricento/products_category/mapping', array('id' => '#ID#'))
34
+ . '\', $(\''. $this->getHtmlId() .'\'), $(\''. $this->getHtmlId() .'_title\'))"'
35
+ . ' id="'. $this->getHtmlId() .'_button">'
36
+ . Mage::helper('diglin_ricento')->__('Open ricardo.ch Category Window')
37
+ . '</button>'."\n";
38
+
39
+ $html .= ' <input id="'.$this->getHtmlId().'" name="'.$this->getName()
40
+ .'" type="hidden" value="'. $this->getEscapedValue() .'" />';
41
+ $html .= $this->getAfterElementHtml();
42
+ return $html;
43
+ }
44
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Mapping.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Category_Mapping
14
+ * Mapping from the Ricardo categories
15
+ *
16
+ * @method int getCategoryId() getCategoryId()
17
+ * @method int getLevels() getLevels()
18
+ * @method Diglin_Ricento_Block_Adminhtml_Products_Category_Children setCategoryId() setCategoryId(int $categoryId)
19
+ * @method Diglin_Ricento_Block_Adminhtml_Products_Category_Children setLevels() setLevels(int $levels)
20
+ *
21
+ */
22
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Mapping extends Mage_Adminhtml_Block_Template
23
+ {
24
+ protected function _beforeToHtml()
25
+ {
26
+ $this->setChild('toplevel',
27
+ $this->getLayout()
28
+ ->createBlock('diglin_ricento/adminhtml_products_category_children')
29
+ ->setTemplate('ricento/products/category/children.phtml')
30
+ ->setLevel(1)
31
+ ->setCategoryId(1)
32
+ );
33
+
34
+ $this->setChild('sublevel',
35
+ $this->getLayout()->createBlock('core/text_list')
36
+ );
37
+
38
+ if ($this->getCategoryId() != Diglin_Ricento_Model_Products_Category_Mapping::ROOT_CATEGORY_ID) {
39
+
40
+ /* @var $mapping Diglin_Ricento_Model_Products_Category_Mapping */
41
+ $mapping = Mage::getModel('diglin_ricento/products_category_mapping');
42
+ $category = $mapping->getCategory($this->getCategoryId());
43
+ $this->setLevels($category ? $category->getLevel() : 1);
44
+
45
+ while ($category && $category->getParentId() != Diglin_Ricento_Model_Products_Category_Mapping::ROOT_CATEGORY_ID) {
46
+ $this->getChild('sublevel')->insert(
47
+ $this->getLayout()
48
+ ->createBlock('diglin_ricento/adminhtml_products_category_children')
49
+ ->setLevel($category->getLevel())
50
+ ->setCategoryId($category->getParentId())
51
+ ->setSelectedCategoryId($category->getId()),
52
+ '', false, 'sublevel-' . $category->getLevel()
53
+ );
54
+ $category = $mapping->getCategory($category->getParentId()); //TODO reference parent from child
55
+ }
56
+
57
+ if ($category) {
58
+ $this->getChild('toplevel')->setSelectedCategoryId($category->getId());
59
+ }
60
+ }
61
+ return parent::_beforeToHtml();
62
+ }
63
+
64
+ /**
65
+ * Determine if the columns have to be resized
66
+ *
67
+ * @return bool
68
+ */
69
+ public function shouldResize()
70
+ {
71
+ return $this->getLevels() >= 5;
72
+ }
73
+
74
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Tree extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+ protected $_controller = 'adminhtml_products_category';
14
+ protected $_mode = 'tree';
15
+ protected $_blockGroup = 'diglin_ricento';
16
+
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+
21
+ $this->removeButton('back');
22
+ $this->removeButton('reset');
23
+ $this->removeButton('delete');
24
+ $this->_headerText = $this->__('Add products from selected categories');
25
+
26
+ Mage::getSingleton('adminhtml/session')->addNotice($this->getInstructionsText());
27
+ }
28
+
29
+ public function getInstructionsText()
30
+ {
31
+ $instructions = $this->__('Only product types supported, enabled and not listed in other products listing will be added.');
32
+ $instructions .= '&nbsp;';
33
+ $instructions .= $this->__('Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories.');
34
+ return $instructions;
35
+ }
36
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree/Categories.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Tree_Categories extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Categories
12
+ {
13
+ /**
14
+ * @return bool
15
+ */
16
+ public function isReadonly()
17
+ {
18
+ return false;
19
+ }
20
+
21
+ /**
22
+ * Return array with category IDs which the product is assigned to
23
+ *
24
+ * @return array
25
+ */
26
+ protected function getCategoryIds()
27
+ {
28
+ return array();
29
+ }
30
+
31
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Category/Tree/Form.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Category_Tree_Form extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract
12
+ {
13
+ protected function _prepareForm()
14
+ {
15
+ $form = new Varien_Data_Form(array(
16
+ 'id' => 'edit_form' ,
17
+ 'class' => 'ricento-form',
18
+ 'action' => $this->getUrl('*/*/saveProductsToAdd', array(
19
+ 'id' => $this->getRequest()->getParam('id')
20
+ )),
21
+ 'method' => 'post',
22
+ 'enctype' => 'multipart/form-data'
23
+ ));
24
+
25
+ $form->setUseContainer(true);
26
+
27
+ $categoriesSelection = $form->addFieldset('categories_selection', array());
28
+ $categoriesSelection
29
+ ->addField('category_tree', 'text', array())
30
+ ->setRenderer($this->getLayout()->createBlock('diglin_ricento/adminhtml_products_category_form_renderer_categories'));
31
+
32
+ $this->setForm($form);
33
+ return parent::_prepareForm();
34
+ }
35
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing extends Mage_Adminhtml_Block_Widget_Grid_Container
16
+ {
17
+ public function __construct()
18
+ {
19
+ $this->_controller = 'adminhtml_products_listing';
20
+ $this->_blockGroup = 'diglin_ricento';
21
+ $this->_headerText = $this->__('Products Listing');
22
+ $this->_addButtonLabel = $this->__('Create new listing');
23
+
24
+ $this->addButton('sync_job', array(
25
+ 'label' => $this->__('Show Synchronization Jobs'),
26
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/log/sync').'\')',
27
+ ));
28
+
29
+ parent::__construct();
30
+ $this->_updateButton('add', 'onclick', 'Ricento.newListingPopup()');
31
+ }
32
+
33
+ public function getCreateUrl()
34
+ {
35
+ return $this->getUrl('*/*/edit');
36
+ }
37
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
16
+ {
17
+ public function __construct()
18
+ {
19
+ $this->_objectId = 'id';
20
+ $this->_blockGroup = 'diglin_ricento';
21
+ $this->_controller = 'adminhtml_products_listing';
22
+ parent::__construct();
23
+
24
+ $this->removeButton('reset');
25
+
26
+ $this->_addButton('add_product_from_category', array(
27
+ 'label' => $this->__('Add Product(s) from category'),
28
+ 'onclick' => "Ricento.showCategoryTreePopup('{$this->getShowCategoryTree()}')",
29
+ 'class' => 'add'
30
+ ), -1, -2);
31
+
32
+ $this->_addButton('add_product', array(
33
+ 'label' => $this->__('Add Product(s)'),
34
+ 'onclick' => "Ricento.addProductsPopup('{$this->getAddProductsPopupUrl()}')",
35
+ 'class' => 'add'
36
+ ), -1, -1);
37
+
38
+ $this->_addButton('stop', array(
39
+ 'label' => $this->__('Stop'),
40
+ 'title' => $this->__('Remove article listed on ricardo.ch'),
41
+ 'onclick' => 'setLocation(\'' . $this->getStopListingUrl() . '\')',
42
+ 'class' => 'cancel'
43
+ ), -1, 2);
44
+
45
+ $this->_addButton('check_and_list', array(
46
+ 'label' => $this->__('Check & List'),
47
+ 'title' => $this->__('Check & list only pending & error items'),
48
+ 'onclick' => 'editForm.submit(\'' . $this->getCheckAndListUrl() . '\');',
49
+ 'class' => 'list success'
50
+ ), -1, 3);
51
+
52
+ if (Mage::getResourceModel('diglin_ricento/products_listing_item')->coundReadyTolist($this->getListing()->getId())) {
53
+ $this->_addButton('force_list', array(
54
+ 'label' => $this->__('List'),
55
+ 'title' => $this->__('List only "Ready to list" items'),
56
+ 'onclick' => 'editForm.submit(\'' . $this->getListUrl() . '\');',
57
+ 'class' => 'list success'
58
+ ), -1, 4);
59
+ }
60
+
61
+ if ($this->getListing()->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED) {
62
+ $this->_updateButton('add_product_from_category', 'disabled', true);
63
+ $this->_updateButton('add_product', 'disabled', true);
64
+ $this->_updateButton('delete', 'disabled', true);
65
+ $this->_updateButton('delete', 'title', $this->__('Listed listings cannot be deleted. Stop the listing first.'));
66
+
67
+ $this->_removeButton('save');
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Retrieve text for header element depending on loaded listing
73
+ *
74
+ * @return string
75
+ */
76
+ public function getHeaderText()
77
+ {
78
+ if ($this->getListingId()) {
79
+ return $this->__("Edit Products Listing '%s'", $this->escapeHtml(Mage::registry('products_listing')->getTitle()));
80
+ }
81
+ return $this->__('New Products Listing');
82
+ }
83
+
84
+ /**
85
+ * Returns URL for AJAX popup
86
+ *
87
+ * @return string
88
+ */
89
+ public function getAddProductsPopupUrl()
90
+ {
91
+ return $this->getUrl('ricento/products_listing/addProductsPopup', array('id' => $this->getListingId()));
92
+ }
93
+
94
+ /**
95
+ * Returns URL
96
+ *
97
+ * @return string
98
+ */
99
+ public function getShowCategoryTree()
100
+ {
101
+ return $this->getUrl('ricento/products_category/showcategoriestree', array('id' => $this->getListingId()));
102
+ }
103
+
104
+ /**
105
+ * Returns URL to stop listing
106
+ *
107
+ * @return string
108
+ */
109
+ public function getStopListingUrl()
110
+ {
111
+ return $this->getUrl('ricento/products_listing/stop', array('id' => $this->getListingId()));
112
+ }
113
+
114
+ /**
115
+ * Returns URL for "save and list" form action
116
+ *
117
+ * @return string
118
+ */
119
+ public function getCheckAndListUrl()
120
+ {
121
+ return $this->getUrl('ricento/products_listing/checkAndList', array('id' => $this->getListingId()));
122
+ }
123
+
124
+ /**
125
+ * Returns URL for "save and list" form action
126
+ *
127
+ * @return string
128
+ */
129
+ public function getListUrl()
130
+ {
131
+ return $this->getUrl('ricento/products_listing/list', array('id' => $this->getListingId()));
132
+ }
133
+
134
+ /**
135
+ * Returns product listing
136
+ *
137
+ * @return Diglin_Ricento_Model_Products_Listing
138
+ */
139
+ public function getListing()
140
+ {
141
+ return Mage::registry('products_listing');
142
+ }
143
+ /**
144
+ * Returns product listing id if listing loaded, null otherwise
145
+ *
146
+ * @return int|null
147
+ */
148
+ public function getListingId()
149
+ {
150
+ $listing = $this->getListing();
151
+ if ($listing) {
152
+ return $listing->getId();
153
+ }
154
+ return null;
155
+ }
156
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Form.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Form
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
16
+ {
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form' ,
21
+ 'class' => 'ricento-form',
22
+ 'action' => $this->getUrl('*/*/save', array(
23
+ 'id' => $this->getRequest()
24
+ ->getParam('id')
25
+ )) , 'method' => 'post' , 'enctype' => 'multipart/form-data'
26
+ ));
27
+
28
+ $form->setUseContainer(true);
29
+ $this->setForm($form);
30
+ return parent::_prepareForm();
31
+ }
32
+
33
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
16
+ {
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setId('products_listing_tabs');
21
+ $this->setDestElementId('edit_form');
22
+ $this->setTitle($this->__('Products Listing'));
23
+ }
24
+
25
+ protected function _beforeToHtml()
26
+ {
27
+ $this->addTab('general_section', array(
28
+ 'label' => $this->__('General'),
29
+ 'title' => $this->__('General'),
30
+ 'content' => $this->getLayout()
31
+ ->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_general')
32
+ ->toHtml()
33
+ ));
34
+ $this->addTab('products_section', array(
35
+ 'label' => $this->__('Products') ,
36
+ 'title' => $this->__('Products') ,
37
+ 'content' => $this->getLayout()
38
+ ->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_products')
39
+ ->toHtml()
40
+ ));
41
+
42
+ $this->addTab('selloptions_section', array(
43
+ 'label' => $this->__('Sales Options') ,
44
+ 'title' => $this->__('Sales Options') ,
45
+ 'content' => $this->getLayout()
46
+ ->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_selloptions')
47
+ ->toHtml()
48
+ ));
49
+
50
+ $this->addTab('rules_section', array(
51
+ 'label' => $this->__('Rules') ,
52
+ 'title' => $this->__('Rules') ,
53
+ 'content' => $this->getLayout()
54
+ ->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_rules')
55
+ ->toHtml()
56
+ ));
57
+
58
+ return parent::_beforeToHtml();
59
+ }
60
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/General.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_General
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_General
16
+ extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract
17
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
18
+ {
19
+
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form();
23
+ $htmlIdPrefix = 'product_listing_';
24
+ $form->setHtmlIdPrefix($htmlIdPrefix);
25
+
26
+ $fieldsetMain = $form->addFieldset('fieldset_main', array('legend' => $this->__('General')));
27
+ $fieldsetMain->addField('entity_id', 'hidden', array(
28
+ 'name' => 'product_listing[entity_id]',
29
+ ));
30
+ $fieldsetMain->addField('title', 'text', array(
31
+ 'name' => 'product_listing[title]',
32
+ 'label' => $this->__('Title')
33
+ ));
34
+ $fieldsetMain->addField('status', 'select', array(
35
+ 'label' => $this->__('Status'),
36
+ 'disabled' => true,
37
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_status')->getAllOptions()
38
+ ));
39
+ $fieldsetMain->addField('website_id', 'select', array(
40
+ 'label' => $this->__('Website'),
41
+ 'disabled' => true,
42
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true, false)
43
+ ));
44
+
45
+ $languages = Mage::helper('diglin_ricento')->getSupportedLang();
46
+
47
+ $fieldsetLang = $form->addFieldset('fieldset_lang', array('legend' => $this->__('Language')));
48
+ $fieldsetLang->addField('publish_languages', 'select', array(
49
+ 'name' => 'product_listing[publish_languages]',
50
+ 'label' => $this->__('Product languages to synchronize to ricardo.ch'),
51
+ 'note' => $this->__('ricardo.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc).'),
52
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_languages')->getAllOptions(),
53
+ 'onchange' => 'generalForm.onChangeInput(this, [\''. implode('\',\'', $languages) .'\']);',
54
+ 'required' => true
55
+
56
+ ));
57
+ $fieldsetLang->addField('default_language', 'select', array(
58
+ 'name' => 'product_listing[default_language]',
59
+ 'label' => $this->__('Default language to publish'),
60
+ 'note' => $this->__('Which language to publish by default to ricardo.ch when the product content is not available in a language?'),
61
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_languages')->getAllOptions(false),
62
+ 'required' => true
63
+ ));
64
+
65
+ foreach ($languages as $lang) {
66
+ $title = Mage::helper('catalog')->__('Store View for %s', ucwords(Mage::app()->getLocale()->getTranslation($lang, 'language')));
67
+ $fieldsetLang->addField('lang_store_id_'. $lang, 'select', array(
68
+ 'name' => 'product_listing[lang_store_id_]' . $lang,
69
+ 'label' => $title,
70
+ 'title' => $title,
71
+ 'class' => 'lang_store_id',
72
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_store')
73
+ ->setWebsiteId($this->_getListing()->getWebsiteId())
74
+ ->getStoreValuesForForm(false, true),
75
+ 'required' => true,
76
+ ));
77
+ }
78
+
79
+
80
+ $this->setForm($form);
81
+
82
+ return parent::_prepareForm();
83
+ }
84
+
85
+ protected function _initFormValues()
86
+ {
87
+ $this->getForm()->setValues($this->_getListing());
88
+
89
+ $publishLanguages = $this->_getListing()->getPublishLanguages();
90
+
91
+ if ($publishLanguages != Diglin_Ricento_Helper_Data::LANG_ALL) {
92
+ $this->getForm()->getElement('default_language')->setDisabled(true);
93
+ $languages = Mage::helper('diglin_ricento')->getSupportedLang();
94
+ foreach ($languages as $lang) {
95
+ if ($publishLanguages != $lang) {
96
+ $this->getForm()->getElement('lang_store_id_' . strtolower($lang))->setDisabled(true);
97
+ }
98
+ }
99
+ }
100
+
101
+ return parent::_initFormValues();
102
+ }
103
+
104
+ protected function _afterToHtml($html)
105
+ {
106
+ $languages = Mage::helper('diglin_ricento')->getSupportedLang();
107
+ $htmlIdPrefix = $this->getForm()->getHtmlIdPrefix();
108
+
109
+ $html .= '<script type="text/javascript">';
110
+ $html .= 'var generalForm = new Ricento.GeneralForm("' . $htmlIdPrefix . '");';
111
+ !$this->isReadonlyForm() && $html .= 'setTimeout(function(){generalForm.onChangeInput($('
112
+ . $htmlIdPrefix .'publish_languages), [\''. implode('\',\'', $languages) .'\'])}, 3000);';
113
+ $html .= '</script>';
114
+ return parent::_afterToHtml($html);
115
+ }
116
+
117
+ /**
118
+ * Return Tab label
119
+ *
120
+ * @return string
121
+ */
122
+ public function getTabLabel()
123
+ {
124
+ return $this->__('General');
125
+ }
126
+
127
+ /**
128
+ * Return Tab title
129
+ *
130
+ * @return string
131
+ */
132
+ public function getTabTitle()
133
+ {
134
+ return $this->__('General');
135
+ }
136
+
137
+ /**
138
+ * Can show tab in tabs
139
+ *
140
+ * @return boolean
141
+ */
142
+ public function canShowTab()
143
+ {
144
+ return true;
145
+ }
146
+
147
+ /**
148
+ * Tab is hidden
149
+ *
150
+ * @return boolean
151
+ */
152
+ public function isHidden()
153
+ {
154
+ return false;
155
+ }
156
+
157
+ protected function _getListing()
158
+ {
159
+ return Mage::registry('products_listing');
160
+ }
161
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products
16
+ extends Mage_Adminhtml_Block_Widget_Grid
17
+ {
18
+ protected $_massactionBlockName = 'diglin_ricento/adminhtml_products_listing_edit_tabs_products_massaction';
19
+
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('products_listing_items');
24
+ $this->setDefaultSort('item_id');
25
+ $this->setDefaultDir('ASC');
26
+ $this->setSaveParametersInSession(true);
27
+ $this->setUseAjax(true);
28
+ }
29
+
30
+ /**
31
+ * @return string
32
+ */
33
+ public function getGridUrl()
34
+ {
35
+ return $this->getUrl('*/*/productsGrid', array('id' => $this->getListing()->getId()));
36
+ }
37
+
38
+ /**
39
+ * @param $item
40
+ * @return string
41
+ */
42
+ public function getRowUrl($item)
43
+ {
44
+ return $this->getUrl('*/products_listing_item/configure', array('id' => $this->getListing()->getId(), 'product' => $item->getId(), 'item' => $item->getItemId()));
45
+ }
46
+
47
+ /**
48
+ * @return Diglin_Ricento_Model_Products_Listing
49
+ */
50
+ public function getListing()
51
+ {
52
+ return Mage::registry('products_listing');
53
+ }
54
+
55
+ protected function _prepareCollection()
56
+ {
57
+ if ($this->getListing()->getId()) {
58
+ $this->setDefaultFilter(array('in_category' => 1));
59
+ }
60
+
61
+ $collection = Mage::getResourceModel('catalog/product_collection')
62
+ ->addAttributeToSelect('name')
63
+ ->addAttributeToSelect('sku')
64
+ ->addAttributeToSelect('type_id')
65
+ ->addAttributeToSelect('price')
66
+ ->addWebsiteFilter($this->getListing()->getWebsiteId())
67
+ ->joinField('stock_qty',
68
+ 'cataloginventory/stock_item',
69
+ 'qty',
70
+ 'product_id=entity_id',
71
+ '{{table}}.stock_id=1',
72
+ 'left'
73
+ )->joinField('status',
74
+ 'diglin_ricento/products_listing_item',
75
+ 'status',
76
+ 'product_id=entity_id',
77
+ '{{table}}.products_listing_id='.(int) $this->getRequest()->getParam('id', 0) . ' AND at_status.parent_item_id IS NULL',
78
+ 'left'
79
+ )->joinField('sales_options_id',
80
+ 'diglin_ricento/products_listing_item',
81
+ 'sales_options_id',
82
+ 'product_id=entity_id',
83
+ '{{table}}.products_listing_id='.(int) $this->getRequest()->getParam('id', 0) . ' AND at_sales_options_id.parent_item_id IS NULL',
84
+ 'left'
85
+ )->joinField('rule_id',
86
+ 'diglin_ricento/products_listing_item',
87
+ 'rule_id',
88
+ 'product_id=entity_id',
89
+ '{{table}}.products_listing_id='.(int) $this->getRequest()->getParam('id', 0) . ' AND at_rule_id.parent_item_id IS NULL',
90
+ 'left'
91
+ )->joinField('ricardo_article_id',
92
+ 'diglin_ricento/products_listing_item',
93
+ 'ricardo_article_id',
94
+ 'product_id=entity_id',
95
+ '{{table}}.products_listing_id='.(int) $this->getRequest()->getParam('id', 0) . ' AND at_ricardo_article_id.parent_item_id IS NULL',
96
+ 'left'
97
+ )->joinField('item_id',
98
+ 'diglin_ricento/products_listing_item',
99
+ 'item_id',
100
+ 'product_id=entity_id',
101
+ '{{table}}.products_listing_id='.(int) $this->getRequest()->getParam('id', 0) . ' AND at_item_id.parent_item_id IS NULL',
102
+ 'left'
103
+ )->distinct(true);
104
+
105
+ $productIds = $this->_getSelectedProducts();
106
+ if (empty($productIds)) {
107
+ $productIds = 0;
108
+ }
109
+ $collection->addFieldToFilter('entity_id', array('in'=>$productIds));
110
+
111
+ $this->getColumn('massaction')->setUseIndex(true);
112
+
113
+
114
+ $this->setCollection($collection);
115
+ return parent::_prepareCollection();
116
+ }
117
+
118
+ protected function _prepareColumns()
119
+ {
120
+ $this->addColumn('item_id', array(
121
+ 'header' => Mage::helper('catalog')->__('Item ID'),
122
+ 'sortable' => true,
123
+ 'filter' => false,
124
+ 'width' => '60',
125
+ 'index' => 'item_id',
126
+ 'type' => 'number'
127
+ ));
128
+
129
+ $this->addColumn('entity_id', array(
130
+ 'header' => Mage::helper('catalog')->__('Product ID'),
131
+ 'sortable' => true,
132
+ 'filter' => false,
133
+ 'width' => '60',
134
+ 'index' => 'entity_id',
135
+ 'type' => 'number'
136
+ ));
137
+
138
+ $this->addColumn('name', array(
139
+ 'header' => Mage::helper('catalog')->__('Name'),
140
+ 'index' => 'name',
141
+ 'width' => '300',
142
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_name')
143
+ ));
144
+
145
+ $store = Mage::app()->getWebsite($this->getListing()->getWebsiteId())->getDefaultStore();
146
+ $this->addColumn('price', array(
147
+ 'header' => Mage::helper('diglin_ricento')->__('Price Catalog'),
148
+ 'type' => 'price',
149
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
150
+ 'index' => 'price',
151
+ 'sortable' => false,
152
+ 'filter' => false,
153
+ ));
154
+ $this->addColumn('type', array(
155
+ 'header' => Mage::helper('catalog')->__('Type'),
156
+ 'index' => 'type_id',
157
+ 'width' => '120',
158
+ 'type' => 'options',
159
+ 'options' => array_intersect_key(Mage::getSingleton('catalog/product_type')->getOptionArray(), Mage::helper('diglin_ricento')->getAllowedProductTypes()),
160
+ ));
161
+ $this->addColumn('sku', array(
162
+ 'header' => Mage::helper('catalog')->__('SKU'),
163
+ 'width' => '120',
164
+ 'index' => 'sku'
165
+ ));
166
+
167
+ $this->addColumn('ricardo_article_id', array(
168
+ 'header' => Mage::helper('diglin_ricento')->__('ricardo.ch Article ID'),
169
+ 'width' => '120',
170
+ 'index' => 'ricardo_article_id',
171
+ 'type' => 'number',
172
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_article')
173
+ ));
174
+
175
+ $this->addColumn('qty', array(
176
+ 'header' => Mage::helper('catalog')->__('Inventory'),
177
+ 'type' => 'number',
178
+ 'width' => '1',
179
+ 'index' => 'stock_qty',
180
+ 'sortable' => false,
181
+ 'filter' => false,
182
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_inventory')
183
+ ));
184
+ $this->addColumn('status', array(
185
+ 'header' => Mage::helper('catalog')->__('Status'),
186
+ 'width' => '80',
187
+ 'index' => 'status',
188
+ 'type' => 'options',
189
+ 'sortable' => true,
190
+ 'options' => Mage::getSingleton('diglin_ricento/config_source_status')->toOptionHash(),
191
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_status')
192
+ ));
193
+ $this->addColumn('has_custom_options', array(
194
+ 'header' => '',
195
+ 'width' => 20,
196
+ 'index' => 'has_custom_options',
197
+ 'sortable' => false,
198
+ 'filter' => false,
199
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_customoptions')
200
+ ));
201
+ $this->addColumn('is_configured', array(
202
+ 'header' => '',
203
+ 'width' => 20,
204
+ 'index' => 'is_configured',
205
+ 'sortable' => false,
206
+ 'filter' => false,
207
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_configured')
208
+ ));
209
+ $this->addColumn('action',
210
+ array(
211
+ 'header' => $this->__('Action'),
212
+ 'width' => '100px',
213
+ 'type' => 'action',
214
+ 'getter' => 'getItemId',
215
+ 'actions' => array(
216
+ array(
217
+ 'caption' => $this->__('Preview'),
218
+ 'field' => 'item',
219
+ 'popup' => true,
220
+ 'url' => array(
221
+ 'base'=>'*/products_listing_item/preview',
222
+ 'params' => array('id' => $this->getListing()->getId())
223
+ )
224
+ ),
225
+ array(
226
+ 'caption' => $this->__('Configure'),
227
+ 'field' => 'item',
228
+ 'url' => array(
229
+ 'base'=>'*/products_listing_item/configure',
230
+ 'params' => array('id' => $this->getListing()->getId())
231
+ )
232
+ ),
233
+ array(
234
+ 'caption' => $this->__('Remove'),
235
+ 'field' => 'item',
236
+ 'url' => array(
237
+ 'base' => '*/*/removeProduct',
238
+ 'params' => array('id' => $this->getListing()->getId()),
239
+ ),
240
+ 'confirm' => $this->__('Are you sure to remove this/these product(s)?'),
241
+ ),
242
+ ),
243
+ 'filter' => false,
244
+ 'sortable' => false,
245
+ ));
246
+
247
+ return parent::_prepareColumns();
248
+ }
249
+
250
+ /**
251
+ * @return $this|Mage_Adminhtml_Block_Widget_Grid
252
+ */
253
+ protected function _prepareMassaction()
254
+ {
255
+ $this->setMassactionIdField('item_id');
256
+ $this->getMassactionBlock()->setFormFieldName('item');
257
+ $this->getMassactionBlock()->setHideFormElement(true);
258
+
259
+ $this->getMassactionBlock()->addItem('remove', array(
260
+ 'label'=> $this->__('Remove from list'),
261
+ 'url' => $this->getUrl('*/products_listing/removeProduct', array('id' => $this->getListing()->getId())),
262
+ 'confirm' => $this->__('Are you sure to remove this/these product(s)?')
263
+ ));
264
+
265
+ $this->getMassactionBlock()->addItem('configure', array(
266
+ 'label' => $this->__('Configure'),
267
+ 'url' => $this->getUrl('*/products_listing_item/configure', array('id' => $this->getListing()->getId(), '_current' => true))
268
+ ));
269
+
270
+ return $this;
271
+ }
272
+
273
+ /**
274
+ * @return array|mixed
275
+ */
276
+ protected function _getSelectedProducts()
277
+ {
278
+ $products = $this->getRequest()->getPost('selected_products');
279
+ if (is_null($products)) {
280
+ $products = $this->getListing()->getProductIds(false);
281
+ }
282
+ return $products;
283
+ }
284
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Add.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Add
14
+ *
15
+ * "Add products" grid
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Add
18
+ extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ /**
21
+ * @var Diglin_Ricento_Helper_Data
22
+ */
23
+ protected $_helper;
24
+
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+ $this->_helper = Mage::helper('diglin_ricento');
29
+ $this->setId('products_listing_add');
30
+ $this->setDefaultSort('entity_id');
31
+ $this->setDefaultDir('ASC');
32
+ $this->setSaveParametersInSession(true);
33
+ $this->setUseAjax(true);
34
+ }
35
+
36
+ public function getGridUrl()
37
+ {
38
+ return $this->getUrl('*/*/addProductsGrid', array('id' => $this->getListing()->getId()));
39
+ }
40
+
41
+ /**
42
+ * @return Diglin_Ricento_Model_Products_Listing
43
+ */
44
+ public function getListing()
45
+ {
46
+ return Mage::registry('products_listing');
47
+ }
48
+
49
+ protected function _prepareCollection()
50
+ {
51
+ if ($this->getListing()->getId()) {
52
+ $this->setDefaultFilter(array('in_category'=>1));
53
+ }
54
+ /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
55
+ $collection = Mage::getResourceModel('catalog/product_collection')
56
+ ->addAttributeToSelect('name')
57
+ ->addAttributeToSelect('sku')
58
+ ->addAttributeToSelect('type_id')
59
+ ->addWebsiteFilter($this->getListing()->getWebsiteId())
60
+ ->addAttributeToFilter('type_id', array('in' => $this->_helper->getAllowedProductTypes()))
61
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
62
+ //->addFieldToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ))
63
+ ->joinField('stock_qty',
64
+ 'cataloginventory/stock_item',
65
+ 'qty',
66
+ 'product_id=entity_id',
67
+ '{{table}}.stock_id=1',
68
+ 'left'
69
+ )->joinField('in_other_list',
70
+ 'diglin_ricento/products_listing_item',
71
+ new Zend_Db_Expr('products_listing_id IS NOT NULL'),
72
+ 'product_id=entity_id',
73
+ 'products_listing_id !='.(int) $this->getRequest()->getParam('id', 0),
74
+ 'left'
75
+ )->joinField('has_custom_options',
76
+ 'catalog/product_option',
77
+ new Zend_Db_Expr('option_id IS NOT NULL'),
78
+ 'product_id=entity_id',
79
+ null,
80
+ 'left')
81
+ ->addFieldToFilter('in_other_list', array('eq' => 0))
82
+ ->distinct(true);
83
+
84
+ $productIds = $this->_getSelectedProducts();
85
+ if (empty($productIds)) {
86
+ $productIds = 0;
87
+ }
88
+
89
+ $collection->addFieldToFilter('entity_id', array('nin'=>$productIds));
90
+
91
+ $this->setCollection($collection);
92
+
93
+ return parent::_prepareCollection();
94
+ }
95
+
96
+ protected function _prepareColumns()
97
+ {
98
+ $this->addColumn('entity_id', array(
99
+ 'header' => Mage::helper('catalog')->__('ID'),
100
+ 'sortable' => true,
101
+ 'width' => '60',
102
+ 'index' => 'entity_id',
103
+ 'type' => 'number'
104
+ ));
105
+ $this->addColumn('name', array(
106
+ 'header' => Mage::helper('catalog')->__('Name'),
107
+ 'index' => 'name'
108
+ ));
109
+ $this->addColumn('type', array(
110
+ 'header' => Mage::helper('catalog')->__('Type'),
111
+ 'index' => 'type_id',
112
+ 'type' => 'options',
113
+ 'options' => array_intersect_key(Mage::getSingleton('catalog/product_type')->getOptionArray(), $this->_helper->getAllowedProductTypes()),
114
+ ));
115
+ $this->addColumn('has_custom_options', array(
116
+ 'header' => '',
117
+ 'width' => 20,
118
+ 'index' => 'has_custom_options',
119
+ 'sortable' => false,
120
+ 'filter' => false,
121
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_edit_tabs_products_renderer_customoptions')
122
+ ));
123
+ $this->addColumn('sku', array(
124
+ 'header' => Mage::helper('catalog')->__('SKU'),
125
+ 'width' => '80',
126
+ 'index' => 'sku'
127
+ ));
128
+ $this->addColumn('qty', array(
129
+ 'header' => Mage::helper('catalog')->__('Inventory'),
130
+ 'type' => 'number',
131
+ 'width' => '1',
132
+ 'index' => 'stock_qty'
133
+ ));
134
+
135
+ return parent::_prepareColumns();
136
+ }
137
+
138
+ protected function _prepareMassaction()
139
+ {
140
+ $this->setMassactionIdField('entity_id');
141
+ $this->getMassactionBlock()->setFormFieldName('product');
142
+
143
+ $this->getMassactionBlock()->addItem('add', array(
144
+ 'label'=> $this->__('Add selected product(s)'),
145
+ 'url' => $this->getUrl('*/products_listing/addProduct', array('id' => $this->getListing()->getId()))
146
+ ));
147
+
148
+ return $this;
149
+ }
150
+
151
+ protected function _getSelectedProducts()
152
+ {
153
+ $products = $this->getRequest()->getPost('selected_products');
154
+ if (is_null($products)) {
155
+ $products = $this->getListing()->getProductIds();
156
+ }
157
+ return $products;
158
+ }
159
+
160
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Massaction.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ */
10
+
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Massaction extends Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract
12
+ {
13
+
14
+ public function getGridIdsJson()
15
+ {
16
+ if (!$this->getUseSelectAll()) {
17
+ return '';
18
+ }
19
+
20
+ $gridIds = $this->getParentBlock()->getCollection()->getColumnValues('item_id');
21
+
22
+ if(!empty($gridIds)) {
23
+ return join(",", $gridIds);
24
+ }
25
+ return '';
26
+ }
27
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Article.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Article
14
+ *
15
+ * Renderer for column ricardo article id for configurable product
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Article
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $value = $this->_getValue($row);
27
+ if ($row->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
28
+ $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
29
+ $itemCollection->addFieldToFilter('parent_item_id', $row->getItemId());
30
+
31
+ $articles = array('&nbsp;');
32
+ foreach ($itemCollection->getItems() as $item) {
33
+ $articles[] = '<li>' . (($item->getRicardoArticleId()) ? $item->getRicardoArticleId() : '&nbsp;') . '</li>';
34
+ }
35
+
36
+ $value = $value . '<ul>' . implode($articles) . '</ul>';
37
+ }
38
+ return $value;
39
+ }
40
+
41
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Configured.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Customoptions
14
+ *
15
+ * Renderer for column with configured rules or sales
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Configured
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $isConfigured = ($row->getSalesOptionsId() || $row->getRuleId()) ? true : false;
27
+ if ($isConfigured) {
28
+
29
+ $append = $salesOptionsTxt = $ruleTxt = '';
30
+ if ($row->getSalesOptionsId()) {
31
+ $salesOptionsTxt = $this->__('the sales options');
32
+ $append = '& ';
33
+ }
34
+ if ($row->getRuleId()) {
35
+ $ruleTxt = $append . $this->__('the shipping and payment rules');
36
+ }
37
+
38
+ $warningMessage = $this->__('This product has been configured for %s %s', $salesOptionsTxt, $ruleTxt);
39
+ return
40
+ <<<HTML
41
+ <div class="diglin_ricento_settings_icon" title="{$warningMessage}">&nbsp;</div>
42
+ HTML;
43
+ }
44
+ return '';
45
+ }
46
+
47
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Customoptions.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Customoptions
14
+ *
15
+ * Renderer for column with warning about custom options
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Customoptions
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ if ($row instanceof Diglin_Ricento_Model_Products_Listing_Item) {
27
+ $productId = $row->getProductId();
28
+ } else if ($row instanceof Mage_Catalog_Model_Product) {
29
+ $productId = $row->getId();
30
+ } else {
31
+ return '';
32
+ }
33
+
34
+ $optionsCollection = Mage::getResourceModel('catalog/product_option_collection');
35
+ $optionsCollection
36
+ ->getSelect()
37
+ ->from(array('option' => $optionsCollection->getTable('catalog/product_option')))
38
+ ->where('option.product_id = ?', $productId)
39
+ ->where('option.option_id IS NOT NULL')
40
+ ->group('option.product_id');
41
+
42
+ if (count($optionsCollection->getItems())) {
43
+ $warningMessage = $this->__('The product has custom options, those will not be added to ricardo.ch!');
44
+ return
45
+ <<<HTML
46
+ <div class="diglin_ricento_warning_icon" title="{$warningMessage}">&nbsp;</div>
47
+ HTML;
48
+ }
49
+
50
+ return '';
51
+ }
52
+
53
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Inventory.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Inventory
14
+ *
15
+ * Renderer for column name for configurable product
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Inventory
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $value = $this->_getValue($row);
27
+ if ($row->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
28
+ $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
29
+ $itemCollection->addFieldToFilter('parent_item_id', $row->getItemId());
30
+
31
+ $inventory = array();
32
+ foreach ($itemCollection->getItems() as $item) {
33
+ $qtyInventory = $item->getQtyInventory();
34
+ if (isset($qtyInventory)) {
35
+ $inventory[] = '<li>' . $qtyInventory . '</li>';
36
+ }
37
+ }
38
+
39
+ if (count($inventory)) {
40
+ $value = '<ul><li>&nbsp;</li>' . implode($inventory) . '</ul>';
41
+ }
42
+ }
43
+
44
+ return $value;
45
+ }
46
+
47
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Name.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Name
14
+ *
15
+ * Renderer for column name for configurable product
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Name
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $value = $this->_getValue($row);
27
+ if ($row->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
28
+ $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
29
+ $itemCollection->addFieldToFilter('parent_item_id', $row->getItemId());
30
+
31
+ $subtitles = array();
32
+ foreach ($itemCollection->getItems() as $item) {
33
+ $subtitle = $item->getProductSubtitle();
34
+ if (isset($subtitle)) {
35
+ $subtitles[] = '<li>' . $subtitle . '</li>';
36
+ }
37
+ }
38
+
39
+ $value = $value . '<ul>' . implode($subtitles) . '</ul>';
40
+ }
41
+ return $value;
42
+ }
43
+
44
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Products/Renderer/Status.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Status
14
+ *
15
+ * Renderer for column name for configurable product
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Products_Renderer_Status
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $value = $this->_getValue($row);
27
+ if ($row->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
28
+ $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
29
+ $itemCollection->addFieldToFilter('parent_item_id', $row->getItemId());
30
+ $helper = Mage::helper('diglin_ricento');
31
+
32
+ $statuses = array();
33
+ foreach ($itemCollection->getItems() as $item) {
34
+ $output = '';
35
+ switch ($item->getStatus()) {
36
+ case 'error':
37
+ $output .= '<span class="message_errors">' . $helper->__('Stopped') . '</span>';
38
+ break;
39
+ case 'listed':
40
+ $output .= '<span class="message_success">' . $helper->__('Listed') . '</span>';
41
+ break;
42
+ default:
43
+ $output .= '<span class="message_warnings">' . $helper->__(ucwords($item->getStatus())) . '</span>';
44
+ break;
45
+ }
46
+ $statuses[] = '<li>' . $output . '</li>';
47
+ }
48
+
49
+ if (count($statuses)) {
50
+ $value = '<ul><li>&nbsp;</li>' . implode($statuses) . '</ul>';
51
+ } else {
52
+ $value = $this->_decorate($value, $row);
53
+ }
54
+ } else {
55
+ $value = $this->_decorate($value, $row);
56
+ }
57
+
58
+ return $value;
59
+ }
60
+
61
+ protected function _decorate($value, Varien_Object $row)
62
+ {
63
+ $output = '';
64
+ $helper = Mage::helper('diglin_ricento');
65
+ $value = htmlspecialchars_decode($value);
66
+ switch ($row->getStatus()) {
67
+ case 'error':
68
+ $output .= '<div id="message-errors-' . $row->getId() . '" class="message_errors">' . $helper->__('Error') . '</div>';
69
+ break;
70
+ case 'listed':
71
+ $output .= '<div id="message-success-' . $row->getId() . '" class="message_success">' . $helper->__('Listed') . '</div>';
72
+ break;
73
+ default:
74
+ $output .= '<div id="message-warnings-' . $row->getId() . '" class="message_warnings">' . $helper->__(ucwords($value)) . '</div>';
75
+ break;
76
+ }
77
+
78
+ return $output;
79
+ }
80
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Rules.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Rules
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Rules
16
+ extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract
17
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
18
+ {
19
+ /**
20
+ * @var Diglin_Ricento_Model_Rule
21
+ */
22
+ protected $_model;
23
+
24
+ /**
25
+ * Returns sales options model
26
+ *
27
+ * @return Diglin_Ricento_Model_Rule
28
+ */
29
+ public function getShippingPaymentRule()
30
+ {
31
+ if (!$this->_model) {
32
+ $this->_model = $this->_getListing()->getShippingPaymentRule();
33
+ $data = Mage::getSingleton('adminhtml/session')->getRulesFormData(true);
34
+ if (!empty($data)) {
35
+ $this->_model->setData($data);
36
+ }
37
+ }
38
+ return $this->_model;
39
+ }
40
+
41
+ protected function _prepareForm()
42
+ {
43
+ $form = new Varien_Data_Form();
44
+ $htmlIdPrefix = 'rules_';
45
+ $form->setHtmlIdPrefix($htmlIdPrefix);
46
+ $form->addField('rule_id', 'hidden', array(
47
+ 'name' => 'rules[rule_id]',
48
+ ));
49
+
50
+ $fieldsetPayment = $form->addFieldset('fieldset_payment', array('legend' => $this->__('Payment Methods')));
51
+ $fieldsetPayment->addType('checkboxes_extensible', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_checkboxes_extensible'));
52
+ $fieldsetPayment->addField('payment_methods', 'checkboxes_extensible', array(
53
+ 'name' => 'rules[payment_methods][]',
54
+ 'label' => $this->__('Payment Methods'),
55
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_rules_payment')->getAllOptions(),
56
+ 'class' => 'validate-payment-method-combination',
57
+ 'note' => $this->__('Combination possible: Cash, Bank transfer / Post, Other, Credit Card + Other, Credit Card + Bank transfer or Credit Card + Cash'),
58
+ 'onchange' => 'rulesForm.togglePaymentDescription($(\''. $htmlIdPrefix . 'payment_methods_'. \Diglin\Ricardo\Enums\PaymentMethods::TYPE_OTHER . '\'));'
59
+ . 'rulesForm.toggleStartPrice($(\'sales_options_sales_auction_start_price\'), \''. \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD . '\');'
60
+ ));
61
+ $fieldsetPayment->addField('payment_description_de', 'textarea', array(
62
+ 'name' => 'rules[payment_description_de]',
63
+ 'label' => $this->__('Payment Description German'),
64
+ 'note' => $this->__('Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method "Other"',
65
+ $this->getCountableText($htmlIdPrefix . 'payment_description_de')),
66
+ 'class' => 'validate-length maximum-length-5000'
67
+ ));
68
+ $fieldsetPayment->addField('payment_description_fr', 'textarea', array(
69
+ 'name' => 'rules[payment_description_fr]',
70
+ 'label' => $this->__('Payment Description French'),
71
+ 'note' => $this->__('Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method "Other"',
72
+ $this->getCountableText($htmlIdPrefix . 'payment_description_fr')),
73
+ 'class' => 'validate-length maximum-length-5000'
74
+ ));
75
+
76
+ $fieldsetShipping = $form->addFieldset('fieldset_shipping', array('legend' => $this->__('Shipping Methods')));
77
+ $fieldsetShipping->addField('shipping_method', 'select', array(
78
+ 'name' => 'rules[shipping_method]',
79
+ 'label' => $this->__('Shipping Methods'),
80
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_rules_shipping')->getAllOptions(),
81
+ 'class' => 'validate-payment-shipping-combination',
82
+ 'onchange' => 'rulesForm.toggleShippingDescription(this); rulesForm.initPackages(this);'
83
+ ));
84
+ $fieldsetShipping->addField('shipping_package', 'select', array(
85
+ 'name' => 'rules[shipping_package]',
86
+ 'class' => '',
87
+ 'onchange' => 'rulesForm.setShippingFee(this);'
88
+ ));
89
+ $fieldsetShipping->addField('shipping_price', 'text', array(
90
+ 'name' => 'rules[shipping_price]',
91
+ 'label' => $this->__('Shipping Price'),
92
+ 'class' => 'validate-number',
93
+ 'required' => true
94
+ ));
95
+ $fieldsetShipping->addField('shipping_cumulative_fee', 'checkbox', array(
96
+ 'name' => 'rules[shipping_cumulative_fee]',
97
+ 'label' => $this->__('Is Shipping fee cumulative'),
98
+ 'note' => $this->__('If you select this option, the shipping fee will be calculate for each sold product.')
99
+ . $this->__('e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option.')
100
+ ));
101
+ $fieldsetShipping->addField('shipping_availability', 'select', array(
102
+ 'name' => 'rules[shipping_availability]',
103
+ 'label' => $this->__('Shipping Availability'),
104
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_rules_shipping_availability')->getAllOptions()
105
+ ));
106
+ $fieldsetShipping->addField('shipping_description_de', 'textarea', array(
107
+ 'name' => 'rules[shipping_description_de]',
108
+ 'label' => $this->__('Shipping Description German'),
109
+ 'required' => true,
110
+ 'class' => 'validate-length maximum-length-5000',
111
+ 'note' => $this->__('Characters: %s. Max. 5 000 characters', $this->getCountableText($htmlIdPrefix . 'shipping_description_de'))
112
+ ));
113
+ $fieldsetShipping->addField('shipping_description_fr', 'textarea', array(
114
+ 'name' => 'rules[shipping_description_fr]',
115
+ 'label' => $this->__('Shipping Description French'),
116
+ 'required' => true,
117
+ 'class' => 'validate-length maximum-length-5000',
118
+ 'note' => $this->__('Characters: %s. Max. 5 000 characters', $this->getCountableText($htmlIdPrefix . 'shipping_description_fr'))
119
+ ));
120
+ $this->setForm($form);
121
+
122
+ return parent::_prepareForm();
123
+ }
124
+
125
+ protected function _initFormValues()
126
+ {
127
+ $supportedLanguages = Mage::helper('diglin_ricento')->getSupportedLang();
128
+
129
+ $this->getForm()->setValues($this->getShippingPaymentRule());
130
+ $this->getForm()->getElement('shipping_cumulative_fee')->setChecked((bool)$this->getShippingPaymentRule()->getShippingCumulativeFee());
131
+
132
+ $disableShippingDescription = (!$this->getShippingPaymentRule()->getShippingMethod()) ? false : true;
133
+
134
+ $disablePaymentDescription = true;
135
+ $methods = (array)$this->getShippingPaymentRule()->getPaymentMethods();
136
+ foreach ($methods as $method) {
137
+ if ((int)$method === \Diglin\Ricardo\Enums\PaymentMethods::TYPE_OTHER) {
138
+ $disablePaymentDescription = false;
139
+ break;
140
+ }
141
+ }
142
+
143
+ foreach ($supportedLanguages as $supportedLang) {
144
+ $supportedLang = strtolower($supportedLang);
145
+
146
+ if ($supportedLang != $this->_getListing()->getPublishLanguages()
147
+ && $this->_getListing()->getPublishLanguages() != Diglin_Ricento_Helper_Data::LANG_ALL) {
148
+ $disableShippingDescription = true;
149
+ $disablePaymentDescription = true;
150
+ }
151
+
152
+ $this->getForm()->getElement('shipping_description_' . $supportedLang)
153
+ ->setDisabled($disableShippingDescription)
154
+ ->setRequired(!$disableShippingDescription);
155
+
156
+
157
+ $this->getForm()->getElement('payment_description_' . $supportedLang)
158
+ ->setDisabled($disablePaymentDescription)
159
+ ->setRequired(!$disablePaymentDescription);
160
+ }
161
+
162
+ $derivedValues = array();
163
+ $derivedValues['shipping_cumulative_fee'] = 1;
164
+
165
+ $this->getForm()->addValues($derivedValues);
166
+ return parent::_initFormValues();
167
+ }
168
+
169
+ /**
170
+ * Improve the display of some html form elements
171
+ *
172
+ * @return Mage_Adminhtml_Block_Widget_Form|void
173
+ */
174
+ protected function _beforeToHtml()
175
+ {
176
+ parent::_beforeToHtml();
177
+
178
+ $form = $this->getForm();
179
+ $fieldsetShipping = $form->getElement('fieldset_shipping');
180
+
181
+ $elements = $fieldsetShipping->getElements();
182
+
183
+ $fieldShippingPrice = $elements->searchById('shipping_price');
184
+ $fieldShippingPrice->setData('after_element_html', Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY);
185
+
186
+ $fieldPackages = $elements->searchById('shipping_package');
187
+ $fieldMethod = $elements->searchById('shipping_method');
188
+
189
+ $fieldMethod->setData('after_element_html', $fieldPackages->getElementHtml());
190
+ $fieldsetShipping->removeField('shipping_package');
191
+ }
192
+
193
+ protected function _afterToHtml($html)
194
+ {
195
+ $shippingPackage = ($this->getShippingPaymentRule()->getShippingPackage()) ? ',' . $this->getShippingPaymentRule()->getShippingPackage() : '';
196
+ $html .= '<script>var rulesForm = new Ricento.RulesForm("' . $this->getForm()->getHtmlIdPrefix() . '", "'
197
+ . Mage::helper('core')->jsQuoteEscape(json_encode(Mage::getSingleton('diglin_ricento/config_source_rules_shipping_packages')->toOptionHash()), "\"") . '");';
198
+ $html .= 'rulesForm.initPackages($(\'' . $this->getForm()->getHtmlIdPrefix() . 'shipping_method\') ' . $shippingPackage . ');';
199
+ $html .= '</script>';
200
+ $html .= Mage::getModel('diglin_ricento/validate_rules_methods')->getJavaScriptValidator();
201
+ return parent::_afterToHtml($html);
202
+ }
203
+
204
+ /**
205
+ * Return Tab label
206
+ *
207
+ * @return string
208
+ */
209
+ public function getTabLabel()
210
+ {
211
+ return $this->__('Rules');
212
+ }
213
+
214
+ /**
215
+ * Return Tab title
216
+ *
217
+ * @return string
218
+ */
219
+ public function getTabTitle()
220
+ {
221
+ return $this->__('Rules');
222
+ }
223
+
224
+ /**
225
+ * Can show tab in tabs
226
+ *
227
+ * @return boolean
228
+ */
229
+ public function canShowTab()
230
+ {
231
+ return true;
232
+ }
233
+
234
+ /**
235
+ * Tab is hidden
236
+ *
237
+ * @return boolean
238
+ */
239
+ public function isHidden()
240
+ {
241
+ return false;
242
+ }
243
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Edit/Tabs/Selloptions.php ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Selloptions
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Selloptions
16
+ extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract
17
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
18
+ {
19
+ /**
20
+ * @var Diglin_Ricento_Model_Sales_Options
21
+ */
22
+ protected $_model;
23
+
24
+ protected function _prepareForm()
25
+ {
26
+ $form = new Varien_Data_Form();
27
+ $htmlIdPrefix = 'sales_options_';
28
+ $form->setHtmlIdPrefix($htmlIdPrefix);
29
+ $form->addField('entity_id', 'hidden', array(
30
+ 'name' => 'sales_options[entity_id]',
31
+ ));
32
+
33
+ $storeCurrency = Mage::getStoreConfig('currency/options/base', Mage::app()->getWebsite($this->_getListing()->getWebsiteId())->getDefaultStore());
34
+ $currencyWarning = '';
35
+ if ($storeCurrency !== Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY) {
36
+ $currencyWarning = '<ul class="messages"><li class="warning-msg">' .
37
+ $this->__("The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed.", Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY) .
38
+ '</li></ul>';
39
+ }
40
+
41
+ /**
42
+ * Category fieldset
43
+ */
44
+
45
+ $fieldsetCategory = $form->addFieldset('fieldset_category', array('legend' => Mage::helper('catalog')->__('Category')));
46
+ $fieldsetCategory->addType('radios_extensible', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_radios_extensible'));
47
+ $fieldsetCategory->addField('ricardo_category_use_mapping', 'radios_extensible', array(
48
+ 'name' => 'sales_options[ricardo_category_use_mapping]',
49
+ 'label' => $this->__('ricardo.ch Category'),
50
+ 'separator' => ' ',
51
+ 'values' => array(
52
+ array('value' => 1, 'label' => $this->__('Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to Ricardo)')),
53
+ array('value' => 0, 'label' => $this->__('Select ricardo.ch Category'), 'field' => array(
54
+ 'ricardo_category', 'ricardo_category', array(
55
+ 'name' => 'sales_options[ricardo_category]',
56
+ 'label' => $this->__('Select the category'),
57
+ 'class' => 'validate-ricardo-category',
58
+ )
59
+ ))
60
+ ),
61
+ 'types' => array('ricardo_category' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_category_form_renderer_mapping'))
62
+ ));
63
+
64
+ /**
65
+ * Sales Type fieldset
66
+ */
67
+
68
+ $fieldsetType = $form->addFieldset('fieldset_type', array('legend' => $this->__('Type of sales')));
69
+ $fieldsetType->addField('sales_type', 'select', array(
70
+ 'name' => 'sales_options[sales_type]',
71
+ 'required' => true,
72
+ 'label' => $this->__('Type of sales'),
73
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_type')->getAllOptions(),
74
+ 'onchange' => "salesOptionsForm.showSalesTypeFieldsets(this.value, $('" . $htmlIdPrefix . "sales_auction_direct_buy').value == '1', '". $this->__('Until Sold') ."', ". Diglin_Ricento_Model_Config_Source_Sales_Reactivation::SOLDOUT .")"
75
+ ));
76
+
77
+ $fieldsetTypeAuction = $form->addFieldset('fieldset_type_auction', array(
78
+ 'legend' => $this->__('Auction'),
79
+ 'fieldset_container_id' => 'fieldset_toggle_auction'));
80
+
81
+ $fieldsetTypeAuction->addField('sales_auction_start_price', 'text', array(
82
+ 'name' => 'sales_options[sales_auction_start_price]',
83
+ 'label' => $this->__('Start price'),
84
+ 'class' => 'validate-number required-if-visible',
85
+ 'onchange' => 'salesOptionsForm.toggleStartPrice(this, \''. \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD .'\');',
86
+ 'note' => $this->__('Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95.')
87
+ ));
88
+ $fieldsetTypeAuction->addField('sales_auction_increment', 'text', array(
89
+ 'name' => 'sales_options[sales_auction_increment]',
90
+ 'label' => $this->__('Increment'),
91
+ 'class' => 'validate-number required-if-visible validate-startprice-increment',
92
+ ));
93
+ $fieldsetTypeAuction->addField('auction_currency', 'label', array(
94
+ 'name' => 'sales_options[auction_currency]',
95
+ 'label' => $this->__('Currency'),
96
+ 'after_element_html' => $currencyWarning,
97
+ ));
98
+ $fieldsetTypeAuction->addField('sales_auction_direct_buy', 'select', array(
99
+ 'name' => 'sales_options[sales_auction_direct_buy]',
100
+ 'label' => $this->__('Allow Direct Buy'),
101
+ 'values' => Mage::getSingleton('eav/entity_attribute_source_boolean')->getAllOptions(),
102
+ 'onchange' => "salesOptionsForm.showSalesTypeFieldsets('auction', this.value =='1', '". Mage::helper('diglin_ricento')->__('Until sold') ."', " . Diglin_Ricento_Model_Config_Source_Sales_Reactivation::SOLDOUT . "); salesOptionsForm.toggleStockManagement(this)",
103
+ 'note' => $this->__('Fill in the fieldset "Buy now" below to define the direct price settings. <strong>Note</strong>: if set to "Yes", the stock management will be set to "Custom Qty" with a value of 1.')
104
+ ));
105
+
106
+ /**
107
+ * Buy Now fieldset
108
+ */
109
+
110
+ $fieldsetTypeBuynow = $form->addFieldset('fieldset_type_buynow', array('legend' => $this->__('Buy now'), 'fieldset_container_id' => 'fieldset_toggle_buynow'));
111
+
112
+ $fieldsetTypeBuynow->addField('price_source_attribute_code', 'select', array(
113
+ 'name' => 'sales_options[price_source_attribute_code]',
114
+ 'label' => $this->__('Source'),
115
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_price_source')->getAllOptions(),
116
+ 'class' => 'required-if-visible',
117
+ ));
118
+ $fieldsetTypeBuynow->addType('fieldset_inline', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_fieldset_inline'));
119
+ $fieldsetPriceChange = $fieldsetTypeBuynow->addField('fieldset_price_change', 'fieldset_inline', array(
120
+ 'label' => $this->__('Price Change'),
121
+ 'class' => 'required-if-visible'
122
+ ));
123
+ $fieldsetPriceChange->addField('price_change_type', 'select', array(
124
+ 'name' => 'sales_options[price_change_type]',
125
+ 'after_element_html' => ' &nbsp;',
126
+ 'no_span' => true,
127
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_price_method')->getAllOptions(),
128
+ 'class' => 'required-if-visible',
129
+ ));
130
+ $fieldsetPriceChange->addField('price_change', 'text', array(
131
+ 'name' => 'sales_options[price_change]',
132
+ 'no_span' => true,
133
+ 'class' => 'inline-number validate-number',
134
+ ));
135
+ $fieldsetTypeBuynow->addField('fix_currency', 'label', array(
136
+ 'name' => 'sales_options[fix_currency]',
137
+ 'label' => $this->__('Currency'),
138
+ 'after_element_html' => $currencyWarning,
139
+ ));
140
+
141
+ $fieldsetTypeBuynow->addField('price_note', 'note', array(
142
+ 'text' => '<ul class="messages"><li class="notice-msg">'
143
+ . $this->__('For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used.')
144
+ . '<br>'
145
+ . $this->__('For Auction articles, the minimum amount is Fr. 0.1 and must be greater than the Start Price.')
146
+ . '<br>'
147
+ . $this->__('If not correctly defined, the minimum and maximum values will be automatically set.')
148
+ . '</li></ul>'
149
+ ));
150
+
151
+ /**
152
+ * Schedule fieldset
153
+ */
154
+
155
+ $fieldsetSchedule = $form->addFieldset('fieldset_schedule', array('legend' => $this->__('Schedule')));
156
+ $fieldsetSchedule->addType('radios_extensible', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_radios_extensible'));
157
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
158
+ Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
159
+ );
160
+ $fieldsetSchedule->addField('schedule_date_start_immediately', 'radios_extensible', array(
161
+ 'name' => 'sales_options[schedule_date_start_immediately]',
162
+ 'label' => $this->__('Start'),
163
+ 'note' => $this->__('Starting date must start minimum in one hour and maximum 30 days in the future.'),
164
+ 'values' => array(
165
+ array('value' => 1, 'label' => $this->__('Start immediately')),
166
+ array('value' => 0, 'label' => $this->__('Start from'), 'field' => array(
167
+ 'schedule_date_start', 'date', array(
168
+ 'time' => true,
169
+ 'name' => 'sales_options[schedule_date_start]',
170
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
171
+ 'format' => $dateFormatIso,
172
+ //'class' => 'validate-date validate-date-range date-range-end_date-from' // Prototype's date validation does not work with localized dates, so we don't use it
173
+ )
174
+ ))
175
+ )
176
+ ));
177
+ $fieldsetSchedule->addField('schedule_period_use_end_date', 'radios_extensible', array(
178
+ 'name' => 'sales_options[schedule_period_use_end_date]',
179
+ 'label' => $this->__('End'),
180
+ 'note' => $this->__('Ending date must finish at the minimum in 24 hours and maximum 10 days from the starting date.'),
181
+ 'values' => array(
182
+ array('value' => 0, 'label' => $this->__('End after %s days'), 'field' => array(
183
+ 'schedule_period_days', 'select', array(
184
+ 'name' => 'sales_options[schedule_period_days]',
185
+ 'options' => $this->_getDaysOptions()->toOptionHash(),
186
+ 'class' => 'inline-select'
187
+ )
188
+ )),
189
+ array('value' => 1, 'label' => $this->__('End on'), 'field' => array(
190
+ 'schedule_period_end_date', 'date', array(
191
+ 'time' => true,
192
+ 'name' => 'sales_options[schedule_period_end_date]',
193
+ 'image' => Mage::getDesign()->getSkinUrl('images/grid-cal.gif'),
194
+ 'format' => $dateFormatIso,
195
+ //'class' => 'validate-date validate-date-range date-range-end_date-to' // Prototype's date validation does not work with localized dates, so we don't use it
196
+ )
197
+ ))
198
+ )
199
+ ));
200
+ $fieldsetSchedule->addField('schedule_reactivation', 'select', array(
201
+ 'name' => 'sales_options[schedule_reactivation]',
202
+ 'label' => $this->__('Reactivation'),
203
+ 'options' => $this->_getReactivationOptions()->toOptionHash(),
204
+ 'note' => $this->__('<strong>Attention:</strong> you cannot use the option "Until Sold" if you select the Sales Type "Auction"'),
205
+ ));
206
+ // @todo cycle to implement
207
+ // $fieldsetSchedule->addField('schedule_cycle_multiple_products_random', 'radios_extensible', array(
208
+ // 'name' => 'sales_options[schedule_cycle_multiple_products_random]',
209
+ // 'label' => $this->__('Cycle'),
210
+ // 'values' => array(
211
+ // array('value' => 0, 'label' => $this->__('Cycle to publish multiple products %s minutes after the first publish'), 'field' => array(
212
+ // 'schedule_cycle_multiple_products', 'text', array(
213
+ // 'name' => 'sales_options[schedule_cycle_multiple_products]',
214
+ // 'class' => 'inline-number validate-number',
215
+ // )
216
+ // )),
217
+ // array('value' => 1, 'label' => $this->__('Randomly published'))
218
+ // )
219
+ // ));
220
+ $fieldsetSchedule->addField('schedule_overwrite_product_date_start', 'select', array(
221
+ 'name' => 'sales_options[schedule_overwrite_product_date_start]',
222
+ 'label' => $this->__('Overwrite all products starting date'),
223
+ 'values' => Mage::getSingleton('eav/entity_attribute_source_boolean')->getAllOptions()
224
+ ));
225
+
226
+ /**
227
+ * Product Condition fieldset
228
+ */
229
+
230
+ $fieldsetCondition = $form->addFieldset('fieldset_condition', array('legend' => $this->__('Product Condition')));
231
+
232
+ $fieldsetCondition->addField('product_condition', 'select', array(
233
+ 'name' => 'sales_options[product_condition]',
234
+ 'label' => $this->__('Default Condition'),
235
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_product_condition')->getAllOptions(),
236
+ 'required' => true
237
+ ));
238
+ $fieldsetCondition->addField('product_condition_use_attribute', 'select', array(
239
+ 'name' => 'sales_options[product_condition_use_attribute]',
240
+ 'label' => $this->__('Condition Product Source'),
241
+ 'note' => $this->__('Do you want to define the condition source from the ricardo.ch Condition Attribute if you defined it on product basis? Otherwise, if not found or you set here to "No", the default condition set above will be defined.'),
242
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray()
243
+ ));
244
+
245
+ $fieldsetCondition->addField('product_warranty', 'select', array(
246
+ 'name' => 'sales_options[product_warranty]',
247
+ 'label' => $this->__('Warranty'),
248
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_warranty')->getAllOptions(),
249
+ 'onchange' => 'salesOptionsForm.toggleWarrantyDescription(this);'
250
+ ));
251
+ $fieldsetCondition->addField('product_warranty_description_de', 'textarea', array(
252
+ 'name' => 'sales_options[product_warranty_description_de]',
253
+ 'label' => $this->__('Warranty description German'),
254
+ 'class' => 'validate-length maximum-length-5000',
255
+ 'note' => $this->__('Characters %s. Max. 5 000 characters', $this->getCountableText($htmlIdPrefix . 'product_warranty_description_de')),
256
+ 'required' => true
257
+ ));
258
+ $fieldsetCondition->addField('product_warranty_description_fr', 'textarea', array(
259
+ 'name' => 'sales_options[product_warranty_description_fr]',
260
+ 'label' => $this->__('Warranty description French'),
261
+ 'class' => 'validate-length maximum-length-5000',
262
+ 'note' => $this->__('Characters %s. Max. 5 000 characters', $this->getCountableText($htmlIdPrefix . 'product_warranty_description_fr')),
263
+ 'required' => true
264
+ ));
265
+
266
+ /**
267
+ * Stock Management fieldset
268
+ */
269
+
270
+ $fieldsetStock = $form->addFieldset('fieldset_stock', array('legend' => $this->__('Stock Management')));
271
+ $fieldsetStock->addType('radios_extensible', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_radios_extensible'));
272
+ $fieldsetStock->addField('stock_management_use_inventory', 'radios_extensible', array(
273
+ 'name' => 'sales_options[stock_management_use_inventory]',
274
+ 'label' => $this->__('Stock Management'),
275
+ 'note' => $this->__('Range 1...999. If you use the product inventory option, the amount of items will be taken from the field "Qty" defined in the product inventory and limited to 999 if you have a quantity above this value.'),
276
+ 'values' => array(
277
+ array('value' => 1, 'label' => $this->__('Use product inventory')),
278
+ array('value' => 0, 'label' => $this->__('Use custom qty'), 'field' => array(
279
+ 'stock_management', 'text', array(
280
+ 'name' => 'sales_options[stock_management]',
281
+ 'class' => 'inline-number validate-number validate-number-range number-range-1-999'
282
+ )
283
+ ))
284
+ )
285
+ ));
286
+
287
+ /**
288
+ * Template fieldset
289
+ */
290
+
291
+ $fieldsetCustomization = $form->addFieldset('fieldset_customization', array('legend' => $this->__('Customization')));
292
+ $fieldsetCustomization->addField('customization_template', 'select', array(
293
+ 'name' => 'sales_options[customization_template]',
294
+ 'label' => $this->__('Template'),
295
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_template')->getAllOptions(),
296
+ 'note' => $this->__('To create one go to your <a href="%s">ricardo.ch account</a> into "My Sales".', Diglin_Ricento_Helper_Data::RICARDO_URL)
297
+ ));
298
+
299
+ /**
300
+ * Promotions fieldset
301
+ */
302
+
303
+ $fieldsetPromotion = $form->addFieldset('fieldset_promotion', array('legend' => $this->__('Promotion')));
304
+ $fieldsetPromotion->addType('radios_extensible', Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_form_element_radios_extensible'));
305
+ $fieldsetPromotion->addField('promotion_space', 'radios_extensible', array(
306
+ 'name' => 'sales_options[promotion_space]',
307
+ 'label' => $this->__('Privilege Space'),
308
+ 'note' => $this->__("Privilege space on main category page and search results. More information about this feature <a onclick=\"window.open('%s');\">here</a>", Diglin_Ricento_Helper_Data::RICARDO_URL_HELP_PROMOTION),
309
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_sales_promotion')->getAllOptions()
310
+ ));
311
+
312
+ $fieldsetPromotion->addField('promotion_start_page', 'checkbox', array(
313
+ 'name' => 'sales_options[promotion_start_page]',
314
+ 'label' => $this->__('Home Privilege Space'),
315
+ 'note' => $this->__("Privilege space on the homepage. More information about this feature <a onclick=\"window.open('%s');\">here</a>", Diglin_Ricento_Helper_Data::RICARDO_URL_HELP_PROMOTION),
316
+ 'after_element_html' => $this->__('Home Space') . ' - ' . $this->_getPromotionHomeFee()
317
+ ));
318
+
319
+ $fieldsetPromotion->addField('note_promotion', 'note', array(
320
+ 'text' => '<ul class="messages"><li class="notice-msg">'
321
+ . $this->__('These options will not be activated for products having no picture.')
322
+ . '</li></ul>'
323
+ ));
324
+
325
+ $this->setForm($form);
326
+ return parent::_prepareForm();
327
+ }
328
+
329
+ protected function _initFormValues()
330
+ {
331
+ $supportedLangs = Mage::helper('diglin_ricento')->getSupportedLang();
332
+
333
+ $this->getForm()->setValues($this->getSalesOptions());
334
+
335
+ $derivedValues = array();
336
+ $derivedValues['fix_currency'] = $derivedValues['auction_currency'] = Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY;
337
+
338
+ /**
339
+ * Set default sales type
340
+ */
341
+ if ($this->getSalesOptions()->getSalesType() == null) {
342
+ $derivedValues['sales_type'] = Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION;
343
+ }
344
+
345
+ /**
346
+ * Add "Until Sold" option to the select input when it's buy now sales type
347
+ */
348
+ if ($this->getSalesOptions()->getSalesType() == Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW) {
349
+ $option = array('value' => Diglin_Ricento_Model_Config_Source_Sales_Reactivation::SOLDOUT, 'label' => Mage::helper('diglin_ricento')->__('Until sold'));;
350
+ $scheduleReactivationValues = $this->getForm()->getElement('schedule_reactivation')->getValues();
351
+ $scheduleReactivationValues[] = $option;
352
+ $this->getForm()->getElement('schedule_reactivation')->setValues($scheduleReactivationValues);
353
+ }
354
+
355
+ /**
356
+ * Select which radio box to enable when no ricardo category exists
357
+ */
358
+ if ((int) $this->getSalesOptions()->getRicardoCategory() == -1) {
359
+ $derivedValues['ricardo_category_use_mapping'] = 1;
360
+ } else {
361
+ $derivedValues['ricardo_category_use_mapping'] = 0;
362
+ }
363
+
364
+ /**
365
+ * Set the default value of the dropdown for the "condition use attribute"
366
+ */
367
+ if ($this->getSalesOptions()->getProductConditionSourceAttributeCode()) {
368
+ $derivedValues['product_condition_use_attribute'] = 1;
369
+ }
370
+
371
+ /**
372
+ * Set the default value of the radio button for the "time to publish between each article"
373
+ */
374
+ if ($this->getSalesOptions()->getScheduleCycleMultipleProducts() === null) {
375
+ $derivedValues['schedule_cycle_multiple_products_random'] = '1';
376
+ }
377
+
378
+ /**
379
+ * Set the default values of the radio button for the "stock management"
380
+ */
381
+ if ((int)$this->getSalesOptions()->getStockManagement() === -1) {
382
+ $derivedValues['stock_management'] = '';
383
+ $derivedValues['stock_management_use_inventory'] = 1;
384
+ }
385
+
386
+ /**
387
+ * Set the default values of the radio button for the "Starting Date"
388
+ */
389
+ if ($this->getSalesOptions()->getScheduleDateStart() == null) {
390
+ $derivedValues['schedule_date_start_immediately'] = 1;
391
+ }
392
+
393
+ /**
394
+ * Set the default values for the ending date
395
+ */
396
+ if (!in_array($this->getSalesOptions()->getSchedulePeriodDays(), $this->_getDaysOptions()->toOptionHash())) {
397
+ $derivedValues['schedule_period_use_end_date'] = 1;
398
+ $derivedValues['schedule_period_end_date'] = date_add(
399
+ new DateTime($this->getSalesOptions()->getScheduleDateStart()),
400
+ DateInterval::createFromDateString($this->getSalesOptions()->getSchedulePeriodDays() . ' day')
401
+ )->format(Varien_Date::DATETIME_PHP_FORMAT);
402
+ }
403
+
404
+ /**
405
+ * Define if the warranty description must be enabled or not
406
+ */
407
+ if ($this->getSalesOptions()->getProductWarranty()) {
408
+ foreach ($supportedLangs as $supportedLang) {
409
+ $supportedLang = strtolower($supportedLang);
410
+ $derivedValues['product_warranty_description_' . $supportedLang] = '';
411
+ $this->getForm()->getElement('product_warranty_description_' . $supportedLang)
412
+ ->setDisabled(true)
413
+ ->setRequired(false);
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Define the values and defaults for the promotion homepage
419
+ */
420
+ $derivedValues['promotion_start_page'] = \Diglin\Ricardo\Enums\Article\PromotionCode::PREMIUMHOMEPAGE;
421
+ if ($this->getSalesOptions()->getPromotionStartPage() == \Diglin\Ricardo\Enums\Article\PromotionCode::PREMIUMHOMEPAGE) {
422
+ $this->getForm()->getElement('promotion_start_page')->setChecked(true);
423
+ }
424
+
425
+
426
+ $this->getForm()->addValues($derivedValues);
427
+ return parent::_initFormValues();
428
+ }
429
+
430
+ protected function _afterToHtml($html)
431
+ {
432
+ $html .= '<script type="text/javascript">var salesOptionsForm = new Ricento.salesOptionsForm("' . $this->getForm()->getHtmlIdPrefix() . '");</script>';
433
+ $html .= Mage::getSingleton('diglin_ricento/validate_sales_increment')->getJavaScriptValidator();
434
+ return parent::_afterToHtml($html);
435
+ }
436
+
437
+ /**
438
+ * Return Tab label
439
+ *
440
+ * @return string
441
+ */
442
+ public function getTabLabel()
443
+ {
444
+ return $this->__('Sales Options');
445
+ }
446
+
447
+ /**
448
+ * Return Tab title
449
+ *
450
+ * @return string
451
+ */
452
+ public function getTabTitle()
453
+ {
454
+ return $this->__('Sales Options');
455
+ }
456
+
457
+ /**
458
+ * Can show tab in tabs
459
+ *
460
+ * @return boolean
461
+ */
462
+ public function canShowTab()
463
+ {
464
+ return true;
465
+ }
466
+
467
+ /**
468
+ * Tab is hidden
469
+ *
470
+ * @return boolean
471
+ */
472
+ public function isHidden()
473
+ {
474
+ return false;
475
+ }
476
+
477
+ /**
478
+ * @return Diglin_Ricento_Model_Config_Source_Sales_Days
479
+ */
480
+ protected function _getDaysOptions()
481
+ {
482
+ return Mage::getSingleton('diglin_ricento/config_source_sales_days');
483
+ }
484
+
485
+ /**
486
+ * @return Diglin_Ricento_Model_Config_Source_Sales_Reactivation
487
+ */
488
+ protected function _getReactivationOptions()
489
+ {
490
+ return Mage::getSingleton('diglin_ricento/config_source_sales_reactivation');
491
+ }
492
+
493
+ /**
494
+ * Returns sales options model
495
+ *
496
+ * @return Diglin_Ricento_Model_Sales_Options
497
+ */
498
+ public function getSalesOptions()
499
+ {
500
+ if (!$this->_model) {
501
+ $this->_model = $this->_getListing()->getSalesOptions();
502
+ $data = Mage::getSingleton('adminhtml/session')->getSalesOptionsFormData(true);
503
+ if (!empty($data)) {
504
+ $this->_model->setData($data);
505
+ }
506
+ }
507
+ return $this->_model;
508
+ }
509
+
510
+ /**
511
+ * @return string
512
+ */
513
+ protected function _getPromotionHomeFee()
514
+ {
515
+ $price = 0;
516
+ $promotions = Mage::getSingleton('diglin_ricento/api_services_system')->getPromotions(
517
+ Mage::helper('diglin_ricento')->getJsonDate(), \Diglin\Ricardo\Enums\System\CategoryArticleType::ALL, 1, 1
518
+ );
519
+
520
+ $priceHelper = Mage::helper('diglin_ricento/price');
521
+
522
+ foreach ($promotions as $promotion) {
523
+ if ($promotion['PromotionId'] == \Diglin\Ricardo\Enums\Article\PromotionCode::PREMIUMHOMEPAGE) {
524
+ $price = $promotion['PromotionFee'];
525
+ break;
526
+ }
527
+ }
528
+
529
+ return $priceHelper->formatPrice($price, $this->_getListing()->getWebsiteId());
530
+ }
531
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Form/Abstract.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Form_Abstract extends Mage_Adminhtml_Block_Widget_Form
16
+ {
17
+ public function isReadonlyForm()
18
+ {
19
+ return $this->_getListing()->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED;
20
+ }
21
+
22
+ public function getReadonlyNote()
23
+ {
24
+ return $this->__('Listed listings cannot be modified. Stop the listing first to make changes.');
25
+ }
26
+
27
+ /**
28
+ * @return Diglin_Ricento_Model_Products_Listing
29
+ */
30
+ protected function _getListing()
31
+ {
32
+ $listing = Mage::registry('products_listing');
33
+ if (!$listing) {
34
+ Mage::throwException('Products listing not loaded');
35
+ }
36
+ return $listing;
37
+ }
38
+
39
+ protected function _initFormValues()
40
+ {
41
+ if ($this->isReadonlyForm()) {
42
+ $this->getForm()->addField('readonly_note', 'note', array(
43
+ 'text' => '<ul class="messages"><li class="warning-msg"><span>' .
44
+ $this->getReadonlyNote() .
45
+ '</span></li></ul>'
46
+ ), '^');
47
+ Mage::helper('diglin_ricento')->disableForm($this->getForm());
48
+ }
49
+ return parent::_initFormValues();
50
+ }
51
+
52
+ /**
53
+ * Get countable text for js event
54
+ *
55
+ * @param string $prefix
56
+ * @return string
57
+ */
58
+ public function getCountableText($prefix)
59
+ {
60
+ return '<strong><span id="' . $prefix . '_result__all">0</span></strong>';
61
+ }
62
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid extends Mage_Adminhtml_Block_Widget_Grid
16
+ {
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setId('listingGrid');
21
+ $this->setDefaultSort('entity_id');
22
+ $this->setDefaultDir('DESC');
23
+ $this->setSaveParametersInSession(true);
24
+ }
25
+
26
+ /**
27
+ * @return Diglin_Ricento_Model_Products_Listing
28
+ */
29
+ public function getListing()
30
+ {
31
+ return Mage::registry('products_listing');
32
+ }
33
+
34
+ /**
35
+ * Prepare the collection to be displayed as a grid
36
+ *
37
+ * @return Varien_Data_Collection
38
+ */
39
+ protected function _prepareCollection()
40
+ {
41
+ $collection = Mage::getResourceModel('diglin_ricento/products_listing_collection');
42
+ $this->setCollection($collection);
43
+ return parent::_prepareCollection();
44
+ }
45
+
46
+ /**
47
+ * Prepare the columns to generate the column
48
+ *
49
+ * @return Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid
50
+ */
51
+ protected function _prepareColumns()
52
+ {
53
+ $helper = Mage::helper('diglin_ricento');
54
+
55
+ $this->addColumn('entity_id', array(
56
+ 'header' => $this->__('ID') ,
57
+ 'align' => 'left',
58
+ 'index' => 'entity_id',
59
+ 'type' => 'number',
60
+ 'width' => '50px',
61
+ ));
62
+
63
+ $this->addColumn('title', array(
64
+ 'header' => $this->__('Title') ,
65
+ 'align' => 'left',
66
+ 'index' => 'title',
67
+ ));
68
+
69
+ if (!Mage::app()->isSingleStoreMode()) {
70
+ $this->addColumn('websites',
71
+ array(
72
+ 'header'=> Mage::helper('catalog')->__('Websites'),
73
+ 'width' => '100px',
74
+ 'sortable' => false,
75
+ 'index' => 'website_id',
76
+ 'type' => 'options',
77
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
78
+ ));
79
+ }
80
+
81
+ $this->addColumn('total', array(
82
+ 'header' => $this->__('Total') ,
83
+ 'align' => 'right',
84
+ 'width' => '50px',
85
+ 'index' => 'total',
86
+ 'type' => 'number',
87
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_grid_renderer_total')
88
+ ));
89
+
90
+ $this->addColumn('status', array(
91
+ 'header' => $this->__('Status') ,
92
+ 'align' => 'left',
93
+ 'width' => '150px',
94
+ 'index' => 'status',
95
+ 'type' => 'options',
96
+ 'options' => Mage::getSingleton('diglin_ricento/config_source_status')->toOptionHash(),
97
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_products_listing_grid_renderer_status')
98
+ ));
99
+
100
+ $this->addColumn('action',
101
+ array(
102
+ 'header' => $helper->__('Action'),
103
+ 'width' => '90px',
104
+ 'type' => 'action',
105
+ 'getter' => 'getId',
106
+ 'actions' => array(
107
+ array(
108
+ 'caption' => $helper->__('Edit'),
109
+ 'url' => array(
110
+ 'base'=>'*/*/edit',
111
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
112
+ ),
113
+ 'field' => 'id'
114
+ ),
115
+ array(
116
+ 'caption' => $helper->__('List'),
117
+ 'url' => array(
118
+ 'base'=>'*/*/list',
119
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
120
+ ),
121
+ 'field' => 'id'
122
+ ),
123
+ // array(
124
+ // 'caption' => $helper->__('Relist'),
125
+ // 'url' => array(
126
+ // 'base'=>'*/*/relist',
127
+ // 'params'=>array('store'=>$this->getRequest()->getParam('store'))
128
+ // ),
129
+ // 'field' => 'id'
130
+ // ),
131
+ array(
132
+ 'caption' => $helper->__('Stop List'),
133
+ 'url' => array(
134
+ 'base'=>'*/*/stop',
135
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
136
+ ),
137
+ 'field' => 'id'
138
+ ),
139
+ array(
140
+ 'caption' => $helper->__('View Logs'),
141
+ 'url' => array(
142
+ 'base'=>'*/log/listing',
143
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
144
+ ),
145
+ 'field' => 'id'
146
+ )
147
+ ),
148
+ 'filter' => false,
149
+ 'sortable' => false,
150
+ 'index' => 'stores',
151
+ ));
152
+
153
+ }
154
+
155
+ /**
156
+ * Prepare the mass action drop down menu
157
+ *
158
+ * @return Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid
159
+ */
160
+ protected function _prepareMassaction()
161
+ {
162
+ $this->setMassactionIdField('entity_id');
163
+ $this->getMassactionBlock()->setFormFieldName('products_listing');
164
+
165
+ // Changing status it's quite a bad idea at product listing level, better at product listing item level
166
+ // $statuses = Mage::getSingleton('diglin_ricento/config_source_status')->toOptionArray();
167
+ //
168
+ // // Remove the first and last item cause no need here
169
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
170
+ // array_pop($statuses);
171
+
172
+ // $this->getMassactionBlock()->addItem('status', array(
173
+ // 'label'=> $this->__('Change status'),
174
+ // 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
175
+ // 'additional' => array(
176
+ // 'visibility' => array(
177
+ // 'name' => 'status',
178
+ // 'type' => 'select',
179
+ // 'class' => 'required-entry',
180
+ // 'label' => $this->__('Status'),
181
+ // 'values' => $statuses
182
+ // )
183
+ // )
184
+ // ));
185
+
186
+ $this->getMassactionBlock()->addItem('delete', array(
187
+ 'label'=> $this->__('Delete'),
188
+ 'url' => $this->getUrl('*/*/massDelete', array('_current'=>true)),
189
+ 'confirm' => $this->__('Are you sure that you want to delete this/these products listing(s)? Be aware it\'s only possible when the listing is "Listed"')
190
+ ));
191
+
192
+ return $this;
193
+ }
194
+
195
+ protected function _filterStoreCondition($collection, $column)
196
+ {
197
+ if (!$value = $column->getFilter()->getValue()) {
198
+ return;
199
+ }
200
+
201
+ $this->getCollection()->addStoreFilter($value);
202
+ }
203
+ /**
204
+ * Get the url to set for each row in the grid
205
+ *
206
+ * @param $row
207
+ * @return string
208
+ */
209
+ public function getRowUrl($row)
210
+ {
211
+ return $this->getUrl('*/*/edit', array(
212
+ 'id' => $row->getId()
213
+ ));
214
+ }
215
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid/Renderer/Status.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid_Renderer_Status
14
+ *
15
+ * Renderer for detailed status information
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid_Renderer_Status
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $resourceModel = Mage::getResourceModel('diglin_ricento/products_listing_item');
27
+ $readAdapter = $resourceModel->getReadConnection();
28
+
29
+ $sqlListed = $readAdapter->select()
30
+ ->from($resourceModel->getTable('diglin_ricento/products_listing_item'), new Zend_Db_Expr('COUNT(*)'))
31
+ ->where('products_listing_id = ?', $row->getId())
32
+ ->where('status = ?', Diglin_Ricento_Helper_Data::STATUS_LISTED)
33
+ ->where('parent_item_id IS NULL');
34
+
35
+ $sqlNotListed = $readAdapter->select()
36
+ ->from($resourceModel->getTable('diglin_ricento/products_listing_item'), new Zend_Db_Expr('COUNT(*)'))
37
+ ->where('products_listing_id = ?', $row->getId())
38
+ ->where('status != ?', Diglin_Ricento_Helper_Data::STATUS_LISTED)
39
+ ->where('parent_item_id IS NULL');
40
+
41
+
42
+ $totalListed = $readAdapter->fetchOne($sqlListed);
43
+ $totalUnlisted = $readAdapter->fetchOne($sqlNotListed);
44
+
45
+ $html = '';
46
+ $html .= '<strong>' . $this->_getValue($row) . '</strong>';
47
+ $html .= '<dl class="diglin_ricento_status_info">';
48
+ $html .= '<dt>' . $this->__('Listed products:') . '</dt>';
49
+ $html .= '<dd>' . (int) $totalListed . '</dd>';
50
+ $html .= '<dt>' . $this->__('Not listed products:') . '</dt>';
51
+ $html .= '<dd>' . (int) $totalUnlisted . '</dd>';
52
+ $html .= '</dl>';
53
+ return $html;
54
+ }
55
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Grid/Renderer/Total.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid_Renderer_Total
14
+ *
15
+ * Renderer for detailed status information
16
+ */
17
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid_Renderer_Total
18
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19
+ {
20
+ /**
21
+ * @param Varien_Object $row
22
+ * @return string
23
+ */
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $resourceModel = Mage::getResourceModel('diglin_ricento/products_listing_item');
27
+ $readAdapter = $resourceModel->getReadConnection();
28
+
29
+ $total = $readAdapter->select()
30
+ ->from($resourceModel->getTable('diglin_ricento/products_listing_item'), new Zend_Db_Expr('COUNT(*)'))
31
+ ->where('products_listing_id = ?', $row->getId())
32
+ ->where('parent_item_id IS NULL');
33
+
34
+ return $readAdapter->fetchOne($total);
35
+ }
36
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
16
+ {
17
+ public function __construct()
18
+ {
19
+ $this->_objectId = 'entity_id';
20
+ $this->_blockGroup = 'diglin_ricento';
21
+ $this->_controller = 'adminhtml_products_listing_item';
22
+
23
+ parent::__construct();
24
+
25
+ $this->updateButton('back', 'label', Mage::helper('adminhtml')->__('Back to the list "%s"', $this->getListing()->getTitle()));
26
+ }
27
+
28
+ /**
29
+ * Retrieve text for header element depending on loaded listing
30
+ *
31
+ * @return string
32
+ */
33
+ public function getHeaderText()
34
+ {
35
+ if (count($this->getSelectedItems()) == 1) {
36
+ return $this->__("Configure product '%s'", $this->escapeHtml($this->getSelectedItems()->getFirstItem()->getMagentoProduct()->getName()));
37
+ } else {
38
+ return $this->__('Configure all %s selected products', count($this->getSelectedItems()));
39
+ }
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getBackUrl()
46
+ {
47
+ return $this->getUrl('*/products_listing/edit', array('id' => $this->getListingId()));
48
+ }
49
+
50
+ /**
51
+ * Returns items that are selected to be configured
52
+ *
53
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
54
+ */
55
+ public function getSelectedItems()
56
+ {
57
+ return Mage::registry('selected_items');
58
+ }
59
+
60
+ /**
61
+ * Returns product listing
62
+ *
63
+ * @return Diglin_Ricento_Model_Products_Listing
64
+ */
65
+ public function getListing()
66
+ {
67
+ return Mage::registry('products_listing');
68
+ }
69
+
70
+ /**
71
+ * Returns product listing id if listing loaded, null otherwise
72
+ *
73
+ * @return int|null
74
+ */
75
+ public function getListingId()
76
+ {
77
+ $listing = $this->getListing();
78
+ if ($listing) {
79
+ return $listing->getId();
80
+ }
81
+ return null;
82
+ }
83
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Form.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Form
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
16
+ {
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setTemplate('ricento/products/listing/item/edit/form.phtml');
21
+ }
22
+
23
+ /**
24
+ * @return Mage_Core_Block_Abstract
25
+ */
26
+ protected function _prepareLayout()
27
+ {
28
+ $this->setChild('tabs',
29
+ $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_item_edit_tabs', 'tabs')
30
+ );
31
+ return parent::_prepareLayout();
32
+ }
33
+
34
+ /**
35
+ * @return Mage_Adminhtml_Block_Widget_Form
36
+ */
37
+ protected function _prepareForm()
38
+ {
39
+ $form = new Varien_Data_Form(array(
40
+ 'id' => 'edit_form',
41
+ 'class' => 'ricento-form',
42
+ 'action' => $this->getUrl('*/*/save', array(
43
+ 'id' => $this->getRequest()
44
+ ->getParam('id')
45
+ )), 'method' => 'post', 'enctype' => 'multipart/form-data'
46
+ ));
47
+ $form->addField('item_ids', 'hidden', array(
48
+ 'name' => 'item_ids'
49
+ ));
50
+
51
+ $form->setUseContainer(true);
52
+ $this->setForm($form);
53
+ return parent::_prepareForm();
54
+ }
55
+
56
+ /**
57
+ * @return string
58
+ */
59
+ public function getTabsHtml()
60
+ {
61
+ return $this->getChildHtml('tabs');
62
+ }
63
+
64
+ /**
65
+ * @return $this|Mage_Adminhtml_Block_Widget_Form
66
+ */
67
+ protected function _initFormValues()
68
+ {
69
+ parent::_initFormValues();
70
+ $this->getForm()->addValues(array('item_ids' => implode(',', $this->getSelectedItems()->getAllIds())));
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * Returns items that are selected to be configured
76
+ *
77
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
78
+ */
79
+ public function getSelectedItems()
80
+ {
81
+ return Mage::registry('selected_items');
82
+ }
83
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
16
+ {
17
+ public function __construct()
18
+ {
19
+ parent::__construct();
20
+ $this->setId('products_listing_item_tabs');
21
+ $this->setDestElementId('edit_form');
22
+ $this->setTemplate('widget/tabshoriz.phtml');
23
+ }
24
+
25
+ protected function _beforeToHtml()
26
+ {
27
+ $this->addTab('selloptions_section', array(
28
+ 'label' => $this->__('Sales Options') ,
29
+ 'title' => $this->__('Sales Options') ,
30
+ 'content' => $this->getLayout()
31
+ ->createBlock('diglin_ricento/adminhtml_products_listing_item_edit_tabs_selloptions')
32
+ ->toHtml()
33
+ ));
34
+
35
+ $this->addTab('rules_section', array(
36
+ 'label' => $this->__('Rules') ,
37
+ 'title' => $this->__('Rules') ,
38
+ 'content' => $this->getLayout()
39
+ ->createBlock('diglin_ricento/adminhtml_products_listing_item_edit_tabs_rules')
40
+ ->toHtml()
41
+ ));
42
+
43
+ return parent::_beforeToHtml();
44
+ }
45
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs/Rules.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs_Rules
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs_Rules
16
+ extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Rules
17
+ {
18
+ /**
19
+ * @return bool
20
+ */
21
+ public function isReadonlyForm()
22
+ {
23
+ foreach ($this->getSelectedItems() as $item) {
24
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
25
+ if ($item->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED) {
26
+ return true;
27
+ }
28
+ }
29
+ return false;
30
+ }
31
+
32
+ /**
33
+ * @return string
34
+ */
35
+ public function getReadonlyNote()
36
+ {
37
+ return $this->__('Listed items cannot be modified. Stop the listing first to make changes.');
38
+ }
39
+
40
+ /**
41
+ * If all items use the default list settings, check the "use default" checkbox
42
+ * and disable all elements but the checkbox
43
+ *
44
+ * @return $this|Mage_Adminhtml_Block_Widget_Form
45
+ */
46
+ protected function _initFormValues()
47
+ {
48
+ parent::_initFormValues();
49
+
50
+ $helper = Mage::helper('diglin_ricento');
51
+
52
+ $useDefaultCheckbox = $this->getForm()->getElement('use_products_list_settings');
53
+ $useDefaultCheckbox->setChecked(true);
54
+ $useDefaultCheckbox->setValue(1);
55
+
56
+ foreach ($this->getSelectedItems() as $item) {
57
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
58
+ if ($item->getRuleId()) {
59
+ $useDefaultCheckbox->setChecked(false);
60
+ break;
61
+ }
62
+ }
63
+ if ($useDefaultCheckbox->getChecked()) {
64
+ $helper->disableForm($this->getForm());
65
+ $useDefaultCheckbox->setDisabled(false);
66
+ }
67
+
68
+ $publishedLang = $this->_getListing()->getPublishLanguages();
69
+ if ($publishedLang != Diglin_Ricento_Helper_Data::LANG_ALL) {
70
+ $supportedLangs = $helper->getSupportedLang();
71
+ foreach ($supportedLangs as $supportedLang) {
72
+ $supportedLang = strtolower($supportedLang);
73
+ if ($supportedLang != $publishedLang) {
74
+ $this->getForm()->getElement('fieldset_shipping')
75
+ ->removeField('shipping_description_' . $supportedLang);
76
+
77
+ $this->getForm()->getElement('fieldset_payment')
78
+ ->removeField('payment_description_' . $supportedLang);
79
+ }
80
+ }
81
+ }
82
+
83
+ return $this;
84
+ }
85
+
86
+ protected function _prepareForm()
87
+ {
88
+ parent::_prepareForm();
89
+ $this->getForm()->addField('use_products_list_settings', 'checkbox', array(
90
+ 'name' => 'rules[use_products_list_settings]',
91
+ 'label' => 'Use Product List Settings',
92
+ 'onclick' => "Ricento.useProductListSettings(this, '{$this->getForm()->getHtmlIdPrefix()}')"
93
+ ), '^');
94
+ return $this;
95
+ }
96
+
97
+ /**
98
+ * Returns items that are selected to be configured
99
+ *
100
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
101
+ */
102
+ public function getSelectedItems()
103
+ {
104
+ return Mage::registry('selected_items');
105
+ }
106
+
107
+ /**
108
+ * Returns sales options model. Use sales options from single item if there is only one item
109
+ * and it has individual settings. Otherwise use a copy of the sales options from listing
110
+ *
111
+ * @return Diglin_Ricento_Model_Rule
112
+ */
113
+ public function getShippingPaymentRule()
114
+ {
115
+ if (!$this->_model) {
116
+ if (count($this->getSelectedItems()) === 1) {
117
+ $this->_loadSalesOptionsFromItem($this->getSelectedItems()->getFirstItem());
118
+ }
119
+ if (!$this->_model) {
120
+ $this->_model = $this->_getListing()->getSalesOptions();
121
+ $this->_model->unsetData('rule_id');
122
+ }
123
+ $data = Mage::getSingleton('adminhtml/session')->getRulesFormData(true);
124
+ if (!empty($data)) {
125
+ $this->_model->setData($data);
126
+ }
127
+ }
128
+ return $this->_model;
129
+ }
130
+
131
+ /**
132
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
133
+ */
134
+ protected function _loadSalesOptionsFromItem(Diglin_Ricento_Model_Products_Listing_Item $item)
135
+ {
136
+ if ($item->getRuleId()) {
137
+ $this->_model = $item->getShippingPaymentRule();
138
+ }
139
+ }
140
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Edit/Tabs/Selloptions.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs_Selloptions
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Tabs_Selloptions
16
+ extends Diglin_Ricento_Block_Adminhtml_Products_Listing_Edit_Tabs_Selloptions
17
+
18
+ {
19
+ /**
20
+ * @return bool
21
+ */
22
+ public function isReadonlyForm()
23
+ {
24
+ foreach ($this->getSelectedItems() as $item) {
25
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
26
+ if ($item->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED) {
27
+ return true;
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+
33
+ /**
34
+ * @return string
35
+ */
36
+ public function getReadonlyNote()
37
+ {
38
+ return $this->__('Listed items cannot be modified. Stop the listing first to make changes.');
39
+ }
40
+
41
+ /**
42
+ * @return $this|Mage_Adminhtml_Block_Widget_Form
43
+ */
44
+ protected function _prepareForm()
45
+ {
46
+ parent::_prepareForm();
47
+ $this->getForm()->addField('use_products_list_settings', 'checkbox', array(
48
+ 'name' => 'sales_options[use_products_list_settings]',
49
+ 'label' => 'Use Product List Settings',
50
+ 'onclick' => "Ricento.useProductListSettings(this, '{$this->getForm()->getHtmlIdPrefix()}')"
51
+ ), '^');
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * If all items use the default list settings, check the "use default" checkbox
57
+ * and disable all elements but the checkbox
58
+ *
59
+ * @return $this|Mage_Adminhtml_Block_Widget_Form
60
+ */
61
+ protected function _initFormValues()
62
+ {
63
+ parent::_initFormValues();
64
+
65
+ $helper = Mage::helper('diglin_ricento');
66
+
67
+ $useDefaultCheckbox = $this->getForm()->getElement('use_products_list_settings');
68
+ $useDefaultCheckbox->setChecked(true);
69
+ $useDefaultCheckbox->setValue(1);
70
+
71
+ foreach ($this->getSelectedItems() as $item) {
72
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
73
+ if ($item->getSalesOptionsId()) {
74
+ $useDefaultCheckbox->setChecked(false);
75
+ break;
76
+ }
77
+ }
78
+ if ($useDefaultCheckbox->getChecked()) {
79
+ $helper->disableForm($this->getForm());
80
+ $useDefaultCheckbox->setDisabled(false);
81
+ }
82
+
83
+ $publishedLang = $this->_getListing()->getPublishLanguages();
84
+ if ($publishedLang != Diglin_Ricento_Helper_Data::LANG_ALL) {
85
+ $supportedLangs = $helper->getSupportedLang();
86
+ foreach ($supportedLangs as $supportedLang) {
87
+ $supportedLang = strtolower($supportedLang);
88
+ if ($supportedLang != $publishedLang) {
89
+ $this->getForm()->getElement('fieldset_condition')->removeField('product_warranty_description_' . $supportedLang);
90
+ }
91
+ }
92
+ }
93
+
94
+ $this->getForm()->getElement('fieldset_schedule')->removeField('schedule_overwrite_product_date_start');
95
+
96
+ return $this;
97
+ }
98
+
99
+ /**
100
+ * Returns items that are selected to be configured
101
+ *
102
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
103
+ */
104
+ public function getSelectedItems()
105
+ {
106
+ return Mage::registry('selected_items');
107
+ }
108
+
109
+ /**
110
+ * Returns sales options model. Use sales options from single item if there is only one item
111
+ * and it has individual settings. Otherwise use a copy of the sales options from listing
112
+ *
113
+ * @return Diglin_Ricento_Model_Sales_Options
114
+ */
115
+ public function getSalesOptions()
116
+ {
117
+ if (!$this->_model) {
118
+ if (count($this->getSelectedItems()) === 1) {
119
+ $this->_loadSalesOptionsFromItem($this->getSelectedItems()->getFirstItem());
120
+ }
121
+ if (!$this->_model) {
122
+ $this->_model = $this->_getListing()->getSalesOptions();
123
+ $this->_model->unsetData('entity_id');
124
+ }
125
+ $data = Mage::getSingleton('adminhtml/session')->getSalesOptionsFormData(true);
126
+ if (!empty($data)) {
127
+ $this->_model->setData($data);
128
+ }
129
+ }
130
+ return $this->_model;
131
+ }
132
+
133
+ /**
134
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
135
+ */
136
+ protected function _loadSalesOptionsFromItem(Diglin_Ricento_Model_Products_Listing_Item $item)
137
+ {
138
+ if ($item->getSalesOptionsId()) {
139
+ $this->_model = $item->getSalesOptions();
140
+ }
141
+ }
142
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Item/Preview.php ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Preview extends Mage_Adminhtml_Block_Template
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $_template = 'ricento/products/listing/item/preview.phtml';
18
+
19
+ /**
20
+ * @var Diglin_Ricento_Model_Products_Listing_Item
21
+ */
22
+ protected $_productItem;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ protected $_categoriesPath = array();
28
+
29
+ /**
30
+ * Returns items that are selected to be configured
31
+ *
32
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
33
+ */
34
+ public function getSelectedItems()
35
+ {
36
+ return Mage::registry('selected_items');
37
+ }
38
+
39
+ /**
40
+ * Returns product listing
41
+ *
42
+ * @return Diglin_Ricento_Model_Products_Listing
43
+ */
44
+ public function getListing()
45
+ {
46
+ return Mage::registry('products_listing');
47
+ }
48
+
49
+ /**
50
+ * @return Diglin_Ricento_Model_Products_Listing_Item
51
+ */
52
+ public function getProductItem()
53
+ {
54
+ if (empty($this->_productItem)) {
55
+
56
+ // Little bit shitty to have a collection here for one product but well, it's a feature
57
+ // not used often + the controller is built in this way
58
+ $this->_productItem = $this->getSelectedItems()->getFirstItem();
59
+ $this->_productItem->setLoadFallbackOptions(true);
60
+ }
61
+
62
+ return $this->_productItem;
63
+ }
64
+
65
+ /**
66
+ * @return Mage_Catalog_Model_Product|Mage_Core_Model_Abstract
67
+ */
68
+ public function getProduct()
69
+ {
70
+ return $this->getProductItem()->getMagentoProduct();
71
+ }
72
+
73
+ /**
74
+ * @return Diglin_Ricento_Model_Sales_Options
75
+ */
76
+ public function getSalesOptions()
77
+ {
78
+ return $this->getProductItem()->getSalesOptions();
79
+ }
80
+
81
+ /**
82
+ * @return Diglin_Ricento_Model_Rule
83
+ */
84
+ public function getShippingPaymentRule()
85
+ {
86
+ return $this->getProductItem()->getShippingPaymentRule();
87
+ }
88
+
89
+ /**
90
+ * Get Category breadcrumb
91
+ *
92
+ * @return array
93
+ */
94
+ public function getBreadcrumb()
95
+ {
96
+ $categoryItem = $this->getProductItem()->getCategory();
97
+
98
+ if ($categoryItem && $categoryItem != -1) {
99
+ $this->_getCategoriesPath($categoryItem);
100
+
101
+ if (is_array($this->_categoriesPath)) {
102
+ return array_reverse($this->_categoriesPath);
103
+ }
104
+ }
105
+
106
+ return array($this->__('No ricardo.ch category found'));
107
+ }
108
+
109
+ /**
110
+ * @param $category
111
+ * @return Diglin_Ricento_Model_Products_Category
112
+ */
113
+ protected function _getCategoriesPath($category)
114
+ {
115
+ $parentId = false;
116
+
117
+ $categoryObject = Mage::getSingleton('diglin_ricento/products_category_mapping')
118
+ ->getCategory($category);
119
+
120
+
121
+ if ($categoryObject && $categoryObject->getCategoryName()) {
122
+ $this->_categoriesPath[] = '<a href="#">' . $categoryObject->getCategoryName() . '</a>';
123
+ $parentId = $categoryObject->getParentId();
124
+ }
125
+
126
+ if (!empty($parentId)) {
127
+ $categoryObject = $this->_getCategoriesPath($parentId);
128
+ }
129
+
130
+ return $categoryObject;
131
+ }
132
+
133
+ /**
134
+ * Get the starting date of the auction
135
+ *
136
+ * @return string
137
+ */
138
+ public function getStartingDate()
139
+ {
140
+ return $this->_getLocalizedDate($this->getSalesOptions()->getScheduleDateStart());
141
+
142
+ }
143
+
144
+ /**
145
+ * Get ending date sales
146
+ *
147
+ * @return mixed
148
+ */
149
+ public function getEndingDate()
150
+ {
151
+ $date = date_add(
152
+ new DateTime($this->getSalesOptions()->getScheduleDateStart()),
153
+ DateInterval::createFromDateString($this->getSalesOptions()->getSchedulePeriodDays() . ' day')
154
+ )->format(Varien_Date::DATETIME_PHP_FORMAT);
155
+
156
+ return $this->_getLocalizedDate($date);
157
+ }
158
+
159
+ /**
160
+ * @param string $date
161
+ * @return string
162
+ */
163
+ protected function _getLocalizedDate($date)
164
+ {
165
+ $date = new Zend_Date($date, Varien_Date::DATETIME_INTERNAL_FORMAT, Mage::app()->getLocale()->getLocale());
166
+ return $date->toString();
167
+ }
168
+
169
+ /**
170
+ * Get Shipping Availability
171
+ *
172
+ * @return mixed
173
+ */
174
+ public function getShippingAvailability()
175
+ {
176
+ $availabilities = Mage::getSingleton('diglin_ricento/config_source_rules_shipping_availability')->toOptionHash();
177
+
178
+ foreach ($availabilities as $availabilityId => $availabilityText) {
179
+ if ($availabilityId === (int) $this->getShippingPaymentRule()->getShippingAvailability()) {
180
+ return $availabilityText;
181
+ }
182
+ }
183
+ return '';
184
+ }
185
+
186
+ /**
187
+ * Get Product Condition
188
+ *
189
+ * @return mixed
190
+ */
191
+ public function getProductCondition()
192
+ {
193
+ $conditions = Mage::getSingleton('diglin_ricento/config_source_sales_product_condition')->toOptionHash();
194
+
195
+ foreach ($conditions as $conditionId => $conditionText) {
196
+ if ($conditionId === (int) $this->getSalesOptions()->getProductCondition()) {
197
+ return $conditionText;
198
+ }
199
+ }
200
+ return '';
201
+ }
202
+
203
+ /**
204
+ * Get payment methods of a product
205
+ *
206
+ * @return array
207
+ */
208
+ public function getPaymentMethods()
209
+ {
210
+ $result = array();
211
+ $paymentMethods = Mage::getSingleton('diglin_ricento/config_source_rules_payment')->toOptionHash();
212
+ $currentPaymentMethods = $this->getShippingPaymentRule()->getPaymentMethods();
213
+
214
+ $this->setOtherPaymentMethod(false);
215
+ foreach ($paymentMethods as $methodId => $methodText) {
216
+ if (in_array($methodId, $currentPaymentMethods)) {
217
+ $result[$methodId] = $methodText;
218
+ if ($methodId === 0) {
219
+ $this->setOtherPaymentMethod(true);
220
+ $this->setOtherPaymentMethodText($this->escapeHtml($this->getShippingPaymentRule()->getPaymentDescription()));
221
+ }
222
+ }
223
+ }
224
+ return $result;
225
+ }
226
+
227
+ /**
228
+ * Get Shipping Method Text of a product
229
+ *
230
+ * @return string
231
+ */
232
+ public function getShippingMethod()
233
+ {
234
+ $shippingMethods = Mage::getSingleton('diglin_ricento/config_source_rules_shipping')->toOptionHash();
235
+
236
+ $currentShippingMethod = (array) $this->getShippingPaymentRule()->getShippingMethod();
237
+
238
+ foreach ($shippingMethods as $methodId => $methodText) {
239
+ if (in_array($methodId, $currentShippingMethod)) {
240
+ if (!$methodId) {
241
+ $this->setOtherShippingMethodText($this->escapeHtml($this->getShippingPaymentRule()->getShippingDescription()));
242
+ }
243
+ return $this->escapeHtml($methodText);
244
+ }
245
+ }
246
+ return '';
247
+ }
248
+
249
+ /**
250
+ * Get the Shipping price in the allowed currency
251
+ *
252
+ * @return string
253
+ */
254
+ public function getShippingPrice()
255
+ {
256
+ return $this->_getPrice($this->getShippingPaymentRule()->getShippingPrice());
257
+ }
258
+
259
+ /**
260
+ * Get the price allowed from ricardo.ch
261
+ *
262
+ * @param float|int $price
263
+ * @return string
264
+ */
265
+ protected function _getPrice($price)
266
+ {
267
+ return Mage::helper('diglin_ricento/price')->formatPrice($price, $this->getListing()->getWebsiteId());
268
+ }
269
+
270
+ /**
271
+ * Get warranty description
272
+ *
273
+ * @return string
274
+ */
275
+ public function getWarranty()
276
+ {
277
+ $warrantyText = '';
278
+
279
+ $warranties = Mage::getSingleton('diglin_ricento/config_source_sales_warranty')->toOptionHash();
280
+ $currentWarranty = (int) $this->getSalesOptions()->getProductWarranty();
281
+
282
+ foreach ($warranties as $warranty => $warrantyText) {
283
+ if ($currentWarranty == $warranty) {
284
+ if ($warranty == \Diglin\Ricardo\Enums\Article\Warranty::FOLLOW_CONDITION) {
285
+ $warrantyText = $this->getSalesOptions()->getProductWarrantyDescription();
286
+ }
287
+ break;
288
+ }
289
+ }
290
+
291
+ return $this->escapeHtml($warrantyText);
292
+ }
293
+
294
+ /**
295
+ * Get Direct Price of the product
296
+ *
297
+ * @return float|mixed|string
298
+ */
299
+ public function getProductPrice()
300
+ {
301
+ return $this->_getPrice($this->getProductItem()->getProductPrice());
302
+ }
303
+
304
+ /**
305
+ * @return string
306
+ */
307
+ public function getSalesAuctionStartPrice()
308
+ {
309
+ return $this->_getPrice($this->getSalesOptions()->getSalesAuctionStartPrice());
310
+ }
311
+
312
+ /**
313
+ * Retrieve list of gallery images
314
+ *
315
+ * @return array|Varien_Data_Collection
316
+ */
317
+ public function getGalleryImages()
318
+ {
319
+ return $this->getProduct()->getMediaGalleryImages();
320
+ }
321
+
322
+ /**
323
+ * Retrieve gallery url
324
+ *
325
+ * @param null|Varien_Object $image
326
+ * @return string
327
+ */
328
+ public function getGalleryUrl($image = null)
329
+ {
330
+ $params = array('id' => $this->getProduct()->getId());
331
+ if ($image) {
332
+ $params['image'] = $image->getValueId();
333
+ }
334
+ return $this->getUrl('catalog/product/gallery', $params);
335
+ }
336
+
337
+ /**
338
+ * @return string
339
+ */
340
+ public function getProductImage()
341
+ {
342
+ try {
343
+ return '<img src="' . Mage::helper('catalog/image')->init($this->getProduct(), 'image')->resize(265). '" />';
344
+ } catch (Exception $e) {
345
+ Mage::logException($e);
346
+ Mage::getSingleton('adminhtml/session')->addError($e->__toString());
347
+ }
348
+
349
+ return '';
350
+ }
351
+
352
+ public function getProductImageThumbnail($_image)
353
+ {
354
+ try {
355
+ return '<img src="' . $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56) . '" width="56" height="56" alt="' . $this->escapeHtml($_image->getLabel()) . '" />';
356
+ } catch (Exception $e) {
357
+ Mage::logException($e);
358
+ Mage::getSingleton('adminhtml/session')->addError($e->__toString());
359
+ }
360
+
361
+ return '';
362
+ }
363
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Log.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+ public function __construct()
14
+ {
15
+ $this->_controller = 'adminhtml_products_listing_log';
16
+ $this->_blockGroup = 'diglin_ricento';
17
+ $this->_headerText = $this->__('Products Listing Log "%s"', $this->getProductsListing()->getTitle());
18
+
19
+ parent::__construct();
20
+
21
+ $this->removeButton('add');
22
+
23
+ $this->addButton('show_listing', array(
24
+ 'label' => $this->__('Edit "%s"', $this->getProductsListing()->getTitle()),
25
+ 'onclick' => 'setLocation(\'' . $this->getEditUrl() .'\')',
26
+ ));
27
+ }
28
+
29
+ /**
30
+ * @return string
31
+ */
32
+ public function getEditUrl()
33
+ {
34
+ return $this->getUrl('*/products_listing/edit', array('id' => $this->getProductsListing()->getId()));
35
+ }
36
+
37
+ /**
38
+ * @return Diglin_Ricento_Model_Products_Listing
39
+ */
40
+ public function getProductsListing()
41
+ {
42
+ return Mage::registry('products_listing');
43
+ }
44
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/Log/Grid.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('itemLogGrid');
17
+ $this->setDefaultSort('created_at');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ }
21
+
22
+ /**
23
+ * Prepare the collection to be displayed as a grid
24
+ *
25
+ * @return Varien_Data_Collection
26
+ */
27
+ protected function _prepareCollection()
28
+ {
29
+ $collection = Mage::getResourceModel('diglin_ricento/products_listing_log_collection');
30
+ $collection
31
+ ->getSelect()
32
+ ->join(array('pl' => $collection->getTable('diglin_ricento/products_listing')),
33
+ 'pl.entity_id = main_table.products_listing_id', 'title');
34
+
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
37
+ }
38
+
39
+ /**
40
+ * Prepare the columns to generate the column
41
+ *
42
+ * @return Diglin_Ricento_Block_Adminhtml_Products_Listing_Grid
43
+ */
44
+ protected function _prepareColumns()
45
+ {
46
+ $this->addColumn('job_id', array(
47
+ 'header' => $this->__('Job ID') ,
48
+ 'align' => 'left',
49
+ 'index' => 'job_id',
50
+ 'type' => 'number',
51
+ 'width' => 50,
52
+ ));
53
+
54
+ if ($this->getNameInLayout() == 'ricento_listing_log') {
55
+ $this->addColumn('products_listing_id', array(
56
+ 'header' => $this->__('Listing ID') ,
57
+ 'align' => 'left',
58
+ 'index' => 'products_listing_id',
59
+ 'type' => 'number',
60
+ 'width' => 50,
61
+ ));
62
+
63
+ $this->addColumn('title', array(
64
+ 'header' => $this->__('Listing Title'),
65
+ 'align' => 'left',
66
+ 'index' => 'title',
67
+ 'type' => 'text',
68
+ 'width' => 150,
69
+ 'frame_callback' => array($this, 'addListingUrl')
70
+ ));
71
+ }
72
+
73
+ $this->addColumn('product_id', array(
74
+ 'header' => $this->__('Product ID') ,
75
+ 'align' => 'left',
76
+ 'index' => 'product_id',
77
+ 'type' => 'number',
78
+ 'width' => 50,
79
+ ));
80
+
81
+ $this->addColumn('product_title', array(
82
+ 'header' => $this->__('Product title') ,
83
+ 'align' => 'left',
84
+ 'index' => 'product_title',
85
+ 'frame_callback' => array($this, 'addConfigureUrl')
86
+ ));
87
+
88
+ $this->addColumn('message', array(
89
+ 'header' => $this->__('Message') ,
90
+ 'align' => 'left',
91
+ 'index' => 'message',
92
+ 'type' => 'text',
93
+ 'string_limit' => 10000, // very long
94
+ 'frame_callback' => array($this, 'prepareMessage')
95
+ ));
96
+
97
+ $this->addColumn('log_status', array(
98
+ 'header' => $this->__('Status') ,
99
+ 'align' => 'left',
100
+ 'index' => 'log_status',
101
+ 'type' => 'options',
102
+ 'width' => 100,
103
+ 'options' => Mage::getSingleton('diglin_ricento/config_source_products_listing_status')->toOptionHash(),
104
+ 'frame_callback' => array($this, 'cellContainer')
105
+ ));
106
+
107
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
108
+ Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
109
+ );
110
+ $this->addColumn('created_at', array(
111
+ 'header' => $this->__('Created at') ,
112
+ 'align' => 'left',
113
+ 'index' => 'created_at',
114
+ 'type' => 'date',
115
+ 'width' => 200,
116
+ 'gmtoffset' => true,
117
+ 'format' => $dateFormatIso
118
+ ));
119
+ }
120
+
121
+ /**
122
+ * Prepare the mass action drop down menu
123
+ *
124
+ * @return Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid
125
+ */
126
+ protected function _prepareMassaction()
127
+ {
128
+ $this->setMassactionIdField('log_id');
129
+ $this->getMassactionBlock()->setFormFieldName('listing_logs_grid');
130
+
131
+ $this->getMassactionBlock()->addItem('delete', array(
132
+ 'label'=> $this->__('Delete'),
133
+ 'url' => $this->getUrl('*/*/massListingDelete', array('_current'=>true)),
134
+ 'confirm' => $this->__('Are you sure that you want to delete this/these log(s)?')
135
+ ));
136
+
137
+ return $this;
138
+ }
139
+
140
+ /**
141
+ * @param $value
142
+ * @param Varien_Object $row
143
+ * @return string
144
+ */
145
+ public function addConfigureUrl($value, Varien_Object $row)
146
+ {
147
+ $url = $this->getUrl('*/products_listing_item/configure', array('id' => $row->getProductsListingId(), 'product' => $row->getProductId()));
148
+ return '<a href="' . $url . '">' . $value . '</a>';
149
+ }
150
+
151
+ /**
152
+ * @param $value
153
+ * @param Varien_Object $row
154
+ * @param $column
155
+ * @return string
156
+ */
157
+ public function addListingUrl($value, Varien_Object $row, $column)
158
+ {
159
+ $url = $this->getUrl('*/products_listing/edit', array('id' => $row->getProductsListingId()));
160
+ return '<a href="' . $url . '">' . $value . '</a>';
161
+ }
162
+
163
+ /**
164
+ * @param $value
165
+ * @param Varien_Object $row
166
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
167
+ * @return string
168
+ */
169
+ public function cellContainer($value, Varien_Object $row, Mage_Adminhtml_Block_Widget_Grid_Column $column)
170
+ {
171
+ $class = '';
172
+ if ($column->getIndex() == 'log_status' && !empty($value)) {
173
+ $class = 'class="' . strtolower($column->getIndex()) . '-' . strtolower($row->getLogStatus()) . '"';
174
+ }
175
+
176
+ return '<div id="' . strtolower($column->getIndex()) . $row->getId() . '" ' . $class . '>' . $value . '</div>';
177
+ }
178
+
179
+ /**
180
+ * @param $value
181
+ * @param Varien_Object $row
182
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
183
+ * @return string
184
+ */
185
+ public function prepareMessage($value, Varien_Object $row, Mage_Adminhtml_Block_Widget_Grid_Column $column)
186
+ {
187
+ $output = '';
188
+ $value = htmlspecialchars_decode($value);
189
+ if ($column->getIndex() == 'message' && !empty($value)) {
190
+ $messages = Mage::helper('core')->jsonDecode($value);
191
+ isset($messages['errors']) && count($messages['errors']) > 0 && $output .= '<div id="message-errors"' . $row->getId() . ' class="message_errors">' . implode('<br>', (array) $messages['errors']) . '</div>';
192
+ isset($messages['warnings']) && count($messages['warnings']) > 0 && $output .= '<div id="message-warnings"' . $row->getId() . ' class="message_warnings">' . implode('<br>', (array) $messages['warnings']) . '</div>';
193
+ isset($messages['notice']) && count($messages['notice']) > 0 && $output .= '<div id="message-notice"' . $row->getId() . ' class="message_notice">' . implode('<br>', (array) $messages['notice']) . '</div>';
194
+ isset($messages['success']) && count($messages['success']) > 0 && $output .= '<div id="message-success"' . $row->getId() . ' class="message_success">' . implode('<br>', (array) $messages['success']) . '</div>';
195
+ }
196
+ return $output;
197
+ }
198
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/New.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_New
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_New extends Mage_Core_Block_Abstract
16
+ {
17
+ /**
18
+ * @return Mage_Core_Block_Abstract|void
19
+ */
20
+ protected function _beforeToHtml()
21
+ {
22
+ $this->setChild('form', $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_new_form'));
23
+ }
24
+ /**
25
+ * @return string
26
+ */
27
+ protected function _toHtml()
28
+ {
29
+ $formAsString = $this->htmlToJsString($this->getChildHtml('form'));
30
+ return
31
+ <<<HTML
32
+ <script type='text/javascript'>
33
+ //<![CDATA[
34
+ Ricento.htmlNewListingForm = '{$formAsString}';
35
+ //]]>
36
+ </script>
37
+ HTML;
38
+ }
39
+ /**
40
+ * Converts HTML to a single line string, escaped for JavaScript
41
+ *
42
+ * @param string $html
43
+ * @return string
44
+ */
45
+ protected function htmlToJsString($html)
46
+ {
47
+ return (string) preg_replace('/\s+/', ' ', $this->jsQuoteEscape($html));
48
+ }
49
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Products/Listing/New/Form.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Products_Listing_New_Form
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Products_Listing_New_Form extends Mage_Adminhtml_Block_Widget_Form
16
+ {
17
+ protected function _prepareForm()
18
+ {
19
+ $actionUrl = $this->getUrl('*/*/create');
20
+ $form = new Varien_Data_Form(
21
+ array('id' => 'diglin_ricento_create_listing_form', 'action' => $actionUrl, 'method' => 'post')
22
+ );
23
+ $htmlIdPrefix = 'diglin_ricento_';
24
+ $form->setHtmlIdPrefix($htmlIdPrefix);
25
+
26
+ $fieldset = $form->addFieldset('create_listing_fieldset', array());
27
+
28
+ $fieldset->addField('listing_title', 'text', array(
29
+ 'name' => 'listing_title',
30
+ 'required' => true,
31
+ 'label' => $this->__('Give a name'),
32
+ 'title' => $this->__('Give a name'),
33
+ ));
34
+
35
+ $fieldset->addField('website_id', 'select', array(
36
+ 'name' => 'website_id',
37
+ 'required' => true,
38
+ 'label' => $this->__('Select a website'),
39
+ 'title' => $this->__('Select a website'),
40
+ 'note' => $this->__('The website(s) must be configured and enabled for this extension. If this field is empty or some are missing please <a href="%s">configure</a> the extension.', Mage::helper('diglin_ricento')->getConfigurationUrl()),
41
+ 'values' => Mage::getSingleton('diglin_ricento/config_source_website')->getWebsiteValuesForForm(true, false),
42
+ ));
43
+
44
+ $cancelButton = $this->getButtonHtml(
45
+ $this->__('Cancel'),
46
+ 'Ricento.closePopup()',
47
+ 'cancel'
48
+ );
49
+ $submitButton = $this->getButtonHtml(
50
+ $this->__('Create new listing'),
51
+ 'Ricento.newListingForm.submit()',
52
+ 'add'
53
+ );
54
+ $fieldset->addField('buttons', 'note', array(
55
+ 'container_id' => $htmlIdPrefix . 'buttons_container',
56
+ 'text' => "{$cancelButton} {$submitButton}"
57
+ ));
58
+
59
+ $form->setUseContainer(true);
60
+ $this->setForm($form);
61
+
62
+ return parent::_prepareForm();
63
+ }
64
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('SyncJobGrid');
17
+ $this->setDefaultSort('created_at');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ /* @var $collection Diglin_Ricento_Model_Resource_Sync_Job_Collection */
25
+ $collection = Mage::getResourceModel('diglin_ricento/sync_job_collection');
26
+ $collection
27
+ ->join(array('sjl' => 'diglin_ricento/sync_job_listing'), 'sjl.job_id = main_table.job_id', 'products_listing_id')
28
+ ->join(array('pl' => 'diglin_ricento/products_listing'), 'pl.entity_id = sjl.products_listing_id', 'title');
29
+
30
+ $this->setCollection($collection);
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ protected function _prepareColumns()
35
+ {
36
+ $this->addColumn('job_id', array(
37
+ 'header' => $this->__('ID') ,
38
+ 'align' => 'left',
39
+ 'index' => 'job_id',
40
+ 'type' => 'number',
41
+ 'filter' => false,
42
+ 'width' => 50
43
+ ));
44
+
45
+ $this->addColumn('job_type', array(
46
+ 'header' => $this->__('Job Type') ,
47
+ 'align' => 'left',
48
+ 'index' => 'job_type',
49
+ 'type' => 'options',
50
+ 'width' => 150,
51
+ 'options' => Mage::getSingleton('diglin_ricento/config_source_sync_type')->toOptionHash()
52
+ ));
53
+
54
+ $this->addColumn('title', array(
55
+ 'header' => $this->__('List name') ,
56
+ 'align' => 'left',
57
+ 'index' => 'title',
58
+ 'type' => 'text',
59
+ 'width' => 150,
60
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_sync_log_grid_renderer_title')
61
+ ));
62
+
63
+ $this->addColumn('job_message', array(
64
+ 'header' => $this->__('Job Message') ,
65
+ 'align' => 'left',
66
+ 'index' => 'job_message',
67
+ 'type' => 'text',
68
+ 'string_limit' => 10000, // very long
69
+ 'frame_callback' => array($this, 'cellContainer')
70
+ ));
71
+
72
+ $this->addColumn('current_progress', array(
73
+ 'header' => $this->__('Current Progress') ,
74
+ 'index' => 'current_progress',
75
+ 'sortable' => false,
76
+ 'filter' => false,
77
+ 'width' => 150,
78
+ 'renderer' => Mage::getConfig()->getBlockClassName('diglin_ricento/adminhtml_sync_log_grid_renderer_progress')
79
+ ));
80
+
81
+ $this->addColumn('job_status', array(
82
+ 'header' => $this->__('Status') ,
83
+ 'align' => 'left',
84
+ 'index' => 'job_status',
85
+ 'type' => 'options',
86
+ 'width' => 100,
87
+ 'frame_callback' => array($this, 'cellContainer'),
88
+ 'options' => Mage::getSingleton('diglin_ricento/config_source_sync_status')->toOptionHash()
89
+ ));
90
+
91
+ $dateFormatIso = Mage::helper('diglin_ricento')->getDateTimeIsoFormat();
92
+
93
+ $this->addColumn('started_at', array(
94
+ 'header' => $this->__('Started at') ,
95
+ 'align' => 'left',
96
+ 'index' => 'started_at',
97
+ 'type' => 'date',
98
+ 'width' => 150,
99
+ 'format' => $dateFormatIso,
100
+ 'gmtoffset' => true,
101
+ 'frame_callback' => array($this, 'cellContainer'),
102
+ ));
103
+
104
+ $this->addColumn('ended_at', array(
105
+ 'header' => $this->__('Ended at') ,
106
+ 'align' => 'left',
107
+ 'index' => 'ended_at',
108
+ 'type' => 'date',
109
+ 'width' => 150,
110
+ 'frame_callback' => array($this, 'cellContainer'),
111
+ 'format' => $dateFormatIso,
112
+ 'gmtoffset' => true
113
+ ));
114
+
115
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
116
+ Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
117
+ );
118
+
119
+ $this->addColumn('created_at', array(
120
+ 'header' => $this->__('Created at') ,
121
+ 'align' => 'right',
122
+ 'index' => 'created_at',
123
+ 'type' => 'date',
124
+ 'width' => 150,
125
+ 'format' => $dateFormatIso,
126
+ 'gmtoffset' => true
127
+ ));
128
+
129
+ return parent::_prepareColumns();
130
+ }
131
+
132
+ /**
133
+ * Prepare the mass action drop down menu
134
+ *
135
+ * @return Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid
136
+ */
137
+ protected function _prepareMassaction()
138
+ {
139
+ $this->setMassactionIdField('job_id');
140
+ $this->getMassactionBlock()->setFormFieldName('jobs_grid');
141
+
142
+ $this->getMassactionBlock()->addItem('delete', array(
143
+ 'label'=> $this->__('Delete'),
144
+ 'url' => $this->getUrl('*/*/massSyncDelete', array('_current'=>true)),
145
+ 'confirm' => $this->__('Are you sure that you want to delete this/these job(s)?')
146
+ ));
147
+
148
+ return $this;
149
+ }
150
+
151
+ /**
152
+ * @param $value
153
+ * @param Varien_Object $row
154
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
155
+ * @return string
156
+ */
157
+ public function cellContainer($value, Varien_Object $row, Mage_Adminhtml_Block_Widget_Grid_Column $column)
158
+ {
159
+ $class = '';
160
+ $status = $row->getJobStatus();
161
+ if ($column->getIndex() == 'job_status' && !empty($status)) {
162
+ $class = 'class="' . strtolower($column->getIndex()) . '-' . strtolower($row->getJobStatus()) . '"';
163
+ }
164
+
165
+ if ($column->getIndex() == 'job_message') {
166
+ $value = Mage::helper('core')->jsonDecode($value);
167
+ $value = (is_array($value)) ? implode('<br>', $value) : $value;
168
+ $value = Mage::getSingleton('diglin_ricento/filter')->filter($value);
169
+ }
170
+
171
+ return '<div id="' . strtolower($column->getIndex()) . $row->getId() . '" ' . $class . '>' . $value . '</div>';
172
+ }
173
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid/Renderer/Progress.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid_Renderer_Progress extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
12
+ {
13
+ /**
14
+ * @param Varien_Object $row
15
+ * @return string
16
+ */
17
+ public function render(Varien_Object $row)
18
+ {
19
+ /* @var $jobProgress Diglin_Ricento_Model_Sync_Job */
20
+ $jobProgress = Mage::getModel('diglin_ricento/sync_job')->load($row->getId());
21
+
22
+ $block = Mage::getBlockSingleton('adminhtml/template');
23
+ $block
24
+ ->setRunProgress(false)
25
+ ->setTemplate('ricento/js/sync/progress.phtml')
26
+ ->setProgressPopupUrl($this->getUrl('ricento/sync/jobMessagePopup', array('jobid' => $row->getId())))
27
+ ->setProgressAjaxUrl($this->getUrl('ricento/sync/progressAjax', array('jobid' => $row->getId())))
28
+ ->setPrefix($row->getId());
29
+
30
+ if ($row->getId()) {
31
+ switch($jobProgress->getProgress()) {
32
+ case Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED:
33
+ break;
34
+ case Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING:
35
+ $block->setJobWillStart(true);
36
+ // keep no break
37
+ default:
38
+ $block->setRunProgress(true);
39
+ break;
40
+ }
41
+ }
42
+
43
+ if ($jobProgress->getJobType() == Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST
44
+ && $jobProgress->getProgress() == Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING) {
45
+ // Run the check list without using Cron
46
+ $html = '<script>new Ajax.Request(\''. $this->getUrl('ricento/products_listing/checkAjax') .'\');</script>';
47
+ $block->setAdditionalHtml($html);
48
+ }
49
+
50
+ return $block->toHtml();
51
+ }
52
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Sync/Log/Grid/Renderer/Title.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid_Renderer_Title extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
12
+ {
13
+ /**
14
+ * @param Varien_Object $row
15
+ * @return string
16
+ */
17
+ public function render(Varien_Object $row)
18
+ {
19
+ return '<a target="_blank" href="' . $this->getUrl('ricento/products_listing/edit', array('id' => $row->getProductsListingId())) .'">' . $row->getTitle() . '</a>';
20
+ }
21
+ }
app/code/community/Diglin/Ricento/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Block_Adminhtml_Widget_Grid_Column_Renderer_Button
14
+ */
15
+ class Diglin_Ricento_Block_Adminhtml_Widget_Grid_Column_Renderer_Button extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
16
+ {
17
+ protected function _toLinkHtml($action, Varien_Object $row)
18
+ {
19
+ $actionAttributes = new Varien_Object();
20
+
21
+ $actionCaption = '';
22
+ $this->_transformActionData($action, $actionCaption, $row);
23
+
24
+ $action['onclick'] = "window.location='{$action['href']}'";
25
+ unset($action['href']);
26
+
27
+ if(isset($action['confirm'])) {
28
+ $action['onclick'] = 'window.confirm(\''
29
+ . addslashes($this->escapeHtml($action['confirm']))
30
+ . '\') && (' . $action['onclick'] . ')';
31
+ unset($action['confirm']);
32
+ }
33
+
34
+ $actionAttributes->setData($action);
35
+ return '<button ' . $actionAttributes->serialize() . '><span>' . $actionCaption . '</span></button>';
36
+ }
37
+ }
app/code/community/Diglin/Ricento/Block/Payment/Info.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Diglin_Ricento_Block_Payment_Info extends Mage_Payment_Block_Info
13
+ {
14
+ protected function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->setTemplate('ricento/payment/info/default.phtml');
18
+ }
19
+
20
+ /**
21
+ * Render as PDF
22
+ * @return string
23
+ */
24
+ public function toPdf()
25
+ {
26
+ $this->setTemplate('ricento/payment/info/pdf/default.phtml');
27
+ return $this->toHtml();
28
+ }
29
+ }
app/code/community/Diglin/Ricento/Controller/Adminhtml/Action.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ abstract class Diglin_Ricento_Controller_Adminhtml_Action extends Mage_Adminhtml_Controller_Action
13
+ {
14
+ protected function _construct()
15
+ {
16
+ // Important to get appropriate translation from this module
17
+ $this->setUsedModuleName('Diglin_Ricento');
18
+ }
19
+
20
+ protected function _isAllowed()
21
+ {
22
+ return Mage::getSingleton('admin/session')->isAllowed('ricento/listing');
23
+ }
24
+
25
+ /**
26
+ * @return bool|Diglin_Ricento_Model_Products_Listing
27
+ */
28
+ protected function _initListing()
29
+ {
30
+ $registeredListing = $this->_getListing();
31
+ if ($registeredListing) {
32
+ return $registeredListing;
33
+ }
34
+ $id = (int)$this->getRequest()->getParam('id');
35
+ if (!$id) {
36
+ $this->_getSession()->addError('Products Listing not found.');
37
+ return false;
38
+ }
39
+
40
+ $productsListing = Mage::getModel('diglin_ricento/products_listing')->load($id);
41
+ Mage::register('products_listing', $productsListing);
42
+
43
+ return $this->_getListing();
44
+ }
45
+
46
+ /**
47
+ * @return Diglin_Ricento_Model_Products_Listing
48
+ */
49
+ protected function _getListing()
50
+ {
51
+ return Mage::registry('products_listing');
52
+ }
53
+
54
+ protected function isApiReady()
55
+ {
56
+ $helper = Mage::helper('diglin_ricento');
57
+ $helperApi = Mage::helper('diglin_ricento/api');
58
+ $websiteId = $this->_initListing()->getWebsiteId();
59
+
60
+ return $helper->isEnabled($websiteId) && $helper->isConfigured($websiteId) && !$helperApi->isApiTokenCredentialGoingToExpire($websiteId);
61
+ }
62
+
63
+ /**
64
+ * @return boolean
65
+ */
66
+ protected function _savingAllowed()
67
+ {
68
+ return true;
69
+ }
70
+ }
app/code/community/Diglin/Ricento/Controller/Adminhtml/Products/Listing.php ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Controller_Adminhtml_Products_Listing
14
+ *
15
+ * Abstract controller for controllers that save listing configuration
16
+ */
17
+ abstract class Diglin_Ricento_Controller_Adminhtml_Products_Listing extends Diglin_Ricento_Controller_Adminhtml_Action
18
+ {
19
+ /**
20
+ * @var Varien_Data_Collection
21
+ */
22
+ protected $_salesOptionsCollection;
23
+
24
+ /**
25
+ * @var Varien_Data_Collection
26
+ */
27
+ protected $_shippingPaymentCollection;
28
+
29
+ /**
30
+ * Filtering posted data (sales options and rules form). Converting localized data if needed
31
+ *
32
+ * @param array
33
+ * @return array
34
+ */
35
+ protected function _filterPostData($data)
36
+ {
37
+ /* Product Listing part */
38
+
39
+ if (!isset($data['product_listing'])) {
40
+ $data['product_listing'] = array();
41
+ }
42
+
43
+ if (isset($data['product_listing']['publish_languages']) && $data['product_listing']['publish_languages'] != Diglin_Ricento_Helper_Data::LANG_ALL) {
44
+ $data['product_listing']['default_language'] = $data['product_listing']['publish_languages'];
45
+ foreach (Mage::helper('diglin_ricento')->getSupportedLang() as $lang) {
46
+ if ($data['product_listing']['publish_languages'] != $lang) {
47
+ $data['product_listing']['lang_store_id_' . $lang] = null;
48
+ }
49
+ }
50
+ }
51
+
52
+ /* Sales Option part */
53
+
54
+ if (!isset($data['sales_options'])) {
55
+ $data['sales_options'] = array();
56
+ }
57
+ $data['sales_options'] = $this->_filterDateTime($data['sales_options'], array('schedule_date_start', 'schedule_period_end_date'));
58
+ if (empty($data['sales_options']['entity_id'])) {
59
+ unset($data['sales_options']['entity_id']);
60
+ }
61
+ if (!empty($data['sales_options']['ricardo_category_use_mapping'])) {
62
+ $data['sales_options']['ricardo_category'] = -1;
63
+ }
64
+ if (!empty($data['sales_options']['schedule_cycle_multiple_products_random'])) {
65
+ $data['sales_options']['schedule_cycle_multiple_products'] = null;
66
+ }
67
+ if (!empty($data['sales_options']['stock_management_use_inventory'])) {
68
+ $data['sales_options']['stock_management'] = -1;
69
+ }
70
+ if (!empty($data['sales_options']['sales_auction_direct_buy'])
71
+ && $data['sales_options']['sales_type'] == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION) {
72
+ $data['sales_options']['stock_management'] = 1;
73
+ $this->_getSession()->addNotice($this->__('Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold'));
74
+ }
75
+ if (!empty($data['sales_options']['schedule_date_start_immediately'])) {
76
+ $data['sales_options']['schedule_date_start'] = null;
77
+ if ($data['sales_options']['sales_type'] == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION) {
78
+ $dateStart = new DateTime();
79
+ $derivedValues['schedule_date_start'] = $dateStart->format(Varien_Date::DATETIME_PHP_FORMAT);
80
+ }
81
+ }
82
+ if (!empty($data['sales_options']['schedule_period_use_end_date'])) {
83
+ try {
84
+ $interval = date_diff(
85
+ new DateTime($data['sales_options']['schedule_date_start']),
86
+ new DateTime($data['sales_options']['schedule_period_end_date']));
87
+ $data['sales_options']['schedule_period_days'] = ($interval->invert ? -1 : 1) * $interval->days;
88
+ } catch (Exception $e) {
89
+ // Invalid date => period of 0 will fail the validation
90
+ $data['sales_options']['schedule_period_days'] = 0;
91
+ }
92
+ }
93
+
94
+ if (empty($data['sales_options']['product_condition_use_attribute'])) {
95
+ $data['sales_options']['product_condition_source_attribute_code'] = null;
96
+ } else {
97
+ $data['sales_options']['product_condition_source_attribute_code'] = 'ricardo_condition';
98
+ }
99
+
100
+ if (isset($data['sales_options']['product_warranty'])) {
101
+ if ($data['sales_options']['product_warranty'] == \Diglin\Ricardo\Enums\Article\Warranty::NONE) {
102
+ unset($data['sales_options']['product_warranty_description_de']);
103
+ unset($data['sales_options']['product_warranty_description_fr']);
104
+ } else {
105
+ if (isset($data['sales_options']['product_warranty_description_de'])) {
106
+ $data['sales_options']['product_warranty_description_de'] = mb_substr(Mage::helper('core')->escapeHtml($data['sales_options']['product_warranty_description_de']), 0, 5000);
107
+ }
108
+ if (isset($data['sales_options']['product_warranty_description_fr'])) {
109
+ $data['sales_options']['product_warranty_description_fr'] = mb_substr(Mage::helper('core')->escapeHtml($data['sales_options']['product_warranty_description_fr']), 0, 5000);
110
+ }
111
+ }
112
+ }
113
+ if (!isset($data['sales_options']['promotion_start_page']) || empty($data['sales_options']['promotion_start_page'])) {
114
+ $data['sales_options']['promotion_start_page'] = 0;
115
+ }
116
+
117
+ /* Rules part */
118
+
119
+ if (!isset($data['rules'])) {
120
+ $data['rules'] = array();
121
+ }
122
+ if (empty($data['rules']['rule_id'])) {
123
+ unset($data['rules']['rule_id']);
124
+ }
125
+
126
+ if (isset($data['rules']['payment_methods'])) {
127
+ $initDescription = true;
128
+ foreach ($data['rules']['payment_methods'] as $method) {
129
+ if ((int) $method === 0) {
130
+ $initDescription = false;
131
+ }
132
+ }
133
+ if ($initDescription) {
134
+ $data['rules']['payment_description_de'] = null;
135
+ $data['rules']['payment_description_fr'] = null;
136
+ }
137
+ }
138
+
139
+ if (!empty($data['rules']['payment_description_de'])) {
140
+ $data['rules']['payment_description_de'] = mb_substr(Mage::helper('core')->escapeHtml($data['rules']['payment_description_de']), 0, 5000);
141
+ }
142
+ if (!empty($data['rules']['payment_description_fr'])) {
143
+ $data['rules']['payment_description_fr'] = mb_substr(Mage::helper('core')->escapeHtml($data['rules']['payment_description_fr']), 0, 5000);
144
+ }
145
+ if (isset($data['rules']['shipping_method']) && (int) $data['rules']['shipping_method'] !== 0) {
146
+ $data['rules']['shipping_description_de'] = null;
147
+ $data['rules']['shipping_description_fr'] = null;
148
+ }
149
+ if (!empty($data['rules']['shipping_description_de'])) {
150
+ $data['rules']['shipping_description_de'] = mb_substr(Mage::helper('core')->escapeHtml($data['rules']['shipping_description_de']), 0, 5000);
151
+ }
152
+ if (!empty($data['rules']['shipping_description_fr'])) {
153
+ $data['rules']['shipping_description_fr'] = mb_substr(Mage::helper('core')->escapeHtml($data['rules']['shipping_description_fr']), 0, 5000);
154
+ }
155
+
156
+ return $data;
157
+ }
158
+
159
+ /**
160
+ * Validate post data
161
+ *
162
+ * @param array $data
163
+ * @return bool Return FALSE if some item is invalid
164
+ */
165
+ protected function _validatePostData($data)
166
+ {
167
+ $errors = array();
168
+
169
+ if (empty($data['rules']['use_products_list_settings'])) {
170
+ /* @var $rulesValidator Diglin_Ricento_Model_Validate_Rules_Methods */
171
+ $rulesValidator = Mage::getModel('diglin_ricento/validate_rules_methods');
172
+ $methods = array(
173
+ 'payment' => array_filter((array)$data['rules']['payment_methods'], 'strlen'),
174
+ 'shipping' => $data['rules']['shipping_method']
175
+ );
176
+ if (!$rulesValidator->isValid($methods)) {
177
+ foreach ($rulesValidator->getMessages() as $message) {
178
+ $errors[] = $message;
179
+ }
180
+ }
181
+ }
182
+
183
+ if (empty($data['sales_options']['use_products_list_settings'])) {
184
+ if (!empty($data['sales_options']['schedule_date_start'])) {
185
+ $startDateInfo = date_parse_from_format(Varien_Date::DATETIME_PHP_FORMAT, $data['sales_options']['schedule_date_start']);
186
+ if ($startDateInfo['error_count']) {
187
+ $errors[] = $this->__('Invalid start date.') . '<br>' . join ('<br>', $startDateInfo['errors']);
188
+
189
+ }
190
+ }
191
+ if ($data['sales_options']['schedule_period_days'] <= 0) {
192
+ $errors[] = $this->__('The end date must be in the future.');
193
+ }
194
+ }
195
+
196
+ if (isset($data['sales_options']['schedule_reactivation'])
197
+ && $data['sales_options']['sales_type'] != Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW
198
+ && $data['sales_options']['schedule_reactivation'] == Diglin_Ricento_Model_Config_Source_Sales_Reactivation::SOLDOUT) {
199
+ $errors[] = $this->__('You cannot reactivate a product until sold out when doing an auction sales type.');
200
+ }
201
+
202
+ if (count($errors)) {
203
+ $this->_getSession()->addError($this->__('Following error(s) appeared:') . '<br>' . join ('<br>', $errors));
204
+ return false;
205
+ }
206
+
207
+ return true;
208
+ }
209
+
210
+
211
+ /**
212
+ * Save rules and sales options for listing or for items
213
+ */
214
+ public function saveConfiguration($data)
215
+ {
216
+ $data = $this->_filterPostData($data);
217
+ if (!$this->_savingAllowed()) {
218
+ $this->_getSession()->addError($this->__('Listed listings cannot be modified. Stop the listing first to make changes.'));
219
+ $this->_redirect($this->_getEditUrl());
220
+ return false;
221
+ }
222
+
223
+ $this->_getSalesOptions()->setDataToAll($data['sales_options']);
224
+ $this->_getShippingPaymentRule()->setDataToAll($data['rules']);
225
+
226
+ if (!$this->_validatePostData($data)) {
227
+ $this->_saveFormDataInSession($data);
228
+ $this->_redirectUrl($this->_getEditUrl());
229
+ return false;
230
+ }
231
+
232
+ try {
233
+ if (isset($data['sales_options']['use_products_list_settings'])) {
234
+ $this->_getSalesOptions()->walk('delete');
235
+ } else {
236
+ $this->_getSalesOptions()->walk('save');
237
+ }
238
+
239
+ if (isset($data['rules']['use_products_list_settings'])) {
240
+ $this->_getShippingPaymentRule()->walk('delete');
241
+ } else {
242
+ $this->_getShippingPaymentRule()->walk('save');
243
+ }
244
+
245
+ $this->_saveFormDataInSession(null);
246
+ if ($this->getRequest()->getParam('back')) {
247
+ $this->_redirectUrl($this->_getEditUrl());
248
+ return false;
249
+ }
250
+ $this->_redirectUrl($this->_getIndexUrl());
251
+ return true;
252
+
253
+ } catch (Mage_Core_Exception $e) {
254
+ $this->_getSession()->addError($e->getMessage());
255
+ } catch (Exception $e) {
256
+ Mage::logException($e);
257
+ $this->_getSession()->addException($e, $this->__('An error occurred while saving the configuration.'));
258
+ }
259
+
260
+ $this->_saveFormDataInSession($data);
261
+ $this->_redirectUrl($this->_getEditUrl());
262
+ return false;
263
+ }
264
+
265
+ protected function _saveFormDataInSession($data)
266
+ {
267
+ if ($data === null) {
268
+ $data = array('rules' => null, 'sales_options' => null);
269
+ }
270
+ $this->_getSession()->setRulesFormData($data['rules']);
271
+ $this->_getSession()->setSalesOptionsFormData($data['sales_options']);
272
+ }
273
+
274
+ /**
275
+ * @return Varien_Data_Collection
276
+ */
277
+ abstract protected function _getSalesOptions();
278
+
279
+ /**
280
+ * @return Varien_Data_Collection
281
+ */
282
+ abstract protected function _getShippingPaymentRule();
283
+
284
+ /**
285
+ * @return string
286
+ */
287
+ abstract protected function _getEditUrl();
288
+
289
+ /**
290
+ * @return string
291
+ */
292
+ abstract protected function _getIndexUrl();
293
+ }
app/code/community/Diglin/Ricento/Exception.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Exception
14
+ */
15
+ class Diglin_Ricento_Exception extends Mage_Core_Exception
16
+ {
17
+ /**
18
+ * @var bool
19
+ */
20
+ protected $_needAuthorization = false;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_validationUrl = '';
26
+
27
+ /**
28
+ * @param boolean $needAuthorization
29
+ * @return $this
30
+ */
31
+ public function setNeedAuthorization($needAuthorization)
32
+ {
33
+ $this->_needAuthorization = $needAuthorization;
34
+ return $this;
35
+ }
36
+
37
+ /**
38
+ * @return boolean
39
+ */
40
+ public function getNeedAuthorization()
41
+ {
42
+ return $this->_needAuthorization;
43
+ }
44
+
45
+ /**
46
+ * @param string $validationUrl
47
+ * @return $this
48
+ */
49
+ public function setValidationUrl($validationUrl)
50
+ {
51
+ $this->_validationUrl = $validationUrl;
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * @return string
57
+ */
58
+ public function getValidationUrl()
59
+ {
60
+ return $this->_validationUrl;
61
+ }
62
+ }
app/code/community/Diglin/Ricento/Helper/Api.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Services\Security;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Helper_Api
16
+ */
17
+ class Diglin_Ricento_Helper_Api extends Mage_Core_Helper_Abstract
18
+ {
19
+ /**
20
+ * Cache type for ricardo API
21
+ */
22
+ const CACHE_TYPE = 'ricardo_api';
23
+
24
+ /**
25
+ * Cache tag for ricardo API
26
+ */
27
+ const CACHE_TAG = 'RICARDO_API';
28
+
29
+ /**
30
+ * Cache lifetime
31
+ */
32
+ const CACHE_LIFETIME = 86400;
33
+
34
+ /**
35
+ * Get if the token credential is going to expire or even not exist
36
+ *
37
+ * @param int|string|Mage_Core_Model_Website $website
38
+ * @return bool
39
+ */
40
+ public function isApiTokenCredentialGoingToExpire($website = 0)
41
+ {
42
+ $token = Mage::getModel('diglin_ricento/api_token')
43
+ ->loadByWebsiteAndTokenType(Security::TOKEN_TYPE_IDENTIFIED, Mage::app()->getWebsite($website)->getId());
44
+
45
+ $expirationDate = $token->getExpirationDate();
46
+ $dayDelay = Mage::helper('diglin_ricento')->getExpirationNotificationDelay();
47
+
48
+ if (empty($expirationDate) ||
49
+ isset($expirationDate) && time() >= (Mage::getSingleton('core/date')->timestamp($expirationDate) - ($dayDelay * 24 * 3600)))
50
+ {
51
+ return true;
52
+ }
53
+
54
+ return false;
55
+ }
56
+
57
+ /**
58
+ * Get if the token credential exists
59
+ *
60
+ * @param int|string|Mage_Core_Model_Website $website
61
+ * @return bool
62
+ */
63
+ public function isApiTokenCredentialExists($website = 0)
64
+ {
65
+ $token = Mage::getModel('diglin_ricento/api_token')
66
+ ->loadByWebsiteAndTokenType(Security::TOKEN_TYPE_IDENTIFIED, Mage::app()->getWebsite($website)->getId());
67
+ return ($token->getId()) ? true : false;
68
+ }
69
+
70
+ /**
71
+ * @param int $sessionDuration in minutes
72
+ * @param null $time
73
+ * @return int|null
74
+ */
75
+ public function calculateSessionExpirationDate($sessionDuration, $time = null)
76
+ {
77
+ $sessionDuration *= 60;
78
+
79
+ if (is_null($time)) {
80
+ return time() + $sessionDuration;
81
+ }
82
+
83
+ return $time + $sessionDuration;
84
+ }
85
+
86
+ /**
87
+ * Calculate the session start time
88
+ *
89
+ * @param int $sessionDuration in minutes
90
+ * @param null $time
91
+ * @return int|null
92
+ */
93
+ public function calculateSessionStart($sessionDuration, $time)
94
+ {
95
+ return strtotime($time) - ($sessionDuration * 60);
96
+ }
97
+
98
+ /**
99
+ * @param int $websiteId
100
+ * @return string
101
+ */
102
+ public function getValidationUrl($websiteId = 0)
103
+ {
104
+ return Mage::getSingleton('diglin_ricento/api_services_security')
105
+ //@fixme there is issue with getting credential token in multi shop so for real website support start to fix here - not planned at the moment
106
+ // ->setCurrentWebsite($websiteId)
107
+ ->getValidationUrl();
108
+ }
109
+ }
app/code/community/Diglin/Ricento/Helper/Dashboard/Turnover.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Diglin_Ricento_Helper_Dashboard_Turnover extends Mage_Adminhtml_Helper_Dashboard_Abstract
13
+ {
14
+ /**
15
+ * @var Diglin_Ricento_Model_Resource_Sales_Transaction_Collection
16
+ */
17
+ protected $_collection;
18
+
19
+ /**
20
+ * Load collection with aggregated data for report
21
+ */
22
+ protected function _initCollection()
23
+ {
24
+ $this->_collection = Mage::getResourceModel('diglin_ricento/sales_transaction_collection');
25
+ $this->_collection->prepareReport();
26
+ $this->_collection->load();
27
+ }
28
+ }
app/code/community/Diglin/Ricento/Helper/Data.php ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use Diglin\Ricardo\Enums\System\LanguageId;
13
+ use Diglin\Ricardo\Enums\PaymentMethods;
14
+
15
+ /**
16
+ * Class Diglin_Ricento_Helper_Data
17
+ */
18
+ class Diglin_Ricento_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+ /**
21
+ * API config
22
+ */
23
+ const CFG_ENABLED = 'ricento/api_config/enabled';
24
+ const CFG_ASSISTANT_URL = 'ricento/api_config/assistant_url';
25
+ const CFG_ASSISTANT_URL_DEV = 'ricento/api_config/assistant_url_dev';
26
+ const CFG_RICARDO_SIGNUP_API_URL = 'ricento/api_config/signup_url';
27
+ const CFG_DEV_MODE = 'ricento/api_config/dev_mode';
28
+ const CFG_DEBUG_MODE = 'ricento/api_config/debug';
29
+ const CFG_API_HOST = 'ricento/api_config/host';
30
+ const CFG_API_HOST_DEV = 'ricento/api_config/host_dev';
31
+ const CFG_SIMULATE_AUTH = 'ricento/api_config/simulate_authorization';
32
+ const CFG_RICARDO_USERNAME = 'ricento/api_config/ricardo_username';
33
+ const CFG_RICARDO_PASSWORD = 'ricento/api_config/ricardo_password';
34
+ const CFG_RICARDO_PARTNERKEY = 'ricento/api_config/partner_key_';
35
+ const CFG_RICARDO_PARTNERPASS = 'ricento/api_config/partner_pass_';
36
+ const CFG_EXPIRATION_NOTIFICATION_DELAY = 'ricento/api_config/expiration_notification_delay'; // in day
37
+ const CFG_EMAIL_NOTIFICATION = 'ricento/api_config/email_notification'; // in day
38
+
39
+ const CFG_SUPPORTED_LANG = 'ricento/api_config/lang';
40
+ const DEFAULT_SUPPORTED_LANG = 'de';
41
+ const LANG_ALL = 'all';
42
+
43
+ const ALLOWED_CURRENCY = 'CHF';
44
+
45
+ /**
46
+ * Global config
47
+ */
48
+ const CFG_SHIPPING_CALCULATION = 'ricento/global/shipping_calculation';
49
+ const CFG_ACCOUNT_CREATION_EMAIL = 'ricento/global/email_account_creation';
50
+ const CFG_ORDER_CREATION_EMAIL = 'ricento/global/email_order_creation';
51
+ const CFG_MERGE_ORDER = 'ricento/global/merge_order';
52
+ const CFG_DECREASE_INVENTORY = 'ricento/global/decrease_inventory';
53
+
54
+ /**
55
+ * Cleanup Job config
56
+ */
57
+ const CFG_CLEAN_JOBS_ENABLED = 'ricento/cleanup_jobs/enabled';
58
+ const CFG_CLEAN_JOBS_KEEP_DAYS = 'ricento/cleanup_jobs/keep_days';
59
+
60
+ /**
61
+ * Common statuses for products listing and products listing item
62
+ */
63
+ const STATUS_PENDING = 'pending';
64
+ const STATUS_LISTED = 'listed';
65
+ const STATUS_STOPPED = 'stopped';
66
+ const STATUS_READY = 'ready';
67
+ const STATUS_ERROR = 'error';
68
+ const STATUS_SOLD = 'sold';
69
+
70
+ const LOG_FILE = 'ricento.log';
71
+
72
+ const RICARDO_URL = 'http://www.ricardo.ch';
73
+ const RICARDO_URL_HELP_PROMOTION = 'http://www.ricardo.ch/ueber-uns/gebühren/einstelloptionen'; //@todo make it for french too
74
+
75
+ const NODE_DISPATCHER_TYPES = 'global/ricento/dispatcher/types';
76
+ const NODE_PRODUCT_TYPES = 'global/ricento/allow_product_types';
77
+
78
+ /**
79
+ * Payment Config
80
+ */
81
+ const PAYMENT_CURRENCY = 'payment/ricento/currency';
82
+ const PAYMENT_BANK_INFO = 'payment/ricento/bank_transfer_instructions';
83
+
84
+ /**
85
+ * Order Status
86
+ */
87
+ const ORDER_STATUS_PENDING = 'pending_ricento';
88
+ const ORDER_STATUS_CANCEL = 'canceled_ricento';
89
+
90
+ /**
91
+ * @var Mage_Directory_Model_Currency
92
+ */
93
+ protected $_oldCurrency;
94
+
95
+ /**
96
+ * Is the extension enabled for the current website
97
+ *
98
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
99
+ * @return bool
100
+ */
101
+ public function isEnabled($website = 0)
102
+ {
103
+ return (bool) Mage::getConfig()->getModuleConfig('Diglin_Ricento')->active
104
+ && self::getWebsiteConfigFlag(self::CFG_ENABLED, $website);
105
+ }
106
+
107
+ /**
108
+ * @param int $website
109
+ * @return bool
110
+ */
111
+ public function isEnabledConfigured($website = 0)
112
+ {
113
+ return $this->isEnabled($website) && $this->isConfigured($website);
114
+ }
115
+
116
+ /**
117
+ * Returns product types that are available in Ricento
118
+ *
119
+ * @return array [ type_id => type_id ]
120
+ */
121
+ public function getAllowedProductTypes()
122
+ {
123
+ $allowProductTypes = array();
124
+ foreach (Mage::getConfig()
125
+ ->getNode(self::NODE_PRODUCT_TYPES)->children() as $type) {
126
+ $allowProductTypes[$type->getName()] = $type->getName();
127
+ }
128
+ return $allowProductTypes;
129
+ }
130
+
131
+ /**
132
+ * Get the configuration Ricardo url
133
+ *
134
+ * @param int|null|Mage_Core_Model_Website
135
+ * @return string
136
+ */
137
+ public function getConfigurationUrl($website = null)
138
+ {
139
+ $params = array();
140
+
141
+ if ($website instanceof Mage_Core_Model_Website) {
142
+ $websiteId = $website->getId();
143
+ } else {
144
+ $websiteId = $website;
145
+ }
146
+
147
+ if (!is_null($website) && $websiteId != 0) {
148
+ $params = array('website' => Mage::app()->getWebsite($website)->getCode());
149
+ }
150
+ return Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/section/ricento', $params);
151
+ }
152
+
153
+ /**
154
+ * Get the Ricardo Assistant Url
155
+ *
156
+ * @return string
157
+ */
158
+ public function getRicardoAssistantUrl()
159
+ {
160
+ if ($this->isDevMode()) {
161
+ $urlConfig = self::CFG_ASSISTANT_URL_DEV;
162
+ } else {
163
+ $urlConfig = self::CFG_ASSISTANT_URL;
164
+ }
165
+
166
+ return Mage::getStoreConfig($urlConfig);
167
+ }
168
+
169
+ /**
170
+ * Get the Ricardo Signup Form URL
171
+ *
172
+ * @param boolean $intern
173
+ * @return string
174
+ */
175
+ public function getRicardoSignupApiUrl($intern = true)
176
+ {
177
+ if ($intern) {
178
+ return Mage::helper('adminhtml')->getUrl('ricento/account/signup');
179
+ }
180
+ return Mage::getStoreConfig(self::CFG_RICARDO_SIGNUP_API_URL);
181
+ }
182
+
183
+ /**
184
+ * Is Development Mode enabled
185
+ *
186
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
187
+ * @return bool
188
+ */
189
+ public function isDevMode($website = 0)
190
+ {
191
+ return self::getWebsiteConfigFlag(self::CFG_DEV_MODE, $website);
192
+ }
193
+
194
+ /**
195
+ * Check if Ricardo API is configured correctly
196
+ *
197
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
198
+ * @return bool
199
+ */
200
+ public function isConfigured($website = 0)
201
+ {
202
+ $configured = false;
203
+ $configuredAccount = (!$this->canSimulateAuthorization() || ($this->canSimulateAuthorization() && $this->getRicardoUsername($website) && $this->getRicardoPass($website))) ? true : false;
204
+
205
+ foreach ($this->getSupportedLang() as $lang) {
206
+ if ($this->getPartnerKey($lang, $website) && $this->getPartnerPass($lang, $website)) {
207
+ $configured = true;
208
+ break;
209
+ }
210
+ }
211
+
212
+ if ($configured && $configuredAccount) {
213
+ return true;
214
+ }
215
+
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * Is Debug Enabled
221
+ *
222
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
223
+ * @return bool
224
+ */
225
+ public function isDebugEnabled($website = 0)
226
+ {
227
+ return self::getWebsiteConfigFlag(self::CFG_DEBUG_MODE, $website);
228
+ }
229
+
230
+ /**
231
+ * Get which method to use to calculate the shipping costs
232
+ *
233
+ * @param int|null|Mage_Core_Model_Store $storeId
234
+ * @return mixed
235
+ */
236
+ public function getShippingCalculationMethod($storeId = null)
237
+ {
238
+ return Mage::getStoreConfig(self::CFG_SHIPPING_CALCULATION, $storeId);
239
+ }
240
+
241
+ /**
242
+ * Can simulate authorization process
243
+ *
244
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
245
+ * @return bool
246
+ */
247
+ public function canSimulateAuthorization($website = 0)
248
+ {
249
+ return self::getWebsiteConfigFlag(self::CFG_SIMULATE_AUTH, $website);
250
+ }
251
+
252
+ /**
253
+ * Get the Ricardo API Partner ID Configuration
254
+ *
255
+ * @param string|null $lang
256
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
257
+ * @return string
258
+ */
259
+ public function getPartnerKey($lang = null, $website = 0)
260
+ {
261
+ $dev = ($this->isDevMode($website)) ? 'dev_' : '';
262
+ $lang = $this->_getLocaleCodeForApiConfig($lang);
263
+ return self::getWebsiteConfig(self::CFG_RICARDO_PARTNERKEY . $dev . $lang, $website);
264
+ }
265
+
266
+ /**
267
+ * Get the Ricardo API Partner Pass Configuration
268
+ *
269
+ * @param string|null $lang
270
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
271
+ * @return string
272
+ */
273
+ public function getPartnerPass($lang = null, $website = 0)
274
+ {
275
+ $dev = ($this->isDevMode($website)) ? 'dev_' : '';
276
+ $lang = $this->_getLocaleCodeForApiConfig($lang);
277
+ return Mage::helper('core')->decrypt(self::getWebsiteConfig(self::CFG_RICARDO_PARTNERPASS. $dev . $lang, $website));
278
+ }
279
+
280
+ /**
281
+ * Get the partner url to get the confirmation
282
+ *
283
+ * @param int $websiteId
284
+ * @return string
285
+ */
286
+ public function getPartnerUrl($websiteId = 0)
287
+ {
288
+ return Mage::helper('adminhtml')->getUrl('ricento/api/confirmation', array('website' => (int) $websiteId));
289
+ }
290
+
291
+ /**
292
+ * Normalize the locale to get only two first letters code or the Germand default
293
+ *
294
+ * @param string $lang
295
+ * @return string
296
+ */
297
+ protected function _getLocaleCodeForApiConfig($lang = null)
298
+ {
299
+ if (empty($lang)) {
300
+ $lang = Mage::app()->getLocale()->getLocaleCode();
301
+ }
302
+
303
+ if ($lang) {
304
+ $lang = substr(strtolower($lang), 0, 2);
305
+ }
306
+
307
+ if (!in_array($lang, $this->getSupportedLang())) {
308
+ $lang = self::DEFAULT_SUPPORTED_LANG;
309
+ }
310
+
311
+ return $lang;
312
+ }
313
+
314
+ /**
315
+ * Get the list of supported API language
316
+ *
317
+ * @return array
318
+ */
319
+ public function getSupportedLang()
320
+ {
321
+ return explode(',', strtolower(Mage::getStoreConfig(self::CFG_SUPPORTED_LANG)));
322
+ }
323
+
324
+ /**
325
+ * @param null|string $lang
326
+ * @return int
327
+ */
328
+ public function getRicardoLanguageIdFromLocaleCode($lang = null)
329
+ {
330
+ $lang = $this->_getLocaleCodeForApiConfig($lang);
331
+ switch ($lang) {
332
+ case 'de':
333
+ $langId = LanguageId::GERMAN;
334
+ break;
335
+ case 'fr':
336
+ $langId = LanguageId::FRENCH;
337
+ break;
338
+ default:
339
+ $langId = LanguageId::NONE;
340
+ break;
341
+ }
342
+
343
+ return $langId;
344
+ }
345
+
346
+ /**
347
+ * @param $id
348
+ * @return string
349
+ */
350
+ public function getLocalCodeFromRicardoLanguageId($id)
351
+ {
352
+ switch ($id) {
353
+ case LanguageId::FRENCH:
354
+ $locale = 'fr';
355
+ break;
356
+ default:
357
+ case LanguageId::GERMAN:
358
+ $locale = 'de';
359
+ break;
360
+ }
361
+
362
+ return $locale;
363
+ }
364
+
365
+ /**
366
+ * Get the default supported lang depending if the partner key is set or not
367
+ * @return string
368
+ */
369
+ public function getDefaultSupportedLang()
370
+ {
371
+ $lang = $this->_getLocaleCodeForApiConfig();
372
+ if ($this->getPartnerKey($lang)) {
373
+ return $lang;
374
+ }
375
+
376
+ foreach($this->getSupportedLang() as $lang) {
377
+ if ($this->getPartnerKey($lang)) {
378
+ return $lang;
379
+ }
380
+ }
381
+
382
+ return self::DEFAULT_SUPPORTED_LANG;
383
+ }
384
+
385
+ /**
386
+ * Get the Ricardo customer username
387
+ *
388
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
389
+ * @return string
390
+ */
391
+ public function getRicardoUsername($website = 0)
392
+ {
393
+ return self::getWebsiteConfig(self::CFG_RICARDO_USERNAME, $website);
394
+ }
395
+
396
+ /**
397
+ * Get the Ricardo customer username
398
+ *
399
+ * @param null|string|bool|int|Mage_Core_Model_Website $website
400
+ * @return string
401
+ */
402
+ public function getRicardoPass($website = 0)
403
+ {
404
+ return Mage::helper('core')->decrypt(self::getWebsiteConfig(self::CFG_RICARDO_PASSWORD, $website));
405
+ }
406
+
407
+ /**
408
+ * Get the delay in days to notify the owner that the API credentials will expire
409
+ *
410
+ * @param null|string|bool|int|Mage_Core_Model_Store $store
411
+ * @return int
412
+ */
413
+ public function getExpirationNotificationDelay($store = 0)
414
+ {
415
+ return Mage::getStoreConfig(self::CFG_EXPIRATION_NOTIFICATION_DELAY, $store);
416
+ }
417
+
418
+ /**
419
+ * Disable all elements in a form recursively
420
+ *
421
+ * @param Varien_Data_Form_Abstract $form
422
+ */
423
+ public function disableForm(Varien_Data_Form_Abstract $form)
424
+ {
425
+ foreach ($form->getElements() as $element) {
426
+ /* @var $element Varien_Data_Form_Element_Abstract */
427
+ $element->setDisabled(true);
428
+ if ($element->getType() === 'button') {
429
+ $element->addClass('disabled');
430
+ }
431
+ $this->disableForm($element);
432
+ }
433
+ }
434
+
435
+ /**
436
+ * @param $path
437
+ * @param null|int|string|Mage_Core_Model_Website $website
438
+ * @return mixed
439
+ */
440
+ public static function getWebsiteConfig($path, $website = null)
441
+ {
442
+ return Mage::app()->getWebsite($website)->getConfig($path);
443
+ }
444
+
445
+ /**
446
+ * @param $path
447
+ * @param null|int|string|Mage_Core_Model_Website $website
448
+ * @return mixed
449
+ */
450
+ public static function getWebsiteConfigFlag($path, $website = null)
451
+ {
452
+ $flag = strtolower(self::getWebsiteConfig($path, $website));
453
+ if (!empty($flag) && 'false' !== $flag) {
454
+ return true;
455
+ } else {
456
+ return false;
457
+ }
458
+ }
459
+
460
+ /**
461
+ * Get the store list of a products listing based on supported language
462
+ *
463
+ * @param int|Diglin_Ricento_Model_Products_Listing $productsListing
464
+ * @return array
465
+ */
466
+ public function getStoresFromListing($productsListing)
467
+ {
468
+ if (is_numeric($productsListing)) {
469
+ $productsListing = Mage::getModel('diglin_ricento/products_listing')->load($productsListing);
470
+ } else if (!$productsListing instanceof Diglin_Ricento_Model_Products_Listing) {
471
+ return array();
472
+ }
473
+
474
+ $stores = array();
475
+ $baseMethod = 'getLangStoreId';
476
+ $defaultLang = $productsListing->getDefaultLanguage();
477
+ $publishLang = $productsListing->getPublishLanguages();
478
+
479
+ if ($publishLang != Diglin_Ricento_Helper_Data::LANG_ALL) {
480
+ $method = $baseMethod . ucwords($publishLang);
481
+ $store = (int) $productsListing->$method();
482
+ if (!empty($store)) {
483
+ $stores[] = $store;
484
+ }
485
+ } else {
486
+ $supportedLang = Mage::helper('diglin_ricento')->getSupportedLang();
487
+
488
+ // We set default lang at first position
489
+ $method = $baseMethod . ucwords($defaultLang);
490
+ $stores[] = (int) $productsListing->$method();
491
+
492
+ foreach ($supportedLang as $lang) {
493
+
494
+ // Prevent to have the default language twice
495
+
496
+ if (strtolower($lang) == strtolower($defaultLang)) {
497
+ continue;
498
+ }
499
+
500
+ $method = $baseMethod . ucwords($lang);
501
+ $stores[] = (int) $productsListing->$method();
502
+ }
503
+ }
504
+
505
+ return $stores;
506
+ }
507
+
508
+ /**
509
+ * @return string
510
+ */
511
+ public function getDateTimeIsoFormat()
512
+ {
513
+ $locale = Mage::app()->getLocale();
514
+ return $locale->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
515
+ . ' ' . $locale->getTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
516
+ }
517
+
518
+ /**
519
+ * @fixme potential problem with missing Mage::getSingleton('diglin_ricento/api_services_selleraccount')->setCurrentWebsite
520
+ * not fixed at the moment bc Diglin_Ricento_Model_Validate_Rules_Methods use this helper and may be not in a context
521
+ * of having relevant information about which website to use (default is used at the moment)
522
+ *
523
+ * @return bool
524
+ */
525
+ public function isCardPaymentAllowed()
526
+ {
527
+ $creditCardAvailable = false;
528
+ $paymentOptions = (array) Mage::getSingleton('diglin_ricento/api_services_selleraccount')->getPaymentOptions();
529
+
530
+ if (isset($paymentOptions['CardPaymentOptionAvailable'])) {
531
+ $creditCardAvailable = (bool) $paymentOptions['CardPaymentOptionAvailable'];
532
+ }
533
+ return $creditCardAvailable;
534
+ }
535
+
536
+ /**
537
+ * Is the ricardo payment method ID is Credit Card
538
+ *
539
+ * @param $paymentMethodId
540
+ * @return bool
541
+ */
542
+ public function isCreditCard($paymentMethodId)
543
+ {
544
+ if ($paymentMethodId == PaymentMethods::TYPE_CREDIT_CARD) {
545
+ return true;
546
+ }
547
+
548
+ return false;
549
+ }
550
+
551
+ /**
552
+ * Generate the Internal Reference - Must be unique to allow the mapping with ricardo
553
+ * Returned value will be similar to "123456#PID#987654"
554
+ *
555
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
556
+ * @param int $productId
557
+ * @return string
558
+ */
559
+ public function generateInternalReference(Diglin_Ricento_Model_Products_Listing_Item $item, $productId = null)
560
+ {
561
+ if (is_null($productId)) {
562
+ $productId = $item->getProductId();
563
+ }
564
+
565
+ return $item->getId() . '#PID#' . $productId;
566
+ }
567
+
568
+ /**
569
+ * Extract the item Id and the product Id from the Internal Reference exposed from the ricardo API
570
+ *
571
+ * @param $internalReference
572
+ * @return Varien_Object
573
+ */
574
+ public function extractInternalReference($internalReference)
575
+ {
576
+ if (strpos($internalReference, '#PID#') === false) {
577
+ return $internalReference;
578
+ }
579
+
580
+ list ($itemId, $productId) = explode('#PID#', $internalReference);
581
+
582
+ return new Varien_Object(array('item_id' => $itemId, 'product_id' => $productId));
583
+ }
584
+
585
+ /**
586
+ * @param array $data
587
+ * @return Varien_Object
588
+ */
589
+ public function extractData(array $data)
590
+ {
591
+ $object = new Varien_Object();
592
+
593
+ foreach ($data as $key => $value) {
594
+ if (is_array($value) && !is_numeric($key)) {
595
+ $value = $this->extractData($value);
596
+ }
597
+ $object->setDataUsingMethod($key, $value);
598
+ }
599
+
600
+ return $object;
601
+ }
602
+
603
+ /**
604
+ * @param $unixtimestamp
605
+ * @return string
606
+ */
607
+ public function getJsonDate($unixtimestamp = null)
608
+ {
609
+ return \Diglin\Ricardo\Core\Helper::getJsonDate($unixtimestamp);
610
+ }
611
+
612
+ /**
613
+ * @param $date
614
+ * @return string
615
+ */
616
+ public function getJsonTimestamp($date)
617
+ {
618
+ return \Diglin\Ricardo\Core\Helper::getJsonTimestamp($date);
619
+ }
620
+
621
+ /**
622
+ * @return bool
623
+ */
624
+ public function getDecreaseInventory()
625
+ {
626
+ return Mage::getStoreConfigFlag(self::CFG_DECREASE_INVENTORY);
627
+ }
628
+
629
+ /**
630
+ * Get allowed HTML Tags from the API
631
+ *
632
+ * @return array
633
+ */
634
+ public function getAllowedTags()
635
+ {
636
+ $allowedTags = array();
637
+ $partnerConfiguration = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getPartnerConfigurations();
638
+ if (isset($partnerConfiguration['GrantedDescriptionTags'])) {
639
+ foreach ($partnerConfiguration['GrantedDescriptionTags'] as $tag) {
640
+ $allowedTags[] = '<'.$tag.'>';
641
+ }
642
+ }
643
+
644
+ return $allowedTags;
645
+ }
646
+ }
app/code/community/Diglin/Ricento/Helper/Price.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Helper_Price extends Mage_Core_Helper_Abstract
12
+ {
13
+ /**
14
+ * @var string
15
+ */
16
+ protected $_oldCurrency = Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY;
17
+
18
+ /**
19
+ * Format the price with the ricardo supported currencies
20
+ *
21
+ * @param float $value
22
+ * @param int $websiteId
23
+ * @return string
24
+ */
25
+ public function formatPrice($value, $websiteId = null)
26
+ {
27
+ $this->startCurrencyEmulation($websiteId);
28
+
29
+ $value = Mage::app()->getWebsite($websiteId)->getDefaultStore()->formatPrice($value);
30
+
31
+ $this->stopCurrencyEmulation($websiteId);
32
+
33
+ return $value;
34
+ }
35
+
36
+ /**
37
+ * Emulate CHF currency in case the current store settings is different as the allowed currency/ies
38
+ *
39
+ * @param int $websiteId
40
+ * @return $this
41
+ */
42
+ public function startCurrencyEmulation($websiteId = null)
43
+ {
44
+ $partnerConfiguration = Mage::getSingleton('diglin_ricento/api_services_system')
45
+ ->setCurrentWebsite($websiteId)
46
+ ->getPartnerConfigurations();
47
+
48
+ if (isset($partnerConfiguration['CurrencyPrefix'])) {
49
+ $ricardoCurrency = $partnerConfiguration['CurrencyPrefix'];
50
+ } else {
51
+ $ricardoCurrency = Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY;
52
+ }
53
+
54
+ $store = Mage::app()->getWebsite($websiteId)->getDefaultStore();
55
+ $this->_oldCurrency = $store->getCurrentCurrency();
56
+ $store->setCurrentCurrency(Mage::getModel('directory/currency')->load($ricardoCurrency));
57
+
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * Revert the changes done regarding the currency of the current store
63
+ *
64
+ * @param int $websiteId
65
+ * @return $this
66
+ */
67
+ public function stopCurrencyEmulation($websiteId = null)
68
+ {
69
+ Mage::app()->getWebsite($websiteId)->getDefaultStore()->setCurrentCurrency($this->_oldCurrency);
70
+
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * Calculate the price change depending on the type and value of the change to apply
76
+ *
77
+ * @param float|int $price
78
+ * @param string $priceChangeType
79
+ * @param float|int $priceChange
80
+ * @return float
81
+ */
82
+ public function calculatePriceChange($price, $priceChangeType, $priceChange)
83
+ {
84
+ switch ($priceChangeType) {
85
+ case Diglin_Ricento_Model_Config_Source_Sales_Price_Method::PRICE_TYPE_DYNAMIC_NEG:
86
+ $price -= ($price * $priceChange / 100);
87
+ break;
88
+ case Diglin_Ricento_Model_Config_Source_Sales_Price_Method::PRICE_TYPE_DYNAMIC_POS:
89
+ $price += ($price * $priceChange / 100);
90
+ break;
91
+ case Diglin_Ricento_Model_Config_Source_Sales_Price_Method::PRICE_TYPE_FIXED_NEG:
92
+ $price -= $priceChange;
93
+ break;
94
+ case Diglin_Ricento_Model_Config_Source_Sales_Price_Method::PRICE_TYPE_FIXED_POS:
95
+ $price += $priceChange;
96
+ break;
97
+ case Diglin_Ricento_Model_Config_Source_Sales_Price_Method::PRICE_TYPE_NOCHANGE:
98
+ default:
99
+ break;
100
+ }
101
+
102
+ return $price;
103
+ }
104
+
105
+ /**
106
+ * Calculate configurable product selection price
107
+ *
108
+ * @param array $priceInfo
109
+ * @param float $productPrice
110
+ * @return float
111
+ */
112
+ public function calcSelectionPrice($priceInfo, $productPrice)
113
+ {
114
+ if ($priceInfo['is_percent']) {
115
+ $ratio = $priceInfo['pricing_value']/100;
116
+ $price = $productPrice * $ratio;
117
+ } else {
118
+ $price = $priceInfo['pricing_value'];
119
+ }
120
+ return $price;
121
+ }
122
+ }
app/code/community/Diglin/Ricento/Helper/Tools.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Helper_Tools
14
+ */
15
+ class Diglin_Ricento_Helper_Tools extends Mage_Core_Helper_Abstract
16
+ {
17
+ const XML_PATH_EMAIL_NOTIFICATION_TEMPLATE = 'system/messages/notification_email_template';
18
+ const XML_PATH_PM_EMAIL_TEMPLATE = 'system/messages/pm_email_template';
19
+
20
+ /**
21
+ * @param $message
22
+ */
23
+ public static function sendAdminNotification($message)
24
+ {
25
+ self::sendNotification(
26
+ Mage::getStoreConfig(Mage_Log_Model_Cron::XML_PATH_EMAIL_LOG_CLEAN_IDENTITY), // e.g. 'general'
27
+ 'support',
28
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_NOTIFICATION_TEMPLATE),
29
+ array('message' => $message),
30
+ Mage::app()->getStore()->getId()
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Send email with specific message
36
+ *
37
+ * @param Mage_Customer_Model_Customer $customer
38
+ * @param string $title
39
+ * @param string $message
40
+ * @param string $backUrl
41
+ * @param int $storeId
42
+ * @return Mage_Customer_Model_Customer
43
+ */
44
+ public static function sendPrivateMessage(Mage_Customer_Model_Customer $customer, $title, $message, $backUrl = '', $storeId = null)
45
+ {
46
+ if (is_null($storeId)) {
47
+ $storeId = $customer->getStoreId();
48
+ }
49
+ $variables = array(
50
+ 'customer' => $customer, 'back_url' => $backUrl, 'message' => $message, 'title' => $title
51
+ );
52
+
53
+ self::sendNotification(
54
+ Mage::getStoreConfig('contacts/email/sender_email_identity'), // e.g. 'general'
55
+ 'customer',
56
+ Mage::getStoreConfig(self::XML_PATH_PM_EMAIL_TEMPLATE),
57
+ $variables,
58
+ $storeId
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Send a notification email to the customer or the shop managers
64
+ *
65
+ * @param string $sender
66
+ * @param string $recipient
67
+ * @param string $template
68
+ * @param array $variables
69
+ * @param int $storeId
70
+ * @throw Exception
71
+ */
72
+ public static function sendNotification($sender = 'general', $recipient = 'customer', $template, $variables = array(), $storeId = null)
73
+ {
74
+ try {
75
+ if ($recipient == 'customer') {
76
+ $customer = $variables['customer'];
77
+
78
+ if (is_numeric($customer)) {
79
+ $customer = Mage::getModel('customer/customer')->load($customer);
80
+ }
81
+
82
+ $recipient = array('name' => $customer->getName(), 'email' => $customer->getEmail());
83
+ } else {
84
+ $recipient = array(
85
+ 'name' => Mage::getStoreConfig('trans_email/ident_' . $recipient . '/name', $storeId),
86
+ 'email' => Mage::getStoreConfig('trans_email/ident_' . $recipient . '/email', $storeId)
87
+ );
88
+ }
89
+
90
+ $translate = Mage::getSingleton('core/translate');
91
+ $translate->setTranslateInline(false);
92
+
93
+ $emailTemplate = Mage::getModel('core/email_template');
94
+ $emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
95
+ ->sendTransactional($template, // xml path email template
96
+ $sender,
97
+ $recipient['email'],
98
+ $recipient['name'],
99
+ $variables,
100
+ $storeId);
101
+
102
+ $translate->setTranslateInline(true);
103
+ } catch (Exception $e) {
104
+ Mage::logException($e);
105
+ self::sendAdminNotification($e->__toString());
106
+ }
107
+ }
108
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/Abstract.php ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Api;
13
+ use \Diglin\Ricardo\Config;
14
+ use \Diglin\Ricardo\Service;
15
+ use \Diglin\Ricardo\Services\ServiceAbstract;
16
+
17
+ /**
18
+ * Class Diglin_Ricento_Model_Api_Services_Abstract
19
+ *
20
+ * @method Diglin_Ricento_Model_Api_Services_Abstract setCacheLifetime(int $lifetime)
21
+ */
22
+ abstract class Diglin_Ricento_Model_Api_Services_Abstract extends Varien_Object
23
+ {
24
+ /**
25
+ * @var string
26
+ */
27
+ private $_registryKey = 'serviceManager';
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ protected $_serviceName = '';
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ protected $_model = '';
38
+
39
+ /**
40
+ * @var int
41
+ */
42
+ protected $_currentWebsite = Mage_Core_Model_App::ADMIN_STORE_ID;
43
+
44
+ /**
45
+ * @var string
46
+ */
47
+ protected $_profilerPrefix = 'RICARDO_API_';
48
+
49
+ /**
50
+ * @var bool
51
+ */
52
+ protected $_canUseCache = true;
53
+
54
+ /**
55
+ * @param int|Mage_Core_Model_Website $currentWebsite
56
+ * @return $this
57
+ */
58
+ public function setCurrentWebsite($currentWebsite)
59
+ {
60
+ $this->_currentWebsite = $currentWebsite;
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * @return Mage_Core_Model_Website
66
+ */
67
+ public function getCurrentWebsite()
68
+ {
69
+ return Mage::app()->getWebsite($this->_currentWebsite);
70
+ }
71
+
72
+ /**
73
+ * @return ServiceAbstract
74
+ */
75
+ public function getServiceModel()
76
+ {
77
+ $key = $this->_registryKey . $this->_serviceName . $this->getCurrentWebsite()->getId();
78
+
79
+ if (!Mage::registry($key)) {
80
+ if (!class_exists($this->_model)) {
81
+ Mage::throwException(Mage::helper('diglin_ricento')->__('ricardo.ch Service Model doesn\'t exists.'));
82
+ }
83
+ Mage::register($key, new $this->_model($this->getServiceManager()));
84
+ }
85
+
86
+ return Mage::registry($key);
87
+ }
88
+
89
+ /**
90
+ * Get the Service Manager of the Ricardo PHP lib
91
+ *
92
+ * @return Service
93
+ */
94
+ public function getServiceManager()
95
+ {
96
+ $helper = Mage::helper('diglin_ricento');
97
+
98
+ if (!Mage::registry('ricardo_api_lang')) {
99
+ Mage::register('ricardo_api_lang', $helper->getDefaultSupportedLang());
100
+ }
101
+
102
+ $website = $this->getCurrentWebsite();
103
+
104
+ $lang = Mage::registry('ricardo_api_lang');
105
+ $registryKey = $this->_registryKey . ucwords($lang) . $website->getId();
106
+
107
+ if (!Mage::registry($registryKey)) {
108
+
109
+ if (!$helper->isConfigured($website)) {
110
+ Mage::throwException($helper->__('ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed.'));
111
+ }
112
+
113
+ if (!in_array($lang, $helper->getSupportedLang())) {
114
+ Mage::throwException($helper->__('API language provided for the Service Manager is not supported.'));
115
+ }
116
+
117
+ if ($helper->isDevMode($website)) {
118
+ $host = Mage::getStoreConfig(Diglin_Ricento_Helper_Data::CFG_API_HOST_DEV);
119
+ } else {
120
+ $host = Mage::getStoreConfig(Diglin_Ricento_Helper_Data::CFG_API_HOST);
121
+ }
122
+
123
+ $config = array(
124
+ 'host' => $host,
125
+ 'partnership_key' => $helper->getPartnerKey($lang, $website),
126
+ 'partnership_passwd' => $helper->getPartnerPass($lang, $website),
127
+ 'partner_url' => $helper->getPartnerUrl($website->getId()),
128
+ 'allow_authorization_simulation' => ($helper->canSimulateAuthorization()) ? true : false,
129
+ 'customer_username' => $helper->getRicardoUsername($website),
130
+ 'customer_password' => $helper->getRicardoPass($website),
131
+ 'debug' => ($helper->isDebugEnabled($website)) ? true : false,
132
+ 'log_path' => Mage::getBaseDir('var') . DS . 'log' . DS . Diglin_Ricento_Helper_Data::LOG_FILE
133
+ );
134
+
135
+ Mage::register($registryKey, new Service(new Api(new Config($config))), false);
136
+ }
137
+
138
+ return Mage::registry($registryKey);
139
+ }
140
+
141
+ /**
142
+ * Get last API call information
143
+ *
144
+ * @param bool $flush
145
+ * @return array
146
+ */
147
+ public function getLastApiDebug($flush = true)
148
+ {
149
+ return $this->getServiceManager()
150
+ ->getApi()
151
+ ->getLastDebug($flush);
152
+ }
153
+
154
+ /**
155
+ * Magic method to getter/setter methods from Ricardo API library, save in cache the getter
156
+ *
157
+ * @param string $method
158
+ * @param array $args
159
+ * @return mixed|Varien_Object
160
+ * @throws \Diglin\Ricardo\Exceptions\ExceptionAbstract
161
+ * @throws Diglin_Ricento_Exception
162
+ * @throws Exception
163
+ */
164
+ public function __call($method, $args)
165
+ {
166
+ $data = array();
167
+ $helper = Mage::helper('diglin_ricento');
168
+ $key = $this->_underscore(substr($method,3));
169
+ $cacheKey = $key . Mage::registry('ricardo_api_lang');
170
+ $profilerName = $this->_profilerPrefix . strtoupper($key);
171
+ $serviceModel = $this->getServiceModel();
172
+
173
+ try {
174
+ switch (substr($method, 0, 3)) {
175
+ case 'get' :
176
+ if (method_exists($serviceModel, $method) && is_callable(array($serviceModel, $method), true)) {
177
+
178
+ Varien_Profiler::start($profilerName);
179
+
180
+ $this->_prepareCredentialToken();
181
+
182
+ if ($this->getCanUseCache()) {
183
+ $data = unserialize(Mage::app()->loadCache($cacheKey));
184
+ }
185
+
186
+ if (empty($data) || !$this->getCanUseCache() || array_key_exists('ErrorCodes', $data)) {
187
+ $data = call_user_func_array(array($serviceModel, $method), $args);
188
+ }
189
+
190
+ $this->setData($key, $data);
191
+
192
+ if ($this->getCanUseCache() && !array_key_exists('ErrorCodes', $data)) {
193
+ Mage::app()->saveCache(serialize($data), $cacheKey, array(Diglin_Ricento_Helper_Api::CACHE_TAG), $this->getCacheLifeTime());
194
+ }
195
+
196
+ $this->_updateCredentialToken();
197
+
198
+ Varien_Profiler::stop($profilerName);
199
+
200
+ return $data;
201
+ }
202
+ break;
203
+ case 'set':
204
+ if (method_exists($serviceModel, $method) && is_callable(array($serviceModel, $method), true)) {
205
+
206
+ Varien_Profiler::start($profilerName);
207
+
208
+ $this->_prepareCredentialToken();
209
+
210
+ call_user_func_array(array($serviceModel, $method), $args);
211
+
212
+ $this->_updateCredentialToken();
213
+
214
+ Varien_Profiler::stop($profilerName);
215
+
216
+ return $this;
217
+ }
218
+ break;
219
+ default:
220
+ if (method_exists($serviceModel, $method) && is_callable(array($serviceModel, $method), true)) {
221
+
222
+ Varien_Profiler::start($profilerName);
223
+
224
+ $this->_prepareCredentialToken();
225
+
226
+ $data = call_user_func_array(array($serviceModel, $method), $args);
227
+
228
+ $this->_updateCredentialToken();
229
+
230
+ Varien_Profiler::stop($profilerName);
231
+
232
+ return $data;
233
+ }
234
+ break;
235
+ }
236
+ } catch (\Diglin\Ricardo\Exceptions\CurlException $e) {
237
+ Mage::logException($e);
238
+ throw new Exception($helper->__('Error while trying to connect to the ricardo.ch API. Please, check your log files.'));
239
+ } catch (\Diglin\Ricardo\Exceptions\ExceptionAbstract $e) {
240
+ $this->_updateCredentialToken();
241
+ $this->_handleSecurityException($e);
242
+ }
243
+
244
+ return parent::__call($method, $args);
245
+ }
246
+
247
+ /**
248
+ * Set if the cache is allow to be used
249
+ *
250
+ * @param boolean $canUseCache
251
+ * @return $this
252
+ */
253
+ public function setCanUseCache($canUseCache)
254
+ {
255
+ $this->_canUseCache = (bool) $canUseCache;
256
+ return $this;
257
+ }
258
+
259
+ /**
260
+ * Allowed to use the cache or not
261
+ *
262
+ * @return boolean
263
+ */
264
+ public function getCanUseCache()
265
+ {
266
+ return (Mage::app()->useCache(Diglin_Ricento_Helper_Api::CACHE_TYPE) && $this->_canUseCache);
267
+ }
268
+
269
+ /**
270
+ * @return int|mixed
271
+ */
272
+ public function getCacheLifeTime()
273
+ {
274
+ if ($this->getData('cache_lifetime')) {
275
+ return $this->getData('cache_lifetime');
276
+ }
277
+
278
+ return Diglin_Ricento_Helper_Api::CACHE_LIFETIME;
279
+ }
280
+
281
+ /**
282
+ * Set the token credential from the DB before to execute the API call
283
+ *
284
+ * @return $this
285
+ */
286
+ protected function _prepareCredentialToken()
287
+ {
288
+ /* @var $serviceModel \Diglin\Ricardo\Managers\ManagerAbstract */
289
+ $typeOfToken = self::getServiceModel()->getTypeOfToken();
290
+
291
+ if ($typeOfToken == ServiceAbstract::TOKEN_TYPE_IDENTIFIED) {
292
+
293
+ $security = Mage::getSingleton('diglin_ricento/api_services_security')
294
+ ->setCurrentWebsite($this->getCurrentWebsite()->getId());
295
+
296
+ $apiToken = Mage::getModel('diglin_ricento/api_token')
297
+ ->loadByWebsiteAndTokenType(
298
+ ServiceAbstract::TOKEN_TYPE_IDENTIFIED,
299
+ $this->getCurrentWebsite()->getId()
300
+ );
301
+
302
+ if ($apiToken->getId()) {
303
+ $security->getServiceModel()
304
+ ->setCredentialToken($apiToken->getToken())
305
+ ->setCredentialTokenExpirationDate(strtotime($apiToken->getExpirationDate()))
306
+ ->setCredentialTokenSessionDuration($apiToken->getSessionDuration())
307
+ ->setCredentialTokenSessionStart(Mage::helper('diglin_ricento/api')
308
+ ->calculateSessionStart($apiToken->getSessionDuration(), $apiToken->getSessionExpirationDate()));
309
+ }
310
+ }
311
+ return $this;
312
+ }
313
+
314
+ /**
315
+ * Update the token credential in the database if needed after API call
316
+ *
317
+ * @return $this
318
+ */
319
+ protected function _updateCredentialToken()
320
+ {
321
+ /* @var $serviceModel \Diglin\Ricardo\Managers\ManagerAbstract */
322
+ $typeOfToken = @self::getServiceModel()->getTypeOfToken();
323
+
324
+ // we want to skip the use of magic __call to prevent loop, we use getServiceModel()
325
+ $security = Mage::getSingleton('diglin_ricento/api_services_security')
326
+ ->setCurrentWebsite($this->getCurrentWebsite()->getId())
327
+ ->getServiceModel();
328
+
329
+ if ($typeOfToken == ServiceAbstract::TOKEN_TYPE_IDENTIFIED && $security->getIsCredentialTokenRefreshed()) {
330
+
331
+ $apiToken = Mage::getModel('diglin_ricento/api_token')
332
+ ->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_IDENTIFIED, $this->getCurrentWebsite()->getId());
333
+
334
+ $apiToken
335
+ ->setToken($security->getCredentialToken())
336
+ ->setTokenType(ServiceAbstract::TOKEN_TYPE_IDENTIFIED)
337
+ ->setSessionExpirationDate(
338
+ Mage::helper('diglin_ricento/api')
339
+ ->calculateSessionExpirationDate(
340
+ $security->getCredentialTokenSessionDuration(),
341
+ $security->getCredentialTokenSessionStart())
342
+ )
343
+ ->save();
344
+
345
+ $security->setIsCredentialTokenRefreshed(false);
346
+ }
347
+
348
+ return $this;
349
+ }
350
+
351
+ /**
352
+ * Delete the credential token from the database
353
+ *
354
+ * @return $this
355
+ */
356
+ protected function _cleanupCredentialToken()
357
+ {
358
+ $token = Mage::getModel('diglin_ricento/api_token')
359
+ ->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_IDENTIFIED, $this->getCurrentWebsite()->getId());
360
+
361
+ if ($token->getId()) {
362
+ $token->delete();
363
+ }
364
+
365
+ $security = Mage::getSingleton('diglin_ricento/api_services_security')
366
+ ->setCurrentWebsite($this->getCurrentWebsite()->getId())
367
+ ->getServiceModel();
368
+
369
+ Mage::getModel('diglin_ricento/api_token')
370
+ ->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY, $this->getCurrentWebsite()->getId())
371
+ ->setToken($security->getTemporaryToken())
372
+ ->setWebsiteId($this->getCurrentWebsite()->getId())
373
+ ->setTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY)
374
+ ->setExpirationDate(
375
+ Mage::helper('diglin_ricento/api')->calculateSessionExpirationDate($security->getCredentialTokenSessionDuration(), $security->getCredentialTokenSessionStart())
376
+ )
377
+ ->save();
378
+
379
+ return $this;
380
+ }
381
+
382
+ /**
383
+ * @param Exception $e
384
+ * @throws Exception
385
+ * @throws Diglin_Ricento_Exception
386
+ */
387
+ protected function _handleSecurityException(Exception $e)
388
+ {
389
+ if ($e->getCode() == \Diglin\Ricardo\Enums\SecurityErrors::TOKEN_AUTHORIZATION) {
390
+
391
+ Mage::logException($e);
392
+
393
+ $ricentoException = new Diglin_Ricento_Exception($e->getMessage(), $e->getCode());
394
+ $ricentoException->setNeedAuthorization(true);
395
+ $ricentoException->setValidationUrl($this->getServiceManager()->getSecurityManager()->getValidationUrl());
396
+ $this->_cleanupCredentialToken();
397
+ throw $ricentoException;
398
+ }
399
+ throw $e;
400
+ }
401
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/Customer.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Api_Services_Customer
14
+ */
15
+ class Diglin_Ricento_Model_Api_Services_Customer extends Diglin_Ricento_Model_Api_Services_Abstract
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $_serviceName = 'customer';
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_model = '\Diglin\Ricardo\Managers\Customer';
26
+
27
+ /**
28
+ * Overwritten just to get the class/method auto completion
29
+ * Be aware that using directly this method to use the methods of the object instead of using
30
+ * the magic methods of the abstract (__call, __get, __set) will prevent to use the cache of Magento
31
+ * but also some logic related to the securtiy token
32
+ *
33
+ * @return \Diglin\Ricardo\Managers\Customer
34
+ */
35
+ public function getServiceModel()
36
+ {
37
+ return parent::getServiceModel();
38
+ }
39
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/Security.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Services\ServiceAbstract;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Model_Api_Services_Security
16
+ */
17
+ class Diglin_Ricento_Model_Api_Services_Security extends Diglin_Ricento_Model_Api_Services_Abstract
18
+ {
19
+ /**
20
+ * @var string
21
+ */
22
+ protected $_serviceName = 'Security';
23
+
24
+ /**
25
+ * Overwritten because the Service Manager has already instanciated the Security Manager model
26
+ *
27
+ * Be aware that using directly this method to use the methods of the object instead of using
28
+ * the magic methods of the abstract (__call, __get, __set) will prevent to use the cache of Magento
29
+ *
30
+ * @return \Diglin\Ricardo\Managers\Security
31
+ */
32
+ public function getServiceModel()
33
+ {
34
+ $key = $this->_serviceName . $this->getCurrentWebsite()->getId();
35
+
36
+ if (!Mage::registry($key)) {
37
+ Mage::register($key, $this->getServiceManager()->getSecurityManager());
38
+ }
39
+
40
+ return Mage::registry($key);
41
+ }
42
+
43
+ /**
44
+ * Get the validation Url necessary if simulation of authorization process is not allowed
45
+ *
46
+ * @return string
47
+ */
48
+ public function getValidationUrl()
49
+ {
50
+ try {
51
+ $websiteId = $this->getCurrentWebsite()->getId();
52
+ $serviceModel = $this->getServiceModel();
53
+ $validationUrl = $serviceModel->getValidationUrl();
54
+
55
+ // Refresh the database cause of new data after getting validation url
56
+ $apiToken = Mage::getModel('diglin_ricento/api_token')->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY, $websiteId);
57
+ $apiToken
58
+ ->setWebsiteId($websiteId)
59
+ ->setToken($serviceModel->getTemporaryToken())
60
+ ->setExpirationDate($serviceModel->getTemporaryTokenExpirationDate())
61
+ ->setTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY)
62
+ ->save();
63
+ } catch (Exception $e) {
64
+ Mage::logException($e);
65
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('diglin_ricento')->__('Security error occurred with the ricardo API. Please, check your log files.'));
66
+ $validationUrl = null;
67
+ }
68
+ return $validationUrl;
69
+ }
70
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/Sell.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Api_Services_Sell
14
+ */
15
+ class Diglin_Ricento_Model_Api_Services_Sell extends Diglin_Ricento_Model_Api_Services_Abstract
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $_serviceName = 'sell';
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_model = '\Diglin\Ricardo\Managers\Sell';
26
+
27
+ /**
28
+ * @var Diglin_Ricento_Model_Sales_Options
29
+ */
30
+ protected $_salesOptions;
31
+
32
+ /**
33
+ * @var Diglin_Ricento_Model_Rule
34
+ */
35
+ protected $_shippingPaymentRule;
36
+
37
+ /**
38
+ * Overwritten just to get the class/method auto completion
39
+ * Be aware that using directly this method to use the methods of the object instead of using
40
+ * the magic methods of the abstract (__call, __get, __set) will prevent to use the cache of Magento
41
+ * but also some logic related to the secure token
42
+ *
43
+ * @return \Diglin\Ricardo\Managers\Sell
44
+ */
45
+ public function getServiceModel()
46
+ {
47
+ return parent::getServiceModel();
48
+ }
49
+
50
+ /**
51
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
52
+ * @return array
53
+ */
54
+ public function insertArticle(Diglin_Ricento_Model_Products_Listing_Item $item)
55
+ {
56
+ $articleResult = array();
57
+ $insertArticle = $item->getInsertArticleParameter();
58
+
59
+ try {
60
+ $start = microtime(true);
61
+
62
+ $articleResult = parent::insertArticle($insertArticle);
63
+
64
+ if (Mage::helper('diglin_ricento')->isDebugEnabled()) {
65
+ Mage::log('Time to insert article ' . (microtime(true) - $start) . ' sec', Zend_Log::DEBUG, Diglin_Ricento_Helper_Data::LOG_FILE);
66
+ }
67
+
68
+ } catch (\Diglin\Ricardo\Exceptions\ExceptionAbstract $e) {
69
+ $this->_updateCredentialToken();
70
+ Mage::logException($e);
71
+
72
+ if (Mage::helper('diglin_ricento')->isDebugEnabled()) {
73
+ $insertArticle->setPictures(null, true); // remove picture otherwise log is extremely long
74
+ Mage::log($insertArticle->getDataProperties(), Zend_Log::DEBUG, Diglin_Ricento_Helper_Data::LOG_FILE);
75
+ }
76
+
77
+ $this->_handleSecurityException($e);
78
+ }
79
+
80
+ unset($insertArticle);
81
+
82
+ return $articleResult;
83
+ }
84
+
85
+ public function updateArticle(Diglin_Ricento_Model_Products_Listing_Item $item)
86
+ {
87
+ // @todo when needed
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Not used
93
+ *
94
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
95
+ * @return array|bool
96
+ */
97
+ public function relistArticle(Diglin_Ricento_Model_Products_Listing_Item $item)
98
+ {
99
+ $relistArticleResult = array();
100
+
101
+ if (!$item->getRicardoArticleId() || $item->getIsPlanned()) {
102
+ return false;
103
+ }
104
+
105
+ try {
106
+ $relistArticleResult = parent::relistArticle($item->getRicardoArticleId());
107
+
108
+ } catch (\Diglin\Ricardo\Exceptions\ExceptionAbstract $e) {
109
+ $this->_updateCredentialToken();
110
+ Mage::logException($e);
111
+ $this->_handleSecurityException($e);
112
+ }
113
+
114
+ return $relistArticleResult;
115
+ }
116
+
117
+ /**
118
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
119
+ * @return array|bool
120
+ * @throws Exception
121
+ */
122
+ public function stopArticle(Diglin_Ricento_Model_Products_Listing_Item $item)
123
+ {
124
+ /**
125
+ * If it is a planned article, we have to delete instead to close the article
126
+ */
127
+ if ($item->getIsPlanned()) {
128
+ $parameterMethod = 'getDeleteArticleParameter';
129
+ $serviceMethod = 'deletePlannedArticle';
130
+ } else {
131
+ $parameterMethod = 'getCloseArticleParameter';
132
+ $serviceMethod = 'closeArticle';
133
+ }
134
+
135
+ try {
136
+ $parameter = $item->$parameterMethod();
137
+ if (!$parameter) {
138
+ return false;
139
+ }
140
+
141
+ $result = $this->$serviceMethod($parameter);
142
+
143
+ /**
144
+ * Ricardo API is special here - if article is closed, returned values may be empty !!!
145
+ * If it's closed/deleted or an error occurred, an exception is triggered
146
+ */
147
+ if (isset($result['IsClosed'])) {
148
+ unset($parameter);
149
+ return true;
150
+ }
151
+ } catch (\Diglin\Ricardo\Exceptions\ExceptionAbstract $e) {
152
+ $this->_updateCredentialToken();
153
+ Mage::logException($e);
154
+
155
+ try {
156
+ $this->_handleSecurityException($e);
157
+ } catch (\Diglin\Ricardo\Exceptions\GeneralException $e) {
158
+ switch ($e->getCode()) {
159
+ case \Diglin\Ricardo\Enums\GeneralErrors::DELETEPLANNEDFAILED:
160
+ case \Diglin\Ricardo\Enums\GeneralErrors::CLOSEAUCTIONFAILED:
161
+ return false;
162
+ default:
163
+ break;
164
+ }
165
+ throw $e;
166
+ }
167
+ }
168
+
169
+ return false;
170
+ }
171
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/Selleraccount.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Diglin_Ricento_Model_Api_Services_Selleraccount extends Diglin_Ricento_Model_Api_Services_Abstract
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $_serviceName = 'seller_account';
18
+
19
+ /**
20
+ * @var string
21
+ */
22
+ protected $_model = '\Diglin\Ricardo\Managers\SellerAccount';
23
+
24
+ /**
25
+ * Overwritten just to get the class/method auto completion
26
+ *
27
+ * Be aware that using directly this method to use the methods of the object instead of using
28
+ * the magic methods of the abstract (__call, __get, __set) will prevent to use the cache of Magento
29
+ * but also some logic related to the securtiy token
30
+ *
31
+ * @return \Diglin\Ricardo\Managers\SellerAccount
32
+ */
33
+ public function getServiceModel()
34
+ {
35
+ return parent::getServiceModel();
36
+ }
37
+ }
app/code/community/Diglin/Ricento/Model/Api/Services/System.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Api_Services_System
14
+ */
15
+ class Diglin_Ricento_Model_Api_Services_System extends Diglin_Ricento_Model_Api_Services_Abstract
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $_serviceName = 'system';
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_model = '\Diglin\Ricardo\Managers\System';
26
+
27
+ /**
28
+ * Overwritten just to get the class/method auto completion
29
+ * Be aware that using directly this method to use the methods of the object instead of using
30
+ * the magic methods of the abstract (__call, __get, __set) will prevent to use the cache of Magento
31
+ *
32
+ * @return \Diglin\Ricardo\Managers\System
33
+ */
34
+ public function getServiceModel()
35
+ {
36
+ return parent::getServiceModel();
37
+ }
38
+ }
app/code/community/Diglin/Ricento/Model/Api/Token.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Api_Token Model
14
+ *
15
+ * @method string getToken()
16
+ * @method string getTokenType()
17
+ * @method int getWebsiteId()
18
+ * @method string getExpirationDate()
19
+ * @method int getSessionDuration()
20
+ * @method string getSessionExpirationDate()
21
+ * @method string getCreatedAt()
22
+ * @method string getUpdatedAt()
23
+ * @method Diglin_Ricento_Model_Api_Token setToken(string $token)
24
+ * @method Diglin_Ricento_Model_Api_Token setTokenType(string $tokenType)
25
+ * @method Diglin_Ricento_Model_Api_Token setWebsiteId(int $websiteId)
26
+ * @method Diglin_Ricento_Model_Api_Token setSessionDuration(int $sessionDuration)
27
+ * @method Diglin_Ricento_Model_Api_Token setExpirationDate(string $expirationDate)
28
+ * @method Diglin_Ricento_Model_Api_Token setSessionExpirationDate(string $expirationDate)
29
+ * @method Diglin_Ricento_Model_Api_Token setCreatedAt(string $createdAt)
30
+ * @method Diglin_Ricento_Model_Api_Token setUpdatedAt(string $updateAt)
31
+ */
32
+
33
+ use \Diglin\Ricardo\Services\Security;
34
+
35
+ /**
36
+ * Class Diglin_Ricento_Model_Api_Token
37
+ */
38
+ class Diglin_Ricento_Model_Api_Token extends Mage_Core_Model_Abstract
39
+ {
40
+ /**
41
+ * Prefix of model events names
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventPrefix = 'api_token';
46
+
47
+ /**
48
+ * Parameter name in event
49
+ * In observe method you can use $observer->getEvent()->getObject() in this case
50
+ *
51
+ * @var string
52
+ */
53
+ protected $_eventObject = 'api_token';
54
+
55
+ /**
56
+ * Api_Token Constructor
57
+ *
58
+ * @return void
59
+ */
60
+ protected function _construct()
61
+ {
62
+ parent::_construct();
63
+ $this->_init('diglin_ricento/api_token');
64
+ }
65
+
66
+ /**
67
+ * @param string $tokenType
68
+ * @param int $websiteId
69
+ * @return $this | Diglin_Ricento_Model_Api_Token
70
+ */
71
+ public function loadByWebsiteAndTokenType($tokenType = Security::TOKEN_TYPE_IDENTIFIED, $websiteId = 0)
72
+ {
73
+ $entityId = $this->getResource()->getSpecificTokenType($tokenType, $websiteId);
74
+ if (!empty($entityId)) {
75
+ $this->load($entityId);
76
+ }
77
+ return $this;
78
+ }
79
+
80
+ /**
81
+ * @return $this
82
+ */
83
+ protected function _validate()
84
+ {
85
+ $helper = Mage::helper('diglin_ricento');
86
+
87
+ // token example: 4a8b285e-417b-431e-bc91-4295793c0d71
88
+ preg_match('/[^.]{8}-[^.]{4}-[^.]{4}-[^.]{4}-[^.]{12}/', $this->getToken(), $matches);
89
+ if (count($matches) != 1) {
90
+ Mage::throwException($helper->__('The format of the token is invalid'));
91
+ }
92
+
93
+ return $this;
94
+ }
95
+
96
+ /**
97
+ * @return Mage_Core_Model_Abstract
98
+ */
99
+ protected function _beforeSave()
100
+ {
101
+ parent::_beforeSave();
102
+
103
+ $this->_validate();
104
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
105
+
106
+ if ($this->isObjectNew()) {
107
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
108
+ }
109
+
110
+ return $this;
111
+ }
112
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Abstract.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Abstract base class for ricento attribute source models, used in edit form
14
+ */
15
+ abstract class Diglin_Ricento_Model_Config_Source_Abstract implements Mage_Eav_Model_Entity_Attribute_Source_Interface
16
+ {
17
+ /**
18
+ * Retrieve All options
19
+ *
20
+ * @return array
21
+ */
22
+ public function getAllOptions()
23
+ {
24
+ $options = array();
25
+ foreach ($this->toOptionHash() as $value => $label) {
26
+ $options[] = array('label' => $label, 'value' => $value);
27
+ }
28
+ return $options;
29
+ }
30
+
31
+ /**
32
+ * Return options as value => label array
33
+ *
34
+ * @return array
35
+ */
36
+ abstract public function toOptionHash();
37
+
38
+ /**
39
+ * Retrieve Option value text
40
+ *
41
+ * @param string $value
42
+ * @return mixed
43
+ */
44
+ public function getOptionText($value)
45
+ {
46
+ $options = $this->toOptionHash();
47
+ if (isset($options[$value])) {
48
+ return $options[$value];
49
+ }
50
+ return null;
51
+ }
52
+
53
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Categories.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Categories
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Categories extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_categories = array();
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_categories) && Mage::helper('diglin_ricento')->isConfigured()) {
28
+ $this->_categories = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getCategories();
29
+ }
30
+
31
+ return $this->_categories;
32
+ }
33
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Languages.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Languages
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Languages extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * Retrieve All options
19
+ *
20
+ * @param bool $all
21
+ * @return array
22
+ */
23
+ public function getAllOptions($all = true)
24
+ {
25
+ $options = array();
26
+ foreach ($this->toOptionHash($all) as $value => $label) {
27
+ $options[] = array('label' => $label, 'value' => $value);
28
+ }
29
+ return $options;
30
+ }
31
+
32
+ /**
33
+ * Return options as value => label array
34
+ *
35
+ * @param bool $all
36
+ * @return array
37
+ */
38
+ public function toOptionHash($all = true)
39
+ {
40
+ $helper = Mage::helper('diglin_ricento');
41
+ $languagesSupported = $helper->getSupportedLang();
42
+
43
+
44
+ $return = array('' => $helper->__('-- Please select --'));
45
+ foreach ($languagesSupported as $lang ){
46
+ $return[$lang] = Mage::app()->getLocale()->getTranslation($lang, 'language');
47
+ }
48
+
49
+ if ($all) {
50
+ $return[Diglin_Ricento_Helper_Data::LANG_ALL] = $helper->__('All languages');
51
+ }
52
+
53
+ return $return;
54
+ }
55
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Products/Listing/Log.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Products_Listing_Log
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Products_Listing_Log extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ public function toOptionHash()
18
+ {
19
+ $helper = Mage::helper('diglin_ricento');
20
+
21
+ return array(
22
+ Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_CHECK => $helper->__('Product item checks'),
23
+ Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_LIST => $helper->__('List product item to ricardo.ch'),
24
+ Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_STOP => $helper->__('Stop product item to ricardo.ch'),
25
+ );
26
+ }
27
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Products/Listing/Status.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Products_Listing_Status
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Products_Listing_Status extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ public function toOptionHash()
18
+ {
19
+ $helper = Mage::helper('diglin_ricento');
20
+
21
+ return array(
22
+ Diglin_Ricento_Model_Products_Listing_Log::STATUS_NOTICE => $helper->__('Notice'),
23
+ Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS => $helper->__('Success'),
24
+ Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR => $helper->__('Error'),
25
+ Diglin_Ricento_Model_Products_Listing_Log::STATUS_WARNING => $helper->__('Warning')
26
+ );
27
+ }
28
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Payment.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Enums\PaymentMethods;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Model_Config_Source_Rules_Payment
16
+ */
17
+ class Diglin_Ricento_Model_Config_Source_Rules_Payment extends Diglin_Ricento_Model_Config_Source_Abstract
18
+ {
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $_paymentMethodsConditions = array();
23
+
24
+ /**
25
+ * @return array
26
+ */
27
+ public function toOptionHash()
28
+ {
29
+ if (empty($this->_paymentMethodsConditions) && Mage::helper('diglin_ricento')->isConfigured()) {
30
+
31
+ $creditCardAvailable = Mage::helper('diglin_ricento')->isCardPaymentAllowed();
32
+
33
+ $paymentMethodsConditions = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getPaymentConditionsAndMethods();
34
+
35
+ foreach ($paymentMethodsConditions as $paymentMethodsCondition)
36
+ if (isset($paymentMethodsCondition['PaymentMethods'])) {
37
+ foreach ($paymentMethodsCondition['PaymentMethods'] as $method) {
38
+ if (!$creditCardAvailable && $method['PaymentMethodId'] == PaymentMethods::TYPE_CREDIT_CARD) {
39
+ continue;
40
+ }
41
+ $this->_paymentMethodsConditions[$method['PaymentMethodId']] = $method['PaymentMethodText'];
42
+ }
43
+ }
44
+ }
45
+
46
+ return $this->_paymentMethodsConditions;
47
+ }
48
+
49
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Rules_Shipping
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Rules_Shipping extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ const TYPE_OTHER = 0;
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $_shippingConditions = array();
23
+
24
+ /**
25
+ * @return array
26
+ */
27
+ public function toOptionHash()
28
+ {
29
+ if (empty($this->_shippingConditions) && Mage::helper('diglin_ricento')->isConfigured()) {
30
+ $shippingConditions = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getDeliveryConditions();
31
+
32
+ foreach ($shippingConditions as $shippingCondition)
33
+ if (isset($shippingCondition['DeliveryConditionId'])) {
34
+ $this->_shippingConditions[$shippingCondition['DeliveryConditionId']] = $shippingCondition['DeliveryConditionText'];
35
+ }
36
+ }
37
+ return $this->_shippingConditions;
38
+ }
39
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Availability.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Rules_Shipping_Availability
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Rules_Shipping_Availability extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ protected $_availabilities = array();
18
+
19
+ public function toOptionHash()
20
+ {
21
+ if (empty($this->_availabilities) && Mage::helper('diglin_ricento')->isConfigured()) {
22
+ $availabilities = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getAvailabilities();
23
+
24
+ foreach ($availabilities as $availabilitiy)
25
+ if (isset($availabilitiy['AvailabilityId'])) {
26
+ $this->_availabilities[$availabilitiy['AvailabilityId']] = $availabilitiy['AvailabilityText'];
27
+ }
28
+ }
29
+ return $this->_availabilities;
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Calculation.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Shipping_Calculation
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Rules_Shipping_Calculation
16
+ {
17
+ const HIGHEST_PRICE = 'highest_price';
18
+
19
+ const CUMULATIVE = 'cumulative';
20
+
21
+ /**
22
+ * Create option array to display the list of possible options for shipping calculation
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ $helper = Mage::helper('diglin_ricento');
29
+
30
+ return array(
31
+
32
+ array(
33
+ 'value' => self::HIGHEST_PRICE,
34
+ 'label' => $helper->__('Highest Price')
35
+ ),
36
+ array(
37
+ 'value' => self::CUMULATIVE,
38
+ 'label' => $helper->__('Cumulative')
39
+ )
40
+ );
41
+ }
42
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Rules/Shipping/Packages.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Rules_Shipping_Packages
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Rules_Shipping_Packages extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ const TYPE_OTHER = 0;
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $_shippingPackages = array();
23
+
24
+ /**
25
+ * @return array
26
+ */
27
+ public function toOptionHash()
28
+ {
29
+ if (empty($this->_shippingConditions) && Mage::helper('diglin_ricento')->isConfigured()) {
30
+ $shippingConditions = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getDeliveryConditions();
31
+
32
+ foreach ($shippingConditions as $shippingCondition)
33
+ if (!empty($shippingCondition['PackageSizes'])) {
34
+ $this->_shippingPackages[$shippingCondition['DeliveryConditionId']] = $shippingCondition['PackageSizes'];
35
+ } else {
36
+ $this->_shippingPackages[$shippingCondition['DeliveryConditionId']] = $shippingCondition['DeliveryCost'];
37
+ }
38
+ }
39
+ return $this->_shippingPackages;
40
+ }
41
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Currency.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Currency
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Currency extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @return array
19
+ */
20
+ public function toOptionHash()
21
+ {
22
+ return array(
23
+ strtolower(Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY) => Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY
24
+ );
25
+ }
26
+
27
+ public function toOptionArray()
28
+ {
29
+ return $this->toOptionHash();
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Days.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Days
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Days extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_days = array();
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_days)) {
28
+ $partnerConfiguration = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getPartnerConfigurations();
29
+
30
+ // Default duration
31
+ $duration = array(1);
32
+
33
+ if (isset($partnerConfiguration['MaxSellingDuration'])) {
34
+ $duration = range($partnerConfiguration['MinSellingDuration'], $partnerConfiguration['MaxSellingDuration'], 1);
35
+ }
36
+
37
+ foreach ($duration as $day) {
38
+ $this->_days[$day] = $day;
39
+ }
40
+ }
41
+
42
+ return $this->_days;
43
+ }
44
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Order/Status.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Order_Status
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Order_Status extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_stateStatuses = array(
21
+ Mage_Sales_Model_Order::STATE_NEW,
22
+ Diglin_Ricento_Helper_Data::ORDER_STATUS_PENDING,
23
+ Mage_Sales_Model_Order::STATE_PROCESSING,
24
+ );
25
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Price/Method.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Price_Method
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Price_Method extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ const PRICE_TYPE_NOCHANGE = 0;
18
+
19
+ const PRICE_TYPE_FIXED_POS = 1;
20
+
21
+ const PRICE_TYPE_FIXED_NEG = 2;
22
+
23
+ const PRICE_TYPE_DYNAMIC_POS = 3;
24
+
25
+ const PRICE_TYPE_DYNAMIC_NEG = 4;
26
+
27
+ /**
28
+ * @return array
29
+ */
30
+ public function toOptionHash()
31
+ {
32
+ $helper = Mage::helper('diglin_ricento');
33
+
34
+ return array(
35
+ '' => $helper->__('-- Select Method --'),
36
+ self::PRICE_TYPE_NOCHANGE => $helper->__('No change'),
37
+ self::PRICE_TYPE_DYNAMIC_POS => $helper->__('Relative increase (+ %)'),
38
+ self::PRICE_TYPE_DYNAMIC_NEG => $helper->__('Relative decrease (- %)'),
39
+ self::PRICE_TYPE_FIXED_POS => $helper->__('Absolute increase (+)'),
40
+ self::PRICE_TYPE_FIXED_NEG => $helper->__('Absolute decrease (-)')
41
+ );
42
+ }
43
+
44
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Price/Source.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Price_Source
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Price_Source extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_options = array();
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_options)) {
28
+ $collection = Mage::getModel('eav/entity_type')
29
+ ->loadByCode(Mage_Catalog_Model_Product::ENTITY)
30
+ ->getAttributeCollection();
31
+
32
+ $items = $collection
33
+ ->addFieldToFilter('backend_type', Varien_Db_Ddl_Table::TYPE_DECIMAL)
34
+ ->getItems();
35
+
36
+ if (!empty($items)) {
37
+ $this->_options = array('' => Mage::helper('diglin_ricento')->__('-- Select Product Attribute --'));
38
+ }
39
+
40
+ foreach ($items as $item) {
41
+ if ($item->getAttributeCode() != 'price' && $item->getAttributeCode() != 'special_price') {
42
+ continue;
43
+ }
44
+ $this->_options[$item->getAttributeCode()] = $item->getFrontendLabel();
45
+ }
46
+ }
47
+
48
+ return $this->_options;
49
+ }
50
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Product/Condition.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Product_Condition
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Product_Condition extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_articleConditions = array();
21
+
22
+ /**
23
+ * Return options as value => label array
24
+ *
25
+ * @return array
26
+ */
27
+ public function toOptionHash()
28
+ {
29
+ if (empty($this->_articleConditions) && Mage::helper('diglin_ricento')->isConfigured()) {
30
+ $articleConditions = (array)Mage::getSingleton('diglin_ricento/api_services_system')->getArticleConditions();
31
+
32
+ if (!empty($articleConditions)) {
33
+ $this->_articleConditions = array(null => Mage::helper('diglin_ricento')->__('-- Please Select --'));
34
+ };
35
+
36
+ foreach ($articleConditions as $condition) {
37
+ $this->_articleConditions[$condition['ArticleConditionId']] = $condition['ArticleConditionText'];
38
+ }
39
+ }
40
+
41
+ return $this->_articleConditions;
42
+ }
43
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Product/Condition/Source.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Product_Condition_Source
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Product_Condition_Source extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * Return options as value => label array
19
+ *
20
+ * @return array
21
+ */
22
+ public function toOptionHash()
23
+ {
24
+ $helper = Mage::helper('diglin_ricento');
25
+
26
+ return array(
27
+ 'ricardo_condition' => $helper->__('ricardo.ch Condition')
28
+ );
29
+ }
30
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Promotion.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Promotion
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Promotion extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ protected $_promotions = array();
18
+
19
+ /**
20
+ * Return options as value => label array
21
+ *
22
+ * @return array
23
+ */
24
+ public function toOptionHash()
25
+ {
26
+ if (empty($this->_promotions) && Mage::helper('diglin_ricento')->isConfigured()) {
27
+ $promotions = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getPromotions(
28
+ Mage::helper('diglin_ricento')->getJsonDate(), \Diglin\Ricardo\Enums\System\CategoryArticleType::ALL, 1, 1
29
+ );
30
+
31
+ if (empty($promotions)) {
32
+ return array();
33
+ }
34
+
35
+ $websiteId = 0;
36
+ // Listing exists in a context of products listing edition
37
+ $listing = Mage::registry('products_listing');
38
+ if ($listing->getWebsiteId()) {
39
+ $websiteId = $listing->getWebsiteId();
40
+ }
41
+
42
+ $helper = Mage::helper('diglin_ricento/price');
43
+
44
+ $this->_promotions = array(0 => $helper->__('No package'));
45
+
46
+ foreach ($promotions as $promotion) {
47
+ if ($promotion['GroupId'] == \Diglin\Ricardo\Enums\Article\PromotionCode::PREMIUMCATEGORY) {
48
+ $this->_promotions[$promotion['PromotionId']] = $helper->__($promotion['PromotionLabel']) . ' - ' . $helper->formatPrice($promotion['PromotionFee'], $websiteId);
49
+ }
50
+ }
51
+ }
52
+
53
+ return $this->_promotions;
54
+ }
55
+
56
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Reactivation.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Model_Config_Source_Sales_Reactivation extends Diglin_Ricento_Model_Config_Source_Abstract
12
+ {
13
+ const SOLDOUT = 99999;
14
+
15
+ /**
16
+ * @var array
17
+ */
18
+ protected $_partnerConfiguration = array();
19
+
20
+ /**
21
+ * Return options as value => label array
22
+ *
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_partnerConfiguration) && Mage::helper('diglin_ricento')->isConfigured()) {
28
+ $partnerConfiguration = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getPartnerConfigurations();
29
+
30
+ if (isset($partnerConfiguration['MaxRelistCount'])) {
31
+ $this->_partnerConfiguration = range(0, $partnerConfiguration['MaxRelistCount']);
32
+ }
33
+ if (empty($this->_partnerConfiguration)) {
34
+ $this->_partnerConfiguration = array(1);
35
+ }
36
+ }
37
+
38
+ return $this->_partnerConfiguration;
39
+ }
40
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Template.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Template
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Template extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_templates = array();
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_templates) && Mage::helper('diglin_ricento')->isConfigured()) {
28
+ $templates = (array) Mage::getSingleton('diglin_ricento/api_services_selleraccount')->getTemplates();
29
+
30
+ $this->_templates = array('-1' => Mage::helper('diglin_ricento')->__('None'));
31
+ foreach ($templates as $template) {
32
+ $this->_templates[$template['TemplateId']] = $template['TemplateName'];
33
+ }
34
+ }
35
+
36
+ return $this->_templates;
37
+ }
38
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Type.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Type
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Type extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ const AUCTION = 'auction';
18
+ const BUYNOW = 'buynow';
19
+
20
+ /**
21
+ * @return array
22
+ */
23
+ public function toOptionHash()
24
+ {
25
+ $helper = Mage::helper('diglin_ricento');
26
+
27
+ return array(
28
+ '' => $helper->__('-- Please Select --'),
29
+ self::AUCTION => $helper->__('Auction'),
30
+ self::BUYNOW => $helper->__('Buy now')
31
+ );
32
+ }
33
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sales/Warranty.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sales_Warranty
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sales_Warranty extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_warranties = array();
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public function toOptionHash()
26
+ {
27
+ if (empty($this->_warranties) && Mage::helper('diglin_ricento')->isConfigured()) {
28
+ $warranties = (array) Mage::getSingleton('diglin_ricento/api_services_system')->getWarranties();
29
+
30
+ foreach ($warranties as $warranty) {
31
+ $this->_warranties[$warranty['WarrantyId']] = $warranty['WarrantyConditionText'];
32
+ }
33
+ }
34
+
35
+ return $this->_warranties;
36
+ }
37
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Status.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Status
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Status extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * Create option array to display in a form the status of a products listing
19
+ *
20
+ * @return array
21
+ */
22
+ public function getAllOptions()
23
+ {
24
+ $helper = Mage::helper('diglin_ricento');
25
+
26
+ return array(
27
+
28
+ array(
29
+ 'value' => '' ,
30
+ 'label' => $helper->__('-- Please Select --')
31
+ ), // Products are not yet listed into ricardo
32
+ array(
33
+ 'value' => Diglin_Ricento_Helper_Data::STATUS_PENDING,
34
+ 'label' => $helper->__('Pending')
35
+ ), // Products are listed into ricardo and are in progress of sales
36
+ array(
37
+ 'value' => Diglin_Ricento_Helper_Data::STATUS_LISTED,
38
+ 'label' => $helper->__('Listed')
39
+ ), // Products are listed into ricardo and are in progress of sales
40
+ array(
41
+ 'value' => Diglin_Ricento_Helper_Data::STATUS_STOPPED,
42
+ 'label' => $helper->__('Stopped')
43
+ ), // Products are not listed or having been stopped from ricardo
44
+ array(
45
+ 'value' => Diglin_Ricento_Helper_Data::STATUS_ERROR,
46
+ 'label' => $helper->__('Error')
47
+ ),
48
+ array(
49
+ 'value' => Diglin_Ricento_Helper_Data::STATUS_READY,
50
+ 'label' => $helper->__('Ready to list')
51
+ )
52
+ );
53
+ }
54
+
55
+ /**
56
+ * This method is used for the massaction for example
57
+ *
58
+ * @return array
59
+ */
60
+ public function toOptionArray()
61
+ {
62
+ return $this->getAllOptions();
63
+ }
64
+
65
+ /**
66
+ * This method is used for grid filter
67
+ */
68
+ public function toOptionHash()
69
+ {
70
+ $hash = array();
71
+ foreach ($this->getAllOptions() as $option) {
72
+ $hash[$option['value']] = $option['label'];
73
+ }
74
+ unset($hash['']);
75
+ return $hash;
76
+ }
77
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Store.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Store
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Store extends Mage_Adminhtml_Model_System_Store
16
+ {
17
+ /**
18
+ * Retrieve store values for form
19
+ *
20
+ * @param bool $empty
21
+ * @param bool $all
22
+ * @return array
23
+ */
24
+ public function getStoreValuesForForm($empty = false, $all = false)
25
+ {
26
+ $websites = $this->_websiteCollection;
27
+ $websiteId = $this->getWebsiteId();
28
+ if ($websiteId && isset($websites[$websiteId])) {
29
+ $this->_websiteCollection = array($websites[$websiteId]);
30
+ }
31
+
32
+ $stores = parent::getStoreValuesForForm($empty, false);
33
+
34
+ if ($all) {
35
+ array_unshift($stores, array('label' => Mage::helper('catalog')->__('Default Values'), 'value' => 0));
36
+ }
37
+
38
+ return $stores;
39
+ }
40
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Progress.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sync_Progress
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sync_Progress extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @return array
19
+ */
20
+ public function toOptionHash()
21
+ {
22
+ $helper = Mage::helper('diglin_ricento');
23
+
24
+ return array(
25
+ Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING => $helper->__('Pending'),
26
+ Diglin_Ricento_Model_Sync_Job::PROGRESS_RUNNING => $helper->__('Running'),
27
+ Diglin_Ricento_Model_Sync_Job::PROGRESS_READY => $helper->__('Ready'),
28
+ Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED => $helper->__('Completed')
29
+ );
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Status.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sync_Status
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sync_Status extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @return array
19
+ */
20
+ public function toOptionHash()
21
+ {
22
+ $helper = Mage::helper('diglin_ricento');
23
+
24
+ return array(
25
+ Diglin_Ricento_Model_Sync_Job::STATUS_NOTICE => $helper->__('Notice'),
26
+ Diglin_Ricento_Model_Sync_Job::STATUS_SUCCESS => $helper->__('Success'),
27
+ Diglin_Ricento_Model_Sync_Job::STATUS_ERROR => $helper->__('Error'),
28
+ Diglin_Ricento_Model_Sync_Job::STATUS_WARNING => $helper->__('Warning')
29
+ );
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Sync/Type.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Sync_Type
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Sync_Type extends Diglin_Ricento_Model_Config_Source_Abstract
16
+ {
17
+ /**
18
+ * @return array
19
+ */
20
+ public function toOptionHash()
21
+ {
22
+ $helper = Mage::helper('diglin_ricento');
23
+
24
+ return array(
25
+ Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST => $helper->__('Products Check Job'),
26
+ Diglin_Ricento_Model_Sync_Job::TYPE_LIST => $helper->__('List Job'),
27
+ Diglin_Ricento_Model_Sync_Job::TYPE_STOP => $helper->__('Stop List Job'),
28
+ Diglin_Ricento_Model_Sync_Job::TYPE_ORDER => $helper->__('Sync Order Job'),
29
+ //Diglin_Ricento_Model_Sync_Job::TYPE_RELIST => $helper->__('Relist Job'),
30
+ //Diglin_Ricento_Model_Sync_Job::TYPE_UPDATE => $helper->__('Update Job'),
31
+ Diglin_Ricento_Model_Sync_Job::TYPE_SYNCLIST => $helper->__('Sync List Job'),
32
+ );
33
+ }
34
+ }
app/code/community/Diglin/Ricento/Model/Config/Source/Website.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Config_Source_Website
14
+ */
15
+ class Diglin_Ricento_Model_Config_Source_Website extends Mage_Adminhtml_Model_System_Store
16
+ {
17
+ /**
18
+ * @param bool $empty
19
+ * @param bool $all
20
+ * @return array
21
+ */
22
+ public function getWebsiteValuesForForm($empty = false, $all = false)
23
+ {
24
+ $helper = Mage::helper('diglin_ricento');
25
+ $enabledRicentoWebsite = array();
26
+
27
+ foreach ($this->_websiteCollection as $website) {
28
+ if ($helper->isConfigured($website) && $helper->isEnabled($website)) {
29
+ $enabledRicentoWebsite[] = $website;
30
+ }
31
+ }
32
+
33
+ $this->_websiteCollection = $enabledRicentoWebsite;
34
+
35
+ return parent::getWebsiteValuesForForm($empty, $all);
36
+ }
37
+ }
app/code/community/Diglin/Ricento/Model/Cron.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Cron
14
+ */
15
+ class Diglin_Ricento_Model_Cron
16
+ {
17
+ protected $_syncProcess = array(
18
+ //Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST, //** Check list before to sync to ricardo.ch - @deprecated move to Diglin_Ricento_Adminhtml_Products_ListingController to start quickly the check
19
+ Diglin_Ricento_Model_Sync_Job::TYPE_LIST, //** List to ricardo.ch
20
+ Diglin_Ricento_Model_Sync_Job::TYPE_STOP, //** Stop the list on ricardo.ch if needed
21
+ //Diglin_Ricento_Model_Sync_Job::TYPE_RELIST //** Relist to ricardo.ch
22
+ );
23
+
24
+ protected $_asyncProcess = array(
25
+ Diglin_Ricento_Model_Sync_Job::TYPE_SYNCLIST, //** Sync List before getting orders
26
+ Diglin_Ricento_Model_Sync_Job::TYPE_ORDER //** Get new orders
27
+ );
28
+
29
+ /**
30
+ * Process Cron tasks - should be run in a short period of time
31
+ */
32
+ public function process()
33
+ {
34
+ if (!Mage::helper('diglin_ricento')->isEnabled()) {
35
+ return;
36
+ }
37
+
38
+ ini_set('memory_limit', '512M');
39
+
40
+ //** Launch Pending Jobs
41
+
42
+ // @todo check that the API token is not expired or that an error may occur, in this case send only once an email to the admin
43
+
44
+ try {
45
+ foreach ($this->_syncProcess as $jobType) {
46
+ $this->dispatch($jobType);
47
+ }
48
+ } catch (Exception $e) {
49
+ Mage::logException($e);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Process Cron tasks which needs to be run on a longer period of time
55
+ */
56
+ public function async()
57
+ {
58
+ if (!Mage::helper('diglin_ricento')->isEnabled()) {
59
+ return;
60
+ }
61
+
62
+ ini_set('memory_limit', '512M');
63
+
64
+ try {
65
+ foreach ($this->_asyncProcess as $jobType) {
66
+ $this->dispatch($jobType);
67
+ }
68
+ } catch (Exception $e) {
69
+ Mage::logException($e);
70
+ }
71
+
72
+ //** Cleanup
73
+
74
+ $this->_processCleanupJobs();
75
+ }
76
+
77
+ /**
78
+ * Clean old jobs passed on the last X days
79
+ *
80
+ * @return $this
81
+ */
82
+ protected function _processCleanupJobs()
83
+ {
84
+ if (Mage::getStoreConfigFlag(Diglin_Ricento_Helper_Data::CFG_CLEAN_JOBS_ENABLED)) {
85
+ $daysKeep = (int)Mage::getStoreConfig(Diglin_Ricento_Helper_Data::CFG_CLEAN_JOBS_KEEP_DAYS);
86
+
87
+ $jobsCollection = Mage::getResourceModel('diglin_ricento/sync_job_collection');
88
+ $jobsCollection->getSelect()->where('((TO_DAYS(main_table.created_at) + ? < TO_DAYS(now())))', $daysKeep);
89
+
90
+ $jobsCollection->walk('delete');
91
+ }
92
+ return $this;
93
+ }
94
+
95
+ /**
96
+ * @return Diglin_Ricento_Model_Dispatcher
97
+ */
98
+ protected function _getDisptacher()
99
+ {
100
+ return Mage::getSingleton('diglin_ricento/dispatcher');
101
+ }
102
+
103
+ /**
104
+ * @param int $type
105
+ * @return $this
106
+ */
107
+ protected function dispatch($type)
108
+ {
109
+ return $this->_getDisptacher()->dispatch($type)->proceed();
110
+ }
111
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Dispatcher
14
+ */
15
+ class Diglin_Ricento_Model_Dispatcher
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_adapterClass = array();
21
+
22
+ /**
23
+ * Get the dispatcher for a specific type
24
+ *
25
+ * @param string $type
26
+ * @return Diglin_Ricento_Model_Dispatcher_Abstract | boolean
27
+ * @throws Mage_Core_Exception
28
+ */
29
+ public function dispatch ($type)
30
+ {
31
+ $className = $this->getAdapterClassName($type);
32
+
33
+ if (empty($className) || !class_exists($className)) {
34
+ Mage::throwException(Mage::helper('diglin_ricento')->__("The dispatcher of type '%s' is not found at %s.", $type, Diglin_Ricento_Helper_Data::NODE_DISPATCHER_TYPES));
35
+ }
36
+
37
+ $adapter = new $className();
38
+
39
+ if (!($adapter instanceof Diglin_Ricento_Model_Dispatcher_Abstract)) {
40
+ Mage::throwException(Mage::helper('diglin_ricento')->__("Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract.", $className));
41
+ }
42
+
43
+ return $adapter;
44
+ }
45
+
46
+ /**
47
+ * Get adapter class name from config
48
+ *
49
+ * @param string $type
50
+ * @return string
51
+ */
52
+ public function getAdapterClassName ($type)
53
+ {
54
+ if (isset($this->_adapterClass[$type])) {
55
+ return $this->_adapterClass[$type];
56
+ }
57
+
58
+ return $this->_adapterClass[$type] = (string) Mage::getConfig()->getNode(Diglin_Ricento_Helper_Data::NODE_DISPATCHER_TYPES . '/' . $type)->class;
59
+ }
60
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Abstract.php ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Managers\SellerAccount\Parameter\UnsoldArticlesParameter;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Model_Dispatcher_Abstract
16
+ */
17
+ abstract class Diglin_Ricento_Model_Dispatcher_Abstract
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ protected $_limit = 400;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ protected $_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_RUNNING;
28
+
29
+ /**
30
+ * @var Diglin_Ricento_Model_Resource_Products_Listing_Log
31
+ */
32
+ protected $_listingLog;
33
+
34
+ /**
35
+ * @var Diglin_Ricento_Model_Sync_Job
36
+ */
37
+ protected $_currentJob;
38
+
39
+ /**
40
+ * @var Diglin_Ricento_Model_Sync_Job_Listing
41
+ */
42
+ protected $_currentJobListing;
43
+
44
+ /**
45
+ * @var bool
46
+ */
47
+ protected $_jobHasSuccess = false;
48
+
49
+ /**
50
+ * @var bool
51
+ */
52
+ protected $_jobHasError = false;
53
+
54
+ /**
55
+ * @var bool
56
+ */
57
+ protected $_jobHasWarning = false;
58
+
59
+ /**
60
+ * @var string
61
+ */
62
+ protected $_itemStatus;
63
+
64
+ /**
65
+ * @var string
66
+ */
67
+ protected $_itemMessage = null;
68
+
69
+ /**
70
+ * @var int
71
+ */
72
+ protected $_productsListingId;
73
+
74
+ /**
75
+ * @var null
76
+ */
77
+ protected $_jobType = null;
78
+
79
+ /**
80
+ * @var int
81
+ */
82
+ protected $_logType = 0;
83
+
84
+ /**
85
+ * @var int
86
+ */
87
+ protected $_totalProceed = 0;
88
+
89
+ /**
90
+ * @var int
91
+ */
92
+ protected $_totalSuccess = 0;
93
+
94
+ /**
95
+ * @var int
96
+ */
97
+ protected $_totalError = 0;
98
+
99
+ /**
100
+ * @return $this
101
+ */
102
+ public function proceed()
103
+ {
104
+ $this->_runJobs();
105
+ return $this;
106
+ }
107
+
108
+ /**
109
+ * @return mixed
110
+ */
111
+ abstract protected function _proceed();
112
+
113
+ /**
114
+ * @param string $type
115
+ * @param array $progress
116
+ * @return Diglin_Ricento_Model_Resource_Sync_Job_Collection
117
+ */
118
+ protected function _getJobCollection($type, $progress)
119
+ {
120
+ $jobsCollection = Mage::getResourceModel('diglin_ricento/sync_job_collection');
121
+ $jobsCollection
122
+ ->addFieldToFilter('job_type', $type)
123
+ ->addFieldToFilter('progress', array('in' => (array) $progress));
124
+
125
+ return $jobsCollection;
126
+ }
127
+
128
+ /**
129
+ * @return $this
130
+ */
131
+ protected function _startJob()
132
+ {
133
+ $this->_currentJob
134
+ ->setStartedAt(Mage::getSingleton('core/date')->gmtDate())
135
+ ->setProgress($this->_progressStatus)
136
+ ->save();
137
+
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Log
143
+ */
144
+ protected function _getListingLog()
145
+ {
146
+ if (!$this->_listingLog) {
147
+ $this->_listingLog = Mage::getResourceModel('diglin_ricento/products_listing_log');
148
+ }
149
+ return $this->_listingLog;
150
+ }
151
+
152
+ /**
153
+ * @param array $statuses
154
+ * @param null $lastItemId
155
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
156
+ */
157
+ protected function _getItemCollection(array $statuses, $lastItemId = null)
158
+ {
159
+ $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
160
+ $itemCollection
161
+ ->addFieldToFilter('status', array('in' => $statuses))
162
+ ->addFieldToFilter('products_listing_id', array('eq' => $this->_productsListingId))
163
+ ->addFieldToFilter('item_id', array('gt' => (int) $lastItemId));
164
+
165
+ if ($this->_limit) {
166
+ $itemCollection->setPageSize($this->_limit);
167
+ }
168
+
169
+ return $itemCollection;
170
+ }
171
+
172
+ /**
173
+ * @return $this
174
+ */
175
+ protected function _runJobs()
176
+ {
177
+ /**
178
+ * Get all pending jobs of specified type
179
+ * The risk is very low to have for this collection a big quantity of data
180
+ */
181
+ $jobsCollection = $this->_getJobCollection($this->_jobType,
182
+ array(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING, Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING));
183
+
184
+ $helper = $this->_getHelper();
185
+
186
+ try {
187
+ /* @var $job Diglin_Ricento_Model_Sync_Job */
188
+ foreach ($jobsCollection->getItems() as $this->_currentJob) {
189
+
190
+ $message = array();
191
+
192
+ $this->_currentJobListing = Mage::getModel('diglin_ricento/sync_job_listing')->load($this->_currentJob->getId(), 'job_id');
193
+ $this->_productsListingId = (int) $this->_currentJobListing->getProductsListingId();
194
+ $this->_totalProceed = (int) $this->_currentJobListing->getTotalProceed();
195
+
196
+ if (!$this->_productsListingId) {
197
+ return $this;
198
+ }
199
+
200
+ /**
201
+ * We set the status to block any parallel process to execute the same job. In case of recoverable error, the job status is reverted
202
+ */
203
+ if ($this->_currentJob->getProgress() == Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING) {
204
+ $this->_startJob();
205
+ }
206
+
207
+ /**
208
+ * Cleanup in case of running again the same job
209
+ */
210
+ if (!$this->_currentJobListing->getLastItemId()) {
211
+ $this->_getListingLog()->cleanSpecificJob($this->_currentJob->getId());
212
+ }
213
+
214
+ /**
215
+ * All the Magic is here ...
216
+ */
217
+ $start = microtime(true);
218
+ $this->_proceed();
219
+ $end = microtime(true);
220
+
221
+ if ($helper->isDebugEnabled()) {
222
+ Mage::log('Time to run the job id ' . $this->_currentJob->getId() . ' in ' . ($end - $start) . ' sec', Zend_Log::DEBUG, Diglin_Ricento_Helper_Data::LOG_FILE);
223
+ }
224
+
225
+ if ($this->_jobHasError || $this->_currentJob->getJobStatus() == Diglin_Ricento_Model_Sync_Job::STATUS_ERROR) {
226
+ $typeError = $helper->__('errors');
227
+ $jobStatus = Diglin_Ricento_Model_Sync_Job::STATUS_ERROR;
228
+ } else if ($this->_jobHasWarning || $this->_currentJob->getJobStatus() == Diglin_Ricento_Model_Sync_Job::STATUS_WARNING) {
229
+ $typeError = $helper->__('warnings');
230
+ $jobStatus = Diglin_Ricento_Model_Sync_Job::STATUS_WARNING;
231
+ } else {
232
+ $typeError = $helper->__('success');
233
+ $jobStatus = Diglin_Ricento_Model_Sync_Job::STATUS_SUCCESS;
234
+ }
235
+
236
+ /**
237
+ * In case we proceed chunk of data or not
238
+ */
239
+ $endedAt = null;
240
+
241
+ if ($this->_totalProceed >= $this->_currentJobListing->getTotalCount()) {
242
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED;
243
+ $endedAt = Mage::getSingleton('core/date')->gmtDate();
244
+
245
+ $this->_currentJobListing
246
+ ->setLastItemId(null)
247
+ ->setTotalProceed($this->_totalProceed)
248
+ ->save();
249
+
250
+ $completedMessage = $helper->__('The Job has finished with %s.', $typeError);
251
+ if ($this->_jobHasError) {
252
+ $completedMessage .= ' ' . $helper->__('Please, view the <a href="%s">log</a> for details.', $this->_getLogListingUrl());
253
+ }
254
+
255
+ $message[] = $completedMessage;
256
+
257
+ } else {
258
+ $message[] = $this->_currentJob->getJobMessage(true);
259
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING;
260
+ }
261
+
262
+ $statusMessage = $this->_getStatusMessage($jobStatus);
263
+ if (!empty($statusMessage)) {
264
+ $message[] = $statusMessage;
265
+ }
266
+
267
+ $this->_currentJob->getResource()->saveCurrentJob($this->_currentJob->getId(), array(
268
+ 'job_message' => $this->_jsonEncode($message),
269
+ 'job_status' => $jobStatus,
270
+ 'ended_at' => $endedAt,
271
+ 'progress' => $this->_progressStatus,
272
+ ));
273
+
274
+ $this->_proceedAfter();
275
+
276
+ $this->_currentJob = null;
277
+ $this->_currentJobListing = null;
278
+ $this->_itemMessage = null;
279
+ $this->_itemStatus = false;
280
+ $this->_productsListingId = null;
281
+ $this->_totalError = 0;
282
+ $this->_totalProceed = 0;
283
+ $this->_totalSuccess = 0;
284
+ $this->_jobHasError = false;
285
+ $this->_jobHasSuccess = false;
286
+ $this->_jobHasWarning = false;
287
+ }
288
+ } catch (Exception $e) {
289
+ Mage::log("\n" . $e->__toString(), Zend_Log::ERR, Diglin_Ricento_Helper_Data::LOG_FILE);
290
+ $this->_currentJob = (isset($this->_currentJob)) ? $this->_currentJob : null;
291
+ $this->_setJobError($e);
292
+ }
293
+
294
+ unset($jobsCollection);
295
+
296
+ return $this;
297
+ }
298
+
299
+ /**
300
+ * @param string $method
301
+ * @return string
302
+ */
303
+ protected function _getProceedMethod($method)
304
+ {
305
+ return '_proceed' . str_replace(' ', '', ucwords(str_replace('_', ' ', $method)));
306
+ }
307
+
308
+ /**
309
+ * @return Diglin_Ricento_Helper_Data
310
+ */
311
+ protected function _getHelper()
312
+ {
313
+ return Mage::helper('diglin_ricento');
314
+ }
315
+
316
+ /**
317
+ * @return string
318
+ */
319
+ protected function _getNoItemMessage()
320
+ {
321
+ return $this->_getHelper()->__('No item is ready for this job. No action has been done.');
322
+ }
323
+
324
+ /**
325
+ * @param mixed $content
326
+ * @return string
327
+ */
328
+ protected function _jsonEncode($content)
329
+ {
330
+ return Mage::helper('core')->jsonEncode($content);
331
+ }
332
+
333
+ /**
334
+ * We build an url which will be replaced during its display in the log grid cause of issue with secure url key
335
+ *
336
+ * @return string
337
+ */
338
+ protected function _getLogListingUrl()
339
+ {
340
+ return '{{adminhtml url="ricento/log/listing/" _query_id=' . $this->_productsListingId . ' _query_job_id=' . $this->_currentJob->getId() . '}}';
341
+ }
342
+
343
+ /**
344
+ * We build an url which will be replaced during its display in the log grid cause of issue with secure url key
345
+ *
346
+ * @return string
347
+ */
348
+ protected function _getProductListingEditUrl()
349
+ {
350
+ return '{{adminhtml url="ricento/products_listing/edit/" _query_id=' . $this->_productsListingId . '}}';
351
+ }
352
+
353
+ /**
354
+ * We build an url which will be replaced during its display in the log grid cause of issue with secure url key
355
+ *
356
+ * @return string
357
+ */
358
+ protected function _getListUrl()
359
+ {
360
+ return '{{adminhtml url="ricento/products_listing/list/" _query_id=' . $this->_productsListingId . '}}';
361
+ }
362
+
363
+ /**
364
+ * @param $jobStatus
365
+ * @return $this
366
+ */
367
+ protected function _getStatusMessage($jobStatus)
368
+ {
369
+ return '';
370
+ }
371
+
372
+ /**
373
+ * @return $this
374
+ */
375
+ protected function _proceedAfter()
376
+ {
377
+ return $this;
378
+ }
379
+
380
+ /**
381
+ * @param Exception $e
382
+ * @return $this
383
+ */
384
+ protected function _setJobError(Exception $e)
385
+ {
386
+ if (isset($this->_currentJob) && $this->_currentJob instanceof Diglin_Ricento_Model_Sync_Job && $this->_currentJob->getId()) {
387
+ $this->_currentJob
388
+ ->setProgress(Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING)
389
+ ->setJobStatus(Diglin_Ricento_Model_Sync_Job::STATUS_ERROR)
390
+ ->setJobMessage(array($e->__toString()))
391
+ ->save();
392
+ }
393
+ return $this;
394
+ }
395
+
396
+ /**
397
+ * @param Exception $e
398
+ * @param null|Diglin_Ricento_Model_Api_Services_Abstract $lastService
399
+ * @return $this
400
+ */
401
+ protected function _handleException(Exception $e, $lastService = null)
402
+ {
403
+ Mage::log("\n" . $e->__toString(), Zend_Log::ERR, Diglin_Ricento_Helper_Data::LOG_FILE);
404
+
405
+ if ($lastService instanceof Diglin_Ricento_Model_Api_Services_Abstract) {
406
+ Mage::log($lastService->getLastApiDebug(), Zend_Log::DEBUG, Diglin_Ricento_Helper_Data::LOG_FILE);
407
+ }
408
+
409
+ $message = $this->_getHelper()->__($e->getMessage());
410
+ $this->_itemMessage = array('errors' =>
411
+ array(
412
+ $this->_getHelper()->__('Error Code: %d', $e->getCode()),
413
+ function_exists('mb_strcut') ? mb_strcut($message, 0, 1024 * 1024) : $message
414
+ ));
415
+
416
+ $this->_jobHasError = true;
417
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR;
418
+ ++$this->_totalError;
419
+
420
+ return $this;
421
+ }
422
+
423
+ /**
424
+ * @param int $productsListingId
425
+ * @return $this
426
+ */
427
+ public function setProductsListingId($productsListingId)
428
+ {
429
+ $this->_productsListingId = $productsListingId;
430
+ return $this;
431
+ }
432
+
433
+ /**
434
+ * @return int
435
+ */
436
+ public function getProductsListingId()
437
+ {
438
+ return $this->_productsListingId;
439
+ }
440
+
441
+ /**
442
+ * @return Diglin_Ricento_Model_Products_Listing
443
+ */
444
+ protected function _getListing()
445
+ {
446
+ return Mage::getModel('diglin_ricento/products_listing')->load($this->_productsListingId);
447
+ }
448
+
449
+ /**
450
+ * @param $item
451
+ * @return null|Varien_Object
452
+ */
453
+ protected function _getUnsoldArticles($item)
454
+ {
455
+ $article = null;
456
+ $unsoldArticlesParameter = new UnsoldArticlesParameter();
457
+
458
+ $unsoldArticlesParameter
459
+ ->setInternalReferenceFilter($item->getInternalReference())
460
+ ->setMinimumEndDate($this->_getHelper()->getJsonDate(time() - (1 * 24 * 60 * 60)));
461
+
462
+ $articles = $this->_getSellerAccount()->getUnsoldArticles($unsoldArticlesParameter);
463
+ if (count($articles) > 0 && isset($articles[0]) && is_array($articles[0])) {
464
+ $article = $this->_getHelper()->extractData($articles[0]);
465
+ }
466
+
467
+ return $article;
468
+ }
469
+
470
+ /**
471
+ * @return Diglin_Ricento_Model_Api_Services_Selleraccount
472
+ */
473
+ protected function _getSellerAccount()
474
+ {
475
+ return Mage::getSingleton('diglin_ricento/api_services_selleraccount')
476
+ ->setCanUseCache(false)
477
+ ->setCurrentWebsite($this->_getListing()->getWebsiteId());
478
+ }
479
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Check/List.php ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Dispatcher_Check_List
14
+ */
15
+ class Diglin_Ricento_Model_Dispatcher_Check_List extends Diglin_Ricento_Model_Dispatcher_Abstract
16
+ {
17
+ /**
18
+ * @var null
19
+ */
20
+ protected $_limit = null;
21
+
22
+ /**
23
+ * @var int
24
+ */
25
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_CHECK;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST;
31
+
32
+ /**
33
+ * @var int
34
+ */
35
+ protected $_totalSuccess = 0;
36
+
37
+ /**
38
+ * @var int
39
+ */
40
+ protected $_totalWarning = 0;
41
+
42
+ /**
43
+ * @var int
44
+ */
45
+ protected $_totalError = 0;
46
+
47
+ /**
48
+ * @return $this
49
+ */
50
+ protected function _proceed()
51
+ {
52
+ $job = $this->_currentJob;
53
+ $jobListing = $this->_currentJobListing;
54
+ $this->_totalSuccess = $this->_totalWarning = $this->_totalError = 0;
55
+
56
+ /**
57
+ * Status of the collection must be the same as Diglin_Ricento_Model_Resource_Products_Listing_Item::countPendingItems
58
+ */
59
+ $itemCollection = $this->_getItemCollection(
60
+ array(
61
+ Diglin_Ricento_Helper_Data::STATUS_PENDING,
62
+ Diglin_Ricento_Helper_Data::STATUS_ERROR,
63
+ Diglin_Ricento_Helper_Data::STATUS_STOPPED
64
+ ),
65
+ $jobListing->getLastItemId()
66
+ );
67
+
68
+ if ($itemCollection->count() == 0) {
69
+ $job->setJobMessage(array($this->_getNoItemMessage()));
70
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED;
71
+ return $this;
72
+ }
73
+
74
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
75
+ foreach ($itemCollection->getItems() as $item) {
76
+
77
+ try {
78
+ $itemValidator = new Diglin_Ricento_Model_Validate_Products_Item();
79
+
80
+ // Detect which stores to use for each language defined at products listing level
81
+
82
+ $stores = Mage::helper('diglin_ricento')->getStoresFromListing($item->getProductsListingId());
83
+
84
+ /**
85
+ * Profiler on dev environment
86
+ *
87
+ * ~ 56ms / simple product
88
+ * ~ 230ms / configurable product
89
+ * ~ 176ms / grouped product
90
+ */
91
+
92
+ $itemValidator->isValid($item, $stores);
93
+
94
+ $this->_itemMessage = $itemValidator->getMessages();
95
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
96
+
97
+ // item validator doesn't send back success at the moment
98
+ $warnings = $itemValidator->getWarnings();
99
+ $errors = $itemValidator->getErrors();
100
+ if (empty($warnings) && empty($errors)) {
101
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
102
+ $this->_jobHasSuccess = true;
103
+ ++$this->_totalSuccess;
104
+ }
105
+
106
+ if (!empty($warnings)) {
107
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_WARNING;
108
+ $this->_jobHasWarning = true;
109
+ ++$this->_totalWarning;
110
+ }
111
+
112
+ if (!empty($errors)) {
113
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR;
114
+ $this->_jobHasError = true;
115
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_ERROR));
116
+ ++$this->_totalError;
117
+ }
118
+
119
+ if ($this->_itemStatus != Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR) {
120
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_READY));
121
+ }
122
+
123
+ } catch (Exception $e) {
124
+ $this->_handleException($e);
125
+ $e = null;
126
+ // keep going for the next item - no break
127
+ }
128
+
129
+ // Save item information and eventual error messages
130
+
131
+ $this->_getListingLog()->saveLog(array(
132
+ 'job_id' => $job->getId(),
133
+ 'product_title' => $item->getProductTitle(),
134
+ 'products_listing_id' => $this->_productsListingId,
135
+ 'product_id' => $item->getProductId(),
136
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
137
+ 'log_status' => $this->_itemStatus,
138
+ 'log_type' => $this->_logType,
139
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
140
+ ));
141
+
142
+ // Save the current information of the process to allow live display via ajax call
143
+
144
+ $jobListing->saveCurrentJob(array(
145
+ 'total_proceed' => ++$this->_totalProceed,
146
+ 'total_success' => ($jobListing->getTotalSuccess() + $this->_totalSuccess),
147
+ 'total_error' => ($jobListing->getTotalError() + $this->_totalError),
148
+ 'last_item_id' => $item->getId()
149
+ ));
150
+
151
+ $this->_itemMessage = null;
152
+ $this->_itemStatus = null;
153
+ unset($itemValidator);
154
+ }
155
+
156
+ return $this;
157
+ }
158
+
159
+ /**
160
+ * @return $this
161
+ */
162
+ protected function _proceedAfter()
163
+ {
164
+ // Ready to list the product automatically which are ready for that
165
+
166
+ /**
167
+ * Prepare products listing item for configurable products
168
+ */
169
+ $this->_prepareConfigurableProduct();
170
+
171
+ if ($this->_jobHasSuccess && $this->_progressStatus == Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED) {
172
+
173
+ $countReadyItems = Mage::getResourceModel('diglin_ricento/products_listing_item')->coundReadyTolist($this->_productsListingId);
174
+
175
+ $jobList = Mage::getModel('diglin_ricento/sync_job');
176
+ $jobList
177
+ ->setProgress(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING)
178
+ ->setJobType(Diglin_Ricento_Model_Sync_Job::TYPE_LIST)
179
+ ->setJobMessage(array($jobList->getJobMessage(true)))
180
+ ->save();
181
+
182
+ $jobListingList = Mage::getModel('diglin_ricento/sync_job_listing');
183
+ $jobListingList
184
+ ->setProductsListingId($this->_productsListingId)
185
+ ->setTotalCount($countReadyItems)
186
+ ->setTotalProceed(0)
187
+ ->setJobId($jobList->getId())
188
+ ->save();
189
+
190
+ unset($jobList);
191
+ unset($jobListingList);
192
+ }
193
+
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * Create products listing items for configurable product
199
+ *
200
+ * @return $this
201
+ */
202
+ protected function _prepareConfigurableProduct()
203
+ {
204
+ /**
205
+ * Get children products of configurable product
206
+ */
207
+ $collectionListingItemBis = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
208
+ $collectionListingItemBis
209
+ ->addFieldToFilter('parent_product_id', array('notnull' => 1))
210
+ ->addFieldToFilter('status', Diglin_Ricento_Helper_Data::STATUS_READY)
211
+ ->addFieldToFilter('products_listing_id', $this->_productsListingId)
212
+ ->getSelect()
213
+ ->group('parent_product_id');
214
+
215
+ $parentProductIds = $collectionListingItemBis->getColumnValues('parent_product_id');
216
+
217
+ /**
218
+ * Get the list of configurable products
219
+ */
220
+ $collectionListingItem = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
221
+ $collectionListingItem
222
+ ->addFieldToFilter('products_listing_id', $this->_productsListingId)
223
+ ->addFieldToFilter('status', Diglin_Ricento_Helper_Data::STATUS_READY)
224
+ ->getConfigurableProducts();
225
+
226
+ if (count($parentProductIds)) {
227
+ $collectionListingItem->addFieldToFilter('product_id', array('nin' => $parentProductIds));
228
+ }
229
+
230
+ /**
231
+ * Get all products of configurable products for a list
232
+ *
233
+ * @var $item Diglin_Ricento_Model_Products_Listing_Item
234
+ */
235
+ foreach ($collectionListingItem->getItems() as $item)
236
+ {
237
+ /**
238
+ * Get all children products
239
+ */
240
+ $collection = Mage::getResourceModel('catalog/product_collection')
241
+ ->addAttributeToSelect('sku')
242
+ ->addFilterByRequiredOptions()
243
+ ->addFieldToFilter('entity_id', array('in' => $item->getProduct()->getUsedProductIds()));
244
+
245
+ $attributes = $item->getProduct()->getConfigurableAttributes();
246
+
247
+ foreach ($attributes as $attribute) {
248
+ $collection->addAttributeToSelect($attribute->getProductAttribute()->getAttributeCode());
249
+ $collection->addAttributeToFilter($attribute->getProductAttribute()->getAttributeCode(), array('notnull' => 1));
250
+ }
251
+
252
+ foreach ($collection->getItems() as $childProduct) {
253
+
254
+ $configurableChild = array();
255
+
256
+ foreach ($attributes as $attribute) {
257
+
258
+ $productAttribute = $attribute->getProductAttribute();
259
+ $attributeValueId = $childProduct->getData($productAttribute->getAttributeCode());
260
+ if ($attributeValueId) {
261
+
262
+ $priceVariation = array();
263
+ $subtitle = $productAttribute->getFrontendLabel() . ': ';
264
+
265
+ /**
266
+ * Get price variation
267
+ */
268
+ $prices = $attribute->getData('prices');
269
+ foreach ($prices as $price) {
270
+ if ($price['pricing_value'] != 0 && $price['value_index'] == $attributeValueId) {
271
+ $priceVariation = array('pricing_value' => $price['pricing_value'], 'is_percent' => $price['is_percent']);
272
+ break;
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Get attribute label to be used as subtitle
278
+ */
279
+ foreach ($productAttribute->getSource()->getAllOptions() as $option) {
280
+ if ($attributeValueId == $option['value']) {
281
+ $subtitle .= $option['label'];
282
+ }
283
+ }
284
+
285
+ $configurableChild['options'][$attributeValueId] = array_merge(array('subtitle' => $subtitle), $priceVariation);
286
+ }
287
+ }
288
+
289
+ $configurableChild['stock_qty'] = Mage::getModel('cataloginventory/stock_item')->loadByProduct($childProduct->getId())->getQty();
290
+
291
+ /**
292
+ * Save as new products listing item
293
+ */
294
+ $itemChild = clone $item;
295
+ $itemChild
296
+ ->setId(null)
297
+ ->setCreatedAt(Mage::getSingleton('core/date')->gmtDate())
298
+ ->setUpdatedAt(null)
299
+ ->setProductId($childProduct->getId())
300
+ ->setAdditionalData(Mage::helper('core')->jsonEncode($configurableChild))
301
+ ->setParentItemId($item->getId())
302
+ ->setParentProductId($item->getProductId())
303
+ ->save();
304
+ }
305
+ }
306
+
307
+ return $this;
308
+ }
309
+
310
+ /**
311
+ * @param string $jobStatus
312
+ * @return string
313
+ */
314
+ protected function _getStatusMessage($jobStatus)
315
+ {
316
+ $message = '';
317
+ $helper = Mage::helper('diglin_ricento');
318
+ if ($jobStatus != Diglin_Ricento_Model_Sync_Job::STATUS_SUCCESS) {
319
+ $message = $helper->__('Report: %d success, %d warning(s), %d error(s)', $this->_totalSuccess, $this->_totalWarning, $this->_totalError);
320
+ $message .= '<br>';
321
+ $message .= $helper->__('Successful products checked are going to be listed. To force to list products having a warning, please <a href="%s">click here</a>. Products with an error won\'t be synchronized, you have to fix the problem first.', $this->_getListUrl());
322
+ }
323
+ return $message;
324
+ }
325
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/List.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Dispatcher_List
14
+ */
15
+ class Diglin_Ricento_Model_Dispatcher_List extends Diglin_Ricento_Model_Dispatcher_Abstract
16
+ {
17
+ /**
18
+ * @var int
19
+ */
20
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_LIST;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_LIST;
26
+
27
+ /**
28
+ * @return $this
29
+ */
30
+ protected function _proceed()
31
+ {
32
+ $job = $this->_currentJob;
33
+ $jobListing = $this->_currentJobListing;
34
+
35
+ $sell = Mage::getSingleton('diglin_ricento/api_services_sell');
36
+ $sell->setCurrentWebsite($this->_getListing()->getWebsiteId());
37
+
38
+ $insertedArticle = null;
39
+ $hasSuccess = false;
40
+
41
+ /**
42
+ * Status of the collection must be the same as Diglin_Ricento_Model_Resource_Products_Listing_Item::coundReadyTolist
43
+ */
44
+ $itemCollection = $this->_getItemCollection(array(Diglin_Ricento_Helper_Data::STATUS_READY), $jobListing->getLastItemId());
45
+
46
+ if ($itemCollection->count() == 0) {
47
+ $job->setJobMessage(array($this->_getNoItemMessage()));
48
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED;
49
+ return $this;
50
+ }
51
+
52
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
53
+ foreach ($itemCollection->getItems() as $item) {
54
+
55
+ try {
56
+ $articleId = null;
57
+ $isPlanned = false;
58
+
59
+ // We skip insert article with configurable product as we push its associated products
60
+ if ($item->getProduct()->isConfigurableType()) {
61
+ $jobListing->saveCurrentJob(array(
62
+ 'total_proceed' => ++$this->_totalProceed,
63
+ 'last_item_id' => $item->getId()
64
+ ));
65
+ continue;
66
+ }
67
+
68
+ if (!$item->getRicardoArticleId()) {
69
+ $insertedArticle = $sell->insertArticle($item);
70
+ }
71
+
72
+ if (!empty($insertedArticle['PlannedArticleId'])) {
73
+ $articleId = $insertedArticle['PlannedArticleId'];
74
+ $isPlanned = true;
75
+ } else if (!empty($insertedArticle['ArticleId'])) {
76
+ $articleId = $insertedArticle['ArticleId'];
77
+ $isPlanned = false;
78
+ }
79
+
80
+ if (!empty($articleId)) {
81
+ // Must be set at first in case of error
82
+ $item->getResource()->saveCurrentItem($item->getId(), array(
83
+ 'ricardo_article_id' => $articleId,
84
+ 'status' => Diglin_Ricento_Helper_Data::STATUS_LISTED,
85
+ 'is_planned' => (int) $isPlanned,
86
+ 'qty_inventory' => $item->getProductQty()
87
+ ));
88
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
89
+ $this->_itemMessage = array('inserted_article' => $insertedArticle);
90
+ $hasSuccess = true;
91
+ $this->_jobHasSuccess = true;
92
+ ++$this->_totalSuccess;
93
+ } else if ($item->getRicardoArticleId()) {
94
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_NOTICE;
95
+ $this->_itemMessage = array('notice' => $this->_getHelper()->__('This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch'));
96
+ $this->_jobHasSuccess = true;
97
+ ++$this->_totalSuccess;
98
+ // no change needed for the item status
99
+ } else {
100
+ ++$this->_totalError;
101
+ $this->_jobHasError = true;
102
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR;
103
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_ERROR));
104
+ }
105
+ } catch (Exception $e) {
106
+ $this->_handleException($e, $sell);
107
+ $e = null;
108
+ // keep going for the next item - no break
109
+ }
110
+
111
+ /**
112
+ * Save item information and eventual error messages
113
+ */
114
+ $this->_getListingLog()->saveLog(array(
115
+ 'job_id' => $job->getId(),
116
+ 'product_title' => $item->getProductTitle(),
117
+ 'products_listing_id' => $this->_productsListingId,
118
+ 'product_id' => $item->getProductId(),
119
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
120
+ 'log_status' => $this->_itemStatus,
121
+ 'log_type' => $this->_logType,
122
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
123
+ ));
124
+
125
+ /**
126
+ * Save the current information of the process to allow live display via ajax call
127
+ */
128
+ $jobListing->saveCurrentJob(array(
129
+ 'total_proceed' => ++$this->_totalProceed,
130
+ 'total_success' => $this->_totalSuccess, //@todo update with the previous total_success in case of chunk_running
131
+ 'total_error' => $this->_totalError,//@todo update with the previous total_success in case of chunk_running
132
+ 'last_item_id' => $item->getId()
133
+ ));
134
+
135
+ $this->_itemMessage = null;
136
+ $this->_itemStatus = null;
137
+ }
138
+
139
+ if ($hasSuccess) {
140
+ $listing = Mage::getModel('diglin_ricento/products_listing')->load($this->_productsListingId);
141
+ $listing
142
+ ->setStatus(Diglin_Ricento_Helper_Data::STATUS_LISTED)
143
+ ->save();
144
+ }
145
+
146
+ unset($itemCollection);
147
+
148
+ return $this;
149
+ }
150
+
151
+ /**
152
+ * @param string $jobStatus
153
+ * @return string
154
+ */
155
+ protected function _getStatusMessage($jobStatus)
156
+ {
157
+ return Mage::helper('diglin_ricento')->__('Report: %d success, %d error(s)', $this->_totalSuccess, $this->_totalError);
158
+ }
159
+
160
+ /**
161
+ * @return $this
162
+ */
163
+ // protected function _proceedAfter()
164
+ // {
165
+ // /**
166
+ // * Get the children of product listing item to set the correct status of the parent
167
+ // */
168
+ // $itemCollection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
169
+ // $itemCollection
170
+ // ->addFieldToFilter('status', array('in' => Diglin_Ricento_Helper_Data::STATUS_LISTED))
171
+ // ->addFieldToFilter('parent_item_id', array('notnull' => 1))
172
+ // ->addFieldToFilter('products_listing_id', array('eq' => $this->_productsListingId))
173
+ // ->getSelect()->group('parent_item_id');
174
+ //
175
+ // $hash = array();
176
+ // foreach ($itemCollection->getItems() as $item) {
177
+ // if (empty($hash[$item->getParentItemId()])) {
178
+ // Mage::getModel('diglin_ricento/products_listing_item')
179
+ // ->load($item->getParentItemId())
180
+ // ->setStatus(Diglin_Ricento_Helper_Data::STATUS_LISTED)
181
+ // ->save();
182
+ //
183
+ // $hash[$item->getParentItemId()] = true;
184
+ // }
185
+ // }
186
+ //
187
+ // unset($itemCollection);
188
+ // unset($hash);
189
+ //
190
+ // return parent::_proceedAfter();
191
+ // }
192
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Order.php ADDED
@@ -0,0 +1,761 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Managers\SellerAccount\Parameter\SoldArticlesParameter;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Model_Dispatcher_Order
16
+ */
17
+ class Diglin_Ricento_Model_Dispatcher_Order extends Diglin_Ricento_Model_Dispatcher_Abstract
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_ORDER;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_ORDER;
28
+
29
+ /**
30
+ * @return $this
31
+ */
32
+ public function proceed()
33
+ {
34
+ $jobType = Diglin_Ricento_Model_Sync_Job::TYPE_ORDER;
35
+
36
+ $productsListingResource = Mage::getResourceModel('diglin_ricento/products_listing');
37
+
38
+ $readListingConnection = $productsListingResource->getReadConnection();
39
+ $select = $readListingConnection
40
+ ->select()
41
+ ->from($productsListingResource->getTable('diglin_ricento/products_listing'), 'entity_id');
42
+
43
+ $listingIds = $readListingConnection->fetchCol($select);
44
+
45
+ foreach ($listingIds as $listingId) {
46
+ $itemResource = Mage::getResourceModel('diglin_ricento/products_listing_item');
47
+
48
+ $readConnection = $itemResource->getReadConnection();
49
+ $select = $readConnection
50
+ ->select()
51
+ ->from($itemResource->getTable('diglin_ricento/products_listing_item'), 'item_id')
52
+ ->where('products_listing_id = :id AND status = :status AND is_planned = 0');
53
+
54
+ $binds = array('id' => $listingId, 'status' => Diglin_Ricento_Helper_Data::STATUS_LISTED);
55
+ $countListedItems = count($readConnection->fetchAll($select, $binds));
56
+
57
+ if ($countListedItems == 0) {
58
+ continue;
59
+ }
60
+
61
+ /**
62
+ * Check that there is not already running job instead of creating a new one
63
+ */
64
+ Mage::getResourceModel('diglin_ricento/sync_job')->cleanupPendingJob($this->_jobType, $listingId);
65
+
66
+ // pending progress doesn't make sense here as we cleanup before but keep it to be sure everything ok
67
+ $job = Mage::getModel('diglin_ricento/sync_job');
68
+ $job->loadByTypeListingIdProgress($jobType, $listingId, array(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING, Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING));
69
+
70
+ if ($job->getId()) {
71
+ continue;
72
+ }
73
+
74
+ $job
75
+ ->setJobType($jobType)
76
+ ->setProgress(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING)
77
+ ->setJobMessage(array($job->getJobMessage(true)))
78
+ ->save();
79
+
80
+ $jobListing = Mage::getModel('diglin_ricento/sync_job_listing');
81
+ $jobListing
82
+ ->setProductsListingId($listingId)
83
+ ->setTotalCount($countListedItems)
84
+ ->setTotalProceed(0)
85
+ ->setJobId($job->getId())
86
+ ->save();
87
+ }
88
+
89
+ unset($listingIds);
90
+ unset($readListingConnection);
91
+ unset($job);
92
+ unset($jobListing);
93
+
94
+ return parent::proceed();
95
+ }
96
+
97
+ /**
98
+ * @return $this|mixed
99
+ */
100
+ protected function _proceed()
101
+ {
102
+ $article = null;
103
+ $isUnsold = false;
104
+ $jobListing = $this->_currentJobListing;
105
+
106
+ $itemCollection = $this->_getItemCollection(array(Diglin_Ricento_Helper_Data::STATUS_LISTED), $jobListing->getLastItemId());
107
+ $itemCollection->addFieldToFilter('is_planned', 0);
108
+
109
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
110
+ foreach ($itemCollection->getItems() as $item) {
111
+
112
+ try {
113
+ $sold = $this->getSoldArticles(array($item->getRicardoArticleId()), $item);
114
+
115
+ if (!$sold) {
116
+ $article = $this->_getUnsoldArticles($item);
117
+ if (!is_null($article)) {
118
+ $isUnsold = true;
119
+ }
120
+ }
121
+
122
+ } catch (Exception $e) {
123
+ $this->_handleException($e, Mage::getSingleton('diglin_ricento/api_services_selleraccount'));
124
+ $e = null;
125
+ // keep going for the next item - no break
126
+ }
127
+
128
+ if ($article && $article->getArticleId() && $isUnsold) {
129
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
130
+ $this->_itemMessage = array('success' => $this->_getHelper()->__('Sorry, the product has not been sold'));
131
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_STOPPED, 'is_planned' => 0, 'ricardo_article_id' => $article->getArticleId()));
132
+ }
133
+
134
+ /**
135
+ * Save item information and eventual error messages
136
+ */
137
+ if (!is_null($this->_itemMessage)) {
138
+ $this->_getListingLog()->saveLog(array(
139
+ 'job_id' => $this->_currentJob->getId(),
140
+ 'product_title' => $item->getProductTitle(),
141
+ 'products_listing_id' => $this->_productsListingId,
142
+ 'product_id' => $item->getProductId(),
143
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
144
+ 'log_status' => $this->_itemStatus,
145
+ 'log_type' => $this->_logType,
146
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
147
+ ));
148
+ }
149
+
150
+ /**
151
+ * Save the current information of the process to allow live display via ajax call
152
+ */
153
+ $jobListing->saveCurrentJob(array(
154
+ 'total_proceed' => ++$this->_totalProceed,
155
+ 'last_item_id' => $item->getId()
156
+ ));
157
+
158
+ $this->_itemMessage = null;
159
+ $this->_itemStatus = null;
160
+ }
161
+
162
+ unset($itemCollection);
163
+
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * @param array $articleIds
169
+ * @param Diglin_Ricento_Model_Products_Listing_Item $productItem
170
+ * @return bool
171
+ * @throws Exception
172
+ */
173
+ public function getSoldArticles($articleIds = array(), Diglin_Ricento_Model_Products_Listing_Item $productItem = null)
174
+ {
175
+ $soldArticlesParameter = new SoldArticlesParameter();
176
+
177
+ /**
178
+ * Set minimum end date to filter e.g. last day. Do not use a higher value as the minimum sales duration is 1 day,
179
+ * we prevent to have conflict with several sold articles having similar internal reference
180
+ */
181
+ $soldArticlesParameter
182
+ ->setPageSize($this->_limit) // if not defined, default is 10
183
+ ->setArticleIdsFilter($articleIds)
184
+ ->setMinimumEndDate($this->_getHelper()->getJsonDate(time() - (3 * 24 * 60 * 60)));
185
+
186
+ $sellerAccountService = Mage::getSingleton('diglin_ricento/api_services_selleraccount')->setCanUseCache(false);
187
+ $sellerAccountService->setCurrentWebsite($this->_getListing()->getWebsiteId());
188
+
189
+ $soldArticles = $sellerAccountService->getSoldArticles($soldArticlesParameter);
190
+
191
+ $soldArticles = array_reverse($soldArticles);
192
+
193
+ foreach ($soldArticles as $soldArticle) {
194
+
195
+ $rawData = $soldArticle;
196
+ $soldArticle = $this->_getHelper()->extractData($soldArticle);
197
+ $transaction = $soldArticle->getTransaction();
198
+
199
+ $listing = $this->_getListing();
200
+
201
+ if ($transaction && count($transaction) > 0) {
202
+
203
+ /**
204
+ * 1. Check that the transaction doesn't already exists
205
+ */
206
+ $salesTransaction = Mage::getModel('diglin_ricento/sales_transaction')
207
+ ->load($transaction->getBidId(), 'bid_id');
208
+
209
+ if ($salesTransaction->getId()) {
210
+ continue;
211
+ }
212
+
213
+ /**
214
+ * 2. Check if the products listing item exists and is listed
215
+ */
216
+ $references = $soldArticle->getArticleInternalReferences();
217
+ if (!isset($references[0]['InternalReferenceValue'])) {
218
+ continue;
219
+ }
220
+ $extractedInternReference = Mage::helper('diglin_ricento')->extractInternalReference($references[0]['InternalReferenceValue']);
221
+
222
+ if (!($extractedInternReference instanceof Varien_Object)) {
223
+ continue;
224
+ }
225
+
226
+ if (is_null($productItem) || $productItem->getId() != $extractedInternReference->getItemId()) {
227
+ $productItem = Mage::getModel('diglin_ricento/products_listing_item')->load($extractedInternReference->getItemId());
228
+ }
229
+
230
+ if (!$productItem->getId() || $productItem->getStatus() != Diglin_Ricento_Helper_Data::STATUS_LISTED) {
231
+ continue;
232
+ }
233
+
234
+ /**
235
+ * 3. Create customer if not exist and set his default billing address
236
+ */
237
+ $customer = $this->_getCustomer($transaction->getBuyer(), $listing->getWebsiteId());
238
+ $buyerAddress = $transaction->getBuyer()->getAddresses();
239
+
240
+ if ($customer) {
241
+
242
+ $address = $customer->getDefaultBillingAddress();
243
+
244
+ $street = $buyerAddress->getAddress1() . ' ' . $buyerAddress->getStreetNumber()
245
+ . (($buyerAddress->getAddress2()) ? "\n" . $buyerAddress->getAddress2() : '')
246
+ . (($buyerAddress->getPostalBox()) ? "\n" . $buyerAddress->getPostalBox() : '');
247
+
248
+ $postCode = $buyerAddress->getZipCode();
249
+ $city = $buyerAddress->getCity();
250
+
251
+ if (!$address || ($address->getCity() != $city && $address->getPostcode() != $postCode && $address->getStreet() != $street)) {
252
+
253
+ /**
254
+ * Ricardo API doesn't provide the region and Magento 1.6 doesn't allow to make region optional
255
+ * We use the first region found for the current country but it's far to be good
256
+ * @todo add a "other" region into each country having required region
257
+ */
258
+ $countryId = $this->_getCountryId($buyerAddress->getCountry());
259
+ $regionId = null;
260
+ if (Mage::helper('directory')->isRegionRequired($countryId)) {
261
+ $regionId = Mage::getModel('directory/region')->getCollection()
262
+ ->addFieldToFilter('country_id', $countryId)
263
+ ->getFirstItem()
264
+ ->getId();
265
+ }
266
+
267
+ $phone = ($transaction->getBuyer()->getPhone()) ? $transaction->getBuyer()->getPhone() : $transaction->getBuyer()->getMobile();
268
+
269
+ $address = Mage::getModel('customer/address');
270
+ $address
271
+ ->setCustomerId($customer->getId())
272
+ ->setCompany($transaction->getBuyer()->getCompanyName())
273
+ ->setLastname($customer->getLastname())
274
+ ->setFirstname($customer->getFirstname())
275
+ ->setStreet($street)
276
+ ->setPostcode($postCode)
277
+ ->setCity($city)
278
+ ->setRegionId($regionId)
279
+ ->setCountryId($countryId)
280
+ ->setTelephone($phone)
281
+ ->setIsDefaultBilling(true)
282
+ ->setIsDefaultShipping(true)
283
+ ->setSaveInAddressBook(1)
284
+ ->save();
285
+
286
+ $customer->addAddress($address);
287
+ }
288
+ } else {
289
+ Mage::log($transaction->getBuyer(), Zend_Log::ERR, Diglin_Ricento_Helper_Data::LOG_FILE);
290
+ throw new Exception($this->_getHelper()->__('Customer creation failed! Ricardo transaction cannot be added.'));
291
+ }
292
+
293
+ /**
294
+ * 4. Prepare data transaction
295
+ */
296
+ $lang = $this->_getHelper()->getLocalCodeFromRicardoLanguageId($soldArticle->getMainLanguageId());
297
+ $shippingDescription = $productItem->getShippingPaymentRule()->getShippingDescription($lang);
298
+ $paymentDescription = $productItem->getShippingPaymentRule()->getPaymentDescription($lang);
299
+
300
+ /**
301
+ * 5. Insert transaction into DB for future use
302
+ */
303
+ $salesTransaction = Mage::getModel('diglin_ricento/sales_transaction');
304
+ $salesTransaction
305
+ ->setBidId($transaction->getBidId())
306
+ ->setWebsiteId($listing->getWebsiteId())
307
+ ->setCustomerId($customer->getId())
308
+ ->setAddressId($address->getId())
309
+ ->setRicardoCustomerId($customer->getRicardoId())
310
+ ->setRicardoArticleId($soldArticle->getArticleId())
311
+ ->setQty($transaction->getBuyerQuantity())
312
+ ->setViewCount($soldArticle->getViewCount())
313
+ ->setShippingFee($soldArticle->getDeliveryCost())
314
+ ->setShippingText($soldArticle->getDeliveryText()) // @fixme - if bought in FR and the API use the DE key, text will in DE. I have no efficient solution now
315
+ ->setShippingMethod($soldArticle->getDeliveryId())
316
+ ->setShippingCumulativeFee((int)$soldArticle->getIsCumulativeShipping())
317
+ ->setLanguageId($soldArticle->getMainLanguageId())
318
+ ->setShippingDescription($shippingDescription)
319
+ ->setPaymentMethods(implode(',', $soldArticle->getPaymentMethodIds()->getData()))
320
+ ->setPaymentDescription($paymentDescription)
321
+ ->setTotalBidPrice($soldArticle->getWinningBidPrice())
322
+ ->setProductId($extractedInternReference->getProductId())
323
+ ->setRawData(Mage::helper('core')->jsonEncode($rawData))
324
+ ->setSoldAt($this->_getHelper()->getJsonTimestamp($soldArticle->getEndDate()))
325
+ ->save();
326
+
327
+ /**
328
+ * 6. Decrease the quantity at products listing item level and stop if needed
329
+ */
330
+ $productItem
331
+ ->setQtyInventory($productItem->getQtyInventory() - $salesTransaction->getQty());
332
+
333
+ if ($productItem->getQtyInventory() <= 0) {
334
+ $productItem->setRicardoArticleId(null);
335
+ $productItem->setStatus(Diglin_Ricento_Helper_Data::STATUS_STOPPED);
336
+ }
337
+
338
+ $productItem->save();
339
+
340
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
341
+ $this->_itemMessage = array('success' => $this->_getHelper()->__('The product has been sold'));
342
+ }
343
+ }
344
+
345
+ unset($salesTransaction);
346
+ unset($soldArticlesParameter);
347
+ unset($sellerAccountService);
348
+ unset($soldArticles);
349
+ unset($productItem);
350
+ unset($customer);
351
+
352
+ if ($this->_itemStatus == Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS) {
353
+ return true;
354
+ }
355
+
356
+ return false;
357
+ }
358
+
359
+ /**
360
+ * Find or create customer if needed based on ricardo data
361
+ *
362
+ * @param Varien_Object $buyer
363
+ * @param int $websiteId
364
+ * @return bool|Mage_Customer_Model_Customer
365
+ */
366
+ protected function _getCustomer(Varien_Object $buyer, $websiteId = Mage_Core_Model_App::ADMIN_STORE_ID)
367
+ {
368
+ if (!$buyer->getBuyerId()) {
369
+ return false;
370
+ }
371
+
372
+ $storeId = $this->_getStoreId($websiteId);
373
+
374
+ /* @var $customer Mage_Customer_Model_Customer */
375
+ $customer = Mage::getModel('customer/customer')
376
+ ->setWebsiteId($websiteId)
377
+ ->loadByEmail($buyer->getEmail());
378
+
379
+ if (!$customer->getId()) {
380
+ $customer
381
+ ->setFirstname($buyer->getFirstName())
382
+ ->setLastname($buyer->getLastName())
383
+ ->setEmail($buyer->getEmail())
384
+ ->setPassword($customer->generatePassword())
385
+ ->setStoreId($storeId)
386
+ ->setWebsiteId($websiteId)
387
+ ->setConfirmation(null);
388
+ }
389
+
390
+ if (!$customer->getRicardoId()) {
391
+ $customer
392
+ ->setRicardoId($buyer->getBuyerId())
393
+ ->setRicardoUsername($buyer->getNickName());
394
+ }
395
+
396
+ if ($customer->hasDataChanges()) {
397
+ $customer->save();
398
+ }
399
+
400
+ Mage::app()->getLocale()->emulate($storeId);
401
+
402
+ if ($customer->isObjectNew() && Mage::getStoreConfigFlag(Diglin_Ricento_Helper_Data::CFG_ACCOUNT_CREATION_EMAIL, $storeId)) {
403
+ if ($customer->isConfirmationRequired()) {
404
+ $typeEmail = 'confirmation';
405
+ } else {
406
+ $typeEmail = 'registered';
407
+ }
408
+ $customer->sendNewAccountEmail($typeEmail, '', $storeId);
409
+ }
410
+
411
+ Mage::app()->getLocale()->revert();
412
+
413
+ return $customer;
414
+ }
415
+
416
+ /**
417
+ * Create new orders for transactions done more than 30 min in past
418
+ *
419
+ * @return $this
420
+ */
421
+ protected function _proceedAfter()
422
+ {
423
+ $customerTransactions = array();
424
+ $mergeOrder = Mage::getStoreConfigFlag(Diglin_Ricento_Helper_Data::CFG_MERGE_ORDER);
425
+
426
+ $delay = ($mergeOrder) ? 30 : 1;
427
+
428
+ /**
429
+ * Get transaction older than 30 or 1 minutes and when no order was created
430
+ * Those will be merged in one order if the customer is the same
431
+ */
432
+ $transactionCollection = Mage::getResourceModel('diglin_ricento/sales_transaction_collection');
433
+ $transactionCollection
434
+ ->getSelect()
435
+ ->where('order_id IS NULL')
436
+ ->where('UNIX_TIMESTAMP(sold_at) + ( ? * 60) < UNIX_TIMESTAMP(now())', (int) $delay); // 30 or 1 min past
437
+
438
+ $inc = 0;
439
+ foreach ($transactionCollection->getItems() as $transactionItem) {
440
+ if ($mergeOrder) {
441
+ $customerTransactions[$transactionItem->getCustomerId()][] = $transactionItem;
442
+ } else {
443
+ $customerTransactions[++$inc] = $transactionItem;
444
+ }
445
+ }
446
+
447
+ /**
448
+ * Create new order for each customer
449
+ */
450
+ if (count($customerTransactions) > 0) {
451
+ foreach ($customerTransactions as $transactions) {
452
+ if (!is_array($transactions)) {
453
+ $transactions = array($transactions);
454
+ }
455
+ $this->createNewOrder($transactions);
456
+ }
457
+ }
458
+
459
+ if ($this->_productsListingId) {
460
+ /**
461
+ * Set the status to stop of products having parent and when all other children are stopped
462
+ */
463
+ $itemResource = Mage::getResourceModel('diglin_ricento/products_listing_item');
464
+ $itemResource->setParentStatusStop($this->_productsListingId);
465
+
466
+ /**
467
+ * Stop the list if all products listing items are stopped
468
+ */
469
+ $listResource = Mage::getResourceModel('diglin_ricento/products_listing');
470
+ $listResource->setStatusStop($this->_productsListingId);
471
+ }
472
+
473
+ unset($transactionCollection);
474
+ unset($customerTransactions);
475
+
476
+ return $this;
477
+ }
478
+
479
+ /**
480
+ * @param array $transactions
481
+ */
482
+ public function createNewOrder($transactions)
483
+ {
484
+ $quote = null;
485
+ $dispatchedTransactions = array();
486
+ $storeId = $shippingTransactionMethod = $shippingMethodFee = $highestShippingFee = 0;
487
+ $shippingText = $shippingDescription = '';
488
+ $paymentMethod = $shippingMethod = Diglin_Ricento_Model_Sales_Method_Payment::PAYMENT_CODE;
489
+
490
+ try {
491
+ /**
492
+ * If a customer ordered several articles of the same seller in a short period of time
493
+ * the order will merge all articles.
494
+ */
495
+
496
+ /* @var $transaction Diglin_Ricento_Model_Sales_Transaction */
497
+ foreach ($transactions as $transaction) {
498
+
499
+ $storeId = $this->_getStoreId($transaction->getWebsiteId());
500
+
501
+ Mage::app()->getLocale()->emulate($storeId);
502
+
503
+ /**
504
+ * 1. Init Quote and define customer and his address
505
+ */
506
+ if (is_null($quote)) {
507
+ $quote = Mage::getModel('sales/quote');
508
+ $quote->setStoreId($storeId);
509
+
510
+ $customerId = $transaction->getCustomerId();
511
+ $customer = Mage::getModel('customer/customer')->load($customerId);
512
+
513
+ $address = Mage::getModel('customer/address')->load($transaction->getAddressId());
514
+ $address->setCustomer($customer);
515
+
516
+ $quoteAddress = Mage::getModel('sales/quote_address');
517
+ $quoteAddress->importCustomerAddress($address);
518
+
519
+ $quote->assignCustomerWithAddressChange($customer, $quoteAddress, $quoteAddress);
520
+ $quote->getBillingAddress()->setPaymentMethod($paymentMethod);
521
+ }
522
+
523
+ /**
524
+ * 2. Add product and its information to the quote
525
+ */
526
+ $infoBuyRequest = new Varien_Object();
527
+ $infoBuyRequest
528
+ ->setQty($transaction->getQty())
529
+ ->setIsRicardo(true)
530
+ ->setRicardoTransactionId($transaction->getId())
531
+ ->setShippingCumulativeFee($transaction->getShippingCumulativeFee())
532
+ ->setShippingFee($transaction->getShippingFee());
533
+
534
+
535
+ $product = Mage::getModel('catalog/product')
536
+ ->setStoreId($storeId)
537
+ ->load($transaction->getProductId())
538
+ ->setSkipCheckRequiredOption(true);
539
+
540
+ if (!$product->getId()) {
541
+ continue;
542
+ }
543
+
544
+ $quoteItem = $quote->addProduct($product, $infoBuyRequest);
545
+
546
+ // Error with a product which is missing or have required options
547
+ if (is_string($quoteItem)) {
548
+ Mage::throwException($quoteItem); // @todo - do we really want to block the process at this level? Other solution to inform about the error?
549
+ }
550
+
551
+ $quoteItem
552
+ // Set unit custom price
553
+ ->setCustomPrice($transaction->getTotalBidPrice())
554
+ ->setOriginalCustomPrice($transaction->getTotalBidPrice());
555
+
556
+ /**
557
+ * 3. Set shipping information, price, etc
558
+ */
559
+ $shippingText = $transaction->getShippingText(); // @todo provide correct language
560
+ $shippingDescription = $transaction->getShippingDescription(); // @todo get shipping description in correct language
561
+
562
+ /**
563
+ * 4. Keep the complete transactions list for later use
564
+ */
565
+ $dispatchedTransactions[$transaction->getBidId()] = $transaction->getId();
566
+ }
567
+
568
+ if ($quote) {
569
+ /**
570
+ * Define payment method and related information
571
+ */
572
+ $quote
573
+ ->setIsRicardo(1)
574
+ ->setQuoteCurrencyCode(Mage::getStoreConfig(Diglin_Ricento_Helper_Data::PAYMENT_CURRENCY));
575
+
576
+ $payment = $quote->getPayment();
577
+ $payment->importData(array(
578
+ 'method' => $paymentMethod,
579
+ 'additional_data' => Mage::helper('core')->jsonEncode(array(
580
+ 'is_ricardo' => true,
581
+ 'ricardo_payment_methods' => $transaction->getPaymentMethods(),
582
+ 'ricardo_transaction_ids' => implode(',', $dispatchedTransactions),
583
+ 'ricardo_bid_ids' => implode(',', array_keys($dispatchedTransactions)),
584
+ )
585
+ )));
586
+
587
+ /**
588
+ * Set Shipping information and price
589
+ * @see Diglin_Ricento_Model_Sales_Method_Shipping::collectRates
590
+ */
591
+ Mage::getSingleton('core/session')
592
+ ->setRicardoShippingDescription($shippingText . "\n" . $shippingDescription)
593
+ ->setRicardoShippingMethod($shippingTransactionMethod);
594
+
595
+ $shipping = $quote->getShippingAddress();
596
+ $shipping->setShippingMethod($shippingMethod . '_' . $shippingTransactionMethod);
597
+
598
+ $sendCustomerNotification = Mage::getStoreConfigFlag(Diglin_Ricento_Helper_Data::CFG_ORDER_CREATION_EMAIL, $storeId);
599
+
600
+ $quote->addData(array(
601
+ 'customer_note_notify' => false,
602
+ 'customer_note' => $this->_getHelper()->__('Order automatically generated by the Ricardo Extension.'))
603
+ );
604
+
605
+ $quote->collectTotals()->save();
606
+
607
+ if ($quote->getId()) {
608
+ // Session variables needed to create order
609
+ $this->_getSession()
610
+ ->setQuoteId($quote->getId())
611
+ ->setStoreId($quote->getStoreId())
612
+ ->setCustomer($quote->getCustomer())
613
+ ->setCustomerId($quote->getCustomer()->getId());
614
+
615
+ /* @var $order Mage_Sales_Model_Order */
616
+ $order = $this->_getOrderCreateModel()
617
+ ->initRuleData()
618
+ ->collectShippingRates()
619
+ ->setSendConfirmation($sendCustomerNotification)
620
+ ->createOrder();
621
+
622
+ /**
623
+ * Define order status
624
+ */
625
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Diglin_Ricento_Helper_Data::ORDER_STATUS_PENDING, $this->_getHelper()->__('Payment is pending'), false);
626
+
627
+ // @fixme getIsTransactionCompleted or getIsTransactionCancelled has no value from ricardo.ch side at the moment, wait API update
628
+ // $rawData = $this->_getHelper()->extractData(Mage::helper('core')->jsonDecode($transaction->getRawData()));
629
+ // if ($rawData->getTransaction()->getIsTransactionCompleted()) {
630
+ // $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $this->_getHelper()->__('Payment has been completed on ricardo.ch side'), false);
631
+ // }
632
+ //
633
+ // if ($rawData->getTransaction()->getIsTransactionCancelled()) {
634
+ // $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, Diglin_Ricento_Helper_Data::ORDER_STATUS_CANCEL, $this->_getHelper()->__('Order canceled on ricardo.ch side'), false);
635
+ // }
636
+
637
+ $quote->setIsActive(false)
638
+ ->save();
639
+
640
+ /**
641
+ * Save the new order id to the ricardo transaction
642
+ */
643
+ foreach ($transactions as $transaction) {
644
+ $transaction
645
+ ->setOrderId($order->getId())
646
+ ->save();
647
+ }
648
+ }
649
+
650
+ Mage::app()->getLocale()->revert();
651
+ }
652
+ } catch (Exception $e) {
653
+ // We store and send the exception but don't block the rest of the process
654
+ Mage::log("\n" . $e->__toString(), Zend_Log::ERR, Diglin_Ricento_Helper_Data::LOG_FILE);
655
+ Mage::helper('diglin_ricento/tools')->sendAdminNotification($e->__toString());
656
+
657
+ /* @var $errors Mage_Core_Model_Message_Collection */
658
+ $errors = $this->_getSession()->getMessages(true);
659
+ if ($errors) {
660
+ Mage::log($errors, Zend_Log::ERR, Diglin_Ricento_Helper_Data::LOG_FILE);
661
+ }
662
+
663
+ // Deactivate the last quote if a problem occur to prevent cart display in frontend to the customer
664
+ $quote = $this->_getSession()->getQuote();
665
+ $quote->setIsActive(false)
666
+ ->setReservedOrderId(NULL)
667
+ ->save();
668
+
669
+ if (Mage::app()->getStore()->isAdmin()) {
670
+ Mage::app()->getLocale()->revert();
671
+ }
672
+ }
673
+
674
+ // force to cleanup model, session and rule_data for the next orders to generate otherwise conflicts will occur
675
+ Mage::unregister('_singleton/adminhtml/sales_order_create');
676
+ Mage::unregister('_singleton/adminhtml/session_quote');
677
+ Mage::unregister('rule_data');
678
+ }
679
+
680
+ /**
681
+ * Retrieve session object
682
+ *
683
+ * @return Mage_Adminhtml_Model_Session_Quote
684
+ */
685
+ protected function _getSession()
686
+ {
687
+ return Mage::getSingleton('adminhtml/session_quote');
688
+ }
689
+
690
+ /**
691
+ * Retrieve order create model
692
+ *
693
+ * @return Mage_Adminhtml_Model_Sales_Order_Create
694
+ */
695
+ protected function _getOrderCreateModel()
696
+ {
697
+ return Mage::getSingleton('adminhtml/sales_order_create');
698
+ }
699
+
700
+ /**
701
+ * @param $countryRicardoId
702
+ * @return string
703
+ * @throws Exception
704
+ */
705
+ protected function _getCountryId($countryRicardoId)
706
+ {
707
+ $countryName = '';
708
+ $countries = Mage::getSingleton('diglin_ricento/api_services_system')
709
+ ->setCurrentWebsite($this->_getListing()->getWebsiteId())
710
+ ->getCountries();
711
+
712
+ foreach ($countries as $country) {
713
+ if ($country['CountryId'] == $countryRicardoId) {
714
+ $countryName = $country['CountryName'];
715
+ break;
716
+ }
717
+ }
718
+
719
+ $code = $this->_translateCountryNameToCode($countryName);
720
+ if (!$code) {
721
+ throw new Exception(Mage::helper('diglin_ricento')->__('Country Code is not available. Please contact the author of this extension or support.'));
722
+ }
723
+ $directory = Mage::getModel('directory/country')->loadByCode($code);
724
+ return $directory->getCountryId();
725
+ }
726
+
727
+ /**
728
+ * VERY TEMPORARY SOLUTION until ricardo provide an API method to get the correct value
729
+ * @todo remove it as soon the API has implemented the method to get it
730
+ *
731
+ * @param $countryName
732
+ * @return string
733
+ */
734
+ protected function _translateCountryNameToCode($countryName)
735
+ {
736
+ $countryCode = array(
737
+ 'Schweiz' => 'CH',
738
+ 'Suisse' => 'CH',
739
+ 'Liechtenstein' => 'LI', // ok for both lang
740
+ 'Österreich' => 'AT',
741
+ 'Autriche' => 'AT',
742
+ 'Deutschland' => 'DE',
743
+ 'Allemagne' => 'DE',
744
+ 'Frankreich' => 'FR',
745
+ 'France' => 'FR',
746
+ 'Italien' => 'IT',
747
+ 'Italie' => 'IT',
748
+ );
749
+
750
+ return (isset($countryCode[$countryName])) ? $countryCode[$countryName] : false;
751
+ }
752
+
753
+ /**
754
+ * @param int $websiteId
755
+ * @return int
756
+ */
757
+ protected function _getStoreId($websiteId)
758
+ {
759
+ return Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
760
+ }
761
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Relist.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Dispatcher_Relist
14
+ */
15
+ class Diglin_Ricento_Model_Dispatcher_Relist extends Diglin_Ricento_Model_Dispatcher_Abstract
16
+ {
17
+ /**
18
+ * @var int
19
+ */
20
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_RELIST;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_RELIST;
26
+
27
+ /**
28
+ * @return $this
29
+ * @deprecated since 1.0
30
+ * @todo Relist is not used as we list again instead of relist, keep it at the moment
31
+ */
32
+ protected function _proceed()
33
+ {
34
+ $job = $this->_currentJob;
35
+ $jobListing = $this->_currentJobListing;
36
+
37
+ $sell = Mage::getSingleton('diglin_ricento/api_services_sell');
38
+ $sell->setCurrentWebsite($this->_getListing()->getWebsiteId());
39
+
40
+ $relistedArticle = null;
41
+ $articleId = null;
42
+ $hasSuccess = false;
43
+
44
+ $itemCollection = $this->_getItemCollection(array(Diglin_Ricento_Helper_Data::STATUS_SOLD), $jobListing->getLastItemId());
45
+
46
+ if ($itemCollection->count() == 0) {
47
+ $job->setJobMessage(array($this->_getNoItemMessage()));
48
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED;
49
+ return $this;
50
+ }
51
+
52
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
53
+ foreach ($itemCollection->getItems() as $item) {
54
+
55
+ try {
56
+ $relistedArticle = $sell->relistArticle($item);
57
+
58
+ $articleId = $item->getRicardoArticleId();
59
+ if (!empty($articleId)) {
60
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
61
+ $this->_itemMessage = array('relisted_article' => print_r($relistedArticle, true));
62
+ $hasSuccess = true;
63
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_LISTED));
64
+ } else {
65
+ $this->_jobHasError = true;
66
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR;
67
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_ERROR));
68
+ }
69
+
70
+ } catch (Exception $e) {
71
+ $this->_handleException($e);
72
+ $e = null;
73
+ // keep going for the next item - no break
74
+ }
75
+
76
+ /**
77
+ * Save item information and eventual error messages
78
+ */
79
+ $this->_getListingLog()->saveLog(array(
80
+ 'job_id' => $job->getId(),
81
+ 'product_title' => $item->getProductTitle(),
82
+ 'products_listing_id' => $this->_productsListingId,
83
+ 'product_id' => $item->getProductId(),
84
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
85
+ 'log_status' => $this->_itemStatus,
86
+ 'log_type' => $this->_logType,
87
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
88
+ ));
89
+
90
+ /**
91
+ * Save the current information of the process to allow live display via ajax call
92
+ */
93
+ $jobListing->saveCurrentJob(array(
94
+ 'total_proceed' => ++$this->_totalProceed,
95
+ 'total_success' => ($jobListing->getTotalSuccess() + $this->_totalSuccess),
96
+ 'total_error' => ($jobListing->getTotalError() + $this->_totalError),
97
+ 'last_item_id' => $item->getId()
98
+ ));
99
+
100
+ $this->_itemMessage = null;
101
+ $this->_itemStatus = null;
102
+ }
103
+
104
+ if ($hasSuccess) {
105
+ $listing = Mage::getModel('diglin_ricento/products_listing')->load($this->_productsListingId);
106
+ $listing
107
+ ->setStatus(Diglin_Ricento_Helper_Data::STATUS_LISTED)
108
+ ->save();
109
+ }
110
+
111
+ return $this;
112
+ }
113
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Stop.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Dispatcher_Stop
14
+ */
15
+ class Diglin_Ricento_Model_Dispatcher_Stop extends Diglin_Ricento_Model_Dispatcher_Abstract
16
+ {
17
+ /**
18
+ * @var int
19
+ */
20
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_STOP;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_STOP;
26
+
27
+ /**
28
+ * @return $this
29
+ */
30
+ protected function _proceed()
31
+ {
32
+ $job = $this->_currentJob;
33
+ $jobListing = $this->_currentJobListing;
34
+
35
+ $stoppedArticle = null;
36
+ $articleId = null;
37
+ $hasSuccess = false;
38
+
39
+ /**
40
+ * Status of the collection must be the same as Diglin_Ricento_Model_Resource_Products_Listing_Item::countListedItems
41
+ */
42
+ $itemCollection = $this->_getItemCollection(array(Diglin_Ricento_Helper_Data::STATUS_LISTED), $jobListing->getLastItemId());
43
+
44
+ if ($itemCollection->count() == 0) {
45
+ $job->setJobMessage(array($this->_getNoItemMessage()));
46
+ $this->_progressStatus = Diglin_Ricento_Model_Sync_Job::PROGRESS_COMPLETED;
47
+ return $this;
48
+ }
49
+
50
+ $sell = Mage::getSingleton('diglin_ricento/api_services_sell');
51
+ $sell->setCurrentWebsite($this->_getListing()->getWebsiteId());
52
+
53
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
54
+ foreach ($itemCollection->getItems() as $item) {
55
+
56
+ try {
57
+ // We skip stop article with configurable product as we push its associated products
58
+ if ($item->getProduct()->isConfigurableType()) {
59
+ $jobListing->saveCurrentJob(array(
60
+ 'total_proceed' => ++$this->_totalProceed,
61
+ 'last_item_id' => $item->getId()
62
+ ));
63
+ continue;
64
+ }
65
+
66
+ $stoppedArticle = $sell->stopArticle($item);
67
+
68
+ if ($stoppedArticle) {
69
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
70
+ $this->_itemMessage = array('success' => $this->_getHelper()->__('The product has been removed from ricardo.ch'));
71
+ $hasSuccess = true;
72
+ ++$this->_totalSuccess;
73
+ $item->getResource()->saveCurrentItem($item->getId(), array('ricardo_article_id' => null, 'is_planned' => null, 'qty_inventory' => null, 'status' => Diglin_Ricento_Helper_Data::STATUS_STOPPED));
74
+ } else {
75
+ ++$this->_totalError;
76
+ $this->_jobHasError = true;
77
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_ERROR;
78
+ $this->_itemMessage = array('errors' => $this->_getHelper()->__('The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it.'));
79
+ // do not change the status of the item itself, the problem can be that the auction is still running and the article cannot be stopped
80
+ }
81
+ } catch (Exception $e) {
82
+ $this->_handleException($e);
83
+ $e = null;
84
+ // keep going for the next item - no break
85
+ }
86
+
87
+ /**
88
+ * Save item information and eventual error messages
89
+ */
90
+ $this->_getListingLog()->saveLog(array(
91
+ 'job_id' => $job->getId(),
92
+ 'product_title' => $item->getProductTitle(),
93
+ 'products_listing_id' => $this->_productsListingId,
94
+ 'product_id' => $item->getProductId(),
95
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
96
+ 'log_status' => $this->_itemStatus,
97
+ 'log_type' => $this->_logType,
98
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
99
+ ));
100
+
101
+ /**
102
+ * Save the current information of the process to allow live display via ajax call
103
+ */
104
+ $jobListing->saveCurrentJob(array(
105
+ 'total_proceed' => ++$this->_totalProceed,
106
+ 'total_success' => ($jobListing->getTotalSuccess() + $this->_totalSuccess),
107
+ 'total_error' => ($jobListing->getTotalError() + $this->_totalError),
108
+ 'last_item_id' => $item->getId()
109
+ ));
110
+
111
+ $this->_itemMessage = null;
112
+ $this->_itemStatus = null;
113
+ }
114
+
115
+ if ($hasSuccess) {
116
+ $countListedItem = Mage::getResourceModel('diglin_ricento/products_listing_item')
117
+ ->countListedItems($this->_productsListingId);
118
+
119
+ if ($countListedItem == 0) {
120
+ $listing = Mage::getModel('diglin_ricento/products_listing')->load($this->_productsListingId);
121
+ $listing
122
+ ->setStatus(Diglin_Ricento_Helper_Data::STATUS_STOPPED)
123
+ ->save();
124
+ }
125
+ }
126
+
127
+ return $this;
128
+ }
129
+
130
+ /**
131
+ * @param string $jobStatus
132
+ * @return string
133
+ */
134
+ protected function _getStatusMessage($jobStatus)
135
+ {
136
+ return Mage::helper('diglin_ricento')->__('Report: %d success, %d error(s)', $this->_totalSuccess, $this->_totalError);
137
+ }
138
+ }
app/code/community/Diglin/Ricento/Model/Dispatcher/Sync/List.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use \Diglin\Ricardo\Enums\Article\ArticlesTypes;
13
+ use \Diglin\Ricardo\Managers\SellerAccount\Parameter\OpenArticlesParameter;
14
+ use \Diglin\Ricardo\Managers\SellerAccount\Parameter\SoldArticlesParameter;
15
+
16
+ /**
17
+ * Class Diglin_Ricento_Model_Dispatcher_Sync_List
18
+ */
19
+ class Diglin_Ricento_Model_Dispatcher_Sync_List extends Diglin_Ricento_Model_Dispatcher_Abstract
20
+ {
21
+ /**
22
+ * @var int
23
+ */
24
+ protected $_logType = Diglin_Ricento_Model_Products_Listing_Log::LOG_TYPE_SYNCLIST;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ protected $_jobType = Diglin_Ricento_Model_Sync_Job::TYPE_SYNCLIST;
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ protected $_openedArticles;
35
+
36
+ /**
37
+ * @return $this
38
+ */
39
+ public function proceed()
40
+ {
41
+ $jobType = $this->_jobType;
42
+
43
+ $productsListingResource = Mage::getResourceModel('diglin_ricento/products_listing');
44
+ $readListingConnection = $productsListingResource->getReadConnection();
45
+ $select = $readListingConnection
46
+ ->select()
47
+ ->from($productsListingResource->getTable('diglin_ricento/products_listing'), 'entity_id');
48
+
49
+ $listingIds = $readListingConnection->fetchCol($select);
50
+
51
+ foreach ($listingIds as $listingId) {
52
+
53
+ /**
54
+ * We want items listed and planned because we want to get the new ricardo_article_id
55
+ * ricardo article id change when the product was planned and then is open for sale
56
+ */
57
+ $itemResource = Mage::getResourceModel('diglin_ricento/products_listing_item');
58
+ $readConnection = $itemResource->getReadConnection();
59
+ $select = $readConnection->select()
60
+ ->from($itemResource->getTable('diglin_ricento/products_listing_item'), 'item_id')
61
+ ->where('products_listing_id = :id')
62
+ ->where('is_planned = 1')
63
+ ->where('status = ?', Diglin_Ricento_Helper_Data::STATUS_LISTED);
64
+
65
+ $binds = array('id' => $listingId);
66
+ $countListedItems = count($readConnection->fetchAll($select, $binds));
67
+
68
+ if ($countListedItems == 0) {
69
+ continue;
70
+ }
71
+
72
+ $job = Mage::getModel('diglin_ricento/sync_job');
73
+ $job->loadByTypeListingIdProgress($jobType, $listingId, array(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING, Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING));
74
+
75
+ if ($job->getId()) {
76
+ continue;
77
+ }
78
+
79
+ $job
80
+ ->setJobType($jobType)
81
+ ->setProgress(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING)
82
+ ->setJobMessage(array($job->getJobMessage(true)))
83
+ ->save();
84
+
85
+ $jobListing = Mage::getModel('diglin_ricento/sync_job_listing');
86
+ $jobListing
87
+ ->setProductsListingId($listingId)
88
+ ->setTotalCount($countListedItems)
89
+ ->setTotalProceed(0)
90
+ ->setJobId($job->getId())
91
+ ->save();
92
+ }
93
+
94
+ return parent::proceed();
95
+ }
96
+
97
+ /**
98
+ * We update the ricardo article ID because it changes when it's planned or opened
99
+ * We need it to retrieve the sold article in a later process
100
+ *
101
+ * @return $this
102
+ */
103
+ protected function _proceed()
104
+ {
105
+ $jobListing = $this->_currentJobListing;
106
+
107
+ $itemCollection = $this->_getItemCollection(array(Diglin_Ricento_Helper_Data::STATUS_LISTED), $jobListing->getLastItemId());
108
+ $itemCollection->addFieldToFilter('is_planned', 1);
109
+
110
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
111
+ foreach ($itemCollection->getItems() as $item) {
112
+
113
+ $article = null;
114
+ $isUnsold = false;
115
+ $openParameter = new OpenArticlesParameter();
116
+ $openParameter->setInternalReferenceFilter($item->getInternalReference());
117
+
118
+ try {
119
+ $openArticles = $this->_getSellerAccount()->getOpenArticles($openParameter);
120
+
121
+ /**
122
+ * Get Article information from OpenArticles method
123
+ */
124
+ if (count($openArticles['OpenArticles']) > 0) {
125
+ $article = Mage::helper('diglin_ricento')->extractData($openArticles['OpenArticles'][0]); // Only one element expected but more may come
126
+ }
127
+
128
+ /**
129
+ * We may have missed the article Id value changes in OpenArticles method, due to sales for example
130
+ * so we try to get it from sold articles method
131
+ */
132
+ if (is_null($article)) {
133
+ $article = $this->_getSoldArticles($item);
134
+ }
135
+
136
+ /**
137
+ * It's maybe not sold
138
+ */
139
+ if (is_null($article)) {
140
+ $article = $this->_getUnsoldArticles($item);
141
+ if (!is_null($article)) {
142
+ $isUnsold = true;
143
+ }
144
+ }
145
+
146
+ if ($article) {
147
+ /**
148
+ * Get the new ricardo article id if the article was planned before
149
+ */
150
+ if ($article->getArticleId() && !$isUnsold) {
151
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
152
+ $this->_itemMessage = array('success' => $this->_getHelper()->__('The product is now live on ricardo.ch'));
153
+ $item->getResource()->saveCurrentItem($item->getId(), array('is_planned' => 0, 'ricardo_article_id' => $article->getArticleId()));
154
+ } elseif ($article->getArticleId() && $isUnsold) {
155
+ $this->_itemStatus = Diglin_Ricento_Model_Products_Listing_Log::STATUS_SUCCESS;
156
+ $this->_itemMessage = array('success' => $this->_getHelper()->__('Sorry, the product has not been sold'));
157
+ $item->getResource()->saveCurrentItem($item->getId(), array('status' => Diglin_Ricento_Helper_Data::STATUS_STOPPED, 'is_planned' => 0, 'ricardo_article_id' => $article->getArticleId()));
158
+ }
159
+ }
160
+ } catch (Exception $e) {
161
+ $this->_handleException($e);
162
+ $e = null;
163
+ // keep going for the next item - no break
164
+ }
165
+
166
+ /**
167
+ * Save item information and eventual error messages
168
+ */
169
+ if (!is_null($this->_itemMessage)) {
170
+ $this->_getListingLog()->saveLog(array(
171
+ 'job_id' => $this->_currentJob->getId(),
172
+ 'product_title' => $item->getProductTitle(),
173
+ 'products_listing_id' => $this->_productsListingId,
174
+ 'product_id' => $item->getProductId(),
175
+ 'message' => (is_array($this->_itemMessage)) ? $this->_jsonEncode($this->_itemMessage) : $this->_itemMessage,
176
+ 'log_status' => $this->_itemStatus,
177
+ 'log_type' => $this->_logType,
178
+ 'created_at' => Mage::getSingleton('core/date')->gmtDate()
179
+ ));
180
+ }
181
+
182
+ /**
183
+ * Save the current information of the process to allow live display via ajax call
184
+ */
185
+ $jobListing->saveCurrentJob(array(
186
+ 'total_proceed' => ++$this->_totalProceed,
187
+ 'last_item_id' => $item->getId()
188
+ ));
189
+
190
+ $this->_itemMessage = null;
191
+ $this->_itemStatus = null;
192
+ }
193
+
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * @param $item
199
+ * @return null|Varien_Object
200
+ */
201
+ protected function _getSoldArticles($item)
202
+ {
203
+ $article = null;
204
+ $soldArticlesParameter = new SoldArticlesParameter();
205
+
206
+ /**
207
+ * Set end date to filter e.g. last day. Do not use a higher value as the minimum sales duration is 1 day,
208
+ * we prevent to have conflict with several sold articles having similar internal reference
209
+ */
210
+ $soldArticlesParameter
211
+ ->setInternalReferenceFilter($item->getInternalReference())
212
+ ->setMinimumEndDate($this->_getHelper()->getJsonDate(time() - (1 * 24 * 60 * 60)));
213
+
214
+ $articles = $this->_getSellerAccount()->getSoldArticles($soldArticlesParameter);
215
+ if (count($articles) > 0) {
216
+ $article = $this->_getHelper()->extractData($articles[0]);
217
+ }
218
+
219
+ return $article;
220
+ }
221
+ }
app/code/community/Diglin/Ricento/Model/Entity/Attribute/Source/Conditions.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Entity_Attribute_Source_Conditions
14
+ */
15
+ class Diglin_Ricento_Model_Entity_Attribute_Source_Conditions extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
16
+ {
17
+ /**
18
+ * Retrieve All options
19
+ * @todo - replace API call by hard coded list of options because these options are displayed in product edit page
20
+ *
21
+ * @return array
22
+ */
23
+ public function getAllOptions()
24
+ {
25
+ // need to check if configured because it blocks users to edit product page until they receive API info
26
+ try {
27
+ if (Mage::helper('diglin_ricento')->isConfigured()) {
28
+ if (is_null($this->_options)) {
29
+
30
+ $this->_options = Mage::getSingleton('diglin_ricento/config_source_sales_product_condition')->getAllOptions();
31
+ }
32
+ return $this->_options;
33
+ }
34
+
35
+ return array('label' => Mage::helper('diglin_ricento')->__('No Options because API not configured'), 'value' => '');
36
+ } catch (Exception $e) {
37
+ Mage::logException($e);
38
+ Mage::getSingleton('core/session')->addError('No ricardo.ch condition options retrieved cause of an API problem');
39
+ }
40
+ return array('label' => Mage::helper('diglin_ricento')->__('No Options because API has a problem'), 'value' => '');
41
+ }
42
+ }
app/code/community/Diglin/Ricento/Model/Filter.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Filter
14
+ */
15
+ class Diglin_Ricento_Model_Filter extends Mage_Core_Model_Email_Template_Filter
16
+ {
17
+ /**
18
+ * Use for cms content or similar to get Adminhtml Url
19
+ *
20
+ * @param $construction
21
+ * @return string
22
+ */
23
+ public function adminhtmlDirective($construction)
24
+ {
25
+ $params = $this->_getIncludeParameters($construction[2]);
26
+ if (!isset($params['_query'])) {
27
+ $params['_query'] = array();
28
+ }
29
+ foreach ($params as $k => $v) {
30
+ if (strpos($k, '_query_') === 0) {
31
+ $params['_query'][substr($k, 7)] = $v;
32
+ unset($params[$k]);
33
+ }
34
+ }
35
+ $params['_absolute'] = $this->_useAbsoluteLinks;
36
+
37
+ if ($this->_useSessionInUrl === false) {
38
+ $params['_nosid'] = true;
39
+ }
40
+
41
+ if (isset($params['direct_url'])) {
42
+ $path = '';
43
+ $params['_direct'] = $params['direct_url'];
44
+ unset($params['direct_url']);
45
+ }
46
+ else {
47
+ $path = isset($params['url']) ? $params['url'] : '';
48
+ unset($params['url']);
49
+ }
50
+
51
+ return Mage::helper('adminhtml')->getUrl($path, $params);
52
+ }
53
+ }
app/code/community/Diglin/Ricento/Model/Observer.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Observer
14
+ *
15
+ * Highly inspired from the Magento Hackathon Project: https://github.com/magento-hackathon/Magento-PSR-0-Autoloader
16
+ * We do our own implementation to merge it in only one extension and to remove useless methods for our case
17
+ *
18
+ */
19
+ class Diglin_Ricento_Model_Observer
20
+ {
21
+ const CONFIG_PATH_PSR0NAMESPACES = 'global/psr0_namespaces';
22
+
23
+ static $shouldAdd = true;
24
+
25
+ /**
26
+ * @return array
27
+ */
28
+ protected function _getNamespacesToRegister()
29
+ {
30
+ $namespaces = array();
31
+ $node = Mage::getConfig()->getNode(self::CONFIG_PATH_PSR0NAMESPACES);
32
+ if ($node && is_array($node->asArray())) {
33
+ $namespaces = array_keys($node->asArray());
34
+ }
35
+ return $namespaces;
36
+ }
37
+
38
+ /**
39
+ * Add PSR-0 Autoloader for our Diglin_Ricardo library
40
+ *
41
+ * Event
42
+ * - resource_get_tablename
43
+ * - add_spl_autoloader
44
+ */
45
+ public function addAutoloader()
46
+ {
47
+ if (!self::$shouldAdd) {
48
+ return;
49
+ }
50
+
51
+ foreach ($this->_getNamespacesToRegister() as $namespace) {
52
+ $namespace = str_replace('_', '/', $namespace);
53
+ if (is_dir(Mage::getBaseDir('lib') . DS . $namespace)) {
54
+ $args = array($namespace, Mage::getBaseDir('lib') . DS . $namespace);
55
+ $autoloader = Mage::getModel("diglin_ricento/splAutoloader", $args);
56
+ $autoloader->register();
57
+ }
58
+ }
59
+
60
+ self::$shouldAdd = false;
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * Decrease the inventory on ricardo.ch when an order is passed outside of ricardo.ch
66
+ *
67
+ * @todo to finish
68
+ *
69
+ * Event
70
+ * - sales_order_item_save_commit_after
71
+ *
72
+ * @param Varien_Event_Observer $observer
73
+ * @return $this
74
+ */
75
+ public function decreaseInventory(Varien_Event_Observer $observer)
76
+ {
77
+ /* @var $item Mage_Sales_Model_Order_Item */
78
+ // $item = $observer->getEvent()->getItem();
79
+ //
80
+ // if (!Mage::helper('diglin_ricento')->getDecreaseInventory() || $item->getOrder()->getIsRicardo()) {
81
+ // return;
82
+ // }
83
+ //
84
+ // $collection = Mage::getResourceModel('diglin_ricento/products_listing_item_collection')
85
+ // ->addFieldToFilter('product_id', $item->getProductId())
86
+ // ->addFieldToFilter('status', Diglin_Ricento_Helper_Data::STATUS_LISTED)
87
+ // ->addFieldToFilter('ricardo_article_id', new Zend_Db_Expr('not null'))
88
+ // ->addFieldToFilter('is_planned', 0);
89
+ //
90
+ // $sell = Mage::getSingleton('diglin_ricento/api_services_sell');
91
+ //
92
+ // foreach ($collection->getItems() as $productItem) {
93
+ // /**
94
+ // * We cannot decrease below 1
95
+ // */
96
+ // $newQuantity = $productItem->getQtyInventory() - $item->getQtyOrdered();
97
+ // if (!($newQuantity)) {
98
+ //
99
+ // $productItem->setQtyInventory($newQuantity);
100
+ //
101
+ // $sell->updateArticle($productItem);
102
+ //
103
+ // $productItem->save();
104
+ // }
105
+ // }
106
+ // return $this;
107
+ }
108
+
109
+ /**
110
+ * Event
111
+ * - adminhtml_block_html_before
112
+ *
113
+ * @param Varien_Event_Observer $observer
114
+ * @return $this
115
+ */
116
+ public function disableFormField(Varien_Event_Observer $observer)
117
+ {
118
+ $block = $observer->getEvent()->getBlock();
119
+
120
+ if ($block instanceof Mage_Adminhtml_Block_Customer_Edit_Tab_Account) {
121
+ $block->getForm()->getElement('ricardo_username')->setDisabled(true);
122
+ $block->getForm()->getElement('ricardo_id')->setDisabled(true);
123
+ }
124
+ return $this;
125
+ }
126
+
127
+ /**
128
+ * Retrieve payment information from a ricardo.ch order
129
+ *
130
+ * Event
131
+ * - payment_info_block_prepare_specific_information
132
+ *
133
+ * @param Varien_Event_Observer $observer
134
+ * @return $this
135
+ */
136
+ public function paymentMethodsInformation(Varien_Event_Observer $observer)
137
+ {
138
+ /* @var $payment Mage_Sales_Model_Order_Payment */
139
+ $payment = $observer->getEvent()->getPayment();
140
+ $transport = $observer->getEvent()->getTransport();
141
+
142
+ if ($payment->getMethod() == Diglin_Ricento_Model_Sales_Method_Payment::PAYMENT_CODE) {
143
+ $additionalData = Mage::helper('core')->jsonDecode($payment->getAdditionalData(), Zend_Json::TYPE_OBJECT);
144
+ $methods = explode(',', $additionalData->ricardo_payment_methods);
145
+
146
+ $label = array();
147
+ $information = '';
148
+ foreach ($methods as $method) {
149
+ if (\Diglin\Ricardo\Enums\PaymentMethods::TYPE_BANK_TRANSFER == $method) {
150
+ $information = Mage::getStoreConfig(Diglin_Ricento_Helper_Data::PAYMENT_BANK_INFO);
151
+ }
152
+ $label[] = Mage::helper('diglin_ricento')->__(\Diglin\Ricardo\Enums\PaymentMethods::getLabel($method));
153
+ }
154
+
155
+ if (!empty($label)) {
156
+ $transport->setData(array(
157
+ 'bid_ids' => (isset($additionalData->ricardo_bid_ids)) ? $additionalData->ricardo_bid_ids : null,
158
+ 'methods' => $label,
159
+ 'information' => $information));
160
+ }
161
+ }
162
+ return $this;
163
+ }
164
+
165
+ /**
166
+ * Event
167
+ * - core_block_abstract_to_html_before
168
+ *
169
+ * @todo to finish
170
+ *
171
+ * @param Varien_Event_Observer $observer
172
+ * @return $this
173
+ */
174
+ // public function addSalesOrderGrid(Varien_Event_Observer $observer)
175
+ // {
176
+ // $block = $observer->getEvent()->getBlock();
177
+ // if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Grid) {
178
+ // $block->addColumn('ricardo_username', array(
179
+ // 'header' => Mage::helper('diglin_ricento')->__('Ricardo Username'),
180
+ // 'index' => 'ricardo_username',
181
+ // 'after' => 'billing_name'
182
+ // ));
183
+ // }
184
+ //
185
+ // return $this;
186
+ // }
187
+
188
+ /**
189
+ * Event
190
+ * - sales_quote_item_set_product
191
+ *
192
+ * We skipped custom option while processing an order via the ricardo.ch API
193
+ *
194
+ * @param Varien_Event_Observer $observer
195
+ * @return $this
196
+ */
197
+ public function setSkipppedRequiredOption(Varien_Event_Observer $observer)
198
+ {
199
+ /* @var $product Mage_Catalog_Model_Product */
200
+ $product = $observer->getEvent()->getProduct();
201
+
202
+ /* @var $quoteItem Mage_Sales_Model_Quote_Item */
203
+ $quoteItem = $observer->getEvent()->getQuoteItem();
204
+
205
+ if ($quoteItem->getQuote() && $quoteItem->getQuote()->getIsRicardo()) {
206
+ $product->setSkipCheckRequiredOption(true);
207
+ }
208
+ return $this;
209
+ }
210
+ }
app/code/community/Diglin/Ricento/Model/Products/Category.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Products_Category
14
+ *
15
+ * Represents a Ricardo category
16
+ *
17
+ * @method string getCategoryId() getCategoryId()
18
+ * @method string getCategoryName() getCategoryName()
19
+ * @method string getIsFinal() getIsFinal()
20
+ * @method string getLevel() getLevel()
21
+ * @method string getParentId() getParentId()
22
+ */
23
+ class Diglin_Ricento_Model_Products_Category extends Varien_Object
24
+ {
25
+ /**
26
+ * Name of object id field
27
+ *
28
+ * @var string
29
+ */
30
+ protected $_idFieldName = 'category_id';
31
+
32
+ /**
33
+ * @var Diglin_Ricento_Model_Products_Category[]
34
+ */
35
+ protected $_children = array();
36
+
37
+ /**
38
+ * Initialize object based on raw API data. Convert CamelCase to under_score, to make getters and setters work
39
+ *
40
+ * @param array $rawData Data as array of strings, as from Ricardo API
41
+ * Example: [ 'ArticleTypeId' => '3',
42
+ * 'CategoryId' => '74974',
43
+ * 'CategoryName' => 'Sonstiger Werkstattbedarf',
44
+ * 'CategoryNameRewritten' => 'sonstiger-werkstattbedarf',
45
+ * 'CategoryTypeId' => '11',
46
+ * 'IsBranding' => '1',
47
+ * 'IsFinal' => '1',
48
+ * 'Level' => '3',
49
+ * 'ParentId' => '74971',
50
+ * 'PartialUrl' => '/kaufen/fahrzeugzubehoer/werkstattbedarf/sonstiger-werkstattbedarf/b/cn74974/'
51
+ * ]
52
+ *
53
+ */
54
+ public function setDataFromApi(array $rawData)
55
+ {
56
+ foreach ($rawData as $key => $value) {
57
+ $this->setDataUsingMethod($key, $value);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @return Diglin_Ricento_Model_Products_Category[]
63
+ */
64
+ public function getChildren()
65
+ {
66
+ return $this->_children;
67
+ }
68
+
69
+ /**
70
+ * @param Diglin_Ricento_Model_Products_Category $category
71
+ */
72
+ public function addChild(Diglin_Ricento_Model_Products_Category $category)
73
+ {
74
+ $this->_children[$category->getCategoryId()] = $category;
75
+ }
76
+ }
app/code/community/Diglin/Ricento/Model/Products/Category/Mapping.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Products_Category_Mapping
14
+ */
15
+ class Diglin_Ricento_Model_Products_Category_Mapping extends Varien_Object
16
+ {
17
+ const ROOT_CATEGORY_ID = 1;
18
+
19
+ /**
20
+ * Root element for category tree
21
+ *
22
+ * @var Diglin_Ricento_Model_Products_Category
23
+ */
24
+ protected $_categoryTree;
25
+
26
+ /**
27
+ * Flat array [ category_id => category ]
28
+ *
29
+ * @var Diglin_Ricento_Model_Products_Category[]
30
+ */
31
+ protected $_categoryIndex = array();
32
+
33
+ /**
34
+ * @var bool
35
+ */
36
+ protected $_canUseCache = true;
37
+
38
+ /**
39
+ * @var string
40
+ */
41
+ protected $_cacheKeyTree = 'ricardo_categories_tree';
42
+
43
+ /**
44
+ * @var string
45
+ */
46
+ protected $_cacheKeyIndex = 'ricardo_categories_index';
47
+
48
+ /**
49
+ * Returns child categories of current category
50
+ *
51
+ * @param int $parentId Parent category, defaults to root category
52
+ * @return mixed
53
+ */
54
+ public function getCategories($parentId = self::ROOT_CATEGORY_ID)
55
+ {
56
+ if (empty($this->_categoryIndex)) {
57
+ $this->_buildRicardoCategoryTree();
58
+ }
59
+ if (!$this->getCategory($parentId)) {
60
+ Mage::log("ricardo.ch category ID {$parentId} not found.", Zend_Log::WARN, Diglin_Ricento_Helper_Data::LOG_FILE);
61
+ return array();
62
+ }
63
+ return $this->getCategory($parentId)->getChildren();
64
+ }
65
+
66
+ /**
67
+ * Returns category object by id
68
+ *
69
+ * @param $categoryId
70
+ * @return Diglin_Ricento_Model_Products_Category
71
+ */
72
+ public function getCategory($categoryId)
73
+ {
74
+ if (empty($this->_categoryIndex)) {
75
+ $this->_buildRicardoCategoryTree();
76
+ }
77
+ return (isset($this->_categoryIndex[$categoryId]) ? $this->_categoryIndex[$categoryId] : false);
78
+ }
79
+
80
+ /**
81
+ * Build category index and tree
82
+ *
83
+ * @return Diglin_Ricento_Model_Products_Category|mixed
84
+ */
85
+ protected function _buildRicardoCategoryTree()
86
+ {
87
+ Varien_Profiler::start('RICARDO_API_BUILD_CATEGORIES');
88
+
89
+ if ($this->getCanUseCache()) {
90
+ $this->_categoryTree = unserialize(Mage::app()->loadCache($this->_cacheKeyTree));
91
+ $this->_categoryIndex = unserialize(Mage::app()->loadCache($this->_cacheKeyIndex));
92
+ }
93
+
94
+ if (empty($this->_categoryTree)) {
95
+
96
+ $this->_categoryTree = Mage::getModel('diglin_ricento/products_category', array(
97
+ 'category_id' => self::ROOT_CATEGORY_ID,
98
+ 'level' => 0,
99
+ 'is_final' => 0
100
+ ));
101
+
102
+ $this->_addCategoryToIndex($this->_categoryTree);
103
+
104
+ foreach ($this->_getRicardoCategoryData() as $_categoryData) {
105
+ /* @var $category Diglin_Ricento_Model_Products_Category */
106
+ $category = Mage::getModel('diglin_ricento/products_category');
107
+ $category->setDataFromApi($_categoryData);
108
+ if (!$this->getCategory($category->getParentId())) {
109
+ Mage::log("ricardo.ch parent category ID {$category->getParentId()} as parent for category {$category->getId()} not found.", Zend_Log::WARN, Diglin_Ricento_Helper_Data::LOG_FILE);
110
+ continue;
111
+ }
112
+ $this->_addCategoryToIndex($category);
113
+ }
114
+ }
115
+
116
+ if ($this->getCanUseCache() && !empty($this->_categoryTree)) {
117
+ Mage::app()->saveCache(serialize($this->_categoryTree), $this->_cacheKeyTree, array(Diglin_Ricento_Helper_Api::CACHE_TAG), Diglin_Ricento_Helper_Api::CACHE_LIFETIME);
118
+ Mage::app()->saveCache(serialize($this->_categoryIndex), $this->_cacheKeyIndex, array(Diglin_Ricento_Helper_Api::CACHE_TAG), Diglin_Ricento_Helper_Api::CACHE_LIFETIME);
119
+ }
120
+
121
+ Varien_Profiler::stop('RICARDO_API_BUILD_CATEGORIES');
122
+
123
+ return $this->_categoryTree;
124
+ }
125
+
126
+ /**
127
+ * Add category to index and tree
128
+ *
129
+ * @param Diglin_Ricento_Model_Products_Category $category
130
+ */
131
+ protected function _addCategoryToIndex(Diglin_Ricento_Model_Products_Category $category)
132
+ {
133
+ $this->_categoryIndex[$category->getId()] = $category;
134
+ if ((int) $category->getLevel() > 0) {
135
+ $this->_categoryIndex[$category->getParentId()]->addChild($category);
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Returns sorted API result
141
+ *
142
+ * @return mixed
143
+ */
144
+ protected function _getRicardoCategoryData()
145
+ {
146
+ $categories = Mage::getSingleton('diglin_ricento/config_source_categories')->toOptionHash();
147
+ usort($categories, array(__CLASS__, 'sortByLevelAndName'));
148
+ return $categories;
149
+ }
150
+
151
+ /**
152
+ * Helper method to sort the API result
153
+ *
154
+ * @param $category1
155
+ * @param $category2
156
+ * @return int
157
+ */
158
+ private static function sortByLevelAndName($category1, $category2)
159
+ {
160
+ return ($category1['Level'] - $category2['Level']) ?: strnatcasecmp($category1['CategoryName'], $category2['CategoryName']);
161
+ }
162
+
163
+ /**
164
+ * Set if the cache is allow to be used
165
+ *
166
+ * @param boolean $canUseCache
167
+ * @return $this
168
+ */
169
+ public function setCanUseCache($canUseCache)
170
+ {
171
+ $this->_canUseCache = (bool) $canUseCache;
172
+ return $this;
173
+ }
174
+
175
+ /**
176
+ * Allowed to use the cache or not
177
+ *
178
+ * @return boolean
179
+ */
180
+ public function getCanUseCache()
181
+ {
182
+ return (Mage::app()->useCache(Diglin_Ricento_Helper_Api::CACHE_TYPE) && $this->_canUseCache);
183
+ }
184
+ }
app/code/community/Diglin/Ricento/Model/Products/Listing.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Products Listing Model
14
+ *
15
+ * @method string getTitle()
16
+ * @method string getStatus()
17
+ * @method int getSalesOptionsId()
18
+ * @method int getWebsiteId()
19
+ * @method int getRuleId()
20
+ * @method string getPublishLanguages()
21
+ * @method string getDefaultLanguage()
22
+ * @method int getLangStoreIdDe()
23
+ * @method int getLangStoreIdFr()
24
+ * @method DateTime getCreatedAt()
25
+ * @method DateTime getUpdatedAt()
26
+ * @method Diglin_Ricento_Model_Products_Listing setTitle(string $title)
27
+ * @method Diglin_Ricento_Model_Products_Listing setStatus(string $status)
28
+ * @method Diglin_Ricento_Model_Products_Listing setSalesOptionsId(int $salesOptionsId)
29
+ * @method Diglin_Ricento_Model_Products_Listing setWebsiteId(int $websiteId)
30
+ * @method Diglin_Ricento_Model_Products_Listing setRuleId(int $ruleId)
31
+ * @method Diglin_Ricento_Model_Products_Listing setPublishLanguages(string $language)
32
+ * @method Diglin_Ricento_Model_Products_Listing setDefaultLanguage(string $language)
33
+ * @method Diglin_Ricento_Model_Products_Listing setLangStoreIdDe(int $storeId)
34
+ * @method Diglin_Ricento_Model_Products_Listing setLangStoreIdFr(int $storeId)
35
+ * @method Diglin_Ricento_Model_Products_Listing setCreatedAt(DateTime $createdAt)
36
+ * @method Diglin_Ricento_Model_Products_Listing setUpdatedAt(DateTime $updatedAt)
37
+ */
38
+ class Diglin_Ricento_Model_Products_Listing extends Mage_Core_Model_Abstract
39
+ {
40
+ /**
41
+ * @var Diglin_Ricento_Model_Sales_Options
42
+ */
43
+ protected $_salesOptions;
44
+
45
+ /**
46
+ * @var Diglin_Ricento_Model_Rule
47
+ */
48
+ protected $_shippingPaymentRule;
49
+
50
+ /**
51
+ * Prefix of model events names
52
+ * @var string
53
+ */
54
+ protected $_eventPrefix = 'products_listing';
55
+
56
+ /**
57
+ * Parameter name in event
58
+ * In observe method you can use $observer->getEvent()->getObject() in this case
59
+ * @var string
60
+ */
61
+ protected $_eventObject = 'products_listing';
62
+
63
+ /**
64
+ * Products_Listing Constructor
65
+ * @return void
66
+ */
67
+ protected function _construct()
68
+ {
69
+ parent::_construct();
70
+ $this->_init('diglin_ricento/products_listing');
71
+ }
72
+
73
+ /**
74
+ * Set date of last update
75
+ *
76
+ * @return Diglin_Ricento_Model_Products_Listing
77
+ */
78
+ protected function _beforeSave()
79
+ {
80
+ parent::_beforeSave();
81
+
82
+ if ($this->hasDataChanges() && $this->getStatus() != Diglin_Ricento_Helper_Data::STATUS_LISTED) {
83
+ $this->setStatus(Diglin_Ricento_Helper_Data::STATUS_PENDING);
84
+
85
+ // Be aware doing that doesn't trigger Magento events but it's faster
86
+ $this->getProductsListingItemCollection()->updateStatusToAll(Diglin_Ricento_Helper_Data::STATUS_PENDING);
87
+
88
+ // Delete configurable product children, will be recreated when the check list process is done
89
+ Mage::getResourceModel('diglin_ricento/products_listing_item_collection')
90
+ ->addFieldToFilter('products_listing_id', $this->getId())
91
+ ->addFieldToFilter('parent_item_id', array('notnull' => 1))
92
+ ->addFieldToFilter('ricardo_article_id', array('null' => 1))
93
+ ->walk('delete');
94
+ }
95
+
96
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
97
+
98
+ if ($this->isObjectNew()) {
99
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
100
+ }
101
+
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * @return $this|Mage_Core_Model_Abstract
107
+ */
108
+ protected function _beforeDelete()
109
+ {
110
+ parent::_beforeDelete();
111
+
112
+ // We must not use the FK constrains cause of deletion of other values at item level
113
+ $this->getProductsListingItemCollection()->walk('delete');
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ * @return $this|Mage_Core_Model_Abstract
119
+ */
120
+ protected function _afterDeleteCommit()
121
+ {
122
+ $this->getSalesOptions()->delete();
123
+ $this->getShippingPaymentRule()->delete();
124
+
125
+ parent::_afterDeleteCommit();
126
+ return $this;
127
+ }
128
+
129
+ /**
130
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
131
+ */
132
+ public function getProductsListingItemCollection()
133
+ {
134
+ return Mage::getResourceModel('diglin_ricento/products_listing_item_collection')
135
+ ->addFieldToFilter('products_listing_id', array('eq' => $this->getId()));
136
+ }
137
+
138
+ /**
139
+ * Retrieve array of product id's for listing
140
+ *
141
+ * @param bool $withChildren
142
+ * @return array
143
+ */
144
+ public function getProductIds($withChildren = true)
145
+ {
146
+ if (!$this->getId()) {
147
+ return array();
148
+ }
149
+
150
+ $array = $this->getData('product_ids');
151
+ if (is_null($array)) {
152
+ $array = $this->getResource()->getProductIds($this, $withChildren);
153
+ $this->setData('product_ids', $array);
154
+ }
155
+ return $array;
156
+ }
157
+
158
+ /**
159
+ * Adds new item by product id
160
+ *
161
+ * @param $productId
162
+ * @return bool true if product has been added
163
+ */
164
+ public function addProduct($productId)
165
+ {
166
+ if (Mage::getResourceModel('catalog/product_collection')->addFieldToFilter('entity_id', $productId)->getSize()) {
167
+ /** @var $productListingItem Diglin_Ricento_Model_Products_Listing_Item */
168
+ $productListingItem = Mage::getModel('diglin_ricento/products_listing_item');
169
+ $productListingItem->setProductsListingId($this->getId())->setProductId($productId)->save();
170
+ return true;
171
+ }
172
+ return false;
173
+ }
174
+
175
+ /**
176
+ * Removes items by product id
177
+ *
178
+ * @param array $productIds
179
+ * @return int[] Returns two values: [number of removed products, number of not removed listed products]
180
+ */
181
+ public function removeProducts(array $productIds)
182
+ {
183
+ /** @var $items Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection */
184
+ $items = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
185
+
186
+ /** @var $itemResource Diglin_Ricento_Model_Resource_Products_Listing_Item */
187
+ $itemResource = Mage::getResourceModel('diglin_ricento/products_listing_item');
188
+ $itemResource->beginTransaction();
189
+
190
+ $numberOfListedItems = $items->addFieldToFilter('products_listing_id', $this->getId())
191
+ ->addFieldToFilter('product_id', array('in' => $productIds))
192
+ ->addFieldToFilter('status', Diglin_Ricento_Helper_Data::STATUS_LISTED)
193
+ ->getSize();
194
+
195
+ $items = Mage::getResourceModel('diglin_ricento/products_listing_item_collection');
196
+ $numberOfItemsToDelete = $items->addFieldToFilter('products_listing_id', $this->getId())
197
+ ->addFieldToFilter('product_id', array('in' => $productIds))
198
+ ->addFieldToFilter('status', array('neq' => Diglin_Ricento_Helper_Data::STATUS_LISTED))
199
+ ->count();
200
+
201
+ if ($numberOfItemsToDelete) {
202
+ $items->walk('delete');
203
+ }
204
+
205
+ $itemResource->commit();
206
+ return array($numberOfItemsToDelete, $numberOfListedItems);
207
+ }
208
+
209
+ /**
210
+ * @return Diglin_Ricento_Model_Sales_Options
211
+ */
212
+ public function getSalesOptions()
213
+ {
214
+ if (!$this->_salesOptions) {
215
+ $this->_salesOptions = Mage::getModel('diglin_ricento/sales_options');
216
+ $this->_salesOptions->load($this->getSalesOptionsId());
217
+ }
218
+ return $this->_salesOptions;
219
+ }
220
+
221
+ /**
222
+ * @return Diglin_Ricento_Model_Rule
223
+ */
224
+ public function getShippingPaymentRule()
225
+ {
226
+ if (!$this->_shippingPaymentRule) {
227
+ $this->_shippingPaymentRule = Mage::getModel('diglin_ricento/rule');
228
+ $this->_shippingPaymentRule->load($this->getRuleId());
229
+ }
230
+ return $this->_shippingPaymentRule;
231
+ }
232
+ }
app/code/community/Diglin/Ricento/Model/Products/Listing/Item.php ADDED
@@ -0,0 +1,710 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use Diglin\Ricardo\Core\Helper;
13
+ use Diglin\Ricardo\Enums\Article\InternalReferenceType;
14
+ use Diglin\Ricardo\Enums\Article\PromotionCode;
15
+ use Diglin\Ricardo\Enums\PictureExtension;
16
+ use Diglin\Ricardo\Enums\System\CategoryBrandingFilter;
17
+ use Diglin\Ricardo\Managers\Sell\Parameter\ArticleDeliveryParameter;
18
+ use Diglin\Ricardo\Managers\Sell\Parameter\ArticleDescriptionParameter;
19
+ use Diglin\Ricardo\Managers\Sell\Parameter\ArticleInformationParameter;
20
+ use Diglin\Ricardo\Managers\Sell\Parameter\ArticleInternalReferenceParameter;
21
+ use Diglin\Ricardo\Managers\Sell\Parameter\ArticlePictureParameter;
22
+ use Diglin\Ricardo\Managers\Sell\Parameter\InsertArticleParameter;
23
+ use Diglin\Ricardo\Managers\Sell\Parameter\CloseArticleParameter;
24
+ use Diglin\Ricardo\Managers\Sell\Parameter\DeletePlannedArticleParameter;
25
+
26
+ /**
27
+ * Products_Listing_Item Model
28
+ *
29
+ * @method int getProductId()
30
+ * @method int getParentItemId()
31
+ * @method int getParentProductId()
32
+ * @method int getRicardoArticleId()
33
+ * @method int getQtyInventory()
34
+ * @method int getProductsListingId()
35
+ * @method int getSalesOptionsId()
36
+ * @method int getRuleId()
37
+ * @method int getIsPlanned()
38
+ * @method string getStatus()
39
+ * @method DateTime getCreatedAt()
40
+ * @method DateTime getUpdatedAt()
41
+ * @method bool getReload()
42
+ * @method int getStoreId()
43
+ * @method int getDefaultStoreId()
44
+ * @method bool getLoadFallbackOptions()
45
+ * @method Diglin_Ricento_Model_Products_Listing_Item setProductId(int $productId)
46
+ * @method Diglin_Ricento_Model_Products_Listing_Item setParentItemId(int $parentItemId)
47
+ * @method Diglin_Ricento_Model_Products_Listing_Item setParentProductId(int $parentProductId)
48
+ * @method Diglin_Ricento_Model_Products_Listing_Item setRicardoArticleId(int $ricardoArticleId)
49
+ * @method Diglin_Ricento_Model_Products_Listing_Item setQtyInventory(int $inventoryQty)
50
+ * @method Diglin_Ricento_Model_Products_Listing_Item setProductsListingId(int $productListingId)
51
+ * @method Diglin_Ricento_Model_Products_Listing_Item setSalesOptionsId(int $salesOptionsId)
52
+ * @method Diglin_Ricento_Model_Products_Listing_Item setRuleId(int $ruleIid)
53
+ * @method Diglin_Ricento_Model_Products_Listing_Item setIsPlanned(int $isPlanned)
54
+ * @method Diglin_Ricento_Model_Products_Listing_Item setStatus(string $status)
55
+ * @method Diglin_Ricento_Model_Products_Listing_Item setAdditionalData(string $additionalData)
56
+ * @method Diglin_Ricento_Model_Products_Listing_Item setCreatedAt(DateTime $createdAt)
57
+ * @method Diglin_Ricento_Model_Products_Listing_Item setUpdatedAt(DateTime $updatedAt)
58
+ * @method Diglin_Ricento_Model_Products_Listing_Item setReload(bool $reload)
59
+ * @method Diglin_Ricento_Model_Products_Listing_Item setStoreId(int $storeId)
60
+ * @method Diglin_Ricento_Model_Products_Listing_Item setDefaultStoreId(int $storeId)
61
+ * @method Diglin_Ricento_Model_Products_Listing_Item setLoadFallbackOptions(bool $loadFallbackOptions)
62
+ */
63
+ class Diglin_Ricento_Model_Products_Listing_Item extends Mage_Core_Model_Abstract
64
+ {
65
+ /**
66
+ * @var Diglin_Ricento_Model_Sales_Options
67
+ */
68
+ protected $_salesOptions;
69
+
70
+ /**
71
+ * @var Diglin_Ricento_Model_Rule
72
+ */
73
+ protected $_shippingPaymentRule;
74
+
75
+ /**
76
+ * Prefix of model events names
77
+ * @var string
78
+ */
79
+ protected $_eventPrefix = 'products_listing_item';
80
+
81
+ /**
82
+ * Parameter name in event
83
+ * In observe method you can use $observer->getEvent()->getObject() in this case
84
+ * @var string
85
+ */
86
+ protected $_eventObject = 'products_listing_item';
87
+
88
+ /**
89
+ * @var Diglin_Ricento_Model_Products_Listing
90
+ */
91
+ protected $_productsListing;
92
+
93
+ /**
94
+ * @var Diglin_Ricento_Model_Products_Listing_Item_Product
95
+ */
96
+ protected $_itemProduct;
97
+
98
+ /**
99
+ * Products_Listing_Item Constructor
100
+ * @return void
101
+ */
102
+ protected function _construct()
103
+ {
104
+ parent::_construct();
105
+ $this->_init('diglin_ricento/products_listing_item');
106
+ }
107
+
108
+ /**
109
+ * @return Diglin_Ricento_Model_Products_Listing_Item
110
+ */
111
+ protected function _beforeSave()
112
+ {
113
+ parent::_beforeSave();
114
+
115
+ if ($this->hasDataChanges() && $this->getStatus() != Diglin_Ricento_Helper_Data::STATUS_LISTED) {
116
+ if (!$this->getParentProductId()) {
117
+ $this->setStatus(Diglin_Ricento_Helper_Data::STATUS_PENDING);
118
+
119
+ if ($this->getId()) {
120
+ // Delete configurable product children, will be recreated when the check list process is done
121
+ $this->getCollection()
122
+ ->addFieldToFilter('products_listing_id', $this->getProductsListingId())
123
+ ->addFieldToFilter('parent_item_id', $this->getId())
124
+ ->addFieldToFilter('ricardo_article_id', array('null' => 1))
125
+ ->walk('delete');
126
+ }
127
+ }
128
+ }
129
+
130
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
131
+
132
+ if ($this->isObjectNew()) {
133
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
134
+ }
135
+
136
+ return $this;
137
+ }
138
+
139
+ /**
140
+ * @return $this|Mage_Core_Model_Abstract
141
+ */
142
+ protected function _afterDeleteCommit()
143
+ {
144
+ if ($this->getSalesOptionsId()) {
145
+ $this->getSalesOptions()->delete();
146
+ }
147
+
148
+ if ($this->getRuleId()) {
149
+ $this->getShippingPaymentRule()->delete();
150
+ }
151
+
152
+ parent::_afterDeleteCommit();
153
+ return $this;
154
+ }
155
+
156
+ /**
157
+ * @return Diglin_Ricento_Model_Products_Listing_Item_Product
158
+ */
159
+ public function getProduct()
160
+ {
161
+ if (empty($this->_itemProduct)) {
162
+ $this->_itemProduct = Mage::getModel('diglin_ricento/products_listing_item_product');
163
+ $this->_itemProduct
164
+ ->setProductListingItem($this)
165
+ ->setDefaultStoreId($this->getDefaultStoreId()); // fallback for language
166
+ }
167
+
168
+ $reload = $this->getReload();
169
+ if ($reload) {
170
+ // To use with precaution - it's a bottleneck
171
+ $this->_itemProduct->reset();
172
+ $this->setReload(false);
173
+ }
174
+
175
+ return $this->_itemProduct
176
+ ->setStoreId($this->getStoreId())
177
+ ->setProductId($this->getProductId());
178
+ }
179
+
180
+ /**
181
+ * @return Diglin_Ricento_Model_Sales_Options
182
+ */
183
+ public function getSalesOptions()
184
+ {
185
+ if (!$this->_salesOptions) {
186
+ if ($this->getSalesOptionsId()) {
187
+ $this->_salesOptions = Mage::getModel('diglin_ricento/sales_options');
188
+ $this->_salesOptions->load($this->getSalesOptionsId());
189
+ } elseif ($this->getLoadFallbackOptions()) {
190
+ $this->_salesOptions = $this->getProductsListing()->getSalesOptions();
191
+ }
192
+ }
193
+
194
+ return $this->_salesOptions;
195
+ }
196
+
197
+ /**
198
+ * @return Diglin_Ricento_Model_Rule
199
+ */
200
+ public function getShippingPaymentRule()
201
+ {
202
+ if (!$this->_shippingPaymentRule) {
203
+ if ($this->getRuleId()) {
204
+ $this->_shippingPaymentRule = Mage::getModel('diglin_ricento/rule');
205
+ $this->_shippingPaymentRule->load($this->getRuleId());
206
+ } elseif ($this->getLoadFallbackOptions()) {
207
+ $this->_shippingPaymentRule = $this->getProductsListing()->getShippingPaymentRule();
208
+ }
209
+ }
210
+ return $this->_shippingPaymentRule;
211
+ }
212
+
213
+ /**
214
+ * @return Diglin_Ricento_Model_Products_Listing
215
+ */
216
+ public function getProductsListing()
217
+ {
218
+ if (empty($this->_productsListing) || !$this->_productsListing->getId()) {
219
+ $this->_productsListing = Mage::getModel('diglin_ricento/products_listing')->load($this->getProductsListingId());
220
+ }
221
+ return $this->_productsListing;
222
+ }
223
+
224
+ /**
225
+ * @return int
226
+ */
227
+ public function getCategory()
228
+ {
229
+ $ricardoCategoryId = $this->getSalesOptions()->getRicardoCategory();
230
+ if ($ricardoCategoryId < 0) {
231
+ $catIds = $this->getProduct()->getCategoryIds($this->getBaseProductId());
232
+ if (!$catIds) {
233
+ return false;
234
+ }
235
+ foreach ($catIds as $id) {
236
+ $category = Mage::getModel('catalog/category')->load($id);
237
+ $ricardoCategoryId = $category->getRicardoCategory();
238
+ if ($ricardoCategoryId) {
239
+ break;
240
+ }
241
+ }
242
+ }
243
+
244
+ return (int) $ricardoCategoryId;
245
+ }
246
+
247
+ /**
248
+ * @return Mage_Catalog_Model_Product
249
+ */
250
+ public function getMagentoProduct()
251
+ {
252
+ return $this->getProduct()->getMagentoProduct();
253
+ }
254
+
255
+ /**
256
+ * Get base Product Id in case of configurable product
257
+ * @return int
258
+ */
259
+ public function getBaseProductId()
260
+ {
261
+ if ($this->getParentProductId()) {
262
+ $productId = $this->getParentProductId();
263
+ } else {
264
+ $productId = $this->getProductId();
265
+ }
266
+ return $productId;
267
+ }
268
+
269
+ /**
270
+ * @param bool $sub
271
+ * @return string
272
+ */
273
+ public function getProductTitle($sub = true)
274
+ {
275
+ return $this->getProduct()->getTitle($this->getBaseProductId(), $this->getStoreId(), $sub);
276
+ }
277
+
278
+ /**
279
+ * @param bool $sub
280
+ * @return array|string
281
+ */
282
+ public function getProductSubtitle($sub = true)
283
+ {
284
+ // Get subtitle from configurable options
285
+ if ($this->getParentProductId()) {
286
+ $subtitles = array();
287
+ foreach ($this->getAdditionalData()->getOptions() as $option) {
288
+ $subtitles[] = $option['subtitle'];
289
+ }
290
+ return implode(' | ', $subtitles); // @todo make it for the different store views
291
+ }
292
+ return $this->getProduct()->getSubtitle($this->getProductId(), $this->getStoreId(), $sub);
293
+ }
294
+
295
+ /**
296
+ * @param bool $sub
297
+ * @return mixed|string
298
+ */
299
+ public function getProductDescription($sub = true)
300
+ {
301
+ $description = $this->getProduct()->getDescription($this->getBaseProductId(), $this->getStoreId(), $sub);
302
+
303
+ return strip_tags(nl2br($description), implode('', Mage::helper('diglin_ricento')->getAllowedTags()));
304
+ }
305
+
306
+ /**
307
+ * @return float
308
+ */
309
+ public function getProductPrice()
310
+ {
311
+ // We take the price from default store view
312
+ $productPrice = $this->getProduct()
313
+ ->setProductId($this->getBaseProductId())
314
+ ->setStoreId($this->getDefaultStoreId())
315
+ ->getPrice();
316
+
317
+ // if child of configurable add the product variation depending on the options (options are ordered by position normally)
318
+ if ($this->getParentProductId()) {
319
+ foreach ($this->getAdditionalData()->getOptions() as $option) {
320
+ if (isset($option['pricing_value'])) {
321
+ $productPrice += Mage::helper('diglin_ricento/price')->calcSelectionPrice($option, $productPrice);
322
+ }
323
+ }
324
+ }
325
+
326
+ return $productPrice;
327
+ }
328
+
329
+ /**
330
+ * @return int
331
+ */
332
+ public function getProductQty()
333
+ {
334
+ if ($this->getSalesOptions()->getStockManagement() == -1) {
335
+ // In case a product belongs to a configurable product
336
+ if ($this->getParentProductId()) {
337
+ return $this->getAdditionalData()->getStockQty();
338
+ }
339
+
340
+ return $this->getProduct()->getQty();
341
+ } else {
342
+ return $this->getSalesOptions()->getStockManagement();
343
+ }
344
+ }
345
+
346
+ /**
347
+ * @return int
348
+ */
349
+ public function getProductSku()
350
+ {
351
+ return $this->getProduct()->getSku($this->getProductId());
352
+ }
353
+
354
+ /**
355
+ * @return string
356
+ */
357
+ public function getProductCondition()
358
+ {
359
+ $salesOptions = $this->getSalesOptions();
360
+ $sourceCondition = $salesOptions->getProductConditionSourceAttributeCode();
361
+
362
+ if (!empty($sourceCondition)) {
363
+ $condition = $this->getProduct()->getCondition($this->getBaseProductId());
364
+ if (!empty($condition)) {
365
+ return $condition;
366
+ }
367
+ }
368
+
369
+ return $salesOptions->getProductCondition();
370
+ }
371
+
372
+ /**
373
+ * @return string
374
+ */
375
+ public function getInternalReference()
376
+ {
377
+ return Mage::helper('diglin_ricento')->generateInternalReference($this);
378
+ }
379
+
380
+ /**
381
+ * Define a list of store IDs for each supported and expected language
382
+ * Define a default one in case of accept all languages
383
+ *
384
+ * @return array
385
+ */
386
+ protected function _prepareStoresLanguage()
387
+ {
388
+ // Prepare language and store id for each language
389
+ $storesLang = array();
390
+ $defaultLang = null;
391
+ $publishLanguages = $this->getProductsListing()->getPublishLanguages();
392
+
393
+ if ($publishLanguages == 'all') {
394
+ $languages = Mage::helper('diglin_ricento')->getSupportedLang();
395
+ $defaultLang = $this->getProductsListing()->getDefaultLanguage();
396
+ foreach ($languages as $language) {
397
+ $method = 'getLangStoreId' . ucwords($language);
398
+ $storesLang[$language] = $this->$method();
399
+ if ($defaultLang == $language) {
400
+ $this->setDefaultStoreId($storesLang[$language]);
401
+ }
402
+ }
403
+ } else {
404
+ $method = 'getLangStoreId' . ucwords($publishLanguages);
405
+ $storesLang[$publishLanguages] = $this->$method();
406
+ }
407
+
408
+ return $storesLang;
409
+ }
410
+
411
+ /**
412
+ * Prepare the InsertArticle Parameter
413
+ *
414
+ * @return InsertArticleParameter
415
+ */
416
+ public function getInsertArticleParameter()
417
+ {
418
+ $insertArticleParameter = new InsertArticleParameter();
419
+
420
+ $this->setLoadFallbackOptions(true);
421
+
422
+ $this->_shippingPaymentRule = $this->getShippingPaymentRule();
423
+ $this->_salesOptions = $this->getSalesOptions();
424
+
425
+ //** Article Description
426
+
427
+ foreach ($this->_prepareStoresLanguage() as $language => $storeId) {
428
+ $this->setStoreId($storeId);
429
+ $insertArticleParameter->setDescriptions($this->_getArticleDescriptionsParameter($language));
430
+ }
431
+
432
+ //** Article Images
433
+
434
+ $images = (array) $this->getProduct()->getImages($this->getBaseProductId());
435
+ $images = array();
436
+ $i = 0;
437
+ $hash = array();
438
+ foreach ($images as $image) {
439
+ $hashImage = md5($image['filepath']);
440
+ if (isset($image['filepath']) && file_exists($image['filepath']) && !isset($hash[$hashImage])) {
441
+ // Prepare picture to set the content as byte array for the webservice
442
+ $imageContent = array_values(unpack('C*', file_get_contents($image['filepath'])));
443
+ $imageExtension = Helper::getPictureExtension($image['filepath']);
444
+
445
+ if ($imageExtension) {
446
+ $picture = new ArticlePictureParameter();
447
+ $picture
448
+ ->setPictureBytes($imageContent)
449
+ ->setPictureExtension($imageExtension)
450
+ ->setPictureIndex(++$i);
451
+
452
+ $insertArticleParameter->setPictures($picture);
453
+ }
454
+ $imageContent = null;
455
+ $hash[$hashImage] = true;
456
+ }
457
+ }
458
+
459
+ $insertArticleParameter
460
+ ->setAntiforgeryToken($this->_getAntiforgeryToken())
461
+ ->setArticleInformation($this->_getArticleInformationParameter())
462
+ ->setIsUpdateArticle(false);
463
+
464
+ return $insertArticleParameter;
465
+ }
466
+
467
+ /**
468
+ * Prepare the Article Delivery Parameter
469
+ *
470
+ * @return ArticleDeliveryParameter
471
+ */
472
+ protected function _getArticleDeliveryParameter()
473
+ {
474
+ $shippingPrice = $this->_shippingPaymentRule->getShippingPrice();
475
+ $freeShipping = false;
476
+ if (floatval($shippingPrice) <= 0) {
477
+ $freeShipping = true;
478
+ }
479
+
480
+ $delivery = new ArticleDeliveryParameter();
481
+
482
+ $delivery
483
+ // required
484
+ ->setDeliveryCost($this->_shippingPaymentRule->getShippingPrice())
485
+ ->setIsDeliveryFree($freeShipping)
486
+ ->setDeliveryId($this->_shippingPaymentRule->getShippingMethod())
487
+ ->setIsCumulativeShipping($this->_shippingPaymentRule->getShippingCumulativeFee())
488
+ // optional
489
+ ->setDeliveryPackageSizeId($this->_shippingPaymentRule->getShippingPackage());
490
+
491
+ return $delivery;
492
+ }
493
+
494
+ /**
495
+ * Prepare the Internal Reference Parameter
496
+ *
497
+ * @return ArticleInternalReferenceParameter
498
+ */
499
+ protected function _getInternalReferencesParameter()
500
+ {
501
+ $internalReferences = new ArticleInternalReferenceParameter();
502
+
503
+ $internalReferences
504
+ ->setInternalReferenceTypeId(InternalReferenceType::SELLERSPECIFIC)
505
+ ->setInternalReferenceValue($this->getInternalReference());
506
+
507
+ return $internalReferences;
508
+ }
509
+
510
+ /**
511
+ * Prepare the Article Information
512
+ *
513
+ * @return ArticleInformationParameter
514
+ */
515
+ protected function _getArticleInformationParameter()
516
+ {
517
+ $promotionIds = array();
518
+ $paymentConditions = array();
519
+
520
+ $paymentMethods = (array) $this->_shippingPaymentRule->getPaymentMethods();
521
+ $salesType = $this->_salesOptions->getSalesType();
522
+
523
+ foreach ($paymentMethods as $paymentMethod) {
524
+ $paymentConditions[] = $this->_getPaymentConditionId($paymentMethod);
525
+ }
526
+
527
+ if ($this->_salesOptions->getScheduleOverwriteProductDateStart()) {
528
+ $startDate = $this->getProductsListing()->getSalesOptions()->getScheduleDateStart();
529
+ } else {
530
+ $startDate = $this->_salesOptions->getScheduleDateStart();
531
+ }
532
+
533
+ $untilSoldOut = ((int) $this->_salesOptions->getScheduleReactivation() === Diglin_Ricento_Model_Config_Source_Sales_Reactivation::SOLDOUT);
534
+
535
+ $customTemplate = ($this->_salesOptions->getCustomizationTemplate() >= 0) ? $this->_salesOptions->getCustomizationTemplate() : null;
536
+
537
+ $articleInformation = new ArticleInformationParameter();
538
+ $articleInformation
539
+ // required
540
+ ->setArticleConditionId($this->getProductCondition())
541
+ ->setArticleDuration(($this->_salesOptions->getSchedulePeriodDays() * 24 * 60)) // In minutes
542
+ ->setAvailabilityId($this->_shippingPaymentRule->getShippingAvailability())
543
+ ->setCategoryId($this->getCategory())
544
+ ->setInitialQuantity($this->getProductQty())
545
+ ->setIsCustomerTemplate(((!is_null($customTemplate)) ? true : false))
546
+ ->setMainPictureId(1)
547
+ ->setMaxRelistCount((!$untilSoldOut) ? $this->_salesOptions->getScheduleReactivation() : 0)
548
+ ->setWarrantyId($this->_salesOptions->getProductWarranty())
549
+ ->setDeliveries($this->_getArticleDeliveryParameter())
550
+ // optional
551
+ ->setInternalReferences($this->_getInternalReferencesParameter())
552
+ ->setPaymentConditionIds($paymentConditions)
553
+ ->setPaymentMethodIds($paymentMethods)
554
+ ->setTemplateId($customTemplate);
555
+
556
+ /**
557
+ * Start Date is mandatory for auction but optional for buy now sales type
558
+ */
559
+ if (!is_null($startDate) || $salesType == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION) {
560
+ $startDate = strtotime($startDate);
561
+
562
+ // ricardo.ch constrains, starting date must be in 1 hour after now
563
+ if ($startDate < (time() + 60*60)) {
564
+ $startDate = time() + 60*60;
565
+ }
566
+
567
+ $articleInformation->setStartDate(Mage::helper('diglin_ricento')->getJsonDate($startDate));
568
+ }
569
+
570
+ if ($salesType == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION) {
571
+ $articleInformation
572
+ ->setIncrement($this->_salesOptions->getSalesAuctionIncrement())
573
+ ->setStartPrice($this->_salesOptions->getSalesAuctionStartPrice());
574
+
575
+ if ($this->_salesOptions->getSalesAuctionDirectBuy()) {
576
+ $promotionIds[] = PromotionCode::BUYNOW;
577
+ }
578
+ }
579
+
580
+ if ($salesType == Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW || $this->_salesOptions->getSalesAuctionDirectBuy()) {
581
+ $articleInformation->setBuyNowPrice($this->getProductPrice());
582
+ }
583
+
584
+ if ($salesType == Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW) {
585
+ $articleInformation->setIsRelistSoldOut($untilSoldOut);
586
+ }
587
+
588
+ //** Promotions
589
+
590
+ $space = $this->_salesOptions->getPromotionSpace();
591
+ if ($space) {
592
+ $promotionIds[] = (int) $space;
593
+ }
594
+
595
+ $startSpace = $this->_salesOptions->getPromotionStartPage();
596
+ if ($startSpace) {
597
+ $promotionIds[] = (int) $startSpace;
598
+ }
599
+
600
+ // required
601
+ $articleInformation->setPromotionIds($promotionIds);
602
+
603
+ return $articleInformation;
604
+ }
605
+
606
+ /**
607
+ * Prepare Article Description Parameter
608
+ *
609
+ * @param string $lang
610
+ * @return ArticleDescriptionParameter
611
+ */
612
+ protected function _getArticleDescriptionsParameter($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG)
613
+ {
614
+ $descriptions = new ArticleDescriptionParameter();
615
+
616
+ $descriptions
617
+ // required
618
+ ->setArticleTitle($this->getProductTitle())
619
+ ->setArticleDescription($this->getProductDescription())
620
+ ->setLanguageId(Mage::helper('diglin_ricento')->getRicardoLanguageIdFromLocaleCode($lang))
621
+ // optional
622
+ ->setArticleSubtitle($this->getProductSubtitle())
623
+ ->setDeliveryDescription($this->_shippingPaymentRule->getShippingDescription($lang))
624
+ ->setPaymentDescription($this->_shippingPaymentRule->getPaymentDescription($lang))
625
+ ->setWarrantyDescription($this->_salesOptions->getProductWarrantyDescription($lang));
626
+
627
+ return $descriptions;
628
+ }
629
+
630
+ /**
631
+ * @param int $paymentMethod
632
+ * @return null|int
633
+ */
634
+ protected function _getPaymentConditionId($paymentMethod)
635
+ {
636
+ $system = Mage::getSingleton('diglin_ricento/api_services_system');
637
+ $conditions = (array) $system->getPaymentConditionsAndMethods();
638
+
639
+ foreach ($conditions as $condition) {
640
+ if (isset($condition['PaymentMethods']) && !empty($condition['PaymentMethods'])) {
641
+ foreach ($condition['PaymentMethods'] as $method) {
642
+ if (isset($method['PaymentMethodId']) && $method['PaymentMethodId'] == (int) $paymentMethod) {
643
+ return (int) $condition['PaymentConditionId'];
644
+ }
645
+ }
646
+ }
647
+ }
648
+
649
+ return null;
650
+ }
651
+
652
+ /**
653
+ * @return bool|CloseArticleParameter
654
+ */
655
+ public function getCloseArticleParameter()
656
+ {
657
+ if (!$this->getRicardoArticleId()) {
658
+ return false;
659
+ }
660
+
661
+ $closeParameter = new CloseArticleParameter();
662
+ $closeParameter
663
+ ->setAntiforgeryToken($this->_getAntiforgeryToken())
664
+ ->setArticleId($this->getRicardoArticleId());
665
+
666
+ return $closeParameter;
667
+ }
668
+
669
+ /**
670
+ * @return bool|DeletePlannedArticleParameter
671
+ */
672
+ public function getDeleteArticleParameter()
673
+ {
674
+ if (!$this->getRicardoArticleId()) {
675
+ return false;
676
+ }
677
+
678
+ $deleteParameter = new DeletePlannedArticleParameter();
679
+ $deleteParameter
680
+ ->setAntiforgeryToken($this->_getAntiforgeryToken())
681
+ ->setPlannedArticleId($this->getRicardoArticleId());
682
+
683
+ return $deleteParameter;
684
+ }
685
+
686
+ /**
687
+ * @return Diglin_Ricento_Model_Api_Services_Security
688
+ */
689
+ protected function _getAntiforgeryToken()
690
+ {
691
+ return Mage::getSingleton('diglin_ricento/api_services_security')
692
+ ->setCurrentWebsite($this->getProductsListing()->getWebsiteId())
693
+ ->getServiceModel()
694
+ ->getAntiforgeryToken();
695
+ }
696
+
697
+ /**
698
+ * Get the additional data and decode the json string
699
+ *
700
+ * @return array|Varien_Object
701
+ */
702
+ public function getAdditionalData()
703
+ {
704
+ $data = $this->getData('additional_data');
705
+ if ($data) {
706
+ return new Varien_Object(Mage::helper('core')->jsonDecode($data));
707
+ }
708
+ return array();
709
+ }
710
+ }
app/code/community/Diglin/Ricento/Model/Products/Listing/Item/Product.php ADDED
@@ -0,0 +1,1074 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Products_Listing_Item_Product
14
+ */
15
+ class Diglin_Ricento_Model_Products_Listing_Item_Product
16
+ {
17
+ /**
18
+ * @var int
19
+ */
20
+ private $_productId;
21
+
22
+ /**
23
+ * @var int
24
+ */
25
+ private $_storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
26
+
27
+ /**
28
+ * @var null
29
+ */
30
+ private $_defaultStoreId = null; // fallback for language
31
+
32
+ /**
33
+ * @var Mage_Catalog_Model_Product
34
+ */
35
+ protected $_model;
36
+
37
+ /**
38
+ * @var int
39
+ */
40
+ protected $_productListingItemId = null;
41
+
42
+ /**
43
+ * @var Diglin_Ricento_Model_Products_Listing_Item
44
+ */
45
+ protected $_productListingItem = null;
46
+
47
+ /**
48
+ * For grouped products
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_associatedProducts = array();
53
+
54
+ /**
55
+ * For grouped products
56
+ *
57
+ * @var array
58
+ */
59
+ protected $_associatedProductIds = array();
60
+
61
+ /**
62
+ * For configurable products
63
+ *
64
+ * @var array
65
+ */
66
+ protected $_usedProducts = array();
67
+
68
+ /**
69
+ * For configurable products
70
+ *
71
+ * @var array
72
+ */
73
+ protected $_usedProductIds = array();
74
+
75
+ /**
76
+ * For configurable products
77
+ *
78
+ * @var array
79
+ */
80
+ protected $_configurable_attributes = array();
81
+
82
+ protected $_title;
83
+ protected $_subtitle;
84
+ protected $_description;
85
+ protected $_condition;
86
+
87
+ protected $_has_options;
88
+ protected $_required_options;
89
+ protected $_sku;
90
+ protected $_typeid;
91
+ protected $_category_ids = array();
92
+
93
+ public function _construct($productListingItemId = null)
94
+ {
95
+ $this->_productListingItemId = $productListingItemId;
96
+
97
+ if (!is_null($productListingItemId) && is_numeric($productListingItemId)) {
98
+ $this->setProductListingItem(Mage::getModel('diglin_ricento/products_listing_item')
99
+ ->load($productListingItemId)
100
+ ->setLoadFallbackOptions(true));
101
+ }
102
+ }
103
+
104
+ /**
105
+ * @return $this
106
+ */
107
+ public function reset()
108
+ {
109
+ $this->_model = null;
110
+ $this->_productListingItemId = null;
111
+ $this->_associatedProducts = null;
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * @return Mage_Catalog_Model_Product
117
+ * @throws Exception
118
+ */
119
+ public function getMagentoProduct()
120
+ {
121
+ if ($this->_model) {
122
+ return $this->_model;
123
+ }
124
+
125
+ if ($this->_productId > 0) {
126
+ $this->loadProduct();
127
+ return $this->_model;
128
+ }
129
+
130
+ throw new Exception('Model has not been instanciated');
131
+ }
132
+
133
+ /**
134
+ * @param Mage_Catalog_Model_Product $productModel
135
+ * @return $this
136
+ */
137
+ public function setProduct(Mage_Catalog_Model_Product $productModel)
138
+ {
139
+ $this->_model = $productModel;
140
+
141
+ $this->setProductId($productModel->getId());
142
+ $this->setStoreId($productModel->getStoreId());
143
+
144
+ return $this;
145
+ }
146
+
147
+ /**
148
+ * @param null|int $productId
149
+ * @param null|int $storeId
150
+ * @return $this
151
+ * @throws Exception
152
+ */
153
+ public function loadProduct($productId = null, $storeId = null)
154
+ {
155
+ $productId = (is_null($productId)) ? $this->_productId : $productId;
156
+ $storeId = (is_null($storeId)) ? $this->_storeId : $storeId;
157
+
158
+ if (!$productId) {
159
+ throw new Exception('Product ID is empty.');
160
+ }
161
+
162
+ $this->_model = Mage::getModel('catalog/product')
163
+ ->setStoreId($storeId)
164
+ ->load($productId);
165
+
166
+ $this->setProductId($productId);
167
+ $this->setStoreId($storeId);
168
+
169
+ return $this;
170
+ }
171
+
172
+ /**
173
+ * @param int $storeId
174
+ * @return array
175
+ */
176
+ public function getStoresList($storeId)
177
+ {
178
+ return array(
179
+ $storeId,
180
+ $this->getDefaultStoreId(),
181
+ Mage_Core_Model_App::ADMIN_STORE_ID
182
+ );
183
+ }
184
+
185
+ /**
186
+ * @param null $productId
187
+ * @return array|bool
188
+ */
189
+ public function getProductInformation($productId = null)
190
+ {
191
+ (!is_null($productId)) && $this->_productId = $productId;
192
+
193
+ $productId = (int) is_null($productId) ? $this->_productId : $productId;
194
+
195
+ if (empty($productId)) {
196
+ return false;
197
+ }
198
+
199
+ $cols = array(
200
+ 'type_id',
201
+ 'sku',
202
+ 'required_options',
203
+ );
204
+
205
+ $readConnection = $this->_getReadConnection();
206
+ $coreResource = $this->_getCoreResource();
207
+
208
+ $select = $readConnection
209
+ ->select()
210
+ ->from(array('cpe' => $coreResource->getTableName('catalog_product_entity')), $cols)
211
+ ->joinLeft(array('cp' => $coreResource->getTableName('catalog/category_product')), 'cpe.entity_id = cp.product_id', "GROUP_CONCAT(category_id SEPARATOR ',') AS category_ids")
212
+ ->joinLeft(array('co' => $coreResource->getTableName('catalog/product_option')), 'co.product_id = cpe.entity_id', new Zend_Db_Expr('IF(co.option_id > 0, 1,0) AS has_options'))
213
+ ->where('`entity_id` = ?', $productId)
214
+ ->group('entity_id');
215
+
216
+ $data = $readConnection->fetchRow($select);
217
+
218
+ if (!empty($data)) {
219
+ $this->_typeid = $data['type_id'];
220
+ $this->_sku = $data['sku'];
221
+ $this->_has_options = $data['has_options'];
222
+ $this->_required_options = $data['required_options'];
223
+ $this->_category_ids = (array) explode(',', $data['category_ids']);
224
+ }
225
+
226
+ return $data;
227
+ }
228
+
229
+ /**
230
+ * @param bool $singleton
231
+ * @return Mage_Catalog_Model_Product_Type_Abstract
232
+ */
233
+ public function getTypeInstance($singleton = false)
234
+ {
235
+ $typeInstance = $this->getMagentoProduct()->getTypeInstance($singleton);
236
+ $typeInstance->setStoreFilter( (int) $this->getStoreId(), $this->getMagentoProduct());
237
+
238
+ return $typeInstance;
239
+ }
240
+
241
+ /**
242
+ * @param null|int $productId
243
+ * @return string
244
+ */
245
+ public function getTypeId($productId = null)
246
+ {
247
+ if (!is_null($productId) && !is_null($this->_model) && $this->_model->getId() && $this->_model->getId() == $productId) {
248
+ return $this->_model->getTypeId();
249
+ }
250
+
251
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
252
+
253
+ if (empty($productId) && empty($this->_typeid)) {
254
+ return false;
255
+ }
256
+
257
+ if (empty($this->_typeid) || $productId != $this->_productId) {
258
+ $this->getProductInformation($productId);
259
+ }
260
+
261
+ return $this->_typeid;
262
+ }
263
+
264
+ /**
265
+ * @param null|int $productId
266
+ * @return bool
267
+ */
268
+ public function getHasOptions($productId = null)
269
+ {
270
+ if (!is_null($productId) && !is_null($this->_model) && $this->_model->getId() && $this->_model->getId() == $productId) {
271
+ return $this->_model->getHasOptions();
272
+ }
273
+
274
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
275
+
276
+ if (empty($productId) && empty($this->_has_options)) {
277
+ return false;
278
+ }
279
+
280
+ if (empty($this->_has_options) || $productId != $this->_productId) {
281
+ $this->getProductInformation($productId);
282
+ }
283
+
284
+ return (bool) $this->_has_options;
285
+ }
286
+
287
+ /**
288
+ * @param null|int $productId
289
+ * @return bool
290
+ */
291
+ public function getRequiredOptions($productId = null)
292
+ {
293
+ if (!is_null($productId) && !is_null($this->_model) && $this->_model->getId() && $this->_model->getId() == $productId) {
294
+ return $this->_model->getRequiredOptions();
295
+ }
296
+
297
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
298
+
299
+ if (empty($productId) && empty($this->_required_options)) {
300
+ return false;
301
+ }
302
+
303
+ if (empty($this->_required_options) || $productId != $this->_productId) {
304
+ $this->getProductInformation($productId);
305
+ }
306
+
307
+ return (bool) $this->_required_options;
308
+ }
309
+
310
+ /**
311
+ * @param null|int $productId
312
+ * @return bool | array
313
+ */
314
+ public function getCategoryIds($productId = null)
315
+ {
316
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
317
+
318
+ if (empty($productId) && empty($this->_category_ids)) {
319
+ return false;
320
+ }
321
+
322
+ if ($productId && empty($this->_category_ids) || $productId != $this->_productId) {
323
+ $this->getProductInformation($productId);
324
+ }
325
+
326
+ return (array) $this->_category_ids;
327
+ }
328
+
329
+ /**
330
+ * @param null|int $productId
331
+ * @param int $storeId
332
+ * @param bool $sub
333
+ * @return string
334
+ */
335
+ public function getTitle($productId = null, $storeId = null, $sub = true)
336
+ {
337
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
338
+ $storeId = (int) (is_null($storeId) ? $this->_storeId : $storeId);
339
+
340
+ $titles = array(
341
+ 'ricardo_title',
342
+ 'name'
343
+ );
344
+
345
+ $returnedTitle = null;
346
+
347
+ foreach ($this->getStoresList($storeId) as $id) {
348
+ if (is_null($id)) {
349
+ continue;
350
+ }
351
+ foreach ($titles as $title) {
352
+ $returnedTitle = $this->_getProductVarchar($title, $productId, $id);
353
+ if ($returnedTitle) {
354
+ break;
355
+ }
356
+ }
357
+ if ($returnedTitle) {
358
+ break;
359
+ }
360
+ }
361
+
362
+ if (empty($returnedTitle)) {
363
+ return '';
364
+ } else if ($sub && !empty($returnedTitle)) {
365
+ return mb_substr($returnedTitle, 0, Diglin_Ricento_Model_Validate_Products_Item::LENGTH_PRODUCT_TITLE);
366
+ } else {
367
+ return $returnedTitle;
368
+ }
369
+ }
370
+
371
+ /**
372
+ * @param null|int $productId
373
+ * @param int $storeId
374
+ * @param bool $sub
375
+ * @return array|string
376
+ */
377
+ public function getSubtitle($productId = null, $storeId = null, $sub = true)
378
+ {
379
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
380
+ $storeId = (int) (is_null($storeId) ? $this->_storeId : $storeId);
381
+
382
+ $subtitle = '';
383
+
384
+ foreach ($this->getStoresList($storeId) as $id) {
385
+ $subtitle = $this->_getProductVarchar('ricardo_subtitle', $productId, $id);
386
+ if ($subtitle) {
387
+ break;
388
+ }
389
+ }
390
+
391
+ if (empty($subtitle)) {
392
+ return '';
393
+ } elseif ($sub) {
394
+ return mb_substr($subtitle, 0, Diglin_Ricento_Model_Validate_Products_Item::LENGTH_PRODUCT_SUBTITLE);
395
+ } else {
396
+ return $subtitle;
397
+ }
398
+ }
399
+
400
+ /**
401
+ * @param null|int $productId
402
+ * @param int $storeId
403
+ * @param bool $sub
404
+ * @return mixed|string
405
+ */
406
+ public function getDescription($productId = null, $storeId = null, $sub = true)
407
+ {
408
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
409
+ $storeId = (int) (is_null($storeId) ? $this->_storeId : $storeId);
410
+
411
+ $descriptions = array(
412
+ 'ricardo_description',
413
+ 'description',
414
+ 'short_description'
415
+ );
416
+
417
+ $returnedDescription = null;
418
+
419
+ foreach ($this->getStoresList($storeId) as $id) {
420
+ if (is_null($id)) {
421
+ continue;
422
+ }
423
+ foreach ($descriptions as $description) {
424
+ $returnedDescription = $this->_getProductText($description, $productId, $id);
425
+ if ($returnedDescription) {
426
+ break;
427
+ }
428
+ }
429
+ if ($returnedDescription) {
430
+ break;
431
+ }
432
+ }
433
+
434
+ if (empty($returnedDescription)) {
435
+ return '';
436
+ } else if ($sub) {
437
+ return mb_substr($returnedDescription, 0, Diglin_Ricento_Model_Validate_Products_Item::LENGTH_PRODUCT_DESCRIPTION);
438
+ } else {
439
+ return $returnedDescription;
440
+ }
441
+ }
442
+
443
+ /**
444
+ * @return float
445
+ */
446
+ public function getPrice()
447
+ {
448
+ //@todo do the conversion from a non supported currency to the supported currency - at the moment we do not support this feature
449
+
450
+ $salesOptions = $this->getProductListingItem()->getSalesOptions();
451
+ $price = $this->_getProductPrice($salesOptions->getPriceSourceAttributeCode());
452
+
453
+ return Mage::helper('diglin_ricento/price')->calculatePriceChange($price, $salesOptions->getPriceChangeType(), $salesOptions->getPriceChange());
454
+ }
455
+
456
+ /**
457
+ * @param null $productId
458
+ * @return string
459
+ */
460
+ public function getSku($productId = null)
461
+ {
462
+ if (!is_null($productId) && !is_null($this->_model) && $this->_model->getId() && $this->_model->getId() == $productId) {
463
+ return $this->_model->getSku();
464
+ }
465
+
466
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
467
+
468
+ if (empty($productId) && empty($this->_sku)) {
469
+ return false;
470
+ }
471
+
472
+ if (empty($this->_sku) || $productId != $this->_productId) {
473
+ $this->getProductInformation($productId);
474
+ }
475
+
476
+ return $this->_sku;
477
+ }
478
+
479
+ /**
480
+ * @param null $productId
481
+ * @param int $storeId
482
+ * @return array
483
+ */
484
+ public function getCondition($productId = null, $storeId = Mage_Core_Model_App::ADMIN_STORE_ID)
485
+ {
486
+ return $this->_getProductVarchar('ricardo_condition', $productId, $storeId);
487
+ }
488
+
489
+ /**
490
+ * @param int|null $productId
491
+ * @return array|bool
492
+ */
493
+ public function getImages($productId = null)
494
+ {
495
+ if (is_null($productId) && $this->_model && $this->_model->getId()) {
496
+ $productId = $this->_model->getId();
497
+ } elseif (is_null($productId) && $this->_productId) {
498
+ $productId = $this->_productId;
499
+ }
500
+
501
+ if (!is_numeric($productId)) {
502
+ return false;
503
+ }
504
+
505
+ $mediaConfig = Mage::getSingleton('catalog/product_media_config');
506
+ $images = $this->getAssignedImages($productId);
507
+
508
+ foreach ($images as &$image) {
509
+ if (isset($image['filepath'])) {
510
+ $image['filepath'] = $mediaConfig->getMediaPath($image['filepath']);
511
+ }
512
+ }
513
+
514
+ return $images;
515
+ }
516
+
517
+ /**
518
+ * Return assigned images for specific stores
519
+ *
520
+ * @param int $productId
521
+ * @return array
522
+ *
523
+ */
524
+ public function getAssignedImages($productId = null)
525
+ {
526
+ $productId = (int) (is_null($productId) ? $this->_productId : $productId);
527
+
528
+ $read = $this->_getReadConnection();
529
+ $resource = $this->_getCoreResource();
530
+
531
+ /**
532
+ * Get the gallery images, only those enabled
533
+ */
534
+ $select = $read->select()
535
+ ->from(
536
+ array('mg' => $resource->getTableName('catalog/product_attribute_media_gallery')),
537
+ array(
538
+ 'filepath' => 'mg.value'
539
+ )
540
+ )
541
+ ->joinLeft(
542
+ array('mgv' => $resource->getTableName('catalog/product_attribute_media_gallery_value')),
543
+ '(mg.value_id = mgv.value_id AND mgv.store_id = 0)',
544
+ array()
545
+ )
546
+ ->where('entity_id IN(?)', $productId)
547
+ ->where('disabled = 0')
548
+ ->order(array('mgv.position ASC'));
549
+
550
+ $mediaGallery = $read->fetchAll($select);
551
+
552
+ /**
553
+ * Get the Base image
554
+ */
555
+ $mainTable = Mage::getResourceModel('catalog/product')->getAttribute('image')
556
+ ->getBackend()
557
+ ->getTable();
558
+
559
+ $select = $read->select()
560
+ ->from(
561
+ array('images' => $mainTable),
562
+ array('value as filepath')
563
+ )
564
+ ->joinLeft(
565
+ array('attr' => $resource->getTableName('eav/attribute')),
566
+ 'images.attribute_id = attr.attribute_id',
567
+ array('attribute_code')
568
+ )
569
+ ->where('entity_id = ?', $productId)
570
+ ->where('store_id = 0')
571
+ ->where('attribute_code = ?', 'image');
572
+
573
+ return array_merge($mediaGallery, $read->fetchAll($select));
574
+ }
575
+
576
+ /**
577
+ * @return Mage_CatalogInventory_Model_Stock_Item
578
+ * @throws Exception
579
+ */
580
+ public function getStockItem()
581
+ {
582
+ if (is_null($this->_model) && $this->_productId < 0) {
583
+ throw new Exception('Product Model must be init first');
584
+ }
585
+
586
+ $productId = !is_null($this->_model) ? $this->_model->getId() : $this->_productId;
587
+
588
+ return Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
589
+ }
590
+
591
+ /**
592
+ * @return bool|float
593
+ */
594
+ public function getQty()
595
+ {
596
+ if ($this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
597
+ || $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
598
+ return false;
599
+ }
600
+
601
+ $stockItem = $this->getStockItem();
602
+
603
+ if ($stockItem->getIsQtyDecimal()) {
604
+ return false;
605
+ }
606
+
607
+ return $stockItem->getQty();
608
+ }
609
+
610
+ /**
611
+ * Check quantity
612
+ *
613
+ * @param float $qty
614
+ * @exception Mage_Core_Exception
615
+ * @return bool
616
+ */
617
+ public function checkQty($qty)
618
+ {
619
+ $stockItem = $this->getStockItem();
620
+
621
+ if (!$stockItem->getManageStock()) {
622
+ return true;
623
+ }
624
+
625
+ $composite = false;
626
+ $usedProductIds = array();
627
+
628
+ if ($this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
629
+ /* @var $instance Mage_Catalog_Model_Product_Type_Configurable */
630
+ $usedProductIds = $this->getTypeInstance(true)->getUsedProductIds($this->getMagentoProduct());
631
+ $composite = true;
632
+ } else if ($this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
633
+ /* @var $instance Mage_Catalog_Model_Product_Type_Grouped */
634
+ $usedProductIds = $this->getAssociatedProductIds();
635
+ $composite = true;
636
+ }
637
+
638
+ if ($composite) {
639
+ foreach ($usedProductIds as $id) {
640
+ $stockItem->unsetData(); // cleanup before to proceed, we may also use the method reset but it's not relevant here
641
+ $stockItemProd = $stockItem->loadByProduct($id);
642
+ if ($stockItemProd->getQty() - $stockItemProd->getMinQty() - $qty < 0) {
643
+ switch ($stockItemProd->getBackorders()) {
644
+ case Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NONOTIFY:
645
+ case Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NOTIFY:
646
+ break;
647
+ default:
648
+ return false;
649
+ break;
650
+ }
651
+ }
652
+ }
653
+ } else {
654
+ if ($stockItem->getQty() - $stockItem->getMinQty() - $qty < 0) {
655
+ switch ($stockItem->getBackorders()) {
656
+ case Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NONOTIFY:
657
+ case Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NOTIFY:
658
+ break;
659
+ default:
660
+ return false;
661
+ break;
662
+ }
663
+ }
664
+ }
665
+ return true;
666
+ }
667
+
668
+ /**
669
+ * @return Mage_Core_Model_Resource
670
+ */
671
+ protected function _getCoreResource()
672
+ {
673
+ return Mage::getSingleton('core/resource');
674
+ }
675
+
676
+ /**
677
+ * @return Varien_Db_Adapter_Interface
678
+ */
679
+ protected function _getReadConnection()
680
+ {
681
+ return $this->_getCoreResource()->getConnection('core_read');
682
+ }
683
+
684
+ /**
685
+ * @param string $field
686
+ * @param null $productId
687
+ * @param int $storeId
688
+ * @return array
689
+ */
690
+ protected function _getProductVarchar($field, $productId = null, $storeId = Mage_Core_Model_App::ADMIN_STORE_ID)
691
+ {
692
+ $readConnection = $this->_getReadConnection();
693
+ $coreResource = $this->_getCoreResource();
694
+
695
+ $select = $readConnection
696
+ ->select()
697
+ ->from(array('cpev'=> $coreResource->getTableName('catalog_product_entity_varchar')), array($field => 'value'))
698
+ ->join(
699
+ array('ea' => $coreResource->getTableName('eav_attribute')),
700
+ '`cpev`.`attribute_id` = `ea`.`attribute_id` AND `ea`.`attribute_code` = \''. $field .'\'',
701
+ array()
702
+ )
703
+ ->where('`cpev`.`entity_id` = ?', $productId)
704
+ ->where('`cpev`.`store_id` = ?', $storeId);
705
+
706
+ return $readConnection->fetchOne($select);
707
+ }
708
+
709
+ /**
710
+ * @param $field
711
+ * @param null $productId
712
+ * @param int $storeId
713
+ * @return string
714
+ */
715
+ protected function _getProductText($field, $productId = null, $storeId = Mage_Core_Model_App::ADMIN_STORE_ID)
716
+ {
717
+ $readConnection = $this->_getReadConnection();
718
+
719
+ $select = $readConnection
720
+ ->select()
721
+ ->from(array('cpet'=> $this->_getCoreResource()->getTableName('catalog_product_entity_text')), array($field => 'value'))
722
+ ->join(
723
+ array('ea' => $this->_getCoreResource()->getTableName('eav_attribute')),
724
+ '`cpet`.`attribute_id` = `ea`.`attribute_id` AND `ea`.`attribute_code` = \''. $field .'\'',
725
+ array()
726
+ )
727
+ ->where('`cpet`.`entity_id` = ?', $productId)
728
+ ->where('`cpet`.`store_id` = ?', $storeId);
729
+
730
+ return $readConnection->fetchOne($select);
731
+ }
732
+
733
+ /**
734
+ * @param $field
735
+ * @return string
736
+ */
737
+ protected function _getProductPrice($field = null)
738
+ {
739
+ switch ($this->getTypeId()) {
740
+ case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
741
+ $price = $this->_getSimpleProductBasePrice($field);
742
+ return $this->_getConfigurableProductBasePrice($price);
743
+ break;
744
+ case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
745
+ return $this->_getGroupedProductBasePrice();
746
+ break;
747
+ case Mage_Catalog_Model_Product_Type::TYPE_SIMPLE:
748
+ default:
749
+ // @todo implement a factory adapter to get other kind of external product type
750
+ return $this->_getSimpleProductBasePrice($field);
751
+ break;
752
+ }
753
+ }
754
+
755
+ /**
756
+ * @param null $field
757
+ * @param bool $withTax
758
+ * @return float|string
759
+ */
760
+ protected function _getSimpleProductBasePrice($field = null, $withTax = true)
761
+ {
762
+ if (is_null($field)) {
763
+ $field = 'price';
764
+ }
765
+
766
+ $readConnection = $this->_getReadConnection();
767
+
768
+ $select = $readConnection
769
+ ->select()
770
+ ->from(array('cped'=> $this->_getCoreResource()->getTableName('catalog_product_entity_decimal')), array($field => 'value'))
771
+ ->join(
772
+ array('ea' => $this->_getCoreResource()->getTableName('eav_attribute')),
773
+ '`cped`.`attribute_id` = `ea`.`attribute_id` AND `ea`.`attribute_code` = \''. $field .'\'',
774
+ array()
775
+ )
776
+ ->where('`cped`.`entity_id` = ?', (int) $this->getProductId())
777
+ ->where('`cped`.`store_id` = ?', $this->_defaultStoreId);
778
+
779
+ $price = $readConnection->fetchOne($select);
780
+
781
+ if ($field == 'special_price' && empty($price)) {
782
+ $price = $this->_getSimpleProductBasePrice('price', false);
783
+ }
784
+
785
+ /**
786
+ * Calculate price with incl tax if price catalog doesn't include it
787
+ * @todo improve performance - Loading product is bad idea (we just need getTaxPercent and getTaxClassId)
788
+ */
789
+ if ($withTax) {
790
+ $price = Mage::helper('tax')->getPrice($this->getMagentoProduct(), $price, true, null, null, null, $this->_defaultStoreId);
791
+ }
792
+
793
+ return $price;
794
+ }
795
+
796
+ /**
797
+ * Associated Products for grouped products
798
+ *
799
+ * @return array
800
+ */
801
+ public function getAssociatedProducts()
802
+ {
803
+ if (!$this->isGroupedType()) {
804
+ return null;
805
+ }
806
+
807
+ if (empty($this->_associatedProducts)) {
808
+ /* @var $groupedInstance Mage_Catalog_Model_Product_Type_Grouped */
809
+ $groupedInstance = $this->getTypeInstance(true);
810
+ $this->_associatedProducts = $groupedInstance->getAssociatedProducts($this->getMagentoProduct());
811
+ }
812
+ return $this->_associatedProducts;
813
+ }
814
+
815
+ /**
816
+ * Associated Product IDs for grouped products
817
+ *
818
+ * @return array|null
819
+ */
820
+ public function getAssociatedProductIds()
821
+ {
822
+ if (!$this->isGroupedType()) {
823
+ return null;
824
+ }
825
+
826
+ if (empty($this->_associatedProducts)) {
827
+ $associatedProducts = $this->getAssociatedProducts();
828
+ foreach ($associatedProducts as $associatedProduct) {
829
+ $this->_associatedProductIds[] = $associatedProduct->getId();
830
+ }
831
+ }
832
+
833
+ return $this->_associatedProductIds;
834
+ }
835
+
836
+ /**
837
+ * Get price of total associated products with default qty
838
+ * Special price not supported by grouped product type
839
+ *
840
+ * @return float|null
841
+ */
842
+ protected function _getGroupedProductBasePrice()
843
+ {
844
+ if (!$this->isGroupedType()) {
845
+ return null;
846
+ }
847
+
848
+ $defaultQty = 1;
849
+ $totalPrice = 0.0;
850
+
851
+ $associatedProducts = $this->getAssociatedProducts();
852
+
853
+ if (!empty($associatedProducts)) {
854
+ foreach ($associatedProducts as $associatedProduct) {
855
+
856
+ // Ricardo is a C2C/B2C platform, price always with tax included
857
+ $priceInclTax = Mage::helper('tax')->getPrice($associatedProduct, $associatedProduct->getPrice(), true, null, null, null, $this->_defaultStoreId);
858
+
859
+ // Set default qty = 1 when qty = 0
860
+ $totalPrice += (((!$associatedProduct->getQty()) ? $associatedProduct->getQty() : $defaultQty) * $priceInclTax);
861
+ }
862
+ }
863
+
864
+ return $totalPrice;
865
+ }
866
+
867
+ /**
868
+ * Used Products for configurable products
869
+ *
870
+ * @return array|null
871
+ */
872
+ public function getUsedProducts()
873
+ {
874
+ if (!$this->isConfigurableType()) {
875
+ return null;
876
+ }
877
+
878
+ if (empty($this->_usedProducts)) {
879
+ /* @var $configurableInstance Mage_Catalog_Model_Product_Type_Configurable */
880
+ $configurableInstance = $this->getTypeInstance(true);
881
+ $this->_usedProducts = $configurableInstance->getUsedProducts(null, $this->getMagentoProduct());
882
+ }
883
+ return $this->_usedProducts;
884
+ }
885
+
886
+ /**
887
+ * @return array|null
888
+ */
889
+ public function getUsedProductIds()
890
+ {
891
+ if (!$this->isConfigurableType()) {
892
+ return null;
893
+ }
894
+
895
+ if (empty($this->_usedProductIds)) {
896
+ $usedProducts = $this->getUsedProducts();
897
+ foreach ($usedProducts as $usedProduct) {
898
+ $this->_usedProductIds[] = $usedProduct->getId();
899
+ }
900
+ }
901
+
902
+ return $this->_usedProductIds;
903
+ }
904
+
905
+ public function getConfigurableAttributes()
906
+ {
907
+ if (!$this->isConfigurableType()) {
908
+ return null;
909
+ }
910
+
911
+ if (empty($this->_configurable_attributes)) {
912
+ $this->_configurable_attributes = Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')
913
+ ->orderByPosition()
914
+ ->setProductFilter($this->getMagentoProduct());
915
+ }
916
+
917
+ return $this->_configurable_attributes;
918
+ }
919
+
920
+ /**
921
+ * @param float|int $productPrice
922
+ * @return null|float
923
+ */
924
+ protected function _getConfigurableProductBasePrice($productPrice)
925
+ {
926
+ if (!$this->isConfigurableType()) {
927
+ return $productPrice;
928
+ }
929
+
930
+ $attributes = $this->getConfigurableAttributes();
931
+
932
+ $i = 0;
933
+ $optionPrices = array();
934
+ $finalMinPrice = 0;
935
+
936
+ if (count($attributes)) {
937
+ foreach ($attributes as $attribute) {
938
+ /* @var Mage_Catalog_Model_Product_Type_Configurable_Attribute $attribute */
939
+ if ($attribute->getData('prices')) {
940
+ $prices = $attribute->getData('prices');
941
+ foreach ($prices as $price) {
942
+ if ($price['pricing_value'] != 0) {
943
+ $optionPrices[$i][] = Mage::helper('diglin_ricento/price')->calcSelectionPrice($price, $productPrice);
944
+ }
945
+ }
946
+
947
+ if (isset($optionPrices[$i])) {
948
+ $finalMinPrice += min($optionPrices[$i]);
949
+ }
950
+ $i++;
951
+ }
952
+ }
953
+ }
954
+
955
+ return ($productPrice + $finalMinPrice);
956
+ }
957
+
958
+ /**
959
+ * @param int $productId
960
+ * @return $this;
961
+ */
962
+ public function setProductId($productId)
963
+ {
964
+ $this->_productId = $productId;
965
+ return $this;
966
+ }
967
+
968
+ /**
969
+ * @return int
970
+ */
971
+ public function getProductId()
972
+ {
973
+ return $this->_productId;
974
+ }
975
+
976
+ /**
977
+ * @param int $storeId
978
+ * @return $this;
979
+ */
980
+ public function setStoreId($storeId)
981
+ {
982
+ $this->_storeId = $storeId;
983
+ return $this;
984
+ }
985
+
986
+ /**
987
+ * @return int
988
+ */
989
+ public function getStoreId()
990
+ {
991
+ return $this->_storeId;
992
+ }
993
+
994
+ /**
995
+ * @param null $defaultStoreId
996
+ * @return $this
997
+ */
998
+ public function setDefaultStoreId($defaultStoreId)
999
+ {
1000
+ $this->_defaultStoreId = $defaultStoreId;
1001
+ return $this;
1002
+ }
1003
+
1004
+ /**
1005
+ * @return null
1006
+ */
1007
+ public function getDefaultStoreId()
1008
+ {
1009
+ return $this->_defaultStoreId;
1010
+ }
1011
+
1012
+ /**
1013
+ * @param \Diglin_Ricento_Model_Products_Listing_Item $productListingItem
1014
+ * @return $this;
1015
+ */
1016
+ public function setProductListingItem(Diglin_Ricento_Model_Products_Listing_Item $productListingItem)
1017
+ {
1018
+ $this->_productListingItem = $productListingItem;
1019
+ return $this;
1020
+ }
1021
+
1022
+ /**
1023
+ * @return \Diglin_Ricento_Model_Products_Listing_Item
1024
+ */
1025
+ public function getProductListingItem()
1026
+ {
1027
+ if (empty($this->_productListingItem) && $this->getProductListingItemId()) {
1028
+ $this->_productListingItem = Mage::getModel('diglin_ricento/products_listing_item')->load($this->getProductListingItemId());
1029
+ }
1030
+ return $this->_productListingItem;
1031
+ }
1032
+
1033
+ /**
1034
+ * @param int $productListingItemId
1035
+ * @return $this
1036
+ */
1037
+ public function setProductListingItemId($productListingItemId)
1038
+ {
1039
+ $this->_productListingItemId = (int) $productListingItemId;
1040
+ return $this;
1041
+ }
1042
+
1043
+ /**
1044
+ * @return int
1045
+ */
1046
+ public function getProductListingItemId()
1047
+ {
1048
+ return $this->_productListingItemId;
1049
+ }
1050
+
1051
+ /**
1052
+ * @return bool
1053
+ */
1054
+ public function isSimpleType()
1055
+ {
1056
+ return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE;
1057
+ }
1058
+
1059
+ /**
1060
+ * @return bool
1061
+ */
1062
+ public function isConfigurableType()
1063
+ {
1064
+ return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE;
1065
+ }
1066
+
1067
+ /**
1068
+ * @return bool
1069
+ */
1070
+ public function isGroupedType()
1071
+ {
1072
+ return $this->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED;
1073
+ }
1074
+ }
app/code/community/Diglin/Ricento/Model/Products/Listing/Log.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Products_Listing_Log
14
+ *
15
+ * @method string getMessage()
16
+ * @method int getJobId()
17
+ * @method int getProductsListingId()
18
+ * @method int getProductId()
19
+ * @method string getProductTitle()
20
+ * @method string getLogStatus()
21
+ * @method string getLogType()
22
+ * @method DateTime getCreatedAt()
23
+ * @method DateTime getUpdatedAt()
24
+ * @method Diglin_Ricento_Model_Products_Listing_Log setMessage(string $message)
25
+ * @method Diglin_Ricento_Model_Products_Listing_Log setJobId(int $id)
26
+ * @method Diglin_Ricento_Model_Products_Listing_Log setProductsListingId(int $id)
27
+ * @method Diglin_Ricento_Model_Products_Listing_Log setProductId(int $id)
28
+ * @method Diglin_Ricento_Model_Products_Listing_Log setProductTitle(string $title)
29
+ * @method Diglin_Ricento_Model_Products_Listing_Log setLogStatus(string $status)
30
+ * @method Diglin_Ricento_Model_Products_Listing_Log setCreatedAt() setCreatedAt(DateTime $createdAt)
31
+ * @method Diglin_Ricento_Model_Products_Listing_Log setUpdatedAt() setUpdatedAt(DateTime $updatedAt)
32
+ */
33
+ class Diglin_Ricento_Model_Products_Listing_Log extends Mage_Core_Model_Abstract
34
+ {
35
+ // STATUSES
36
+ const STATUS_NOTICE = 'notice';
37
+ const STATUS_WARNING = 'warning';
38
+ const STATUS_ERROR = 'error';
39
+ const STATUS_SUCCESS = 'success';
40
+
41
+ // TYPE OF LOGS
42
+ const LOG_TYPE_CHECK = 1;
43
+ const LOG_TYPE_LIST = 2;
44
+ const LOG_TYPE_STOP = 3;
45
+ const LOG_TYPE_RELIST = 3;
46
+ const LOG_TYPE_SYNCLIST = 4;
47
+ const LOG_TYPE_ORDER = 5;
48
+
49
+ /**
50
+ * Prefix of model events names
51
+ * @var string
52
+ */
53
+ protected $_eventPrefix = 'listing_log';
54
+
55
+ /**
56
+ * Parameter name in event
57
+ * In observe method you can use $observer->getEvent()->getObject() in this case
58
+ * @var string
59
+ */
60
+ protected $_eventObject = 'listing_log';
61
+
62
+ /**
63
+ * Sync_Log Constructor
64
+ * @return void
65
+ */
66
+ protected function _construct()
67
+ {
68
+ parent::_construct();
69
+ $this->_init('diglin_ricento/products_listing_log');
70
+ }
71
+
72
+ /**
73
+ * @return string
74
+ */
75
+ public function getLogTypeMessage()
76
+ {
77
+ $sourceLog = Mage::getModel('diglin_ricento/config_source_products_listing_log')->toOptionHash();
78
+ return $sourceLog[$this->getLogType()];
79
+ }
80
+
81
+ /**
82
+ * @return Mage_Core_Model_Abstract
83
+ */
84
+ protected function _beforeSave()
85
+ {
86
+ parent::_beforeSave();
87
+
88
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
89
+
90
+ if ($this->isObjectNew()) {
91
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
92
+ }
93
+
94
+ return $this;
95
+ }
96
+ }
app/code/community/Diglin/Ricento/Model/Resource/Api/Token.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Resource Model of Api_Token
14
+ */
15
+ use \Diglin\Ricardo\Services\Security;
16
+
17
+ /**
18
+ * Class Diglin_Ricento_Model_Resource_Api_Token
19
+ */
20
+ class Diglin_Ricento_Model_Resource_Api_Token extends Mage_Core_Model_Resource_Db_Abstract
21
+ {
22
+ /**
23
+ * Api_Token Resource Constructor
24
+ * @return void
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->_init('diglin_ricento/api_token', 'entity_id');
29
+ }
30
+
31
+ /**
32
+ * Get the token of a specific type and website
33
+ *
34
+ * @param string $tokenType
35
+ * @param int $websiteId
36
+ * @return array
37
+ */
38
+ public function getSpecificTokenType($tokenType = Security::TOKEN_TYPE_IDENTIFIED, $websiteId = 0)
39
+ {
40
+ $readConnection = $this->_getReadAdapter();
41
+
42
+ $select = $readConnection
43
+ ->select(array('entity_id'))
44
+ ->from($this->getTable('diglin_ricento/api_token'))
45
+ ->where('token_type = :token_type AND website_id = :website_id');
46
+ $bind = array('token_type' => $tokenType, 'website_id' => (int) $websiteId);
47
+
48
+ $result = $readConnection->fetchOne($select, $bind);
49
+
50
+ if (empty($result) && !empty($websiteId)) {
51
+ $result = $this->getSpecificTokenType($tokenType, 0);
52
+ }
53
+
54
+ return $result;
55
+ }
56
+ }
app/code/community/Diglin/Ricento/Model/Resource/Api/Token/Collection.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Collection of Api_Token
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Api_Token_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Api_Token Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/api_token');
25
+ }
26
+
27
+
28
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Resource Model of Products_Listing
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ /**
18
+ * Products_Listing Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('diglin_ricento/products_listing', 'entity_id');
24
+ }
25
+
26
+ /**
27
+ * Get product ids of listing items
28
+ *
29
+ * @param Diglin_Ricento_Model_Products_Listing $listing
30
+ * @param bool $withChildren
31
+ * @return array
32
+ */
33
+ public function getProductIds($listing, $withChildren = true)
34
+ {
35
+ $readerConnection = $this->_getReadAdapter();
36
+
37
+ $select = $readerConnection->select()
38
+ ->from($this->getTable('diglin_ricento/products_listing_item'), 'product_id')
39
+ ->where('products_listing_id = :listing_id');
40
+
41
+ $bind = array('listing_id' => (int) $listing->getId());
42
+
43
+ if (!$withChildren) {
44
+ $select->where('parent_product_id IS NULL');
45
+ }
46
+
47
+ return $readerConnection->fetchCol($select, $bind);
48
+ }
49
+
50
+ /**
51
+ * Stop product lists if all items are stopped
52
+ *
53
+ * @param $productsListingId
54
+ * @return $this
55
+ */
56
+ public function setStatusStop($productsListingId)
57
+ {
58
+ $readerConnection = $this->_getReadAdapter();
59
+
60
+ $select = $readerConnection->select()
61
+ ->from(array('pl' => $this->getTable('diglin_ricento/products_listing')))
62
+ ->where('pl.entity_id = :id')
63
+ ->joinLeft(
64
+ array('pli' => $this->getTable('diglin_ricento/products_listing_item')),
65
+ 'pli.products_listing_id = pl.entity_id AND pl.status = "listed"',
66
+ array('item_status' => 'pli.status')
67
+ );
68
+
69
+ $binds = array('id' => $productsListingId);
70
+
71
+ $rows = $readerConnection->fetchAll($select, $binds);
72
+ $lists = array();
73
+
74
+ foreach ($rows as $row) {
75
+ if ($row['item_status'] == Diglin_Ricento_Helper_Data::STATUS_STOPPED) {
76
+ $lists[$row['entity_id']]['stopped'] = true;
77
+ }
78
+ if ($row['item_status'] == Diglin_Ricento_Helper_Data::STATUS_LISTED) {
79
+ $lists[$row['entity_id']]['listed'] = true;
80
+ }
81
+ }
82
+
83
+ foreach ($lists as $key => $list) {
84
+ if (!isset($lists[$key]['listed']) && isset($lists[$key]['stopped'])) {
85
+ $this->saveCurrentList($key, array('status' => Diglin_Ricento_Helper_Data::STATUS_STOPPED));
86
+ }
87
+ }
88
+
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * @param int $listId
94
+ * @param array $bind
95
+ * @return int
96
+ */
97
+ public function saveCurrentList($listId, $bind)
98
+ {
99
+ $writeConection = $this->_getWriteAdapter();
100
+
101
+ return $writeConection->update(
102
+ $this->getMainTable(),
103
+ $bind,
104
+ array($this->getIdFieldName() . ' = ?' => $listId));
105
+ }
106
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Collection of Products_Listing
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Products_Listing Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/products_listing');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Item.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Resource Model of Products_Listing_Item
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing_Item extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ /**
18
+ * Products_Listing_Item Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('diglin_ricento/products_listing_item', 'item_id');
24
+ }
25
+
26
+ /**
27
+ * Count the number of items not listed
28
+ *
29
+ * @param int $productsListingId
30
+ * @return int
31
+ */
32
+ public function countPendingItems($productsListingId)
33
+ {
34
+ return $this->_countItems('status IN (\'' . Diglin_Ricento_Helper_Data::STATUS_PENDING . '\', \'' . Diglin_Ricento_Helper_Data::STATUS_ERROR .'\', \'' . Diglin_Ricento_Helper_Data::STATUS_STOPPED .'\')', $productsListingId);
35
+ }
36
+
37
+ /**
38
+ * Count the number of items listed
39
+ *
40
+ * @param int $productsListingId
41
+ * @return int
42
+ */
43
+ public function countListedItems($productsListingId)
44
+ {
45
+ return $this->_countItems('status IN (\'' . Diglin_Ricento_Helper_Data::STATUS_LISTED . '\')', $productsListingId);
46
+ }
47
+
48
+ /**
49
+ * Count the number of items sold
50
+ *
51
+ * @param int $productsListingId
52
+ * @return int
53
+ */
54
+ public function countSoldItems($productsListingId)
55
+ {
56
+ return $this->_countItems('status IN (\'' . Diglin_Ricento_Helper_Data::STATUS_SOLD . '\')', $productsListingId);
57
+ }
58
+
59
+ /**
60
+ * Count the number of items ready to list
61
+ *
62
+ * @param int $productsListingId
63
+ * @return int
64
+ */
65
+ public function coundReadyTolist($productsListingId)
66
+ {
67
+ return $this->_countItems('status IN (\'' . Diglin_Ricento_Helper_Data::STATUS_READY . '\')', $productsListingId);
68
+ }
69
+
70
+ /**
71
+ * Count the number of items depending of the where clause
72
+ *
73
+ * @param int $productsListingId
74
+ * @param $whereClause
75
+ * @return int
76
+ */
77
+ protected function _countItems($whereClause, $productsListingId = 0)
78
+ {
79
+ $readerConnection = $this->_getReadAdapter();
80
+
81
+ $select = $readerConnection->select()
82
+ ->from($this->getTable('diglin_ricento/products_listing_item'), 'product_id')
83
+ ->where('products_listing_id = :id')
84
+ ->where($whereClause);
85
+ $binds = array('id' => $productsListingId);
86
+
87
+ return count($readerConnection->fetchAll($select, $binds));
88
+ }
89
+
90
+ /**
91
+ * @param $status
92
+ * @param $productsListingId
93
+ * @return array
94
+ */
95
+ public function getItemsPerStatusProductsListing($status, $productsListingId)
96
+ {
97
+ $readerConnection = $this->_getReadAdapter();
98
+
99
+ $select = $readerConnection->select()
100
+ ->from($this->getTable('diglin_ricento/products_listing_item'), 'item_id')
101
+ ->where('products_listing_id = :id')
102
+ ->where('status = :status');
103
+ $binds = array('id' => $productsListingId, 'status' => $status);
104
+
105
+ return $readerConnection->fetchCol($select, $binds);
106
+ }
107
+
108
+ /**
109
+ * @param int $itemId
110
+ * @param array $bind
111
+ * @return int
112
+ */
113
+ public function saveCurrentItem($itemId, $bind)
114
+ {
115
+ $writeConection = $this->_getWriteAdapter();
116
+
117
+ return $writeConection->update(
118
+ $this->getMainTable(),
119
+ $bind,
120
+ array($this->getIdFieldName() . ' = ?' => $itemId));
121
+ }
122
+
123
+ /**
124
+ * Stop parent product item if all children products are stopped
125
+ * Probably deprecated because the parent configurable product should not have a changing status
126
+ *
127
+ * @param $productsListingId
128
+ * @return $this
129
+ */
130
+ public function setParentStatusStop($productsListingId)
131
+ {
132
+ $readerConnection = $this->_getReadAdapter();
133
+
134
+ $select = $readerConnection->select()
135
+ ->from(array('pli' => $this->getTable('diglin_ricento/products_listing_item')), array( 'parent_id' => 'pli.parent_item_id', 'item_status' => 'pli.status'))
136
+ ->where('pli.products_listing_id = :id')
137
+ ->where('pli.parent_item_id IS NOT NULL')
138
+ ->joinLeft(array('plib' => $this->getTable('diglin_ricento/products_listing_item')), 'plib.item_id = pli.parent_item_id AND plib.status = "listed"');
139
+
140
+ $binds = array('id' => $productsListingId);
141
+
142
+ $items = $readerConnection->fetchAll($select, $binds);
143
+ $parents = array();
144
+
145
+ foreach ($items as $item) {
146
+ if ($item['item_status'] == Diglin_Ricento_Helper_Data::STATUS_STOPPED) {
147
+ $parents[$item['parent_id']]['stopped'] = true;
148
+ }
149
+ if ($item['item_status'] == Diglin_Ricento_Helper_Data::STATUS_LISTED) {
150
+ $parents[$item['parent_id']]['listed'] = true;
151
+ }
152
+ }
153
+
154
+ foreach ($parents as $key => $parent) {
155
+ if (!isset($parents[$key]['listed']) && isset($parents[$key]['stopped'])) {
156
+ $this->saveCurrentItem($key, array('status' => Diglin_Ricento_Helper_Data::STATUS_STOPPED));
157
+ }
158
+ }
159
+
160
+ return $this;
161
+ }
162
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Item/Collection.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Collection of Products_Listing_Item
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * @var bool
19
+ */
20
+ protected $_isProductTableJoined = false;
21
+
22
+ /**
23
+ * @var bool
24
+ */
25
+ protected $_isProductConfigurableTableJoined = false;
26
+
27
+ /**
28
+ * @var bool
29
+ */
30
+ protected $_addAdditionalInformation = false;
31
+
32
+ /**
33
+ * Products_Listing_Item Collection Resource Constructor
34
+ * @return void
35
+ */
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->_init('diglin_ricento/products_listing_item');
40
+ }
41
+
42
+ /**
43
+ * @param $status
44
+ * @return $this
45
+ */
46
+ public function updateStatusToAll($status)
47
+ {
48
+ $connection = $this->getConnection();
49
+ $connection->update(
50
+ $this->getTable('diglin_ricento/products_listing_item'),
51
+ array('status' => $status),
52
+ array('item_id IN (?)' => $this->getAllIds())
53
+ );
54
+
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Get only items collection being a configurable product
60
+ *
61
+ * @return $this
62
+ */
63
+ public function getConfigurableProducts()
64
+ {
65
+ if (!$this->_isProductConfigurableTableJoined) {
66
+ $this
67
+ ->getSelect()
68
+ ->join(
69
+ array('pl' => $this->getTable('catalog/product')),
70
+ "pl.entity_id = main_table.product_id",
71
+ array('product_type' => 'type_id')
72
+ )
73
+ ->where('type_id = ?', Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE);
74
+
75
+ $this->_isProductConfigurableTableJoined = true;
76
+ }
77
+ return $this;
78
+ }
79
+
80
+ /**
81
+ * Get only items collection being a configurable product
82
+ *
83
+ * @return $this
84
+ */
85
+ public function getProductsWithoutConfigurable()
86
+ {
87
+ if (!$this->_isProductTableJoined) {
88
+ $this
89
+ ->getSelect()
90
+ ->join(
91
+ array('pl' => $this->getTable('catalog/product')),
92
+ "pl.entity_id = main_table.product_id",
93
+ array('product_type' => 'type_id')
94
+ )
95
+ ->where('type_id <> ?', Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE);
96
+
97
+ $this->_isProductTableJoined = true;
98
+ }
99
+ return $this;
100
+ }
101
+
102
+ public function getAddAdditionalInformation()
103
+ {
104
+ return $this->_addAdditionalInformation;
105
+ }
106
+
107
+ public function setAddAdditionalInformation($var)
108
+ {
109
+ $this->_addAdditionalInformation = $var;
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ * Helper to filter some fields from extra/joined tables
115
+ *
116
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
117
+ */
118
+ public function addGridFilter(Mage_Adminhtml_Block_Widget_Grid_Column $column)
119
+ {
120
+ $valueToSearch = $column->getFilter()->getValue();
121
+ $config = Mage::getSingleton('eav/config');
122
+
123
+ switch($column->getId()){
124
+ case 'product_name':
125
+ $productName = $config->getAttribute('catalog_product','name');
126
+ $this->getSelect()->join(array('product_attributes' => $productName->getBackendTable()),
127
+ 'main_table.product_id = product_attributes.entity_id',
128
+ array());
129
+
130
+ $condition = "product_attributes.attribute_id = '".$productName->getId() . "'";
131
+ $this->addFilter('product_attributes.attribute_id', $condition , 'string');//1st param useless here
132
+ $this->addFieldToFilter('product_attributes.value', array('like' => '%'.$valueToSearch.'%'));
133
+ break;
134
+
135
+ case 'product_sku':
136
+ $this->getSelect()->join(
137
+ array('product_entity' => $this->getTable('catalog/product/entity')),
138
+ 'main_table.product_id = product_entity.entity_id',
139
+ array());
140
+
141
+ $this->addFieldToFilter('product_entity.sku',array('like' => '%'.$valueToSearch.'%'));
142
+ break;
143
+ }
144
+ }
145
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Log.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Products_Listing_Log
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing_Log extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ /**
18
+ * Products_Listing_Item Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('diglin_ricento/listing_log', 'log_id');
24
+ }
25
+
26
+ /**
27
+ * @param array $bind
28
+ * @return int
29
+ */
30
+ public function saveLog($bind)
31
+ {
32
+ $writeConection = $this->_getWriteAdapter();
33
+
34
+ return $writeConection->insert(
35
+ $this->getMainTable(),
36
+ $bind);
37
+ }
38
+
39
+ /**
40
+ * @param int $jobId
41
+ * @return int
42
+ */
43
+ public function cleanSpecificJob($jobId)
44
+ {
45
+ $writeConection = $this->_getWriteAdapter();
46
+ return $writeConection->delete(
47
+ $this->getMainTable(),
48
+ array('job_id = ?' => $jobId)
49
+ );
50
+ }
51
+ }
app/code/community/Diglin/Ricento/Model/Resource/Products/Listing/Log/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Products_Listing_Log_Collection
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Products_Listing_Log_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Products_Listing Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/products_listing_log');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Resource/Rule.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Rule
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Rule extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ protected function _construct()
18
+ {
19
+ $this->_init('diglin_ricento/shipping_payment_rule', 'rule_id');
20
+ }
21
+ }
app/code/community/Diglin/Ricento/Model/Resource/Rule/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Rule_Collection
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Rule_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Rule Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/shipping_payment_rule');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sales/Options.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Resource Model of Sales_Options
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sales_Options extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ /**
18
+ * Sales_Options Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('diglin_ricento/sales_options', 'entity_id');
24
+ }
25
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sales/Options/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Collection of Sales_Options
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sales_Options_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Sales_Options Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/sales_options');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sales/Transaction.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sales_Transaction
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sales_Transaction extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ protected function _construct()
18
+ {
19
+ $this->_init('diglin_ricento/sales_transaction', 'transaction_id');
20
+ }
21
+
22
+ /**
23
+ * Returns sum of all transaction prices
24
+ *
25
+ * @return string
26
+ */
27
+ public function getTotalSalesValue()
28
+ {
29
+ $result = $this->getReadConnection()->select()
30
+ ->from($this->getMainTable(), array(new Zend_Db_Expr('SUM(total_bid_price)')))
31
+ ->query(Zend_Db::FETCH_NUM)->fetchColumn(0);
32
+ return $result;
33
+ }
34
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sales/Transaction/Collection.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Diglin_Ricento_Model_Resource_Sales_Transaction_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
12
+ {
13
+ protected $_groupByProduct = false;
14
+ protected $_isProductTableJoined = false;
15
+ protected $_isProductAttributeJoined = array();
16
+
17
+ /**
18
+ * Sales_Options Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/sales_transaction');
25
+ }
26
+ /**
27
+ * Get flag if collection is grouped by product
28
+ *
29
+ * @return boolean
30
+ */
31
+ public function isGroupByProduct()
32
+ {
33
+ return $this->_groupByProduct;
34
+ }
35
+
36
+ /**
37
+ * Set flag that collection is grouped by product
38
+ *
39
+ * @param boolean $groupByProduct
40
+ * @return $this
41
+ */
42
+ public function setGroupByProduct($groupByProduct)
43
+ {
44
+ $this->_groupByProduct = $groupByProduct;
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * Join product information
50
+ *
51
+ * @return $this
52
+ */
53
+ public function joinProducts()
54
+ {
55
+ $this->_joinProductAttribute('name');
56
+ $this->_joinProductAttribute('price');
57
+ $this->_joinProductSku();
58
+ return $this;
59
+ }
60
+ /**
61
+ * Joins product attribute value
62
+ *
63
+ * @param string $attributeCode
64
+ * @return $this
65
+ * @throws Mage_Core_Exception
66
+ */
67
+ protected function _joinProductAttribute($attributeCode)
68
+ {
69
+ if (empty($this->_isProductAttributeJoined[$attributeCode])) {
70
+ $entityTypeId = Mage::getResourceModel('catalog/config')
71
+ ->getEntityTypeId();
72
+ $attribute = Mage::getModel('catalog/entity_attribute')
73
+ ->loadByCode($entityTypeId, $attributeCode);
74
+
75
+ $storeId = Mage::app()->getStore()->getId();
76
+
77
+ $tableAlias = "product_{$attributeCode}_table";
78
+ $fieldAlias = "product_{$attributeCode}";
79
+ $this->getSelect()
80
+ ->join(
81
+ array($tableAlias => $attribute->getBackendTable()),
82
+ "{$tableAlias}.entity_id=main_table.product_id" .
83
+ " AND {$tableAlias}.store_id=" . $storeId .
84
+ " AND {$tableAlias}.attribute_id=" . $attribute->getId().
85
+ " AND {$tableAlias}.entity_type_id=" . $entityTypeId,
86
+ array($fieldAlias => 'value')
87
+ );
88
+
89
+ $this->_isProductAttributeJoined[$attributeCode] = true;
90
+ }
91
+ return $this;
92
+ }
93
+
94
+ /**
95
+ * Join product entity table to select SKU
96
+ *
97
+ * @return $this
98
+ */
99
+ protected function _joinProductSku()
100
+ {
101
+ if (!$this->_isProductTableJoined) {
102
+
103
+ $this->getSelect()
104
+ ->join(
105
+ array('product_table' => $this->getTable('catalog/product')),
106
+ "product_table.entity_id=main_table.product_id",
107
+ array('product_sku' => 'sku')
108
+ );
109
+ $this->_isProductTableJoined = true;
110
+ }
111
+ return $this;
112
+ }
113
+
114
+ /**
115
+ * If the collection is grouped by products, count the distinct product_ids
116
+ *
117
+ * @return Varien_Db_Select
118
+ */
119
+ public function getSelectCountSql()
120
+ {
121
+ $countSelect = parent::getSelectCountSql();
122
+ if ($this->isGroupByProduct()) {
123
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
124
+ $countSelect->reset(Zend_Db_Select::GROUP);
125
+ $countSelect->columns('COUNT(DISTINCT main_table.product_id)');
126
+ }
127
+ return $countSelect;
128
+ }
129
+
130
+ /**
131
+ * Prepares collection for revenue report by month
132
+ */
133
+ public function prepareReport()
134
+ {
135
+ $dateStart = Mage::app()->getLocale()->date();
136
+ $dateEnd = clone $dateStart;
137
+ $dateStart->subYear(1);
138
+
139
+ $dateStart->setHour(0);
140
+ $dateStart->setMinute(0);
141
+ $dateStart->setSecond(0);
142
+
143
+ $dateEnd->setHour(23);
144
+ $dateEnd->setMinute(59);
145
+ $dateEnd->setSecond(59);
146
+
147
+ $this->getSelect()->reset(Zend_Db_Select::COLUMNS);
148
+ $this->getSelect()->columns(
149
+ array(
150
+ 'range' => 'DATE_FORMAT(sold_at, "%Y-%m")',
151
+ 'revenue' => 'SUM(main_table.total_bid_price)',
152
+ ))
153
+ ->where(
154
+ $this->_getConditionSql('sold_at', array("from" => $dateStart, "to" => $dateEnd, 'datetime' => true))
155
+ )
156
+ ->group(
157
+ $this->getConnection()->getDateFormatSql('sold_at', '%Y-%m')
158
+ );
159
+ }
160
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sync/Abstract.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sync_Abstract
14
+ */
15
+ abstract class Diglin_Ricento_Model_Resource_Sync_Abstract extends Mage_Core_Model_Resource_Db_Abstract
16
+ {
17
+ /**
18
+ * @param int $jobId
19
+ * @param array $bind
20
+ * @return int
21
+ */
22
+ public function saveCurrentJob($jobId, $bind)
23
+ {
24
+ $writeConection = $this->_getWriteAdapter();
25
+
26
+ return $writeConection->update(
27
+ $this->getMainTable(),
28
+ $bind,
29
+ array($this->getIdFieldName() . ' = ?' => $jobId));
30
+ }
31
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sync/Job.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sync_Job
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sync_Job extends Diglin_Ricento_Model_Resource_Sync_Abstract
16
+ {
17
+ /**
18
+ * Sync Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('diglin_ricento/sync_job', 'job_id');
24
+ }
25
+
26
+ /**
27
+ * @param $type
28
+ * @param $productsListingId
29
+ * @param null $progress
30
+ * @return string
31
+ */
32
+ public function loadByTypeListingIdProgress($type, $productsListingId, $progress = null)
33
+ {
34
+ $readConnection = $this->_getReadAdapter();
35
+
36
+ $select = $readConnection
37
+ ->select(array('job_id'))
38
+ ->from(array('sj' => $this->getTable('diglin_ricento/sync_job')))
39
+ ->joinLeft(array('sjl' => $this->getTable('diglin_ricento/sync_job_listing')), 'sjl.job_id = sj.job_id')
40
+ ->where('sj.job_type = :job_type AND sjl.products_listing_id = :products_listing_id');
41
+
42
+ $bind = array('job_type' => $type, 'products_listing_id' => (int) $productsListingId);
43
+
44
+ if (!is_null($progress)) {
45
+ if (!is_array($progress)) {
46
+ $progress = array($progress);
47
+ }
48
+ $select->where('sj.progress IN (?)', $progress);
49
+ }
50
+
51
+ return $readConnection->fetchOne($select, $bind);
52
+ }
53
+
54
+ /**
55
+ * @param $jobType
56
+ * @param $productListingId
57
+ * @return $this
58
+ */
59
+ public function cleanupPendingJob($jobType, $productListingId)
60
+ {
61
+ $readConnection = $this->_getReadAdapter();
62
+
63
+ $select = $readConnection
64
+ ->select()
65
+ ->from(array('sj' => $this->getTable('diglin_ricento/sync_job')), 'job_id')
66
+ ->join(array('jl' => $this->getTable('diglin_ricento/sync_job_listing')),
67
+ 'jl.job_id = sj.job_id', '*')
68
+ ->where('jl.products_listing_id = ?', $productListingId)
69
+ ->where('job_Type = ? ', $jobType)
70
+ ->where('progress = ?', Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING)
71
+ ->deleteFromSelect('sj');
72
+
73
+ if (!empty($select) && !is_numeric($select)) {
74
+ $readConnection->query($select);
75
+ }
76
+
77
+ return $this;
78
+ }
79
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sync_Job_Collection
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sync_Job_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Sync Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/sync_job');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Listing.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sync_Job_Listing
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sync_Job_Listing extends Diglin_Ricento_Model_Resource_Sync_Abstract
16
+ {
17
+ protected function _construct()
18
+ {
19
+ $this->_init('diglin_ricento/sync_job_listing', 'job_listing_id');
20
+ }
21
+ }
app/code/community/Diglin/Ricento/Model/Resource/Sync/Job/Listing/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Resource_Sync_Job_Listing_Collection
14
+ */
15
+ class Diglin_Ricento_Model_Resource_Sync_Job_Listing_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
16
+ {
17
+ /**
18
+ * Sync Collection Resource Constructor
19
+ * @return void
20
+ */
21
+ protected function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('diglin_ricento/sync_job_listing');
25
+ }
26
+ }
app/code/community/Diglin/Ricento/Model/Rule.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Rule
14
+ *
15
+ * @method Diglin_Ricento_Model_Rule setShippingMethod(string $shippingMethod)
16
+ * @method Diglin_Ricento_Model_Rule setShippingDescriptionDe(string $shippingDescriptionDe)
17
+ * @method Diglin_Ricento_Model_Rule setShippingDescriptionFr(string $shippingDescriptionFr)
18
+ * @method Diglin_Ricento_Model_Rule setShippingPrice(string $shippingPrice)
19
+ * @method Diglin_Ricento_Model_Rule setShippingAvailability(string $shippingAvailability)
20
+ * @method Diglin_Ricento_Model_Rule setPaymentMethods(string $paymentMethods)
21
+ * @method Diglin_Ricento_Model_Rule setPaymentDescriptionDe(string $paymentDescriptionDe)
22
+ * @method Diglin_Ricento_Model_Rule setPaymentDescriptionFr(string $paymentDescriptionFr)
23
+ * @method Diglin_Ricento_Model_Rule setShippingPackage(int $shippingPackage)
24
+ * @method Diglin_Ricento_Model_Rule setShippingCumulativeFee(int $shippingCumulativeFee)
25
+ * @method string getShippingMethod()
26
+ * @method string getShippingDescriptionDe()
27
+ * @method string getShippingDescriptionFr()
28
+ * @method float getShippingPrice()
29
+ * @method string getShippingAvailability()
30
+ * @method string getPaymentDescriptionDe()
31
+ * @method string getPaymentDescriptionFr()
32
+ * @method string[] getPaymentMethods()
33
+ * @method string getShippingPackage()
34
+ * @method int getShippingCumulativeFee()
35
+ *
36
+ */
37
+ class Diglin_Ricento_Model_Rule extends Mage_Core_Model_Abstract
38
+ {
39
+ /**
40
+ * Prefix of model events names
41
+ * @var string
42
+ */
43
+ protected $_eventPrefix = 'shipping_payment_rule';
44
+
45
+ /**
46
+ * Parameter name in event
47
+ *
48
+ * @var string
49
+ */
50
+ protected $_eventObject = 'shipping_payment_rule';
51
+
52
+ protected function _construct()
53
+ {
54
+ $this->_init('diglin_ricento/rule');
55
+ }
56
+
57
+ /**
58
+ * Set date of last update, convert payment method array to string
59
+ *
60
+ * @return Diglin_Ricento_Model_Rule
61
+ */
62
+ protected function _beforeSave()
63
+ {
64
+ parent::_beforeSave();
65
+
66
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
67
+
68
+ $this->_preparePaymentMethods(false);
69
+
70
+ if ($this->isObjectNew()) {
71
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
72
+ }
73
+
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * Convert payment method string to array
79
+ *
80
+ * @return Diglin_Ricento_Model_Rule
81
+ */
82
+ protected function _afterLoad()
83
+ {
84
+ $this->_preparePaymentMethods();
85
+
86
+ return parent::_afterLoad();
87
+ }
88
+
89
+ /**
90
+ * Convert payment method string to array
91
+ *
92
+ * @return Diglin_Ricento_Model_Rule
93
+ */
94
+ protected function _afterSave()
95
+ {
96
+ $this->_preparePaymentMethods();
97
+
98
+ return parent::_afterSave();
99
+ }
100
+
101
+ /**
102
+ * Prepare Payment Methods
103
+ */
104
+ protected function _preparePaymentMethods($explode = true)
105
+ {
106
+ if ($explode){
107
+ if (isset($this->_data['payment_methods']) && !is_null($this->_data['payment_methods'])) {
108
+ $this->_data['payment_methods'] = explode(',', $this->_data['payment_methods']);
109
+ } else {
110
+ $this->_data['payment_methods'] = array();
111
+ }
112
+ } else {
113
+ if (isset($this->_data['payment_methods']) && is_array($this->_data['payment_methods'])) {
114
+ $this->_data['payment_methods'] = implode(',', $this->_data['payment_methods']);
115
+ } else {
116
+ $this->_data['payment_methods'] = '';
117
+ }
118
+ }
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * @param string $lang
124
+ * @return string
125
+ */
126
+ public function getShippingDescription($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG)
127
+ {
128
+ return $this->_getDescriptionLangMethod($lang, 'getShippingDescription');
129
+ }
130
+
131
+ /**
132
+ * @param string $lang
133
+ * @return string
134
+ */
135
+ public function getPaymentDescription($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG)
136
+ {
137
+ return $this->_getDescriptionLangMethod($lang, 'getPaymentDescription');
138
+ }
139
+
140
+ /**
141
+ * @param string $lang
142
+ * @param string $method
143
+ * @return string
144
+ */
145
+ protected function _getDescriptionLangMethod($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG, $method)
146
+ {
147
+ $supportedLang = Mage::helper('diglin_ricento')->getSupportedLang();
148
+ $lang = strtolower($lang);
149
+
150
+ if (in_array($lang, $supportedLang)) {
151
+ $method = $method . ucwords($lang);
152
+ return $this->$method();
153
+ }
154
+ return '';
155
+ }
156
+ }
app/code/community/Diglin/Ricento/Model/Sales/Method/Payment.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sales_Method_Payment
14
+ */
15
+ class Diglin_Ricento_Model_Sales_Method_Payment extends Mage_Payment_Model_Method_Abstract
16
+ {
17
+ const CHECK_IS_RICARDO_ORDER = 256;
18
+ const PAYMENT_CODE = 'ricento';
19
+
20
+ /**
21
+ * unique internal payment method identifier
22
+ *
23
+ * @var string [a-z0-9_]
24
+ */
25
+ protected $_code = self::PAYMENT_CODE;
26
+
27
+ /**
28
+ * payment info block
29
+ *
30
+ * @var string MODULE/BLOCKNAME
31
+ */
32
+ protected $_infoBlockType = 'diglin_ricento/payment_info';
33
+
34
+ protected $_canManageRecurringProfiles = false;
35
+ protected $_canUseCheckout = false;
36
+ protected $_canCapture = true;
37
+ protected $_canCapturePartial = true;
38
+
39
+ /**
40
+ * Check whether payment method can be used
41
+ * Not allowed for frontend
42
+ *
43
+ * @param Mage_Sales_Model_Quote|null $quote
44
+ *
45
+ * @return bool
46
+ */
47
+ public function isAvailable($quote = null)
48
+ {
49
+ if (!Mage::helper('diglin_ricento')->isEnabledConfigured()) {
50
+ return false;
51
+ }
52
+
53
+ if ($quote && parent::isAvailable($quote) && $this->isApplicableToQuote($quote, self::CHECK_IS_RICARDO_ORDER)) {
54
+ return true;
55
+ }
56
+
57
+ return false;
58
+ }
59
+
60
+ /**
61
+ * Check whether payment method is applicable to quote
62
+ * Purposed to allow use in controllers some logic that was implemented in blocks only before
63
+ *
64
+ * @param Mage_Sales_Model_Quote $quote
65
+ * @param int|null $checksBitMask
66
+ * @return bool
67
+ */
68
+ public function isApplicableToQuote($quote, $checksBitMask)
69
+ {
70
+ if (!Mage::helper('diglin_ricento')->isEnabledConfigured()) {
71
+ return parent::isApplicableToQuote($quote, $checksBitMask);
72
+ }
73
+
74
+ if ($checksBitMask & self::CHECK_IS_RICARDO_ORDER) {
75
+ if (!$quote->getIsRicardo()) {
76
+ return false;
77
+ }
78
+ }
79
+
80
+ return parent::isApplicableToQuote($quote, $checksBitMask);
81
+ }
82
+ }
app/code/community/Diglin/Ricento/Model/Sales/Method/Shipping.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sales_Method_Shipping
14
+ */
15
+ class Diglin_Ricento_Model_Sales_Method_Shipping
16
+ extends Mage_Shipping_Model_Carrier_Abstract
17
+ implements Mage_Shipping_Model_Carrier_Interface
18
+ {
19
+ /**
20
+ * Carrier's code
21
+ *
22
+ * @var string
23
+ */
24
+ protected $_code = 'ricento';
25
+
26
+ /**
27
+ * Whether this carrier has fixed rates calculation
28
+ *
29
+ * @var bool
30
+ */
31
+ protected $_isFixed = true;
32
+
33
+ /**
34
+ * Collect and get rates
35
+ *
36
+ * @param Mage_Shipping_Model_Rate_Request $request
37
+ * @return Mage_Shipping_Model_Rate_Result|bool|null
38
+ */
39
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
40
+ {
41
+ if (!$this->getConfigFlag('active') || !Mage::helper('diglin_ricento')->isEnabled()) {
42
+ return false;
43
+ }
44
+
45
+ $calculationMethod = Mage::helper('diglin_ricento')->getShippingCalculationMethod();
46
+ $shippingPrice = 0;
47
+ $isRicardo = false;
48
+
49
+ if ($request->getAllItems()) {
50
+ foreach ($request->getAllItems() as $item) {
51
+ $value = $item->getOptionByCode('info_buyRequest')->getValue();
52
+ $params = unserialize($value);
53
+ $price = 0;
54
+
55
+ if (isset($params['is_ricardo'])) {
56
+ $isRicardo = true;
57
+ }
58
+ if (isset($params['shipping_fee'])) {
59
+ $price = $params['shipping_fee'];
60
+ }
61
+ if (isset($params['shipping_cumulative_fee']) && $params['shipping_cumulative_fee']) {
62
+ $price *= $item->getQty();
63
+ }
64
+
65
+ if ($calculationMethod == Diglin_Ricento_Model_Config_Source_Rules_Shipping_Calculation::HIGHEST_PRICE) {
66
+ if ($shippingPrice <= $price) {
67
+ $shippingPrice = $price;
68
+ }
69
+ } else {
70
+ $shippingPrice += $price;
71
+ }
72
+ }
73
+ }
74
+
75
+ if (!$isRicardo) {
76
+ return false;
77
+ }
78
+
79
+ /** @var Mage_Shipping_Model_Rate_Result $result */
80
+ $result = Mage::getModel('shipping/rate_result');
81
+
82
+ $description = Mage::getSingleton('core/session')->getRicardoShippingDescription();
83
+ $shippingMethod = Mage::getSingleton('core/session')->getRicardoShippingMethod();
84
+
85
+ $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
86
+
87
+ if ($shippingPrice !== false) {
88
+ $method = Mage::getModel('shipping/rate_result_method');
89
+
90
+ $method->setCarrier($this->_code);
91
+ $method->setCarrierTitle($this->getConfigData('title'));
92
+
93
+ $method->setMethod($shippingMethod);
94
+ $method->setMethodTitle((strlen($description) > 0) ? $description : '');
95
+
96
+ $method->setPrice($shippingPrice);
97
+ $method->setCost($shippingPrice);
98
+
99
+ $result->append($method);
100
+ }
101
+
102
+ return $result;
103
+ }
104
+
105
+ /**
106
+ * Get allowed shipping methods
107
+ *
108
+ * @return array
109
+ */
110
+ public function getAllowedMethods()
111
+ {
112
+ return Mage::getSingleton('diglin_ricento/config_source_rules_shipping')->toOptionHash();
113
+ }
114
+ }
app/code/community/Diglin/Ricento/Model/Sales/Options.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Sales_Options Model
14
+ *
15
+ * @method int getRicardoCategory()
16
+ * @method string getSalesType()
17
+ * @method string getPriceSourceAttributeCode()
18
+ * @method float getPriceChange()
19
+ * @method string getPriceChangeType()
20
+ * @method int getSalesAuctionDirectBuy()
21
+ * @method float getSalesAuctionStartPrice()
22
+ * @method float getSalesAuctionIncrement()
23
+ * @method string getScheduleDateStart()
24
+ * @method int getSchedulePeriodDays()
25
+ * @method int getScheduleReactivation()
26
+ * @method int getScheduleCycleMultipleProducts()
27
+ * @method int getScheduleOverwriteProductDateStart()
28
+ * @method int getStockManagement()
29
+ * @method int getCustomizationTemplate()
30
+ * @method int getPromotionSpace()
31
+ * @method int getPromotionStartPage()
32
+ * @method int getProductWarranty()
33
+ * @method string getProductWarrantyDescriptionDe()
34
+ * @method string getProductWarrantyDescriptionFr()
35
+ * @method string getProductCondition()
36
+ * @method string getProductConditionSourceAttributeCode()
37
+ * @method string getCreatedAt()
38
+ * @method string getUpdatedAt()
39
+ * @method Diglin_Ricento_Model_Sales_Options setRicardoCategory(int $ricardoCategory)
40
+ * @method Diglin_Ricento_Model_Sales_Options setSalesType(string $salesType)
41
+ * @method Diglin_Ricento_Model_Sales_Options setPriceSourceAttributeCode(string $priceSourceAttributeCode)
42
+ * @method Diglin_Ricento_Model_Sales_Options setPriceChange(float $priceChange)
43
+ * @method Diglin_Ricento_Model_Sales_Options setPriceChangeType(string $priceChangeType)
44
+ * @method Diglin_Ricento_Model_Sales_Options setSalesAuctionDirectBuy(int $salesAuctionDirectBuy)
45
+ * @method Diglin_Ricento_Model_Sales_Options setSalesAuctionStartPrice(float $salesAuctionStartPrice)
46
+ * @method Diglin_Ricento_Model_Sales_Options setSalesAuctionIncrement(float $salesAuctionIncrement)
47
+ * @method Diglin_Ricento_Model_Sales_Options setScheduleDateStart(string $scheduleDateStart)
48
+ * @method Diglin_Ricento_Model_Sales_Options setSchedulePeriodDays(int $schedulePeriodDays)
49
+ * @method Diglin_Ricento_Model_Sales_Options setScheduleReactivation(int $scheduleReactivation)
50
+ * @method Diglin_Ricento_Model_Sales_Options setScheduleCycleMultipleProducts(int $scheduleCycleMultipleProducts)
51
+ * @method Diglin_Ricento_Model_Sales_Options setScheduleOverwriteProductDateStart(int $scheduleOverwriteProductDateStart)
52
+ * @method Diglin_Ricento_Model_Sales_Options setStockManagement(int $stockManagement)
53
+ * @method Diglin_Ricento_Model_Sales_Options setCustomizationTemplate(int $customizationTemplate)
54
+ * @method Diglin_Ricento_Model_Sales_Options setPromotionSpace(int $promotionSpace)
55
+ * @method Diglin_Ricento_Model_Sales_Options setPromotionStartPage(int $promotionStartPage)
56
+ * @method Diglin_Ricento_Model_Sales_Options setProductWarranty(int $warranty)
57
+ * @method Diglin_Ricento_Model_Sales_Options setProductWarrantyDescriptionFr(string $warrantyDescriptionFr)
58
+ * @method Diglin_Ricento_Model_Sales_Options setProductWarrantyDescriptionDe(string $warrantyDescriptionDe)
59
+ * @method Diglin_Ricento_Model_Sales_Options setProductCondition(string $productConditionSource)
60
+ * @method Diglin_Ricento_Model_Sales_Options setProductConditionSourceAttributeCode(string $productConditionSourceAttributeCode)
61
+ * @method Diglin_Ricento_Model_Sales_Options setCreatedAt(string $createdAt)
62
+ * @method Diglin_Ricento_Model_Sales_Options setUpdatedAt(string $updatedAt)
63
+ */
64
+ class Diglin_Ricento_Model_Sales_Options extends Mage_Core_Model_Abstract
65
+ {
66
+ /**
67
+ * Prefix of model events names
68
+ * @var string
69
+ */
70
+ protected $_eventPrefix = 'sales_options';
71
+
72
+ /**
73
+ * Parameter name in event
74
+ * In observe method you can use $observer->getEvent()->getObject() in this case
75
+ * @var string
76
+ */
77
+ protected $_eventObject = 'sales_options';
78
+
79
+ /**
80
+ * Sales_Options Constructor
81
+ * @return void
82
+ */
83
+ protected function _construct()
84
+ {
85
+ parent::_construct();
86
+ $this->_init('diglin_ricento/sales_options');
87
+ }
88
+
89
+ /**
90
+ * Set date of last update
91
+ *
92
+ * @return Diglin_Ricento_Model_Sales_Options
93
+ */
94
+ protected function _beforeSave()
95
+ {
96
+ parent::_beforeSave();
97
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
98
+
99
+ if ($this->isObjectNew()) {
100
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
101
+ }
102
+
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * @param string $lang
108
+ * @return string
109
+ */
110
+ public function getProductWarrantyDescription($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG)
111
+ {
112
+ return $this->_getDescriptionLangMethod($lang, 'getProductWarrantyDescription');
113
+ }
114
+
115
+ /**
116
+ * @param string $lang
117
+ * @param string $method
118
+ * @return string
119
+ */
120
+ protected function _getDescriptionLangMethod($lang = Diglin_Ricento_Helper_Data::DEFAULT_SUPPORTED_LANG, $method)
121
+ {
122
+ $supportedLang = Mage::helper('diglin_ricento')->getSupportedLang();
123
+ $lang = strtolower($lang);
124
+
125
+ if (in_array($lang, $supportedLang)) {
126
+ $method = $method . ucwords($lang);
127
+ return $this->$method();
128
+ }
129
+ return '';
130
+ }
131
+ }
app/code/community/Diglin/Ricento/Model/Sales/Transaction.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sales_Transaction
14
+ *
15
+ * @method int getBidId()
16
+ * @method int getOrderId()
17
+ * @method int getWebsiteId()
18
+ * @method int getAddressId()
19
+ * @method int getCustomerId()
20
+ * @method int getLanguageId()
21
+ * @method int getRicardoCustomerId()
22
+ * @method int getRicardoArticleId()
23
+ * @method int getProductId()
24
+ * @method int getQty()
25
+ * @method int getViewCount()
26
+ * @method int getTotalBidPrice()
27
+ * @method string getPaymentMethods()
28
+ * @method string getPaymentDescription()
29
+ * @method int getShippingFee()
30
+ * @method int getShippingMethod()
31
+ * @method string getShippingText()
32
+ * @method string getShippingDescription()
33
+ * @method int getShippingCumulativeFee()
34
+ * @method string getRawData()
35
+ * @method string getSoldAt()
36
+ * @method string getUpdateAt()
37
+ * @method string getCreatedAt()
38
+ *
39
+ * @method Diglin_Ricento_Model_Sales_Transaction setBidId(int $bidId)
40
+ * @method Diglin_Ricento_Model_Sales_Transaction setOrderId(int $orderId)
41
+ * @method Diglin_Ricento_Model_Sales_Transaction setWebsiteId(int $websiteId)
42
+ * @method Diglin_Ricento_Model_Sales_Transaction setAddressId(int $addressId)
43
+ * @method Diglin_Ricento_Model_Sales_Transaction setCustomerId(int $customerId)
44
+ * @method Diglin_Ricento_Model_Sales_Transaction setLanguageId(int $languageId)
45
+ * @method Diglin_Ricento_Model_Sales_Transaction setRicardoCustomerId(int $ricardoCustomerId)
46
+ * @method Diglin_Ricento_Model_Sales_Transaction setRicardoArticleId(int $ricardoArticleId)
47
+ * @method Diglin_Ricento_Model_Sales_Transaction setProductId(int $productId)
48
+ * @method Diglin_Ricento_Model_Sales_Transaction setQty(int $qty)
49
+ * @method Diglin_Ricento_Model_Sales_Transaction setViewCount(int $viewCount)
50
+ * @method Diglin_Ricento_Model_Sales_Transaction setTotalBidPrice(float $totalBidPrice)
51
+ * @method Diglin_Ricento_Model_Sales_Transaction setPaymentMethods(string $paymentMethods)
52
+ * @method Diglin_Ricento_Model_Sales_Transaction setPaymentDescription(string $paymentDescription)
53
+ * @method Diglin_Ricento_Model_Sales_Transaction setShippingFee(int $shippingFee)
54
+ * @method Diglin_Ricento_Model_Sales_Transaction setShippingMethod(string $shippingMethod)
55
+ * @method Diglin_Ricento_Model_Sales_Transaction setShippingText(string $shippingText)
56
+ * @method Diglin_Ricento_Model_Sales_Transaction setShippingDescription(string $shippingDescription)
57
+ * @method Diglin_Ricento_Model_Sales_Transaction setShippingCumulativeFee(string $cumulativeShippingFee)
58
+ * @method Diglin_Ricento_Model_Sales_Transaction setRawData(string $rawData)
59
+ * @method Diglin_Ricento_Model_Sales_Transaction setSoldAt(string $soldAt)
60
+ * @method Diglin_Ricento_Model_Sales_Transaction setUpdateAt(string $updatedAt)
61
+ * @method Diglin_Ricento_Model_Sales_Transaction setCreatedAt(string $createdAt)
62
+ */
63
+ class Diglin_Ricento_Model_Sales_Transaction extends Mage_Core_Model_Abstract
64
+ {
65
+ protected function _construct()
66
+ {
67
+ $this->_init('diglin_ricento/sales_transaction');
68
+ }
69
+
70
+ /**
71
+ * Set date of last update
72
+ *
73
+ * @return Diglin_Ricento_Model_Sales_Options
74
+ */
75
+ protected function _beforeSave()
76
+ {
77
+ parent::_beforeSave();
78
+
79
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
80
+
81
+ if ($this->isObjectNew()) {
82
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
83
+ }
84
+
85
+ return $this;
86
+ }
87
+ }
app/code/community/Diglin/Ricento/Model/SplAutoloader.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SplClassLoader implementation that implements the technical interoperability
4
+ * standards for PHP 5.3 namespaces and class names.
5
+ *
6
+ * http://groups.google.com/group/php-standards/web/final-proposal
7
+ *
8
+ * // Example which loads classes for the Doctrine Common package in the
9
+ * // Doctrine\Common namespace.
10
+ * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
11
+ * $classLoader->register();
12
+ *
13
+ * @author Jonathan H. Wage <jonwage@gmail.com>
14
+ * @author Roman S. Borschel <roman@code-factory.org>
15
+ * @author Matthew Weier O'Phinney <matthew@zend.com>
16
+ * @author Kris Wallsmith <kris.wallsmith@gmail.com>
17
+ * @author Fabien Potencier <fabien.potencier@symfony-project.org>
18
+ */
19
+ class Diglin_Ricento_Model_SplAutoloader extends Mage_Core_Model_Abstract
20
+ {
21
+
22
+ private $_fileExtension = '.php';
23
+ private $_namespace;
24
+ private $_includePath;
25
+ private $_namespaceSeparator = '\\';
26
+
27
+ /**
28
+ * Creates a new <tt>SplClassLoader</tt> that loads classes of the
29
+ * specified namespace.
30
+ *
31
+ * @param string $ns The namespace to use.
32
+ */
33
+ public function __construct($ns = null, $includePath = null)
34
+ {
35
+ $this->_namespace = $ns;
36
+ $this->_includePath = $includePath;
37
+ }
38
+
39
+ /**
40
+ * Sets the namespace separator used by classes in the namespace of this class loader.
41
+ *
42
+ * @param string $sep The separator to use.
43
+ */
44
+ public function setNamespaceSeparator($sep)
45
+ {
46
+ $this->_namespaceSeparator = $sep;
47
+ }
48
+
49
+ /**
50
+ * Gets the namespace seperator used by classes in the namespace of this class loader.
51
+ *
52
+ * @return void
53
+ */
54
+ public function getNamespaceSeparator()
55
+ {
56
+ return $this->_namespaceSeparator;
57
+ }
58
+
59
+ /**
60
+ * Sets the base include path for all class files in the namespace of this class loader.
61
+ *
62
+ * @param string $includePath
63
+ */
64
+ public function setIncludePath($includePath)
65
+ {
66
+ $this->_includePath = $includePath;
67
+ }
68
+
69
+ /**
70
+ * Gets the base include path for all class files in the namespace of this class loader.
71
+ *
72
+ * @return string $includePath
73
+ */
74
+ public function getIncludePath()
75
+ {
76
+ return $this->_includePath;
77
+ }
78
+
79
+ /**
80
+ * Sets the file extension of class files in the namespace of this class loader.
81
+ *
82
+ * @param string $fileExtension
83
+ */
84
+ public function setFileExtension($fileExtension)
85
+ {
86
+ $this->_fileExtension = $fileExtension;
87
+ }
88
+
89
+ /**
90
+ * Gets the file extension of class files in the namespace of this class loader.
91
+ *
92
+ * @return string $fileExtension
93
+ */
94
+ public function getFileExtension()
95
+ {
96
+ return $this->_fileExtension;
97
+ }
98
+
99
+ /**
100
+ * Installs this class loader on the SPL autoload stack.
101
+ */
102
+ public function register()
103
+ {
104
+ spl_autoload_register(array($this, 'loadClass'), true, true);
105
+ }
106
+
107
+ /**
108
+ * Uninstalls this class loader from the SPL autoloader stack.
109
+ */
110
+ public function unregister()
111
+ {
112
+ spl_autoload_unregister(array($this, 'loadClass'));
113
+ }
114
+
115
+ /**
116
+ * Loads the given class or interface.
117
+ *
118
+ * @param string $className The name of the class to load.
119
+ * @return void
120
+ */
121
+ public function loadClass($className)
122
+ {
123
+ $className = ltrim($className, '\\');
124
+ $fileName = '';
125
+ if ($lastNsPos = strripos($className, '\\')) {
126
+ $namespace = substr($className, 0, $lastNsPos);
127
+ $className = substr($className, $lastNsPos + 1);
128
+ $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
129
+ }
130
+ $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
131
+ $fileName = stream_resolve_include_path($fileName);
132
+ if (false !== $fileName) {
133
+ include $fileName;
134
+ }
135
+ }
136
+ }
app/code/community/Diglin/Ricento/Model/Sync/Abstract.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sync_Abstract
14
+ */
15
+ abstract class Diglin_Ricento_Model_Sync_Abstract extends Mage_Core_Model_Abstract
16
+ {
17
+ /**
18
+ * Set date of last update, convert payment method array to string
19
+ *
20
+ * @return Diglin_Ricento_Model_Sync_Abstract
21
+ */
22
+ protected function _beforeSave()
23
+ {
24
+ parent::_beforeSave();
25
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
26
+
27
+ if ($this->isObjectNew()) {
28
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
29
+ }
30
+
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Save the current status of a job
36
+ *
37
+ * @param array $bind
38
+ * @return int|bool
39
+ */
40
+ public function saveCurrentJob($bind)
41
+ {
42
+ $jobId = $this->getId();
43
+
44
+ if (is_null($jobId)) {
45
+ return false;
46
+ }
47
+
48
+ return $this->getResource()->saveCurrentJob($jobId, $bind);
49
+ }
50
+ }
app/code/community/Diglin/Ricento/Model/Sync/Job.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sync_Job
14
+ *
15
+ * @method string getJobStatus()
16
+ * @method string getJobType()
17
+ * @method string getProgress()
18
+ * @method DateTime getStartedAt()
19
+ * @method DateTime getEndedAt()
20
+ * @method DateTime getCreatedAt()
21
+ * @method DateTime getUpdatedAt()
22
+ * @method Diglin_Ricento_Model_Sync_Job setJobMessage(string $message)
23
+ * @method Diglin_Ricento_Model_Sync_Job setJobType(string $type)
24
+ * @method Diglin_Ricento_Model_Sync_Job setJobStatus(string $status)
25
+ * @method Diglin_Ricento_Model_Sync_Job setProgress(string $progress)
26
+ * @method Diglin_Ricento_Model_Sync_Job setStartedAt(DateTime $starteddAt)
27
+ * @method Diglin_Ricento_Model_Sync_Job setEndedAt(DateTime $endedAt)
28
+ * @method Diglin_Ricento_Model_Sync_Job setCreatedAt(DateTime $createdAt)
29
+ * @method Diglin_Ricento_Model_Sync_Job setUpdatedAt(DateTime $updatedAt)
30
+ */
31
+ class Diglin_Ricento_Model_Sync_Job extends Diglin_Ricento_Model_Sync_Abstract
32
+ {
33
+ // TYPES OF JOB
34
+ const TYPE_CHECK_LIST = 'check_list';
35
+ const TYPE_LIST = 'list';
36
+ const TYPE_RELIST = 'relist';
37
+ const TYPE_STOP = 'stop';
38
+ const TYPE_UPDATE = 'update';
39
+ const TYPE_ORDER = 'order';
40
+ const TYPE_SYNCLIST = 'sync_list';
41
+
42
+ // PROGRESS
43
+ const PROGRESS_PENDING = 'pending';
44
+ const PROGRESS_RUNNING = 'running';
45
+ const PROGRESS_CHUNK_RUNNING = 'chunk_running';
46
+ const PROGRESS_COMPLETED = 'completed';
47
+ const PROGRESS_READY = 'ready';
48
+
49
+ // STATUSES
50
+ const STATUS_NOTICE = 'notice';
51
+ const STATUS_WARNING = 'warning';
52
+ const STATUS_ERROR = 'error';
53
+ const STATUS_SUCCESS = 'success';
54
+
55
+ /**
56
+ * Prefix of model events names
57
+ * @var string
58
+ */
59
+ protected $_eventPrefix = 'sync_job';
60
+
61
+ /**
62
+ * Parameter name in event
63
+ *
64
+ * @var string
65
+ */
66
+ protected $_eventObject = 'sync_job';
67
+
68
+ protected function _construct()
69
+ {
70
+ $this->_init('diglin_ricento/sync_job');
71
+ }
72
+
73
+ protected function _afterLoad()
74
+ {
75
+ try {
76
+ $jobMessage = $this->getData('job_message');
77
+ if (!is_array($jobMessage)) {
78
+ $this->setJobMessage(Mage::helper('core')->jsonDecode($jobMessage));
79
+ }
80
+ } catch (Exception $e) {
81
+ // keep going, do not block the script
82
+ Mage::logException($e);
83
+ }
84
+
85
+ return parent::_afterLoad();
86
+ }
87
+
88
+ protected function _beforeSave()
89
+ {
90
+ $message = $this->getData('job_message');
91
+ if (is_array($message)) {
92
+ $this->setJobMessage(Mage::helper('core')->jsonEncode($message));
93
+ }
94
+ return parent::_beforeSave();
95
+ }
96
+
97
+ /**
98
+ * Load the job by Job Type and Products Listing Id
99
+ *
100
+ * @param string $type
101
+ * @param int $productsListingId
102
+ * @param string|null $progress
103
+ * @return $this|bool
104
+ */
105
+ public function loadByTypeListingIdProgress($type, $productsListingId, $progress = null)
106
+ {
107
+ $jobId = $this->getResource()->loadByTypeListingIdProgress($type, $productsListingId, $progress);
108
+ if ($jobId) {
109
+ $this->load($jobId);
110
+ return $this;
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+ /**
117
+ * @param bool $default
118
+ * @return mixed|string
119
+ */
120
+ public function getJobMessage($default = false)
121
+ {
122
+ $helper = Mage::helper('diglin_ricento');
123
+
124
+ if ($this->getData('job_message') && !$default) {
125
+ return $this->getData('job_message');
126
+ } else {
127
+ switch ($this->getJobType()) {
128
+ case self::TYPE_CHECK_LIST:
129
+ if (in_array($this->getProgress(), array(self::PROGRESS_PENDING, self::PROGRESS_CHUNK_RUNNING))) {
130
+ return $helper->__('Check in progress...');
131
+ }
132
+ break;
133
+ case self::TYPE_LIST:
134
+ if (in_array($this->getProgress(), array(self::PROGRESS_PENDING, self::PROGRESS_CHUNK_RUNNING))) {
135
+ return $helper->__('List in progress...');
136
+ }
137
+ break;
138
+ default:
139
+ if (in_array($this->getProgress(), array(self::PROGRESS_PENDING, self::PROGRESS_CHUNK_RUNNING))) {
140
+ return $helper->__('Job in progress...');
141
+ }
142
+ break;
143
+ }
144
+ }
145
+ }
146
+
147
+ /**
148
+ * @return string
149
+ */
150
+ public function getJobTypeLabel()
151
+ {
152
+ $logTypes = Mage::getModel('diglin_ricento/config_source_sync_type')->toOptionHash();
153
+
154
+ return $logTypes[$this->getJobType()];
155
+ }
156
+ }
app/code/community/Diglin/Ricento/Model/Sync/Job/Listing.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sync_Job_Listing
14
+ *
15
+ * @method int getJobId()
16
+ * @method string getJobMessage()
17
+ * @method int getProductsListingId()
18
+ * @method int getLastItemId()
19
+ * @method int getTotalCount()
20
+ * @method int getTotalProceed()
21
+ * @method int getTotalSuccess()
22
+ * @method int getTotalError()
23
+ * @method string getCreatedAt()
24
+ * @method string getUpdatedAt()
25
+ *
26
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setJobId(int $id)
27
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setJobMessage(string $message)
28
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setProductsListingId(int $id)
29
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setLastItemId(int $id)
30
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setTotalCount(int $total)
31
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setTotalProceed(int $proceed)
32
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setTotalSuccess(int $success)
33
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setTotalError(int $error)
34
+ * @method Diglin_Ricento_Model_Sync_Job_Listing setUpdatedAt(string $date)
35
+ */
36
+
37
+ /**
38
+ * Class Diglin_Ricento_Model_Sync_Job_Listing
39
+ */
40
+ class Diglin_Ricento_Model_Sync_Job_Listing extends Diglin_Ricento_Model_Sync_Abstract
41
+ {
42
+ /**
43
+ * Prefix of model events names
44
+ * @var string
45
+ */
46
+ protected $_eventPrefix = 'sync_job_listing';
47
+
48
+ /**
49
+ * Parameter name in event
50
+ *
51
+ * @var string
52
+ */
53
+ protected $_eventObject = 'sync_job_listing';
54
+
55
+ protected function _construct()
56
+ {
57
+ $this->_init('diglin_ricento/sync_job_listing');
58
+ }
59
+ }
app/code/community/Diglin/Ricento/Model/Validate/Products/Item.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ use Diglin\Ricardo\Enums\PaymentMethods;
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Model_Validate_Products_Item
16
+ */
17
+ class Diglin_Ricento_Model_Validate_Products_Item extends Zend_Validate_Abstract
18
+ {
19
+ const LENGTH_PRODUCT_TITLE = 40;
20
+ const LENGTH_PRODUCT_SUBTITLE = 60;
21
+ const LENGTH_PRODUCT_DESCRIPTION = 65000;
22
+
23
+ const BUYNOW_MINPRICE_FIXPRICE = 0.05;
24
+ const BUYNOW_MAXPRICE_FIXPRICE = 2999.95;
25
+ const BUYNOW_MINPRICE_AUCTIONPRICE = 0.1;
26
+
27
+ const PERIOD_DAYS_MIN = 1; // in days
28
+ const PERIOD_DAYS_MAX = 10; // in days
29
+
30
+ /**
31
+ * @var array
32
+ */
33
+ protected $_errors = array();
34
+
35
+ /**
36
+ * @var array
37
+ */
38
+ protected $_warnings = array();
39
+
40
+ /**
41
+ * @var array
42
+ */
43
+ protected $_success = array();
44
+
45
+ /**
46
+ * Returns true if and only if $value meets the validation requirements
47
+ *
48
+ * If $value fails validation, then this method returns false, and
49
+ * getMessages() will return an array of messages that explain why the
50
+ * validation failed.
51
+ *
52
+ * @param Diglin_Ricento_Model_Products_Listing_Item $item
53
+ * @param array $stores
54
+ * @return boolean
55
+ * @throws Zend_Validate_Exception If validation of $value is impossible
56
+ */
57
+ public function isValid($item, $stores = array(Mage_Core_Model_APP::ADMIN_STORE_ID))
58
+ {
59
+ if (!$item instanceof Diglin_Ricento_Model_Products_Listing_Item) {
60
+ return false;
61
+ }
62
+
63
+ $item->setLoadFallbackOptions(true);
64
+ $helper = Mage::helper('diglin_ricento');
65
+
66
+ // Validate product content for each available store
67
+
68
+ foreach ($stores as $store) {
69
+
70
+ $item->setStoreId($store);
71
+
72
+ $storeCode = Mage::app()->getStore($store)->getName();
73
+
74
+ // Validate title
75
+
76
+ $strLen = new Zend_Validate_StringLength(array('min' => 1, 'max' => self::LENGTH_PRODUCT_TITLE));
77
+ if (!$strLen->isValid($item->getProductTitle(false))) {
78
+ // warning - content will be cut when exporting to ricardo
79
+ $this->_warnings[] = $helper->__('Product Title will be cut after %s characters when published on ricardo.ch for store "%s"', self::LENGTH_PRODUCT_TITLE, $storeCode);
80
+ }
81
+
82
+ // Validate subtitle
83
+
84
+ $strLen = new Zend_Validate_StringLength(array('max' => self::LENGTH_PRODUCT_SUBTITLE));
85
+ if (!$strLen->isValid($item->getProductSubtitle(false))) {
86
+ // warning - content will be cut when exporting to ricardo
87
+ $this->_warnings[] = $helper->__('Product Subtitle will be cut after %s characters when published on ricardo.ch for store "%s"', self::LENGTH_PRODUCT_SUBTITLE, $storeCode);
88
+ }
89
+
90
+ // Validate description
91
+
92
+ $strLen = new Zend_Validate_StringLength(array('min' => 1, 'max' => self::LENGTH_PRODUCT_DESCRIPTION));
93
+ if (!$strLen->isValid($item->getProductDescription(false))) {
94
+ // warning - content will be cut when exporting to ricardo
95
+ $this->_warnings[] = $helper->__('Product Description will be cut after %s characters when published on ricardo.ch for store "%s"', self::LENGTH_PRODUCT_DESCRIPTION, $storeCode);
96
+ }
97
+ }
98
+
99
+ // Reinit the product to default store
100
+
101
+ $item->getProduct()->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID);
102
+
103
+ // Validate custom options
104
+
105
+ if ($item->getProduct()->getHasOptions()) {
106
+ // warning - no option will be send to ricardo.ch
107
+ $this->_warnings[] = $helper->__('Custom Options are not supported. Those won\'t be synchronized into ricardo.ch.', Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY);
108
+ }
109
+
110
+ // Validate Inventory - In Stock or not? Enough Qty or not?
111
+
112
+ $salesOptionsStockManagement = $item->getSalesOptions()->getStockManagement();
113
+ $stockItem = $item->getProduct()->getStockItem();
114
+
115
+ if ($stockItem->getManageStock()) {
116
+ if ($salesOptionsStockManagement == -1) {
117
+ $qty = 1;
118
+ // if stock managed and qty > 0 => ok
119
+ // if stock not managed => ok (default qty will be set to 1)
120
+ } else {
121
+ $qty = $salesOptionsStockManagement;
122
+ // if stock managed, check there is enough quantity compared to $salesOptionsStockManagement
123
+ // if stock is not managed => ok (default qty will be set to 1)
124
+ }
125
+
126
+ if (!$item->getProduct()->checkQty($qty) || !$stockItem->getIsInStock()) {
127
+ // Error - Qty not available or not in stock
128
+ $this->_errors[] = $helper->__('The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock.');
129
+ }
130
+ }
131
+
132
+ // Validate the currency
133
+
134
+ $currencyCode = Mage::app()->getWebsite($item->getProductsListing()->getWebsiteId())->getBaseCurrencyCode();
135
+ if ($currencyCode != Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY) {
136
+ // Warning - Ricardo supports only CHF currency
137
+ $this->_warnings[] = $helper->__('Only %s currency is supported. No conversion will be done.', Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY);
138
+ }
139
+
140
+ // Validate Category exists
141
+
142
+ $category = $item->getCategory();
143
+ if (!$category) {
144
+ // error - category cannot be empty
145
+ $this->_errors[] = $helper->__('You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level.');
146
+ }
147
+
148
+ // Validate Payment and Shipping Rule
149
+
150
+ $methodValidator = new Diglin_Ricento_Model_Validate_Rules_Methods();
151
+ $rules = $item->getShippingPaymentRule();
152
+ $methods = array(
153
+ 'shipping' => $rules->getShippingMethod(),
154
+ 'payment' => $rules->getPaymentMethods()
155
+ );
156
+
157
+ if (!$methodValidator->isValid($methods)) {
158
+ // Error - combination respect mandatory
159
+ $this->_errors[] = $helper->__('Payment and/or Shipping combination are not correct.') . '<br>' . print_r($methodValidator->getMessages(), true);
160
+ }
161
+
162
+ // Validate price against buy now price > 0.05 or 0.1
163
+
164
+ $salesOptions = $item->getSalesOptions();
165
+ $productPrice = $item->getProductPrice();
166
+ if ($salesOptions->getSalesType() == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION && $salesOptions->getSalesAuctionDirectBuy()) {
167
+ $startPrice = $salesOptions->getSalesAuctionStartPrice();
168
+ $minPrice = ($startPrice < 0.1) ? 0.1 : $startPrice;
169
+
170
+ $greatherThanValidator = new Zend_Validate_GreaterThan(array('min' => $minPrice));
171
+
172
+ if (!$greatherThanValidator->isValid($productPrice)) {
173
+ // Error - Price not allowed
174
+ $this->_errors[] = $helper->__('You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s.', $productPrice, $minPrice);
175
+ }
176
+ }
177
+
178
+ if (($salesOptions->getSalesType() == Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW || $salesOptions->getSalesAuctionDirectBuy()) && in_array(PaymentMethods::TYPE_CREDIT_CARD, $rules->getPaymentMethods())) {
179
+ $betweenValidator = new Zend_Validate_Between(
180
+ array(
181
+ 'min' => self::BUYNOW_MINPRICE_FIXPRICE,
182
+ 'max' => self::BUYNOW_MAXPRICE_FIXPRICE,
183
+ 'inclusive' => true
184
+ )
185
+ );
186
+ if (!$betweenValidator->isValid($productPrice)) {
187
+ // Error - Price not allowed
188
+ $this->_errors[] = $helper->__('Product Price of %s CHF is incorrect for a direct sales with credit card. Price must be between %s and %s.', $productPrice, self::BUYNOW_MINPRICE_FIXPRICE, self::BUYNOW_MAXPRICE_FIXPRICE);
189
+ }
190
+ } else if($productPrice < self::BUYNOW_MINPRICE_FIXPRICE) {
191
+ $this->_errors[] = $helper->__('Product Price of %s CHF is incorrect. Minimum price is %s.', self::BUYNOW_MINPRICE_FIXPRICE);
192
+ }
193
+
194
+ // Validate Ending Date
195
+
196
+ $period = (int) $item->getSalesOptions()->getSchedulePeriodDays();
197
+ $betweenValidator = new Zend_Validate_Between(
198
+ array(
199
+ 'min' => self::PERIOD_DAYS_MIN,
200
+ 'max' => self::PERIOD_DAYS_MAX,
201
+ 'inclusive' => true
202
+ )
203
+ );
204
+
205
+ if (!$betweenValidator->isValid($period)) {
206
+ // Error - Period too long or too short
207
+ $this->_errors[] = $helper->__('The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days', self::PERIOD_DAYS_MIN, self::PERIOD_DAYS_MAX);
208
+ }
209
+
210
+ // Validate picture - warning if promotions exists but no picture
211
+
212
+ $assignedImages = $item->getProduct()->getImages();
213
+ if (empty($assignedImages) && ($salesOptions->getPromotionSpace() || $salesOptions->getPromotionStartPage())) {
214
+ // Warning - No promotion possible if no image in the product
215
+ $this->_warnings[] = $helper->__('You cannot use the privilege spaces as you do not have any pictures for this product.');
216
+ }
217
+
218
+ if (count($this->_errors)) {
219
+ return false;
220
+ }
221
+
222
+ return true;
223
+ }
224
+
225
+ /**
226
+ * @return array
227
+ */
228
+ public function getErrors()
229
+ {
230
+ return $this->_errors;
231
+ }
232
+
233
+ /**
234
+ * @return array
235
+ */
236
+ public function getWarnings()
237
+ {
238
+ return $this->_warnings;
239
+ }
240
+
241
+ /**
242
+ * @return array
243
+ */
244
+ public function getSuccess()
245
+ {
246
+ return $this->_success;
247
+ }
248
+
249
+ /**
250
+ * @return array
251
+ */
252
+ public function getMessages()
253
+ {
254
+ return array(
255
+ 'errors' => $this->_errors,
256
+ 'warnings' => $this->_warnings,
257
+ 'success' => $this->_success,
258
+ );
259
+ }
260
+ }
app/code/community/Diglin/Ricento/Model/Validate/Rules/Methods.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Validate_Rules_Methods
14
+ */
15
+ class Diglin_Ricento_Model_Validate_Rules_Methods extends Zend_Validate_Abstract
16
+ {
17
+ const ERROR_INVALID_PAYMENT_COMBINATION = 'invalidPaymentCombination';
18
+ const ERROR_INVALID_PAYMENT_SHIPPING_COMBINATION = 'invalidPaymentShippingCombination';
19
+
20
+ protected $_allowedPaymentCombinations = array(
21
+ array(
22
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD,
23
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_BANK_TRANSFER),
24
+ array(
25
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD,
26
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CASH),
27
+ array(
28
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD,
29
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_OTHER),
30
+ array(
31
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_BANK_TRANSFER),
32
+ array(
33
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CASH),
34
+ array(
35
+ \Diglin\Ricardo\Enums\PaymentMethods::TYPE_OTHER)
36
+ );
37
+
38
+ protected $_disallowedPaymentShippingCombinations = array(
39
+ array(
40
+ 'shipping' => Diglin_Ricento_Model_Config_Source_Rules_Shipping::TYPE_OTHER,
41
+ 'payment' => \Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD)
42
+ );
43
+
44
+ /*
45
+ * Message generation is overridden in getMessages()
46
+ */
47
+ protected $_messageTemplates = array(
48
+ self::ERROR_INVALID_PAYMENT_COMBINATION => self::ERROR_INVALID_PAYMENT_COMBINATION,
49
+ self::ERROR_INVALID_PAYMENT_SHIPPING_COMBINATION => self::ERROR_INVALID_PAYMENT_SHIPPING_COMBINATION
50
+ );
51
+
52
+ public function __construct()
53
+ {
54
+ $this->_normalizeAllowedPaymentCombinations();
55
+ }
56
+
57
+ protected function _normalizeAllowedPaymentCombinations()
58
+ {
59
+ foreach ($this->_allowedPaymentCombinations as $key => &$paymentArray) {
60
+ if (array_search(\Diglin\Ricardo\Enums\PaymentMethods::TYPE_CREDIT_CARD, $paymentArray) !== false
61
+ && !Mage::helper('diglin_ricento')->isCardPaymentAllowed()) {
62
+ unset($this->_allowedPaymentCombinations[$key]);
63
+ continue;
64
+ }
65
+
66
+ sort($paymentArray);
67
+ }
68
+
69
+ sort($this->_allowedPaymentCombinations);
70
+ }
71
+
72
+ /**
73
+ * Returns true if and only if $value meets the validation requirements
74
+ *
75
+ * If $value fails validation, then this method returns false, and
76
+ * getMessages() will return an array of messages that explain why the
77
+ * validation failed.
78
+ *
79
+ * @param mixed $value
80
+ * @return boolean
81
+ * @throws Zend_Validate_Exception If validation of $value is impossible
82
+ */
83
+ public function isValid($value)
84
+ {
85
+ if (!is_array($value) || !isset($value['shipping']) || !isset($value['payment'])) {
86
+ throw new Zend_Validate_Exception(__CLASS__ . ' expects array with keys "payment" and "shipping"');
87
+ }
88
+ $this->_setValue(print_r($value, true)); // string expected to display error message
89
+ return $this->_isValidPaymentCombination($value) && $this->_isValidPaymentShippingCombination($value);
90
+ }
91
+
92
+ /**
93
+ * Returns true if the combination of payment methods is allowed
94
+ *
95
+ * @param mixed $value [ 'shipping' => int, 'payment' => int[] ]
96
+ * @return bool
97
+ */
98
+ protected function _isValidPaymentCombination($value)
99
+ {
100
+ $normalizedPaymentArray = array_values((array)$value['payment']);
101
+ sort($normalizedPaymentArray);
102
+ if (!in_array($normalizedPaymentArray, $this->_allowedPaymentCombinations)) {
103
+ $this->_error(self::ERROR_INVALID_PAYMENT_COMBINATION);
104
+ return false;
105
+ }
106
+ return true;
107
+ }
108
+
109
+ /**
110
+ * Returns true if the selected shipping method is allowed together with the selected payment methods
111
+ *
112
+ * @param mixed $value [ 'shipping' => int, 'payment' => int[] ]
113
+ * @return bool
114
+ */
115
+ protected function _isValidPaymentShippingCombination($value)
116
+ {
117
+ foreach ($this->_disallowedPaymentShippingCombinations as $disallowedCombination) {
118
+ if ($disallowedCombination['shipping'] == $value['shipping'] && in_array($disallowedCombination['payment'], $value['payment'])) {
119
+ $this->_error(self::ERROR_INVALID_PAYMENT_SHIPPING_COMBINATION);
120
+ return false;
121
+ }
122
+ }
123
+ return true;
124
+ }
125
+
126
+ /**
127
+ * Returns JavaScript with form validation methods based on $_allowedPaymentCombinations and $_disallowedPaymentShippingCombinations
128
+ *
129
+ * @return string
130
+ */
131
+ public function getJavaScriptValidator()
132
+ {
133
+ /* @var $block Mage_Adminhtml_Block_Template */
134
+ $block = Mage::getBlockSingleton('adminhtml/template');
135
+ $block
136
+ ->setTemplate('ricento/js/rules/validate/paymentshipping.phtml')
137
+ ->setPaymentValidationMessage($this->getAllowedPaymentCombinationsMessage())
138
+ ->setJsonAllowedPaymentCombinations(Mage::helper('core')->jsonEncode($this->_allowedPaymentCombinations))
139
+ ->setPaymentShippingValidationMessage($this->getDisallowedPaymentShippingCombinationsMessage())
140
+ ->setJsonDisallowedPaymentShippingCombinations(Mage::helper('core')->jsonEncode($this->_disallowedPaymentShippingCombinations));
141
+
142
+ return $block->toHtml();
143
+ }
144
+
145
+ /**
146
+ * Return translated error messages
147
+ *
148
+ * @return array
149
+ */
150
+ public function getMessages()
151
+ {
152
+ $messages = parent::getMessages();
153
+ foreach ($messages as $messageKey => $messageValue) {
154
+ switch ($messageKey) {
155
+ case self::ERROR_INVALID_PAYMENT_COMBINATION:
156
+ $messages[$messageKey] = $this->getAllowedPaymentCombinationsMessage(false);
157
+ break;
158
+ case self::ERROR_INVALID_PAYMENT_SHIPPING_COMBINATION:
159
+ $messages[$messageKey] = $this->getDisallowedPaymentShippingCombinationsMessage();
160
+ break;
161
+ }
162
+ }
163
+ return $messages;
164
+ }
165
+
166
+ /**
167
+ * @param bool $wrapNotice
168
+ * @return string
169
+ */
170
+ public function getAllowedPaymentCombinationsMessage($wrapNotice = true)
171
+ {
172
+ $helper = Mage::helper('diglin_ricento');
173
+ return $helper->__('This payment method combination is not possible.') .
174
+ ($wrapNotice ? '<ul class="messages"><li class="notice-msg">' : ' ') .
175
+ $helper->__('The following combinations are possible:') .
176
+ $this->_htmlListOfAllowedPaymentCombinations() .
177
+ ($wrapNotice ? '</li></ul>' : '');
178
+ }
179
+
180
+ /**
181
+ * @return string
182
+ */
183
+ public function getDisallowedPaymentShippingCombinationsMessage()
184
+ {
185
+ $helper = Mage::helper('diglin_ricento');
186
+ return $helper->__('It is not possible to combine "Other" shipping method with "Credit Card" payment method');
187
+ }
188
+
189
+ /**
190
+ * Returns HTML for message box with detailed validation info
191
+ *
192
+ * @return string one line of HTML
193
+ */
194
+ protected function _htmlListOfAllowedPaymentCombinations()
195
+ {
196
+ /* @var $source Diglin_Ricento_Model_Config_Source_Rules_Payment */
197
+ $source = Mage::getModel('diglin_ricento/config_source_rules_payment');
198
+
199
+ $html = '<ul class="allowed-payment-combinations">';
200
+ foreach ($this->_allowedPaymentCombinations as $paymentCombination) {
201
+ $html .= '<li>';
202
+ $html .= join(' <em>+</em> ', array_map(array($source, 'getOptionText'), $paymentCombination));
203
+ $html .= '</li>';
204
+ }
205
+ $html .= '</ul>';
206
+ return $html;
207
+ }
208
+ }
app/code/community/Diglin/Ricento/Model/Validate/Sales/Increment.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Model_Sales_Validate
14
+ */
15
+ class Diglin_Ricento_Model_Validate_Sales_Increment extends Zend_Validate_Abstract
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $_allowedCombinations = array(
21
+ array('start_price' => array('min' => 0.05, 'max' => 9.99), 'increment' => array('min' => 0.05, 'max' => 5.00)),
22
+ array('start_price' => array('min' => 10.00, 'max' => 49.99), 'increment' => array('min' => 0.05, 'max' => 10.00)),
23
+ array('start_price' => array('min' => 50.00, 'max' => 99.99), 'increment' => array('min' => 0.05, 'max' => 20.00)),
24
+ array('start_price' => array('min' => 100.00, 'max' => 499.99), 'increment' => array('min' => 0.05, 'max' => 50.00)),
25
+ array('start_price' => array('min' => 500.00, 'max' => 999.99), 'increment' => array('min' => 0.05, 'max' => 100.00)),
26
+ array('start_price' => array('min' => 1000.00, 'max' => 1999.99), 'increment' => array('min' => 0.05, 'max' => 200.00)),
27
+ array('start_price' => array('min' => 2000.00, 'max' => 4999.99), 'increment' => array('min' => 0.05, 'max' => 500.00)),
28
+ array('start_price' => array('min' => 5000.00, 'max' => 1000000.00), 'increment' => array('min' => 0.05, 'max' => 1000.00)),
29
+ );
30
+
31
+ /**
32
+ * @param int|float $increment
33
+ * @param float $startPrice
34
+ * @return bool
35
+ */
36
+ public function isValid($increment, $startPrice = 0.05)
37
+ {
38
+ foreach ($this->_getAllowedCombination() as $combination) {
39
+ $startPriceValidate = new Zend_Validate_Between(array('min' => $combination['start_price']['min'], 'max' => $combination['start_price']['max']));
40
+ if ($startPriceValidate->isValid($startPrice)) {
41
+ $incrementValidate = new Zend_Validate_Between(array('min' => $combination['increment']['min'], 'max' => $combination['increment']['max']));
42
+ if ($incrementValidate->isValid($increment)) {
43
+ return true;
44
+ }
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+
50
+ /**
51
+ * Get an array of allowed combination
52
+ *
53
+ * @return array
54
+ */
55
+ protected function _getAllowedCombination()
56
+ {
57
+ return $this->_allowedCombinations;
58
+ }
59
+
60
+ /**
61
+ * Get Json string of the allowed combination
62
+ *
63
+ * @return string
64
+ */
65
+ protected function _getJsonAllowedCombination()
66
+ {
67
+ return json_encode($this->_allowedCombinations);
68
+ }
69
+
70
+ /**
71
+ * Get the Validator Javascript code
72
+ *
73
+ * @return string
74
+ */
75
+ public function getJavaScriptValidator()
76
+ {
77
+ $block = Mage::getBlockSingleton('adminhtml/template');
78
+ $block->setTemplate('ricento/js/salesoptions/validate/increment.phtml')
79
+ ->setJsonAllowedCombinations($this->_getJsonAllowedCombination())
80
+ ->setErrorMessage($this->getErrorMessage());
81
+
82
+ return $block->toHtml();
83
+ }
84
+
85
+ /**
86
+ * @param bool $wrapNotice
87
+ * @return string
88
+ */
89
+ public function getErrorMessage($wrapNotice = true)
90
+ {
91
+ $helper = Mage::helper('diglin_ricento');
92
+
93
+ return $helper->__('This increment value is not possible for this start price.') .
94
+ ($wrapNotice ? '<ul class="messages"><li class="notice-msg">' : ' ') .
95
+ $helper->__('Only the following combinations are possible:') .
96
+ $this->_htmlListOfAllowedCombinations() .
97
+ ($wrapNotice ? '</li></ul>' : '');
98
+ }
99
+
100
+ protected function _htmlListOfAllowedCombinations()
101
+ {
102
+ $helper = Mage::helper('diglin_ricento');
103
+
104
+ $html = '<table class="allowed-combinations">';
105
+ $html .= '<thead><tr>';
106
+ $html .= '<th><span>'. $helper->__('Start price is between') . '</span></th>';
107
+ $html .= '<th><span>'. $helper->__('Increment must be between') .'</span></th>';
108
+ $html .= '</tr></thead>';
109
+ $html .= '<tbody>';
110
+ foreach ($this->_getAllowedCombination() as $combination) {
111
+ $html .= '<tr>';
112
+ $html .= '<td><span>' . $combination['start_price']['min'] . '...' . $combination['start_price']['max'] . '</span></td>';
113
+ $html .= '<td><span>' . $combination['increment']['min'] . '...' . $combination['increment']['max'] . '</span></td>';
114
+ $html .= '</tr>';
115
+ }
116
+ $html .= '</tbody>';
117
+ $html .= '</table>';
118
+ return $html;
119
+ }
120
+ }
app/code/community/Diglin/Ricento/Test/Model/Rule/Validate.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Test_Model_Rule_Validate
14
+ */
15
+ class Diglin_Ricento_Test_Model_Rule_Validate extends EcomDev_PHPUnit_Test_Case
16
+ {
17
+ /**
18
+ * @var Diglin_Ricento_Model_Validate_Rules_Methods
19
+ */
20
+ protected $_subject;
21
+
22
+ protected function setUp()
23
+ {
24
+ $this->_subject = Mage::getModel('diglin_ricento/validate_rules_methods');
25
+ return parent::setUp();
26
+ }
27
+
28
+ /**
29
+ * @test
30
+ * @loadExpectations
31
+ * @dataProvider dataProvider
32
+ */
33
+ public function testPaymentMethodCombinations($payment, $shipping)
34
+ {
35
+ $expectedResults = $this->expected(sprintf('payment-%s_shipping-%s', join('-', $payment), $shipping));
36
+ $this->assertEquals(
37
+ $expectedResults->getIsValid(),
38
+ $this->_subject->isValid(array('shipping' => $shipping, 'payment' => $payment)),
39
+ 'isValid() result'
40
+ );
41
+ $this->assertEquals(
42
+ $expectedResults->getMessages(),
43
+ array_keys($this->_subject->getMessages()),
44
+ 'keys of getMessages() result',
45
+ 0, 10, true
46
+ );
47
+ }
48
+ }
app/code/community/Diglin/Ricento/Test/Model/Rule/Validate/expectations/testPaymentMethodCombinations.yaml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ payment-0-2_shipping-1:
2
+ is_valid: 1
3
+ messages: []
4
+ payment-1-2_shipping-1:
5
+ is_valid: 1
6
+ messages: []
7
+ payment-2-3_shipping-1:
8
+ is_valid: 1
9
+ messages: []
10
+ payment-0_shipping-1:
11
+ is_valid: 1
12
+ messages: []
13
+ payment-1_shipping-1:
14
+ is_valid: 1
15
+ messages: []
16
+ payment-3_shipping-1:
17
+ is_valid: 1
18
+ messages: []
19
+
20
+ payment-2_shipping-1:
21
+ is_valid: 0
22
+ messages: [invalidPaymentCombination]
23
+ payment-0-1-2_shipping-1:
24
+ is_valid: 0
25
+ messages: [invalidPaymentCombination]
26
+ payment-0-1-2-3_shipping-1:
27
+ is_valid: 0
28
+ messages: [invalidPaymentCombination]
29
+ payment-1-3_shipping-1:
30
+ is_valid: 0
31
+ messages: [invalidPaymentCombination]
32
+ payment-0-1-3_shipping-1:
33
+ is_valid: 0
34
+ messages: [invalidPaymentCombination]
35
+
36
+ payment-2-0_shipping-1:
37
+ is_valid: 1
38
+ messages: []
39
+ payment-2-1-0_shipping-1:
40
+ is_valid: 0
41
+ messages: [invalidPaymentCombination]
42
+
43
+ payment-0-2_shipping-11:
44
+ is_valid: 0
45
+ messages: [invalidPaymentShippingCombination]
46
+ payment-1-2_shipping-11:
47
+ is_valid: 0
48
+ messages: [invalidPaymentShippingCombination]
49
+ payment-2-3_shipping-11:
50
+ is_valid: 0
51
+ messages: [invalidPaymentShippingCombination]
52
+
53
+ payment-0_shipping-11:
54
+ is_valid: 1
55
+ messages: []
56
+ payment-1_shipping-11:
57
+ is_valid: 1
58
+ messages: []
59
+ payment-3_shipping-11:
60
+ is_valid: 1
61
+ messages: []
62
+
63
+ payment-0-2_shipping-2:
64
+ is_valid: 1
65
+ messages: []
66
+ payment-0-2_shipping-3:
67
+ is_valid: 1
68
+ messages: []
69
+ payment-0-2_shipping-4:
70
+ is_valid: 1
71
+ messages: []
72
+ payment-0-2_shipping-5:
73
+ is_valid: 1
74
+ messages: []
75
+ payment-0-2_shipping-6:
76
+ is_valid: 1
77
+ messages: []
78
+ payment-0-2_shipping-7:
79
+ is_valid: 1
80
+ messages: []
81
+ payment-0-2_shipping-8:
82
+ is_valid: 1
83
+ messages: []
84
+ payment-0-2_shipping-9:
85
+ is_valid: 1
86
+ messages: []
87
+ payment-0-2_shipping-10:
88
+ is_valid: 1
89
+ messages: []
app/code/community/Diglin/Ricento/Test/Model/Rule/Validate/providers/testPaymentMethodCombinations.yaml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file provided parameters for the testPaymentMethodCombinations test. All array keys are just for
3
+ # better readability
4
+ #
5
+
6
+ # All allowed payment method combinations
7
+ allowed_cc_bank:
8
+ payment: [ 0, 2 ]
9
+ shipping: 1
10
+ allowed_cc_cash:
11
+ payment: [ 1, 2 ]
12
+ shipping: 1
13
+ allowed_cc_other:
14
+ payment: [ 2, 3 ]
15
+ shipping: 1
16
+ allowed_bank:
17
+ payment: [ 0 ]
18
+ shipping: 1
19
+ allowed_cash:
20
+ payment: [ 1 ]
21
+ shipping: 1
22
+ allowed_other:
23
+ payment: [ 3 ]
24
+ shipping: 1
25
+
26
+ # Disallowed payment method combinations
27
+ disallowed_cc:
28
+ payment: [ 2 ]
29
+ shipping: 1
30
+ disallowed_cc_bank_cash:
31
+ payment: [ 0, 1, 2]
32
+ shipping: 1
33
+ disallowed_cc_bank_cash_other:
34
+ payment: [ 0, 1, 2, 3 ]
35
+ shipping: 1
36
+ disallowed_cash_other:
37
+ payment: [ 1, 3 ]
38
+ shipping: 1
39
+ disallowed_bank_cash_other:
40
+ payment: [ 0, 1, 3 ]
41
+ shipping: 1
42
+
43
+ # Test array normalization
44
+ payment_normalize_allowed:
45
+ payment: [ 2, 0 ]
46
+ shipping: 1
47
+ payment_normalize_disallowed:
48
+ payment: [ 2, 1, 0]
49
+ shipping: 1
50
+
51
+ # Test shipping method "Other" with credit card
52
+ disallowed_shipping_other_payment_cc_bank:
53
+ payment: [ 0, 2 ]
54
+ shipping: 11
55
+ disallowed_shipping_other_payment_cc_cash:
56
+ payment: [ 1, 2 ]
57
+ shipping: 11
58
+ disallowed_shipping_other_payment_cc_other:
59
+ payment: [ 2, 3 ]
60
+ shipping: 11
61
+
62
+ # Test shipping method "Other" without credit card
63
+ allowed_shipping_other_payment_bank:
64
+ payment: [ 0 ]
65
+ shipping: 11
66
+ allowed_shipping_other_payment_cash:
67
+ payment: [ 1 ]
68
+ shipping: 11
69
+ allowed_shipping_other_payment_other:
70
+ payment: [ 3 ]
71
+ shipping: 11
72
+
73
+ # Test different shipping methods
74
+ allowed_shipping_mail_apost_payment_cc_bank:
75
+ payment: [ 0, 2 ]
76
+ shipping: 2
77
+ allowed_shipping_mail_bpost_payment_cc_bank:
78
+ payment: [ 0, 2 ]
79
+ shipping: 3
80
+ allowed_shipping_package_apost_payment_cc_bank:
81
+ payment: [ 0, 2 ]
82
+ shipping: 4
83
+ allowed_shipping_package_bpost_payment_cc_bank:
84
+ payment: [ 0, 2 ]
85
+ shipping: 5
86
+ allowed_shipping_dhl_payment_cc_bank:
87
+ payment: [ 0, 2 ]
88
+ shipping: 6
89
+ allowed_shipping_dps_payment_cc_bank:
90
+ payment: [ 0, 2 ]
91
+ shipping: 7
92
+ allowed_shipping_ups_payment_cc_bank:
93
+ payment: [ 0, 2 ]
94
+ shipping: 8
95
+ allowed_shipping_tnt_payment_cc_bank:
96
+ payment: [ 0, 2 ]
97
+ shipping: 9
98
+ allowed_shipping_flat_payment_cc_bank:
99
+ payment: [ 0, 2 ]
100
+ shipping: 10
app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Test_Model_Rule_Validate
14
+ */
15
+ class Diglin_Ricento_Test_Model_Rule_Validate extends EcomDev_PHPUnit_Test_Case
16
+ {
17
+ /**
18
+ * @var Diglin_Ricento_Model_Sales_Validate_Increment
19
+ */
20
+ protected $_subject;
21
+
22
+ protected function setUp()
23
+ {
24
+ $this->_subject = Mage::getModel('diglin_ricento/validate_sales_increment');
25
+ return parent::setUp();
26
+ }
27
+
28
+ /**
29
+ * @test
30
+ * @loadExpectations
31
+ * @dataProvider dataProvider
32
+ */
33
+ public function testStartPriceIncrementCombination($startPrice, $increment)
34
+ {
35
+ $expectedResults = $this->expected(sprintf('startprice-%s_increment-%s', $startPrice, $increment));
36
+ $this->assertEquals(
37
+ $expectedResults->getIsValid(),
38
+ $this->_subject->isValid($increment, $startPrice),
39
+ 'isValid() result'
40
+ );
41
+ // $this->assertEquals(
42
+ // $expectedResults->getMessages(),
43
+ // array_keys($this->_subject->getMessages()),
44
+ // 'keys of getMessages() result',
45
+ // 0, 10, true
46
+ // );
47
+ }
48
+ }
app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment/expectations/testStartPriceIncrementCombination.yaml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ startprice-5_increment-3.00:
2
+ is_valid: 1
3
+ messages: []
4
+ startprice-49.99_increment-10.00:
5
+ is_valid: 1
6
+ messages: []
7
+ startprice-50_increment-15.00:
8
+ is_valid: 1
9
+ messages: []
10
+ startprice-120_increment-45.00:
11
+ is_valid: 1
12
+ messages: []
13
+ startprice-550_increment-48.00:
14
+ is_valid: 1
15
+ messages: []
16
+ startprice-1200_increment-100.00:
17
+ is_valid: 1
18
+ messages: []
19
+ startprice-2300.00_increment-150.00:
20
+ is_valid: 1
21
+ messages: []
22
+ startprice-5500_increment-450.00:
23
+ is_valid: 1
24
+ messages: []
25
+
26
+ startprice-5_increment-10.00:
27
+ is_valid: 0
28
+ messages: []
29
+ startprice-49.99_increment-20.00:
30
+ is_valid: 0
31
+ messages: []
32
+ startprice-50_increment-50.00:
33
+ is_valid: 0
34
+ messages: []
35
+ startprice-120_increment-100.00:
36
+ is_valid: 0
37
+ messages: []
38
+ startprice-550_increment-200.00:
39
+ is_valid: 0
40
+ messages: []
41
+ startprice-1200_increment-400.00:
42
+ is_valid: 0
43
+ messages: []
44
+ startprice-2300.00_increment-600.00:
45
+ is_valid: 0
46
+ messages: []
47
+ startprice-5500_increment-2000.00:
48
+ is_valid: 0
49
+ messages: []
app/code/community/Diglin/Ricento/Test/Model/Sales/Validate/Increment/providers/testStartPriceIncrementCombination.yaml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file provided parameters for the testStartPriceIncrementCombination test. All array keys are just for
3
+ # better readability
4
+ #
5
+
6
+ # All allowed payment method combinations
7
+ allowed_1:
8
+ startprice: 5
9
+ increment: 3.00
10
+ allowed_2:
11
+ startprice: 49.99
12
+ increment: 10.00
13
+ allowed_3:
14
+ startprice: 50
15
+ increment: 15.00
16
+ allowed_4:
17
+ startprice: 120
18
+ increment: 45.00
19
+ allowed_5:
20
+ startprice: 550
21
+ increment: 48.00
22
+ allowed_6:
23
+ startprice: 1200
24
+ increment: 100.00
25
+ allowed_7:
26
+ startprice: 2300.00
27
+ increment: 150.00
28
+ allowed_8:
29
+ startprice: 5500
30
+ increment: 450.00
31
+
32
+ notallowed_1:
33
+ startprice: 5
34
+ increment: 10.00
35
+ notallowed_2:
36
+ startprice: 49.99
37
+ increment: 20.00
38
+ notallowed_3:
39
+ startprice: 50
40
+ increment: 50.00
41
+ notallowed_4:
42
+ startprice: 120
43
+ increment: 100.00
44
+ notallowed_5:
45
+ startprice: 550
46
+ increment: 200.00
47
+ notallowed_6:
48
+ startprice: 1200
49
+ increment: 400.00
50
+ notallowed_7:
51
+ startprice: 2300.00
52
+ increment: 600.00
53
+ notallowed_8:
54
+ startprice: 5500
55
+ increment: 2000.00
app/code/community/Diglin/Ricento/controllers/Adminhtml/AccountController.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_AccountController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_AccountController extends Mage_Adminhtml_Controller_Action
16
+ {
17
+ public function signupAction()
18
+ {
19
+ $block = $this->getLayout()->createBlock('core/template');
20
+
21
+ $block
22
+ ->setTemplate('ricento/iframe.phtml')
23
+ ->setTitle($this->__('ricardo.ch API Signup'))
24
+ ->setIframeUrl(Mage::helper('diglin_ricento')->getRicardoSignupApiUrl(false));
25
+
26
+ $ricardoLabel = $this->__('ricardo.ch');
27
+ $signupLabel = $this->__('API Signup');
28
+
29
+ $this->_title($signupLabel);
30
+
31
+ $this->loadLayout()
32
+ ->_setActiveMenu('ricento/signup')
33
+ ->_addBreadcrumb($ricardoLabel, $ricardoLabel)
34
+ ->_addBreadcrumb($signupLabel, $signupLabel)
35
+ ->_addContent($block)
36
+ ->renderLayout();
37
+ }
38
+
39
+ public function assistantAction()
40
+ {
41
+ $block = $this->getLayout()->createBlock('core/template');
42
+
43
+ $block
44
+ ->setTemplate('ricento/iframe.phtml')
45
+ ->setTitle($this->__('ricardo.ch Assistant Portal'))
46
+ ->setIframeUrl(Mage::helper('diglin_ricento')->getRicardoAssistantUrl());
47
+
48
+ $ricardoLabel = $this->__('ricardo.ch');
49
+ $assistantLabel = $this->__('Assistant Portal');
50
+
51
+ $this->_title($assistantLabel);
52
+
53
+ $this->loadLayout()
54
+ ->_setActiveMenu('ricento/assistant')
55
+ ->_addBreadcrumb($ricardoLabel, $ricardoLabel)
56
+ ->_addBreadcrumb($assistantLabel, $assistantLabel)
57
+ ->_addContent($block)
58
+ ->renderLayout();
59
+ }
60
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/ApiController.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ use Diglin\Ricardo\Services\ServiceAbstract;
12
+
13
+ class Diglin_Ricento_Adminhtml_ApiController extends Mage_Adminhtml_Controller_Action
14
+ {
15
+ protected function _isAllowed()
16
+ {
17
+ return Mage::getSingleton('admin/session')->isAllowed('ricento/config');
18
+ }
19
+
20
+ public function confirmationAction()
21
+ {
22
+ $success = (int)$this->getRequest()->getParam('success', 0);
23
+
24
+ if ($success) {
25
+ $temporaryToken = $this->getRequest()->getParam('temporarytoken');
26
+ $websiteId = (int)$this->getRequest()->getParam('website');
27
+
28
+ if (!is_numeric($websiteId) || is_null($websiteId)) {
29
+ $this->_getSession()->addError($this->__('The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side.'));
30
+ $this->_redirect('adminhtml');
31
+ return;
32
+ }
33
+
34
+ $securityService = Mage::getSingleton('diglin_ricento/api_services_security');
35
+ /* @var $securityServiceModel Diglin\Ricardo\Managers\Security */
36
+ $securityServiceModel = $securityService
37
+ ->setCurrentWebsite($websiteId)
38
+ ->getServiceModel(); // Get Service Model instead to use __call method, prevent caching but also some logic
39
+
40
+ try {
41
+ // Save the temporary token created after to got the validation url from Diglin_Ricento_Model_Api_Services_Security
42
+ $apiTokenTemp = Mage::getModel('diglin_ricento/api_token')
43
+ ->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY, $websiteId);
44
+
45
+ $apiTokenTemp
46
+ ->setWebsiteId($websiteId)
47
+ ->setToken($temporaryToken)
48
+ ->setTokenType(ServiceAbstract::TOKEN_TYPE_TEMPORARY)
49
+ ->save();
50
+
51
+ $expirationDate = new DateTime($apiTokenTemp->getExpirationDate());
52
+
53
+ // Initialize the Security Model with the required variable
54
+ $securityServiceModel
55
+ ->setTemporaryTokenExpirationDate($expirationDate->getTimestamp())
56
+ ->setTemporaryToken($temporaryToken);
57
+
58
+ // Save the credential token for future use
59
+ $apiToken = Mage::getModel('diglin_ricento/api_token')
60
+ ->loadByWebsiteAndTokenType(ServiceAbstract::TOKEN_TYPE_IDENTIFIED, $websiteId);
61
+
62
+ $apiToken
63
+ ->setWebsiteId($websiteId)
64
+ ->setToken($securityServiceModel->getCredentialToken())
65
+ ->setTokenType(ServiceAbstract::TOKEN_TYPE_IDENTIFIED)
66
+ ->setExpirationDate($securityServiceModel->getCredentialTokenExpirationDate())
67
+ ->setSessionDuration($securityServiceModel->getCredentialTokenSessionDuration())
68
+ ->setSessionExpirationDate(
69
+ Mage::helper('diglin_ricento/api')->calculateSessionExpirationDate(
70
+ $securityServiceModel->getCredentialTokenSessionDuration(),
71
+ $securityServiceModel->getCredentialTokenSessionStart()))
72
+ ->save();
73
+
74
+ // Cleanup as we do not need it and in any case we will have to generate it again.
75
+ $apiTokenTemp->delete();
76
+
77
+ $this->_getSession()->addSuccess($this->__('Your ricardo.ch account has been authorized to get access to the API.'));
78
+
79
+ } catch (Exception $e) {
80
+ Mage::logException($e);
81
+ Mage::log($securityService->getLastApiDebug($websiteId), Zend_Log::DEBUG, Diglin_Ricento_Helper_Data::LOG_FILE);
82
+ $this->_getSession()->addError($this->__('An error occurred while saving the token. Please, check your log files.'));
83
+ }
84
+ } else {
85
+ $this->_getSession()->addError($this->__('Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason.'));
86
+ }
87
+
88
+ $this->_redirect('adminhtml');
89
+ }
90
+
91
+ public function unlinkTokenAction()
92
+ {
93
+ $entityId = $this->getRequest()->getParam('entity_id');
94
+ if (!empty($entityId)) {
95
+
96
+ $token = Mage::getModel('diglin_ricento/api_token')
97
+ ->load($entityId);
98
+
99
+ if ($token->getId()) {
100
+ $token->delete();
101
+ }
102
+ }
103
+
104
+ $this->_redirect('ricento/dashboard');
105
+ }
106
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/DashboardController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_DashboardController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_DashboardController extends Mage_Adminhtml_Controller_Action
16
+ {
17
+ protected function _isAllowed()
18
+ {
19
+ return Mage::getSingleton('admin/session')->isAllowed('ricento/dashboard');
20
+ }
21
+
22
+ /**
23
+ * Ricento dashboard
24
+ */
25
+ public function indexAction()
26
+ {
27
+ $this->loadLayout();
28
+ $this->renderLayout();
29
+ }
30
+
31
+ /**
32
+ * Proxy for Google Chart API, reused from core dashboard
33
+ */
34
+ public function tunnelAction()
35
+ {
36
+ $this->_forward('tunnel', 'dashboard', 'admin');
37
+ }
38
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ require_once 'Mage/Adminhtml/controllers/IndexController.php';
13
+
14
+ /**
15
+ * Class Diglin_Ricento_Adminhtml_IndexController
16
+ *
17
+ * use the adminhtml index controller for standard actions like deniedJsonAction()
18
+ */
19
+ class Diglin_Ricento_Adminhtml_IndexController extends Mage_Adminhtml_IndexController
20
+ {
21
+
22
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/LogController.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_LogController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_LogController extends Diglin_Ricento_Controller_Adminhtml_Action
16
+ {
17
+ protected function _isAllowed()
18
+ {
19
+ return Mage::getSingleton('admin/session')->isAllowed('ricento/log');
20
+ }
21
+
22
+ protected function _initAction()
23
+ {
24
+ $this->loadLayout();
25
+ $this->_title(Mage::helper('diglin_ricento')->__('Logs'));
26
+
27
+ return $this;
28
+ }
29
+
30
+ public function indexAction()
31
+ {
32
+ $this->_redirect('*/*/listing');
33
+ }
34
+
35
+ /**
36
+ * Show logs of the listings
37
+ */
38
+ public function listingAction()
39
+ {
40
+ $this->_initAction();
41
+
42
+ // $productsListing = null;
43
+ // if ($this->getRequest()->getParam('id')) {
44
+ // $productsListing = $this->_initListing();
45
+ // $id = $productsListing->getId();
46
+ // }
47
+
48
+ // if ($productsListing && !empty($id)) {
49
+ // $block = $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_log');
50
+ // } else {
51
+ // }
52
+
53
+ $block = $this->getLayout()->createBlock('diglin_ricento/adminhtml_log', 'ricento_logs_tabs',
54
+ array('active_tab' => Diglin_Ricento_Block_Adminhtml_Log_Tabs::TAB_LISTING)
55
+ );
56
+
57
+ $this->_addContent($block)->renderLayout();
58
+ }
59
+
60
+ /**
61
+ * Show synchronization job processes
62
+ */
63
+ public function syncAction()
64
+ {
65
+ $this->_initAction();
66
+
67
+ $block = $this->getLayout()->createBlock('diglin_ricento/adminhtml_log', 'ricento_logs_tabs',
68
+ array('active_tab' => Diglin_Ricento_Block_Adminhtml_Log_Tabs::TAB_SYNCHRONIZATION)
69
+ );
70
+
71
+ $this->_addContent($block)->renderLayout();
72
+ }
73
+
74
+ /**
75
+ * Show orders passed
76
+ */
77
+ public function orderAction()
78
+ {
79
+ $this->_initAction();
80
+
81
+ $block = $this->getLayout()->createBlock('diglin_ricento/adminhtml_log', 'ricento_logs_tabs',
82
+ array('active_tab' => Diglin_Ricento_Block_Adminhtml_Log_Tabs::TAB_ORDER)
83
+ );
84
+
85
+ $this->_addContent($block)->renderLayout();
86
+ }
87
+
88
+ /**
89
+ * Massaction to delete listing logs
90
+ */
91
+ public function massListingDeleteAction()
92
+ {
93
+ $logs = $this->getRequest()->getParam('listing_logs_grid');
94
+
95
+ try {
96
+ if (is_array($logs)) {
97
+ $logCollection = Mage::getResourceModel('diglin_ricento/products_listing_log_collection');
98
+ $logCollection
99
+ ->addFieldToFilter('log_id', array('in' => $logs));
100
+
101
+ $logCollection->walk('delete');
102
+ $this->_getSession()->addSuccess($this->__('Log(s) is/are successfully deleted.'));
103
+ }
104
+ } catch (Exception $e) {
105
+ Mage::logException($e);
106
+ $this->_getSession()->addError($this->__('An error occurred while trying to delete the listing log(s). Please, check your exception log.'));
107
+ }
108
+
109
+ $this->_redirect('*/*/listing');
110
+ }
111
+
112
+ /**
113
+ * Massaction to delete sync jobs
114
+ */
115
+ public function massSyncDeleteAction()
116
+ {
117
+ $jobs = $this->getRequest()->getParam('jobs_grid');
118
+
119
+ try {
120
+ if (is_array($jobs)) {
121
+ $jobCollection = Mage::getResourceModel('diglin_ricento/sync_job_collection');
122
+ $jobCollection->addFieldToFilter('job_id', array('in' => $jobs));
123
+ // ->addFieldToFilter('progress', array('neq' => Diglin_Ricento_Model_Sync_Job::PROGRESS_RUNNING));
124
+
125
+ $goingToBeDeleted = $jobCollection->getAllIds();
126
+
127
+ $jobCollection->walk('delete');
128
+ $this->_getSession()->addSuccess($this->__('Job(s) is/are successfully deleted.'));
129
+
130
+ $notDeleted = array_diff($jobs, $goingToBeDeleted);
131
+ if ($notDeleted) {
132
+ $this->_getSession()->addNotice($this->__('The following job IDs have not been deleted because they are still running: %s', implode(',', $notDeleted)));
133
+ }
134
+ }
135
+ } catch (Exception $e) {
136
+ Mage::logException($e);
137
+ $this->_getSession()->addError($this->__('An error occurred while trying to delete the job(s). Please, check your exception log.'));
138
+ }
139
+
140
+ $this->_redirect('*/*/sync');
141
+ }
142
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/CategoryController.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_Products_CategoryController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_Products_CategoryController extends Diglin_Ricento_Controller_Adminhtml_Action
16
+ {
17
+ public function mappingAction()
18
+ {
19
+ $this->loadLayout();
20
+ $this->getLayout()->getBlock('category_mapping')
21
+ ->setCategoryId($this->getRequest()->getParam('id', 1));
22
+ $this->renderLayout();
23
+ }
24
+
25
+ public function childrenAction()
26
+ {
27
+ $this->loadLayout();
28
+ $this->getLayout()->getBlock('category_children')
29
+ ->setCategoryId($this->getRequest()->getParam('id', 1))
30
+ ->setLevel($this->getRequest()->getParam('level', 0));
31
+ $this->renderLayout();
32
+ }
33
+
34
+ /**
35
+ * Show the categories tree to add products related to them into a product listing item
36
+ */
37
+ public function showCategoriesTreeAction()
38
+ {
39
+ $noContentRender = false;
40
+
41
+ if (!$this->_initListing()) {
42
+ $this->_getSession()->addError($this->__('No category will be displayed, the products listing doesn\'t exists. Please, close the window.'));
43
+ $noContentRender = true;
44
+ }
45
+
46
+ if (!$this->_savingAllowed()) {
47
+ $this->_getSession()->addError($this->__('You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window.'));
48
+ $noContentRender = true;
49
+ }
50
+
51
+ $this->loadLayout();
52
+
53
+ if ($noContentRender) {
54
+ $this->getLayout()->getBlock('content')->unsetChild('products_listing_categories');
55
+ }
56
+
57
+ $this->renderLayout();
58
+ }
59
+
60
+ /**
61
+ * Use for ajax call to load new categories in the tree
62
+ */
63
+ public function categoriesJsonAction()
64
+ {
65
+ $this->getResponse()->setBody(
66
+ $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_category_tree_categories')
67
+ ->getCategoryChildrenJson($this->getRequest()->getParam('category'))
68
+ );
69
+ }
70
+
71
+ public function saveProductsToAddAction()
72
+ {
73
+ if (!$this->_initListing()) {
74
+ $this->_getSession()->addError($this->__('Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists.'));
75
+ $this->_redirect('*/products_listing/index');
76
+ return;
77
+ }
78
+
79
+ if (!$this->_savingAllowed()) {
80
+ $this->_getSession()->addError($this->__('You are not allowed to save the products listing, so you cannot add products from a category.'));
81
+ $this->_redirect('*/products_listing/index');
82
+ return;
83
+ }
84
+
85
+ $categoryIds = $this->getRequest()->getParam('category_ids', array());
86
+
87
+ try {
88
+ $productsAdded = 0;
89
+ $categoryIds = array_unique(explode(',', $categoryIds));
90
+ if (!empty($categoryIds)) {
91
+ $supportedTypes = Mage::helper('diglin_ricento')->getAllowedProductTypes();
92
+
93
+ $productsListingItemIds = (array)$this->_getListing()
94
+ ->getProductsListingItemCollection()
95
+ ->getColumnValues('product_id');
96
+
97
+ $categories = Mage::getResourceModel('catalog/category_collection')
98
+ ->addFieldToFilter('entity_id', array('in' => $categoryIds));
99
+
100
+ foreach ($categories->getItems() as $category) {
101
+ /* Only supported products type, not already in the current & other list */
102
+ $productCollection = Mage::getResourceModel('catalog/product_collection')
103
+ ->addWebsiteFilter($this->_getListing()->getWebsiteId())
104
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
105
+ ->addFieldToFilter('type_id', array('in' => $supportedTypes))
106
+ //->addFieldToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE ))
107
+ ->joinField('in_other_list',
108
+ 'diglin_ricento/products_listing_item',
109
+ new Zend_Db_Expr('products_listing_id IS NOT NULL'),
110
+ 'product_id=entity_id',
111
+ 'products_listing_id !=' . (int)$this->_getListing()->getId(),
112
+ 'left'
113
+ )
114
+ ->addFieldToFilter('in_other_list', array('eq' => 0))
115
+ ->groupByAttribute('entity_id')
116
+ ->addCategoryFilter($category);
117
+
118
+ if (!empty($productsListingItemIds)) {
119
+ $productCollection->addFieldToFilter('entity_id', array('nin' => $productsListingItemIds));
120
+ }
121
+
122
+ $productIds = $productCollection->getAllIds();
123
+ $productsListingItemIds = array_merge($productsListingItemIds, $productIds);
124
+ foreach ($productIds as $productId) {
125
+ if ($this->_getListing()->addProduct((int)$productId)) {
126
+ ++$productsAdded;
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ $this->_getSession()->addSuccess($this->__('%d product(s) added to the listing', $productsAdded));
133
+ } catch (Exception $e) {
134
+ Mage::logException($e);
135
+ $this->_getSession()->addError($this->__('Error occurred while saving the product(s) from the selected categories. Please check your exception log.'));
136
+ }
137
+ $this->_redirect('*/products_listing/edit', array('id' => $this->_getListing()->getId()));
138
+ }
139
+
140
+ /**
141
+ * @return boolean
142
+ */
143
+ protected function _savingAllowed()
144
+ {
145
+ return $this->_getListing()->getStatus() !== Diglin_Ricento_Helper_Data::STATUS_LISTED;
146
+ }
147
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/Listing/ItemController.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_Products_Listing_ItemController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_Products_Listing_ItemController extends Diglin_Ricento_Controller_Adminhtml_Products_Listing
16
+ {
17
+ protected $_itemIds = array();
18
+
19
+ /**
20
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
21
+ */
22
+ protected function _initItems()
23
+ {
24
+ /* @var $itemCollection Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection */
25
+ $itemCollection = Mage::getModel('diglin_ricento/products_listing_item')->getCollection();
26
+
27
+ if ($this->getRequest()->isPost()) {
28
+ $this->_itemIds = array_map('intval', (array) $this->getRequest()->getPost('item', array()));
29
+ } else {
30
+ $this->_itemIds = array_map('intval', explode(',', $this->getRequest()->getParam('item')));
31
+ }
32
+
33
+ if ($this->_itemIds) {
34
+ $itemCollection->addFieldToFilter('products_listing_id', $this->_getListing()->getId())
35
+ ->addFieldToFilter('item_id', array('in' => $this->_itemIds));
36
+ } else {
37
+ $itemCollection->addFieldToFilter('item_id', array('in' => explode(',', $this->getRequest()->getPost('item_ids'))));
38
+ $this->_itemIds = $itemCollection->getColumnValues('item_id');
39
+ }
40
+
41
+ Mage::register('selected_items', $itemCollection->load());
42
+
43
+ return $itemCollection;
44
+ }
45
+
46
+ /**
47
+ * Returns items that are selected to be configured
48
+ *
49
+ * @return Diglin_Ricento_Model_Resource_Products_Listing_Item_Collection
50
+ */
51
+ public function getSelectedItems()
52
+ {
53
+ return Mage::registry('selected_items');
54
+ }
55
+
56
+ /**
57
+ * Configure individually or a group of products belonging to a products listing
58
+ */
59
+ public function configureAction()
60
+ {
61
+ if (!$this->_initListing()) {
62
+ $this->_getSession()->addError('Products Listing not found.');
63
+ $this->_redirectUrl($this->_getRefererUrl());
64
+ return;
65
+ }
66
+
67
+ if ($this->_initItems()->count() == 0) {
68
+ $this->_getSession()->addError($this->__('No products selected.'));
69
+ $this->_redirect('*/products_listing/edit', array('id' => $this->_getListing()->getId()));
70
+ return;
71
+ }
72
+
73
+ $this->loadLayout();
74
+ $this->renderLayout();
75
+ }
76
+
77
+ /**
78
+ * Save the configuration of sales options and rules
79
+ */
80
+ public function saveAction()
81
+ {
82
+ if ($data = $this->getRequest()->getPost()) {
83
+ if (!$this->_initListing()) {
84
+ $this->_getSession()->addError('Products Listing not found.');
85
+ $this->_redirectUrl($this->_getRefererUrl());
86
+ return;
87
+ }
88
+ $this->_initItems();
89
+ try {
90
+ if ($this->saveConfiguration($data)) {
91
+ foreach ($this->getSelectedItems() as $item) {
92
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
93
+ if (!isset($data['sales_options']['use_products_list_settings'])) {
94
+ $item->setSalesOptionsId($item->getSalesOptions()->getId());
95
+ } else {
96
+ $item->setSalesOptionsId(new Zend_Db_Expr('null'));
97
+ }
98
+ if (!isset($data['rules']['use_products_list_settings'])) {
99
+ $item->setRuleId($item->getShippingPaymentRule()->getId());
100
+ } else {
101
+ $item->setRuleId(new Zend_Db_Expr('null'));
102
+ }
103
+
104
+ if ($item->hasDataChanges()) {
105
+ $item->save();
106
+ }
107
+ }
108
+ $this->_getSession()->addSuccess($this->__('The configuration has been saved successfully.'));
109
+ }
110
+ } catch (Mage_Core_Exception $e) {
111
+ $this->_getSession()->addError($e->getMessage());
112
+ } catch (Exception $e) {
113
+ Mage::logException($e);
114
+ $this->_getSession()->addException($e, $this->__('An error occurred while saving the configuration. Please, check your log files for more details.'));
115
+ }
116
+ }
117
+ $this->_redirectUrl($this->_getEditUrl());
118
+
119
+ }
120
+
121
+ /**
122
+ * @return bool
123
+ */
124
+ protected function _savingAllowed()
125
+ {
126
+ foreach ($this->getSelectedItems() as $item) {
127
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
128
+ if ($item->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED) {
129
+ return false;
130
+ }
131
+ }
132
+ return true;
133
+ }
134
+
135
+ /**
136
+ * @return Varien_Data_Collection
137
+ */
138
+ protected function _getSalesOptions()
139
+ {
140
+ if (!$this->_salesOptionsCollection) {
141
+ $this->_salesOptionsCollection = new Varien_Data_Collection();
142
+ foreach ($this->getSelectedItems() as $item) {
143
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
144
+ $this->_salesOptionsCollection->addItem($item->getSalesOptions());
145
+ }
146
+ }
147
+ return $this->_salesOptionsCollection;
148
+ }
149
+
150
+ /**
151
+ * @return Varien_Data_Collection
152
+ */
153
+ protected function _getShippingPaymentRule()
154
+ {
155
+ if (!$this->_shippingPaymentCollection) {
156
+ $this->_shippingPaymentCollection = new Varien_Data_Collection();
157
+ foreach ($this->getSelectedItems() as $item) {
158
+ /* @var $item Diglin_Ricento_Model_Products_Listing_Item */
159
+ $this->_shippingPaymentCollection->addItem($item->getShippingPaymentRule());
160
+ }
161
+ }
162
+ return $this->_shippingPaymentCollection;
163
+ }
164
+
165
+ /**
166
+ * @return string
167
+ */
168
+ protected function _getEditUrl()
169
+ {
170
+ return $this->getUrl('*/*/configure', array('id' => $this->getRequest()->getParam('id'), 'item' => implode(',', $this->_itemIds)));
171
+ }
172
+
173
+ /**
174
+ * @return string
175
+ */
176
+ protected function _getIndexUrl()
177
+ {
178
+ return $this->getUrl('*/products_listing/edit', array('id' => $this->getRequest()->getParam('id')));
179
+ }
180
+
181
+ /**
182
+ * Show preview page of the product published on ricardo.ch
183
+ */
184
+ public function previewAction()
185
+ {
186
+ if (!$this->_initListing()) {
187
+ $this->_getSession()->addError('Products Listing not found.');
188
+ $this->_redirect('*/products_listing/index');
189
+ return;
190
+ }
191
+
192
+ if ($this->_initItems()->count() == 0) {
193
+ $this->_getSession()->addError($this->__('No products selected.'));
194
+ $this->_redirect('*/products_listing/edit', array('id' => $this->_getListing()->getId()));
195
+ return;
196
+ }
197
+
198
+ $this->_getSession()->addNotice($this->__('It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different.'));
199
+
200
+ $this->loadLayout();
201
+ $this->renderLayout();
202
+ }
203
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/Products/ListingController.php ADDED
@@ -0,0 +1,574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_Products_ListingController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_Products_ListingController extends Diglin_Ricento_Controller_Adminhtml_Products_Listing
16
+ {
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $_successMessage = '';
21
+
22
+ /**
23
+ * Show the products listing
24
+ */
25
+ public function indexAction()
26
+ {
27
+ $title = $this->__('Products Listing');
28
+
29
+ $this->loadLayout()
30
+ ->_setActiveMenu('ricento/products_listing')
31
+ ->_addBreadcrumb($title, $title);
32
+
33
+ $this->_title($this->__('Products Listing'));
34
+ $this->_addContent($this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing', 'products_listing'));
35
+ $this->renderLayout();
36
+ }
37
+
38
+ /**
39
+ * Used for Ajax call
40
+ */
41
+ public function productsGridAction()
42
+ {
43
+ $noRender = false;
44
+ if (!$this->_initListing()) {
45
+ $noRender = true;
46
+ }
47
+
48
+ $this->loadLayout();
49
+
50
+ if ($noRender) {
51
+ $content = json_encode(array('success' => false));
52
+ } else {
53
+ $content = $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_products')->toHtml();
54
+ }
55
+
56
+ $this->getResponse()->setBody($content);
57
+ }
58
+
59
+ public function addProductsPopupAction()
60
+ {
61
+ if (!$this->_initListing()) {
62
+ $this->_redirect($this->_getIndexUrl());
63
+ return;
64
+ }
65
+
66
+ $this->loadLayout();
67
+ $this->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * Used for ajax version of the action addProductsPopupAction
72
+ */
73
+ public function addProductsGridAction()
74
+ {
75
+ $noRender = false;
76
+ if (!$this->_initListing()) {
77
+ $noRender = true;
78
+ }
79
+
80
+ $this->loadLayout();
81
+
82
+ if ($noRender) {
83
+ $content = json_encode(array('success' => false));
84
+ } else {
85
+ $content = $this->getLayout()->createBlock('diglin_ricento/adminhtml_products_listing_edit_tabs_products_add')->toHtml();
86
+ }
87
+
88
+ $this->getResponse()->setBody($content);
89
+ }
90
+
91
+ /**
92
+ * Edit a product listing item
93
+ */
94
+ public function editAction()
95
+ {
96
+ $productsListing = $this->_initListing();
97
+ if (!$productsListing) {
98
+ $this->_getSession()->addError('Products Listing not found.');
99
+ $this->_redirectUrl($this->_getRefererUrl());
100
+ return;
101
+ }
102
+
103
+ try {
104
+ $this->_title($this->__('Edit List "%s"', $productsListing->getTitle()));
105
+
106
+ $this->loadLayout();
107
+ $this->renderLayout();
108
+ } catch (Diglin_Ricento_Exception $e) {
109
+ $this->_getSession()->addError($this->__('The action you try to do, is not possible. You must authorize the API token. Please, go the <a href="%s">ricardo.ch Authorization</a> page to do the authorization process', $e->getValidationUrl()));
110
+ $this->_redirectUrl($this->_getIndexUrl());
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Create empty product listing based on name and website_id
116
+ */
117
+ public function createAction()
118
+ {
119
+ $listingTitle = (string)$this->getRequest()->getPost('listing_title');
120
+ $websiteId = (int)$this->getRequest()->getPost('website_id');
121
+
122
+ if (empty($listingTitle) || empty($websiteId)) {
123
+ $this->_getSession()->addError($this->__('Listing name and website must be specified.'));
124
+ $this->_redirect('*/*/index');
125
+ return;
126
+ }
127
+
128
+ /* Detect Language settings */
129
+
130
+ $helper = Mage::helper('diglin_ricento');
131
+ $languages = $helper->getSupportedLang();
132
+ $baseLanguage = $languages[0]; // We set per default german language
133
+ $storeLanguages = array();
134
+ $websiteLocale = explode('_', $helper->getWebsiteConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $websiteId));
135
+ $websiteLang = strtolower($websiteLocale[0]);
136
+ if (in_array($websiteLang, $languages)) {
137
+ $baseLanguage = $websiteLang;
138
+ }
139
+
140
+ $storeIds = Mage::app()->getWebsite($websiteId)->getStoreIds();
141
+ foreach ($storeIds as $store) {
142
+ $locale = explode('_', Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $store));
143
+ $storeLang = strtolower($locale[0]);
144
+ if (in_array($storeLang, $languages) && $websiteLang != $storeLang) {
145
+ $storeLanguages[$storeLang] = $store;
146
+ }
147
+ }
148
+
149
+ $this->_getSession()->addNotice($this->__('We have detected and set for you the language configuration. Please, review it before to go further.'));
150
+
151
+ /* @var $salesOptions Diglin_Ricento_Model_Sales_Options */
152
+ $salesOptions = Mage::getModel('diglin_ricento/sales_options');
153
+ $salesOptions->setDataChanges(true)->save();
154
+
155
+ /* @var $rule Diglin_Ricento_Model_Rule */
156
+ $rule = Mage::getModel('diglin_ricento/rule');
157
+ $rule->setDataChanges(true)->save();
158
+
159
+ /* @var $listing Diglin_Ricento_Model_Products_Listing */
160
+ $listing = Mage::getModel('diglin_ricento/products_listing');
161
+ $listing->setTitle($listingTitle)
162
+ ->setWebsiteId($websiteId)
163
+ ->setSalesOptionsId($salesOptions->getId())
164
+ ->setRuleId($rule->getId())
165
+ ->setPublishLanguages((!empty($storeLanguages)) ? Diglin_Ricento_Helper_Data::LANG_ALL : $baseLanguage)
166
+ ->setDefaultLanguage($baseLanguage);
167
+
168
+ foreach ($storeLanguages as $storeLang => $storeId) {
169
+ call_user_func(array($listing, 'setLangStoreId' . ucwords($storeLang)), $storeId);
170
+ }
171
+
172
+ $listing->save();
173
+
174
+ $this->_redirect('*/*/edit', array('id' => $listing->getId()));
175
+ }
176
+
177
+ /**
178
+ * Save a product listing
179
+ */
180
+ public function saveAction()
181
+ {
182
+ $error = false;
183
+
184
+ if ($data = $this->getRequest()->getPost()) {
185
+ $listing = $this->_initListing();
186
+ if (!$listing) {
187
+ $this->_getSession()->addError('Products Listing not found.');
188
+ $this->_redirectUrl($this->_getIndexUrl());
189
+ return $this;
190
+ }
191
+ $listing->addData($data['product_listing']);
192
+ try {
193
+ $listing->save();
194
+ if ($this->saveConfiguration($data)) {
195
+ $this->_getSession()->addSuccess($this->__('The listing has been saved.'));
196
+ } else {
197
+ $error = true;
198
+ }
199
+ } catch (Mage_Core_Exception $e) {
200
+ $this->_getSession()->addError($e->getMessage());
201
+ $error = true;
202
+ } catch (Exception $e) {
203
+ Mage::logException($e);
204
+ $this->_getSession()->addException($e, $this->__('An error occurred while saving the listing.'));
205
+ $error = true;
206
+ }
207
+ }
208
+
209
+ $this->_redirectUrl($this->_getEditUrl());
210
+
211
+ // To block chaining, we return the error
212
+ if ($error) {
213
+ return !$error;
214
+ }
215
+
216
+ return true;
217
+ }
218
+
219
+ protected function _savingAllowed()
220
+ {
221
+ return $this->_getListing()->getStatus() !== Diglin_Ricento_Helper_Data::STATUS_LISTED;
222
+ }
223
+
224
+ protected function _getSalesOptions()
225
+ {
226
+ if (!$this->_salesOptionsCollection) {
227
+ $this->_salesOptionsCollection = new Varien_Data_Collection();
228
+ $this->_salesOptionsCollection->addItem($this->_getListing()->getSalesOptions());
229
+ }
230
+ return $this->_salesOptionsCollection;
231
+ }
232
+
233
+ protected function _getShippingPaymentRule()
234
+ {
235
+ if (!$this->_shippingPaymentCollection) {
236
+ $this->_shippingPaymentCollection = new Varien_Data_Collection();
237
+ $this->_shippingPaymentCollection->addItem($this->_getListing()->getShippingPaymentRule());
238
+ }
239
+ return $this->_shippingPaymentCollection;
240
+ }
241
+
242
+ protected function _getEditUrl()
243
+ {
244
+ return $this->getUrl('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
245
+ }
246
+
247
+ protected function _getIndexUrl()
248
+ {
249
+ return $this->getUrl('*/*/index');
250
+ }
251
+
252
+ /**
253
+ * Delete a product listing
254
+ */
255
+ public function deleteAction()
256
+ {
257
+ if (!$this->_initListing()) {
258
+ $this->_getSession()->addError('Products Listing not found.');
259
+ $this->_redirectUrl($this->_getRefererUrl());
260
+ return;
261
+ }
262
+
263
+ if ($this->_getListing()->getStatus() === Diglin_Ricento_Helper_Data::STATUS_LISTED) {
264
+ $this->_getSession()->addError($this->__('Listed listings cannot be deleted. Stop the listing first.'));
265
+ $this->_redirectUrl($this->_getRefererUrl());
266
+ return;
267
+ }
268
+
269
+ $this->_getListing()->delete();
270
+ $this->_getSession()->addSuccess($this->__('Listing deleted'));
271
+ $this->_redirect('*/*/index');
272
+ }
273
+
274
+ /**
275
+ * Add product(s) into a product listing item
276
+ */
277
+ public function addProductAction()
278
+ {
279
+ if (!$this->_initListing()) {
280
+ $this->_getSession()->addError('Products Listing not found.');
281
+ $this->_redirectUrl($this->_getRefererUrl());
282
+ return;
283
+ }
284
+ $productIds = (array)$this->getRequest()->getPost('product', array());
285
+ $productsAdded = 0;
286
+ foreach ($productIds as $productId) {
287
+ if ($this->_getListing()->addProduct((int)$productId)) {
288
+ ++$productsAdded;
289
+ }
290
+ }
291
+ $this->_getSession()->addSuccess($this->__('%d product(s) added to the listing', $productsAdded));
292
+ $this->_redirect('*/*/edit', array('id' => $this->_getListing()->getId()));
293
+ }
294
+
295
+ /**
296
+ * Remove product(s) from product listing
297
+ */
298
+ public function removeProductAction()
299
+ {
300
+ if (!$this->_initListing()) {
301
+ $this->_getSession()->addError('Products Listing not found.');
302
+ $this->_redirectUrl($this->_getRefererUrl());
303
+ return;
304
+ }
305
+
306
+ if ($this->getRequest()->isPost()) {
307
+ $productIds = array_map('intval', (array) $this->getRequest()->getPost('product', array()));
308
+ } else {
309
+ $productIds = array_map('intval', (array) $this->getRequest()->getParam('product', array()));
310
+ }
311
+
312
+ list($productsRemoved, $productsNotRemoved) = $this->_getListing()->removeProducts($productIds);
313
+
314
+ if ($productsRemoved) {
315
+ $this->_getSession()->addSuccess($this->__('%d products removed from listing', $productsRemoved));
316
+ }
317
+
318
+ if ($productsNotRemoved) {
319
+ $this->_getSession()->addNotice($this->__('%d products are listed and could not be removed', $productsNotRemoved));
320
+ }
321
+
322
+ $this->_redirect('*/*/edit', array('id' => $this->_getListing()->getId()));
323
+ }
324
+
325
+ /**
326
+ * @param string $jobType
327
+ * @param int $totalItems
328
+ */
329
+ protected function _startJobList($jobType, $totalItems)
330
+ {
331
+ $productListing = $this->_getListing();
332
+
333
+ if (!$this->isApiReady()) {
334
+ $this->_getSession()->addError($this->__('The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire.'));
335
+ $this->_redirectUrl($this->_getRefererUrl());
336
+ return;
337
+ }
338
+
339
+ try {
340
+ /**
341
+ * Cleanup old pending job before to create a new similar one
342
+ */
343
+ Mage::getResourceModel('diglin_ricento/sync_job')->cleanupPendingJob($jobType, $productListing->getId());
344
+
345
+ /**
346
+ * Do nothing if the same job is already running
347
+ */
348
+ $collection = Mage::getResourceModel('diglin_ricento/sync_job_collection');
349
+ $collection
350
+ ->getSelect()
351
+ ->join(array('jl' => $collection->getTable('diglin_ricento/sync_job_listing')),
352
+ 'jl.job_id = main_table.job_id', '*')
353
+ ->where('jl.products_listing_id = ?', $productListing->getId())
354
+ ->where('job_Type = ?', $jobType)
355
+ ->where('progress IN (?)', array(Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING, Diglin_Ricento_Model_Sync_Job::PROGRESS_RUNNING));
356
+
357
+ if ($collection->count() > 0) {
358
+ $this->_getSession()->addNotice($this->__('A similar job is already running. This job won\'t be executed.'));
359
+ $this->_redirect('*/products_listing/edit', array('id' => $productListing->getId()));
360
+ return;
361
+ }
362
+
363
+ // Create a job to prepare the sync to Ricardo.ch
364
+
365
+ $job = Mage::getModel('diglin_ricento/sync_job');
366
+ $job
367
+ ->setJobType($jobType)
368
+ ->setProgress(Diglin_Ricento_Model_Sync_Job::PROGRESS_PENDING)
369
+ ->setJobMessage( (is_array($job->getJobMessage())) ? $job->getJobMessage() : array($job->getJobMessage()))
370
+ ->save();
371
+
372
+ $jobListing = Mage::getModel('diglin_ricento/sync_job_listing');
373
+ $jobListing
374
+ ->setProductsListingId($productListing->getId())
375
+ ->setTotalCount($totalItems)
376
+ ->setTotalProceed(0)
377
+ ->setJobId($job->getId())
378
+ ->save();
379
+
380
+ $this->_getSession()->addSuccess($this->_successMessage);
381
+ $this->_redirect('*/log/sync', array('id' => $job->getId()));
382
+ return;
383
+ } catch (Diglin_Ricento_Exception $e) {
384
+ Mage::logException($e);
385
+ $this->_getSession()->addError($this->__('It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href="%s">ricardo.ch Authorization</a> page to do the authorization process', $e->getValidationUrl()));
386
+ } catch (Exception $e) {
387
+ Mage::logException($e);
388
+ $this->_getSession()->addError($this->__('An error occurred while starting this job. Please check your log file.'));
389
+ }
390
+
391
+ $this->_redirect('*/*/index');
392
+ }
393
+
394
+ /**
395
+ * @return string
396
+ */
397
+ protected function _getSuccessMesageList()
398
+ {
399
+ return $this->__('The job to check your products listing will start in few minutes. You can check the progression below.')
400
+ . '<br>'
401
+ . $this->__('If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues.');
402
+ }
403
+
404
+ /**
405
+ * Start to list the product listing on ricardo platform if not already listed
406
+ */
407
+ public function checkAndListAction()
408
+ {
409
+ $productListing = $this->_initListing();
410
+
411
+ if (!$productListing) {
412
+ $this->_getSession()->addError('Products Listing not found.');
413
+ $this->_redirectUrl($this->_getRefererUrl());
414
+ return;
415
+ }
416
+
417
+ if ($productListing->getStatus() != Diglin_Ricento_Helper_Data::STATUS_LISTED && !$this->saveAction()) {
418
+ $this->_redirect('*/*/edit', array('id' => $productListing->getId()));
419
+ return;
420
+ }
421
+
422
+ $countPendingItems = Mage::getResourceModel('diglin_ricento/products_listing_item')->countPendingItems($productListing->getId());
423
+
424
+ if ($countPendingItems == 0) {
425
+ $this->_getSession()->addError($this->__('There is no pending product to check.'));
426
+ $this->_redirect('*/*/edit', array('id' => $productListing->getId()));
427
+ return;
428
+ }
429
+
430
+ $this->_successMessage = $this->_getSuccessMesageList();
431
+ $this->_startJobList(Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST, $countPendingItems);
432
+ }
433
+
434
+ public function checkAjaxAction()
435
+ {
436
+ $return = true;
437
+ try {
438
+
439
+ Mage::getSingleton('diglin_ricento/dispatcher')
440
+ ->dispatch(Diglin_Ricento_Model_Sync_Job::TYPE_CHECK_LIST)
441
+ ->proceed();
442
+
443
+ } catch (Exception $e) {
444
+ Mage::logException($e);
445
+ $return = false;
446
+ }
447
+
448
+ $response = array(
449
+ 'status' => $return
450
+ );
451
+
452
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
453
+ }
454
+
455
+ /**
456
+ * Action used to list the products to ricardo.ch when the cron job which check the products listing finished with warnings
457
+ */
458
+ public function listAction()
459
+ {
460
+ $productListing = $this->_initListing();
461
+
462
+ if (!$productListing) {
463
+ $this->_getSession()->addError('Products Listing not found.');
464
+ $this->_redirectUrl($this->_getRefererUrl());
465
+ return;
466
+ }
467
+
468
+ $countReadyToList = Mage::getResourceModel('diglin_ricento/products_listing_item')->coundReadyTolist($productListing->getId());
469
+
470
+ if ($countReadyToList == 0) {
471
+ $this->_getSession()->addError($this->__('There is no product ready to be listed. Please, add products to your products listing "%s".', $productListing->getTitle()));
472
+ $this->_redirect('*/*/index');
473
+ return;
474
+ }
475
+
476
+ $this->_successMessage = $this->__('The job to list your products listing will start in few minutes.')
477
+ . '<br>'
478
+ . $this->__('You can check the progression below.');
479
+ $this->_startJobList(Diglin_Ricento_Model_Sync_Job::TYPE_LIST, $countReadyToList);
480
+ }
481
+
482
+ /**
483
+ * Start to list the product listing on ricardo platform if those was already listed and sold
484
+ *
485
+ * @deprecated since 18.09.2014
486
+ */
487
+ public function relistAction()
488
+ {
489
+ $productListing = $this->_initListing();
490
+
491
+ if (!$productListing) {
492
+ $this->_getSession()->addError('Products Listing not found.');
493
+ $this->_redirectUrl($this->_getRefererUrl());
494
+ return;
495
+ }
496
+
497
+ $countSoldItems = Mage::getResourceModel('diglin_ricento/products_listing_item')->countSoldItems($productListing->getId());
498
+
499
+ if ($countSoldItems == 0) {
500
+ $this->_getSession()->addError($this->__('There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d.', $productListing->getId()));
501
+ $this->_redirect('*/*/index');
502
+ return;
503
+ }
504
+ $this->_successMessage = $this->_getSuccessMesageList();
505
+ $this->_startJobList(Diglin_Ricento_Model_Sync_Job::TYPE_RELIST, $countSoldItems);
506
+ }
507
+
508
+ /**
509
+ * Stop to list all items belonging to a product list from ricardo platform
510
+ */
511
+ public function stopAction()
512
+ {
513
+ $listing = $this->_initListing();
514
+ if (!$listing) {
515
+ $this->_getSession()->addError('Products Listing not found.');
516
+ $this->_redirectUrl($this->_getRefererUrl());
517
+ return;
518
+ }
519
+
520
+ $countListedItem = Mage::getResourceModel('diglin_ricento/products_listing_item')->countListedItems($this->_getListing()->getId());
521
+
522
+ if ($countListedItem == 0 && $listing->getStatus() == Diglin_Ricento_Helper_Data::STATUS_LISTED) {
523
+ $listing
524
+ ->setStatus(Diglin_Ricento_Helper_Data::STATUS_STOPPED)
525
+ ->save();
526
+
527
+ $this->_getSession()->addSuccess($this->__('The product list has been stopped.'));
528
+ $this->_redirectUrl($this->_getRefererUrl());
529
+ return;
530
+ }
531
+
532
+ if ($countListedItem == 0) {
533
+ $this->_getSession()->addError($this->__('Only listed product items can be stopped.'));
534
+ $this->_redirectUrl($this->_getRefererUrl());
535
+ return;
536
+ }
537
+
538
+ $this->_successMessage = $this->__('The job to stop to list your products will start in few minutes.') . $this->__('You can check the progression below.');
539
+ $this->_startJobList(Diglin_Ricento_Model_Sync_Job::TYPE_STOP, $countListedItem);
540
+ }
541
+
542
+ /**
543
+ * Delete one or more product listing via mass action
544
+ * Maybe redirected to the method deleteAction with variable changes
545
+ */
546
+ public function massDeleteAction()
547
+ {
548
+ $productListings = $this->getRequest()->getParam('products_listing');
549
+
550
+ try {
551
+ if (is_array($productListings)) {
552
+ $productListingsCollection = Mage::getResourceModel('diglin_ricento/products_listing_collection');
553
+ $productListingsCollection
554
+ ->addFieldToFilter('entity_id', array('in' => $productListings))
555
+ ->addFieldToFilter('status', array('neq' => Diglin_Ricento_Helper_Data::STATUS_LISTED));
556
+
557
+ $goingToBeDeleted = $productListingsCollection->getAllIds();
558
+
559
+ $productListingsCollection->walk('delete');
560
+ $this->_getSession()->addSuccess($this->__('Products listing(s) is/are successfully deleted.'));
561
+
562
+ $notDeleted = array_diff($productListings, $goingToBeDeleted);
563
+ if ($notDeleted) {
564
+ $this->_getSession()->addNotice($this->__('The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode(',', $notDeleted)));
565
+ }
566
+ }
567
+ } catch (Exception $e) {
568
+ Mage::logException($e);
569
+ $this->_getSession()->addError($this->__('An error occurred while trying to delete the products listing(s). Please, check your exception log.'));
570
+ }
571
+
572
+ $this->_redirect('*/*/index');
573
+ }
574
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/SupportController.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Ricento_
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ */
10
+ class Diglin_Ricento_Adminhtml_SupportController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ public function indexAction()
13
+ {
14
+ $supportLabel = $this->__('Ricento Extension Support');
15
+
16
+ $block = $this->getLayout()->createBlock('core/template');
17
+
18
+ $block
19
+ ->setTemplate('ricento/support.phtml')
20
+ ->setTitle($supportLabel);
21
+ // ->setIframeUrl(Mage::helper('diglin_ricento')->getRicardoAssistantUrl());
22
+
23
+ $this->_title($supportLabel);
24
+
25
+ $this->loadLayout()
26
+ ->_setActiveMenu('ricento/support')
27
+ ->_addBreadcrumb($supportLabel, $supportLabel)
28
+ ->_addContent($block)
29
+ ->renderLayout();
30
+ }
31
+ }
app/code/community/Diglin/Ricento/controllers/Adminhtml/SyncController.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * Class Diglin_Ricento_Adminhtml_SyncController
14
+ */
15
+ class Diglin_Ricento_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action
16
+ {
17
+ protected function _isAllowed()
18
+ {
19
+ return Mage::getSingleton('admin/session')->isAllowed('ricento/log');
20
+ }
21
+
22
+ /**
23
+ * Ajax call to get the status of a running job
24
+ */
25
+ public function jobMessagePopupAction()
26
+ {
27
+ $jobId = (int)$this->getRequest()->getParam('jobid');
28
+
29
+ /* @var $job Diglin_Ricento_Model_Sync_Job */
30
+ $job = Mage::getModel('diglin_ricento/sync_job')->load($jobId);
31
+
32
+ $this->loadLayout();
33
+
34
+ $block = $this->getLayout()->getBlock('sync_ajax_popup');
35
+
36
+ if ($job->getId() && $block) {
37
+ $block->setMessages($job->getJobMessage());
38
+ $block->setProductsListingId($job->getProductsListingId());
39
+ }
40
+
41
+ $this->renderLayout();
42
+ }
43
+
44
+ /**
45
+ * Ajax call to get the status of a running job
46
+ */
47
+ public function progressAjaxAction()
48
+ {
49
+ $jobId = (int)$this->getRequest()->getParam('jobid');
50
+ $isAjax = (bool)($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false));
51
+ $percentDone = 0;
52
+ $response = array();
53
+
54
+ if (!$isAjax) {
55
+ $this->_getSession()->addError($this->__('Only Ajax call is allowed here.'));
56
+ $this->_redirect('*/*/index');
57
+ return;
58
+ }
59
+
60
+ /* @var $job Diglin_Ricento_Model_Sync_Job */
61
+ $job = Mage::getModel('diglin_ricento/sync_job')->load($jobId);
62
+
63
+ if ($job->getId()) {
64
+
65
+ $jobListing = Mage::getModel('diglin_ricento/sync_job_listing')->load($jobId, 'job_id');
66
+ $totalProceed = $jobListing->getTotalProceed();
67
+ $totalCount = $jobListing->getTotalCount();
68
+
69
+ if ($totalCount) {
70
+ $percentDone = ($totalProceed * 100) / $totalCount;
71
+ }
72
+
73
+ $locale = Mage::app()->getLocale();
74
+ $dateFormatIso = Mage::helper('diglin_ricento')->getDateTimeIsoFormat();
75
+
76
+ $jobMessage = $job->getJobMessage();
77
+
78
+ if (is_array($jobMessage)) {
79
+ $jobMessage = implode('<br>', $jobMessage);
80
+ }
81
+
82
+ switch ($job->getProgress()) {
83
+ case Diglin_Ricento_Model_Sync_Job::PROGRESS_CHUNK_RUNNING:
84
+ $stateMessage = $this->__('Chunk Running');
85
+ break;
86
+ case Diglin_Ricento_Model_Sync_Job::PROGRESS_RUNNING:
87
+ $stateMessage = $this->__('Running');
88
+ break;
89
+ default:
90
+ $stateMessage = '';
91
+ break;
92
+ }
93
+
94
+ $response = array(
95
+ 'percentage' => $percentDone,
96
+ 'job_type' => $job->getJobType(),
97
+ 'status' => ucfirst($job->getJobStatus()),
98
+ 'state' => $job->getProgress(),
99
+ 'state_message' => $stateMessage,
100
+ 'message' => Mage::getSingleton('diglin_ricento/filter')->filter($jobMessage),
101
+ 'started_at' => ($job->getStartedAt()) ? $locale->date($job->getStartedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($dateFormatIso) : '',
102
+ 'ended_at' => ($job->getEndedAt()) ? $locale->date($job->getEndedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($dateFormatIso) : '',
103
+ );
104
+ }
105
+
106
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
107
+ return;
108
+ }
109
+ }
app/code/community/Diglin/Ricento/data/ricento_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @var $installer Mage_Catalog_Model_Resource_Setup */
12
+ $installer = $this;
13
+
14
+ $installer->startSetup();
15
+
16
+ $productsListingTable = $installer->getTable('diglin_ricento/products_listing');
17
+ $storeTable = $installer->getTable('core/store');
18
+ $languages = array('fr','de'); //Mage::helper('diglin_ricento')->getSupportedLang(); // helper not working in this context!!!
19
+
20
+ foreach ($languages as $lang) {
21
+ if (empty($lang)) {
22
+ continue;
23
+ }
24
+ $columnName = 'lang_store_id_' . $lang ;
25
+ $installer->getConnection()->addColumn($productsListingTable, $columnName, array(
26
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
27
+ 'nullable' => true,
28
+ 'after' => 'default_language',
29
+ 'comment' => 'Store View ' . strtoupper($lang)));
30
+
31
+ $installer->getConnection()->addForeignKey(
32
+ $installer->getFkName($productsListingTable, $columnName, $storeTable, 'store_id'),
33
+ $productsListingTable, $columnName, $storeTable, 'store_id',
34
+ Varien_Db_Ddl_Table::ACTION_SET_NULL
35
+ );
36
+ }
37
+
38
+ $connection = $installer->getConnection();
39
+ $data = array(
40
+ array('ricardo_payment_canceled', 'ricardo.ch Payment Canceled'),
41
+ array('ricardo_payment_pending', 'Pending ricardo.ch Payment')
42
+ );
43
+ $connection = $installer->getConnection()->insertArray(
44
+ $installer->getTable('sales/order_status'),
45
+ array('status', 'label'),
46
+ $data
47
+ );
48
+
49
+ $relation = array(
50
+ array('canceled', 'ricardo_payment_canceled', 0),
51
+ array('pending', 'ricardo_payment_pending', 0),
52
+ );
53
+
54
+ $connection = $installer->getConnection()->insertArray(
55
+ $installer->getTable('sales/order_status_state'),
56
+ array('state', 'status', 'is_default'),
57
+ $relation
58
+ );
59
+
60
+ $installer->endSetup();
app/code/community/Diglin/Ricento/etc/adminhtml.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+ <config>
14
+ <menu>
15
+ <ricento translate="title" module="diglin_ricento">
16
+ <title>ricardo.ch</title>
17
+ <class>ricardo_logo</class>
18
+ <action>ricento/dashboard</action>
19
+ <sort_order>31</sort_order>
20
+ <children>
21
+ <dashboard translate="title" module="diglin_ricento">
22
+ <title>Dashboard</title>
23
+ <action>ricento/dashboard</action>
24
+ <sort_order>10</sort_order>
25
+ </dashboard>
26
+ <listing translate="title" module="diglin_ricento">
27
+ <title>Products Listing</title>
28
+ <action>ricento/products_listing</action>
29
+ <sort_order>20</sort_order>
30
+ </listing>
31
+ <log translate="title" module="diglin_ricento">
32
+ <title>Logs</title>
33
+ <action>ricento/log</action>
34
+ <sort_order>30</sort_order>
35
+ <children>
36
+ <listing>
37
+ <title>Listing</title>
38
+ <action>ricento/log/listing</action>
39
+ <sort_order>10</sort_order>
40
+ </listing>
41
+ <sync>
42
+ <title>Synchronization</title>
43
+ <action>ricento/log/sync</action>
44
+ <sort_order>20</sort_order>
45
+ </sync>
46
+ </children>
47
+ </log>
48
+ <assistant translate="title" module="diglin_ricento">
49
+ <title>ricardo.ch Assistant</title>
50
+ <action>ricento/account/assistant</action>
51
+ <sort_order>40</sort_order>
52
+ </assistant>
53
+ <config translate="title" module="diglin_ricento">
54
+ <title>Configuration</title>
55
+ <action>adminhtml/system_config/edit/section/ricento</action>
56
+ <sort_order>100</sort_order>
57
+ </config>
58
+ <support translate="title" module="diglin_ricento">
59
+ <title>Support</title>
60
+ <action>ricento/support</action>
61
+ <sort_order>200</sort_order>
62
+ </support>
63
+ </children>
64
+ </ricento>
65
+ </menu>
66
+ <acl>
67
+ <resources>
68
+ <all>
69
+ <title>Allow Everything</title>
70
+ </all>
71
+ <admin>
72
+ <children>
73
+ <system>
74
+ <children>
75
+ <config>
76
+ <children>
77
+ <ricento translate="title" module="diglin_ricento">
78
+ <title>Ricento by Diglin GmbH</title>
79
+ </ricento>
80
+ </children>
81
+ </config>
82
+ </children>
83
+ </system>
84
+ <ricento translate="title" module="diglin_ricento">
85
+ <title>Ricento by Diglin GmbH</title>
86
+ <children>
87
+ <dashboard translate="title" module="diglin_ricento">
88
+ <title>Dashboard</title>
89
+ </dashboard>
90
+ <listing translate="title" module="diglin_ricento">
91
+ <title>Products Listing</title>
92
+ </listing>
93
+ <log translate="title" module="diglin_ricento">
94
+ <title>Log</title>
95
+ </log>
96
+ <assistant translate="title" module="diglin_ricento">
97
+ <title>ricardo.ch Assistant</title>
98
+ </assistant>
99
+ <config translate="title" module="diglin_ricento">
100
+ <title>Configuration</title>
101
+ </config>
102
+ </children>
103
+ </ricento>
104
+ </children>
105
+ </admin>
106
+ </resources>
107
+ </acl>
108
+ </config>
app/code/community/Diglin/Ricento/etc/config.xml ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <Diglin_Ricento>
16
+ <version>1.0.13</version>
17
+ </Diglin_Ricento>
18
+ </modules>
19
+
20
+ <default>
21
+ <system>
22
+ <messages>
23
+ <notification_email_template>system_admin_notification_email_template</notification_email_template>
24
+ <pm_email_template>customer_private_message_email_template</pm_email_template>
25
+ </messages>
26
+ </system>
27
+
28
+ <ricento>
29
+ <global>
30
+ <merge_order>1</merge_order>
31
+ <decrease_inventory>0</decrease_inventory>
32
+ <shipping_calculation>cumulative</shipping_calculation>
33
+ <email_account_creation>0</email_account_creation>
34
+ <email_order_creation>0</email_order_creation>
35
+ </global>
36
+ <api_config>
37
+ <enabled>1</enabled>
38
+ <dev_mode>1</dev_mode>
39
+ <debug>0</debug>
40
+ <assistant_url>https://assistant.ricardo.ch</assistant_url>
41
+ <assistant_url_dev>https://ra.betaqxl.com/</assistant_url_dev>
42
+ <signup_url>http://www.ricardo.ch/interface/en-us/application.aspx</signup_url>
43
+ <simulate_authorization>0</simulate_authorization>
44
+ <email_notification>1</email_notification>
45
+ <!-- it's only possible one day before to renew the API token -->
46
+ <expiration_notification_delay>1</expiration_notification_delay>
47
+ <host>ws.ricardo.ch</host>
48
+ <host_dev>ws.betaqxl.com</host_dev>
49
+ <lang>de,fr</lang>
50
+ </api_config>
51
+ <cleanup_jobs>
52
+ <enabled>1</enabled>
53
+ <keep_days>30</keep_days>
54
+ </cleanup_jobs>
55
+ <rss>
56
+ <news_count>4</news_count>
57
+ <news_feed_de>http://www.ricardo.ch/verkauferportal/de-ch/news.aspx?view=rss</news_feed_de>
58
+ <news_feed_fr>http://www.fr.ricardo.ch/portail-vendeur/fr-ch/actualit%C3%A9s.aspx?view=rss</news_feed_fr>
59
+ </rss>
60
+ </ricento>
61
+
62
+ <payment>
63
+ <ricento translate="title" module="diglin_ricento">
64
+ <active>1</active>
65
+ <model>diglin_ricento/sales_method_payment</model>
66
+ <title>ricardo.ch Payment Methods</title>
67
+ <allowspecific>0</allowspecific>
68
+ <sort_order>999</sort_order>
69
+ </ricento>
70
+ </payment>
71
+
72
+ <carriers>
73
+ <ricento translate="title" module="diglin_ricento">
74
+ <active>1</active>
75
+ <model>diglin_ricento/sales_method_shipping</model>
76
+ <title>ricardo.ch Shipping</title>
77
+ <sort_order>999</sort_order>
78
+ <sallowspecific>0</sallowspecific>
79
+ <showmethod>0</showmethod>
80
+ </ricento>
81
+ </carriers>
82
+ </default>
83
+
84
+ <global>
85
+ <psr0_namespaces>
86
+ <!-- Required to load the Ricardo PHP library -->
87
+ <Diglin_Ricardo />
88
+ </psr0_namespaces>
89
+
90
+ <phpunit>
91
+ <suite>
92
+ <modules>
93
+ <Diglin_Ricento />
94
+ </modules>
95
+ </suite>
96
+ </phpunit>
97
+
98
+ <cache>
99
+ <types>
100
+ <ricardo_api translate="label,description" module="diglin_ricento">
101
+ <label>ricardo.ch API</label>
102
+ <description><![CDATA[Cache ricardo.ch API content (category, system info, payment & shipping info, etc) when called.]]></description>
103
+ <tags>RICARDO_API</tags>
104
+ </ricardo_api>
105
+ </types>
106
+ </cache>
107
+
108
+ <models>
109
+ <diglin_ricento>
110
+ <class>Diglin_Ricento_Model</class>
111
+ <resourceModel>diglin_ricento_resource</resourceModel>
112
+ </diglin_ricento>
113
+ <diglin_ricento_resource>
114
+ <class>Diglin_Ricento_Model_Resource</class>
115
+ <entities>
116
+ <products_listing>
117
+ <table>ricento_products_listing</table>
118
+ </products_listing>
119
+ <products_listing_item>
120
+ <table>ricento_products_listing_item</table>
121
+ </products_listing_item>
122
+ <sales_options>
123
+ <table>ricento_sales_options</table>
124
+ </sales_options>
125
+ <api_token>
126
+ <table>ricento_api_token</table>
127
+ </api_token>
128
+ <sync_job>
129
+ <table>ricento_sync_job</table>
130
+ </sync_job>
131
+ <sync_job_listing>
132
+ <table>ricento_sync_job_listing</table>
133
+ </sync_job_listing>
134
+ <listing_log>
135
+ <table>ricento_products_listing_log</table>
136
+ </listing_log>
137
+ <shipping_payment_rule>
138
+ <table>ricento_shipping_payment_rule</table>
139
+ </shipping_payment_rule>
140
+ <sales_transaction>
141
+ <table>ricento_sales_transaction</table>
142
+ </sales_transaction>
143
+ </entities>
144
+ </diglin_ricento_resource>
145
+ </models>
146
+
147
+ <blocks>
148
+ <diglin_ricento>
149
+ <class>Diglin_Ricento_Block</class>
150
+ </diglin_ricento>
151
+ </blocks>
152
+
153
+ <helpers>
154
+ <diglin_ricento>
155
+ <class>Diglin_Ricento_Helper</class>
156
+ </diglin_ricento>
157
+ </helpers>
158
+
159
+ <resources>
160
+ <ricento_setup>
161
+ <setup>
162
+ <module>Diglin_Ricento</module>
163
+ <class>Mage_Catalog_Model_Resource_Setup</class>
164
+ </setup>
165
+ <connection>
166
+ <use>core_setup</use>
167
+ </connection>
168
+ </ricento_setup>
169
+
170
+ <ricento_resource_read>
171
+ <connection>core_read</connection>
172
+ </ricento_resource_read>
173
+
174
+ <ricento_resource_write>
175
+ <connection>core_write</connection>
176
+ </ricento_resource_write>
177
+ </resources>
178
+
179
+ <events>
180
+ <resource_get_tablename>
181
+ <observers>
182
+ <diglin_ricento>
183
+ <type>singleton</type>
184
+ <class>diglin_ricento/observer</class>
185
+ <method>addAutoloader</method>
186
+ </diglin_ricento>
187
+ </observers>
188
+ </resource_get_tablename>
189
+
190
+ <add_spl_autoloader>
191
+ <observers>
192
+ <diglin_ricento>
193
+ <type>singleton</type>
194
+ <class>diglin_ricento/observer</class>
195
+ <method>addAutoloader</method>
196
+ </diglin_ricento>
197
+ </observers>
198
+ </add_spl_autoloader>
199
+
200
+ <!--<sales_order_item_save_commit_after>-->
201
+ <!--<observers>-->
202
+ <!--<ricento_qty_decrease>-->
203
+ <!--<type>singleton</type>-->
204
+ <!--<class>diglin_ricento/observer</class>-->
205
+ <!--<method>decreaseInventory</method>-->
206
+ <!--</ricento_qty_decrease>-->
207
+ <!--</observers>-->
208
+ <!--</sales_order_item_save_commit_after>-->
209
+
210
+ <payment_info_block_prepare_specific_information>
211
+ <observers>
212
+ <ricento_payment_info>
213
+ <class>diglin_ricento/observer</class>
214
+ <method>paymentMethodsInformation</method>
215
+ </ricento_payment_info>
216
+ </observers>
217
+ </payment_info_block_prepare_specific_information>
218
+
219
+ <sales_quote_item_set_product>
220
+ <observers>
221
+ <ricento_quote_item>
222
+ <class>diglin_ricento/observer</class>
223
+ <method>setSkipppedRequiredOption</method>
224
+ </ricento_quote_item>
225
+ </observers>
226
+ </sales_quote_item_set_product>
227
+ </events>
228
+
229
+ <ricento>
230
+ <allow_product_types>
231
+ <simple />
232
+ <configurable />
233
+ <grouped />
234
+ </allow_product_types>
235
+
236
+ <dispatcher>
237
+ <types>
238
+ <check_list>
239
+ <class>Diglin_Ricento_Model_Dispatcher_Check_List</class>
240
+ </check_list>
241
+ <sync_list>
242
+ <class>Diglin_Ricento_Model_Dispatcher_Sync_List</class>
243
+ </sync_list>
244
+ <list>
245
+ <class>Diglin_Ricento_Model_Dispatcher_List</class>
246
+ </list>
247
+ <order>
248
+ <class>Diglin_Ricento_Model_Dispatcher_Order</class>
249
+ </order>
250
+ <relist>
251
+ <class>Diglin_Ricento_Model_Dispatcher_Relist</class>
252
+ </relist>
253
+ <stop>
254
+ <class>Diglin_Ricento_Model_Dispatcher_Stop</class>
255
+ </stop>
256
+ </types>
257
+ </dispatcher>
258
+ </ricento>
259
+
260
+ <template>
261
+ <email>
262
+ <system_admin_notification_email_template translate="label" module="diglin_ricento">
263
+ <label>Admin Email Notification</label>
264
+ <file>ricento/admin_message.html</file>
265
+ <type>text</type>
266
+ </system_admin_notification_email_template>
267
+ <customer_private_message_email_template translate="label" module="diglin_ricento">
268
+ <label>Private message</label>
269
+ <file>ricento/private_message.html</file>
270
+ <type>html</type>
271
+ </customer_private_message_email_template>
272
+ </email>
273
+ </template>
274
+
275
+ <fieldsets>
276
+ <sales_convert_quote>
277
+ <is_ricardo>
278
+ <to_order>*</to_order>
279
+ </is_ricardo>
280
+ <customer_ricardo_username>
281
+ <to_order>*</to_order>
282
+ </customer_ricardo_username>
283
+ <customer_ricardo_id>
284
+ <to_order>*</to_order>
285
+ </customer_ricardo_id>
286
+ </sales_convert_quote>
287
+ </fieldsets>
288
+ </global>
289
+
290
+ <adminhtml>
291
+ <layout>
292
+ <updates>
293
+ <diglin_ricento>
294
+ <file>ricento.xml</file>
295
+ </diglin_ricento>
296
+ </updates>
297
+ <jstranslate>
298
+ <file>jstranslator.xml</file>
299
+ </jstranslate>
300
+ </layout>
301
+ <translate>
302
+ <modules>
303
+ <diglin_ricento>
304
+ <files>
305
+ <default>Diglin_Ricento.csv</default>
306
+ </files>
307
+ </diglin_ricento>
308
+ </modules>
309
+ </translate>
310
+
311
+ <events>
312
+ <adminhtml_block_html_before>
313
+ <observers>
314
+ <ricardo_customer_fields>
315
+ <class>Diglin_Ricento_Model_Observer</class>
316
+ <method>disableFormField</method>
317
+ </ricardo_customer_fields>
318
+ </observers>
319
+ </adminhtml_block_html_before>
320
+ </events>
321
+ </adminhtml>
322
+
323
+ <admin>
324
+ <routers>
325
+ <ricento>
326
+ <use>admin</use>
327
+ <args>
328
+ <module>Diglin_Ricento</module>
329
+ <frontName>ricento</frontName>
330
+ <modules>
331
+ <diglin_ricento before="Mage_Adminhtml">Diglin_Ricento_Adminhtml</diglin_ricento>
332
+ </modules>
333
+ </args>
334
+ </ricento>
335
+ </routers>
336
+ </admin>
337
+
338
+ <frontend>
339
+ <translate>
340
+ <modules>
341
+ <diglin_ricento>
342
+ <files>
343
+ <default>Diglin_Ricento.csv</default>
344
+ </files>
345
+ </diglin_ricento>
346
+ </modules>
347
+ </translate>
348
+ </frontend>
349
+
350
+ <crontab>
351
+ <jobs>
352
+ <ricento_sync_jobs>
353
+ <schedule>
354
+ <cron_expr>*/5 * * * *</cron_expr>
355
+ </schedule>
356
+ <run>
357
+ <model>diglin_ricento/cron::process</model>
358
+ </run>
359
+ </ricento_sync_jobs>
360
+ <ricento_async_jobs>
361
+ <schedule>
362
+ <cron_expr>*/10 * * * *</cron_expr>
363
+ </schedule>
364
+ <run>
365
+ <model>diglin_ricento/cron::async</model>
366
+ </run>
367
+ </ricento_async_jobs>
368
+ </jobs>
369
+ </crontab>
370
+
371
+ <uninstall>
372
+ <filename>uninstall.txt</filename>
373
+ </uninstall>
374
+ </config>
app/code/community/Diglin/Ricento/etc/jstranslator.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+
14
+ <jstranslator>
15
+ <diglin_ricento translate="add_product,create_product_listing" module="diglin_ricento">
16
+ <add_product>Add Product</add_product>
17
+ <create_product_listing>Create Products Listing</create_product_listing>
18
+ <add_product_from_selected_categories>Add Products from selected categories</add_product_from_selected_categories>
19
+ </diglin_ricento>
20
+ </jstranslator>
app/code/community/Diglin/Ricento/etc/system.xml ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Diglin GmbH - Switzerland
5
+ *
6
+ * @author Sylvain Rayé <support at diglin.com>
7
+ * @category Diglin
8
+ * @package Diglin_Ricento
9
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+ <config>
14
+ <tabs>
15
+ <diglin>
16
+ <label><![CDATA[<div><img alt="Diglin" title="Diglin" width="66" height="23" style="display:block;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAAAZCAYAAABnweOlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACDBJREFUeNrsWQtwFdUZPvu4e595cXPJ+8kjvITEhAChAVos0Y6WttY6lhFRoQzCjEOaWrE+oJ0MFsSOYn3VFpQO1pak0taORdEKTTK2QcgUkaRVA6QhJLm5r929+97+Z+/e2+Wam7YkYZzaM/nvf86ec/7/P9/5z3/+3SD0//KJQsQr9731pF3T1MdEjr2DDQQRGwqe48LBxt8/1PLGZw0UMl5hXMxrGlI2SGI0TZL5NEkR5oqqdKhqY93qzyQo9/xqx9e4UGhFZNhvD4+MoEgwhCLhEBEJR9IFQv3RE3/49tSJUOaqrp0Tp08zKLThJWnMPHZkhIIjg7hwCLGRCIpwLIqwUcQLUllOkXfV7sP3XvzO6ieOjuusOhyvW5rF45HlrKr+MrCbzOZvoydP/GZCPSU0OKxFggHEGoCEAQwWhVkecVERiTx5VFXUtSUVufubX9lUPy5tul6UoPEa7vbMB7rdpPkTfnxUJB4xPCQcBjAwIBzieRkJEertpg3LKJLQ62VZLpxZVbL/4RfXL/lU+Lim2YDsJtkm/Pi83tx6snJd7TPhCLspwvOIj8ooGqaP37dxsV5RNmWhKGkODS4qRZTKK5fO2Hf/c2u//ujGl06PJdgxZx5mnweaBZQP1D/KmGxgS83mWeHM6W5LXx6wL5jzI0B/AXobxiT8zuqDSXLjl8MwjG+zPPcAW2ixCcvFOg9b5MZAGezul0/sa9/uu36aM8LJ68QQ3dG0vlqsnJ1dCzHFA66CSJ1AKkEiWRAqljTM3QbT1qQCxF4xO4P2+nZBdRlQDlAWEKeryuU74vVNA/a42XzSNBDPvxP67oZqCRAO8jzQANB70LdZ7P4gOOZOe31xme8CtcGcKcB3wPO5wPNMmRnYJgwc0CYY812Q25UABRd/z+Cgvz9wf/ENNX2b75hdu/TaqbVcVEq3EQTCXoKJgA3R4Vfi+JvHAsWWk/sDXVG+ZQRXxo538ZhhjKrMuCzEqIobWLnZ9BmAzJhZCfObYX6eOR/pkshANRPvMPSdB+O3jRm6VCUuc8C0ZzqwLSATxWXiUIqBAdnp2AYY40Waulz8Ww9PW4Xds/lzlwprptlWLM5ZyPJSJgWAkEC64SUxbgJkT2UQUz69BJRvMJt94tn37zU9IAP62pIjg6VuWGzLK2zSFdkEhGmB+a32WXPydUl60FiEomwCvu0/DA+SAZKieCzPekDmDuDY23LAJmzrEhhTA7pXAygvJ0C5q3E5un3rsiZVlLdEOMlNEDHPMLwDg2OsAACBI6TpRFdKUIqKb9Bl2WE2D8oDF1stgP37C0qR4/FgQOzpboT55xFJIaa07FZ4VmO6/X8dli31cyDzoMUmEYNi6q4G9nIio127dcXdw4N8c4iV3ZqGgzu+QWMxLA4OSWiIJlTJ53N8P+WiZNmaf7x1BQuI7+rf5f6+87gCPO7uE1GSb6qPLfXCREy5/tbq0v6+yG4bTTA0TSCKQogCuEggcBIAI/aWBH9yptf5ved3HW0dQ6lqqQfHYbyQ1KYm6XK3J4NieMq6poYbOU7J4nkNRaMaEgUgSUOSrCMcmxRNR04HFfS46EcOPNX22Au7/jiWEi5ZyRWW5GOip3pvG6XvSouc8JSPPgyUMDYC2e0asjNwfhkC2aBNA9koAnk8dPDNd4aOK5q6c+/2sV+aCZo+GY/yUG6hfTktytAlBNxtGcaOIWLIvImmwxycw5yypg+WEp0EUP6liBXQRzorI6eTRE4DGBIxdtLgHg8VPt7h79zzbLddQMJWR2HWU0JfQE4J9aWBDtqbHTBzkxsdc6/ZIvxVvQj8Wrj+YsBR9J9SgkrRT8OV+gieD3NeAv4LY9WSWJw07pQl71kEOnGacEzxDw9NSJrf1fHh4XBU7/aPyMgfkFAgKKNQWIbMVmU7TwU7dz/TY3ema6ty8tHj2ddVrHfkp9GpBEIOESYoag9QGJpuWMxexzWVh4A/EFsM5Vf8Qz8d5QgYMqHvxzDmTaAo5DXleJ45t8SqB8Z1wJgLZvNLWAdQTYp4QaaIIaP2GYa89tyR/i+ub7gztzzn50yUKHc7VOSSKKH3At+5/5e9hDtDrWfcMiIZFRGy8nTeTbOEgVc/OBC9xCqjAaMEAs1YGZWZiXdvClx1NERt7O4B6DsAKfWhmDkkTrPPmNMuGtH1zOkhSMe/CtWHgBZTmVlZZkY70/Q+ZI4LOuYtaAQdDyZ0xLJTLDcus3sUPd2XQ/LJPsLav2zdqvqMfO9BJ0MWIlU/8rs3/kE605XrGBcAYlcQScPVTGogh0De3Kw1va+832lz2M8NnL0gjvp6v6AKp9d1QDhrxLvaHu06qVr6cT6TG7+poM+4rQgbgxcfML7BLFyE31MG8ecBUxbi2o8TKXS0ggwBnpXGsYP2QJIe41kKG4w+Inkh1WtWrXR50/d2vef/tc0pP4A9hGAAFBvkKSQGBfLtNA8qKipE06vmtfDDXOPz39x5fiIDnWf5yn34nSWW90g4Ky0D2h4LJkQv13as7Kp8o7WWkptX1kUF+WHSJjZgQKgEIDpKd7tRUWEByi8t7VEErWH/XXt6J9ood1396LcJQXC6IDTxJ/787FX5Rmst51qOtiOV2w0xJGIFJM3lRAX5eSinsOhjXSEmBRCzjJgZLGfGE1wfhvefRycbkJSeEi8F35h/C2knXyQInfJA9laQn6vkFZcO2R2ulT+5bWfPZBnlWlSH8xQcFyrNJO4dnK/w77bLV/VfHKlK8doF9YyN/kpB7tSqqbl5r2Zk+372wm0/ZP+Xv+b/U4ABAG0UhdPj3XnQAAAAAElFTkSuQmCC"></div>]]></label>
17
+ <sort_order>400</sort_order>
18
+ </diglin>
19
+ </tabs>
20
+
21
+ <sections>
22
+ <ricento module="diglin_ricento" translate="label">
23
+ <label><![CDATA[<img width="16" height="16" style="vertical-align:middle" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QkY5RTRGREZEMTI3MTFFM0ExQkNBQjM2QkYxRTNDMjMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QkY5RTRGRTBEMTI3MTFFM0ExQkNBQjM2QkYxRTNDMjMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpCRjlFNEZEREQxMjcxMUUzQTFCQ0FCMzZCRjFFM0MyMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpCRjlFNEZERUQxMjcxMUUzQTFCQ0FCMzZCRjFFM0MyMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PvtFcEUAAAc/SURBVHjapFZ5bBxXGf9m3hx7bxzfVxLXUZw0wUmaxKGYy1ElRKoEREkr6EEBtSAQCP5BqlSBiBCNlFYElUgtUHoQqhYlCqJIrWhQCVGdtmnjtolLiuM4PmJnba/X9p5zPn5vduxuvN42akf62bMz897vfd/3+w4p/7s2WubaAhwH1gAF+viXBMiABfQDvweeBBylwgITGPYXGB+TlAOu/z/oG3MY+ALwLamCxQwI+ScuHl3ieMi9B0zGfsz294VBDiPHZR6DzaXSZaXXWuBRYDvwQCXia7wVUGA0yCxb87ZMGFF6O9VEk4UoNQTmaXPVONXpWe8givjWUSnv6PjWXep2YfWrwKjyYZQeoVqgqXQdPTnURScS68hyZco6GiUKMSqAIMgsqgd5EB4IKSbtaXqP7lp1hqLhFMzXybADxPmi6wf9WN8kLA76PjP9lyTDrZqao6vZavrz8HY6PtZJl7I1ZMKdTCpaMZs299l56zY9rD0RC2sve8HEah0H6Igm6CtN52lPcz+1R6aoYOkL3o8ALwBfFMSncfM/4AdAVsIHOiw9MrSDHhv8DA3AWpsrWOfQfDq3z8pZ28JxvfC1nvbdN2+q33rizOh//n7q8r/tvB3SQmpvLBp+wUWcZdiwKT5Oj247RhurxqhgBgW3IP6HEJhw9U5AF4YKc3XZpPFsFT0+2E1nU80UgAWSayiqIt117+6OB1rqo83/fGPU/XRnQ+jbt25g07OFz41ezWz/+q617PxQ8ssv9g4rMsnHDa5T32wzPYUQPVx92ROmWyK6hRyzP1CvSxmIKGUFSIOgBLHtOGF44vav9rSv++k3toQ726ujkD0LaIxkWVK3dNTEfrjvU+E93W2bTcvdw7lLEdVAyIhenFhP7063kapdWw7kchFzL8aK5C6qErETnolGQypEo5IgdJyiYhyXU1BXKBxUKRbRKG9YPclE+jdTqfx9MsIzacYgzJ3Ytuj+hUtZwoknFp2aaofFodJsFG8cQVL8wRffCU1wX7Y5w6INbdWrb+tp//F0Kj9+9JVLLGvyP52cajcnsiupIThHBjKhzGINpOl8jJ4b3UppKFFnsFryKNzSqpDOmiApRieTs2g+Y3n3tu1SR2tc+tndN8n33Lq+hUn0Xdt2giLt5hA6SapgsYy4HLvcRefmm8iFFXOZwiZYZzBZTuIApm8Y3dASp6aakHe/uiFKSCfvPm84HkQooiFNuEmomIkUXEjDMmJVtmkaan5maDvlLJmCCt+2pnXFfhC77w/PPW1Zjua6xcXf/NI6CmrFpXs/3wbxFZ+HoYHGuvBiCAC2ECe+pIwuEjOod2CmngZRKAzDbm2pCvz8F/ft2L0iotMvnziz6q0LicZsoejeNY2xxQ1a6iKL9zdvbKD25rgQA12eSMNpfBSesmzOyOW0PLE4Uw7NyuGyWBhXFHnb1o5ajwSi6nzo6bc+sh011YY9XBhO0aHn+oZzpntQU1muGaKqC2S8vcvSibsK3RCeoWo9RwFdHZlI5n/18JGzwyOJDN3S1Ur7799JnWurr6sfXk3m6F9nxhKmxV9SmOR0RCZpJcitki68SCwetsUStBc1Nqrz+YzhPvaHv713YP8f35hOzOSoe3PjNS7+sAtipJWxgAw3B11XKqpZdpcvIF45g/L2Np1DtTIoFNCFHJ89+srFkffhuuu9xiYz9NcTAwmE6xnGZAsGU62GlokCIlWqXNxWqSU0RzE0iWJFUoV6j710emQGlei6iM9emKLDR9/tt11+WFGYHUNbvaUePcgtrVtLiG302cZQij5bcwkvkHuqOp837F//9vl3Djzyl77UR5EnENvecxOTsZD2siyh8IJJiGpT/Co0pFau1bZwhuzQd9pep6ZgGnGXvBqsKvLBQ8+/c/DgkbPJmbnKs9/Jviv0yLN9pyCoA4wpXIabb0RvXoHpxHZYZWIJzrCNMG2tHaKu6mES+Ze3GUUCCimy9NDjx/t7T749XpFYYTLpqhL0moe/46rQrDfFWB9EWC0rmZ668YECN/fUDlLvVBtdKcSpINwkOWoowK4gvwdKGsc15xZ1ncnSiI18dZElmmwVRYv4SgsaJroI1Cjlox0nC1bfueZNakTuiVnrNPrpGFdsm6sPShI74BtURuxKTLIcllMkGZ0oTd3Vl6inboC4oy0QC5H8REywij8I6KXdx/FGVqJdzedpV+N/6WRiPR3q38EHCquTipFMUi5Qziq6m5n0CLtqxulHG05Td91F73g5tFhf0+KPyM2UmLlew81moBvoK7VEFHYFAlH1POp3gMbzVRSLRSkeEYNAqY/JmzZmszbNz81Ta3iWVHQ6ywx5c/ZyU7Ygvt8ftN8EvgeMLHWj+KGiuChiDDJtqJ0vu5mKBswwjdioB8XB3ltaKB2tSomFsp8C7vBjd8GPhUSf7BLhmwEeBF4vywBfaff6L78PbPTTjH9CYpE2E8DK5V7+X4ABANuaCb3j3gT7AAAAAElFTkSuQmCC"/> ricardo.ch]]></label>
24
+ <tab>diglin</tab>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>110</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <groups>
31
+ <hint>
32
+ <frontend_model>diglin_ricento/adminhtml_config_source_hint</frontend_model>
33
+ <sort_order>0</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </hint>
38
+
39
+ <global module="diglin_ricento" translate="label comment">
40
+ <label>Global Configuration</label>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <fields>
46
+ <merge_order module="diglin_ricento" translate="label comment">
47
+ <label>Merge Order</label>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <comment><![CDATA[If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?]]></comment>
51
+ <sort_order>10</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>0</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </merge_order>
56
+ <!-- @todo Implementation to finish when ricardo.ch API is implemented -->
57
+ <!--<decrease_inventory module="diglin_ricento" translate="label comment">-->
58
+ <!--<label>Decrease Inventory</label>-->
59
+ <!--<frontend_type>select</frontend_type>-->
60
+ <!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
61
+ <!--<comment><![CDATA[If an order is passed on your shop but the product is also listed on ricardo.ch, do you want to decrease the stock on ricardo.ch side? Be aware, it's not possible to increase the quantity if the order is canceled. It's also not possible to decrease if a bid has been done.]]></comment>-->
62
+ <!--<sort_order>20</sort_order>-->
63
+ <!--<show_in_default>1</show_in_default>-->
64
+ <!--<show_in_website>0</show_in_website>-->
65
+ <!--<show_in_store>0</show_in_store>-->
66
+ <!--</decrease_inventory>-->
67
+ <shipping_calculation module="diglin_ricento" translate="label comment">
68
+ <label>Shipping Calculation</label>
69
+ <sort_order>30</sort_order>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>diglin_ricento/config_source_rules_shipping_calculation</source_model>
72
+ <comment><![CDATA[You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>
73
+ "Highest Price": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>
74
+ "Cumulative": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.
75
+ ]]></comment>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>0</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </shipping_calculation>
80
+ <!-- not allowed at the moment -->
81
+ <!--<email_account_creation module="diglin_ricento" translate="label comment">-->
82
+ <!--<label>Send Account Creation Confirmation Email</label>-->
83
+ <!--<frontend_type>select</frontend_type>-->
84
+ <!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
85
+ <!--<comment><![CDATA[Do you want to send a confirmation email to a customer when his account is imported from ricardo?]]></comment>-->
86
+ <!--<sort_order>40</sort_order>-->
87
+ <!--<show_in_default>1</show_in_default>-->
88
+ <!--<show_in_website>1</show_in_website>-->
89
+ <!--<show_in_store>1</show_in_store>-->
90
+ <!--</email_account_creation>-->
91
+ <email_order_creation module="diglin_ricento" translate="label comment">
92
+ <label>Send Email for new order</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>adminhtml/system_config_source_yesno</source_model>
95
+ <comment><![CDATA[Do you want to send the newly order created by email to a customer when the order is imported from ricardo?]]></comment>
96
+ <sort_order>50</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </email_order_creation>
101
+ </fields>
102
+ </global>
103
+
104
+ <api_config module="diglin_ricento" translate="label">
105
+ <label>API Token Configuration</label>
106
+ <sort_order>20</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
+ <fields>
111
+ <general_api_config module="diglin_ricento" translate="label">
112
+ <label>General API Config</label>
113
+ <frontend_model>diglin_ricento/adminhtml_config_source_heading</frontend_model>
114
+ <comment><![CDATA[Enable the ricardo extension for this website]]></comment>
115
+ <sort_order>10</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>0</show_in_website>
118
+ <show_in_store>0</show_in_store>
119
+ </general_api_config>
120
+ <enabled module="diglin_ricento" translate="label comment">
121
+ <label>ricardo.ch Extension enabled</label>
122
+ <frontend_type>select</frontend_type>
123
+ <source_model>adminhtml/system_config_source_yesno</source_model>
124
+ <sort_order>11</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>0</show_in_website>
127
+ <show_in_store>0</show_in_store>
128
+ </enabled>
129
+ <dev_mode module="diglin_ricento" translate="label comment">
130
+ <label>Development Mode</label>
131
+ <frontend_type>select</frontend_type>
132
+ <source_model>adminhtml/system_config_source_yesno</source_model>
133
+ <comment><![CDATA[If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below.]]></comment>
134
+ <sort_order>12</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>0</show_in_website>
137
+ <show_in_store>0</show_in_store>
138
+ </dev_mode>
139
+ <debug module="diglin_ricento" translate="label comment">
140
+ <label>Debug</label>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <comment><![CDATA[Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast.]]></comment>
144
+ <sort_order>13</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>0</show_in_website>
147
+ <show_in_store>0</show_in_store>
148
+ </debug>
149
+ <!--<simulate_authorization module="diglin_ricento" translate="label comment">-->
150
+ <!--<label>Automatize API Authorization</label>-->
151
+ <!--<frontend_type>select</frontend_type>-->
152
+ <!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
153
+ <!--<comment><![CDATA[After a certain period of time, your API token credentials are not anymore valid and you have to authorize to create a new one. This option allows you to do the process completely automatically without any action of you. However, by enabling this feature, you agree that your ricardo user credentials are stored securely into your own shop database.]]></comment>-->
154
+ <!--<sort_order>1</sort_order>-->
155
+ <!--<show_in_default>1</show_in_default>-->
156
+ <!--<show_in_website>1</show_in_website>-->
157
+ <!--<show_in_store>0</show_in_store>-->
158
+ <!--</simulate_authorization>-->
159
+ <!--<ricardo_account module="diglin_ricento" translate="label">-->
160
+ <!--<label>ricardo.ch Account</label>-->
161
+ <!--<sort_order>3</sort_order>-->
162
+ <!--<frontend_model>diglin_ricento/adminhtml_config_source_heading</frontend_model>-->
163
+ <!--<show_in_default>1</show_in_default>-->
164
+ <!--<show_in_website>1</show_in_website>-->
165
+ <!--<show_in_store>0</show_in_store>-->
166
+ <!--<depends>-->
167
+ <!--<simulate_authorization>1</simulate_authorization>-->
168
+ <!--</depends>-->
169
+ <!--</ricardo_account>-->
170
+ <!--<ricardo_username module="diglin_ricento" translate="label comment">-->
171
+ <!--<label>ricardo.ch Username</label>-->
172
+ <!--<sort_order>5</sort_order>-->
173
+ <!--<frontend_type>text</frontend_type>-->
174
+ <!--<show_in_default>1</show_in_default>-->
175
+ <!--<show_in_website>1</show_in_website>-->
176
+ <!--<show_in_store>0</show_in_store>-->
177
+ <!--<frontend_class>required-entry</frontend_class>-->
178
+ <!--<comment><![CDATA[Your ricardo.ch username. Create an account on <a href="http://www.ricardo.ch">http://www.ricardo.ch</a> if you don't have one.]]></comment>-->
179
+ <!--<depends>-->
180
+ <!--<simulate_authorization>1</simulate_authorization>-->
181
+ <!--</depends>-->
182
+ <!--</ricardo_username>-->
183
+ <!--<ricardo_password module="diglin_ricento" translate="label comment">-->
184
+ <!--<label>ricardo.ch Password</label>-->
185
+ <!--<sort_order>15</sort_order>-->
186
+ <!--<frontend_type>obscure</frontend_type>-->
187
+ <!--<backend_model>adminhtml/system_config_backend_encrypted</backend_model>-->
188
+ <!--<show_in_default>1</show_in_default>-->
189
+ <!--<show_in_website>1</show_in_website>-->
190
+ <!--<show_in_store>0</show_in_store>-->
191
+ <!--<frontend_class>required-entry</frontend_class>-->
192
+ <!--<comment><![CDATA[Your ricardo.ch password. Create an account on <a href="http://www.ricardo.ch">http://www.ricardo.ch</a> if you don't have one.]]></comment>-->
193
+ <!--<depends>-->
194
+ <!--<simulate_authorization>1</simulate_authorization>-->
195
+ <!--</depends>-->
196
+ <!--</ricardo_password>-->
197
+
198
+ <api_de module="diglin_ricento" translate="label comment">
199
+ <label>German API Token</label>
200
+ <sort_order>20</sort_order>
201
+ <frontend_model>diglin_ricento/adminhtml_config_source_heading</frontend_model>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>0</show_in_website>
204
+ <show_in_store>0</show_in_store>
205
+ <depends>
206
+ <enabled>1</enabled>
207
+ </depends>
208
+ </api_de>
209
+ <!-- PRODUCTION -->
210
+ <partner_key_de module="diglin_ricento" translate="label comment">
211
+ <label>PROD German Partner Key</label>
212
+ <frontend_type>text</frontend_type>
213
+ <sort_order>30</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>0</show_in_website>
216
+ <show_in_store>0</show_in_store>
217
+ <!--<frontend_class>required-entry</frontend_class>-->
218
+ <comment><![CDATA[Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
219
+ <depends>
220
+ <enabled>1</enabled>
221
+ </depends>
222
+ </partner_key_de>
223
+ <partner_pass_de module="diglin_ricento" translate="label comment">
224
+ <label>PROD German Partner Password</label>
225
+ <frontend_type>obscure</frontend_type>
226
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
227
+ <sort_order>31</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>0</show_in_website>
230
+ <show_in_store>0</show_in_store>
231
+ <!--<frontend_class>required-entry</frontend_class>-->
232
+ <comment><![CDATA[You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
233
+ <depends>
234
+ <enabled>1</enabled>
235
+ </depends>
236
+ </partner_pass_de>
237
+
238
+ <!-- DEVELOPMENT -->
239
+ <partner_key_dev_de module="diglin_ricento" translate="label comment">
240
+ <label>DEV German Partner Key</label>
241
+ <frontend_type>text</frontend_type>
242
+ <sort_order>21</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>0</show_in_website>
245
+ <show_in_store>0</show_in_store>
246
+ <!--<frontend_class>required-entry</frontend_class>-->
247
+ <comment><![CDATA[Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
248
+ <depends>
249
+ <enabled>1</enabled>
250
+ </depends>
251
+ </partner_key_dev_de>
252
+ <partner_pass_dev_de module="diglin_ricento" translate="label comment">
253
+ <label>DEV German Partner Password</label>
254
+ <frontend_type>obscure</frontend_type>
255
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
256
+ <sort_order>22</sort_order>
257
+ <show_in_default>1</show_in_default>
258
+ <show_in_website>0</show_in_website>
259
+ <show_in_store>0</show_in_store>
260
+ <!--<frontend_class>required-entry</frontend_class>-->
261
+ <comment><![CDATA[You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
262
+ <depends>
263
+ <enabled>1</enabled>
264
+ </depends>
265
+ </partner_pass_dev_de>
266
+
267
+ <api_fr module="diglin_ricento" translate="label">
268
+ <label>French API Token</label>
269
+ <sort_order>35</sort_order>
270
+ <frontend_model>diglin_ricento/adminhtml_config_source_heading</frontend_model>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>0</show_in_website>
273
+ <show_in_store>0</show_in_store>
274
+ <depends>
275
+ <enabled>1</enabled>
276
+ </depends>
277
+ </api_fr>
278
+ <!-- PRODUCTION -->
279
+ <partner_key_fr module="diglin_ricento" translate="label comment">
280
+ <label>PROD French Partner Key</label>
281
+ <frontend_type>text</frontend_type>
282
+ <sort_order>40</sort_order>
283
+ <show_in_default>1</show_in_default>
284
+ <show_in_website>0</show_in_website>
285
+ <show_in_store>0</show_in_store>
286
+ <!--<frontend_class>required-entry</frontend_class>-->
287
+ <comment><![CDATA[Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
288
+ <depends>
289
+ <enabled>1</enabled>
290
+ </depends>
291
+ </partner_key_fr>
292
+ <partner_pass_fr module="diglin_ricento" translate="label comment">
293
+ <label>PROD French Partner Password</label>
294
+ <frontend_type>obscure</frontend_type>
295
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
296
+ <sort_order>42</sort_order>
297
+ <show_in_default>1</show_in_default>
298
+ <show_in_website>0</show_in_website>
299
+ <show_in_store>0</show_in_store>
300
+ <!--<frontend_class>required-entry</frontend_class>-->
301
+ <comment><![CDATA[You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
302
+ <depends>
303
+ <enabled>1</enabled>
304
+ </depends>
305
+ </partner_pass_fr>
306
+ <!-- DEVELOPMENT -->
307
+ <partner_key_dev_fr module="diglin_ricento" translate="label comment">
308
+ <label>DEV French Partner Key</label>
309
+ <frontend_type>text</frontend_type>
310
+ <sort_order>36</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>0</show_in_store>
314
+ <!--<frontend_class>required-entry</frontend_class>-->
315
+ <comment><![CDATA[Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
316
+ <depends>
317
+ <enabled>1</enabled>
318
+ </depends>
319
+ </partner_key_dev_fr>
320
+ <partner_pass_dev_fr module="diglin_ricento" translate="label comment">
321
+ <label>DEV French Partner Password</label>
322
+ <frontend_type>obscure</frontend_type>
323
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
324
+ <sort_order>37</sort_order>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>0</show_in_website>
327
+ <show_in_store>0</show_in_store>
328
+ <!--<frontend_class>required-entry</frontend_class>-->
329
+ <comment><![CDATA[You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page]]></comment>
330
+ <depends>
331
+ <enabled>1</enabled>
332
+ </depends>
333
+ </partner_pass_dev_fr>
334
+
335
+ <!-- @todo -->
336
+ <!--<email_notification module="diglin_ricento" translate="label comment">-->
337
+ <!--<label>Notification API Token Expiration</label>-->
338
+ <!--<frontend_type>select</frontend_type>-->
339
+ <!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
340
+ <!--<comment><![CDATA[Do you want to receive an email when the API Token will expire? If your API Token expires, you won't be able to use the extension until you authorize it again. Receiving a notification per email will help you to prevent such a problem.]]></comment>-->
341
+ <!--<sort_order>60</sort_order>-->
342
+ <!--<show_in_default>1</show_in_default>-->
343
+ <!--<show_in_website>1</show_in_website>-->
344
+ <!--<show_in_store>0</show_in_store>-->
345
+ <!--</email_notification>-->
346
+ </fields>
347
+ </api_config>
348
+
349
+ <cleanup_jobs module="diglin_ricento" translate="label comment">
350
+ <label>Cleanup Synchronization Jobs Log</label>
351
+ <sort_order>30</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>0</show_in_website>
354
+ <show_in_store>0</show_in_store>
355
+ <fields>
356
+ <enabled module="diglin_ricento" translate="label comment">
357
+ <label>Enabled</label>
358
+ <frontend_type>select</frontend_type>
359
+ <source_model>adminhtml/system_config_source_yesno</source_model>
360
+ <sort_order>10</sort_order>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>0</show_in_website>
363
+ <show_in_store>0</show_in_store>
364
+ <comment><![CDATA[Under the menu ricardo.ch > Logs > Synchronization, you will find all jobs running like list your products, get the new sold articles, etc. Here you can clean the data after a period of time.]]></comment>
365
+ </enabled>
366
+ <keep_days module="diglin_ricento" translate="label comment">
367
+ <label>Keep for X days</label>
368
+ <frontend_type>text</frontend_type>
369
+ <sort_order>20</sort_order>
370
+ <show_in_default>1</show_in_default>
371
+ <show_in_website>0</show_in_website>
372
+ <show_in_store>0</show_in_store>
373
+ </keep_days>
374
+ </fields>
375
+ </cleanup_jobs>
376
+ </groups>
377
+ </ricento>
378
+
379
+ <payment>
380
+ <groups>
381
+ <ricento translate="label" module="diglin_ricento">
382
+ <label>ricardo.ch API Payment Methods</label>
383
+ <frontend_type>text</frontend_type>
384
+ <sort_order>999</sort_order>
385
+ <show_in_default>1</show_in_default>
386
+ <show_in_website>1</show_in_website>
387
+ <show_in_store>0</show_in_store>
388
+ <fields>
389
+ <bank_transfer_instructions translate="label">
390
+ <label>Bank Transfer Instructions</label>
391
+ <frontend_type>textarea</frontend_type>
392
+ <sort_order>30</sort_order>
393
+ <show_in_default>1</show_in_default>
394
+ <show_in_website>1</show_in_website>
395
+ <show_in_store>1</show_in_store>
396
+ </bank_transfer_instructions>
397
+ <currency translate="label">
398
+ <label>Accepted Currency</label>
399
+ <frontend_type>select</frontend_type>
400
+ <source_model>diglin_ricento/config_source_sales_currency</source_model>
401
+ <sort_order>50</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>1</show_in_website>
404
+ <show_in_store>0</show_in_store>
405
+ </currency>
406
+ </fields>
407
+ </ricento>
408
+ </groups>
409
+ </payment>
410
+ </sections>
411
+ </config>
app/code/community/Diglin/Ricento/etc/uninstall.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src/app/etc/modules/Diglin_Ricento.xml app/etc/modules/Diglin_Ricento.xml
2
+ src/app/code/community/Diglin/Ricento app/code/community/Diglin/Ricento
3
+ src/app/design/adminhtml/default/default/layout/ricento.xml app/design/adminhtml/default/default/layout/ricento.xml
4
+ src/app/design/adminhtml/default/default/template/ricento app/design/adminhtml/default/default/template/ricento
5
+ src/skin/adminhtml/default/default/ricento skin/adminhtml/default/default/ricento
6
+ src/js/ricento js/ricento
7
+
8
+ src/app/locale/en_US/Diglin_Ricento.csv app/locale/en_US/Diglin_Ricento.csv
9
+ src/app/locale/en_US/template/email/ricento app/locale/en_US/template/email/ricento
10
+
11
+ src/app/locale/fr_FR/Diglin_Ricento.csv app/locale/fr_FR/Diglin_Ricento.csv
12
+ src/app/locale/fr_FR/template/email/ricento app/locale/fr_FR/template/email/ricento
13
+
14
+ src/app/locale/de_CH/Diglin_Ricento.csv app/locale/de_CH/Diglin_Ricento.csv
15
+ src/app/locale/de_CH/template/email/ricento app/locale/de_CH/template/email/ricento
16
+
17
+ src/app/locale/de_DE/Diglin_Ricento.csv app/locale/de_DE/Diglin_Ricento.csv
18
+ src/app/locale/de_DE/template/email/ricento app/locale/de_DE/template/email/ricento
app/code/community/Diglin/Ricento/sql/ricento_setup/install-1.0.0.php ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Ricento
7
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ /* @var $installer Mage_Catalog_Model_Resource_Setup */
11
+ $installer = $this;
12
+
13
+ $installer->startSetup();
14
+
15
+ $apiTokenTable = $installer->getTable('diglin_ricento/api_token');
16
+ $salesOptionsTable = $installer->getTable('diglin_ricento/sales_options');
17
+ $shippingPaymentRuleTable = $installer->getTable('diglin_ricento/shipping_payment_rule');
18
+ $productListingTable = $installer->getTable('diglin_ricento/products_listing');
19
+ $productListingItemTable = $installer->getTable('diglin_ricento/products_listing_item');
20
+
21
+ $syncJobTable = $installer->getTable('diglin_ricento/sync_job');
22
+ $listingLogTable = $installer->getTable('diglin_ricento/listing_log');
23
+ $transactionTable = $installer->getTable('diglin_ricento/sales_transaction');
24
+ $syncJobListingTable = $installer->getTable('diglin_ricento/sync_job_listing');
25
+
26
+ $tableApiTokens = $installer->getConnection()->newTable($apiTokenTable);
27
+ $tableApiTokens->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
28
+ ->addColumn('token', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
29
+ ->addColumn('token_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
30
+ ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'nullable' => false))
31
+ ->addColumn('expiration_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false))
32
+ ->addColumn('session_duration', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false))
33
+ ->addColumn('session_expiration_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false))
34
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true))
35
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
36
+ ->setComment('Tokens for ricardo.ch API');
37
+ $installer->getConnection()->createTable($tableApiTokens);
38
+
39
+ $tableSalesOptions = $installer->getConnection()->newTable($salesOptionsTable);
40
+ $tableSalesOptions->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
41
+ ->addColumn('ricardo_category', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => true, 'unsigned' => false, 'default' => 0))
42
+ ->addColumn('sales_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
43
+ ->addColumn('price_source_attribute_code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true))
44
+ ->addColumn('price_change', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('default' => 0))
45
+ ->addColumn('price_change_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255)
46
+ ->addColumn('sales_auction_direct_buy', Varien_Db_Ddl_Table::TYPE_INTEGER, 1, array('unsigned' => 1))
47
+ ->addColumn('sales_auction_start_price', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('nullable' => false, 'default' => 0))
48
+ ->addColumn('sales_auction_increment', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('nullable' => false, 'default' => 0))
49
+ ->addColumn('schedule_date_start', Varien_Db_Ddl_Table::TYPE_DATETIME, array('nullable' => false, 'default' => null))
50
+ ->addColumn('schedule_period_days', Varien_Db_Ddl_Table::TYPE_INTEGER, 2, array('nullable' => false, 'unsigned' => true))
51
+ ->addColumn('schedule_reactivation', Varien_Db_Ddl_Table::TYPE_INTEGER, 2, array('default' => null, 'unsigned' => true))
52
+ ->addColumn('schedule_cycle_multiple_products', Varien_Db_Ddl_Table::TYPE_SMALLINT, 4, array('nullable' => true, 'default' => null))
53
+ ->addColumn('schedule_overwrite_product_date_start', Varien_Db_Ddl_Table::TYPE_INTEGER, 1, array('unsigned' => true))
54
+ ->addColumn('stock_management', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('default' => -1))
55
+ ->addColumn('customization_template', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => true, 'unsigned' => false, 'default' => '-1'))
56
+ ->addColumn('promotion_space', Varien_Db_Ddl_Table::TYPE_INTEGER, 2, array('nullable' => false, 'unsigned' => true, 'default' => 0))
57
+ ->addColumn('promotion_start_page', Varien_Db_Ddl_Table::TYPE_INTEGER, 1, array('nullable' => false, 'default' => 0))
58
+ ->addColumn('product_warranty', Varien_Db_Ddl_Table::TYPE_SMALLINT, 2, array('default' => 0, 'unsigned' => true, 'nullable' => false))
59
+ ->addColumn('product_warranty_description_de', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true))
60
+ ->addColumn('product_warranty_description_fr', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true))
61
+ ->addColumn('product_condition', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array('nullable' => false, 'default' => 0))
62
+ ->addColumn('product_condition_source_attribute_code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true))
63
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
64
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
65
+ ->setComment('Sales options');
66
+ $installer->getConnection()->createTable($tableSalesOptions);
67
+
68
+ $tableProductListings = $installer->getConnection()->newTable($productListingTable);
69
+ $tableProductListings->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
70
+ ->addColumn('title', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
71
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array('nullable' => false, 'default' => Diglin_Ricento_Helper_Data::STATUS_PENDING))
72
+ ->addColumn('sales_options_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => false))
73
+ ->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => false))
74
+ ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'nullable' => false))
75
+ ->addColumn('publish_languages', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true))
76
+ ->addColumn('default_language', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array('nullable' => true))
77
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
78
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
79
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing', 'sales_options_id', 'diglin_ricento/sales_options', 'entity_id'),
80
+ 'sales_options_id', $salesOptionsTable, 'entity_id', Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION)
81
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing', 'rule_id', 'diglin_ricento/shipping_payment_rule', 'rule_id'),
82
+ 'rule_id', $shippingPaymentRuleTable, 'rule_id', Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION)
83
+ ->setComment('List of products to be published on ricardo platform');
84
+ $installer->getConnection()->createTable($tableProductListings);
85
+
86
+ $tableProductListingItems = $installer->getConnection()->newTable($productListingItemTable);
87
+ $tableProductListingItems
88
+ ->addColumn('item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
89
+ ->addColumn('parent_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => true, 'unsigned' => true))
90
+ ->addColumn('ricardo_article_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
91
+ ->addColumn('is_planned', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => true))
92
+ ->addColumn('qty_inventory', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('unsigned' => true, 'nullable' => true))
93
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => false))
94
+ ->addColumn('parent_product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => true))
95
+ ->addColumn('products_listing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => false))
96
+ ->addColumn('sales_options_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => true, 'default' => null))
97
+ ->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => true, 'default' => null))
98
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array('nullable' => false, 'default' => Diglin_Ricento_Helper_Data::STATUS_PENDING))
99
+ ->addColumn('additional_data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true))
100
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
101
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
102
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing_item', 'product_id', 'catalog/product', 'entity_id'),
103
+ 'product_id', $installer->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE)
104
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing_item', 'products_listing_id', 'diglin_ricento/products_listing', 'entity_id'),
105
+ 'products_listing_id', $productListingTable, 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE)
106
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing_item', 'sales_options_id', 'diglin_ricento/sales_options', 'entity_id'),
107
+ 'sales_options_id', $salesOptionsTable, 'entity_id', Varien_Db_Ddl_Table::ACTION_SET_NULL)
108
+ ->addForeignKey($installer->getFkName('diglin_ricento/products_listing_item', 'rule_id', 'diglin_ricento/shipping_payment_rule', 'rule_id'),
109
+ 'rule_id', $shippingPaymentRuleTable, 'rule_id', Varien_Db_Ddl_Table::ACTION_SET_NULL)
110
+ ->setComment('Associated products for products listing');
111
+
112
+ $installer->getConnection()->createTable($tableProductListingItems);
113
+
114
+ $tablePaymentRule = $installer->getConnection()->newTable($shippingPaymentRuleTable);
115
+ $tablePaymentRule
116
+ ->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array(
117
+ 'primary' => true,
118
+ 'auto_increment' => true,
119
+ 'nullable' => false,
120
+ 'unsigned' => true
121
+ ), 'Rule ID')
122
+ ->addColumn('payment_methods', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
123
+ 'nullable' => false
124
+ ), 'Payment Methods')
125
+ ->addColumn('payment_description_de', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
126
+ 'nullable' => true
127
+ ), 'Payment description DE')
128
+ ->addColumn('payment_description_fr', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
129
+ 'nullable' => true
130
+ ), 'Payment description FR')
131
+ ->addColumn('shipping_method', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
132
+ 'nullable' => false
133
+ ), 'Shipping Methods')
134
+ ->addColumn('shipping_package', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
135
+ 'nullable' => true
136
+ ), 'Shipping Package')
137
+ ->addColumn('shipping_cumulative_fee', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
138
+ 'nullable' => false,
139
+ 'default' => 0
140
+ ), 'Shipping Cumulative Fee')
141
+ ->addColumn('shipping_description_de', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
142
+ 'nullable' => true
143
+ ), 'Shipping Description DE')
144
+ ->addColumn('shipping_description_fr', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
145
+ 'nullable' => true
146
+ ), 'Shipping Description FR')
147
+ ->addColumn('shipping_availability', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
148
+ 'nullable' => false
149
+ ), 'Shipping Availability')
150
+ ->addColumn('shipping_price', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
151
+ 'nullable' => true,
152
+ ), 'Selection Price Value')
153
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
154
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
155
+ ->setComment('Shipping & Payment Rule for product list or product item');
156
+ $installer->getConnection()->createTable($tablePaymentRule);
157
+
158
+ $tableSync = $installer->getConnection()->newTable($syncJobTable);
159
+ $tableSync
160
+ ->addColumn('job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
161
+ ->addColumn('job_message', Varien_Db_Ddl_Table::TYPE_TEXT, Varien_Db_Ddl_Table::MAX_TEXT_SIZE, array('nullable' => true))
162
+ ->addColumn('job_status', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array('nullable' => true))
163
+ ->addColumn('job_type', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array('nullable' => false))
164
+ ->addColumn('started_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
165
+ ->addColumn('ended_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
166
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
167
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
168
+ ->setComment('ricardo.ch synchronization job');
169
+
170
+ $installer->getConnection()->createTable($tableSync);
171
+
172
+ $installer->run("ALTER TABLE " . $tableSync->getName() . " ADD COLUMN `progress` ENUM('pending', 'ready', 'running', 'chunk_running', 'completed') NOT NULL AFTER job_type");
173
+
174
+ $tableSyncListing = $installer->getConnection()->newTable($syncJobListingTable);
175
+ $tableSyncListing
176
+ ->addColumn('job_listing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
177
+ ->addColumn('job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false, 'unsigned' => true))
178
+ ->addColumn('products_listing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false, 'unsigned' => true))
179
+ ->addColumn('last_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true))
180
+ ->addColumn('total_count', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'default' => 0))
181
+ ->addColumn('total_proceed', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'default' => 0))
182
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
183
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
184
+ ->addForeignKey($installer->getFkName('diglin_ricento/sync_job_listing', 'job_id', 'diglin_ricento/sync_job', 'job_id'),
185
+ 'job_id', $syncJobTable, 'job_id', Varien_Db_Ddl_Table::ACTION_CASCADE)
186
+ ->setComment('ricardo.ch synchronization job for listing');
187
+
188
+ $installer->getConnection()->createTable($tableSyncListing);
189
+
190
+ $tableProdListingLogs = $installer->getConnection()->newTable($listingLogTable);
191
+ $tableProdListingLogs
192
+ ->addColumn('log_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
193
+ ->addColumn('job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => true, 'unsigned' => true))
194
+ ->addColumn('products_listing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false, 'unsigned' => true))
195
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false, 'unsigned' => true))
196
+ ->addColumn('product_title', Varien_Db_Ddl_Table::TYPE_VARBINARY, 255, array('nullable' => true))
197
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, Varien_Db_Ddl_Table::MAX_TEXT_SIZE, array('nullable' => true))
198
+ ->addColumn('log_type', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('nullable' => false, 'unsigned' => true))
199
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
200
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
201
+ ->addForeignKey($installer->getFkName('diglin_ricento/listing_log', 'job_id', 'diglin_ricento/sync_job', 'job_id'),
202
+ 'job_id', $syncJobTable, 'job_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_SET_NULL)
203
+ ->addForeignKey($installer->getFkName('diglin_ricento/listing_log', 'products_listing_id', 'diglin_ricento/products_listing', 'entity_id'),
204
+ 'products_listing_id', $installer->getTable('diglin_ricento/products_listing'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE)
205
+ ->addForeignKey($installer->getFkName('diglin_ricento/listing_log', 'product_id', 'catalog/product', 'entity_id'),
206
+ 'product_id', $installer->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
207
+ ->setComment('ricardo.ch Products Listing logs');
208
+
209
+ $installer->getConnection()->createTable($tableProdListingLogs);
210
+
211
+ $installer->run("ALTER TABLE " . $tableProdListingLogs->getName() . " ADD COLUMN `log_status` ENUM('notice', 'warning', 'error', 'success') NOT NULL AFTER log_type");
212
+
213
+ $transaction = $installer->getConnection()->newTable($transactionTable);
214
+ $transaction
215
+ ->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('primary' => true, 'auto_increment' => true, 'nullable' => false, 'unsigned' => true))
216
+ ->addColumn('bid_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => false))
217
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
218
+ ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
219
+ ->addColumn('address_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
220
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
221
+ ->addColumn('language_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 3, array('unsigned' => true, 'nullable' => true))
222
+ ->addColumn('ricardo_customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => false))
223
+ ->addColumn('ricardo_article_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => false))
224
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => true))
225
+ ->addColumn('qty', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => false))
226
+ ->addColumn('view_count', Varien_Db_Ddl_Table::TYPE_INTEGER, 4, array('unsigned' => true, 'nullable' => true))
227
+ ->addColumn('total_bid_price', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('nullable' => false, 'unsigned' => true, 'default' => 0))
228
+ ->addColumn('payment_methods', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
229
+ ->addColumn('payment_description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true))
230
+ ->addColumn('shipping_fee', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array('nullable' => false, 'unsigned' => true, 'default' => 0))
231
+ ->addColumn('shipping_method', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))
232
+ ->addColumn('shipping_text', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true))
233
+ ->addColumn('shipping_description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true))
234
+ ->addColumn('shipping_cumulative_fee', Varien_Db_Ddl_Table::TYPE_INTEGER, 2, array('unsigned' => true, 'nullable' => false))
235
+ ->addColumn('raw_data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false))
236
+ ->addColumn('sold_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
237
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP)
238
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true, 'default' => null))
239
+ ->setComment('Transactions done on ricardo.ch from listed articles and synced back in Magento')
240
+ ->addForeignKey($installer->getFkName('diglin_ricento/sales_transaction', 'address_id', 'customer/address_entity', 'entity_id'),
241
+ 'address_id', $installer->getTable('customer/address_entity'), 'entity_id', Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_SET_NULL)
242
+ ->addForeignKey($installer->getFkName('diglin_ricento/sales_transaction', 'website_id', 'core/website', 'website_id'),
243
+ 'website_id', $installer->getTable('core/website'), 'website_id', Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_SET_NULL)
244
+ ->addForeignKey($installer->getFkName('diglin_ricento/sales_transaction', 'order_id', 'sales/order', 'entity_id'),
245
+ 'order_id', $installer->getTable('sales/order'), 'entity_id', Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_SET_NULL)
246
+ ->addForeignKey($installer->getFkName('diglin_ricento/sales_transaction', 'customer_id', 'customer/entity', 'entity_id'),
247
+ 'customer_id', $installer->getTable('customer/entity'), 'entity_id', Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_SET_NULL)
248
+ ->addForeignKey($installer->getFkName('diglin_ricento/sales_transaction', 'product_id', 'catalog/product', 'entity_id'),
249
+ 'product_id', $installer->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_SET_NULL);
250
+
251
+ $installer->getConnection()->createTable($transaction);
252
+
253
+ /**
254
+ * Add a column to sales/quote table
255
+ */
256
+ $salesQuoteTable = $installer->getTable('sales/quote');
257
+
258
+ $installer->getConnection()->addColumn($salesQuoteTable, 'is_ricardo', array(
259
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
260
+ 'nullable' => true,
261
+ 'unsigned' => true,
262
+ 'comment' => 'Is ricardo.ch Transaction'));
263
+
264
+ /**
265
+ * Add a column to sales/order table
266
+ */
267
+ $salesOrderTable = $installer->getTable('sales/order');
268
+
269
+ $installer->getConnection()->addColumn($salesOrderTable, 'is_ricardo', array(
270
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
271
+ 'nullable' => true,
272
+ 'unsigned' => true,
273
+ 'comment' => 'Is ricardo.ch Transaction'));
274
+
275
+ $installer->endSetup();
276
+
277
+ // Create Catalog Category Enttities
278
+
279
+ $entityTypeId = $installer->getEntityTypeId(Mage_Catalog_Model_Category::ENTITY);
280
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
281
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, 'General Information');
282
+
283
+ $installer->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'ricardo_category', array(
284
+ 'input_renderer' => 'diglin_ricento/adminhtml_products_category_form_renderer_mapping',
285
+ 'type' => 'int',
286
+ 'label' => 'ricardo.ch Category',
287
+ 'note' => 'Map this current Magento category with one of ricardo.ch. It will facilitate you the creation of product listing.',
288
+ 'input' => 'text',
289
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
290
+ 'required' => false,
291
+ 'user_defined' => false,
292
+ 'unique' => false,
293
+ 'default' => ''
294
+ ));
295
+
296
+ $installer->addAttributeToGroup(
297
+ $entityTypeId,
298
+ $attributeSetId,
299
+ $attributeGroupId,
300
+ 'ricardo_category'
301
+ );
302
+
303
+ // Create Catalog Product Enttities
304
+
305
+ $ricardoGroup = 'Ricardo';
306
+
307
+ $entityTypeId = $installer->getEntityTypeId(Mage_Catalog_Model_Product::ENTITY);
308
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
309
+ $installer->addAttributeGroup($entityTypeId, $attributeSetId, $ricardoGroup, 50);
310
+
311
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'ricardo_title', array(
312
+ 'group' => $ricardoGroup,
313
+ 'type' => 'varchar',
314
+ 'backend' => '',
315
+ 'frontend' => '',
316
+ 'label' => 'ricardo.ch Title',
317
+ 'note' => 'Title is limited to 40 characters on ricardo.ch, use this field instead of the product name to prevent any unwanted behavior. Normal product name will be used if this field is empty but will be cut to 40 chars on ricardo.ch.',
318
+ 'input' => 'text',
319
+ 'class' => 'validate-length maximum-length-40',
320
+ 'source' => '',
321
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
322
+ 'visible' => true,
323
+ 'required' => false,
324
+ 'user_defined' => false,
325
+ 'default' => '',
326
+ 'searchable' => false,
327
+ 'filterable' => false,
328
+ 'comparable' => false,
329
+ 'visible_on_front' => false,
330
+ 'unique' => false,
331
+ 'is_configurable' => false,
332
+ 'used_in_product_listing' => true,
333
+ 'apply_to' => 'simple,grouped,configurable'
334
+ ));
335
+
336
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'ricardo_subtitle', array(
337
+ 'group' => $ricardoGroup,
338
+ 'type' => 'varchar',
339
+ 'backend' => '',
340
+ 'frontend' => '',
341
+ 'label' => 'ricardo.ch Subtitle',
342
+ 'note' => 'Subtitle is limited to 60 characters on ricardo.ch. Let empty if you don\'t need it.',
343
+ 'input' => 'text',
344
+ 'class' => 'validate-length maximum-length-60',
345
+ 'source' => '',
346
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
347
+ 'visible' => true,
348
+ 'required' => false,
349
+ 'user_defined' => false,
350
+ 'default' => '',
351
+ 'searchable' => false,
352
+ 'filterable' => false,
353
+ 'comparable' => false,
354
+ 'visible_on_front' => false,
355
+ 'unique' => false,
356
+ 'is_configurable' => false,
357
+ 'used_in_product_listing' => true,
358
+ 'apply_to' => 'simple,grouped,configurable'
359
+ ));
360
+
361
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'ricardo_description', array(
362
+ 'group' => $ricardoGroup,
363
+ 'type' => 'text',
364
+ 'backend' => '',
365
+ 'frontend' => '',
366
+ 'label' => 'ricardo.ch Description',
367
+ 'note' => '65 000 characters Max. - Description of the product for ricardo.ch page. If empty, the default Magento description of your product will be taken.',
368
+ 'input' => 'textarea',
369
+ 'class' => 'validate-length maximum-length-65000',
370
+ 'source' => '',
371
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
372
+ 'visible' => true,
373
+ 'required' => false,
374
+ 'user_defined' => false,
375
+ 'default' => '',
376
+ 'searchable' => false,
377
+ 'filterable' => false,
378
+ 'comparable' => false,
379
+ 'visible_on_front' => false,
380
+ 'unique' => false,
381
+ 'is_configurable' => false,
382
+ 'used_in_product_listing' => true,
383
+ 'wysiwyg_enabled' => true,
384
+ 'is_html_allowed_on_front' => true,
385
+ 'apply_to' => 'simple,grouped,configurable'
386
+ ));
387
+
388
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'ricardo_condition', array(
389
+ 'group' => $ricardoGroup,
390
+ 'type' => 'int',
391
+ 'backend' => '',
392
+ 'frontend' => '',
393
+ 'label' => 'Product Condition',
394
+ 'note' => '',
395
+ 'input' => 'select',
396
+ 'class' => '',
397
+ 'source' => 'diglin_ricento/entity_attribute_source_conditions',
398
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
399
+ 'visible' => true,
400
+ 'required' => false,
401
+ 'user_defined' => false,
402
+ 'default' => '',
403
+ 'searchable' => false,
404
+ 'filterable' => false,
405
+ 'comparable' => false,
406
+ 'visible_on_front' => false,
407
+ 'unique' => false,
408
+ 'is_configurable' => false,
409
+ 'used_in_product_listing' => true,
410
+ 'apply_to' => 'simple,grouped,configurable'
411
+ ));
412
+
413
+ $installer->addAttribute('customer', 'ricardo_username', array(
414
+ 'type' => 'varchar',
415
+ 'input' => 'text',
416
+ 'label' => 'ricardo.ch Username',
417
+ 'required' => false,
418
+ 'user_defined' => true,
419
+ 'default' => '',
420
+ 'unique' => true,
421
+ 'note' => 'ricardo.ch Username imported from ricardo.ch',
422
+ 'visible' => true,
423
+ 'visible_on_front' => false,
424
+ 'frontend_class' => 'disabled'
425
+ ));
426
+
427
+ $installer->addAttribute('customer', 'ricardo_id', array(
428
+ 'type' => 'int',
429
+ 'input' => 'text',
430
+ 'label' => 'ricardo.ch Customer ID',
431
+ 'required' => false,
432
+ 'user_defined' => true,
433
+ 'default' => '',
434
+ 'unique' => true,
435
+ 'note' => 'ricardo.ch Customer ID imported from ricardo.ch',
436
+ 'visible' => true,
437
+ 'visible_on_front' => false,
438
+ 'frontend_class' => 'disabled'
439
+ ));
440
+
441
+ /**
442
+ * Add column to sales quote
443
+ */
444
+ $installer->getConnection()->addColumn($salesQuoteTable, 'customer_ricardo_username', array(
445
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
446
+ 'length' => 255,
447
+ 'nullable' => true,
448
+ 'comment' => 'Ricardo Username'));
449
+
450
+ $installer->getConnection()->addColumn($salesQuoteTable, 'customer_ricardo_id', array(
451
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
452
+ 'nullable' => true,
453
+ 'unsigned' => true,
454
+ 'comment' => 'ricardo.ch ID'));
455
+
456
+ /**
457
+ * Add column to sales quote
458
+ */
459
+ $installer->getConnection()->addColumn($salesOrderTable, 'customer_ricardo_username', array(
460
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
461
+ 'length' => 255,
462
+ 'nullable' => true,
463
+ 'comment' => 'ricardo.ch Username'));
464
+
465
+ $installer->getConnection()->addColumn($salesOrderTable, 'customer_ricardo_id', array(
466
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
467
+ 'nullable' => true,
468
+ 'unsigned' => true,
469
+ 'comment' => 'ricardo.ch ID'));
470
+
471
+ Mage::getSingleton('eav/config')
472
+ ->getAttribute('customer', 'ricardo_id')
473
+ ->setData('used_in_forms', array('adminhtml_customer', 'adminhtml_checkout'))
474
+ ->save();
475
+
476
+ Mage::getSingleton('eav/config')
477
+ ->getAttribute('customer', 'ricardo_username')
478
+ ->setData('used_in_forms', array('adminhtml_customer', 'adminhtml_checkout'))
479
+ ->save();
480
+
481
+ $installer->endSetup();
app/code/community/Diglin/Ricento/sql/ricento_setup/uninstall.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /* @var $installer Mage_Core_Model_Resource_Setup */
13
+ $installer = $this;
14
+
15
+ $installer->startSetup();
16
+
17
+ // Customer Attributes
18
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_id');
19
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_username');
20
+
21
+ // Product Attributes
22
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_category');
23
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_title');
24
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_subtitle');
25
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_description');
26
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'ricardo_condition');
27
+
28
+ // Sales Quote Columns
29
+ $installer->getConnection()->dropColumn($installer->getTable('sales/quote'), 'is_ricardo');
30
+ $installer->getConnection()->dropColumn($installer->getTable('sales/quote'), 'customer_ricardo_id');
31
+ $installer->getConnection()->dropColumn($installer->getTable('sales/quote'), 'customer_ricardo_username');
32
+
33
+ // Sales Order Columns
34
+ $installer->getConnection()->dropColumn($installer->getTable('sales/order'), 'is_ricardo');
35
+ $installer->getConnection()->dropColumn($installer->getTable('sales/order'), 'customer_ricardo_id');
36
+ $installer->getConnection()->dropColumn($installer->getTable('sales/order'), 'customer_ricardo_username');
37
+
38
+ // Remove all ricento tables
39
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/api_token'));
40
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/products_listing'));
41
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/products_listing_item'));
42
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/listing_log'));
43
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/sales_options'));
44
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/shipping_payment_rule'));
45
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/sync_job'));
46
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/sales_transaction'));
47
+ $installer->getConnection()->dropTable($installer->getTable('diglin_ricento/sync_job_listing'));
48
+
49
+ $installer->getConnection()->delete($installer->getTable('sales/order_status'), 'status = "ricardo_payment_canceled"');
50
+ $installer->getConnection()->delete($installer->getTable('sales/order_status'), 'status = "ricardo_payment_pending"');
51
+
52
+ $installer->endSetup();
53
+
54
+ /*
55
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_id';
56
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_username';
57
+
58
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_category';
59
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_title';
60
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_subtitle';
61
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_description';
62
+ DELETE FROM MYPREFIX_eav_attribute WHERE attribute_code = 'ricardo_condition';
63
+
64
+ ALTER TABLE MYPREFIX_sales_flat_quote DROP COLUMN is_ricardo, DROP COLUMN customer_ricardo_id, DROP COLUMN customer_ricardo_username;
65
+ ALTER TABLE MYPREFIX_sales_flat_order DROP COLUMN is_ricardo, DROP COLUMN customer_ricardo_id, DROP COLUMN customer_ricardo_username;
66
+
67
+ DROP TABLE MYPREFIX_api_token;
68
+ DROP TABLE MYPREFIX_products_listing;
69
+ DROP TABLE MYPREFIX_products_listing_item;
70
+ DROP TABLE MYPREFIX_listing_log;
71
+ DROP TABLE MYPREFIX_sales_options;
72
+ DROP TABLE MYPREFIX_shipping_payment_rule;
73
+ DROP TABLE MYPREFIX_sync_job;
74
+ DROP TABLE MYPREFIX_sales_transaction;
75
+ DROP TABLE MYPREFIX_sync_job_listing;
76
+
77
+ DELETE FROM MYPREFIX_sales_order_status WHERE status = 'ricardo_payment_canceled';
78
+ DELETE FROM MYPREFIX_sales_order_status WHERE status = 'ricardo_payment_pending';
79
+ */
app/code/community/Diglin/Ricento/sql/ricento_setup/upgrade-1.0.8-1.0.9.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <support at diglin.com>
6
+ * @category Ricento
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ */
10
+ /* @var $installer Mage_Catalog_Model_Resource_Setup */
11
+ $installer = $this;
12
+
13
+ $installer->startSetup();
14
+
15
+ $syncJobtable = $installer->getTable('diglin_ricento/sync_job_listing');
16
+
17
+ $installer->getConnection()->addColumn($syncJobtable, 'total_success', array(
18
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
19
+ 'length' => 10,
20
+ 'nullable' => false,
21
+ 'unsigned' => true,
22
+ 'default' => 0,
23
+ 'after' => 'total_count',
24
+ 'comment' => 'Total Success'));
25
+
26
+ $installer->getConnection()->addColumn($syncJobtable, 'total_error', array(
27
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
28
+ 'length' => 10,
29
+ 'nullable' => false,
30
+ 'unsigned' => true,
31
+ 'default' => 0,
32
+ 'after' => 'total_success',
33
+ 'comment' => 'Total Error'));
34
+
35
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/ricento.xml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Diglin
5
+ *
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2014 Diglin (http://www.diglin.com)
9
+ */
10
+ -->
11
+ <layout>
12
+ <default>
13
+ <reference name="notifications">
14
+ <block type="diglin_ricento/adminhtml_notifications_default" name="ricento_notifications_configured"
15
+ template="ricento/notifications/configured.phtml" before="-"/>
16
+ <block type="diglin_ricento/adminhtml_notifications_expiration"
17
+ name="ricento_notifications_api_expiration" template="ricento/notifications/expiration.phtml"/>
18
+ </reference>
19
+
20
+ <reference name="head">
21
+ <action method="addCss"><style>ricento/css/ricento.css</style></action>
22
+ </reference>
23
+
24
+ <reference name="root">
25
+ <action method="unsetChild"><name>menu</name></action>
26
+ <block type="diglin_ricento/adminhtml_page_menu" name="menu" as="menu" />
27
+ </reference>
28
+ </default>
29
+
30
+ <ricento_scripts>
31
+ <reference name="head">
32
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
33
+ <action method="addCss"><name>lib/prototype/windows/themes/magento.css</name></action>
34
+ <action method="addJs"><name>ricento/adminhtml.js</name></action>
35
+ <action method="addJs"><name>ricento/Countable.js</name></action>
36
+ </reference>
37
+ </ricento_scripts>
38
+
39
+ <ricento_dashboard_index>
40
+ <reference name="content">
41
+ <block type="core/template" name="ricento_dashboard" as="ricento.dashboard"
42
+ template="ricento/dashboard.phtml">
43
+ <block type="core/text_list" name="ricento_dashboard_left" as="ricento.dashboard.left">
44
+ <block type="adminhtml/template" name="ricento_dashboard_toolbar" as="ricento.dashboard.toolbar"
45
+ template="ricento/dashboard/toolbar.phtml"/>
46
+ <block type="adminhtml/template" name="ricento_dashboard_account" as="ricento.dashboard.account"
47
+ template="ricento/dashboard/account.phtml">
48
+ <block type="diglin_ricento/adminhtml_dashboard_account" name="ricento_dashboard_account_grid"
49
+ as="ricento.dashboard.account.grid"/>
50
+ </block>
51
+ <block type="diglin_ricento/adminhtml_dashboard_news" name="ricento_dashboard_news"
52
+ as="ricento.dashboard.news"
53
+ template="ricento/dashboard/news.phtml"/>
54
+ </block>
55
+ <block type="core/text_list" name="ricento_dashboard_right" as="ricento.dashboard.right">
56
+ <block type="diglin_ricento/adminhtml_dashboard_lifetime" name="ricento_dashboard_lifetime"
57
+ as="ricento.dashboard.lifetime"
58
+ template="ricento/dashboard/lifeturnover.phtml"/>
59
+ <block type="adminhtml/template" name="ricento_dashboard_turnover" as="ricento.dashboard.turnover"
60
+ template="ricento/dashboard/turnover.phtml">
61
+ <block type="diglin_ricento/adminhtml_dashboard_turnover" name="ricento_dashboard_turnover_graph" as="ricento.dashboard.turnover.graph" />
62
+ </block>
63
+ <block type="core/template" name="ricento_dashboard_bestsellers" as="ricento.dashboard.bestsellers"
64
+ template="ricento/dashboard/bestsellers.phtml">
65
+ <block type="diglin_ricento/adminhtml_dashboard_bestsellers"
66
+ name="ricento_dashboard_bestsellers_grid"
67
+ as="ricento.dashboard.bestsellers.grid"/>
68
+ </block>
69
+ </block>
70
+ </block>
71
+ </reference>
72
+ </ricento_dashboard_index>
73
+
74
+ <!-- PRODUCTS LISTING PAGES -->
75
+
76
+ <ricento_products_listing_index>
77
+ <update handle="ricento_scripts" />
78
+ <reference name="content">
79
+ <block type="diglin_ricento/adminhtml_products_listing_new" name="products_listing_new" />
80
+ </reference>
81
+ </ricento_products_listing_index>
82
+
83
+ <ricento_products_listing_edit>
84
+ <update handle="ricento_scripts" />
85
+ <update handle="editor"/>
86
+ <reference name="content">
87
+ <block type="diglin_ricento/adminhtml_products_listing_edit" name="products_listing_edit" />
88
+ </reference>
89
+ <reference name="left">
90
+ <block type="diglin_ricento/adminhtml_products_listing_edit_tabs" name="products_listing_edit_tabs" />
91
+ </reference>
92
+ </ricento_products_listing_edit>
93
+
94
+ <ricento_products_listing_addproductspopup>
95
+ <update handle="overlay_popup" />
96
+ <remove name="footer" />
97
+ <reference name="content">
98
+ <block type="diglin_ricento/adminhtml_products_listing_edit_tabs_products_add"
99
+ name="products_listing_add" />
100
+ </reference>
101
+ </ricento_products_listing_addproductspopup>
102
+
103
+ <!-- PRODUCTS LISTING ITEMS PAGES -->
104
+
105
+ <ricento_products_listing_item_configure>
106
+ <update handle="ricento_scripts" />
107
+ <reference name="content">
108
+ <block type="diglin_ricento/adminhtml_products_listing_item_edit" name="products_listing_item_edit" />
109
+ </reference>
110
+ </ricento_products_listing_item_configure>
111
+
112
+ <ricento_products_listing_item_preview>
113
+ <update handle="ricento_scripts" />
114
+ <reference name="root">
115
+ <action method="setTemplate">
116
+ <template>empty.phtml</template>
117
+ </action>
118
+ </reference>
119
+ <reference name="content">
120
+ <block type="diglin_ricento/adminhtml_products_listing_item_preview" name="products_listing_item_preview" />
121
+ </reference>
122
+ </ricento_products_listing_item_preview>
123
+
124
+ <!-- PRODUCTS CATEGORY PAGES -->
125
+
126
+ <ricento_products_category_mapping>
127
+ <update handle="overlay_popup" />
128
+ <remove name="footer" />
129
+ <reference name="content">
130
+ <block type="diglin_ricento/adminhtml_products_category_mapping" name="category_mapping" template="ricento/products/category/mapping.phtml"/>
131
+ </reference>
132
+ </ricento_products_category_mapping>
133
+
134
+ <ricento_products_category_children>
135
+ <remove name="root" />
136
+ <block type="diglin_ricento/adminhtml_products_category_children" name="category_children" template="ricento/products/category/children.phtml" output="toHtml" />
137
+ </ricento_products_category_children>
138
+
139
+ <adminhtml_catalog_category_edit>
140
+ <update handle="ricento_scripts" />
141
+ </adminhtml_catalog_category_edit>
142
+
143
+ <ricento_products_category_showcategoriestree>
144
+ <update handle="overlay_popup" />
145
+ <remove name="footer" />
146
+ <reference name="content">
147
+ <block type="diglin_ricento/adminhtml_products_category_tree" name="products_listing_tree" as="products_listing_tree" />
148
+ </reference>
149
+ </ricento_products_category_showcategoriestree>
150
+
151
+ <!-- SYNCHRONIZATION PAGES -->
152
+
153
+ <ricento_log_sync>
154
+ <update handle="ricento_scripts" />
155
+ <reference name="head">
156
+ <action method="addJs"><name>ricento/livepipe-ui/livepipe.js</name></action>
157
+ <action method="addJs"><name>ricento/livepipe-ui/progressbar.js</name></action>
158
+ </reference>-->
159
+ </ricento_log_sync>
160
+
161
+ <ricento_sync_jobmessagepopup>
162
+ <update handle="overlay_popup" />
163
+ <remove name="footer" />
164
+ <reference name="content">
165
+ <block type="adminhtml/template" name="sync_ajax_popup" as="sync_ajax_popup" template="ricento/sync/check/popup.phtml" />
166
+ </reference>
167
+ </ricento_sync_jobmessagepopup>
168
+
169
+ <ricento_products_listing_productsgrid>
170
+ <update handle="formkey"/>
171
+ </ricento_products_listing_productsgrid>
172
+ </layout>
app/design/adminhtml/default/default/template/ricento/dashboard.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @var $this Mage_Adminhtml_Block_Template */
12
+ ?>
13
+ <div class="content-header">
14
+ <table cellspacing="0">
15
+ <tr>
16
+ <td><h3 class="head-dashboard"><?php echo $this->__('ricardo.ch - Dashboard') ?></h3></td>
17
+ </tr>
18
+ </table>
19
+ </div>
20
+ <div class="ricento_dashboard">
21
+ <div class="left">
22
+ <?php echo $this->getChildHtml('ricento.dashboard.left'); ?>
23
+ </div>
24
+ <div class="right">
25
+ <?php echo $this->getChildHtml('ricento.dashboard.right'); ?>
26
+ </div>
27
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/account.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head"><h4><?php echo $this->__('Your ricardo.ch API Token') ?></h4></div>
14
+ <fieldset class="np">
15
+ <?php echo $this->getChildHtml('ricento.dashboard.account.grid'); ?>
16
+ </fieldset>
17
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/bestsellers.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head"><h4><?php echo $this->__('Best Sellers') ?></h4></div>
14
+ <fieldset class="np">
15
+ <?php echo $this->getChildHtml('ricento.dashboard.bestsellers.grid'); ?>
16
+ </fieldset>
17
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/lifeturnover.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @category Ricento
6
+ * @package Diglin_Ricento
7
+ * @copyright Copyright (c) 2011-2014 Diglin (http://www.diglin.com)
8
+ */
9
+
10
+ /** @var $this Diglin_Ricento_Block_Adminhtml_Dashboard_Lifetime */
11
+ ?>
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head"><h4><?php echo $this->__('ricardo.ch Lifetime Sales') ?></h4></div>
14
+ <fieldset class="a-center bold">
15
+ <span class="nowrap" style="font-size:18px;"><span class="price"><?php echo $this->getValueHtml() ?></span><span style="font-size:14px; color:#686868;"></span></span>
16
+ </fieldset>
17
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/news.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /** @var $this Diglin_Ricento_Block_Adminhtml_Dashboard_News */
13
+
14
+ $news = $this->getNewsFromFeed();
15
+ ?>
16
+ <div class="entry-edit">
17
+ <div class="entry-edit-head"><h4><?php echo $this->__('ricardo.ch News') ?></h4></div>
18
+ <fieldset class="a-left">
19
+ <?php if (empty($news)): ?>
20
+ <em><?php echo $this->__('News could not be retrieved'); ?></em>
21
+ <?php endif; ?>
22
+ <?php foreach ($news as $newsEntry): ?>
23
+ <div class="ricento_news_item">
24
+ <h4 class="ricento_news_title"><?php echo $this->escapeHtml($newsEntry->getTitle()) ?></h4>
25
+ <div class="ricento_news_description"><?php echo $newsEntry->getDescription() ?></div>
26
+ <div class="ricento_news_link"><a href="<?php echo $newsEntry->getLink() ?>"><?php echo $this->__('Read more') ?></a></div>
27
+ </div>
28
+ <?php endforeach; ?>
29
+ </fieldset>
30
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/toolbar.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /** @var $this Mage_Adminhtml_Block_Template */
13
+ ?>
14
+ <div class="entry-edit">
15
+ <ul class="ricento_toolbar">
16
+ <li><a href="<?php echo $this->getUrl('ricento/products_listing'); ?>" class="ricento_icon ricento_icon_list"><?php echo $this->__('Products Listing') ?></a></li>
17
+ <li><a href="<?php echo $this->getUrl('ricento/log/sync'); ?>" class="ricento_icon ricento_icon_sync"><?php echo $this->__('Synchronizsation') ?></a></li>
18
+ <li><a href="<?php echo $this->getUrl('ricento/log/listing'); ?>" class="ricento_icon ricento_icon_logs"><?php echo $this->__('Logs') ?></a></li>
19
+ <li><a href="<?php echo $this->getUrl('adminhtml/system_config/edit', array('section' => 'ricento')); ?>" class="ricento_icon ricento_icon_conf"><?php echo $this->__('Configuration') ?></a></li>
20
+ <li><a href=<?php echo $this->getUrl('ricento/support'); ?>"" class="ricento_icon ricento_icon_support"><?php echo $this->__('Support') ?></a></li>
21
+ </ul>
22
+ <p class="icons-copyright">Icons provided by <a href="http://icons8.com/">icons8</a> as Creative Commons Attribution-NoDerivs 3.0 Unported</p>
23
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/turnover.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head"><h4><?php echo $this->__('Turnover per month') ?></h4></div>
14
+ <fieldset class="a-center bold">
15
+ <?php echo $this->getChildHtml('ricento.dashboard.turnover.graph'); ?>
16
+ </fieldset>
17
+ </div>
app/design/adminhtml/default/default/template/ricento/dashboard/turnover/graph.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /** @var $this Diglin_Ricento_Block_Adminhtml_Dashboard_Turnover */
12
+ ?>
13
+ <div style="margin:20px;">
14
+ <?php if (Mage::getStoreConfig(Mage_Adminhtml_Block_Dashboard::XML_PATH_ENABLE_CHARTS)) { ?>
15
+ <?php
16
+ $_containerStyle = "width:{$this->getWidth()}px;height:{$this->getHeight()}px; margin:0 auto;";
17
+ ?>
18
+ <?php if($this->getCount()): ?>
19
+ <p style="<?php echo $_containerStyle?>"><img src="<?php echo $this->getChartUrl(false) ?>" alt="<?php echo $this->__('ricardo.ch Turnover Chart'); ?>" title="<?php echo $this->__('ricardo.ch Turnover Chart'); ?>" /></p>
20
+ <?php else: ?>
21
+ <p class="a-center" style="<?php echo $_containerStyle?>"><?php echo $this->__('No Data Found') ?></p>
22
+ <?php endif; ?>
23
+ <?php } else { ?>
24
+ <div class="box" style="margin:20px;">
25
+ <p class="a-center">
26
+ <?php echo $this->helper('adminhtml')->__('Chart is disabled. If you want to enable chart, click <a href="%s">here</a>.', $this->getUrl('adminhtml/system_config/edit', array('section'=>'admin')))?>
27
+ </p>
28
+ </div>
29
+ <?php } ?>
30
+ </div>
app/design/adminhtml/default/default/template/ricento/iframe.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @see Diglin_Ricento_Adminhtml_AccountController */
12
+ ?>
13
+ <div class="content-header" style="visibility: visible;">
14
+ <table cellspacing="0">
15
+ <tbody>
16
+ <tr>
17
+ <td style="width: 50%;">
18
+ <h3 class="icon-head head-categories"><?php echo $this->getTitle() ?></h3>
19
+ <?php echo Mage::helper('diglin_ricento')->__('You may also access to the %s content of this page</a> in a new window.',
20
+ '<a href="'. $this->getIframeUrl() .'" target="_blank" onClick="javascript:document.getElementById(\'dashboarddiv\').innerHTML=\'\'; ">'); ?>
21
+ </td>
22
+ </tr>
23
+ </tbody>
24
+ </table>
25
+ </div>
26
+ <div id="dashboarddiv" style="margin-top: -18px">
27
+ <iframe style="border-bottom:3px solid #dfdfdf" id="dashboardiframe" frameborder="0"
28
+ src="<?php echo $this->getIframeUrl() ?>" height="960px" width="100%"></iframe>
29
+ </div>
30
+ <script>
31
+ function GetHeight() {
32
+ var y = 0;
33
+ if (self.innerHeight) {
34
+ y = self.innerHeight;
35
+ } else if (document.documentElement && document.documentElement.clientHeight) {
36
+ y = document.documentElement.clientHeight;
37
+ } else if (document.body) {
38
+ y = document.body.clientHeight;
39
+ }
40
+ return y;
41
+ }
42
+
43
+ function doResize() {
44
+ document.getElementById("dashboardiframe").style.height = (GetHeight() - 220) + "px";
45
+ }
46
+
47
+ window.onresize = doResize;
48
+ doResize();
49
+ </script>
app/design/adminhtml/default/default/template/ricento/js/rules/validate/paymentshipping.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ $paymentValidationMessage = $this->getPaymentValidationMessage();
12
+ $jsonAllowedPaymentCombinations = $this->getJsonAllowedPaymentCombinations();
13
+ $paymentShippingValidationMessage = $this->getPaymentShippingValidationMessage();
14
+ $jsonDisallowedPaymentShippingCombinations = $this->getJsonDisallowedPaymentShippingCombinations();
15
+ ?>
16
+ <script>
17
+ Validation.add('validate-payment-method-combination', '<?php echo $paymentValidationMessage ?>', function(fieldValue, field) {
18
+ var checkboxes = field.form[field.name];
19
+ var paymentValue = [];
20
+ for (var i = 0; i < checkboxes.length; ++i) {
21
+ if (checkboxes[i].checked) {
22
+ paymentValue.push(parseInt(checkboxes[i].value));
23
+ }
24
+ }
25
+ allowedPaymentCombinations = <?php echo $jsonAllowedPaymentCombinations ?>;
26
+ var arraysAreEqual = function(a1, a2) {
27
+ return a1.length==a2.length && a1.every(function(v,i) { return a2.indexOf(v) >= 0});
28
+ };
29
+ for (var i = 0; i < allowedPaymentCombinations.length; ++i) {
30
+ if (arraysAreEqual(allowedPaymentCombinations[i], paymentValue)) {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ });
36
+ var paymentFormFieldName = 'rules[payment_methods][]';
37
+ Validation.add('validate-payment-shipping-combination', '<?php echo $paymentShippingValidationMessage ?>', function(fieldValue, field) {
38
+ var checkboxes = field.form[paymentFormFieldName]
39
+ var paymentValue = [];
40
+ for (var i = 0; i < checkboxes.length; ++i) {
41
+ if (checkboxes[i].checked) {
42
+ paymentValue.push(parseInt(checkboxes[i].value));
43
+ }
44
+ }
45
+ disallowedPaymentShippingCombinations = <?php echo $jsonDisallowedPaymentShippingCombinations ?>;
46
+ for (var i = 0; i < disallowedPaymentShippingCombinations.length; ++i) {
47
+ if (disallowedPaymentShippingCombinations[i].shipping == fieldValue && paymentValue.indexOf(disallowedPaymentShippingCombinations[i].payment) >= 0) {
48
+ return false;
49
+ }
50
+ }
51
+ return true;
52
+ });
53
+ </script>
app/design/adminhtml/default/default/template/ricento/js/salesoptions/validate/increment.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ $incrementValidationMessage = $this->getErrorMessage();
12
+ $jsonAllowedCombinations = $this->getJsonAllowedCombinations();
13
+ ?>
14
+ <script type="text/javascript">
15
+ Validation.addAllThese([
16
+ ['validate-startprice-increment', '<?php echo $incrementValidationMessage ?>', function(fieldValue, field) {
17
+
18
+ if ($('fieldset_toggle_auction').getStyle('display') == 'none') {
19
+ return true;
20
+ }
21
+
22
+ startPriceValue = $('sales_options_sales_auction_start_price').value;
23
+
24
+ allowedCombinations = <?php echo $jsonAllowedCombinations ?>;
25
+ for (i = 0; i < allowedCombinations.length; ++i) {
26
+ if (allowedCombinations[i].start_price.min <= startPriceValue && allowedCombinations[i].start_price.max >= startPriceValue ) {
27
+ if (allowedCombinations[i].increment.min <= fieldValue && allowedCombinations[i].increment.max >= fieldValue) {
28
+ return true;
29
+ }
30
+ }
31
+ }
32
+ return false;
33
+ }],
34
+ ['validate-ricardo-category', '<?php echo $this->__('You must select a ricardo.ch Category if you set this option'); ?>', function(fieldValue) {
35
+
36
+ var useMappingValue = Form.getInputs('edit_form','radio','sales_options[ricardo_category_use_mapping]').find(function(radio) {
37
+ return radio.checked;
38
+ }).value;
39
+
40
+ fieldValue = $('sales_options_ricardo_category').value;
41
+
42
+ if (useMappingValue == 0 && fieldValue <= 0) {
43
+ return false;
44
+ }
45
+
46
+ return true;
47
+ }]
48
+ ]);
49
+ </script>
app/design/adminhtml/default/default/template/ricento/js/sync/progress.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /* @var $this Mage_Adminhtml_Block_Template */
13
+ /* @see Diglin_Ricento_Block_Adminhtml_Sync_Log_Grid_Renderer_Progress */
14
+
15
+ $progressUrl = $this->getProgressAjaxUrl();
16
+ $progressPopupUrl = $this->getProgressPopupUrl();
17
+ $prefix = $this->getPrefix();
18
+
19
+ if($this->getRunProgress()) {?>
20
+ <div id="progress<?php echo $prefix ?>" class="sync-indicator-text"></div>
21
+ <div id="progress_bar<?php echo $prefix ?>" class="sync-progress-bar"></div>
22
+ <div id="advice<?php echo $prefix ?>" class="sync-advice">
23
+ <?php if ($this->getJobWillStart()) { ?>
24
+ <div class="sync-advice"><?php echo $this->__('The task will start few minutes');?></div>
25
+ <?php } ?>
26
+ </div>
27
+ <div id="debug<?php echo $prefix ?>" style="display: none"></div><?php // Keep it to prevent, warning js messages ?>
28
+ <script type="text/javascript">
29
+ // Use timeout cause of offsetWidth, needed here to set the progress bar
30
+ setTimeout(function(){
31
+ Ricento.progressInterval('<?php echo $progressUrl ?>', '<?php echo $prefix ?>');
32
+ }, 150);
33
+ </script>
34
+ <?php echo $this->getAdditionalHtml(); ?>
35
+ <?php } else { ?>
36
+ <div class="sync-advice"><?php echo $this->__('No progress');?></div>
37
+ <?php } ?>
app/design/adminhtml/default/default/template/ricento/log.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <div class="content-header">
13
+ <table cellspacing="0">
14
+ <tr>
15
+ <td><h3><?php echo $this->getHeaderText() ?></h3></td>
16
+ <td class="form-buttons">
17
+ <?php echo $this->getButtonsHtml() ?>
18
+ </td>
19
+ </tr>
20
+ </table>
21
+ </div>
app/design/adminhtml/default/default/template/ricento/notifications/configured.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /**
12
+ * @var $this Diglin_Ricento_Block_Adminhtml_Notifications_Default
13
+ */
14
+ $helperData = Mage::helper('diglin_ricento');
15
+ ?>
16
+ <?php if (!$helperData->isConfigured()): ?>
17
+ <div class="notification-global">
18
+ <strong><?php echo $this->__('The Official ricardo.ch Extension has been installed.') ?></strong>
19
+ <?php echo $this->__('Please, click <a href="%s">here to configure</a> the access to the ricardo.ch API.', $helperData->getConfigurationUrl()); ?>
20
+ </div>
21
+ <?php endif ?>
app/design/adminhtml/default/default/template/ricento/notifications/expiration.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /**
12
+ * @var $this Diglin_Ricento_Block_Adminhtml_Notifications_Expiration
13
+ */
14
+
15
+ /* @var $website Mage_Core_Model_Website */
16
+ $website = Mage::app()->getWebsite();
17
+ // @fixme real multi website support - planned if needs come
18
+ //$websites = Mage::app()->getWebsites();
19
+ //foreach ($websites as $website) {
20
+ ?>
21
+ <?php if ($this->getApiReady()): ?>
22
+ <div class="notification-global">
23
+ <?php if ($this->isApiCredentialTokenExist($website)): ?>
24
+ <strong><?php echo $this->__('Your ricardo.ch API token credentials are going to expire in %s days for the website "%s".', $this->getExpirationNotificationDelay(), $website->getName());?></strong>
25
+ <?php else: ?>
26
+ <strong><?php echo $this->__('No ricardo.ch API Authorization have been found for the website "%s".', $website->getName());?></strong>
27
+ <?php endif; ?>
28
+ <?php
29
+ $validationUrl = $this->getValidationUrl($website);
30
+ if (empty($validationUrl)) {
31
+ echo Mage::helper('diglin_ricento')->__('Security error occurred with the ricardo API. Please, check your log files and your <a href="%s">API configuration</a>.', Mage::helper('diglin_ricento')->getConfigurationUrl($website));
32
+ } else {
33
+ echo $this->__('You have to authorize your account to get access to the ricardo.ch API thanks to the <a href="%s">ricardo.ch Authorization Page</a>. If you don\'t do it, your ricardo.ch extension and all related transactions with ricardo.ch will be blocked.',
34
+ $validationUrl); ?>
35
+ <?php } ?>
36
+ <?php echo $this->__('To hide this message, you have to <a href="%s">disable the extension</a>.', Mage::helper('diglin_ricento')->getConfigurationUrl($website)); ?>
37
+ </div>
38
+ <?php endif ?>
39
+ <?php //} ?>
app/design/adminhtml/default/default/template/ricento/payment/info/default.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <?php
13
+ /**
14
+ * @var $this Mage_Payment_Block_Info
15
+ */
16
+ ?>
17
+ <?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>:
18
+
19
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
20
+ <?php if (isset($_specificInfo['bid_ids'])): ?>
21
+ <div class="ricardo-payment-info">
22
+ <p><?php echo Mage::helper('diglin_ricento')->__('Transactions: <strong>%s</strong>', $_specificInfo['bid_ids']) ?></p>
23
+ <?php endif; ?>
24
+ <ul>
25
+ <li><?php echo implode(' / ', $_specificInfo['methods']) ?></li>
26
+ <?php if (isset($_specificInfo['information'])): ?><li><?php echo $this->escapeHtml($_specificInfo['information']); ?></li><?php endif; ?>
27
+ </ul>
28
+ </div>
29
+ <?php endif;?>
30
+
31
+ <?php echo $this->getChildHtml()?>
app/design/adminhtml/default/default/template/ricento/payment/info/pdf/default.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <?php
13
+ /**
14
+ * @see Mage_Payment_Block_Info
15
+ */
16
+ ?>
17
+ <?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}}
18
+
19
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
20
+ <?php if (isset($_specificInfo['bid_ids'])): ?>
21
+ <?php echo Mage::helper('diglin_ricento')->__('Transactions %s', $_specificInfo['bid_ids']) ?>
22
+ <?php endif; ?>
23
+ <?php foreach ($_specificInfo['methods'] as $_value):?>
24
+ <?php echo $_value ?>{{pdf_row_separator}}
25
+ <?php endforeach; ?>
26
+ <?php if (isset($_specificInfo['information'])): ?>
27
+ <?php echo $_specificInfo['information']; ?>{{pdf_row_separator}}
28
+ <?php endif; ?>
29
+
30
+ <?php endif;?>
31
+
32
+ <?php echo implode($this->getChildPdfAsArray(), '{{pdf_row_separator}}') ?>
app/design/adminhtml/default/default/template/ricento/products/category/children.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @var $this Diglin_Ricento_Block_Adminhtml_Products_Category_Children */
12
+ $level = $this->getLevel();
13
+ ?>
14
+ <nav class="span<?php echo $level?> navCat" id=navCatLvl<?php echo $level?>>
15
+ <ul class="nav nav-list">
16
+ <?php foreach ($this->getCategories() as $category): ?>
17
+ <li class="<?php if ($category->getIsFinal()): ?>final<?php endif; ?><?php if ($this->getSelectedCategoryId() == $category->getId()): ?> selected<?php endif; ?>" >
18
+ <a href="#"
19
+ data-category-id="<?php echo $category->getId(); ?>"
20
+ data-update-prefix = "navCatLvl"
21
+ data-level = "<?php echo $level; ?>"
22
+ data-update-level = "<?php echo $level + 1; ?>"
23
+ data-is-final = "<?php echo $category->getIsFinal(); ?>"
24
+ data-text = "<?php echo $category->getCategoryName(); ?>">
25
+ <?php if (!$category->getIsFinal()): ?>
26
+ <strong class="icon icon-plus">&gt;</strong>
27
+ <?php else: ?>
28
+ <strong class="icon icon-check">&nbsp;</strong>
29
+ <input type="radio" name="ricardo_category_id" id="ricardo_category_id<?php echo $category->getId(); ?>"
30
+ value="<?php echo $category->getId(); ?>"
31
+ <?php if ($this->getSelectedCategoryId() == $category->getId()): ?>checked="checked"<?php endif; ?>/>
32
+ <?php endif; ?>
33
+ <div>
34
+ <?php echo $category->getCategoryName(); ?>
35
+ </div>
36
+ </a>
37
+ </li>
38
+ <?php endforeach; ?>
39
+ </ul>
40
+ </nav>
app/design/adminhtml/default/default/template/ricento/products/category/mapping.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @var $this Diglin_Ricento_Block_Adminhtml_Products_Category_Mapping */
12
+ ?>
13
+ <div id="ricardo_categories" <?php if ($this->shouldResize()): ?>class="ricardo_categories_resized"<?php endif; ?>>
14
+ <form action="#" onsubmit="categoryMapper.submitForm(this); return false;">
15
+ <div class="form-buttons">
16
+ <button type="button" onclick="Ricento.closePopup()" class="cancel button" id="ricardo_categories_button_cancel"><span><?php echo $this->__('Cancel'); ?></span></button>
17
+ <button type="submit" class="save button" id="ricardo_categories_button_save"><span><?php echo $this->__('Confirm');?></span></button>
18
+ </div>
19
+ <?php
20
+ echo $this->getChildHtml('toplevel');
21
+ ?>
22
+ <div id="ricardo_children">
23
+ <?php
24
+ echo $this->getChildHtml('sublevel');
25
+ ?>
26
+ </div>
27
+ <input type="hidden" name="ricardo_category_selected_title" id="ricardo_category_selected_title" value="" />
28
+ <div class="form-buttons">
29
+ <button type="button" onclick="Ricento.closePopup()" class="cancel button" id="ricardo_categories_button_cancel"><span><?php echo $this->__('Cancel'); ?></span></button>
30
+ <button type="submit" class="save button" id="ricardo_categories_button_save"><span><?php echo $this->__('Confirm');?></span></button>
31
+ </div>
32
+ </form>
33
+ </div>
34
+
35
+ <script type="text/javascript">
36
+ categoryMapper = new Ricento.CategoryMappper({
37
+ wrapperElement : 'ricardo_categories',
38
+ loadChildrenUrl : '<?php echo $this->getUrl('ricento/products_category/children', array('id' => '#ID#', 'level' => '#LVL#')); ?>'
39
+ });
40
+ </script>
app/design/adminhtml/default/default/template/ricento/products/listing/item/edit/form.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ /* @var $this Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Edit_Form */ ?>
12
+ <div class="entry-edit">
13
+ <?php echo $this->getTabsHtml(); ?>
14
+ <?php echo $this->getFormHtml(); ?>
15
+ </div>
16
+ <?php echo $this->getChildHtml('form_after');?>
app/design/adminhtml/default/default/template/ricento/products/listing/item/preview.phtml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /* @var $this Diglin_Ricento_Block_Adminhtml_Products_Listing_Item_Preview */
13
+ ?>
14
+ <div class="product_item_preview">
15
+ <div id="messages">
16
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
17
+ </div>
18
+ <div class="breadcrumb"><?php echo implode(' > ', $this->getBreadcrumb()); ?></div>
19
+ <div class="container">
20
+ <div class="ricardo_title"><h1><?php echo $this->getProductItem()->getProductName(); ?></h1></div>
21
+ <div class="ricardo_subtitle"><h2><?php echo $this->getProduct()->getRicardoSubtitle(); ?></h2></div>
22
+ <div class="product_container1">
23
+ <div class="product_image">
24
+ <?php echo $this->getProductImage(); ?>
25
+ <?php if (count($this->getGalleryImages()) > 0): ?>
26
+ <div class="more-views">
27
+ <h2><?php echo $this->__('More Views') ?></h2>
28
+ <ul>
29
+ <?php foreach ($this->getGalleryImages() as $_image): ?>
30
+ <li>
31
+ <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>">
32
+ <?php echo $this->getProductImageThumbnail($_image); ?>
33
+ </a>
34
+ </li>
35
+ <?php endforeach; ?>
36
+ </ul>
37
+ </div>
38
+ <?php endif; ?>
39
+ </div>
40
+ <div class="schedule">
41
+ <div class="remaining_time"><?php echo $this->__('%s days 0:0:0', $this->getSalesOptions()->getSchedulePeriodDays()); ?></div>
42
+ <div class="starting_date"><?php echo $this->getStartingDate(); ?></div>
43
+ </div>
44
+ <div class="product_auction_buynow">
45
+ <?php if ($this->getSalesOptions()->getSalesType() == Diglin_Ricento_Model_Config_Source_Sales_Type::AUCTION) { ?>
46
+ <div class="row">
47
+ <div class="auction_box auction_container">
48
+ <div class="label"><?php echo $this->__('Starting price'); ?></div>
49
+ <div class="auction_price"><?php echo $this->getSalesAuctionStartPrice(); ?></div>
50
+ </div>
51
+ <div class="auction_box increment_container">
52
+ <div class="label"><?php echo $this->__('Increment'); ?></div>
53
+ <div class="increment_price"><input type="text" value="<?php echo round($this->getSalesOptions()->getSalesAuctionIncrement(), 2); ?>" id="increment" /></div>
54
+ </div>
55
+ <div class="auction_box button_bit">
56
+ <button type="button" class="scalable" title="<?php echo $this->__('Place a bit'); ?>"><span><span><?php echo $this->__('Place a bit'); ?></span></span></button>
57
+ </div>
58
+ </div>
59
+ <?php } ?>
60
+ <div class="row">
61
+ <div class="quantity">
62
+ <?php if ($this->getSalesOptions()->getStockManagement() > 1): ?>
63
+ <label for="quantity"><?php echo $this->__('Quantity'); ?></label>
64
+ <input type="text" id="quantity" name="quantity" value="1" /><?php echo $this->__('of %s', $this->getSalesOptions()->getStockManagement()); ?>
65
+ <?php endif; ?>
66
+ </div>
67
+ <?php if ($this->getSalesOptions()->getSalesType() == Diglin_Ricento_Model_Config_Source_Sales_Type::BUYNOW || $this->getSalesOptions()->getSalesAuctionDirectBuy()): ?>
68
+ <?php $price = $this->getProductPrice(); ?>
69
+ <?php if ($price): ?>
70
+ <div class="buy_now">
71
+ <div class="label"><?php echo $price; ?></div>
72
+ <div class="button"><button type="button" class="scalable save" title="<?php echo $this->__('Buy now'); ?>"><span><span><?php echo $this->__('Buy now'); ?></span></span></button></div>
73
+ </div>
74
+ <?php endif; ?>
75
+ <?php endif; ?>
76
+ </div>
77
+ </div>
78
+ <div class="product_options">
79
+ <h2><?php echo $this->__('Details'); ?></h2>
80
+ <ul>
81
+ <li><span class="label"><?php echo $this->__('Ending date:'); ?></span><span class="option"><?php echo $this->getEndingDate(); ?></span></li>
82
+ <li><span class="label"><?php echo $this->__('Availability:'); ?></span><span class="option"><?php echo $this->getShippingAvailability(); ?></span></li>
83
+ <li><span class="label"><?php echo $this->__('Product condition:'); ?></span><span class="option"><?php echo $this->getProductCondition(); ?></span></li>
84
+ <li><span class="label"><?php echo $this->__('Payment information:'); ?></span><span class="option"><?php echo implode(', ', $this->getPaymentMethods()); ?></span></li>
85
+ <li><span class="label"><?php echo $this->__('Shipping Method (CH):'); ?></span><span class="option"><?php echo $this->getShippingMethod(); ?></span></li>
86
+ </ul>
87
+ </div>
88
+ </div>
89
+ <div class="clear"></div>
90
+ <div class="product_container2">
91
+ <ul class="navigation">
92
+ <li class="tab"><a href="#description" class="nav-description"><?php echo $this->__('Description'); ?></a></li>
93
+ <li class="tab"><a href="#additional" class="nav-additional"><?php echo $this->__('Payment, Shipping, Warranty'); ?></a></li>
94
+ </ul>
95
+
96
+ <div class="description">
97
+ <a name="description"></a>
98
+ <h2><?php echo $this->getProductItem()->getProductName(); ?></h2>
99
+ <p><?php echo nl2br($this->getProductItem()->getProductDescription()); ?></p>
100
+ </div>
101
+ <div class="additional">
102
+ <a name="additional"></a>
103
+ <h2><?php echo $this->__('Payment, Shipping, Warranty'); ?></h2>
104
+
105
+ <h3><?php echo $this->__('Payment information'); ?></h3>
106
+ <ul class="payment_methods">
107
+ <li><span class="label"><?php echo $this->__('Payment Methods:'); ?></span><?php echo implode(', ', $this->getPaymentMethods()); ?></li>
108
+ <?php if ($this->getOtherPaymentMethod()) {?>
109
+ <li><span class="label"><?php echo $this->__('Payment Description:'); ?></span></li>
110
+ <li><span class="option"><?php echo $this->getOtherPaymentMethodText(); ?></span></li>
111
+ <?php }; ?>
112
+ </ul>
113
+ <h3><?php echo $this->__('Shipping'); ?></h3>
114
+ <ul class="shipping_method">
115
+ <li><span class="label"><?php echo $this->__('Shipping Price:', Diglin_Ricento_Helper_Data::ALLOWED_CURRENCY); ?></span><span class="option"><?php echo $this->getShippingPrice(); ?></span></li>
116
+ <li><span class="label"><?php echo $this->__('Shipping Availability:'); ?></span><span class="option"><?php echo $this->getShippingAvailability(); ?></span></li>
117
+ <li><span class="label"><?php echo $this->__('Shipping Method (CH):'); ?></span><span class="option"><?php echo $this->getShippingMethod(); ?></span></li>
118
+ <?php if ($this->getOtherShippingMethodText()) { ?>
119
+ <li><span class="label"><?php echo $this->__('Shipping Description (CH):'); ?></span></li>
120
+ <li><span class="option"><?php echo $this->getOtherShippingMethodText(); ?></span></li>
121
+ <?php }; ?>
122
+ </ul>
123
+ <h3><?php echo $this->__('Warranty'); ?></h3>
124
+ <ul><li><?php echo $this->getWarranty(); ?></li></ul>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
app/design/adminhtml/default/default/template/ricento/support.phtml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * @todo:
14
+ * - Provide in the mailto information about the user or shop
15
+ * - replace mailto with a form to allow to get the configuration/log of the user for the support
16
+ * - to translate
17
+ */
18
+ ?>
19
+ <div class="content-header" style="visibility: visible;">
20
+ <table cellspacing="0">
21
+ <tbody>
22
+ <tr>
23
+ <td style="width: 50%;">
24
+ <h3 class="icon-head head-categories"><?php echo $this->getTitle() ?></h3>
25
+ </td>
26
+ </tr>
27
+ </tbody>
28
+ </table>
29
+ </div>
30
+ <div class="ricardo-support">
31
+ <div class="knowledge-base"><a href="http://diglin.zendesk.com/" target="_blank"><img src="<?php echo $this->getSkinUrl('ricento/images/KB.png'); ?>" title="Knowledge Base" alt="Knowledge Base" /></a></div>
32
+ <div class="contact"><a href="mailto:support@diglin.com?subject=Support for Ricento Extension"><img src="<?php echo $this->getSkinUrl('ricento/images/contact.png'); ?>" title="Contact" alt="Contact" /></a></div>
33
+ <div class="github"><a href="https://github.com/diglin/ricento" target="_blank"><img src="<?php echo $this->getSkinUrl('ricento/images/github.png'); ?>" title="Github" alt="Github" /></a></div>
34
+ </div>
35
+ <div class="clear"></div>
36
+ <div class="ricardo-diglin">
37
+ <div class="logo">
38
+ <a href="http://www.ricardo.ch"><img src="<?php echo $this->getSkinUrl('ricento/images/ricardo@2x.png'); ?>"
39
+ width="290px"
40
+ title="ricardo.ch" alt="ricardo.ch" /></a>
41
+ <a href="http://www.diglin.com"><img src="<?php echo $this->getSkinUrl('ricento/images/diglin@2x.png'); ?>"
42
+ width="290px"
43
+ title="diglin.com ecommerce solutions" alt="diglin.com ecommerce solutions" /></a>
44
+ <div class="clear"></div>
45
+ </div>
46
+ <div class="information">
47
+ <h2>Version</h2>
48
+ <p>You use the version: <strong>Diglin_Ricento v.<?php echo Mage::getConfig()->getModuleConfig
49
+ ('Diglin_Ricento')->version; ?></strong></p>
50
+ <h2>License & support</h2>
51
+ <p>This extension has been realized for <a href="http://www.ricardo.ch">ricardo.ch</a> in collaboration with
52
+ <a href="http://www.diglin.com">Diglin GmbH</a>. This extension is licensed under the <a
53
+ href="http://opensource
54
+ .org/licenses/osl-3.0.php">OSL 3.0</a> license. <a href="http://www.ricardo.ch">ricardo.ch</a> or <a
55
+ href="http://www.diglin.com">Diglin GmbH</a> are not responsible for any damages or lost. Support may be provided free of
56
+ charge or against payment depending on the support needed e.g. Installation, Configuration,
57
+ Custom development, Problem due to conflict with other extensions or misusing,
58
+ etc. <a href="mailto:support@diglin.com?subject=Support for Ricento Extension">Contact us</a> for details.</p>
59
+ <h2>Imprint</h2>
60
+ <div class="ricardo-imprint">
61
+ <p>ricardo.ch AG</p>
62
+ <p>General-Guisan-Strasse 8</p>
63
+ <p>6304 Zug</p>
64
+ <div class="clear"></div>
65
+ </div>
66
+ <div class="diglin-imprint">
67
+ <p>Diglin GmbH</p>
68
+ <p>Rütistrasse 14</p>
69
+ <p>8952 Schlieren</p>
70
+ <p>Email: <a href="mailto:support@diglin.com?subject=Ricento Contact">Contact us</a></p>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ <div class="clear"></div>
app/design/adminhtml/default/default/template/ricento/sync/check/popup.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ $messages = $this->getMessages();
13
+ $helper = Mage::helper('diglin_ricento');
14
+ ?>
15
+ <div class="sync_job_popup">
16
+ <h1><?php echo $helper->__('Latest message for the selected job'); ?></h1>
17
+ <p><?php echo $helper->__('<a href="%s">Edit</a> your products listing if needed', $this->getUrl('*/products_listing/edit', array('id' => $this->getProductsListingId()))); ?></p>
18
+ <div id="messages">
19
+ <ul class="messages">
20
+ <?php if (count($messages)) { ?>
21
+ <?php foreach ($messages as $message) { ?>
22
+
23
+ <?php if (isset($message['name'])) { ?>
24
+ <h2><?php echo $message['name'] ?></h2>
25
+ <?php } ?>
26
+ <?php if (isset($message['errors'])) { ?>
27
+ <li class="error-msg">
28
+ <ul>
29
+ <?php foreach ($message['errors'] as $error) { ?>
30
+ <li><span><?php echo $error ?></span></li>
31
+ <?php } ?>
32
+ </ul>
33
+ </li>
34
+ <?php } ?>
35
+ <?php if (isset($message['warnings'])) { ?>
36
+ <li class="notice-msg">
37
+ <ul>
38
+ <?php foreach ($message['warnings'] as $warning) { ?>
39
+ <li><span><?php echo $warning ?></span></li>
40
+ <?php } ?>
41
+ </ul>
42
+ </li>
43
+ <?php } ?>
44
+ <?php } ?>
45
+ <?php } else { ?>
46
+ <li class="notice-msg">
47
+ <ul>
48
+ <li><span><?php echo $this->__('No message found.') ?></span></li>
49
+ </ul>
50
+ </li>
51
+ <?php } ?>
52
+ </ul>
53
+ </div>
54
+ </div>
app/design/frontend/base/default/template/ricento/payment/info/default.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category Diglin
7
+ * @package Diglin_Ricento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ ?>
12
+ <?php
13
+ /**
14
+ * @var $this Mage_Payment_Block_Info
15
+ */
16
+ ?>
17
+ <?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>:
18
+
19
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
20
+ <?php if (isset($_specificInfo['bid_ids'])): ?>
21
+ <div class="ricardo-payment-info">
22
+ <p><?php echo Mage::helper('diglin_ricento')->__('Transactions: <strong>%s</strong>', $_specificInfo['bid_ids']) ?></p>
23
+ <?php endif; ?>
24
+ <ul>
25
+ <li><?php echo implode(' / ', $_specificInfo['methods']) ?></li>
26
+ <?php if (isset($_specificInfo['information'])): ?><li><?php echo $this->escapeHtml($_specificInfo['information']); ?></li><?php endif; ?>
27
+ </ul>
28
+ </div>
29
+ <?php endif;?>
30
+
31
+ <?php echo $this->getChildHtml()?>
app/etc/modules/Diglin_Ricento.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Diglin_Ricento>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ <Mage_Shipping />
10
+ <Mage_Catalog />
11
+ <Mage_Sales />
12
+ <Mage_Customer />
13
+ </depends>
14
+ </Diglin_Ricento>
15
+ </modules>
16
+ </config>
app/locale/de_CH/Diglin_Ricento.csv ADDED
@@ -0,0 +1,665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "ricardo.ch","ricardo.ch"
2
+ "Dashboard","Dashboard"
3
+ "Products Listing","Produktübersicht"
4
+ "Logs","Logs"
5
+ "ricardo.ch Assistant","ricardo.ch Assistent"
6
+ "Configuration","Konfiguration"
7
+ "Ricento by Diglin GmbH","Ricento von der Diglin GmbH"
8
+ "Log","Log"
9
+ "ricardo.ch Payment Methods","ricardo.ch Zahlarten"
10
+ "ricardo.ch Shipping","ricardo.ch Versandarten"
11
+ "Admin Email Notification","Admin Email Benachrichtigung"
12
+ "Private message","Private Nachricht"
13
+ "Global Configuration","Globale Konfiguration"
14
+ "Merge Order","Bestellungen zusammenfassen"
15
+ "If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?","Wenn ein Kunde mehrere Produkte innerhalb von 30 Minuten bestellt, möchten Sie, dass die Bestellungen zusammengefasst werden?"
16
+ "Shipping Calculation","Versandkosten-Kalkulation"
17
+ "You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>","Sie können entscheiden, wie die Versandkosten berechnet werden, wenn eine Bestellung zusammengefasst wurde.<br>"
18
+ " ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>","""Höchster Preis"": Diese Methode findet das Produkt mit den höchsten Versandkosten und nutzt diesen Versandkosten für die Gesamtsumme.<br>"
19
+ " ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.","""Kumulativ"": diese Methode addiert die Versandkosten der einzelnen Produkte"
20
+ "Send Account Creation Confirmation Email","Sende Willkommensbestätigung per Mail"
21
+ "Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?","Möchten Sie eine Bestätigungsmail (via ricardo.ch API) senden, wenn ein Kunde ein Konto erstellt hat?"
22
+ "Send Email for new order","Sende Email beim Eingang einer neuen Bestellung"
23
+ "Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Möchten Sie eine Bestätigungsmail (via ricardo.ch API) senden, wenn ein Kunde ein Konto erstellt hat?"
24
+ "API Token Configuration","API Token Konfiguration"
25
+ "General API Config","Allgemeine API Konfiguration"
26
+ "ricardo.ch Extension enabled","ricardo.ch Extension aktiviert"
27
+ "Development Mode","Entwicklermodus"
28
+ "If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below.","Wenn Sie diese Funktion aktivieren, werden alle API-Anfragen an die ricardo.ch BETA Umgebubg verschickt. Stellen Sie sicher, dass Sie die dafür passenden API-Keys und Passwörter eingetragen haben."
29
+ "Debug","Debug"
30
+ "Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast.","In diesem Modus werden alle Anfragen an die ricardo.ch-API in die Datei var/log/ricento.log geschrieben. Aktivieren Sie diesen Modus, wenn Sie Probleme haben und schicken Sie uns diese Datei zu. Damit können wir Ihnen helfen. Die Passwörter werden anonymisiert. Achtung: Das Log Datei Grösse kann schnell wachsen."
31
+ "German API Token","Deutscher API Token"
32
+ "PROD German Partner Key","PROD Deutscher Partner Schlüssel"
33
+ "Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Der Partner Schlüssel hat das folgende Format: '0F12345-1234-1234-1234-1234567890'. Sie müssen sich für die ricardo.ch API anmelden, um diesen Schlüssel zu bekommen. Klicken Sie dazu auf den Button oben auf der Seite."
34
+ "PROD German Partner Password","PROD Deutsches Partner Passwort"
35
+ "You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Sie müssen sich für die ricardo.ch API anmelden, um diesen Schlüssel zu bekommen. Klicken Sie dazu auf den Button oben auf der Seite."
36
+ "DEV German Partner Key","Entwicklermodus deutscher Partner Schlüssel"
37
+ "DEV German Partner Password","Entwicklermodus deutsches Partner Passwort"
38
+ "French API Token","Französischer API Token"
39
+ "PROD French Partner Key","PROD Französischer Partner Schlüssel"
40
+ "PROD French Partner Password","PROD Französischer Partner Passwort"
41
+ "DEV French Partner Key","Entwicklermodus französischer Partner Schlüssel"
42
+ "DEV French Partner Password","Entwicklermodus französischer Partner Passwort"
43
+ "Cleanup Synchronization Jobs Log","Leere Log für Synchronisation-Jobs"
44
+ "Enabled","Aktiviert"
45
+ "Keep for X days","Halte für x Tage vor"
46
+ "Cleanup Listings Log","Leere Log für Produktlisten"
47
+ "ricardo.ch API Payment Methods","ricardo.ch API Zahlungsarten"
48
+ "Bank Transfer Instructions","Instruktionen Bank-Ãœberweisung"
49
+ "Accepted Currency","Akzeptierte Währung"
50
+ "Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold","Lagerbestand auf 1 gesetzt, da die Zahlart ""Direkt Kaufen"" nicht mehr als einen Artikel erlaubt."
51
+ "Invalid start date.","Ungültiges Startdatum"
52
+ "The end date must be in the future.","Das Enddatum muss in der Zukunft liegen."
53
+ "Listed listings cannot be modified. Stop the listing first to make changes.","Aktive Listungen können nicht verändert werden. Beenden Sie die Listung, um Änderungen vornehmen zu können."
54
+ "An error occurred while saving the configuration.","Ein Fehler trat beim Speichern der Konfiguration auf."
55
+ "ricardo.ch Service Model doesn\'t exists.","ricardo.ch Service Model existiert nicht."
56
+ "ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed.","ricardo.ch API Daten sind nicht vorhanden. Bitte tragen Sie zunächst die Daten ein."
57
+ "API language provided for the Service Manager is not supported.","API Sprache für den Service Manager wird nicht unterstützt."
58
+ "Error while trying to connect to the ricardo.ch API. Please, check your log files.","Fehler beim Verbinden mit der ricardo.ch API. Bitte checken Sie Ihre Log Dateien, um eine genauere Fehlerbeschreibung zu erhalten."
59
+ "The format of the token is invalid","Das Format des Tokens ist ungültig."
60
+ "The dispatcher of type '%s' is not found at %s.","The dispatcher of type '%s' is not found at %s."
61
+ "Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract.","Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract."
62
+ "The product has been sold","Das Produkt wurde verkauft."
63
+ "Customer creation failed! ricardo.ch transaction cannot be added.","Kunde konnte nicht angelegt werden. ricardo.ch Bestellung konnte nicht übertragen werden."
64
+ "Order automatically generated by the ricardo.ch Extension.","Bestellung(en) wurde(n) automatisch durch das ricardo.ch Modul erstellt."
65
+ "Payment is pending","Bezahlung ausstehend"
66
+ "Payment has been completed on ricardo.ch side","Bezahlung wurde bei ricardo.ch durchgeführt."
67
+ "Order canceled on ricardo.ch side","Bezahlung wurd bei ricardo.ch storniert."
68
+ "Country Code is not available. Please contact the author of this extension or support.","Ländercode ist nicht verfügbar. Bitte kontaktieren Sie den Autor dieses Moduls für Support."
69
+ "Report: %d success, %d warning(s), %d error(s)","Report: %d erfolgreich, %d Warnung(en), %d Fehler"
70
+ "Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">click here</a>. Products with an error won\'t be synchronized, you have to fix the problem first.","Erfolgreich geprüfte Produkte werden gelistet. Um Produkte mit Warnungen zu listen, klick Sie bitte <a href=""%s"">hier</a>. Produkte mit Fehlern werden nicht übertragen, Sie müssen die Fehler zuerst beheben."
71
+ "The product is now live on ricardo.ch","Das Produkt ist nun live auf ricardo.ch."
72
+ "Sorry, the product has not been sold","Sorry, das Produkt wurde nicht verkauft."
73
+ "This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch","Der Artikel ist bereits gelistet oder hat bereits eine Artikelnummer bei ricardo.ch."
74
+ "The product has been removed from ricardo.ch","Das Produkt wurde bei ricardo.ch entfernt."
75
+ "The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it.","Das Produkt wurde nicht bei ricardo.ch entfernt. Wahrscheinlich weil jemand für das Produkt geboten oder es gekauft hat."
76
+ "Report: %d success, %d error(s)","Report: %d erfolgreich, %d Fehler"
77
+ "errors","Fehler"
78
+ "warnings","Warnungen"
79
+ "success","Erfolgreich"
80
+ "The Job has finished with %s.","Der Job wurd mit %s beendet."
81
+ "Please, view the <a href=""%s"">log</a> for details.","Bitte schauen Sie in den <a href=""%s"">Log</a> für Details."
82
+ "No item is ready for this job. No action has been done.","Das Produkt ist bereit für den Job. Es wurde keine Aktion durchgeführt."
83
+ "Error Code: %d","Fehlercode: %d"
84
+ "Notice","Hinweis"
85
+ "Success","Erfolgreich"
86
+ "Error","Fehler"
87
+ "Warning","Warnung"
88
+ "Product item checks","Produkte geprüft"
89
+ "List product item to ricardo.ch","Ãœbertrage Produkt zu ricardo.ch"
90
+ "Stop product item to ricardo.ch","Stoppe Produkt bei ricardo.ch"
91
+ "Default Values","Standardwerte"
92
+ "No package","Kein Paket"
93
+ "-- Select Product Attribute --","-- Wähle Produkt Attribut --"
94
+ "-- Select Method --","-- Wähle Methode --"
95
+ "No change","Keine Änderung"
96
+ "Relative increase (+ %)","Relative Erhöhung (+ %)"
97
+ "Relative decrease (- %)","Relativer Rückgang (- %)"
98
+ "Absolute increase (+)","Absolute Erhöhung (+)"
99
+ "Absolute decrease (-)","Absoluter Rückgang (-)"
100
+ "None","Keine"
101
+ "ricardo.ch Condition","ricardo.ch Konditionen"
102
+ "-- Please Select --","-- Bitte wählen --"
103
+ "Auction","Auktion"
104
+ "Buy now","Sofort-Kaufen"
105
+ "Highest Price","Höchster Preis"
106
+ "Cumulative","Kumulativ"
107
+ "Pending","Verarbeitung"
108
+ "Running","Laufend"
109
+ "Ready","Fertig"
110
+ "Completed","Komplett"
111
+ "Products Check Job","Produkt-Check Job"
112
+ "List Job","List Job"
113
+ "Stop List Job","Stop Einstellen Job"
114
+ "Sync Order Job","Sync Bestellung Job"
115
+ "Relist Job","Reaktivierung Job"
116
+ "Update Job","Update Job"
117
+ "Sync List Job","Sync Einstellen Job"
118
+ "-- Please select --","-- Bitte wählen --"
119
+ "All languages","Alle Sprachen"
120
+ "Listed","Eingestellt"
121
+ "Stopped","Beendet"
122
+ "Ready to list","Bereit zum Einstellen"
123
+ "Check in progress...","Prüfung läuft..."
124
+ "List in progress...","Einstellen läuft..."
125
+ "Job in progress...","Job läuft..."
126
+ "Product Title will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Titel wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
127
+ "Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Untertitel wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
128
+ "Product Description will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Beschreibung wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
129
+ "Custom Options are not supported. Those won\'t be synchronized into ricardo.ch.","Individuelle Optionen werden nicht unterstützt. Sie werden nicht zu ricardo.ch übertragen und ignoriert."
130
+ "The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock.","Das Hauptprodukt oder seine verknüpften Produkte sind nicht auf Lager oder der Lagerbestand ist nicht hoch genug."
131
+ "Only %s currency is supported. No conversion will be done.","Nur die Währung %s wird unterstützt. Es wird keine Umrechnung vorgenommen."
132
+ "You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level.","Sie müssen eine ricardo.ch-Kategorie für dieses Produkt wählen. Prüfen Sie, ob Sie das Produkt auf Produktlisting-Level oder Magento-Kategorie-Level gesetzt haben."
133
+ "Payment and/or Shipping combination are not correct.","Zahlung und/oder Versand-Kombination sind nicht korrekt."
134
+ "You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s.","Sie können keinen Startpreis für eine Auktion von %2$s festlegen, wenn Sie ""Sofort-Kaufen"" mit dem Produktpreis von %1$s anbieten."
135
+ "Product Price of %s CHF is incorrect for a direct sales with credit card. Price must be between %s and %s.","Aus Sicherheitsgründen ist eine Kreditkarten-Zahlung bei Beträgen von CHF %s.- nicht möglich für ""Sofort-Kaufen"". Bitte wählen Sie andere Zahlungsmethoden oder passen Sie den Preis an. Der Preis muss zwischen %s und %s liegen."
136
+ "The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days","Das Enddatum ist zu früh oder zu spät. Minimale erlaubte Zeitspanne: %s Tage - maximale erlaubte Zeitspanne: %s Tage"
137
+ "You cannot use the privilege spaces as you do not have any pictures for this product.","Sie können keine Sonderfelder nutzen, da Sie keine Bilder für dieses Produkt hinterlegt haben."
138
+ "This increment value is not possible for this start price.","Der angegebene Erhöhungsschritt ist nicht möglich für diesen Startpreis."
139
+ "Only the following combinations are possible:","Nur die folgenden Kombinationen sind möglich:"
140
+ "Start price is between","Startpreis ist zwischen"
141
+ "Increment must be between","Erhöhungsschritt muss sein zwischen "
142
+ "This payment method combination is not possible.","Diese Zahlmethoden-Kombination ist nicht möglich."
143
+ "The following combinations are possible:","Die folgenden Kombinationen sind möglich:"
144
+ "It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method","Es ist nicht möglich, die Versandmethode ""Andere"" mit der Zahlmethoden ""Kreditkarte"" zu kombinieren."
145
+ "No category will be displayed, the products listing doesn\'t exists. Please, close the window.","Keine Kategorie wird angezeigt, das Produktlisting existiert nicht. Bitte schliessen Sie das Fenster."
146
+ "You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window.","Sie dürfen dieses Produktlisting nicht speichern. Es können keine Produkte von einer Kategorie hinzufügen. Bitte schliessen Sie das Fenster."
147
+ "Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists.","Produkte von den gewählten Kategorien können nicht gespeichert werden. Das Produktlisting existiert nicht."
148
+ "You are not allowed to save the products listing, so you cannot add products from a category.","Sie dürfen dieses Produktlisting nicht speichern. Es können keine Produkte von einer Kategorie hinzufügen. "
149
+ "%d product(s) added to the listing","%d Produkte zum Produktlisting hinzugefügt."
150
+ "Error occurred while saving the product(s) from the selected categories. Please check your exception log.","Fehler traten auf während des Speicherns der gewählten Kategorien. Bitte prüfen Sie den Fehlerlog."
151
+ "The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","Die Aktion, die Sie durchführen wollen, ist nicht möglich. Sie müssen zunächst das API Token authorisieren. Bitte gehen Sie zur <a href=""%s"">ricardo.ch Authorisierungsseite</a> um den Authorisierungsprozess durchzuführen."
152
+ "Listing name and website must be specified.","Listingname und Webseite müssen definiert werden."
153
+ "We have detected and set for you the language configuration. Please, review it before to go further.","Wir haben die Sprache für Sie vorausgewählt. Bitte prüfen Sie, ob die Wahl richtig ist, bevor Sie fortfahren."
154
+ "The listing has been saved.","Das Listing wurde gespeichert."
155
+ "An error occurred while saving the listing.","Beim Speichern des Listings trat ein Fehler auf."
156
+ "Listed listings cannot be deleted. Stop the listing first.","Aktive Listings können nicht gelöscht werden. Stoppen Sie die Listings zuerst."
157
+ "Listing deleted","Listing entfernt"
158
+ "%d products removed from listing","%d Produkte vom Listing entfernt."
159
+ "%d products are listed and could not be removed","%d Produkte sind aktiv gelistet und können nicht entfernt werden."
160
+ "The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire.","Der API Token und die Konfiguration sind nicht fertig eingerichtet, diese Aktion ist nicht erlaubt. Bitte prüfen Sie, dass der Token aktiv ist und die Gültigkeit nicht ausläuft."
161
+ "A similar job is already running. This job won\'t be executed.","Es läuft bereits ein Vorgang. Ihre Aktion wird nicht ausgeführt."
162
+ "It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","Es ist nicht möglich, diese Aktion durchzuführen. Sie müssen den API Token zunächst authorisieren. Bitte gehen Sie zur <a href=""%s"">ricardo.ch Authorisierungsseite</a> um den Authorisierungsprozess durchzurführen."
163
+ "An error occurred while starting this job. Please check your log file.","Ein Fehler trat auf beim Start des Vorgangs. Bitte schauen Sie in den Fehlerlog."
164
+ "The job to check your products listing will start in few minutes. You can check the progression below.","Der Vorgang um Ihre Produktlistings zu überprüfen wird in wenigen Minuten starten. Sie können den Fortschritt unten einsehen."
165
+ "If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues.","Wenn erfolgreich beendet, werden Ihre Produkte automatisch aktiv gelistet. Falls Fehler auftreten, müssen Sie entscheiden, ob das Listing fortgesetzt oder überprüft werden soll."
166
+ "There is no product ready to be listed. Please, add products to your products listing ""%s"".","Kein Produkt ist bereit um eingestellt zu werden. Bitte fügen Sie Produkt zu Ihrem Produktlisting ""%s"" hinzu."
167
+ "There is no pending product to check.","Kein zu prüfendes Produkt vorhanden"
168
+ "The job to list your products listing will start in few minutes.","Der Vorgang zur Einstellung Ihrer Produkte wird in wenigen Minuten beginnen."
169
+ "You can check the progression below.","Sie können den Fortschritten unten einsehen."
170
+ "There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d.","Es gibt kein Produkt zum reaktivieren. Nur Produkte, die schon mal auf ricardo.ch.ch gelistet wurden, können wieder aktiviert werden für das Produktlisting %d."
171
+ "Only listed product items can be stopped.","Nur aktive gelistete Produkte können deaktiviert werden."
172
+ "The job to stop to list your products will start in few minutes.","Der Vorgang um Ihre Produkte zu beenden wird in wenigen Minuten beginnen."
173
+ "Products listing(s) is/are successfully deleted.","Produktlisting(s) wurde(n) erfolgreich gelöscht."
174
+ "The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode(","Die folgenden Produktlisting-IDs wurden nicht gelöscht, da Sie immer noch aktiv auf ricardo.ch gelistet sind:"
175
+ "An error occurred while trying to delete the products listing(s). Please, check your exception log.","Beim Löschen des/der Produktlisting(s) trat ein Fehler auf. Bitte schauen Sie in Ihre Fehlerlog."
176
+ "No products selected.","Keine Produkte gewählt."
177
+ "The configuration has been saved successfully.","Die Konfiguration wurde erfolgreich gespeichert."
178
+ "An error occurred while saving the configuration. Please, check your log files for more details.","Beim Speichern der Konfiguration trat ein Fehler auf. Bitte schauen Sie in den Fehlerlog für weitere Informationen."
179
+ "It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different.","Dies ist nur eine Vorschau. Bitte denken Sie daran, dass die Darstellung auf ricardo.ch unterschiedlich sein kann."
180
+ "Log(s) is/are successfully deleted.","Log(s) wurde(n) erfolgreich gelöscht."
181
+ "An error occurred while trying to delete the listing log(s). Please, check your exception log.","Beim Löschen der Listing-Logs trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
182
+ "Job(s) is/are successfully deleted.","Aktion(en) erfolgreich gelöscht."
183
+ "The following job IDs have not been deleted because they are still running: %s","Die folgenden Aktions-IDs wurden nicht gelöscht, da Sie immer noch aktiv sind."
184
+ "An error occurred while trying to delete the job(s). Please, check your exception log.","Beim Löschen der Aktion(en) trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
185
+ "ricardo.ch API Signup","ricardo.ch API Anmeldung"
186
+ "API Signup","API Anmeldung"
187
+ "ricardo.ch Assistant Portal","ricardo.ch Verkäuferportal"
188
+ "Assistant Portal","Verkäuferportal"
189
+ "Only Ajax call is allowed here.","Hier ist nur ein Ajax-Aufruf erlaubt."
190
+ "The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side.","Der Website Code von ricardo.ch ist nicht korrekt. Die Authorisierung konnte auf Seiten von Magento nicht gespeichert werden."
191
+ "Your ricardo.ch account has been authorized to get access to the API.","Ihr ricardo.ch-Konto wurde erfolgreich authorisiert, um Zugang zur API zu erhalten."
192
+ "An error occurred while saving the token. Please, check your log files.","Beim Speichern des Tokens trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
193
+ "Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason.","Die Authorisierung wurde von ricardo.ch zurückgewiesen. Bitte kontaktieren Sie ricardo.ch um den Grund zu erfahren."
194
+ "Sign Up to ricardo.ch API","Anmeldung zur ricardo.ch API"
195
+ "API Authorization","API Authorisierung"
196
+ "No Selection","Keine Auswahl"
197
+ "Open ricardo.ch Category Window","Öffne ricardo.ch Kategorien Fenster"
198
+ "Add products from selected categories","Füge Produkte von gewählten Kategorien hinzu"
199
+ "Only product types supported, enabled and not listed in other products listing will be added.","Nur Produkte, deren Typ unterstützt wird, die aktiv und nicht bereits gelistet sind, werden hinzugefügt."
200
+ "Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories.","Bitte achten Sie darauf, auch die Unterkategorien zu wählen. Wenn Sie nur eine Oberkategorie wählen können Produkte nicht zu deren Unterkategorien hinzugefügt werden."
201
+ "Create new listing","Erstelle neues Listing."
202
+ "Show Synchronization Jobs","Zeige Synchronisierung-Aufträge"
203
+ "General","Allgemeine API Konfiguration"
204
+ "Products","Produkte"
205
+ "Sales Options","Verkaufsoptionen"
206
+ "Rules","Regeln"
207
+ "Product ID","Produkt ID"
208
+ "Name","Name"
209
+ "Price","Preis"
210
+ "Type","Typ"
211
+ "SKU","Artikelnummer"
212
+ "Inventory","Lagerbestand"
213
+ "Status","Status"
214
+ "Action","Aktion"
215
+ "Preview","Vorschau"
216
+ "Configure","Konfiguriere"
217
+ "Remove","Löschen"
218
+ "Are you sure to remove this/these product(s)?","Sind Sie sicher, dass Sie diese Produkte löschen möchten?"
219
+ "Remove from list","Von der Liste löschen"
220
+ "the sales options","Die Verkaufsoptionen"
221
+ "the shipping and payment rules","Die Regeln für Versand- und Zahlungsarten."
222
+ "This product has been configured for %s %s","Diese Produkte wurde konfiguriert für %s %s"
223
+ "The product has custom options, those will not be added to ricardo.ch!","Das Produkt hat individuelle Optionen, diese werden nicht zu ricardo.ch übertragen."
224
+ "ID","ID"
225
+ "Add selected product(s)","Fügen Sie gewählte Produkte hinzu"
226
+ "Title","Titel"
227
+ "Website","Website"
228
+ "Language","Sprache"
229
+ "Product languages to synchronize to ricardo.ch","Produktsprachen, die mit ricardo.ch synchronisiert werden sollen."
230
+ "ricardo.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc).","ricardo.ch unterstützt zur Zeit nur zwei Sprachen: Deutsch und Französisch. Sie können wählen, in welcher Sprache Sie die Produktinfos übertragen möchten (Titel, Untertitel, Beschreibung, etc)."
231
+ "Default language to publish","Standardsprache bei der Veröffentlichung."
232
+ "Which language to publish by default to ricardo.ch when the product content is not available in a language?","Welche Sprache soll standarmässig zur Veröffentlichung bei ricardo.ch gewählt werden, wenn Produktinfos in gewüschter Sprache nicht verfügbar sind?"
233
+ "Store View for %s","Store View für %s"
234
+ "Payment Methods","Zahlungsarten"
235
+ "Payment Description German","Zahlungsarten Beschreibung deutsch"
236
+ "Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other""","Zeichen: %s. Max. 5 000 Zeichen. Information zu den Zahlungsarten für die Kunden. Diese Infos werden zu ricardo.ch nur übertragen, wenn Sie die Zahlart ""Andere"" wählen"
237
+ "Payment Description French","Beschreibung Zahlungsarten Französisch"
238
+ "Shipping Methods","Versandarten"
239
+ "Shipping Price","Versandkosten"
240
+ "Free shipping","kostenloser Versand"
241
+ "Is Shipping fee cumulative","Sind Versandkosten kumulativ"
242
+ "If you select this option, the shipping fee will be calculate for each sold product.","Wenn Sie diese Option wählen, werden die Versandkosten für jedes verkaufte Produkt einzelnd berechnet."
243
+ "e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option.","z. B. ein Artikel wird mit der Menge 3 von einem Kunden gekauft und die Versandkosten liegen bei jeweils 15 CHF. Die Versandkosten sind dann insgesamt 45 CHF. Lassen Sie das Feld leer, wenn Sie diese Option nicht wählen möchten."
244
+ "Shipping Availability","Verfügbarkeit des Artikels"
245
+ "Shipping Description German","Versandbeschreibung deutsch"
246
+ "Characters: %s. Max. 5 000 characters","Zeichen: %s. Max. 5 000 Zeichen"
247
+ "Shipping Description French","Versandbeschreibung französisch"
248
+ "The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed.","Die Standardwährung dieses Stores ist {$storeCurrency}. Nur %s ist als Währung erlaubt. Die Preise werde nicht umgerechnet."
249
+ "Category","Kategorie"
250
+ "ricardo.ch Category","ricardo.ch Kategorie"
251
+ "Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)","Nutze Magento / ricardo.ch Kategorie-Mapping (wenn ein Mapping nicht existiert, wird eine Fehlermeldung ausgegeben, wenn die Synchronisierung zu ricardo.ch vorbereitet wird.)"
252
+ "Select ricardo.ch Category","Wähle ricardo.ch Kategorie"
253
+ "Select the category","Wähle Kategorie"
254
+ "Type of sales","Verkaufstyp"
255
+ "Until Sold","Bezahlt bis"
256
+ "Start price","Startpreis"
257
+ "Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95.","Spanne zwischen Fr. 0.05 und Fr. 1 000 000. Wenn Kreditkarte als Zahlart verfügbar und aktiv, liegt die Spanne zwischen Fr. 0.05 und Fr. 2 999.95."
258
+ "Increment","Erhöhtungsschritt"
259
+ "Currency","Währung"
260
+ "Allow Direct Buy","Erlaube Sofort-Kaufen"
261
+ "Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1.","Befüllen Sie das Feld ""Sofort-Kaufen"" unten, um den Sofort-Kaufen-Preis zu definieren. <strong>Hinweis</strong>: wenn auf ""Ja"" gestellt, wird die ""individuelle Verfügbarkeit"" auf 1 gestellt."
262
+ "Source","Quelle"
263
+ "Price Change","Preisspanne"
264
+ "For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used.","Für Produkte mit Fixpreis, der Mindestpreis ist Fr. 0.05 und der Maximalpreis ist Fr. 2 999.95 sofern die Zahlungsart Kreditkarte aktiviert ist."
265
+ "For Auction articles, the minimum amount is Fr. 0.1 and must be greater than the Start Price.","Für Auktions-Artikel ist die minimale Menge Fr. 0.1 und muss grösser sein, als der Startpreis."
266
+ "If not correctly defined, the minimum and maximum values will be automatically set.","Wenn nicht korrekt definiert, werden die Min- und Max-Werte automatische gesetzt."
267
+ "Schedule","Zeitplan"
268
+ "Start","Start"
269
+ "Starting date must start minimum in one hour and maximum 30 days in the future.","Der Verkauf kann frühestens in einer Stunde, spätestens in 30 Tagen starten."
270
+ "Start immediately","Sofort starten"
271
+ "Start from","Starte von"
272
+ "End","Ende"
273
+ "Ending date must finish at the minimum in 24 hours and maximum 10 days from the starting date.","Der Verkauf darf frühestens in 24 Stunden, spätestens 10 Tage nach dem Startdatum enden."
274
+ "End after %s days","Ende nach %s Tagen"
275
+ "End on","Endet am"
276
+ "Reactivation","Reaktivierung"
277
+ "Cycle","Zyklus"
278
+ "Cycle to publish multiple products %s minutes after the first publish","Zyklus, um mehrere Produkte %s Minuten nach der ersten Veröffentlichung zu veröffentlichen."
279
+ "Randomly published","Zufällige Veröffentlichung"
280
+ "Overwrite all products starting date","Ãœberschreibe alle Startdaten der Produkte"
281
+ "Product Condition","Produkt-Zustand"
282
+ "Default Condition","Standard Zustand"
283
+ "Condition Product Source","Zustand des Produkts"
284
+ "Do you want to define the condition source from the ricardo.ch Condition Attribute if you defined it on product basis? Otherwise, if not found or you set here to ""No"", the default condition set above will be defined.","Möchten Sie den Zustand des Produkts über das Produktattribut bestimmen? Falls nicht und Sie hier ""Nein"" eintragen, wird der Standardwert aus dem Produktlisting übernommen."
285
+ "Warranty","Garantie"
286
+ "Warranty description German","Garantiebeschreibung deutsch"
287
+ "Characters %s. Max. 5 000 characters","Zeichen %s. Max. 5 000 Zeichen"
288
+ "Warranty description French","Garantiebeschreibung französisch"
289
+ "Stock Management","Lagerverwaltung"
290
+ "Range 1...999. If you use the product inventory option, the amount of items will be taken from the field ""Qty"" defined in the product inventory and limited to 999 if you have a quantity above this value.","Spanne 1...999. Wenn Sie die Lagerhaltungs-Option nutzen, wird die Menge der Produkte mit dem Feld ""Menge"" befüllt. Die maximale Menge ist jedoch 999."
291
+ "Use product inventory","Nutze Lagerbestand des Produkts"
292
+ "Use custom qty","Nutze spezifizierte Menge"
293
+ "Customization","Spezifizierung"
294
+ "Template","Template"
295
+ "To create one go to your <a href=""%s"">ricardo.ch account</a> into ""My Sales"".","Um eines zu erstellen, gehen Sie zu Ihrem <a href=""%s"">ricardo.ch Konto</a> in ""Meine Verkäufe""."
296
+ "Promotion","Promotion"
297
+ "Privilege Space","Promo-Fenster"
298
+ "Privilege space on main category page and search results. More information about this feature <a onclick=\window.open('%s');\"">here</a>""","Promo-Fenster auf der Hauptkategorieseite und Suchergebnisse. Mehr Informationen über dieses Feature finden Sie <a onclick=\window.open('%s');\"">hier</a>"""
299
+ "Home Privilege Space","Promo-Fenster Homepage"
300
+ "Privilege space on the homepage. More information about this feature <a onclick=""window.open('%s');"">here</a>","Promo-Fenster auf der Homepage. Mehr Informationen über dieses Feature bekommen Sie <a onclick=""window.open('%s');"">hier</a>"
301
+ "Home Space","Promo-Fenster Homepage"
302
+ "These options will not be activated for products having no picture.","Diese Option wird nicht aktiviert für Produkte ohne Bilder."
303
+ "Until sold","Verkauft bis"
304
+ "Listed items cannot be modified. Stop the listing first to make changes.","Gelistete Produkte können nicht modifiziert werden. Beenden Sie zunächst das Listing um Änderungen vornehmen zu können."
305
+ "Back to the list ""%s""","Zurück zur Liste ""%s"""
306
+ "Configure product '%s'","Konfiguriere Produkt '%s'"
307
+ "Configure all %s selected products","Konfiguriere alle %s gewählten Produkte"
308
+ "No ricardo.ch category found","Keine ricardo.ch Kategorie gefunden"
309
+ "Give a name","Geben Sie einen Namen an"
310
+ "Select a website","Wählen Sie eine Website"
311
+ "The website(s) must be configured and enabled for this extension. If this field is empty or some are missing please <a href=""%s"">configure</a> the extension.","Die Website(s) müssen für diese extension konfiguriert und aktiviert sein. Wenn dieses Feld leer ist oder etwas fehlt, <a href=""%s"">konfigurieren</a> Sie bitte die Extension."
312
+ "Cancel","Abbrechen"
313
+ "Listed products:","Gelistete Produkte"
314
+ "Not listed products:","Nicht gelistete Produkte"
315
+ "Add Product(s) from category","Füge Produkt(e) von der Kategorie hinzu"
316
+ "Add Product(s)","Füge Produkt(e) hinzu"
317
+ "Stop","Stop"
318
+ "Remove article listed on ricardo.ch","Entferne gelistete Artikel auf ricardo.ch"
319
+ "Check & List","Prüfe & liste"
320
+ "Check & list only pending & error items","Prüfe & liste nur wartende und fehlerhafte Produkte"
321
+ "List","Einstellen"
322
+ "List only ""Ready to list"" items","Nur Produkte einstellen, die den Status ""Fertig zur Listung"" haben"
323
+ "Edit Products Listing '%s'","Bearbeite Produktlisting '%s'"
324
+ "New Products Listing","Neues Produktlisting"
325
+ "Websites","Websites"
326
+ "Total","Gesamt"
327
+ "Edit","Bearbeiten"
328
+ "Relist","Reaktivierung"
329
+ "Stop List","Angebot beenden"
330
+ "View Logs","Siehe Logs"
331
+ "Change status","Ändere Status"
332
+ "Delete","Löschen"
333
+ "Are you sure that you want to delete this/these products listing(s)? Be aware it\'s only possible when the listing is ""Listed""","Sind Sie sicher, dass Sie die Produktlisting(s) löschen möchten? Beachten Sie, das nur aktive Listen gelöscht werden können."
334
+ "Products Listing Log ""%s""","Produktlistings Log ""%s"""
335
+ "Edit ""%s""","Bearbeite ""%s"""
336
+ "Job ID","Job ID"
337
+ "Listing ID","Listing ID"
338
+ "Listing Title","Listing Titel"
339
+ "Product title","Produkttitel"
340
+ "Message","Nachricht"
341
+ "Created at","Erzeugt am"
342
+ "Are you sure that you want to delete this/these log(s)?","Sind Sie sicher, dass Sie die Logs löschen möchten?"
343
+ "Job Type","Job Typ"
344
+ "Job Message","Job Nachricht"
345
+ "Current Progress","Aktueller Fortschritt"
346
+ "Started at","Begonnen am"
347
+ "Ended at","Beendet am"
348
+ "Are you sure that you want to delete this/these job(s)?","Sind Sie sicher, dass Sie diese Vorgänge löschen möchten?"
349
+ "Show Products Listing","Zeige Produktlisting"
350
+ "Listing","Listing"
351
+ "Synchronization","Synchronisierung"
352
+ "Orders","Bestellungen"
353
+ "Transactions %s","Transaktionen %s"
354
+ "You may also access to the %s content of this page</a> in a new window.","Sie können den %s Inhalt dieser Seite auch </a> in einem neuen Fenster bearbeiten."
355
+ "Your ricardo.ch API token credentials are going to expire in %s days for the website ""%s"".","Ihre ricardo.ch-API-Token-Daten laufen in %s Tagen für diese Webseite ""%s"" ab."
356
+ "No ricardo.ch API Authorization have been found for the website ""%s"".","Keine ricardo.ch-API-Authorisierung wurde für diese Website ""%s"" gefunden."
357
+ " You have to authorize your account to get access to the ricardo.ch API thanks to the <a href=""%s"">ricardo.ch Authorization Page</a>. If you don\'t do it, your ricardo.ch extension and all related transactions with ricardo.ch will be blocked."," Sie müssen Ihr Konto authorisieren, um Zugang zur ricardo.ch-API zu bekommen. Sie können das mittels der <a href=""%s"">ricardo.ch Authorisierungsseite</a> tun. Wenn Sie das nicht tun, werden alle Aufrufe von und zu ricardo.ch blockiert."
358
+ "To hide this message, you have to <a href=""%s"">disable the extension</a>.","Um diese Nachricht zu verbergen, müssen Sie die Extension <a href=""%s"">deaktivieren</a>."
359
+ "The Official ricardo.ch Extension has been installed.","Die offizielle ricardo.ch Extension wurde installiert."
360
+ "Please, click <a href=""%s"">here to configure</a> the access to the ricardo.ch API.","Bitte klicken Sie <a href=""%s"">hier</a> um den Zugang zur ricardo.ch API zu konfigurieren."
361
+ "Latest message for the selected job","Letzte Nachricht für den gewählten Vorgang"
362
+ "<a href=""%s"">Edit</a> your products listing if needed","<a href=""%s"">Bearbeite</a> deine Produktlistings, wenn notwendig"
363
+ "No message found.","Keine Nachricht gefunden."
364
+ "Confirm","Bestätige"
365
+ "More Views","Mehr Ansichten"
366
+ "%s days 0:0:0","%s Tage 0:0:0"
367
+ "Starting price","Startpreis"
368
+ "Place a bit","Platziere ein Gebot"
369
+ "Quantity","Anzahl"
370
+ "of %s","von %s"
371
+ "Details","Details"
372
+ "Ending date:","Enddatum:"
373
+ "Availability:","Verfügbarkeit:"
374
+ "Product condition:","Produktzustand:"
375
+ "Payment information:","Zahlungsinformation:"
376
+ "Shipping Method (CH):","Versandart (CH):"
377
+ "Description","Beschreibung"
378
+ "Payment, Shipping, Warranty","Bezahlung, Versand, Garantie"
379
+ "Payment information","Zahlungsinformation"
380
+ "Payment Methods:","Zahlungsarten:"
381
+ "Payment Description:","Zahlungsarten Beschreibung:"
382
+ "Shipping","Versand"
383
+ "Shipping Price:","Versandkosten:"
384
+ "Shipping Availability:","Versandverfügbarkeit:"
385
+ "Shipping Description (CH):","Versandkosten Beschreibung (CH):"
386
+ "You must select a ricardo.ch Category if you set this option","Sie müssen eine ricardo.ch-Kategorie wählen, um diese Option zu wählen"
387
+ "The task will start few minutes","Der Vorgang wird in ein paar Minuten starten"
388
+ "No progress","Kein Fortschritt"
389
+ "The product list has been stopped.","Die Produktliste wurde beendet."
390
+
391
+ "ricardo.ch Lifetime Sales","ricardo.ch Gesamtumsatz"
392
+ "Turnover per month","Umsatz pro Monat"
393
+ "Best Sellers","Meistverkaufte Produkte"
394
+ "Qty sold", "Menge Verkauft"
395
+ "Product Name","Produktname"
396
+ "SKU","SKU"
397
+ "Price","Preis"
398
+ "Your ricardo.ch API Token","Ihre ricardo.ch API Token"
399
+
400
+ "PREMIUMCATEGORYBRONZE"," Klein"
401
+ "PREMIUMCATEGORYSILVER"," "Medium"
402
+ "PREMIUMCATEGORYGOLD"," "Gross"
403
+
404
+ "TYPE_BANK_TRANSFER","Banküberweisung"
405
+ "TYPE_CASH","Bar"
406
+ "TYPE_CREDIT_CARD","Kreditkarte via ricardo.ch"
407
+ "TYPE_OTHER", "Andere Zahlungsmethoden"
408
+
409
+ "UNKNOWNPROPERTY","Unbekannter Besitzer"
410
+ "CUSTOMERNOTARTICLEOWNER","Der Kunde darf das Produkt nicht bearbeiten, da er nicht der Besitzer ist."
411
+ "CHECKPASSWORDWRONGPASSWORD","Das Passwort ist falsch."
412
+ "CHECKPASSWORDBLACKLISTEDIP","Das CheckPassword wird von einer blacklisted IP aus benutzt "
413
+ "CHECKPASSWORDBANNEDCUSTOMER","Das CheckPassword wird von einem gesperrten Kunden genutzt, zusätzliche Info enthält das Datum, seit wann der Nutzer gesperrt ist."
414
+ "CHECKPASSWORDCLOSEDCUSTOMER","Das CheckPassword wurde von einem deaktivierten Kunden genutzt, zusätzliche Info enthält das Datum, seit wann der Nutzer inaktiv ist."
415
+ "LOGADMINFAILED","Admin login fehlgeschlagen"
416
+ "TOKENERROR","Token Fehler für API "
417
+ "TOKENEXPIRED","Token ausgelaufen für API "
418
+ "ANONYMOUSNOTALLOWED","Anonymer Aufruf ist nicht erlaubt"
419
+ "TEMPORAYCREDENTIALEXPIRED","temporärer Zugang abgelaufen für API"
420
+ "TEMPORAYCREDENTIALUNVALIDATED","temporärer Zugang für API nicht valide"
421
+ "SESSIONEXPIRED","Session abgelaufen"
422
+ "UPDATEPASSWORDPOLICYINVALID","CustomerUpdatePassword wird mit einem Passwort mit invaliden Bedingungen genutzt. Es müssen mindestens 8 Zeichen sein, davon mindestens ein Grossbuchstabe und ein Nicht-Alphanumerisches Zeichen."
423
+ "AFTOKENERROR","Anti Forgery token error "
424
+ "UNKNOWNPARTNERSHIP","Unbekannte Partnerschaft"
425
+ "CHECKPASSWORDPENDINGEMAILVALIDATION","Nutzer hat seine E-Mail Adresse nicht validiert"
426
+ "VALIDATECUSTOMERADDRESSDISABLED","Validierung der Adresse ist deaktiviert"
427
+ "ACCOUNTBANNED","Das Kundenkonto wurde gesperrt."
428
+ "ACCOUNTCLOSED","Das Kundenkonto wurde geschlossen."
429
+ "METHODNOTALLOWED","Die Partnerschaft stimmt nicht mit der gewählten Methode überein."
430
+ "TOKEN_AUTHORIZATION","Die Authorisierung muss nochmal durchgeführt werden"
431
+
432
+ "CLOSEAUCTIONFAILED","Auktion konnte nicht geschlossen werden"
433
+ "CLOSECLASSIFIEDFAILED","Ein Produkt konnte nicht klassifiziert werden"
434
+ "DELETEPLANNEDFAILED","Ein Produkt konnte nicht gelöscht werden"
435
+ "COUNTRYORPARTNERNOTDEFINED","Das Land oder der Partner konnte nicht gefunden werden"
436
+ "UNKNOWNCATEGORYID","Die übergebene Kategorie ID existiert nicht"
437
+ "UNSUPPORTEDLANGUAGEID","Die übergebene Sprach ID existiert nicht"
438
+ "ARTICLENOTFOUND","Das Produkt konnte nicht gefunden werden"
439
+ "CUSTOMERNOTFOUND","Kunde nicht gefunden"
440
+ "EMPTYIPADDRESS","Die IP Adresse ist nicht definiert"
441
+ "TECHNICALPROBLEM","Technischer Fehler"
442
+ "ARTICLESAMOUNTLIMIT","Limit für die Menge pro Übertragung liegt bei 100 "
443
+ "LISTOFARTICLESEMPTY","Liste der Produkte ist leer"
444
+ "UNKNOWNCATEGORYNAME","Kategoriename ist nicht bekannt"
445
+
446
+ "EMPTYCOUNTRYID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
447
+ "EMPTYPARTNERID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
448
+ "EMPTYCATEGORY","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
449
+ "EMPTYRELISINFOS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
450
+ "EMPTYCUSTOMER","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
451
+ "UNKNOWNPARTNERID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
452
+ "UNKONWNCATEGORYID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
453
+ "INVALIDDURATION","Die angefragte Dauer ist nicht möglich."
454
+ "RELISTCOUNTEXCEEDED","Bitte beachten Sie, dass Sie Ihre Artikel höchstens 9 Mal reaktivieren können. "
455
+ "STARTPRICETOOHIGH","Bitte setzen Sie einen Startpreis, der gleich oder tiefer als CHF 10 000 000 000 ist."
456
+ "STARTPRICETOOLOW","Bitte setzen Sie einen Startpreis, der gleich oder höher als CHF 0.05 ist."
457
+ "INVALIDARTICLETYPEFORCATEGORY","Bitte beachten Sie, dass diese Kategorie-Änderung nicht erlaubt ist."
458
+ "CATEGORYNOTFINAL","Bitte wählen Sie in der letzten Spalte eine Unterkategorie aus."
459
+ "CATEGORYDEDICATEDTOUSERS","Leider können Sie in dieser Kategorie keine Artikel einstellen. Bitte wählen Sie eine andere Kategorie aus oder kontaktieren Sie unseren Kundendienst."
460
+ "INVALIDTEMPLATEID","Bitte überprüfen Sie ob die ausgewählte Vorlage in Ihrem My Ricardo vorhanden ist."
461
+ "EMPTYTITLE","Bitte tragen Sie einen Titel in das entsprechende Feld ein."
462
+ "EMPTYDESCRIPTION","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein."
463
+ "EMPTYSUBTITLE","Bitte tragen Sie einen Untertitel in der zweiten Sprache ein."
464
+ "TOOLONGTITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
465
+ "TOOLONGDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf."
466
+ "TOOLONGSUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
467
+ "EMPTYPAYMENTDESCRIPTION","Bitte tragen Sie eine Zahlungsart-Beschreibung in das entsprechende Feld ein."
468
+ "TOOLONGPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
469
+ "EMPTYDELIVERYDESCRIPTION","Bitte tragen Sie eine Beschreibung der Versandart in das entsprechende Feld ein."
470
+ "TOOLONGDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
471
+ "EMPTYWARRANTYDESCRIPTION","Bitte tragen Sie eine Garantie-Beschreibung in das entsprechende Feld ein. "
472
+ "TOOLONGWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
473
+ "INCREMENTNOTDEFINED","Bitte tragen Sie einen Erhöhungsschritt in das entsprechende Feld ein."
474
+ "INVALIDINCREMENT","Bitte beachten Sie, dass der Erhöhungsschritt nur aus Zahlen bestehen soll und keine Sonderzeichen enthalten darf."
475
+ "QUANTITYTOOLOW","Bitte beachten Sie, dass Sie mindestens ein Stück verkaufen müssen."
476
+ "QUANTITYTOOHIGH","Bitte beachten Sie, dass die Stückzahl gleich oder weniger als 999 sein muss."
477
+ "NOPAYMENTMETHOD","Bitte wählen Sie eine Zahlungsart aus."
478
+ "NODELIVERYCONDITION","Bitte wählen Sie eine Versandart aus. "
479
+ "DELIVERYCOSTTOOHIGH","Die von Ihnen definierte Versandkosten sind zu hoch. Bitte wählen Sie einen Betrag der kleiner ist als CHF 210'000."
480
+ "MANUALINCREMENTNOTALLOWED","Der Erhöhungschritt kann nicht manuell definiert werden."
481
+ "PLANNEDSCHEDULETOOLOW","Die geplante Startzeit, darf nicht näher als 30 Minuten von der aktuellen Zeit sein"
482
+ "PLANNEDSCHEDULETOOHIGH","Die von Ihnen definierte ""Startzeit"" für das Einstellen des Artikels liegt zuweit in der Zukunft. Bitte planen Sie max. 30 Tage im Voraus. "
483
+ "REFERENCETOOLONG","Die von Ihnen gesetzte Referenznummer ist zu lang. Bitte wählen Sie eine Referenznummer mit maximal 40 Zeichen."
484
+ "INVALIDQUANTITYFORAUCTIONBUYNOW","Bitte beachten Sie, dass die Option "Sofort-Kaufen" nur bei Angeboten mit der Stückzahl 1 gewählt werden kann."
485
+ "BUYNOWLOWERTHANSTARTPRICE","Bitte setzen Sie einen Sofort-Kaufen-Preis, der höher als Ihr Startpreis ist."
486
+ "RICARDOPAYNOCARSANDBIKES","Über ricardo.ch können keine Autos oder Fahrräder verkauft werden"
487
+ "RICARDOPAYWRONGPAYMENTCONDITIONS","Die gewählte Bezahlmethode kann nicht mit der Kreditkartenzahlung kombiniert werden. Bitte wählen Sie eine andere Methode aus."
488
+ "RICARDOPAYPRICETOOHIGH","Der Preis ist zu hoch."
489
+ "RICARDOPAYWALLETBLOCKED","Das ricardo.ch Pay-Wallet wurde blockiert."
490
+ "MAXPICTURESIZEREACHED","Bitte beachten Sie, dass die gesamte Grösse für das Hochladen Ihrer Bilder auf 20 MB beschränkt ist. "
491
+ "ERRORRESIZINGPICTURE","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
492
+ "MAXPICTURESCOUNTREACHED","Bitte beachten Sie, dass die maximale Anzahl Fotos pro Artikel auf 10 beschränkt ist. Weitere Bilder können deshalb nicht hinzugefügt werden."
493
+ "INVALIDPROMOTION","Ungültige Promotion."
494
+ "INVALIDPROMOTIONCOMBINATION","Bitte beachten Sie, dass die mehrfache Auswahl von Anzeigepaketen nicht möglich ist. "
495
+ "NOTCLOSED","Die Bezahloption „Kreditkartenzahlung“ steht für Autozubehör nicht zur Verfügung. Deaktivieren Sie bitte diese Option."
496
+ "EMPTYARTICLEINFOS","Bitte wählen Sie eine Option, um den Zustand Ihres Artikels zu definieren."
497
+ "EMPTYDELIVERY","Bitte wählen Sie eine Versandart aus."
498
+ "EMPTYPROMOTIONS","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein."
499
+ "EMPTYDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. "
500
+ "UPDATEARTICLEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
501
+ "MULTIPLEUPDATENOTALLOWED","Beachten Sie bitte, dass Sie diese Angebote nicht gemeinsam bearbeiten können."
502
+ "UPDATEARTICLECANTRETREIVEARTICLEINFORMATIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
503
+ "UPDATEARTICLECANTRETREIVECATEGORY","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
504
+ "UPDATEARTICLECANTUPDATEDESCRIPTION","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
505
+ "ARTICLEHASBIDS","Bitte beachten Sie, dass bei Ihrem Artikel bereits Gebote abgegeben wurden. Sie können nur zusätzliche Bilder zu Ihrem Artikel hinzufügen."
506
+ "INVALIDPICTUREEXTENSTION","Bitte beachten Sie, dass nur die folgenden Bildformate von unserem System unterstützt werden: .jpg; .jpeg; .gif; .tiff; .png."
507
+ "LANGUAGEIDNOTSET","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
508
+ "SETLIVEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
509
+ "ARTICLENOTFOUND","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
510
+ "EMPTYPICTURES","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
511
+ "UPDATEFAILEDCOULDNOTLOCKARTICLE","Leider konnte Ihr Angebot nicht aktualisiert werden."
512
+ "UPDATEFAILEDONARTICLETABLE","Leider konnte Ihr Angebot nicht aktualisiert werden."
513
+ "UPDATEFAILEDFORSTARTDATE","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
514
+ "UPDATEFAILEDCOULDNOTDELETEOLDIMAGES","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
515
+ "UPDATEFAILEDFORIMAGES","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
516
+ "UPDATEFAILEDCOULDNOTDELETEOLDDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
517
+ "UPDATEFAILEDFORDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
518
+ "UPDATEFAILEDCOULDNOTDELETEOLDLIST","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
519
+ "UPDATEFAILEDFORLIST","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
520
+ "INSERTPREVIEWARTICLEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
521
+ "ONEPRICEMUSTBESET","Bitte tragen Sie im entsprechenden Feld einen Startpreis ein."
522
+ "PICTUREBASEDPROMOTIONNEEDPICTURE","Um ein Anzeigepaket auswählen zu können, müssen Sie Bilder Ihres Artikels hochladen."
523
+ "SUBTITLEMUSTBESETFORSUBTITLEPROMOTION","Service error"
524
+ "NOPAYMENTCONDITIONSELECTED","Bitte wählen Sie eine Zahlungsart aus."
525
+ "QUANTITYCANTINCREASE","Bitte beachten Sie, dass die Stückzahl eines laufenden Angebots nur reduziert werden kann."
526
+ "STARTPRICECANTINCREASE","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
527
+ "BUYNOWPRICECANTINCREASE","Bitte beachten Sie, dass der Sofort-Kaufen-Preis nicht erhöht werden darf."
528
+ "PROMOTIONCANTBEREMOVEDONUPDATE","Bitte beachten Sie, dass Sie kein Anzeigepaket mit einem niedrigeren Preis als das bereits ausgewählte buchen können."
529
+ "PROMOTIONCANTBEDOWNGRADED","Bitte beachten Sie, dass die Dauer Ihres Angebots nur einmal geändert werden darf."
530
+ "DURATIONCHANGESTOOMANY","Die Dauer wurde zu häufig gewechselt."
531
+ "CANTPURCHASEWITHBUYNOW","Die Zahlung kann nicht mit der Sofort-Kaufen-Methode durchgeführt werden."
532
+ "UNABLETOUPDATEQUANTITY","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
533
+ "UNABLETOUPDATERELISTCOUNT","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
534
+ "BUYNOWPROMOTIONNEEDED","Service error"
535
+ "INVALIDMAXRELISTCOUNT","Bitte beachten Sie, dass Sie Ihre Artikel höchstens 9 Mal reaktivieren können. "
536
+ "RELISTSOLDOUTAUCTIONNOTALLOWED","Service error"
537
+ "SUBTITLEALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb einen Untertitel in der zweiten Sprache ein. "
538
+ "DELIVERYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Beschreibung über die Versandbedingungen in der zweiten Sprache ein."
539
+ "PAYMENTDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Zahlungsart-Beschreibung in der zweiten Sprache ein."
540
+ "WARRANTYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie haben entschieden, Ihren Artikel zweisprachig zu erfassen. Bitte tragen Sie eine Garantie-Beschreibung in der zweiten Sprache ein."
541
+ "TITLEALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb einen Titel in der zweiten Sprache ein."
542
+ "DESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Beschreibung für Ihren Artikel in der zweiten Sprache ein."
543
+ "SUBTITLEMAINLANGUAGEISEMPTY","Bitte tragen Sie einen Untertitel in der zweiten Sprache ein."
544
+ "DELIVERYDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Beschreibung der Versandbedingungen in das entsprechende Feld ein. "
545
+ "PAYMENTDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Zahlungsart-Beschreibung in das entsprechende Feld ein."
546
+ "WARRANTYDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Garantie-Beschreibung in das entsprechende Feld ein."
547
+ "TITLEMAINLANGUAGEISEMPTY","Bitte tragen Sie einen Titel in das entsprechende Feld ein."
548
+ "DESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein. "
549
+ "CLOSED","Beachten Sie bitte, dass dieses Angebot bereits zu Ende gegangen ist."
550
+ "TOOLONGMAINTITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
551
+ "TOOLONGMAINDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf."
552
+ "TOOLONGMAINSUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
553
+ "TOOLONGALTERNATIVETITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
554
+ "TOOLONGALTERNATIVEDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf. "
555
+ "TOOLONGALTERNATIVESUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
556
+ "TOOLONGMAINPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
557
+ "TOOLONGALTERNATIVEPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
558
+ "TOOLONGMAINWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
559
+ "TOOLONGALTERNATIVEWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
560
+ "TOOLONGMAINDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
561
+ "TOOLONGALTERNATIVEDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
562
+ "BUYNOWPRICETOOLOW","Service error"
563
+ "BUYNOWPROMOTIONNOTALLOWED","Service error"
564
+ "CANTUPDATEPICTUREONARTICLEWITHBID","Das Bild kann bei einem Angebot das bereits Gebote erhalten hat nicht aktualisiert werden."
565
+ "HTMLTAGSNOTALLOWED","Bitte beachten Sie, dass HTML-Tags in diesem Beschreibungsfeld nicht unterstützt werden"
566
+ "WRONGPAYMENTCONDITIONS","Falsche Zahlungsarten"
567
+ "EMPTYPAYMENTCONDITIONIDS","Leere Zahlungsarten-Ids"
568
+ "NODETAILS","Keine Details gegeben."
569
+ "ARTICLEALREADYHASCARDPAYMENT","Produkt hat bereits eine Zahlungs-Id."
570
+ "ERRORINSERTINGCARDPAYMENT","Fehler bei der Eingabe der Kartenzahlung."
571
+ "ARTICLEDOESNOTHAVECARDPAYMENT","Produkt hat keine Kartenzahlung."
572
+ "ERRORREMOVINGCARDPAYMENT","Fehler beim Entfernen der Kartenzahlung"
573
+ "RICARDOPAYNOTACTIVATED","ricardo.ch Pay ist nicht aktiviert."
574
+ "EMPTYPAYMENTMETHODSIDS","Leere Zahlungsarten-Ids"
575
+ "EMPTYARTICLEID","Leere Produkt-Id"
576
+ "INVALIDCARDCOMBINATIONWITHDELIVERYCONDITION","Ungültige Karte in Kombination mit den Versandkonditionen"
577
+ "NUMBEROFARTICLELIMITED","Anzahl der Produkte ist limitiert."
578
+ "PAYMENTMETHODNEEDALTERNATEONE","Alternative Zahlungsart notwendig."
579
+ "WRONGPAYMENTMETHODS","falsche Zahlungsart"
580
+ "CUMULATIVESHIPPINGNOTALLOWED","kumulative Versandkosten nicht erlaubt."
581
+
582
+ "MAXPICTURESCOUNTREACHED","maximale Bilderanzahl erreicht"
583
+ "MAXPICTURESIZEREACHED","maximale Bildgrösse erreicht"
584
+ "ERRORRESIZINGPICTURE","Fehler bei der Grössenänderung der Bilder"
585
+ "PICTUREINDEXDOESNOTEXIST","Bildindex existiert nicht"
586
+ "EMPTYPICTURECONTENT","leerer Bildinhalt"
587
+ "NOPICTURES","keine Bilder"
588
+ "INVALIDPICTUREINDEX","ungültiger Bildindex"
589
+ "MAXLOGOPICTURESIZEREACHED","maximale Logogrösse erreicht"
590
+ "ERRORRESIZINGLOGOPICTURE","Fehler bei der Grössenänderung des Logos"
591
+
592
+ "NOTALLOWEDTOSELL","Produkt nicht erlaubt zu verkaufen"
593
+ "BILLINGERROR","BILLINGERROR"
594
+ "GETCUSTOMERERROR","GETCUSTOMERERROR"
595
+ "NEEDTOCHANGEPASSWORDERROR","NEEDTOCHANGEPASSWORDERROR"
596
+ "GETACCOUNTPREFERENCESERROR","GETACCOUNTPREFERENCESERROR"
597
+ "INVALIDARGUMENTS","INVALIDARGUMENTS"
598
+ "EMPTYCOUNTRYID","EMPTYCOUNTRYID"
599
+ "EMPTYNICKNAME","EMPTYNICKNAME"
600
+ "EMPTYIPADDRESS","EMPTYIPADDRESS"
601
+ "EMPTYEMAIL","EMPTYEMAIL"
602
+ "EMPTYCUSTOMERID","EMPTYCUSTOMERID"
603
+ "EMPTYGUID","EMPTYGUID"
604
+ "NICKNAMEISNOTUNIQUE","NICKNAMEISNOTUNIQUE"
605
+ "EMAILISNOTUNIQUE","EMAILISNOTUNIQUE"
606
+ "EMPTYFIRSTNAME","EMPTYFIRSTNAME"
607
+ "TOOLONGFIRSTNAME","TOOLONGFIRSTNAME"
608
+ "EMPTYLASTNAME","EMPTYLASTNAME"
609
+ "TOOLONGLASTNAME","TOOLONGLASTNAME"
610
+ "TOOLONGNICKNAME","TOOLONGNICKNAME"
611
+ "TOOLONGEMAIL","TOOLONGEMAIL"
612
+ "MUSTBEOVER18","MUSTBEOVER18"
613
+ "EMPTYADDRESS1","EMPTYADDRESS1"
614
+ "TOOLONGADDRESS1","TOOLONGADDRESS1"
615
+ "TOOLONGADDRESS2","TOOLONGADDRESS2"
616
+ "TOOLONGSTREETNR","TOOLONGSTREETNR"
617
+ "TOOLONGPOSTALBOX","TOOLONGPOSTALBOX"
618
+ "EMPTYZIPCODE","EMPTYZIPCODE"
619
+ "TOOLONGZIPCODE","TOOLONGZIPCODE"
620
+ "EMPTYCITY","EMPTYCITY"
621
+ "TOOLONGCITY","TOOLONGCITY"
622
+ "EMPTYCANTONID","EMPTYCANTONID"
623
+ "EMPTYPHONENUMBER","EMPTYPHONENUMBER"
624
+ "TOOLONGPHONENUMBER","TOOLONGPHONENUMBER"
625
+ "INVALIDNICKNAME","INVALIDNICKNAME"
626
+ "INVALIDEMAIL","INVALIDEMAIL"
627
+ "INVALIDSTREETNR","INVALIDSTREETNR"
628
+ "INVALIDZIPCODE","INVALIDZIPCODE"
629
+ "INVALIDPHONENUMBER","INVALIDPHONENUMBER"
630
+ "EMPTYPASSWORD","EMPTYPASSWORD"
631
+ "COMPANYDETAILSNOTFULL","COMPANYDETAILSNOTFULL"
632
+ "TOOLONGCOMPANYNAME","TOOLONGCOMPANYNAME"
633
+ "TOOLONGCOMPANYVATNUMBER","TOOLONGCOMPANYVATNUMBER"
634
+ "TOOLONGCOMPANYREGISTRYNUMBER","TOOLONGCOMPANYREGISTRYNUMBER"
635
+ "INVALIDVALIDATIONKEY","INVALIDVALIDATIONKEY"
636
+ "UNABLETOVALIDATE","UNABLETOVALIDATE"
637
+ "MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION","MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION"
638
+ "EMPTYSTREETNR","EMPTYSTREETNR"
639
+ "NOTCARDEALER","NOTCARDEALER"
640
+ "PASSWORDCOMPLEXITY","PASSWORDCOMPLEXITY"
641
+ "UNABLETOUPDATE","UNABLETOUPDATE"
642
+ "EMPTYNEWEMAIL","EMPTYNEWEMAIL"
643
+ "EMPTYNEWNICK","EMPTYNEWNICK"
644
+ "VALIDATIONKEYEXPIRED","VALIDATIONKEYEXPIRED"
645
+ "TOOMANYPREMIUMPACKAGES","TOOMANYPREMIUMPACKAGES"
646
+ "CARDPAYMENTOPTIONNOTAVAILABLE","CARDPAYMENTOPTIONNOTAVAILABLE"
647
+ "CUSTOMERBANNED","CUSTOMERBANNED"
648
+ "BUYERNOTFROMCHORLI","BUYERNOTFROMCHORLI"
649
+ "BUYERNORDVNORAC","BUYERNORDVNORAC"
650
+ "EMPTYCUSTOMERINFOS","EMPTYCUSTOMERINFOS"
651
+ "EMPTYMEMBERPREFERENCES","EMPTYMEMBERPREFERENCES"
652
+ "EMPTYADDRESSES","EMPTYADDRESSES"
653
+ "UNABLETOINSERT","UNABLETOINSERT"
654
+ "CREDITLIMITEXCEEDED","Kreditlimit erreicht. Bitte, kontaktieren Sie ricardo.ch"
655
+ "ACTIVATIONCODESTATUSMANUALLYBLOCKED","ACTIVATIONCODESTATUSMANUALLYBLOCKED"
656
+
657
+ "No Options because API not configured","No Options because API not configured"
658
+ "No Options because API has a problem","No Options because API has a problem"
659
+ "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>.", "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>."
660
+ "Security error occurred with the ricardo API. Please, check your log files.", "Security error occurred with the ricardo API. Please, check your log files."
661
+ "Error occurred with the API. Check if the API is correctly configured: %s","Error occurred with the API. Check if the API is correctly configured: %s"
662
+ "Product Price of %s CHF is incorrect. Minimum price is %s.","Produktpreis von %s CHF ist falsch. Minimum Preis ist %s."
663
+ "You cannot reactivate a product until sold out when doing an auction sales type.","You cannot reactivate a product until sold out when doing an auction sales type."
664
+ "Following error(s) appeared:","Following error(s) appeared:"
665
+ "<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction""","<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction"""
app/locale/de_CH/template/email/ricento/admin_message.html ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <!--@subject Admin Notification @-->
2
+ Dear Admin,
3
+
4
+ A problem appeared, here is the message log:
5
+
6
+ {{var message}}
app/locale/de_CH/template/email/ricento/private_message.html ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var title}} @-->
2
+
3
+ <style type="text/css">
4
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
5
+ </style>
6
+
7
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
8
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
9
+ <tr>
10
+ <td align="center" valign="top">
11
+ <!-- [ header starts here] -->
12
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
13
+ <tr>
14
+ <td valign="top">
15
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
16
+ </tr>
17
+ </table>
18
+
19
+ <!-- [ middle starts here] -->
20
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
21
+ <tr>
22
+ <td valign="top">
23
+ <p><strong>Dear {{htmlescape var=$customer.name}}</strong>,</p>
24
+ {{var message}}
25
+ <p>If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_general/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_general/email'}}</a>.</p>
26
+ <p>Thanks again.</p>
27
+ <p>{{var store.getFrontendName()}} customer service</p>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
app/locale/de_DE/Diglin_Ricento.csv ADDED
@@ -0,0 +1,665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "ricardo.ch","ricardo.ch"
2
+ "Dashboard","Dashboard"
3
+ "Products Listing","Produktübersicht"
4
+ "Logs","Logs"
5
+ "ricardo.ch Assistant","ricardo.ch Assistent"
6
+ "Configuration","Konfiguration"
7
+ "Ricento by Diglin GmbH","Ricento von der Diglin GmbH"
8
+ "Log","Log"
9
+ "ricardo.ch Payment Methods","ricardo.ch Zahlarten"
10
+ "ricardo.ch Shipping","ricardo.ch Versandarten"
11
+ "Admin Email Notification","Admin Email Benachrichtigung"
12
+ "Private message","Private Nachricht"
13
+ "Global Configuration","Globale Konfiguration"
14
+ "Merge Order","Bestellungen zusammenfassen"
15
+ "If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?","Wenn ein Kunde mehrere Produkte innerhalb von 30 Minuten bestellt, möchten Sie, dass die Bestellungen zusammengefasst werden?"
16
+ "Shipping Calculation","Versandkosten-Kalkulation"
17
+ "You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>","Sie können entscheiden, wie die Versandkosten berechnet werden, wenn eine Bestellung zusammengefasst wurde.<br>"
18
+ " ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>","""Höchster Preis"": Diese Methode findet das Produkt mit den höchsten Versandkosten und nutzt diesen Versandkosten für die Gesamtsumme.<br>"
19
+ " ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.","""Kumulativ"": diese Methode addiert die Versandkosten der einzelnen Produkte"
20
+ "Send Account Creation Confirmation Email","Sende Willkommensbestätigung per Mail"
21
+ "Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?","Möchten Sie eine Bestätigungsmail (via ricardo.ch API) senden, wenn ein Kunde ein Konto erstellt hat?"
22
+ "Send Email for new order","Sende Email beim Eingang einer neuen Bestellung"
23
+ "Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Möchten Sie eine Bestätigungsmail (via ricardo.ch API) senden, wenn ein Kunde ein Konto erstellt hat?"
24
+ "API Token Configuration","API Token Konfiguration"
25
+ "General API Config","Allgemeine API Konfiguration"
26
+ "ricardo.ch Extension enabled","ricardo.ch Extension aktiviert"
27
+ "Development Mode","Entwicklermodus"
28
+ "If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below.","Wenn Sie diese Funktion aktivieren, werden alle API-Anfragen an die ricardo.ch BETA Umgebubg verschickt. Stellen Sie sicher, dass Sie die dafür passenden API-Keys und Passwörter eingetragen haben."
29
+ "Debug","Debug"
30
+ "Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast.","In diesem Modus werden alle Anfragen an die ricardo.ch-API in die Datei var/log/ricento.log geschrieben. Aktivieren Sie diesen Modus, wenn Sie Probleme haben und schicken Sie uns diese Datei zu. Damit können wir Ihnen helfen. Die Passwörter werden anonymisiert. Achtung: Das Log Datei Größe kann schnell wachsen."
31
+ "German API Token","Deutscher API Token"
32
+ "PROD German Partner Key","PROD Deutscher Partner Schlüssel"
33
+ "Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Der Partner Schlüssel hat das folgende Format: '0F12345-1234-1234-1234-1234567890'. Sie müssen sich für die ricardo.ch API anmelden, um diesen Schlüssel zu bekommen. Klicken Sie dazu auf den Button oben auf der Seite."
34
+ "PROD German Partner Password","PROD Deutsches Partner Passwort"
35
+ "You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Sie müssen sich für die ricardo.ch API anmelden, um diesen Schlüssel zu bekommen. Klicken Sie dazu auf den Button oben auf der Seite."
36
+ "DEV German Partner Key","Entwicklermodus deutscher Partner Schlüssel"
37
+ "DEV German Partner Password","Entwicklermodus deutsches Partner Passwort"
38
+ "French API Token","Französischer API Token"
39
+ "PROD French Partner Key","PROD Französischer Partner Schlüssel"
40
+ "PROD French Partner Password","PROD Französischer Partner Passwort"
41
+ "DEV French Partner Key","Entwicklermodus französischer Partner Schlüssel"
42
+ "DEV French Partner Password","Entwicklermodus französischer Partner Passwort"
43
+ "Cleanup Synchronization Jobs Log","Leere Log für Synchronisation-Jobs"
44
+ "Enabled","Aktiviert"
45
+ "Keep for X days","Halte für x Tage vor"
46
+ "Cleanup Listings Log","Leere Log für Produktlisten"
47
+ "ricardo.ch API Payment Methods","ricardo.ch API Zahlungsarten"
48
+ "Bank Transfer Instructions","Instruktionen Bank-Ãœberweisung"
49
+ "Accepted Currency","Akzeptierte Währung"
50
+ "Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold","Lagerbestand auf 1 gesetzt, da die Zahlart ""Direkt Kaufen"" nicht mehr als einen Artikel erlaubt."
51
+ "Invalid start date.","Ungültiges Startdatum"
52
+ "The end date must be in the future.","Das Enddatum muss in der Zukunft liegen."
53
+ "Listed listings cannot be modified. Stop the listing first to make changes.","Aktive Listungen können nicht verändert werden. Beenden Sie die Listung, um Änderungen vornehmen zu können."
54
+ "An error occurred while saving the configuration.","Ein Fehler trat beim Speichern der Konfiguration auf."
55
+ "ricardo.ch Service Model doesn\'t exists.","ricardo.ch Service Model existiert nicht."
56
+ "ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed.","ricardo.ch API Daten sind nicht vorhanden. Bitte tragen Sie zunächst die Daten ein."
57
+ "API language provided for the Service Manager is not supported.","API Sprache für den Service Manager wird nicht unterstützt."
58
+ "Error while trying to connect to the ricardo.ch API. Please, check your log files.","Fehler beim Verbinden mit der ricardo.ch API. Bitte checken Sie Ihre Log Dateien, um eine genauere Fehlerbeschreibung zu erhalten."
59
+ "The format of the token is invalid","Das Format des Tokens ist ungültig."
60
+ "The dispatcher of type '%s' is not found at %s.","The dispatcher of type '%s' is not found at %s."
61
+ "Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract.","Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract."
62
+ "The product has been sold","Das Produkt wurde verkauft."
63
+ "Customer creation failed! ricardo.ch transaction cannot be added.","Kunde konnte nicht angelegt werden. ricardo.ch Bestellung konnte nicht übertragen werden."
64
+ "Order automatically generated by the ricardo.ch Extension.","Bestellung(en) wurde(n) automatisch durch das ricardo.ch Modul erstellt."
65
+ "Payment is pending","Bezahlung ausstehend"
66
+ "Payment has been completed on ricardo.ch side","Bezahlung wurde bei ricardo.ch durchgeführt."
67
+ "Order canceled on ricardo.ch side","Bezahlung wurd bei ricardo.ch storniert."
68
+ "Country Code is not available. Please contact the author of this extension or support.","Ländercode ist nicht verfügbar. Bitte kontaktieren Sie den Autor dieses Moduls für Support."
69
+ "Report: %d success, %d warning(s), %d error(s)","Report: %d erfolgreich, %d Warnung(en), %d Fehler"
70
+ "Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">click here</a>. Products with an error won't be synchronized, you have to fix the problem first.","Erfolgreich geprüfte Produkte werden gelistet. Um Produkte mit Warnungen zu listen, klick Sie bitte <a href=""%s"">hier</a>. Produkte mit Fehlern werden nicht übertragen, Sie müssen die Fehler zuerst beheben."
71
+ "The product is now live on ricardo.ch","Das Produkt ist nun live auf ricardo.ch."
72
+ "Sorry, the product has not been sold","Sorry, das Produkt wurde nicht verkauft."
73
+ "This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch","Der Artikel ist bereits gelistet oder hat bereits eine Artikelnummer bei ricardo.ch."
74
+ "The product has been removed from ricardo.ch","Das Produkt wurde bei ricardo.ch entfernt."
75
+ "The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it.","Das Produkt wurde nicht bei ricardo.ch entfernt. Wahrscheinlich weil jemand für das Produkt geboten oder es gekauft hat."
76
+ "Report: %d success, %d error(s)","Report: %d erfolgreich, %d Fehler"
77
+ "errors","Fehler"
78
+ "warnings","Warnungen"
79
+ "success","Erfolgreich"
80
+ "The Job has finished with %s.","Der Job wurd mit %s beendet."
81
+ "Please, view the <a href=""%s"">log</a> for details.","Bitte schauen Sie in den <a href=""%s"">Log</a> für Details."
82
+ "No item is ready for this job. No action has been done.","Das Produkt ist bereit für den Job. Es wurde keine Aktion durchgeführt."
83
+ "Error Code: %d","Fehlercode: %d"
84
+ "Notice","Hinweis"
85
+ "Success","Erfolgreich"
86
+ "Error","Fehler"
87
+ "Warning","Warnung"
88
+ "Product item checks","Produkte geprüft"
89
+ "List product item to ricardo.ch","Ãœbertrage Produkt zu ricardo.ch"
90
+ "Stop product item to ricardo.ch","Stoppe Produkt bei ricardo.ch"
91
+ "Default Values","Standardwerte"
92
+ "No package","Kein Paket"
93
+ "-- Select Product Attribute --","-- Wähle Produkt Attribut --"
94
+ "-- Select Method --","-- Wähle Methode --"
95
+ "No change","Keine Änderung"
96
+ "Relative increase (+ %)","Relative Erhöhung (+ %)"
97
+ "Relative decrease (- %)","Relativer Rückgang (- %)"
98
+ "Absolute increase (+)","Absolute Erhöhung (+)"
99
+ "Absolute decrease (-)","Absoluter Rückgang (-)"
100
+ "None","Keine"
101
+ "ricardo.ch Condition","ricardo.ch Konditionen"
102
+ "-- Please Select --","-- Bitte wählen --"
103
+ "Auction","Auktion"
104
+ "Buy now","Sofort-Kaufen"
105
+ "Highest Price","Höchster Preis"
106
+ "Cumulative","Kumulativ"
107
+ "Pending","Verarbeitung"
108
+ "Running","Laufend"
109
+ "Ready","Fertig"
110
+ "Completed","Komplett"
111
+ "Products Check Job","Produkt-Check Job"
112
+ "List Job","List Job"
113
+ "Stop List Job","Stop Einstellen Job"
114
+ "Sync Order Job","Sync Bestellung Job"
115
+ "Relist Job","Reaktivierung Job"
116
+ "Update Job","Update Job"
117
+ "Sync List Job","Sync Einstellen Job"
118
+ "-- Please select --","-- Bitte wählen --"
119
+ "All languages","Alle Sprachen"
120
+ "Listed","Eingestellt"
121
+ "Stopped","Beendet"
122
+ "Ready to list","Bereit zum Einstellen"
123
+ "Check in progress...","Prüfung läuft..."
124
+ "List in progress...","Einstellen läuft..."
125
+ "Job in progress...","Job läuft..."
126
+ "Product Title will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Titel wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
127
+ "Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Untertitel wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
128
+ "Product Description will be cut after %s characters when published on ricardo.ch for store ""%s""","Produkt-Beschreibung wird nach %s Zeichen abgeschnitten, wenn auf ricardo.ch für Store ""%s"" veröffentlicht."
129
+ "Custom Options are not supported. Those won\'t be synchronized into ricardo.ch.","Individuelle Optionen werden nicht unterstützt. Sie werden nicht zu ricardo.ch übertragen und ignoriert."
130
+ "The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock.","Das Hauptprodukt oder seine verknüpften Produkte sind nicht auf Lager oder der Lagerbestand ist nicht hoch genug."
131
+ "Only %s currency is supported. No conversion will be done.","Nur die Währung %s wird unterstützt. Es wird keine Umrechnung vorgenommen."
132
+ "You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level.","Sie müssen eine ricardo.ch-Kategorie für dieses Produkt wählen. Prüfen Sie, ob Sie das Produkt auf Produktlisting-Level oder Magento-Kategorie-Level gesetzt haben."
133
+ "Payment and/or Shipping combination are not correct.","Zahlung und/oder Versand-Kombination sind nicht korrekt."
134
+ "You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s.","Sie können keinen Startpreis für eine Auktion von %2$s festlegen, wenn Sie ""Sofort-Kaufen"" mit dem Produktpreis von %1$s anbieten."
135
+ "Product Price of %s CHF is incorrect for a direct sales with credit card. Price must be between %s and %s.","Aus Sicherheitsgründen ist eine Kreditkarten-Zahlung bei Beträgen von CHF %s.- nicht möglich für ""Sofort-Kaufen"". Bitte wählen Sie andere Zahlungsmethoden oder passen Sie den Preis an. Der Preis muss zwischen %s und %s liegen."
136
+ "The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days","Das Enddatum ist zu früh oder zu spät. Minimale erlaubte Zeitspanne: %s Tage - maximale erlaubte Zeitspanne: %s Tage"
137
+ "You cannot use the privilege spaces as you do not have any pictures for this product.","Sie können keine Sonderfelder nutzen, da Sie keine Bilder für dieses Produkt hinterlegt haben."
138
+ "This increment value is not possible for this start price.","Der angegebene Erhöhungsschritt ist nicht möglich für diesen Startpreis."
139
+ "Only the following combinations are possible:","Nur die folgenden Kombinationen sind möglich:"
140
+ "Start price is between","Startpreis ist zwischen"
141
+ "Increment must be between","Erhöhungsschritt muss sein zwischen "
142
+ "This payment method combination is not possible.","Diese Zahlmethoden-Kombination ist nicht möglich."
143
+ "The following combinations are possible:","Die folgenden Kombinationen sind möglich:"
144
+ "It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method","Es ist nicht möglich, die Versandmethode ""Andere"" mit der Zahlmethoden ""Kreditkarte"" zu kombinieren."
145
+ "No category will be displayed, the products listing doesn\'t exists. Please, close the window.","Keine Kategorie wird angezeigt, das Produktlisting existiert nicht. Bitte schließen Sie das Fenster."
146
+ "You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window.","Sie dürfen dieses Produktlisting nicht speichern. Es können keine Produkte von einer Kategorie hinzufügen. Bitte schließen Sie das Fenster."
147
+ "Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists.","Produkte von den gewählten Kategorien können nicht gespeichert werden. Das Produktlisting existiert nicht."
148
+ "You are not allowed to save the products listing, so you cannot add products from a category.","Sie dürfen dieses Produktlisting nicht speichern. Es können keine Produkte von einer Kategorie hinzufügen. "
149
+ "%d product(s) added to the listing","%d Produkte zum Produktlisting hinzugefügt."
150
+ "Error occurred while saving the product(s) from the selected categories. Please check your exception log.","Fehler traten auf während des Speicherns der gewählten Kategorien. Bitte prüfen Sie den Fehlerlog."
151
+ "The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","Die Aktion, die Sie durchführen wollen, ist nicht möglich. Sie müssen zunächst das API Token authorisieren. Bitte gehen Sie zur <a href=""%s"">ricardo.ch Authorisierungsseite</a> um den Authorisierungsprozeß durchzuführen."
152
+ "Listing name and website must be specified.","Listingname und Webseite müssen definiert werden."
153
+ "We have detected and set for you the language configuration. Please, review it before to go further.","Wir haben die Sprache für Sie vorausgewählt. Bitte prüfen Sie, ob die Wahl richtig ist, bevor Sie fortfahren."
154
+ "The listing has been saved.","Das Listing wurde gespeichert."
155
+ "An error occurred while saving the listing.","Beim Speichern des Listings trat ein Fehler auf."
156
+ "Listed listings cannot be deleted. Stop the listing first.","Aktive Listings können nicht gelöscht werden. Stoppen Sie die Listings zuerst."
157
+ "Listing deleted","Listing entfernt"
158
+ "%d products removed from listing","%d Produkte vom Listing entfernt."
159
+ "%d products are listed and could not be removed","%d Produkte sind aktiv gelistet und können nicht entfernt werden."
160
+ "The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire.","Der API Token und die Konfiguration sind nicht fertig eingerichtet, diese Aktion ist nicht erlaubt. Bitte prüfen Sie, dass der Token aktiv ist und die Gültigkeit nicht ausläuft."
161
+ "A similar job is already running. This job won\'t be executed.","Es läuft bereits ein Vorgang. Ihre Aktion wird nicht ausgeführt."
162
+ "It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","Es ist nicht möglich, diese Aktion durchzuführen. Sie müssen den API Token zunächst authorisieren. Bitte gehen Sie zur <a href=""%s"">ricardo.ch Authorisierungsseite</a> um den Authorisierungsprozess durchzurführen."
163
+ "An error occurred while starting this job. Please check your log file.","Ein Fehler trat auf beim Start des Vorgangs. Bitte schauen Sie in den Fehlerlog."
164
+ "The job to check your products listing will start in few minutes. You can check the progression below.","Der Vorgang um Ihre Produktlistings zu überprüfen wird in wenigen Minuten starten. Sie können den Fortschritt unten einsehen."
165
+ "If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues.","Wenn erfolgreich beendet, werden Ihre Produkte automatisch aktiv gelistet. Falls Fehler auftreten, müssen Sie entscheiden, ob das Listing fortgesetzt oder überprüft werden soll."
166
+ "There is no product ready to be listed. Please, add products to your products listing ""%s"".","Kein Produkt ist bereit um eingestellt zu werden. Bitte fügen Sie Produkt zu Ihrem Produktlisting ""%s"" hinzu."
167
+ "There is no pending product to check.","Kein zu prüfendes Produkt vorhanden"
168
+ "The job to list your products listing will start in few minutes.","Der Vorgang zur Einstellung Ihrer Produkte wird in wenigen Minuten beginnen."
169
+ "You can check the progression below.","Sie können den Fortschritten unten einsehen."
170
+ "There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d.","Es gibt kein Produkt zum reaktivieren. Nur Produkte, die schon mal auf ricardo.ch.ch gelistet wurden, können wieder aktiviert werden für das Produktlisting %d."
171
+ "Only listed product items can be stopped.","Nur aktive gelistete Produkte können deaktiviert werden."
172
+ "The job to stop to list your products will start in few minutes.","Der Vorgang um Ihre Produkte zu beenden wird in wenigen Minuten beginnen."
173
+ "Products listing(s) is/are successfully deleted.","Produktlisting(s) wurde(n) erfolgreich gelöscht."
174
+ "The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode(","Die folgenden Produktlisting-IDs wurden nicht gelöscht, da Sie immer noch aktiv auf ricardo.ch gelistet sind:"
175
+ "An error occurred while trying to delete the products listing(s). Please, check your exception log.","Beim Löschen des/der Produktlisting(s) trat ein Fehler auf. Bitte schauen Sie in Ihre Fehlerlog."
176
+ "No products selected.","Keine Produkte gewählt."
177
+ "The configuration has been saved successfully.","Die Konfiguration wurde erfolgreich gespeichert."
178
+ "An error occurred while saving the configuration. Please, check your log files for more details.","Beim Speichern der Konfiguration trat ein Fehler auf. Bitte schauen Sie in den Fehlerlog für weitere Informationen."
179
+ "It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different.","Dies ist nur eine Vorschau. Bitte denken Sie daran, dass die Darstellung auf ricardo.ch unterschiedlich sein kann."
180
+ "Log(s) is/are successfully deleted.","Log(s) wurde(n) erfolgreich gelöscht."
181
+ "An error occurred while trying to delete the listing log(s). Please, check your exception log.","Beim Löschen der Listing-Logs trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
182
+ "Job(s) is/are successfully deleted.","Aktion(en) erfolgreich gelöscht."
183
+ "The following job IDs have not been deleted because they are still running: %s","Die folgenden Aktions-IDs wurden nicht gelöscht, da Sie immer noch aktiv sind."
184
+ "An error occurred while trying to delete the job(s). Please, check your exception log.","Beim Löschen der Aktion(en) trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
185
+ "ricardo.ch API Signup","ricardo.ch API Anmeldung"
186
+ "API Signup","API Anmeldung"
187
+ "ricardo.ch Assistant Portal","ricardo.ch Verkäuferportal"
188
+ "Assistant Portal","Verkäuferportal"
189
+ "Only Ajax call is allowed here.","Hier ist nur ein Ajax-Aufruf erlaubt."
190
+ "The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side.","Der Website Code von ricardo.ch ist nicht korrekt. Die Authorisierung konnte auf Seiten von Magento nicht gespeichert werden."
191
+ "Your ricardo.ch account has been authorized to get access to the API.","Ihr ricardo.ch-Konto wurde erfolgreich authorisiert, um Zugang zur API zu erhalten."
192
+ "An error occurred while saving the token. Please, check your log files.","Beim Speichern des Tokens trat ein Fehler auf. Bitte schauen Sie in Ihr Fehlerlog."
193
+ "Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason.","Die Authorisierung wurde von ricardo.ch zurückgewiesen. Bitte kontaktieren Sie ricardo.ch um den Grund zu erfahren."
194
+ "Sign Up to ricardo.ch API","Anmeldung zur ricardo.ch API"
195
+ "API Authorization","API Authorisierung"
196
+ "No Selection","Keine Auswahl"
197
+ "Open ricardo.ch Category Window","Öffne ricardo.ch Kategorien Fenster"
198
+ "Add products from selected categories","Füge Produkte von gewählten Kategorien hinzu"
199
+ "Only product types supported, enabled and not listed in other products listing will be added.","Nur Produkte, deren Typ unterstützt wird, die aktiv und nicht bereits gelistet sind, werden hinzugefügt."
200
+ "Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories.","Bitte achten Sie darauf, auch die Unterkategorien zu wählen. Wenn Sie nur eine Oberkategorie wählen können Produkte nicht zu deren Unterkategorien hinzugefügt werden."
201
+ "Create new listing","Erstelle neues Listing."
202
+ "Show Synchronization Jobs","Zeige Synchronisierung-Aufträge"
203
+ "General","Allgemeine API Konfiguration"
204
+ "Products","Produkte"
205
+ "Sales Options","Verkaufsoptionen"
206
+ "Rules","Regeln"
207
+ "Product ID","Produkt ID"
208
+ "Name","Name"
209
+ "Price","Preis"
210
+ "Type","Typ"
211
+ "SKU","Artikelnummer"
212
+ "Inventory","Lagerbestand"
213
+ "Status","Status"
214
+ "Action","Aktion"
215
+ "Preview","Vorschau"
216
+ "Configure","Konfiguriere"
217
+ "Remove","Löschen"
218
+ "Are you sure to remove this/these product(s)?","Sind Sie sicher, dass Sie diese Produkte löschen möchten?"
219
+ "Remove from list","Von der Liste löschen"
220
+ "the sales options","Die Verkaufsoptionen"
221
+ "the shipping and payment rules","Die Regeln für Versand- und Zahlungsarten."
222
+ "This product has been configured for %s %s","Diese Produkte wurde konfiguriert für %s %s"
223
+ "The product has custom options, those will not be added to ricardo.ch!","Das Produkt hat individuelle Optionen, diese werden nicht zu ricardo.ch übertragen."
224
+ "ID","ID"
225
+ "Add selected product(s)","Fügen Sie gewählte Produkte hinzu"
226
+ "Title","Titel"
227
+ "Website","Website"
228
+ "Language","Sprache"
229
+ "Product languages to synchronize to ricardo.ch","Produktsprachen, die mit ricardo.ch synchronisiert werden sollen."
230
+ "ricardo.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc).","ricardo.ch unterstützt zur Zeit nur zwei Sprachen: Deutsch und Französisch. Sie können wählen, in welcher Sprache Sie die Produktinfos übertragen möchten (Titel, Untertitel, Beschreibung, etc)."
231
+ "Default language to publish","Standardsprache bei der Veröffentlichung."
232
+ "Which language to publish by default to ricardo.ch when the product content is not available in a language?","Welche Sprache soll standarmässig zur Veröffentlichung bei ricardo.ch gewählt werden, wenn Produktinfos in gewüschter Sprache nicht verfügbar sind?"
233
+ "Store View for %s","Store View für %s"
234
+ "Payment Methods","Zahlungsarten"
235
+ "Payment Description German","Zahlungsarten Beschreibung deutsch"
236
+ "Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other""","Zeichen: %s. Max. 5 000 Zeichen. Information zu den Zahlungsarten für die Kunden. Diese Infos werden zu ricardo.ch nur übertragen, wenn Sie die Zahlart ""Andere"" wählen"
237
+ "Payment Description French","Beschreibung Zahlungsarten Französisch"
238
+ "Shipping Methods","Versandarten"
239
+ "Shipping Price","Versandkosten"
240
+ "Free shipping","kostenloser Versand"
241
+ "Is Shipping fee cumulative","Sind Versandkosten kumulativ"
242
+ "If you select this option, the shipping fee will be calculate for each sold product.","Wenn Sie diese Option wählen, werden die Versandkosten für jedes verkaufte Produkt einzelnd berechnet."
243
+ "e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option.","z. B. ein Artikel wird mit der Menge 3 von einem Kunden gekauft und die Versandkosten liegen bei jeweils 15 CHF. Die Versandkosten sind dann insgesamt 45 CHF. Lassen Sie das Feld leer, wenn Sie diese Option nicht wählen möchten."
244
+ "Shipping Availability","Verfügbarkeit des Artikels"
245
+ "Shipping Description German","Versandbeschreibung deutsch"
246
+ "Characters: %s. Max. 5 000 characters","Zeichen: %s. Max. 5 000 Zeichen"
247
+ "Shipping Description French","Versandbeschreibung französisch"
248
+ "The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed.","Die Standardwährung dieses Stores ist {$storeCurrency}. Nur %s ist als Währung erlaubt. Die Preise werde nicht umgerechnet."
249
+ "Category","Kategorie"
250
+ "ricardo.ch Category","ricardo.ch Kategorie"
251
+ "Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)","Nutze Magento / ricardo.ch Kategorie-Mapping (wenn ein Mapping nicht existiert, wird eine Fehlermeldung ausgegeben, wenn die Synchronisierung zu ricardo.ch vorbereitet wird.)"
252
+ "Select ricardo.ch Category","Wähle ricardo.ch Kategorie"
253
+ "Select the category","Wähle Kategorie"
254
+ "Type of sales","Verkaufstyp"
255
+ "Until Sold","Bezahlt bis"
256
+ "Start price","Startpreis"
257
+ "Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95.","Spanne zwischen Fr. 0.05 und Fr. 1 000 000. Wenn Kreditkarte als Zahlart verfügbar und aktiv, liegt die Spanne zwischen Fr. 0.05 und Fr. 2 999.95."
258
+ "Increment","Erhöhtungsschritt"
259
+ "Currency","Währung"
260
+ "Allow Direct Buy","Erlaube Sofort-Kaufen"
261
+ "Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1.","Befüllen Sie das Feld ""Sofort-Kaufen"" unten, um den Sofort-Kaufen-Preis zu definieren. <strong>Hinweis</strong>: wenn auf ""Ja"" gestellt, wird die ""individuelle Verfügbarkeit"" auf 1 gestellt."
262
+ "Source","Quelle"
263
+ "Price Change","Preisspanne"
264
+ "For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used.","Für Produkte mit Fixpreis, der Mindestpreis ist Fr. 0.05 und der Maximalpreis ist Fr. 2 999.95 sofern die Zahlungsart Kreditkarte aktiviert ist."
265
+ "For Auction articles, the minimum amount is Fr. 0.1 and must be greater than the Start Price.","Für Auktions-Artikel ist die minimale Menge Fr. 0.1 und muss größer sein, als der Startpreis."
266
+ "If not correctly defined, the minimum and maximum values will be automatically set.","Wenn nicht korrekt definiert, werden die Min- und Max-Werte automatische gesetzt."
267
+ "Schedule","Zeitplan"
268
+ "Start","Start"
269
+ "Starting date must start minimum in one hour and maximum 30 days in the future.","Der Verkauf kann frühestens in einer Stunde, spätestens in 30 Tagen starten."
270
+ "Start immediately","Sofort starten"
271
+ "Start from","Starte von"
272
+ "End","Ende"
273
+ "Ending date must finish at the minimum in 24 hours and maximum 10 days from the starting date.","Der Verkauf darf frühestens in 24 Stunden, spätestens 10 Tage nach dem Startdatum enden."
274
+ "End after %s days","Ende nach %s Tagen"
275
+ "End on","Endet am"
276
+ "Reactivation","Reaktivierung"
277
+ "Cycle","Zyklus"
278
+ "Cycle to publish multiple products %s minutes after the first publish","Zyklus, um mehrere Produkte %s Minuten nach der ersten Veröffentlichung zu veröffentlichen."
279
+ "Randomly published","Zufällige Veröffentlichung"
280
+ "Overwrite all products starting date","Ãœberschreibe alle Startdaten der Produkte"
281
+ "Product Condition","Produkt-Zustand"
282
+ "Default Condition","Standard Zustand"
283
+ "Condition Product Source","Zustand des Produkts"
284
+ "Do you want to define the condition source from the ricardo.ch Condition Attribute if you defined it on product basis? Otherwise, if not found or you set here to ""No"", the default condition set above will be defined.","Möchten Sie den Zustand des Produkts über das Produktattribut bestimmen? Falls nicht und Sie hier ""Nein"" eintragen, wird der Standardwert aus dem Produktlisting übernommen."
285
+ "Warranty","Garantie"
286
+ "Warranty description German","Garantiebeschreibung deutsch"
287
+ "Characters %s. Max. 5 000 characters","Zeichen %s. Max. 5 000 Zeichen"
288
+ "Warranty description French","Garantiebeschreibung französisch"
289
+ "Stock Management","Lagerverwaltung"
290
+ "Range 1...999. If you use the product inventory option, the amount of items will be taken from the field ""Qty"" defined in the product inventory and limited to 999 if you have a quantity above this value.","Spanne 1...999. Wenn Sie die Lagerhaltungs-Option nutzen, wird die Menge der Produkte mit dem Feld ""Menge"" befüllt. Die maximale Menge ist jedoch 999."
291
+ "Use product inventory","Nutze Lagerbestand des Produkts"
292
+ "Use custom qty","Nutze spezifizierte Menge"
293
+ "Customization","Spezifizierung"
294
+ "Template","Template"
295
+ "To create one go to your <a href=""%s"">ricardo.ch account</a> into ""My Sales"".","Um eines zu erstellen, gehen Sie zu Ihrem <a href=""%s"">ricardo.ch Konto</a> in ""Meine Verkäufe""."
296
+ "Promotion","Promotion"
297
+ "Privilege Space","Promo-Fenster"
298
+ "Privilege space on main category page and search results. More information about this feature <a onclick=\window.open('%s');\"">here</a>""","Promo-Fenster auf der Hauptkategorieseite und Suchergebnisse. Mehr Informationen über dieses Feature finden Sie <a onclick=\window.open('%s');\"">hier</a>"""
299
+ "Home Privilege Space","Promo-Fenster Homepage"
300
+ "Privilege space on the homepage. More information about this feature <a onclick=""window.open('%s');"">here</a>","Promo-Fenster auf der Homepage. Mehr Informationen über dieses Feature bekommen Sie <a onclick=""window.open('%s');"">hier</a>"
301
+ "Home Space","Promo-Fenster Homepage"
302
+ "These options will not be activated for products having no picture.","Diese Option wird nicht aktiviert für Produkte ohne Bilder."
303
+ "Until sold","Verkauft bis"
304
+ "Listed items cannot be modified. Stop the listing first to make changes.","Gelistete Produkte können nicht modifiziert werden. Beenden Sie zunächst das Listing um Änderungen vornehmen zu können."
305
+ "Back to the list ""%s""","Zurück zur Liste ""%s"""
306
+ "Configure product '%s'","Konfiguriere Produkt '%s'"
307
+ "Configure all %s selected products","Konfiguriere alle %s gewählten Produkte"
308
+ "No ricardo.ch category found","Keine ricardo.ch Kategorie gefunden"
309
+ "Give a name","Geben Sie einen Namen an"
310
+ "Select a website","Wählen Sie eine Website"
311
+ "The website(s) must be configured and enabled for this extension. If this field is empty or some are missing please <a href=""%s"">configure</a> the extension.","Die Website(s) müssen für diese extension konfiguriert und aktiviert sein. Wenn dieses Feld leer ist oder etwas fehlt, <a href=""%s"">konfigurieren</a> Sie bitte die Extension."
312
+ "Cancel","Abbrechen"
313
+ "Listed products:","Gelistete Produkte"
314
+ "Not listed products:","Nicht gelistete Produkte"
315
+ "Add Product(s) from category","Füge Produkt(e) von der Kategorie hinzu"
316
+ "Add Product(s)","Füge Produkt(e) hinzu"
317
+ "Stop","Stop"
318
+ "Remove article listed on ricardo.ch","Entferne gelistete Artikel auf ricardo.ch"
319
+ "Check & List","Prüfe & liste"
320
+ "Check & list only pending & error items","Prüfe & liste nur wartende und fehlerhafte Produkte"
321
+ "List","Einstellen"
322
+ "List only ""Ready to list"" items","Nur Produkte einstellen, die den Status ""Fertig zur Listung"" haben"
323
+ "Edit Products Listing '%s'","Bearbeite Produktlisting '%s'"
324
+ "New Products Listing","Neues Produktlisting"
325
+ "Websites","Websites"
326
+ "Total","Gesamt"
327
+ "Edit","Bearbeiten"
328
+ "Relist","Reaktivierung"
329
+ "Stop List","Angebot beenden"
330
+ "View Logs","Siehe Logs"
331
+ "Change status","Ändere Status"
332
+ "Delete","Löschen"
333
+ "Are you sure that you want to delete this/these products listing(s)? Be aware it\'s only possible when the listing is ""Listed""","Sind Sie sicher, dass Sie die Produktlisting(s) löschen möchten? Beachten Sie, das nur aktive Listen gelöscht werden können."
334
+ "Products Listing Log ""%s""","Produktlistings Log ""%s"""
335
+ "Edit ""%s""","Bearbeite ""%s"""
336
+ "Job ID","Job ID"
337
+ "Listing ID","Listing ID"
338
+ "Listing Title","Listing Titel"
339
+ "Product title","Produkttitel"
340
+ "Message","Nachricht"
341
+ "Created at","Erzeugt am"
342
+ "Are you sure that you want to delete this/these log(s)?","Sind Sie sicher, dass Sie die Logs löschen möchten?"
343
+ "Job Type","Job Typ"
344
+ "Job Message","Job Nachricht"
345
+ "Current Progress","Aktueller Fortschritt"
346
+ "Started at","Begonnen am"
347
+ "Ended at","Beendet am"
348
+ "Are you sure that you want to delete this/these job(s)?","Sind Sie sicher, dass Sie diese Vorgänge löschen möchten?"
349
+ "Show Products Listing","Zeige Produktlisting"
350
+ "Listing","Listing"
351
+ "Synchronization","Synchronisierung"
352
+ "Orders","Bestellungen"
353
+ "Transactions %s","Transaktionen %s"
354
+ "You may also access to the %s content of this page</a> in a new window.","Sie können den %s Inhalt dieser Seite auch </a> in einem neuen Fenster bearbeiten."
355
+ "Your ricardo.ch API token credentials are going to expire in %s days for the website ""%s"".","Ihre ricardo.ch-API-Token-Daten laufen in %s Tagen für diese Webseite ""%s"" ab."
356
+ "No ricardo.ch API Authorization have been found for the website ""%s"".","Keine ricardo.ch-API-Authorisierung wurde für diese Website ""%s"" gefunden."
357
+ "You have to authorize your account to get access to the ricardo.ch API thanks to the <a href=""%s"">ricardo.ch Authorization Page</a>. If you don\'t do it, your ricardo.ch extension and all related transactions with ricardo.ch will be blocked."," Sie müssen Ihr Konto authorisieren, um Zugang zur ricardo.ch-API zu bekommen. Sie können das mittels der <a href=""%s"">ricardo.ch Authorisierungsseite</a> tun. Wenn Sie das nicht tun, werden alle Aufrufe von und zu ricardo.ch blockiert."
358
+ "To hide this message, you have to <a href=""%s"">disable the extension</a>.","Um diese Nachricht zu verbergen, müssen Sie die Extension <a href=""%s"">deaktivieren</a>."
359
+ "The Official ricardo.ch Extension has been installed.","Die offizielle ricardo.ch Extension wurde installiert."
360
+ "Please, click <a href=""%s"">here to configure</a> the access to the ricardo.ch API.","Bitte klicken Sie <a href=""%s"">hier</a> um den Zugang zur ricardo.ch API zu konfigurieren."
361
+ "Latest message for the selected job","Letzte Nachricht für den gewählten Vorgang"
362
+ "<a href=""%s"">Edit</a> your products listing if needed","<a href=""%s"">Bearbeite</a> deine Produktlistings, wenn notwendig"
363
+ "No message found.","Keine Nachricht gefunden."
364
+ "Confirm","Bestätige"
365
+ "More Views","Mehr Ansichten"
366
+ "%s days 0:0:0","%s Tage 0:0:0"
367
+ "Starting price","Startpreis"
368
+ "Place a bit","Platziere ein Gebot"
369
+ "Quantity","Anzahl"
370
+ "of %s","von %s"
371
+ "Details","Details"
372
+ "Ending date:","Enddatum:"
373
+ "Availability:","Verfügbarkeit:"
374
+ "Product condition:","Produktzustand:"
375
+ "Payment information:","Zahlungsinformation:"
376
+ "Shipping Method (CH):","Versandart (CH):"
377
+ "Description","Beschreibung"
378
+ "Payment, Shipping, Warranty","Bezahlung, Versand, Garantie"
379
+ "Payment information","Zahlungsinformation"
380
+ "Payment Methods:","Zahlungsarten:"
381
+ "Payment Description:","Zahlungsarten Beschreibung:"
382
+ "Shipping","Versand"
383
+ "Shipping Price:","Versandkosten:"
384
+ "Shipping Availability:","Versandverfügbarkeit:"
385
+ "Shipping Description (CH):","Versandkosten Beschreibung (CH):"
386
+ "You must select a ricardo.ch Category if you set this option","Sie müssen eine ricardo.ch-Kategorie wählen, um diese Option zu wählen"
387
+ "The task will start few minutes","Der Vorgang wird in ein paar Minuten starten"
388
+ "No progress","Kein Fortschritt"
389
+ "The product list has been stopped.","Die Produktliste wurde beendet."
390
+
391
+ "ricardo.ch Lifetime Sales","ricardo.ch Gesamtumsatz"
392
+ "Turnover per month","Umsatz pro Monat"
393
+ "Best Sellers","Meistverkaufte Produkte"
394
+ "Qty sold", "Menge Verkauft"
395
+ "Product Name","Produktname"
396
+ "SKU","SKU"
397
+ "Price","Preis"
398
+ "Your ricardo.ch API Token","Ihre ricardo.ch API Token"
399
+
400
+ "PREMIUMCATEGORYBRONZE"," Klein"
401
+ "PREMIUMCATEGORYSILVER"," "Medium"
402
+ "PREMIUMCATEGORYGOLD"," "Groß"
403
+
404
+ "TYPE_BANK_TRANSFER","Banküberweisung"
405
+ "TYPE_CASH","Bar"
406
+ "TYPE_CREDIT_CARD","Kreditkarte via ricardo.ch"
407
+ "TYPE_OTHER", "Andere Zahlungsmethoden"
408
+
409
+ "UNKNOWNPROPERTY","Unbekannter Besitzer"
410
+ "CUSTOMERNOTARTICLEOWNER","Der Kunde darf das Produkt nicht bearbeiten, da er nicht der Besitzer ist."
411
+ "CHECKPASSWORDWRONGPASSWORD","Das Passwort ist falsch."
412
+ "CHECKPASSWORDBLACKLISTEDIP","Das CheckPassword wird von einer blacklisted IP aus benutzt "
413
+ "CHECKPASSWORDBANNEDCUSTOMER","Das CheckPassword wird von einem gesperrten Kunden genutzt, zusätzliche Info enthält das Datum, seit wann der Nutzer gesperrt ist."
414
+ "CHECKPASSWORDCLOSEDCUSTOMER","Das CheckPassword wurde von einem deaktivierten Kunden genutzt, zusätzliche Info enthält das Datum, seit wann der Nutzer inaktiv ist."
415
+ "LOGADMINFAILED","Admin login fehlgeschlagen"
416
+ "TOKENERROR","Token Fehler für API "
417
+ "TOKENEXPIRED","Token ausgelaufen für API "
418
+ "ANONYMOUSNOTALLOWED","Anonymer Aufruf ist nicht erlaubt"
419
+ "TEMPORAYCREDENTIALEXPIRED","temporärer Zugang abgelaufen für API"
420
+ "TEMPORAYCREDENTIALUNVALIDATED","temporärer Zugang für API nicht valide"
421
+ "SESSIONEXPIRED","Session abgelaufen"
422
+ "UPDATEPASSWORDPOLICYINVALID","CustomerUpdatePassword wird mit einem Passwort mit invaliden Bedingungen genutzt. Es müssen mindestens 8 Zeichen sein, davon mindestens ein Großbuchstabe und ein Nicht-Alphanumerisches Zeichen."
423
+ "AFTOKENERROR","Anti Forgery token error "
424
+ "UNKNOWNPARTNERSHIP","Unbekannte Partnerschaft"
425
+ "CHECKPASSWORDPENDINGEMAILVALIDATION","Nutzer hat seine E-Mail Adresse nicht validiert"
426
+ "VALIDATECUSTOMERADDRESSDISABLED","Validierung der Adresse ist deaktiviert"
427
+ "ACCOUNTBANNED","Das Kundenkonto wurde gesperrt."
428
+ "ACCOUNTCLOSED","Das Kundenkonto wurde geschlossen."
429
+ "METHODNOTALLOWED","Die Partnerschaft stimmt nicht mit der gewählten Methode überein."
430
+ "TOKEN_AUTHORIZATION","Die Authorisierung muss nochmal durchgeführt werden"
431
+
432
+ "CLOSEAUCTIONFAILED","Auktion konnte nicht geschlossen werden"
433
+ "CLOSECLASSIFIEDFAILED","Ein Produkt konnte nicht klassifiziert werden"
434
+ "DELETEPLANNEDFAILED","Ein Produkt konnte nicht gelöscht werden"
435
+ "COUNTRYORPARTNERNOTDEFINED","Das Land oder der Partner konnte nicht gefunden werden"
436
+ "UNKNOWNCATEGORYID","Die übergebene Kategorie ID existiert nicht"
437
+ "UNSUPPORTEDLANGUAGEID","Die übergebene Sprach ID existiert nicht"
438
+ "ARTICLENOTFOUND","Das Produkt konnte nicht gefunden werden"
439
+ "CUSTOMERNOTFOUND","Kunde nicht gefunden"
440
+ "EMPTYIPADDRESS","Die IP Adresse ist nicht definiert"
441
+ "TECHNICALPROBLEM","Technischer Fehler"
442
+ "ARTICLESAMOUNTLIMIT","Limit für die Menge pro Übertragung liegt bei 100 "
443
+ "LISTOFARTICLESEMPTY","Liste der Produkte ist leer"
444
+ "UNKNOWNCATEGORYNAME","Kategoriename ist nicht bekannt"
445
+
446
+ "EMPTYCOUNTRYID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
447
+ "EMPTYPARTNERID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
448
+ "EMPTYCATEGORY","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
449
+ "EMPTYRELISINFOS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
450
+ "EMPTYCUSTOMER","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
451
+ "UNKNOWNPARTNERID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
452
+ "UNKONWNCATEGORYID","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
453
+ "INVALIDDURATION","Die angefragte Dauer ist nicht möglich."
454
+ "RELISTCOUNTEXCEEDED","Bitte beachten Sie, dass Sie Ihre Artikel höchstens 9 Mal reaktivieren können. "
455
+ "STARTPRICETOOHIGH","Bitte setzen Sie einen Startpreis, der gleich oder tiefer als CHF 10 000 000 000 ist."
456
+ "STARTPRICETOOLOW","Bitte setzen Sie einen Startpreis, der gleich oder höher als CHF 0.05 ist."
457
+ "INVALIDARTICLETYPEFORCATEGORY","Bitte beachten Sie, dass diese Kategorie-Änderung nicht erlaubt ist."
458
+ "CATEGORYNOTFINAL","Bitte wählen Sie in der letzten Spalte eine Unterkategorie aus."
459
+ "CATEGORYDEDICATEDTOUSERS","Leider können Sie in dieser Kategorie keine Artikel einstellen. Bitte wählen Sie eine andere Kategorie aus oder kontaktieren Sie unseren Kundendienst."
460
+ "INVALIDTEMPLATEID","Bitte überprüfen Sie ob die ausgewählte Vorlage in Ihrem My Ricardo vorhanden ist."
461
+ "EMPTYTITLE","Bitte tragen Sie einen Titel in das entsprechende Feld ein."
462
+ "EMPTYDESCRIPTION","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein."
463
+ "EMPTYSUBTITLE","Bitte tragen Sie einen Untertitel in der zweiten Sprache ein."
464
+ "TOOLONGTITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
465
+ "TOOLONGDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf."
466
+ "TOOLONGSUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
467
+ "EMPTYPAYMENTDESCRIPTION","Bitte tragen Sie eine Zahlungsart-Beschreibung in das entsprechende Feld ein."
468
+ "TOOLONGPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
469
+ "EMPTYDELIVERYDESCRIPTION","Bitte tragen Sie eine Beschreibung der Versandart in das entsprechende Feld ein."
470
+ "TOOLONGDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
471
+ "EMPTYWARRANTYDESCRIPTION","Bitte tragen Sie eine Garantie-Beschreibung in das entsprechende Feld ein. "
472
+ "TOOLONGWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
473
+ "INCREMENTNOTDEFINED","Bitte tragen Sie einen Erhöhungsschritt in das entsprechende Feld ein."
474
+ "INVALIDINCREMENT","Bitte beachten Sie, dass der Erhöhungsschritt nur aus Zahlen bestehen soll und keine Sonderzeichen enthalten darf."
475
+ "QUANTITYTOOLOW","Bitte beachten Sie, dass Sie mindestens ein Stück verkaufen müssen."
476
+ "QUANTITYTOOHIGH","Bitte beachten Sie, dass die Stückzahl gleich oder weniger als 999 sein muss."
477
+ "NOPAYMENTMETHOD","Bitte wählen Sie eine Zahlungsart aus."
478
+ "NODELIVERYCONDITION","Bitte wählen Sie eine Versandart aus. "
479
+ "DELIVERYCOSTTOOHIGH","Die von Ihnen definierte Versandkosten sind zu hoch. Bitte wählen Sie einen Betrag der kleiner ist als CHF 210'000."
480
+ "MANUALINCREMENTNOTALLOWED","Der Erhöhungschritt kann nicht manuell definiert werden."
481
+ "PLANNEDSCHEDULETOOLOW","Die geplante Startzeit, darf nicht näher als 30 Minuten von der aktuellen Zeit sein"
482
+ "PLANNEDSCHEDULETOOHIGH","Die von Ihnen definierte ""Startzeit"" für das Einstellen des Artikels liegt zuweit in der Zukunft. Bitte planen Sie max. 30 Tage im Voraus. "
483
+ "REFERENCETOOLONG","Die von Ihnen gesetzte Referenznummer ist zu lang. Bitte wählen Sie eine Referenznummer mit maximal 40 Zeichen."
484
+ "INVALIDQUANTITYFORAUCTIONBUYNOW","Bitte beachten Sie, dass die Option "Sofort-Kaufen" nur bei Angeboten mit der Stückzahl 1 gewählt werden kann."
485
+ "BUYNOWLOWERTHANSTARTPRICE","Bitte setzen Sie einen Sofort-Kaufen-Preis, der höher als Ihr Startpreis ist."
486
+ "RICARDOPAYNOCARSANDBIKES","Über ricardo.ch können keine Autos oder Fahrräder verkauft werden"
487
+ "RICARDOPAYWRONGPAYMENTCONDITIONS","Die gewählte Bezahlmethode kann nicht mit der Kreditkartenzahlung kombiniert werden. Bitte wählen Sie eine andere Methode aus."
488
+ "RICARDOPAYPRICETOOHIGH","Der Preis ist zu hoch."
489
+ "RICARDOPAYWALLETBLOCKED","Das ricardo.ch Pay-Wallet wurde blockiert."
490
+ "MAXPICTURESIZEREACHED","Bitte beachten Sie, dass die gesamte Grösse für das Hochladen Ihrer Bilder auf 20 MB beschränkt ist. "
491
+ "ERRORRESIZINGPICTURE","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
492
+ "MAXPICTURESCOUNTREACHED","Bitte beachten Sie, dass die maximale Anzahl Fotos pro Artikel auf 10 beschränkt ist. Weitere Bilder können deshalb nicht hinzugefügt werden."
493
+ "INVALIDPROMOTION","Ungültige Promotion."
494
+ "INVALIDPROMOTIONCOMBINATION","Bitte beachten Sie, dass die mehrfache Auswahl von Anzeigepaketen nicht möglich ist. "
495
+ "NOTCLOSED","Die Bezahloption „Kreditkartenzahlung“ steht für Autozubehör nicht zur Verfügung. Deaktivieren Sie bitte diese Option."
496
+ "EMPTYARTICLEINFOS","Bitte wählen Sie eine Option, um den Zustand Ihres Artikels zu definieren."
497
+ "EMPTYDELIVERY","Bitte wählen Sie eine Versandart aus."
498
+ "EMPTYPROMOTIONS","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein."
499
+ "EMPTYDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. "
500
+ "UPDATEARTICLEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
501
+ "MULTIPLEUPDATENOTALLOWED","Beachten Sie bitte, dass Sie diese Angebote nicht gemeinsam bearbeiten können."
502
+ "UPDATEARTICLECANTRETREIVEARTICLEINFORMATIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
503
+ "UPDATEARTICLECANTRETREIVECATEGORY","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
504
+ "UPDATEARTICLECANTUPDATEDESCRIPTION","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung."
505
+ "ARTICLEHASBIDS","Bitte beachten Sie, dass bei Ihrem Artikel bereits Gebote abgegeben wurden. Sie können nur zusätzliche Bilder zu Ihrem Artikel hinzufügen."
506
+ "INVALIDPICTUREEXTENSTION","Bitte beachten Sie, dass nur die folgenden Bildformate von unserem System unterstützt werden: .jpg; .jpeg; .gif; .tiff; .png."
507
+ "LANGUAGEIDNOTSET","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
508
+ "SETLIVEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
509
+ "ARTICLENOTFOUND","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
510
+ "EMPTYPICTURES","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
511
+ "UPDATEFAILEDCOULDNOTLOCKARTICLE","Leider konnte Ihr Angebot nicht aktualisiert werden."
512
+ "UPDATEFAILEDONARTICLETABLE","Leider konnte Ihr Angebot nicht aktualisiert werden."
513
+ "UPDATEFAILEDFORSTARTDATE","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
514
+ "UPDATEFAILEDCOULDNOTDELETEOLDIMAGES","Während der Verarbeitung Ihrer Bilder ist ein Fehler aufgetreten. Wir bitten Sie um Entschuldigung."
515
+ "UPDATEFAILEDFORIMAGES","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
516
+ "UPDATEFAILEDCOULDNOTDELETEOLDDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
517
+ "UPDATEFAILEDFORDESCRIPTIONS","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
518
+ "UPDATEFAILEDCOULDNOTDELETEOLDLIST","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
519
+ "UPDATEFAILEDFORLIST","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
520
+ "INSERTPREVIEWARTICLEERROR","Ein technischer Fehler ist aufgetreten. Wir bitten Sie um Entschuldigung. Bitte versuchen Sie es später nochmals oder kontaktieren Sie unseren Kundendienst."
521
+ "ONEPRICEMUSTBESET","Bitte tragen Sie im entsprechenden Feld einen Startpreis ein."
522
+ "PICTUREBASEDPROMOTIONNEEDPICTURE","Um ein Anzeigepaket auswählen zu können, müssen Sie Bilder Ihres Artikels hochladen."
523
+ "SUBTITLEMUSTBESETFORSUBTITLEPROMOTION","Service error"
524
+ "NOPAYMENTCONDITIONSELECTED","Bitte wählen Sie eine Zahlungsart aus."
525
+ "QUANTITYCANTINCREASE","Bitte beachten Sie, dass die Stückzahl eines laufenden Angebots nur reduziert werden kann."
526
+ "STARTPRICECANTINCREASE","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
527
+ "BUYNOWPRICECANTINCREASE","Bitte beachten Sie, dass der Sofort-Kaufen-Preis nicht erhöht werden darf."
528
+ "PROMOTIONCANTBEREMOVEDONUPDATE","Bitte beachten Sie, dass Sie kein Anzeigepaket mit einem niedrigeren Preis als das bereits ausgewählte buchen können."
529
+ "PROMOTIONCANTBEDOWNGRADED","Bitte beachten Sie, dass die Dauer Ihres Angebots nur einmal geändert werden darf."
530
+ "DURATIONCHANGESTOOMANY","Die Dauer wurde zu häufig gewechselt."
531
+ "CANTPURCHASEWITHBUYNOW","Die Zahlung kann nicht mit der Sofort-Kaufen-Methode durchgeführt werden."
532
+ "UNABLETOUPDATEQUANTITY","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
533
+ "UNABLETOUPDATERELISTCOUNT","Bitte beachten Sie, dass der Preis nicht erhöht werden darf."
534
+ "BUYNOWPROMOTIONNEEDED","Service error"
535
+ "INVALIDMAXRELISTCOUNT","Bitte beachten Sie, dass Sie Ihre Artikel höchstens 9 Mal reaktivieren können. "
536
+ "RELISTSOLDOUTAUCTIONNOTALLOWED","Service error"
537
+ "SUBTITLEALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb einen Untertitel in der zweiten Sprache ein. "
538
+ "DELIVERYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Beschreibung über die Versandbedingungen in der zweiten Sprache ein."
539
+ "PAYMENTDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Zahlungsart-Beschreibung in der zweiten Sprache ein."
540
+ "WARRANTYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie haben entschieden, Ihren Artikel zweisprachig zu erfassen. Bitte tragen Sie eine Garantie-Beschreibung in der zweiten Sprache ein."
541
+ "TITLEALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb einen Titel in der zweiten Sprache ein."
542
+ "DESCRIPTIONALTERNATIVELANGUAGEISEMPTY","Sie möchten Ihren Artikel zweisprachig erstellen. Bitte tragen Sie deshalb eine Beschreibung für Ihren Artikel in der zweiten Sprache ein."
543
+ "SUBTITLEMAINLANGUAGEISEMPTY","Bitte tragen Sie einen Untertitel in der zweiten Sprache ein."
544
+ "DELIVERYDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Beschreibung der Versandbedingungen in das entsprechende Feld ein. "
545
+ "PAYMENTDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Zahlungsart-Beschreibung in das entsprechende Feld ein."
546
+ "WARRANTYDESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Garantie-Beschreibung in das entsprechende Feld ein."
547
+ "TITLEMAINLANGUAGEISEMPTY","Bitte tragen Sie einen Titel in das entsprechende Feld ein."
548
+ "DESCRIPTIONMAINLANGUAGEISEMPTY","Bitte tragen Sie eine Beschreibung für Ihren Artikel in das entsprechende Feld ein. "
549
+ "CLOSED","Beachten Sie bitte, dass dieses Angebot bereits zu Ende gegangen ist."
550
+ "TOOLONGMAINTITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
551
+ "TOOLONGMAINDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf."
552
+ "TOOLONGMAINSUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
553
+ "TOOLONGALTERNATIVETITLE","Bitte beachten Sie, dass der Titel nicht mehr als 40 Zeichen enthalten darf."
554
+ "TOOLONGALTERNATIVEDESCRIPTION","Bitte beachten Sie, dass Ihre Artikel-Beschreibung nicht mehr als 65'000 Zeichen enthalten darf. "
555
+ "TOOLONGALTERNATIVESUBTITLE","Bitte beachten Sie, dass der Untertitel nicht mehr als 60 Zeichen enthalten darf."
556
+ "TOOLONGMAINPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
557
+ "TOOLONGALTERNATIVEPAYMENTDESCRIPTION","Bitte beachten Sie, dass die Beschreibung der Zahlungsart nicht mehr als 5'000 Zeichen enthalten darf."
558
+ "TOOLONGMAINWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
559
+ "TOOLONGALTERNATIVEWARRANTYDESCRIPTION","Bitte beachten Sie, dass die Garantie-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
560
+ "TOOLONGMAINDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf. "
561
+ "TOOLONGALTERNATIVEDELIVERYDESCRIPTION","Bitte beachten Sie, dass die Versandart-Beschreibung nicht mehr als 5'000 Zeichen enthalten darf."
562
+ "BUYNOWPRICETOOLOW","Service error"
563
+ "BUYNOWPROMOTIONNOTALLOWED","Service error"
564
+ "CANTUPDATEPICTUREONARTICLEWITHBID","Das Bild kann bei einem Angebot das bereits Gebote erhalten hat nicht aktualisiert werden."
565
+ "HTMLTAGSNOTALLOWED","Bitte beachten Sie, dass HTML-Tags in diesem Beschreibungsfeld nicht unterstützt werden"
566
+ "WRONGPAYMENTCONDITIONS","Falsche Zahlungsarten"
567
+ "EMPTYPAYMENTCONDITIONIDS","Leere Zahlungsarten-Ids"
568
+ "NODETAILS","Keine Details gegeben."
569
+ "ARTICLEALREADYHASCARDPAYMENT","Produkt hat bereits eine Zahlungs-Id."
570
+ "ERRORINSERTINGCARDPAYMENT","Fehler bei der Eingabe der Kartenzahlung."
571
+ "ARTICLEDOESNOTHAVECARDPAYMENT","Produkt hat keine Kartenzahlung."
572
+ "ERRORREMOVINGCARDPAYMENT","Fehler beim Entfernen der Kartenzahlung"
573
+ "RICARDOPAYNOTACTIVATED","ricardo.ch Pay ist nicht aktiviert."
574
+ "EMPTYPAYMENTMETHODSIDS","Leere Zahlungsarten-Ids"
575
+ "EMPTYARTICLEID","Leere Produkt-Id"
576
+ "INVALIDCARDCOMBINATIONWITHDELIVERYCONDITION","Ungültige Karte in Kombination mit den Versandkonditionen"
577
+ "NUMBEROFARTICLELIMITED","Anzahl der Produkte ist limitiert."
578
+ "PAYMENTMETHODNEEDALTERNATEONE","Alternative Zahlungsart notwendig."
579
+ "WRONGPAYMENTMETHODS","falsche Zahlungsart"
580
+ "CUMULATIVESHIPPINGNOTALLOWED","kumulative Versandkosten nicht erlaubt."
581
+
582
+ "MAXPICTURESCOUNTREACHED","maximale Bilderanzahl erreicht"
583
+ "MAXPICTURESIZEREACHED","maximale Bildgröße erreicht"
584
+ "ERRORRESIZINGPICTURE","Fehler bei der Grössenänderung der Bilder"
585
+ "PICTUREINDEXDOESNOTEXIST","Bildindex existiert nicht"
586
+ "EMPTYPICTURECONTENT","leerer Bildinhalt"
587
+ "NOPICTURES","keine Bilder"
588
+ "INVALIDPICTUREINDEX","ungültiger Bildindex"
589
+ "MAXLOGOPICTURESIZEREACHED","maximale Logogröße erreicht"
590
+ "ERRORRESIZINGLOGOPICTURE","Fehler bei der Größenänderung des Logos"
591
+
592
+ "NOTALLOWEDTOSELL","Produkt nicht erlaubt zu verkaufen"
593
+ "BILLINGERROR","BILLINGERROR"
594
+ "GETCUSTOMERERROR","GETCUSTOMERERROR"
595
+ "NEEDTOCHANGEPASSWORDERROR","NEEDTOCHANGEPASSWORDERROR"
596
+ "GETACCOUNTPREFERENCESERROR","GETACCOUNTPREFERENCESERROR"
597
+ "INVALIDARGUMENTS","INVALIDARGUMENTS"
598
+ "EMPTYCOUNTRYID","EMPTYCOUNTRYID"
599
+ "EMPTYNICKNAME","EMPTYNICKNAME"
600
+ "EMPTYIPADDRESS","EMPTYIPADDRESS"
601
+ "EMPTYEMAIL","EMPTYEMAIL"
602
+ "EMPTYCUSTOMERID","EMPTYCUSTOMERID"
603
+ "EMPTYGUID","EMPTYGUID"
604
+ "NICKNAMEISNOTUNIQUE","NICKNAMEISNOTUNIQUE"
605
+ "EMAILISNOTUNIQUE","EMAILISNOTUNIQUE"
606
+ "EMPTYFIRSTNAME","EMPTYFIRSTNAME"
607
+ "TOOLONGFIRSTNAME","TOOLONGFIRSTNAME"
608
+ "EMPTYLASTNAME","EMPTYLASTNAME"
609
+ "TOOLONGLASTNAME","TOOLONGLASTNAME"
610
+ "TOOLONGNICKNAME","TOOLONGNICKNAME"
611
+ "TOOLONGEMAIL","TOOLONGEMAIL"
612
+ "MUSTBEOVER18","MUSTBEOVER18"
613
+ "EMPTYADDRESS1","EMPTYADDRESS1"
614
+ "TOOLONGADDRESS1","TOOLONGADDRESS1"
615
+ "TOOLONGADDRESS2","TOOLONGADDRESS2"
616
+ "TOOLONGSTREETNR","TOOLONGSTREETNR"
617
+ "TOOLONGPOSTALBOX","TOOLONGPOSTALBOX"
618
+ "EMPTYZIPCODE","EMPTYZIPCODE"
619
+ "TOOLONGZIPCODE","TOOLONGZIPCODE"
620
+ "EMPTYCITY","EMPTYCITY"
621
+ "TOOLONGCITY","TOOLONGCITY"
622
+ "EMPTYCANTONID","EMPTYCANTONID"
623
+ "EMPTYPHONENUMBER","EMPTYPHONENUMBER"
624
+ "TOOLONGPHONENUMBER","TOOLONGPHONENUMBER"
625
+ "INVALIDNICKNAME","INVALIDNICKNAME"
626
+ "INVALIDEMAIL","INVALIDEMAIL"
627
+ "INVALIDSTREETNR","INVALIDSTREETNR"
628
+ "INVALIDZIPCODE","INVALIDZIPCODE"
629
+ "INVALIDPHONENUMBER","INVALIDPHONENUMBER"
630
+ "EMPTYPASSWORD","EMPTYPASSWORD"
631
+ "COMPANYDETAILSNOTFULL","COMPANYDETAILSNOTFULL"
632
+ "TOOLONGCOMPANYNAME","TOOLONGCOMPANYNAME"
633
+ "TOOLONGCOMPANYVATNUMBER","TOOLONGCOMPANYVATNUMBER"
634
+ "TOOLONGCOMPANYREGISTRYNUMBER","TOOLONGCOMPANYREGISTRYNUMBER"
635
+ "INVALIDVALIDATIONKEY","INVALIDVALIDATIONKEY"
636
+ "UNABLETOVALIDATE","UNABLETOVALIDATE"
637
+ "MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION","MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION"
638
+ "EMPTYSTREETNR","EMPTYSTREETNR"
639
+ "NOTCARDEALER","NOTCARDEALER"
640
+ "PASSWORDCOMPLEXITY","PASSWORDCOMPLEXITY"
641
+ "UNABLETOUPDATE","UNABLETOUPDATE"
642
+ "EMPTYNEWEMAIL","EMPTYNEWEMAIL"
643
+ "EMPTYNEWNICK","EMPTYNEWNICK"
644
+ "VALIDATIONKEYEXPIRED","VALIDATIONKEYEXPIRED"
645
+ "TOOMANYPREMIUMPACKAGES","TOOMANYPREMIUMPACKAGES"
646
+ "CARDPAYMENTOPTIONNOTAVAILABLE","CARDPAYMENTOPTIONNOTAVAILABLE"
647
+ "CUSTOMERBANNED","CUSTOMERBANNED"
648
+ "BUYERNOTFROMCHORLI","BUYERNOTFROMCHORLI"
649
+ "BUYERNORDVNORAC","BUYERNORDVNORAC"
650
+ "EMPTYCUSTOMERINFOS","EMPTYCUSTOMERINFOS"
651
+ "EMPTYMEMBERPREFERENCES","EMPTYMEMBERPREFERENCES"
652
+ "EMPTYADDRESSES","EMPTYADDRESSES"
653
+ "UNABLETOINSERT","UNABLETOINSERT"
654
+ "CREDITLIMITEXCEEDED","Kreditlimit erreicht. Bitte, kontaktieren Sie ricardo.ch"
655
+ "ACTIVATIONCODESTATUSMANUALLYBLOCKED","ACTIVATIONCODESTATUSMANUALLYBLOCKED"
656
+
657
+ "No Options because API not configured","No Options because API not configured"
658
+ "No Options because API has a problem","No Options because API has a problem"
659
+ "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>.", "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>."
660
+ "Security error occurred with the ricardo API. Please, check your log files.", "Security error occurred with the ricardo API. Please, check your log files."
661
+ "Error occurred with the API. Check if the API is correctly configured: %s","Error occurred with the API. Check if the API is correctly configured: %s"
662
+ "Product Price of %s CHF is incorrect. Minimum price is %s.","Produktpreis von %s CHF ist falsch. Minimum Preis ist %s."
663
+ "You cannot reactivate a product until sold out when doing an auction sales type.","You cannot reactivate a product until sold out when doing an auction sales type."
664
+ "Following error(s) appeared:","Following error(s) appeared:"
665
+ "<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction""","<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction"""
app/locale/de_DE/template/email/ricento/admin_message.html ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <!--@subject Admin Notification @-->
2
+ Dear Admin,
3
+
4
+ A problem appeared, here is the message log:
5
+
6
+ {{var message}}
app/locale/de_DE/template/email/ricento/private_message.html ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var title}} @-->
2
+
3
+ <style type="text/css">
4
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
5
+ </style>
6
+
7
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
8
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
9
+ <tr>
10
+ <td align="center" valign="top">
11
+ <!-- [ header starts here] -->
12
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
13
+ <tr>
14
+ <td valign="top">
15
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
16
+ </tr>
17
+ </table>
18
+
19
+ <!-- [ middle starts here] -->
20
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
21
+ <tr>
22
+ <td valign="top">
23
+ <p><strong>Dear {{htmlescape var=$customer.name}}</strong>,</p>
24
+ {{var message}}
25
+ <p>If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_general/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_general/email'}}</a>.</p>
26
+ <p>Thanks again.</p>
27
+ <p>{{var store.getFrontendName()}} customer service</p>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
app/locale/en_US/Diglin_Ricento.csv ADDED
@@ -0,0 +1,660 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "ricardo.ch","ricardo.ch"
2
+ "Dashboard","Dashboard"
3
+ "Products Listing","Products Listing"
4
+ "Logs","Logs"
5
+ "ricardo.ch Assistant","ricardo.ch Assistant"
6
+ "Configuration","Configuration"
7
+ "Ricento by Diglin GmbH","Ricento by Diglin GmbH"
8
+ "Log","Log"
9
+ "ricardo.ch Payment Methods","ricardo.ch Payment Methods"
10
+ "ricardo.ch Shipping","ricardo.ch Shipping"
11
+ "Admin Email Notification","Admin Email Notification"
12
+ "Private message","Private message"
13
+ "Global Configuration","Global Configuration"
14
+ "Merge Order","Merge Order"
15
+ "If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?","If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?"
16
+ "Shipping Calculation","Shipping Calculation"
17
+ "You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>
18
+ ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>
19
+ ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.
20
+ ","You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>
21
+ ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>
22
+ ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.
23
+ "
24
+ "Send Account Creation Confirmation Email","Send Account Creation Confirmation Email"
25
+ "Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?","Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?"
26
+ "Send Email for new order","Send Email for new order"
27
+ "Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?"
28
+ "API Token Configuration","API Token Configuration"
29
+ "General API Config","General API Config"
30
+ "ricardo.ch Extension enabled","ricardo.ch Extension enabled"
31
+ "Development Mode","Development Mode"
32
+ "If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below.","If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below."
33
+ "Debug","Debug"
34
+ "Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast.","Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast."
35
+ "German API Token","German API Token"
36
+ "PROD German Partner Key","PROD German Partner Key"
37
+ "Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page"
38
+ "PROD German Partner Password","PROD German Partner Password"
39
+ "You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page"
40
+ "DEV German Partner Key","DEV German Partner Key"
41
+ "DEV German Partner Password","DEV German Partner Password"
42
+ "French API Token","French API Token"
43
+ "PROD French Partner Key","PROD French Partner Key"
44
+ "PROD French Partner Password","PROD French Partner Password"
45
+ "DEV French Partner Key","DEV French Partner Key"
46
+ "DEV French Partner Password","DEV French Partner Password"
47
+ "Cleanup Synchronization Jobs Log","Cleanup Synchronization Jobs Log"
48
+ "Enabled","Enabled"
49
+ "Keep for X days","Keep for X days"
50
+ "Cleanup Listings Log","Cleanup Listings Log"
51
+ "ricardo.ch API Payment Methods","ricardo.ch API Payment Methods"
52
+ "Bank Transfer Instructions","Bank Transfer Instructions"
53
+ "Accepted Currency","Accepted Currency"
54
+ "Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold","Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold"
55
+ "Invalid start date.","Invalid start date."
56
+ "The end date must be in the future.","The end date must be in the future."
57
+ "Listed listings cannot be modified. Stop the listing first to make changes.","Listed listings cannot be modified. Stop the listing first to make changes."
58
+ "An error occurred while saving the configuration.","An error occurred while saving the configuration."
59
+ "ricardo.ch Service Model doesn\'t exists.","ricardo.ch Service Model doesn\'t exists."
60
+ "ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed.","ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed."
61
+ "API language provided for the Service Manager is not supported.","API language provided for the Service Manager is not supported."
62
+ "Error while trying to connect to the ricardo.ch API. Please, check your log files.","Error while trying to connect to the ricardo.ch API. Please, check your log files."
63
+ "The format of the token is invalid","The format of the token is invalid"
64
+ "The dispatcher of type '%s' is not found at %s.","The dispatcher of type '%s' is not found at %s."
65
+ "Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract.","Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract."
66
+ "The product has been sold","The product has been sold"
67
+ "Customer creation failed! ricardo.ch transaction cannot be added.","Customer creation failed! ricardo.ch transaction cannot be added."
68
+ "Order automatically generated by the ricardo.ch Extension.","Order automatically generated by the ricardo.ch Extension."
69
+ "Payment is pending","Payment is pending"
70
+ "Payment has been completed on ricardo.ch side","Payment has been completed on ricardo.ch side"
71
+ "Order canceled on ricardo.ch side","Order canceled on ricardo.ch side"
72
+ "Country Code is not available. Please contact the author of this extension or support.","Country Code is not available. Please contact the author of this extension or support."
73
+ "Report: %d success, %d warning(s), %d error(s)","Report: %d success, %d warning(s), %d error(s)"
74
+ "Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">clicking here</a>. Products with an error won't be synchronized, you have to fix the problem first.","Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">clicking here</a>. Products with an error won\'t be synchronized, you have to fix the problem first."
75
+ "The product is now live on ricardo.ch","The product is now live on ricardo.ch"
76
+ "Sorry, the product has not been sold","Sorry, the product has not been sold"
77
+ "This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch","This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch"
78
+ "The product has been removed from ricardo.ch","The product has been removed from ricardo.ch"
79
+ "The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it.","The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it."
80
+ "Report: %d success, %d error(s)","Report: %d success, %d error(s)"
81
+ "errors","errors"
82
+ "warnings","warnings"
83
+ "success","success"
84
+ "The Job has finished with %s.","The Job has finished with %s."
85
+ "Please, view the <a href=""%s"">log</a> for details.","Please, view the <a href=""%s"">log</a> for details."
86
+ "No item is ready for this job. No action has been done.","No item is ready for this job. No action has been done."
87
+ "Error Code: %d","Error Code: %d"
88
+ "Notice","Notice"
89
+ "Success","Success"
90
+ "Error","Error"
91
+ "Warning","Warning"
92
+ "Product item checks","Product item checks"
93
+ "List product item to ricardo.ch","List product item to ricardo.ch"
94
+ "Stop product item to ricardo.ch","Stop product item to ricardo.ch"
95
+ "Default Values","Default Values"
96
+ "No package","No package"
97
+ "-- Select Product Attribute --","-- Select Product Attribute --"
98
+ "-- Select Method --","-- Select Method --"
99
+ "No change","No change"
100
+ "Relative increase (+ %)","Relative increase (+ %)"
101
+ "Relative decrease (- %)","Relative decrease (- %)"
102
+ "Absolute increase (+)","Absolute increase (+)"
103
+ "Absolute decrease (-)","Absolute decrease (-)"
104
+ "None","None"
105
+ "ricardo.ch Condition","ricardo.ch Condition"
106
+ "-- Please Select --","-- Please Select --"
107
+ "Auction","Auction"
108
+ "Buy now","Buy now"
109
+ "Highest Price","Highest Price"
110
+ "Cumulative","Cumulative"
111
+ "Pending","Pending"
112
+ "Running","Running"
113
+ "Ready","Ready"
114
+ "Completed","Completed"
115
+ "Products Check Job","Products Check Job"
116
+ "List Job","List Job"
117
+ "Stop List Job","Stop List Job"
118
+ "Sync Order Job","Sync Order Job"
119
+ "Relist Job","Relist Job"
120
+ "Update Job","Update Job"
121
+ "Sync List Job","Sync List Job"
122
+ "-- Please select --","-- Please select --"
123
+ "All languages","All languages"
124
+ "Listed","Listed"
125
+ "Stopped","Stopped"
126
+ "Ready to list","Ready to list"
127
+ "Check in progress...","Check in progress..."
128
+ "List in progress...","List in progress..."
129
+ "Job in progress...","Job in progress..."
130
+ "Product Title will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Title will be cut after %s characters when published on ricardo.ch for store ""%s"""
131
+ "Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s"""
132
+ "Product Description will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Description will be cut after %s characters when published on ricardo.ch for store ""%s"""
133
+ "Custom Options are not supported. Those won\'t be synchronized into ricardo.ch.","Custom Options are not supported. Those won\'t be synchronized into ricardo.ch."
134
+ "The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock.","The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock."
135
+ "Only %s currency is supported. No conversion will be done.","Only %s currency is supported. No conversion will be done."
136
+ "You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level.","You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level."
137
+ "Payment and/or Shipping combination are not correct.","Payment and/or Shipping combination are not correct."
138
+ "You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s.","You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s."
139
+ "Product Price of %s CHF is incorrect for a direct sales with credit card. Price must be between %s and %s.","Product Price of %s CHF is incorrect for a direct sales. Price must be between %s and %s."
140
+ "The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days","The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days"
141
+ "You cannot use the privilege spaces as you do not have any pictures for this product.","You cannot use the privilege spaces as you do not have any pictures for this product."
142
+ "This increment value is not possible for this start price.","This increment value is not possible for this start price."
143
+ "Only the following combinations are possible:","Only the following combinations are possible:"
144
+ "Start price is between","Start price is between"
145
+ "Increment must be between","Increment must be between"
146
+ "This payment method combination is not possible.","This payment method combination is not possible."
147
+ "The following combinations are possible:","The following combinations are possible:"
148
+ "It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method","It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method"
149
+ "No category will be displayed, the products listing doesn\'t exists. Please, close the window.","No category will be displayed, the products listing doesn\'t exists. Please, close the window."
150
+ "You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window.","You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window."
151
+ "Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists.","Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists."
152
+ "You are not allowed to save the products listing, so you cannot add products from a category.","You are not allowed to save the products listing, so you cannot add products from a category."
153
+ "%d product(s) added to the listing","%d product(s) added to the listing"
154
+ "Error occurred while saving the product(s) from the selected categories. Please check your exception log.","Error occurred while saving the product(s) from the selected categories. Please check your exception log."
155
+ "The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process"
156
+ "Listing name and website must be specified.","Listing name and website must be specified."
157
+ "We have detected and set for you the language configuration. Please, review it before to go further.","We have detected and set for you the language configuration. Please, review it before to go further."
158
+ "The listing has been saved.","The listing has been saved."
159
+ "An error occurred while saving the listing.","An error occurred while saving the listing."
160
+ "Listed listings cannot be deleted. Stop the listing first.","Listed listings cannot be deleted. Stop the listing first."
161
+ "Listing deleted","Listing deleted"
162
+ "%d products removed from listing","%d products removed from listing"
163
+ "%d products are listed and could not be removed","%d products are listed and could not be removed"
164
+ "The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire.","The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire."
165
+ "A similar job is already running. This job won\'t be executed.","A similar job is already running. This job won\'t be executed."
166
+ "It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process"
167
+ "An error occurred while starting this job. Please check your log file.","An error occurred while starting this job. Please check your log file."
168
+ "The job to check your products listing will start in few minutes. You can check the progression below.","The job to check your products listing will start in few minutes. You can check the progression below."
169
+ "If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues.","If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues."
170
+ "There is no product ready to be listed. Please, add products to your products listing ""%s"".","There is no product ready to be listed. Please, add products to your products listing ""%s""."
171
+ "There is no pending product to check.","There is no pending product to check."
172
+ "The job to list your products listing will start in few minutes.","The job to list your products listing will start in few minutes."
173
+ "You can check the progression below.","You can check the progression below."
174
+ "There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d.","There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d."
175
+ "Only listed product items can be stopped.","Only listed product items can be stopped."
176
+ "The job to stop to list your products will start in few minutes.","The job to stop to list your products will start in few minutes."
177
+ "Products listing(s) is/are successfully deleted.","Products listing(s) is/are successfully deleted."
178
+ "The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode(","The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode("
179
+ "An error occurred while trying to delete the products listing(s). Please, check your exception log.","An error occurred while trying to delete the products listing(s). Please, check your exception log."
180
+ "No products selected.","No products selected."
181
+ "The configuration has been saved successfully.","The configuration has been saved successfully."
182
+ "An error occurred while saving the configuration. Please, check your log files for more details.","An error occurred while saving the configuration. Please, check your log files for more details."
183
+ "It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different.","It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different."
184
+ "Log(s) is/are successfully deleted.","Log(s) is/are successfully deleted."
185
+ "An error occurred while trying to delete the listing log(s). Please, check your exception log.","An error occurred while trying to delete the listing log(s). Please, check your exception log."
186
+ "Job(s) is/are successfully deleted.","Job(s) is/are successfully deleted."
187
+ "The following job IDs have not been deleted because they are still running: ' . implode(","The following job IDs have not been deleted because they are still running: ' . implode("
188
+ "An error occurred while trying to delete the job(s). Please, check your exception log.","An error occurred while trying to delete the job(s). Please, check your exception log."
189
+ "ricardo.ch API Signup","ricardo.ch API Signup"
190
+ "API Signup","API Signup"
191
+ "ricardo.ch Assistant Portal","ricardo.ch Assistant Portal"
192
+ "Assistant Portal","Assistant Portal"
193
+ "Only Ajax call is allowed here.","Only Ajax call is allowed here."
194
+ "The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side.","The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side."
195
+ "Your ricardo.ch account has been authorized to get access to the API.","Your ricardo.ch account has been authorized to get access to the API."
196
+ "An error occurred while saving the token. Please, check your log files.","An error occurred while saving the token. Please, check your log files."
197
+ "Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason.","Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason."
198
+ "Sign Up to ricardo.ch API","Sign Up to ricardo.ch API"
199
+ "API Authorization","API Authorization"
200
+ "No Selection","No Selection"
201
+ "Open ricardo.ch Category Window","Open ricardo.ch Category Window"
202
+ "Add products from selected categories","Add products from selected categories"
203
+ "Only product types supported, enabled and not listed in other products listing will be added.","Only product types supported, enabled and not listed in other products listing will be added."
204
+ "Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories.","Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories."
205
+ "Create new listing","Create new listing"
206
+ "Show Synchronization Jobs","Show Synchronization Jobs"
207
+ "General","General"
208
+ "Products","Products"
209
+ "Sales Options","Sales Options"
210
+ "Rules","Rules"
211
+ "Product ID","Product ID"
212
+ "Name","Name"
213
+ "Price","Price"
214
+ "Type","Type"
215
+ "SKU","SKU"
216
+ "Inventory","Inventory"
217
+ "Status","Status"
218
+ "Action","Action"
219
+ "Preview","Preview"
220
+ "Configure","Configure"
221
+ "Remove","Remove"
222
+ "Are you sure to remove this/these product(s)?","Are you sure to remove this/these product(s)?"
223
+ "Remove from list","Remove from list"
224
+ "the sales options","the sales options"
225
+ "the shipping and payment rules","the shipping and payment rules"
226
+ "This product has been configured for %s %s","This product has been configured for %s %s"
227
+ "The product has custom options, those will not be added to ricardo.ch!","The product has custom options, those will not be added to ricardo.ch!"
228
+ "ID","ID"
229
+ "Add selected product(s)","Add selected product(s)"
230
+ "Title","Title"
231
+ "Website","Website"
232
+ "Language","Language"
233
+ "Product languages to synchronize to ricardo.ch.ch","Product languages to synchronize to ricardo.ch.ch"
234
+ "ricardo.ch.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc).","ricardo.ch.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc)."
235
+ "Default language to publish","Default language to publish"
236
+ "Which language to publish by default to ricardo.ch.ch when the product content is not available in a language","Which language to publish by default to ricardo.ch.ch when the product content is not available in a language"
237
+ "Store View for ' . ucwords(Mage::app()->getLocale()->getTranslation($lang, 'language","Store View for ' . ucwords(Mage::app()->getLocale()->getTranslation($lang, 'language"
238
+ "Payment Methods","Payment Methods"
239
+ "Payment Description German","Payment Description German"
240
+ "Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other""","Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other"""
241
+ "Payment Description French","Payment Description French"
242
+ "Shipping Methods","Shipping Methods"
243
+ "Shipping Price","Shipping Price"
244
+ "Free shipping","Free shipping"
245
+ "Is Shipping fee cumulative","Is Shipping fee cumulative"
246
+ "If you select this option, the shipping fee will be calculate for each sold product.","If you select this option, the shipping fee will be calculate for each sold product."
247
+ "e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option.","e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option."
248
+ "Shipping Availability","Shipping Availability"
249
+ "Shipping Description German","Shipping Description German"
250
+ "Characters: %s. Max. 5 000 characters","Characters: %s. Max. 5 000 characters"
251
+ "Shipping Description French","Shipping Description French"
252
+ "The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed.","The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed."
253
+ "Category","Category"
254
+ "ricardo.ch Category","ricardo.ch Category"
255
+ "Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)","Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)"
256
+ "Select ricardo.ch Category","Select ricardo.ch Category"
257
+ "Select the category","Select the category"
258
+ "Type of sales","Type of sales"
259
+ "Until Sold","Until Sold"
260
+ "Start price","Start price"
261
+ "Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95.","Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95."
262
+ "Increment","Increment"
263
+ "Currency","Currency"
264
+ "Allow Direct Buy","Allow Direct Buy"
265
+ "Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1.","Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1."
266
+ "Source","Source"
267
+ "Price Change","Price Change"
268
+ "For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used.","For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used."
269
+ "For Auction articles, the minimum amount is Fr. 0.1 and must be greater than the Start Price.","For Auction articles, the minimum amount is Fr. 0.1 and must be greater than the Start Price."
270
+ "If not correctly defined, the minimum and maximum values will be automatically set.","If not correctly defined, the minimum and maximum values will be automatically set."
271
+ "Schedule","Schedule"
272
+ "Start","Start"
273
+ "Starting date must start minimum in one hour and maximum 30 days in the future.","Starting date must start minimum in one hour and maximum 30 days in the future."
274
+ "Start immediately","Start immediately"
275
+ "Start from","Start from"
276
+ "End","End"
277
+ "Ending date must finish at the minimum in 24 hours and maximum 10 days from the starting date.","Ending date must finish at the minimum in 24 hours and maximum 10 days from the starting date."
278
+ "End after %s days","End after %s days"
279
+ "End on","End on"
280
+ "Reactivation","Reactivation"
281
+ "Cycle","Cycle"
282
+ "Cycle to publish multiple products %s minutes after the first publish","Cycle to publish multiple products %s minutes after the first publish"
283
+ "Randomly published","Randomly published"
284
+ "Overwrite all products starting date","Overwrite all products starting date"
285
+ "Product Condition","Product Condition"
286
+ "Default Condition","Default Condition"
287
+ "Condition Product Source","Condition Product Source"
288
+ "Do you want to define the condition source from the ricardo.ch Condition Attribute if you defined it on product basis? Otherwise, if not found or you set here to ""No"", the default condition set above will be defined.","Do you want to define the condition source from the ricardo.ch Condition Attribute if you defined it on product basis? Otherwise, if not found or you set here to ""No"", the default condition set above will be defined."
289
+ "Warranty","Warranty"
290
+ "Warranty description German","Warranty description German"
291
+ "Characters %s. Max. 5 000 characters","Characters %s. Max. 5 000 characters"
292
+ "Warranty description French","Warranty description French"
293
+ "Stock Management","Stock Management"
294
+ "Range 1...999. If you use the product inventory option, the amount of items will be taken from the field ""Qty"" defined in the product inventory and limited to 999 if you have a quantity above this value.","Range 1...999. If you use the product inventory option, the amount of items will be taken from the field ""Qty"" defined in the product inventory and limited to 999 if you have a quantity above this value."
295
+ "Use product inventory","Use product inventory"
296
+ "Use custom qty","Use custom qty"
297
+ "Customization","Customization"
298
+ "Template","Template"
299
+ "To create one go to your <a href=""%s"">ricardo.ch account</a> into ""My Sales"".","To create one go to your <a href=""%s"">ricardo.ch account</a> into ""My Sales""."
300
+ "Promotion","Promotion"
301
+ "Privilege Space","Privilege Space"
302
+ "Privilege space on main category page and search results. More information about this feature <a onclick=\"window.open('%s');\">here</a>","Privilege space on main category page and search results. More information about this feature <a onclick=\"window.open('%s');\">here</a>"
303
+ "Home Privilege Space","Home Privilege Space"
304
+ "Privilege space on the homepage. More information about this feature <a onclick=\"window.open('%s');\">here</a>","Privilege space on the homepage. More information about this feature <a onclick=\"window.open('%s');\">here</a>"
305
+ "Home Space","Home Space"
306
+ "These options will not be activated for products having no picture.","These options will not be activated for products having no picture."
307
+ "Until sold","Until sold"
308
+ "Listed items cannot be modified. Stop the listing first to make changes.","Listed items cannot be modified. Stop the listing first to make changes."
309
+ "Back to the list ""%s""","Back to the list ""%s"""
310
+ "Configure product '%s'","Configure product '%s'"
311
+ "Configure all %s selected products","Configure all %s selected products"
312
+ "No ricardo.ch category found","No ricardo.ch category found"
313
+ "Give a name","Give a name"
314
+ "Select a website","Select a website"
315
+ "The website(s) must be configured and enabled for this extension. If this field is empty or some are missing please <a href=""%s"">configure</a> the extension.","The website(s) must be configured and enabled for this extension. If this field is empty or some are missing please <a href=""%s"">configure</a> the extension."
316
+ "Cancel","Cancel"
317
+ "Listed products:","Listed products:"
318
+ "Not listed products:","Not listed products:"
319
+ "Add Product(s) from category","Add Product(s) from category"
320
+ "Add Product(s)","Add Product(s)"
321
+ "Stop","Stop"
322
+ "Remove article listed on ricardo.ch","Remove article listed on ricardo.ch"
323
+ "Check & List","Check & List"
324
+ "Check & list only pending & error items","Check & list only pending & error items"
325
+ "List","List"
326
+ "List only ""Ready to list"" items","List only ""Ready to list"" items"
327
+ "Edit Products Listing '%s'","Edit Product Listing '%s'"
328
+ "New Products Listing","New Product Listing"
329
+ "Websites","Websites"
330
+ "Total","Total"
331
+ "Edit","Edit"
332
+ "Relist","Relist"
333
+ "Stop List","Stop List"
334
+ "View Logs","View Logs"
335
+ "Change status","Change status"
336
+ "Delete","Delete"
337
+ "Are you sure that you want to delete this/these products listing(s)? Be aware it\'s only possible when the listing is ""Listed""","Are you sure that you want to delete this/these products listing(s)? Be aware it\'s only possible when the listing is ""Listed"""
338
+ "Products Listing Log ""%s""","Products Listing Log ""%s"""
339
+ "Edit ""%s""","Edit ""%s"""
340
+ "Job ID","Job ID"
341
+ "Listing ID","Listing ID"
342
+ "Listing Title","Listing Title"
343
+ "Product title","Product title"
344
+ "Message","Message"
345
+ "Created at","Created at"
346
+ "Are you sure that you want to delete this/these log(s)?","Are you sure that you want to delete this/these log(s)?"
347
+ "Job Type","Job Type"
348
+ "Job Message","Job Message"
349
+ "Current Progress","Current Progress"
350
+ "Started at","Started at"
351
+ "Ended at","Ended at"
352
+ "Are you sure that you want to delete this/these job(s)?","Are you sure that you want to delete this/these job(s)?"
353
+ "Show Products Listing","Show Products Listing"
354
+ "Listing","Listing"
355
+ "Synchronization","Synchronization"
356
+ "Orders","Orders"
357
+ "Transactions %s","Transactions %s"
358
+ "You may also access to the %s content of this page</a> in a new window.","You may also access to the %s content of this page</a> in a new window."
359
+ "Your ricardo.ch API token credentials are going to expire in %s days for the website ""%s"".","Your ricardo.ch API token credentials are going to expire in %s days for the website ""%s""."
360
+ "No ricardo.ch API Authorization have been found for the website ""%s"".","No ricardo.ch API Authorization have been found for the website ""%s""."
361
+ "You have to authorize your account to get access to the ricardo.ch API thanks to the <a href=""%s"">ricardo.ch Authorization Page</a>. If you don\'t do it, your ricardo.ch extension and all related transactions with ricardo.ch will be blocked."," You have to authorize your account to get access to the ricardo.ch API thanks to the <a href=""%s"">ricardo.ch Authorization Page</a>. If you don\'t do it, your ricardo.ch extension and all related transactions with ricardo.ch will be blocked."
362
+ "To hide this message, you have to <a href=""%s"">disable the extension</a>.","To hide this message, you have to <a href=""%s"">disable the extension</a>."
363
+ "The Official ricardo.ch Extension has been installed.","The Official ricardo.ch Extension has been installed."
364
+ "Please, click <a href=""%s"">here to configure</a> the access to the ricardo.ch API.","Please, click <a href=""%s"">here to configure</a> the access to the ricardo.ch API."
365
+ "Latest message for the selected job","Latest message for the selected job"
366
+ "<a href=""%s"">Edit</a> your products listing if needed","<a href=""%s"">Edit</a> your products listing if needed"
367
+ "No message found.","No message found."
368
+ "Confirm","Confirm"
369
+ "More Views","More Views"
370
+ "%s days 0:0:0","%s days 0:0:0"
371
+ "Starting price","Starting price"
372
+ "Place a bit","Place a bit"
373
+ "Quantity","Quantity"
374
+ "of %s","of %s"
375
+ "Details","Details"
376
+ "Ending date:","Ending date:"
377
+ "Availability:","Availability:"
378
+ "Product condition:","Product condition:"
379
+ "Payment information:","Payment information:"
380
+ "Shipping Method (CH):","Shipping Method (CH):"
381
+ "Description","Description"
382
+ "Payment, Shipping, Warranty","Payment, Shipping, Warranty"
383
+ "Payment information","Payment information"
384
+ "Payment Methods:","Payment Methods:"
385
+ "Payment Description:","Payment Description:"
386
+ "Shipping","Shipping"
387
+ "Shipping Price:","Shipping Price:"
388
+ "Shipping Availability:","Shipping Availability:"
389
+ "Shipping Description (CH):","Shipping Description (CH):"
390
+ "You must select a ricardo.ch Category if you set this option","You must select a ricardo.ch Category if you set this option"
391
+ "The task will start few minutes","The task will start few minutes"
392
+ "No progress","No progress"
393
+ "The product list has been stopped.","The product list has been stopped."
394
+
395
+ "PREMIUMCATEGORYBRONZE", "Small"
396
+ "PREMIUMCATEGORYSILVER", "Medium"
397
+ "PREMIUMCATEGORYGOLD", "Big"
398
+
399
+ "TYPE_BANK_TRANSFER", "Bank transfer"
400
+ "TYPE_CASH", "Cash"
401
+ "TYPE_CREDIT_CARD", "Credit Card via ricardo.ch"
402
+ "TYPE_OTHER", "Other payment method"
403
+
404
+ "UNKNOWNPROPERTY","Unknow Property"
405
+ "CUSTOMERNOTARTICLEOWNER","The current customer can't act on the article as he's not the owner "
406
+ "CHECKPASSWORDWRONGPASSWORD","The CheckPassword is used with a wrong password "
407
+ "CHECKPASSWORDBLACKLISTEDIP","The CheckPassword is used with a blacklisted IP "
408
+ "CHECKPASSWORDBANNEDCUSTOMER","The CheckPassword is used with a bannished Customer, additional info contains the date since when the user is bannished as Datetime "
409
+ "CHECKPASSWORDCLOSEDCUSTOMER","The CheckPassword is used with a closed customer, additional info contains the date since when the user is closed as Datetime "
410
+ "LOGADMINFAILED","Admin login failed "
411
+ "TOKENERROR","Token error for API "
412
+ "TOKENEXPIRED","Token expired for API "
413
+ "ANONYMOUSNOTALLOWED","Anonymous call is not allowed "
414
+ "TEMPORAYCREDENTIALEXPIRED","TemporayCredential expired for API"
415
+ "TEMPORAYCREDENTIALUNVALIDATED","TemporayCredential unvalidated for API"
416
+ "SESSIONEXPIRED","Session expired"
417
+ "UPDATEPASSWORDPOLICYINVALID","CustomerUpdatePassword is used with a password with invalid policy There must be at least 8 characters. At least 1 uppercase character. At least 1 non alpha numeric. "
418
+ "AFTOKENERROR","The Anti Forgery token error "
419
+ "UNKNOWNPARTNERSHIP","Unknown partnership"
420
+ "CHECKPASSWORDPENDINGEMAILVALIDATION","User has not validated his email"
421
+ "VALIDATECUSTOMERADDRESSDISABLED","Validation of User Address is disabled "
422
+ "ACCOUNTBANNED","The account linked to the customer has been banned"
423
+ "ACCOUNTCLOSED","The account linked to the customer has been closed"
424
+ "METHODNOTALLOWED","The Partnership used is not allowed to use this method"
425
+ "TOKEN_AUTHORIZATION","The authorization of the token must be again requested"
426
+
427
+ "CLOSEAUCTIONFAILED","Failed to close the auction"
428
+ "CLOSECLASSIFIEDFAILED","Failed to close a classified article"
429
+ "DELETEPLANNEDFAILED","Failed to delete planned article"
430
+ "COUNTRYORPARTNERNOTDEFINED","The country or partner is not defined "
431
+ "UNKNOWNCATEGORYID","The given category Id does not exist "
432
+ "UNSUPPORTEDLANGUAGEID","The given languageId is not supported/existing"
433
+ "ARTICLENOTFOUND","Unable to find the article given its ID "
434
+ "CUSTOMERNOTFOUND","Customer not found "
435
+ "EMPTYIPADDRESS","The IP address is not defined "
436
+ "TECHNICALPROBLEM","Technical Exception "
437
+ "ARTICLESAMOUNTLIMIT","Limit for amount of articles per 1 push is 100 "
438
+ "LISTOFARTICLESEMPTY","list of article empty"
439
+ "UNKNOWNCATEGORYNAME","Category name specified is unknown"
440
+
441
+ "EMPTYCOUNTRYID","EMPTYCOUNTRYID"
442
+ "EMPTYPARTNERID","EMPTYPARTNERID"
443
+ "EMPTYCATEGORY","EMPTYCATEGORY"
444
+ "EMPTYRELISINFOS","EMPTYRELISINFOS"
445
+ "EMPTYCUSTOMER","EMPTYCUSTOMER"
446
+ "UNKNOWNPARTNERID","UNKNOWNPARTNERID"
447
+ "UNKONWNCATEGORYID","UNKONWNCATEGORYID"
448
+ "INVALIDDURATION","INVALIDDURATION"
449
+ "RELISTCOUNTEXCEEDED","RELISTCOUNTEXCEEDED"
450
+ "STARTPRICETOOHIGH","STARTPRICETOOHIGH"
451
+ "STARTPRICETOOLOW","STARTPRICETOOLOW"
452
+ "INVALIDARTICLETYPEFORCATEGORY","INVALIDARTICLETYPEFORCATEGORY"
453
+ "CATEGORYNOTFINAL","CATEGORYNOTFINAL"
454
+ "CATEGORYDEDICATEDTOUSERS","CATEGORYDEDICATEDTOUSERS"
455
+ "INVALIDTEMPLATEID","INVALIDTEMPLATEID"
456
+ "EMPTYTITLE","EMPTYTITLE"
457
+ "EMPTYDESCRIPTION","EMPTYDESCRIPTION"
458
+ "EMPTYSUBTITLE","EMPTYSUBTITLE"
459
+ "TOOLONGTITLE","TOOLONGTITLE"
460
+ "TOOLONGDESCRIPTION","TOOLONGDESCRIPTION"
461
+ "TOOLONGSUBTITLE","TOOLONGSUBTITLE"
462
+ "EMPTYPAYMENTDESCRIPTION","EMPTYPAYMENTDESCRIPTION"
463
+ "TOOLONGPAYMENTDESCRIPTION","TOOLONGPAYMENTDESCRIPTION"
464
+ "EMPTYDELIVERYDESCRIPTION","EMPTYDELIVERYDESCRIPTION"
465
+ "TOOLONGDELIVERYDESCRIPTION","TOOLONGDELIVERYDESCRIPTION"
466
+ "EMPTYWARRANTYDESCRIPTION","EMPTYWARRANTYDESCRIPTION"
467
+ "TOOLONGWARRANTYDESCRIPTION","TOOLONGWARRANTYDESCRIPTION"
468
+ "INCREMENTNOTDEFINED","INCREMENTNOTDEFINED"
469
+ "INVALIDINCREMENT","INVALIDINCREMENT"
470
+ "QUANTITYTOOLOW","QUANTITYTOOLOW"
471
+ "QUANTITYTOOHIGH","QUANTITYTOOHIGH"
472
+ "NOPAYMENTMETHOD","NOPAYMENTMETHOD"
473
+ "NODELIVERYCONDITION","NODELIVERYCONDITION"
474
+ "DELIVERYCOSTTOOHIGH","DELIVERYCOSTTOOHIGH"
475
+ "MANUALINCREMENTNOTALLOWED","MANUALINCREMENTNOTALLOWED"
476
+ "PLANNEDSCHEDULETOOLOW","PLANNEDSCHEDULETOOLOW"
477
+ "PLANNEDSCHEDULETOOHIGH","PLANNEDSCHEDULETOOHIGH"
478
+ "REFERENCETOOLONG","REFERENCETOOLONG"
479
+ "INVALIDQUANTITYFORAUCTIONBUYNOW","INVALIDQUANTITYFORAUCTIONBUYNOW"
480
+ "BUYNOWLOWERTHANSTARTPRICE","BUYNOWLOWERTHANSTARTPRICE"
481
+ "RICARDOPAYNOCARSANDBIKES","RICARDOPAYNOCARSANDBIKES"
482
+ "RICARDOPAYWRONGPAYMENTCONDITIONS","RICARDOPAYWRONGPAYMENTCONDITIONS"
483
+ "RICARDOPAYPRICETOOHIGH","RICARDOPAYPRICETOOHIGH"
484
+ "RICARDOPAYWALLETBLOCKED","RICARDOPAYWALLETBLOCKED"
485
+ "MAXPICTURESIZEREACHED","MAXPICTURESIZEREACHED"
486
+ "ERRORRESIZINGPICTURE","ERRORRESIZINGPICTURE"
487
+ "MAXPICTURESCOUNTREACHED","MAXPICTURESCOUNTREACHED"
488
+ "INVALIDPROMOTION","INVALIDPROMOTION"
489
+ "INVALIDPROMOTIONCOMBINATION","INVALIDPROMOTIONCOMBINATION"
490
+ "NOTCLOSED","NOTCLOSED"
491
+ "EMPTYARTICLEINFOS","EMPTYARTICLEINFOS"
492
+ "EMPTYDELIVERY","EMPTYDELIVERY"
493
+ "EMPTYPROMOTIONS","EMPTYPROMOTIONS"
494
+ "EMPTYDESCRIPTIONS","EMPTYDESCRIPTIONS"
495
+ "UPDATEARTICLEERROR","UPDATEARTICLEERROR"
496
+ "MULTIPLEUPDATENOTALLOWED","MULTIPLEUPDATENOTALLOWED"
497
+ "UPDATEARTICLECANTRETREIVEARTICLEINFORMATIONS","UPDATEARTICLECANTRETREIVEARTICLEINFORMATIONS"
498
+ "UPDATEARTICLECANTRETREIVECATEGORY","UPDATEARTICLECANTRETREIVECATEGORY"
499
+ "UPDATEARTICLECANTUPDATEDESCRIPTION","UPDATEARTICLECANTUPDATEDESCRIPTION"
500
+ "ARTICLEHASBIDS","ARTICLEHASBIDS"
501
+ "INVALIDPICTUREEXTENSTION","INVALIDPICTUREEXTENSTION"
502
+ "LANGUAGEIDNOTSET","LANGUAGEIDNOTSET"
503
+ "SETLIVEERROR","SETLIVEERROR"
504
+ "ARTICLENOTFOUND","ARTICLENOTFOUND"
505
+ "EMPTYPICTURES","EMPTYPICTURES"
506
+ "UPDATEFAILEDCOULDNOTLOCKARTICLE","UPDATEFAILEDCOULDNOTLOCKARTICLE"
507
+ "UPDATEFAILEDONARTICLETABLE","UPDATEFAILEDONARTICLETABLE"
508
+ "UPDATEFAILEDFORSTARTDATE","UPDATEFAILEDFORSTARTDATE"
509
+ "UPDATEFAILEDCOULDNOTDELETEOLDIMAGES","UPDATEFAILEDCOULDNOTDELETEOLDIMAGES"
510
+ "UPDATEFAILEDFORIMAGES","UPDATEFAILEDFORIMAGES"
511
+ "UPDATEFAILEDCOULDNOTDELETEOLDDESCRIPTIONS","UPDATEFAILEDCOULDNOTDELETEOLDDESCRIPTIONS"
512
+ "UPDATEFAILEDFORDESCRIPTIONS","UPDATEFAILEDFORDESCRIPTIONS"
513
+ "UPDATEFAILEDCOULDNOTDELETEOLDLIST","UPDATEFAILEDCOULDNOTDELETEOLDLIST"
514
+ "UPDATEFAILEDFORLIST","UPDATEFAILEDFORLIST"
515
+ "INSERTPREVIEWARTICLEERROR","INSERTPREVIEWARTICLEERROR"
516
+ "ONEPRICEMUSTBESET","ONEPRICEMUSTBESET"
517
+ "PICTUREBASEDPROMOTIONNEEDPICTURE","PICTUREBASEDPROMOTIONNEEDPICTURE"
518
+ "SUBTITLEMUSTBESETFORSUBTITLEPROMOTION","SUBTITLEMUSTBESETFORSUBTITLEPROMOTION"
519
+ "NOPAYMENTCONDITIONSELECTED","NOPAYMENTCONDITIONSELECTED"
520
+ "QUANTITYCANTINCREASE","QUANTITYCANTINCREASE"
521
+ "STARTPRICECANTINCREASE","STARTPRICECANTINCREASE"
522
+ "BUYNOWPRICECANTINCREASE","BUYNOWPRICECANTINCREASE"
523
+ "PROMOTIONCANTBEREMOVEDONUPDATE","PROMOTIONCANTBEREMOVEDONUPDATE"
524
+ "PROMOTIONCANTBEDOWNGRADED","PROMOTIONCANTBEDOWNGRADED"
525
+ "DURATIONCHANGESTOOMANY","DURATIONCHANGESTOOMANY"
526
+ "CANTPURCHASEWITHBUYNOW","CANTPURCHASEWITHBUYNOW"
527
+ "UNABLETOUPDATEQUANTITY","UNABLETOUPDATEQUANTITY"
528
+ "UNABLETOUPDATERELISTCOUNT","UNABLETOUPDATERELISTCOUNT"
529
+ "BUYNOWPROMOTIONNEEDED","BUYNOWPROMOTIONNEEDED"
530
+ "INVALIDMAXRELISTCOUNT","INVALIDMAXRELISTCOUNT"
531
+ "RELISTSOLDOUTAUCTIONNOTALLOWED","RELISTSOLDOUTAUCTIONNOTALLOWED"
532
+ "SUBTITLEALTERNATIVELANGUAGEISEMPTY","SUBTITLEALTERNATIVELANGUAGEISEMPTY"
533
+ "DELIVERYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","DELIVERYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY"
534
+ "PAYMENTDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","PAYMENTDESCRIPTIONALTERNATIVELANGUAGEISEMPTY"
535
+ "WARRANTYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY","WARRANTYDESCRIPTIONALTERNATIVELANGUAGEISEMPTY"
536
+ "TITLEALTERNATIVELANGUAGEISEMPTY","TITLEALTERNATIVELANGUAGEISEMPTY"
537
+ "DESCRIPTIONALTERNATIVELANGUAGEISEMPTY","DESCRIPTIONALTERNATIVELANGUAGEISEMPTY"
538
+ "SUBTITLEMAINLANGUAGEISEMPTY","SUBTITLEMAINLANGUAGEISEMPTY"
539
+ "DELIVERYDESCRIPTIONMAINLANGUAGEISEMPTY","DELIVERYDESCRIPTIONMAINLANGUAGEISEMPTY"
540
+ "PAYMENTDESCRIPTIONMAINLANGUAGEISEMPTY","PAYMENTDESCRIPTIONMAINLANGUAGEISEMPTY"
541
+ "WARRANTYDESCRIPTIONMAINLANGUAGEISEMPTY","WARRANTYDESCRIPTIONMAINLANGUAGEISEMPTY"
542
+ "TITLEMAINLANGUAGEISEMPTY","TITLEMAINLANGUAGEISEMPTY"
543
+ "DESCRIPTIONMAINLANGUAGEISEMPTY","DESCRIPTIONMAINLANGUAGEISEMPTY"
544
+ "CLOSED","CLOSED"
545
+ "TOOLONGMAINTITLE","TOOLONGMAINTITLE"
546
+ "TOOLONGMAINDESCRIPTION","TOOLONGMAINDESCRIPTION"
547
+ "TOOLONGMAINSUBTITLE","TOOLONGMAINSUBTITLE"
548
+ "TOOLONGALTERNATIVETITLE","TOOLONGALTERNATIVETITLE"
549
+ "TOOLONGALTERNATIVEDESCRIPTION","TOOLONGALTERNATIVEDESCRIPTION"
550
+ "TOOLONGALTERNATIVESUBTITLE","TOOLONGALTERNATIVESUBTITLE"
551
+ "TOOLONGMAINPAYMENTDESCRIPTION","TOOLONGMAINPAYMENTDESCRIPTION"
552
+ "TOOLONGALTERNATIVEPAYMENTDESCRIPTION","TOOLONGALTERNATIVEPAYMENTDESCRIPTION"
553
+ "TOOLONGMAINWARRANTYDESCRIPTION","TOOLONGMAINWARRANTYDESCRIPTION"
554
+ "TOOLONGALTERNATIVEWARRANTYDESCRIPTION","TOOLONGALTERNATIVEWARRANTYDESCRIPTION"
555
+ "TOOLONGMAINDELIVERYDESCRIPTION","TOOLONGMAINDELIVERYDESCRIPTION"
556
+ "TOOLONGALTERNATIVEDELIVERYDESCRIPTION","TOOLONGALTERNATIVEDELIVERYDESCRIPTION"
557
+ "BUYNOWPRICETOOLOW","BUYNOWPRICETOOLOW"
558
+ "BUYNOWPROMOTIONNOTALLOWED","BUYNOWPROMOTIONNOTALLOWED"
559
+ "CANTUPDATEPICTUREONARTICLEWITHBID","CANTUPDATEPICTUREONARTICLEWITHBID"
560
+ "HTMLTAGSNOTALLOWED","HTMLTAGSNOTALLOWED"
561
+ "WRONGPAYMENTCONDITIONS","WRONGPAYMENTCONDITIONS"
562
+ "EMPTYPAYMENTCONDITIONIDS","EMPTYPAYMENTCONDITIONIDS"
563
+ "NODETAILS","NODETAILS"
564
+ "ARTICLEALREADYHASCARDPAYMENT","ARTICLEALREADYHASCARDPAYMENT"
565
+ "ERRORINSERTINGCARDPAYMENT","ERRORINSERTINGCARDPAYMENT"
566
+ "ARTICLEDOESNOTHAVECARDPAYMENT","ARTICLEDOESNOTHAVECARDPAYMENT"
567
+ "ERRORREMOVINGCARDPAYMENT","ERRORREMOVINGCARDPAYMENT"
568
+ "RICARDOPAYNOTACTIVATED","RICARDOPAYNOTACTIVATED"
569
+ "EMPTYPAYMENTMETHODSIDS","EMPTYPAYMENTMETHODSIDS"
570
+ "EMPTYARTICLEID","EMPTYARTICLEID"
571
+ "INVALIDCARDCOMBINATIONWITHDELIVERYCONDITION","INVALIDCARDCOMBINATIONWITHDELIVERYCONDITION"
572
+ "NUMBEROFARTICLELIMITED","NUMBEROFARTICLELIMITED"
573
+ "PAYMENTMETHODNEEDALTERNATEONE","PAYMENTMETHODNEEDALTERNATEONE"
574
+ "WRONGPAYMENTMETHODS","WRONGPAYMENTMETHODS"
575
+ "CUMULATIVESHIPPINGNOTALLOWED","CUMULATIVESHIPPINGNOTALLOWED"
576
+
577
+ "MAXPICTURESCOUNTREACHED","MAXPICTURESCOUNTREACHED"
578
+ "MAXPICTURESIZEREACHED","MAXPICTURESIZEREACHED"
579
+ "ERRORRESIZINGPICTURE","ERRORRESIZINGPICTURE"
580
+ "PICTUREINDEXDOESNOTEXIST","PICTUREINDEXDOESNOTEXIST"
581
+ "EMPTYPICTURECONTENT","EMPTYPICTURECONTENT"
582
+ "NOPICTURES","NOPICTURES"
583
+ "INVALIDPICTUREINDEX","INVALIDPICTUREINDEX"
584
+ "MAXLOGOPICTURESIZEREACHED","MAXLOGOPICTURESIZEREACHED"
585
+ "ERRORRESIZINGLOGOPICTURE","ERRORRESIZINGLOGOPICTURE"
586
+
587
+ "NOTALLOWEDTOSELL","Product Not allowed to be sold"
588
+ "BILLINGERROR","BILLINGERROR"
589
+ "GETCUSTOMERERROR","GETCUSTOMERERROR"
590
+ "NEEDTOCHANGEPASSWORDERROR","NEEDTOCHANGEPASSWORDERROR"
591
+ "GETACCOUNTPREFERENCESERROR","GETACCOUNTPREFERENCESERROR"
592
+ "INVALIDARGUMENTS","INVALIDARGUMENTS"
593
+ "EMPTYCOUNTRYID","EMPTYCOUNTRYID"
594
+ "EMPTYNICKNAME","EMPTYNICKNAME"
595
+ "EMPTYIPADDRESS","EMPTYIPADDRESS"
596
+ "EMPTYEMAIL","EMPTYEMAIL"
597
+ "EMPTYCUSTOMERID","EMPTYCUSTOMERID"
598
+ "EMPTYGUID","EMPTYGUID"
599
+ "NICKNAMEISNOTUNIQUE","NICKNAMEISNOTUNIQUE"
600
+ "EMAILISNOTUNIQUE","EMAILISNOTUNIQUE"
601
+ "EMPTYFIRSTNAME","EMPTYFIRSTNAME"
602
+ "TOOLONGFIRSTNAME","TOOLONGFIRSTNAME"
603
+ "EMPTYLASTNAME","EMPTYLASTNAME"
604
+ "TOOLONGLASTNAME","TOOLONGLASTNAME"
605
+ "TOOLONGNICKNAME","TOOLONGNICKNAME"
606
+ "TOOLONGEMAIL","TOOLONGEMAIL"
607
+ "MUSTBEOVER18","MUSTBEOVER18"
608
+ "EMPTYADDRESS1","EMPTYADDRESS1"
609
+ "TOOLONGADDRESS1","TOOLONGADDRESS1"
610
+ "TOOLONGADDRESS2","TOOLONGADDRESS2"
611
+ "TOOLONGSTREETNR","TOOLONGSTREETNR"
612
+ "TOOLONGPOSTALBOX","TOOLONGPOSTALBOX"
613
+ "EMPTYZIPCODE","EMPTYZIPCODE"
614
+ "TOOLONGZIPCODE","TOOLONGZIPCODE"
615
+ "EMPTYCITY","EMPTYCITY"
616
+ "TOOLONGCITY","TOOLONGCITY"
617
+ "EMPTYCANTONID","EMPTYCANTONID"
618
+ "EMPTYPHONENUMBER","EMPTYPHONENUMBER"
619
+ "TOOLONGPHONENUMBER","TOOLONGPHONENUMBER"
620
+ "INVALIDNICKNAME","INVALIDNICKNAME"
621
+ "INVALIDEMAIL","INVALIDEMAIL"
622
+ "INVALIDSTREETNR","INVALIDSTREETNR"
623
+ "INVALIDZIPCODE","INVALIDZIPCODE"
624
+ "INVALIDPHONENUMBER","INVALIDPHONENUMBER"
625
+ "EMPTYPASSWORD","EMPTYPASSWORD"
626
+ "COMPANYDETAILSNOTFULL","COMPANYDETAILSNOTFULL"
627
+ "TOOLONGCOMPANYNAME","TOOLONGCOMPANYNAME"
628
+ "TOOLONGCOMPANYVATNUMBER","TOOLONGCOMPANYVATNUMBER"
629
+ "TOOLONGCOMPANYREGISTRYNUMBER","TOOLONGCOMPANYREGISTRYNUMBER"
630
+ "INVALIDVALIDATIONKEY","INVALIDVALIDATIONKEY"
631
+ "UNABLETOVALIDATE","UNABLETOVALIDATE"
632
+ "MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION","MAXNUMBEROFCALLSTOAUTOMATICALLYVALIDATEUSERINFORMATION"
633
+ "EMPTYSTREETNR","EMPTYSTREETNR"
634
+ "NOTCARDEALER","NOTCARDEALER"
635
+ "PASSWORDCOMPLEXITY","PASSWORDCOMPLEXITY"
636
+ "UNABLETOUPDATE","UNABLETOUPDATE"
637
+ "EMPTYNEWEMAIL","EMPTYNEWEMAIL"
638
+ "EMPTYNEWNICK","EMPTYNEWNICK"
639
+ "VALIDATIONKEYEXPIRED","VALIDATIONKEYEXPIRED"
640
+ "TOOMANYPREMIUMPACKAGES","TOOMANYPREMIUMPACKAGES"
641
+ "CARDPAYMENTOPTIONNOTAVAILABLE","CARDPAYMENTOPTIONNOTAVAILABLE"
642
+ "CUSTOMERBANNED","CUSTOMERBANNED"
643
+ "BUYERNOTFROMCHORLI","BUYERNOTFROMCHORLI"
644
+ "BUYERNORDVNORAC","BUYERNORDVNORAC"
645
+ "EMPTYCUSTOMERINFOS","EMPTYCUSTOMERINFOS"
646
+ "EMPTYMEMBERPREFERENCES","EMPTYMEMBERPREFERENCES"
647
+ "EMPTYADDRESSES","EMPTYADDRESSES"
648
+ "UNABLETOINSERT","UNABLETOINSERT"
649
+ "CREDITLIMITEXCEEDED","Credit limit exceeded. Please contact ricardo.ch"
650
+ "ACTIVATIONCODESTATUSMANUALLYBLOCKED","ACTIVATIONCODESTATUSMANUALLYBLOCKED"
651
+
652
+ "No Options because API not configured","No Options because API not configured"
653
+ "No Options because API has a problem","No Options because API has a problem"
654
+ "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>.", "Security error occurred with the ricardo API. Please, check your log files and your <a href=""%s"">API configuration</a>."
655
+ "Security error occurred with the ricardo API. Please, check your log files.", "Security error occurred with the ricardo API. Please, check your log files."
656
+ "Error occurred with the API. Check if the API is correctly configured: %s","Error occurred with the API. Check if the API is correctly configured: %s"
657
+ "Product Price of %s CHF is incorrect. Minimum price is %s.","Product Price of %s CHF is incorrect. Minimum price is %s."
658
+ "You cannot reactivate a product until sold out when doing an auction sales type.","You cannot reactivate a product until sold out when doing an auction sales type."
659
+ "Following error(s) appeared:","Following error(s) appeared:"
660
+ "<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction""","<strong>Attention:</strong> you cannot use the option ""Until Sold"" if you select the Sales Type ""Auction"""
app/locale/en_US/template/email/ricento/admin_message.html ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <!--@subject Admin Notification @-->
2
+ Dear Admin,
3
+
4
+ A problem appeared, here is the message log:
5
+
6
+ {{var message}}
app/locale/en_US/template/email/ricento/private_message.html ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var title}} @-->
2
+
3
+ <style type="text/css">
4
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
5
+ </style>
6
+
7
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
8
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
9
+ <tr>
10
+ <td align="center" valign="top">
11
+ <!-- [ header starts here] -->
12
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
13
+ <tr>
14
+ <td valign="top">
15
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
16
+ </tr>
17
+ </table>
18
+
19
+ <!-- [ middle starts here] -->
20
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
21
+ <tr>
22
+ <td valign="top">
23
+ <p><strong>Dear {{htmlescape var=$customer.name}}</strong>,</p>
24
+ {{var message}}
25
+ <p>If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_general/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_general/email'}}</a>.</p>
26
+ <p>Thanks again.</p>
27
+ <p>{{var store.getFrontendName()}} customer service</p>
28
+ </td>
29
+ </tr>
30
+ </table>
31
+
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
app/locale/fr_FR/Diglin_Ricento.csv ADDED
@@ -0,0 +1,669 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "ricardo.ch","ricardo.ch"
2
+ "Dashboard","Dashboard"
3
+ "Products Listing","Products Listing"
4
+ "Logs","Logs"
5
+ "ricardo.ch Assistant","ricardo.ch Assistant"
6
+ "Configuration","Configuration"
7
+ "Ricento by Diglin GmbH","Ricento by Diglin GmbH"
8
+ "Log","Log"
9
+ "ricardo.ch Payment Methods","ricardo.ch Payment Methods"
10
+ "ricardo.ch Shipping","ricardo.ch Shipping"
11
+ "Admin Email Notification","Admin Email Notification"
12
+ "Private message","Private message"
13
+ "Global Configuration","Global Configuration"
14
+ "Merge Order","Merge Order"
15
+ "If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?","If a customer order several products in a period of 30 minutes, do you want to merge the ricardo transaction in one order?"
16
+ "Shipping Calculation","Shipping Calculation"
17
+ "You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>
18
+ ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>
19
+ ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.
20
+ ","You can decide how do you want to calculate the shipping cost when an order merge several bought products by a customer.<br>
21
+ ""Highest Price"": it will find which product has the highest cost for the shipping and will take only this one for the calculation.<br>
22
+ ""Cumulative"": it will calculate the shipping cost based on the configuration you did in the products listing for each article and will combine them.
23
+ "
24
+ "Send Account Creation Confirmation Email","Send Account Creation Confirmation Email"
25
+ "Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?","Do you want to send a confirmation email to a customer when his account is created thanks to the ricardo.ch API?"
26
+ "Send Email for new order","Send Email for new order"
27
+ "Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?","Do you want to send the newly order created by email to a customer when the order is created thanks to the ricardo.ch API?"
28
+ "API Token Configuration","API Token Configuration"
29
+ "General API Config","General API Config"
30
+ "ricardo.ch Extension enabled","ricardo.ch Extension enabled"
31
+ "Development Mode","Development Mode"
32
+ "If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below.","If you enable this configuration, all API requests will be send to the ricardo.ch Sandbox instead to use the production servers. Be aware, you have to provide others partner Keys and Passwords specific for dev environment below."
33
+ "Debug","Debug"
34
+ "Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast.","Write into the var/log/ricento.log file all requests sent to the ricardo.ch API. Enable it to help us to support you and send this file to us if you have an issue. Your passwords will be anonymized. Attention: the file size can grow quite fast."
35
+ "German API Token","German API Token"
36
+ "PROD German Partner Key","PROD German Partner Key"
37
+ "Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","Partner Key has the following format '0F12345-1234-1234-1234-1234567890'. You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page"
38
+ "PROD German Partner Password","PROD German Partner Password"
39
+ "You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page","You have to sign up to the ricardo.ch API to get this information. Click on the button at the top of this page"
40
+ "DEV German Partner Key","DEV German Partner Key"
41
+ "DEV German Partner Password","DEV German Partner Password"
42
+ "French API Token","French API Token"
43
+ "PROD French Partner Key","PROD French Partner Key"
44
+ "PROD French Partner Password","PROD French Partner Password"
45
+ "DEV French Partner Key","DEV French Partner Key"
46
+ "DEV French Partner Password","DEV French Partner Password"
47
+ "Cleanup Synchronization Jobs Log","Cleanup Synchronization Jobs Log"
48
+ "Enabled","Enabled"
49
+ "Keep for X days","Keep for X days"
50
+ "Cleanup Listings Log","Cleanup Listings Log"
51
+ "ricardo.ch API Payment Methods","ricardo.ch API Payment Methods"
52
+ "Bank Transfer Instructions","Bank Transfer Instructions"
53
+ "Accepted Currency","Accepted Currency"
54
+ "Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold","Stock quantity set to 1 because auction sales type with direct buy option does not allow more than one article to be sold"
55
+ "Invalid start date.","Invalid start date."
56
+ "The end date must be in the future.","The end date must be in the future."
57
+ "Listed listings cannot be modified. Stop the listing first to make changes.","Listed listings cannot be modified. Stop the listing first to make changes."
58
+ "An error occurred while saving the configuration.","An error occurred while saving the configuration."
59
+ "ricardo.ch Service Model doesn\'t exists.","ricardo.ch Service Model doesn\'t exists."
60
+ "ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed.","ricardo.ch API Credentials are not configured. Please, configure the extension before to proceed."
61
+ "API language provided for the Service Manager is not supported.","API language provided for the Service Manager is not supported."
62
+ "Error while trying to connect to the ricardo.ch API. Please, check your log files.","Error while trying to connect to the ricardo.ch API. Please, check your log files."
63
+ "The format of the token is invalid","The format of the token is invalid"
64
+ "The dispatcher of type '%s' is not found at %s.","The dispatcher of type '%s' is not found at %s."
65
+ "Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract.","Dispatcher Class %s doesn't implements Diglin_Ricento_Model_Dispatcher_Abstract."
66
+ "The product has been sold","The product has been sold"
67
+ "Customer creation failed! ricardo.ch transaction cannot be added.","Customer creation failed! ricardo.ch transaction cannot be added."
68
+ "Order automatically generated by the ricardo.ch Extension.","Order automatically generated by the ricardo.ch Extension."
69
+ "Payment is pending","Payment is pending"
70
+ "Payment has been completed on ricardo.ch side","Payment has been completed on ricardo.ch side"
71
+ "Order canceled on ricardo.ch side","Order canceled on ricardo.ch side"
72
+ "Country Code is not available. Please contact the author of this extension or support.","Country Code is not available. Please contact the author of this extension or support."
73
+ "Report: %d success, %d warning(s), %d error(s)","Report: %d success, %d warning(s), %d error(s)"
74
+ "Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">clicking here</a>. Products with an error won't be synchronized, you have to fix the problem first.","Successful products checked are going to be listed. To force to list products having a warning, please <a href=""%s"">clicking here</a>. Products with an error won\'t be synchronized, you have to fix the problem first."
75
+ "The product is now live on ricardo.ch","The product is now live on ricardo.ch"
76
+ "Sorry, the product has not been sold","Sorry, the product has not been sold"
77
+ "This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch","This item is already listed or has already a ricardo article Id. No insert done to ricardo.ch"
78
+ "The product has been removed from ricardo.ch","The product has been removed from ricardo.ch"
79
+ "The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it.","The product has not been removed from ricardo.ch. Probably because someone bid the product or bought it."
80
+ "Report: %d success, %d error(s)","Report: %d success, %d error(s)"
81
+ "errors","errors"
82
+ "warnings","warnings"
83
+ "success","success"
84
+ "The Job has finished with %s.","The Job has finished with %s."
85
+ "Please, view the <a href=""%s"">log</a> for details.","Please, view the <a href=""%s"">log</a> for details."
86
+ "No item is ready for this job. No action has been done.","No item is ready for this job. No action has been done."
87
+ "Error Code: %d","Error Code: %d"
88
+ "Notice","Notice"
89
+ "Success","Success"
90
+ "Error","Error"
91
+ "Warning","Warning"
92
+ "Product item checks","Product item checks"
93
+ "List product item to ricardo.ch","List product item to ricardo.ch"
94
+ "Stop product item to ricardo.ch","Stop product item to ricardo.ch"
95
+ "Default Values","Default Values"
96
+ "No package","No package"
97
+ "-- Select Product Attribute --","-- Select Product Attribute --"
98
+ "-- Select Method --","-- Select Method --"
99
+ "No change","No change"
100
+ "Relative increase (+ %)","Relative increase (+ %)"
101
+ "Relative decrease (- %)","Relative decrease (- %)"
102
+ "Absolute increase (+)","Absolute increase (+)"
103
+ "Absolute decrease (-)","Absolute decrease (-)"
104
+ "None","None"
105
+ "ricardo.ch Condition","ricardo.ch Condition"
106
+ "-- Please Select --","-- Please Select --"
107
+ "Auction","Auction"
108
+ "Buy now","Buy now"
109
+ "Highest Price","Highest Price"
110
+ "Cumulative","Cumulative"
111
+ "Pending","Pending"
112
+ "Running","Running"
113
+ "Ready","Ready"
114
+ "Completed","Completed"
115
+ "Products Check Job","Products Check Job"
116
+ "List Job","List Job"
117
+ "Stop List Job","Stop List Job"
118
+ "Sync Order Job","Sync Order Job"
119
+ "Relist Job","Relist Job"
120
+ "Update Job","Update Job"
121
+ "Sync List Job","Sync List Job"
122
+ "-- Please select --","-- Please select --"
123
+ "All languages","All languages"
124
+ "Listed","Listed"
125
+ "Stopped","Stopped"
126
+ "Ready to list","Ready to list"
127
+ "Check in progress...","Check in progress..."
128
+ "List in progress...","List in progress..."
129
+ "Job in progress...","Job in progress..."
130
+ "Product Title will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Title will be cut after %s characters when published on ricardo.ch for store ""%s"""
131
+ "Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Subtitle will be cut after %s characters when published on ricardo.ch for store ""%s"""
132
+ "Product Description will be cut after %s characters when published on ricardo.ch for store ""%s""","Product Description will be cut after %s characters when published on ricardo.ch for store ""%s"""
133
+ "Custom Options are not supported. Those won\'t be synchronized into ricardo.ch.","Custom Options are not supported. Those won\'t be synchronized into ricardo.ch."
134
+ "The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock.","The product or its associated products is/are not in stock or doesn\'t have enough quantity in stock."
135
+ "Only %s currency is supported. No conversion will be done.","Only %s currency is supported. No conversion will be done."
136
+ "You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level.","You MUST define a ricardo category for this product. Check that you set it at products listing level or at Magento category level."
137
+ "Payment and/or Shipping combination are not correct.","Payment and/or Shipping combination are not correct."
138
+ "You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s.","You cannot have a starting price for an auction of %2$s when you set a direct sales with a product price of %1$s."
139
+ "Product Price of %s CHF is incorrect for a direct sales with credit card. Price must be between %s and %s.","Product Price of %s CHF is incorrect for a direct sales. Price must be between %s and %s."
140
+ "The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days","The ending date is too early or too late. Minimum period allowed: %s days - Maximum period allowed: %s days"
141
+ "You cannot use the privilege spaces as you do not have any pictures for this product.","You cannot use the privilege spaces as you do not have any pictures for this product."
142
+ "This increment value is not possible for this start price.","This increment value is not possible for this start price."
143
+ "Only the following combinations are possible:","Only the following combinations are possible:"
144
+ "Start price is between","Start price is between"
145
+ "Increment must be between","Increment must be between"
146
+ "This payment method combination is not possible.","This payment method combination is not possible."
147
+ "The following combinations are possible:","The following combinations are possible:"
148
+ "It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method","It is not possible to combine ""Other"" shipping method with ""Credit Card"" payment method"
149
+ "No category will be displayed, the products listing doesn\'t exists. Please, close the window.","No category will be displayed, the products listing doesn\'t exists. Please, close the window."
150
+ "You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window.","You are not allowed to save the products listing, so you cannot add products from a category. Please, close the window."
151
+ "Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists.","Product(s) from the selected categories cannot be saved. The products listing doesn\'t exists."
152
+ "You are not allowed to save the products listing, so you cannot add products from a category.","You are not allowed to save the products listing, so you cannot add products from a category."
153
+ "%d product(s) added to the listing","%d product(s) added to the listing"
154
+ "Error occurred while saving the product(s) from the selected categories. Please check your exception log.","Error occurred while saving the product(s) from the selected categories. Please check your exception log."
155
+ "The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","The action you try to do, is not possible. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process"
156
+ "Listing name and website must be specified.","Listing name and website must be specified."
157
+ "We have detected and set for you the language configuration. Please, review it before to go further.","We have detected and set for you the language configuration. Please, review it before to go further."
158
+ "The listing has been saved.","The listing has been saved."
159
+ "An error occurred while saving the listing.","An error occurred while saving the listing."
160
+ "Listed listings cannot be deleted. Stop the listing first.","Listed listings cannot be deleted. Stop the listing first."
161
+ "Listing deleted","Listing deleted"
162
+ "%d products removed from listing","%d products removed from listing"
163
+ "%d products are listed and could not be removed","%d products are listed and could not be removed"
164
+ "The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire.","The API token and configuration are not ready to allow this action. Please, check that your token is enabled and not going to expire."
165
+ "A similar job is already running. This job won\'t be executed.","A similar job is already running. This job won\'t be executed."
166
+ "It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process","It\'s s not possible to start this job. You must authorize the API token. Please, go the <a href=""%s"">ricardo.ch Authorization</a> page to do the authorization process"
167
+ "An error occurred while starting this job. Please check your log file.","An error occurred while starting this job. Please check your log file."
168
+ "The job to check your products listing will start in few minutes. You can check the progression below.","The job to check your products listing will start in few minutes. You can check the progression below."
169
+ "If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues.","If it finishes with success, your products will be listed automatically otherwise you will have to choose if you want to keep going to list or fix potential issues."
170
+ "There is no product ready to be listed. Please, add products to your products listing ""%s"".","There is no product ready to be listed. Please, add products to your products listing ""%s""."
171
+ "There is no pending product to check.","There is no pending product to check."
172
+ "The job to list your products listing will start in few minutes.","The job to list your products listing will start in few minutes."
173
+ "You can check the progression below.","You can check the progression below."
174
+ "There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d.","There is no item to relist. Only products who have been sold on ricardo.ch can be relisted for the products listing %d."
175
+ "Only listed product items can be stopped.","Only listed product items can be stopped."
176
+ "The job to stop to list your products will start in few minutes.","The job to stop to list your products will start in few minutes."
177
+ "Products listing(s) is/are successfully deleted.","Products listing(s) is/are successfully deleted."
178
+ "The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode(","The following products listings IDs have not been deleted because they are still listed on ricardo.ch: ' . implode("
179
+ "An error occurred while trying to delete the products listing(s). Please, check your exception log.","An error occurred while trying to delete the products listing(s). Please, check your exception log."
180
+ "No products selected.","No products selected."
181
+ "The configuration has been saved successfully.","The configuration has been saved successfully."
182
+ "An error occurred while saving the configuration. Please, check your log files for more details.","An error occurred while saving the configuration. Please, check your log files for more details."
183
+ "It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different.","It\'s just a preview. Please, be aware that the display on ricardo.ch might be slightly different."
184
+ "Log(s) is/are successfully deleted.","Log(s) is/are successfully deleted."
185
+ "An error occurred while trying to delete the listing log(s). Please, check your exception log.","An error occurred while trying to delete the listing log(s). Please, check your exception log."
186
+ "Job(s) is/are successfully deleted.","Job(s) is/are successfully deleted."
187
+ "The following job IDs have not been deleted because they are still running: ' . implode(","The following job IDs have not been deleted because they are still running: ' . implode("
188
+ "An error occurred while trying to delete the job(s). Please, check your exception log.","An error occurred while trying to delete the job(s). Please, check your exception log."
189
+ "ricardo.ch API Signup","ricardo.ch API Signup"
190
+ "API Signup","API Signup"
191
+ "ricardo.ch Assistant Portal","ricardo.ch Assistant Portal"
192
+ "Assistant Portal","Assistant Portal"
193
+ "Only Ajax call is allowed here.","Only Ajax call is allowed here."
194
+ "The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side.","The website code returned from ricardo.ch is not correct! Your authorization has not been saved on our side."
195
+ "Your ricardo.ch account has been authorized to get access to the API.","Your ricardo.ch account has been authorized to get access to the API."
196
+ "An error occurred while saving the token. Please, check your log files.","An error occurred while saving the token. Please, check your log files."
197
+ "Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason.","Authorization was not successful on ricardo.ch side. Please, contact ricardo.ch to find out the reason."
198
+ "Sign Up to ricardo.ch API","Sign Up to ricardo.ch API"
199
+ "API Authorization","API Authorization"
200
+ "No Selection","No Selection"
201
+ "Open ricardo.ch Category Window","Open ricardo.ch Category Window"
202
+ "Add products from selected categories","Add products from selected categories"
203
+ "Only product types supported, enabled and not listed in other products listing will be added.","Only product types supported, enabled and not listed in other products listing will be added."
204
+ "Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories.","Be aware, you have also to select the sub-categories, otherwise selecting only a top category won\'t allow to add products of its subcategories."
205
+ "Create new listing","Create new listing"
206
+ "Show Synchronization Jobs","Show Synchronization Jobs"
207
+ "General","General"
208
+ "Products","Products"
209
+ "Sales Options","Sales Options"
210
+ "Rules","Rules"
211
+ "Product ID","Product ID"
212
+ "Name","Name"
213
+ "Price","Price"
214
+ "Type","Type"
215
+ "SKU","SKU"
216
+ "Inventory","Inventory"
217
+ "Status","Status"
218
+ "Action","Action"
219
+ "Preview","Preview"
220
+ "Configure","Configure"
221
+ "Remove","Remove"
222
+ "Are you sure to remove this/these product(s)?","Are you sure to remove this/these product(s)?"
223
+ "Remove from list","Remove from list"
224
+ "the sales options","the sales options"
225
+ "the shipping and payment rules","the shipping and payment rules"
226
+ "This product has been configured for %s %s","This product has been configured for %s %s"
227
+ "The product has custom options, those will not be added to ricardo.ch!","The product has custom options, those will not be added to ricardo.ch!"
228
+ "ID","ID"
229
+ "Add selected product(s)","Add selected product(s)"
230
+ "Title","Title"
231
+ "Website","Website"
232
+ "Language","Language"
233
+ "Product languages to synchronize to ricardo.ch.ch","Product languages to synchronize to ricardo.ch.ch"
234
+ "ricardo.ch.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc).","ricardo.ch.ch supports only two languages at the moment: German and French. You can set in which language you want to publish your product content (title, subtitle, description, etc)."
235
+ "Default language to publish","Default language to publish"
236
+ "Which language to publish by default to ricardo.ch.ch when the product content is not available in a language","Which language to publish by default to ricardo.ch.ch when the product content is not available in a language"
237
+ "Store View for ' . ucwords(Mage::app()->getLocale()->getTranslation($lang, 'language","Store View for ' . ucwords(Mage::app()->getLocale()->getTranslation($lang, 'language"
238
+ "Payment Methods","Payment Methods"
239
+ "Payment Description German","Payment Description German"
240
+ "Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other""","Characters: %s. Max. 5 000 characters. Payment information to display to customers. Will be send to ricardo only if you select the method ""Other"""
241
+ "Payment Description French","Payment Description French"
242
+ "Shipping Methods","Shipping Methods"
243
+ "Shipping Price","Shipping Price"
244
+ "Free shipping","Free shipping"
245
+ "Is Shipping fee cumulative","Is Shipping fee cumulative"
246
+ "If you select this option, the shipping fee will be calculate for each sold product.","If you select this option, the shipping fee will be calculate for each sold product."
247
+ "e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option.","e.g. an article is sold with a quantity of 3 to one customer and the shipping fee is 15 CHF. Total Shipping fee is 45 CHF. Let it empty if you don\'t such an option."
248
+ "Shipping Availability","Shipping Availability"
249
+ "Shipping Description German","Shipping Description German"
250
+ "Characters: %s. Max. 5 000 characters","Characters: %s. Max. 5 000 characters"
251
+ "Shipping Description French","Shipping Description French"
252
+ "The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed.","The store's base currency is {$storeCurrency}. Only %s is allowed as currency. No currency conversion will be proceed."
253
+ "Category","Category"
254
+ "ricardo.ch Category","ricardo.ch Category"
255
+ "Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)","Use Magento / ricardo.ch Category mapping (if mapping does not exist, an error message will be triggered while preparing the synchronization to ricardo.ch)"
256
+ "Select ricardo.ch Category","Select ricardo.ch Category"
257
+ "Select the category","Select the category"
258
+ "Type of sales","Type of sales"
259
+ "Until Sold","Until Sold"
260
+ "Start price","Start price"
261
+ "Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95.","Range from Fr. 0.05 to Fr. 1 000 000. If Credit card payment method available and enabled, the range is from Fr. 0.05 to Fr. 2 999.95."
262
+ "Increment","Increment"
263
+ "Currency","Currency"
264
+ "Allow Direct Buy","Allow Direct Buy"
265
+ "Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1.","Fill in the fieldset ""Buy now"" below to define the direct price settings. <strong>Note</strong>: if set to ""Yes"", the stock management will be set to ""Custom Qty"" with a value of 1."
266
+ "Source","Source"
267
+ "Price Change","Price Change"
268
+ "For Fixed Price articles, the minimum price is Fr. 0.05 and maximum Fr. 2 999.95 if the Credit Card payment method is used.","For Fixed Pri