Nosto_Tagging - Version 2.9.0

Version Notes

- Add support for sending the account details & new platform UI
- Add check if table `nosto_tagging_customer` already exists before creating it
- Add visitor checksum tagging
- Strip out _Main Website_ from the default account title
- Disable tagging categories if there are hidden categories in the category path

Download this release

Release Info

Developer Nosto
Extension Nosto_Tagging
Version 2.9.0
Comparing to
See all releases


Code changes from version 2.6.14 to 2.9.0

Files changed (156) hide show
  1. app/code/community/Nosto/Tagging/Block/Addtocart.php +9 -7
  2. app/code/community/Nosto/Tagging/Block/Adminhtml/Iframe.php +18 -9
  3. app/code/community/Nosto/Tagging/Block/Adminhtml/Notifications.php +165 -0
  4. app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/CronFrequency.php +139 -0
  5. app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Formats.php +88 -0
  6. app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Method.php +83 -0
  7. app/code/community/Nosto/Tagging/Block/Adminhtml/Wizard.php +6 -6
  8. app/code/community/Nosto/Tagging/Block/Cart.php +23 -8
  9. app/code/community/Nosto/Tagging/Block/Category.php +12 -9
  10. app/code/community/Nosto/Tagging/Block/Customer.php +59 -9
  11. app/code/community/Nosto/Tagging/Block/Element.php +9 -7
  12. app/code/community/Nosto/Tagging/Block/Embed.php +12 -8
  13. app/code/community/Nosto/Tagging/Block/Meta.php +9 -7
  14. app/code/community/Nosto/Tagging/Block/Order.php +22 -7
  15. app/code/community/Nosto/Tagging/Block/Order/Vaimo/Klarna/Checkout.php +95 -0
  16. app/code/community/Nosto/Tagging/Block/Pagetype.php +75 -0
  17. app/code/community/Nosto/Tagging/Block/Product.php +12 -9
  18. app/code/community/Nosto/Tagging/Block/Searchterm.php +6 -2
  19. app/code/community/Nosto/Tagging/Block/Variation.php +85 -0
  20. app/code/community/Nosto/Tagging/Helper/Account.php +166 -37
  21. app/code/community/Nosto/Tagging/Helper/Cache.php +55 -0
  22. app/code/community/Nosto/Tagging/Helper/Class.php +76 -0
  23. app/code/community/Nosto/Tagging/Helper/Currency.php +118 -0
  24. app/code/community/Nosto/Tagging/Helper/Customer.php +27 -7
  25. app/code/community/Nosto/Tagging/Helper/Data.php +370 -9
  26. app/code/community/Nosto/Tagging/Helper/Date.php +6 -6
  27. app/code/community/Nosto/Tagging/Helper/Oauth.php +6 -6
  28. app/code/community/Nosto/Tagging/Helper/Price.php +146 -28
  29. app/code/community/Nosto/Tagging/Helper/Setup.php +112 -0
  30. app/code/community/Nosto/Tagging/Helper/Url.php +277 -45
  31. app/code/community/Nosto/Tagging/Model/Base.php +6 -6
  32. app/code/community/Nosto/Tagging/Model/Collection/Rates.php +33 -0
  33. app/code/community/Nosto/Tagging/Model/Container/Cart.php +13 -6
  34. app/code/community/Nosto/Tagging/Model/Container/Customer.php +15 -6
  35. app/code/community/Nosto/Tagging/Model/Customer.php +6 -6
  36. app/code/community/Nosto/Tagging/Model/Export/Collection/Order.php +12 -8
  37. app/code/community/Nosto/Tagging/Model/Meta/Account.php +77 -17
  38. app/code/community/Nosto/Tagging/Model/Meta/Account/Billing.php +6 -6
  39. app/code/community/Nosto/Tagging/Model/Meta/Account/Iframe.php +7 -7
  40. app/code/community/Nosto/Tagging/Model/Meta/Account/Owner.php +14 -12
  41. app/code/community/Nosto/Tagging/Model/Meta/Oauth.php +9 -13
  42. app/code/community/Nosto/Tagging/Model/Meta/Order.php +9 -7
  43. app/code/community/Nosto/Tagging/Model/Meta/Order/Buyer.php +7 -6
  44. app/code/community/Nosto/Tagging/Model/Meta/Order/Item.php +14 -7
  45. app/code/community/Nosto/Tagging/Model/Meta/Order/Status.php +7 -6
  46. app/code/community/Nosto/Tagging/Model/Meta/Order/Vaimo/Klarna/Checkout.php +334 -0
  47. app/code/community/Nosto/Tagging/Model/Meta/Product.php +284 -67
  48. app/code/community/Nosto/Tagging/Model/Observer.php +164 -35
  49. app/code/community/Nosto/Tagging/Model/Product.php +6 -6
  50. app/code/community/Nosto/Tagging/Model/Resource/Customer.php +6 -6
  51. app/code/community/Nosto/Tagging/Model/Resource/Customer/Collection.php +6 -6
  52. app/code/community/Nosto/Tagging/Model/Resource/Product/Collection.php +6 -6
  53. app/code/community/Nosto/Tagging/Model/Resource/Setup.php +6 -6
  54. app/code/community/Nosto/Tagging/Model/Service/Order.php +13 -8
  55. app/code/community/Nosto/Tagging/Model/System/Config/Backend/Currency/Exchange/Rate/Cron.php +82 -0
  56. app/code/community/Nosto/Tagging/Model/System/Config/Source/Brand.php +49 -0
  57. app/code/community/Nosto/Tagging/Model/System/Config/Source/Cron/Frequency.php +59 -0
  58. app/code/community/Nosto/Tagging/Model/System/Config/Source/Custom/Tags.php +50 -0
  59. app/code/community/Nosto/Tagging/Model/System/Config/Source/Image.php +16 -12
  60. app/code/community/Nosto/Tagging/Model/System/Config/Source/Multi/Currency/Method.php +60 -0
  61. app/code/community/Nosto/Tagging/bootstrap.php +24 -31
  62. app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php +212 -9
  63. app/code/community/Nosto/Tagging/controllers/ExportController.php +17 -11
  64. app/code/community/Nosto/Tagging/controllers/OauthController.php +14 -8
  65. app/code/community/Nosto/Tagging/etc/adminhtml.xml +25 -26
  66. app/code/community/Nosto/Tagging/etc/cache.xml +25 -26
  67. app/code/community/Nosto/Tagging/etc/config.xml +73 -28
  68. app/code/community/Nosto/Tagging/etc/system.xml +209 -28
  69. app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-install-2.8.0.php +37 -0
  70. app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-upgrade-2.8.0-2.8.2.php +37 -0
  71. app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-install-1.2.0.php +45 -43
  72. app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-upgrade-1.1.7-1.2.0.php +6 -6
  73. app/design/adminhtml/default/default/layout/nostotagging.xml +30 -26
  74. app/design/adminhtml/default/default/template/nostotagging/iframe.phtml +9 -8
  75. app/design/adminhtml/default/default/template/nostotagging/notifications.phtml +56 -0
  76. app/design/adminhtml/default/default/template/nostotagging/system/config/currency/cronFrequency.phtml +78 -0
  77. app/design/adminhtml/default/default/template/nostotagging/system/config/currency/formats.phtml +47 -0
  78. app/design/adminhtml/default/default/template/nostotagging/wizard.phtml +8 -8
  79. app/design/frontend/base/default/layout/nostotagging.xml +117 -27
  80. app/design/frontend/base/default/template/nostotagging/addtocart.phtml +40 -15
  81. app/design/frontend/base/default/template/nostotagging/cart.phtml +10 -11
  82. app/design/frontend/base/default/template/nostotagging/category.phtml +8 -10
  83. app/design/frontend/base/default/template/nostotagging/customer.phtml +8 -8
  84. app/design/frontend/base/default/template/nostotagging/element.phtml +8 -10
  85. app/design/frontend/base/default/template/nostotagging/embed.phtml +11 -16
  86. app/design/frontend/base/default/template/nostotagging/jsstub.phtml +35 -0
  87. app/design/frontend/base/default/template/nostotagging/meta.phtml +8 -10
  88. app/design/frontend/base/default/template/nostotagging/order.phtml +9 -10
  89. app/design/frontend/base/default/template/nostotagging/{category/view.phtml → pagetype.phtml} +5 -6
  90. app/design/frontend/base/default/template/nostotagging/product.phtml +10 -12
  91. app/design/frontend/base/default/template/nostotagging/searchterm.phtml +5 -7
  92. app/design/frontend/base/default/template/nostotagging/variation.phtml +37 -0
  93. app/etc/modules/Nosto_Tagging.xml +25 -26
  94. js/nosto/iframeHandler.min.js +1 -1
  95. lib/nosto/php-sdk/src/classes/Nosto.php +47 -7
  96. lib/nosto/php-sdk/src/classes/NostoAccount.php +52 -12
  97. lib/nosto/php-sdk/src/classes/NostoAccountMeta.php +110 -43
  98. lib/nosto/php-sdk/src/classes/NostoCipher.php +3 -2
  99. lib/nosto/php-sdk/src/classes/NostoCurrency.php +27 -16
  100. lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php +1 -0
  101. lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php +1 -0
  102. lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php +1 -0
  103. lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php +1 -0
  104. lib/nosto/php-sdk/src/classes/NostoDotEnv.php +3 -2
  105. lib/nosto/php-sdk/src/classes/NostoExchangeRate.php +1 -0
  106. lib/nosto/php-sdk/src/classes/NostoMessage.php +3 -2
  107. lib/nosto/php-sdk/src/classes/NostoNotification.php +256 -0
  108. lib/nosto/php-sdk/src/classes/NostoObject.php +3 -2
  109. lib/nosto/php-sdk/src/classes/NostoOrderConfirmation.php +5 -2
  110. lib/nosto/php-sdk/src/classes/NostoProductReCrawl.php +6 -3
  111. lib/nosto/php-sdk/src/classes/NostoValidator.php +14 -13
  112. lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php +3 -2
  113. lib/nosto/php-sdk/src/classes/api/NostoApiToken.php +16 -2
  114. lib/nosto/php-sdk/src/classes/collection/NostoCollection.php +3 -2
  115. lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php +3 -2
  116. lib/nosto/php-sdk/src/classes/collection/NostoOrderCollection.php +3 -2
  117. lib/nosto/php-sdk/src/classes/collection/NostoProductCollection.php +3 -2
  118. lib/nosto/php-sdk/src/classes/exception/NostoApiResponseException.php +42 -0
  119. lib/nosto/php-sdk/src/classes/exception/NostoException.php +3 -2
  120. lib/nosto/php-sdk/src/classes/exception/NostoHttpException.php +64 -2
  121. lib/nosto/php-sdk/src/classes/exception/NostoHttpResponseException.php +42 -0
  122. lib/nosto/php-sdk/src/classes/export/NostoExportOrderCollection.php +5 -2
  123. lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php +4 -38
  124. lib/nosto/php-sdk/src/classes/export/NostoExporter.php +3 -2
  125. lib/nosto/php-sdk/src/classes/helper/NostoHelper.php +3 -2
  126. lib/nosto/php-sdk/src/classes/helper/NostoHelperDate.php +3 -2
  127. lib/nosto/php-sdk/src/classes/helper/NostoHelperIframe.php +27 -19
  128. lib/nosto/php-sdk/src/classes/helper/NostoHelperPrice.php +10 -4
  129. lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php +13 -2
  130. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapter.php +3 -2
  131. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php +10 -7
  132. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php +6 -2
  133. lib/nosto/php-sdk/src/classes/http/NostoHttpResponse.php +7 -6
  134. lib/nosto/php-sdk/src/classes/oauth/NostoOAuthClient.php +5 -4
  135. lib/nosto/php-sdk/src/classes/oauth/NostoOAuthToken.php +3 -2
  136. lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php +1 -0
  137. lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php +7 -4
  138. lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php +56 -11
  139. lib/nosto/php-sdk/src/config.inc.php +7 -2
  140. lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php +3 -2
  141. lib/nosto/php-sdk/src/interfaces/NostoExportCollectionInterface.php +3 -2
  142. lib/nosto/php-sdk/src/interfaces/NostoNotificationInterface.php +108 -0
  143. lib/nosto/php-sdk/src/interfaces/NostoOAuthClientMetaDataInterface.php +3 -2
  144. lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php +102 -8
  145. lib/nosto/php-sdk/src/interfaces/NostoValidatableInterface.php +3 -2
  146. lib/nosto/php-sdk/src/interfaces/account/NostoAccountInterface.php +19 -3
  147. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataBillingDetailsInterface.php +3 -2
  148. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataIframeInterface.php +3 -2
  149. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php +10 -2
  150. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataOwnerInterface.php +3 -2
  151. lib/nosto/php-sdk/src/interfaces/order/NostoOrderBuyerInterface.php +3 -2
  152. lib/nosto/php-sdk/src/interfaces/order/NostoOrderInterface.php +10 -2
  153. lib/nosto/php-sdk/src/interfaces/order/NostoOrderPurchasedItemInterface.php +3 -2
  154. lib/nosto/php-sdk/src/interfaces/order/NostoOrderStatusInterface.php +3 -2
  155. lib/nosto/php-sdk/src/js/src/NostoIframe.js +4 -3
  156. package.xml +204 -135
app/code/community/Nosto/Tagging/Block/Addtocart.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -41,8 +41,10 @@ class Nosto_Tagging_Block_Addtocart extends Mage_Core_Block_Template
41
  */
42
  protected function _toHtml()
43
  {
 
 
44
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
45
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
46
  ) {
47
  return '';
48
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
41
  */
42
  protected function _toHtml()
43
  {
44
+ /** @var Nosto_Tagging_Helper_Account $helper */
45
+ $helper = Mage::helper('nosto_tagging/account');
46
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
47
+ || !$helper->existsAndIsConnected()
48
  ) {
49
  return '';
50
  }
app/code/community/Nosto/Tagging/Block/Adminhtml/Iframe.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -36,6 +36,7 @@
36
  class Nosto_Tagging_Block_Adminhtml_Iframe extends Mage_Adminhtml_Block_Template
37
  {
38
  const DEFAULT_IFRAME_ORIGIN_REGEXP = '(https:\/\/(.*)\.hub\.nosto\.com)|(https:\/\/my\.nosto\.com)';
 
39
 
40
  /**
41
  * @var string the iframe url if SSO to Nosto can be made.
@@ -77,10 +78,18 @@ class Nosto_Tagging_Block_Adminhtml_Iframe extends Mage_Adminhtml_Block_Template
77
  $session->setData('nosto_message', null);
78
  }
79
  }
 
80
  $store = $this->getSelectedStore();
81
- $account = Mage::helper('nosto_tagging/account')->find($store);
82
- return $this->_iframeUrl = Mage::helper('nosto_tagging/account')
83
- ->getIframeUrl($store, $account, $params);
 
 
 
 
 
 
 
84
  }
85
 
86
  /**
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
36
  class Nosto_Tagging_Block_Adminhtml_Iframe extends Mage_Adminhtml_Block_Template
37
  {
38
  const DEFAULT_IFRAME_ORIGIN_REGEXP = '(https:\/\/(.*)\.hub\.nosto\.com)|(https:\/\/my\.nosto\.com)';
39
+ const IFRAME_VERSION = 1;
40
 
41
  /**
42
  * @var string the iframe url if SSO to Nosto can be made.
78
  $session->setData('nosto_message', null);
79
  }
80
  }
81
+ $params['v'] = self::IFRAME_VERSION;
82
  $store = $this->getSelectedStore();
83
+ /* @var Mage_Core_Model_App_Emulation $emulation */
84
+ $emulation = Mage::getSingleton('core/app_emulation');
85
+ $env = $emulation->startEnvironmentEmulation($store->getId());
86
+ /** @var Nosto_Tagging_Helper_Account $helper */
87
+ $helper = Mage::helper('nosto_tagging/account');
88
+ $account = $helper->find($store);
89
+ $this->_iframeUrl = $helper->getIframeUrl($store, $account, $params);
90
+ $emulation->stopEnvironmentEmulation($env);
91
+
92
+ return $this->_iframeUrl;
93
  }
94
 
95
  /**
app/code/community/Nosto/Tagging/Block/Adminhtml/Notifications.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Nosto notification block.
30
+ * Adds a notification for showing information about missing tokens
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
37
+ {
38
+ /**
39
+ * The id for the a tag where echange rate cron is configured
40
+ *
41
+ * @var string
42
+ */
43
+ const EXCHANGE_RATE_CRON_FRAGMENT = 'nosto_tagging_scheduled_currency_exchange_rate_update-head';
44
+
45
+ /**
46
+ * Returns the status of the accounts for showing the notification. If any
47
+ * of the accounts use multi-currency and have tokens missing, then the
48
+ * notification bar should inform the merchant
49
+ *
50
+ * @return bool true or false indicating the status of the accounts
51
+ */
52
+ public function allAccountsOK()
53
+ {
54
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
55
+ $accountHelper = Mage::helper('nosto_tagging/account');
56
+ /** @var Nosto_Tagging_Helper_Data $dataHelper */
57
+ $dataHelper = Mage::helper('nosto_tagging/data');
58
+ foreach (Mage::app()->getStores() as $store) {
59
+ /** @var NostoAccount $account */
60
+ $account = $accountHelper->find($store);
61
+ if ($account !== null
62
+ && $account->isConnectedToNosto()
63
+ && $account->hasMissingTokens()
64
+ && !$dataHelper->multiCurrencyDisabled($store)) {
65
+ return false;
66
+ }
67
+ }
68
+ return true;
69
+ }
70
+
71
+ /**
72
+ * Get index management url
73
+ *
74
+ * @return string
75
+ */
76
+ public function getConfigureUrl()
77
+ {
78
+ return $this->getUrl(
79
+ 'adminhtml/system_config/edit/section/nosto_tagging',
80
+ array(
81
+ '_fragment' => self::EXCHANGE_RATE_CRON_FRAGMENT
82
+ )
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Returns the status of the cron of the accounts for showing the
88
+ * notification. If any of the accounts use multi-currency but cron is
89
+ * disabled then the notification bar should inform the merchant
90
+ *
91
+ * @return bool true or false indicating the cron status
92
+ */
93
+ public function cronEnabledIfNeeded()
94
+ {
95
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
96
+ $accountHelper = Mage::helper('nosto_tagging/account');
97
+ /** @var Nosto_Tagging_Helper_Data $dataHelper */
98
+ $dataHelper = Mage::helper('nosto_tagging/data');
99
+ foreach (Mage::app()->getStores() as $store) {
100
+ $account = $accountHelper->find($store);
101
+ if ($account !== null
102
+ && !$dataHelper->multiCurrencyDisabled($store)
103
+ && !$dataHelper->isScheduledCurrencyExchangeRateUpdateEnabled($store)) {
104
+ return false;
105
+ }
106
+ }
107
+ return true;
108
+ }
109
+
110
+ /**
111
+ * Checks if any of the Nosto accounts where previously installed into a
112
+ * different store or magento installtion. This would happen mostly when
113
+ * development/staging setup is deployed to the production or vice versa.
114
+ *
115
+ * Return array structure
116
+ * [
117
+ * 'savedUrl' => $savedFrontPageUrl,
118
+ * 'currentUrl' => $currentFrontPageUrl,
119
+ * 'storeName' => $store->getName(),
120
+ * 'nostoAccount' => $nostoAccount->getName(),
121
+ * 'actionUrl' => $this->getUrl(
122
+ * ]
123
+ *
124
+ * @return array (see structure above)
125
+ */
126
+ public function getInvalidAccountDomains()
127
+ {
128
+ /** @var Nosto_Tagging_Helper_Url $urlHelper */
129
+ $urlHelper = Mage::helper('nosto_tagging/url');
130
+ /** @var Nosto_Tagging_Helper_Data $dataHelper */
131
+ $dataHelper = Mage::helper('nosto_tagging/data');
132
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
133
+ $accountHelper = Mage::helper('nosto_tagging/account');
134
+ $result = array();
135
+ /* @var $store Mage_Core_Model_Store */
136
+ foreach (Mage::app()->getStores() as $store) {
137
+ $savedFrontPageUrl = $dataHelper->getStoreFrontPageUrl($store);
138
+ /* @var $nostoAccount NostoAccount */
139
+ $nostoAccount = $accountHelper->find($store);
140
+ if (
141
+ empty($savedFrontPageUrl)
142
+ || $nostoAccount instanceof NostoAccount == false
143
+ ) {
144
+ continue;
145
+ }
146
+ $currentFrontPageUrl = $urlHelper->getFrontPageUrl($store);
147
+ if ($savedFrontPageUrl != $currentFrontPageUrl) {
148
+ $invalidConfig = array(
149
+ 'savedUrl' => $savedFrontPageUrl,
150
+ 'currentUrl' => $currentFrontPageUrl,
151
+ 'storeName' => $store->getName(),
152
+ 'nostoAccount' => $nostoAccount->getName(),
153
+ 'actionUrl' => $this->getUrl(
154
+ 'adminhtml/nosto/resetAccountSettings/',
155
+ array('store'=>$store->getId())
156
+ )
157
+ );
158
+
159
+ $result[] = $invalidConfig;
160
+ }
161
+ }
162
+
163
+ return $result;
164
+ }
165
+ }
app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/CronFrequency.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for editing Nosto's currency exchange cron frequency
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Block_Adminhtml_System_Config_Currency_CronFrequency
36
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
37
+ {
38
+ /**
39
+ * The select name
40
+ */
41
+ const HOUR_SELECT_NAME = 'groups[scheduled_currency_exchange_rate_update][fields][time][value][]';
42
+
43
+ /**
44
+ * Array of the available frequency options
45
+ *
46
+ * @var array
47
+ */
48
+ private $options;
49
+
50
+ /**
51
+ * Form element to be rendered
52
+ *
53
+ * @var Varien_Data_Form_Element_Abstract
54
+ */
55
+ private $element;
56
+
57
+ /**
58
+ * @inheritdoc
59
+ */
60
+ protected function _construct()
61
+ {
62
+ parent::_construct();
63
+ $this->setTemplate(
64
+ 'nostotagging/system/config/currency/cronFrequency.phtml'
65
+ );
66
+ }
67
+
68
+ /**
69
+ * @inheritdoc
70
+ */
71
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
72
+ {
73
+ $this->element = $element;
74
+ $data = $this->element->getData();
75
+ if (isset($data['values']) && is_array($data['values'])) {
76
+ $this->options = $data['values'];
77
+ } else {
78
+ Mage::log(
79
+ 'Could not find any options for cron frequency',
80
+ Zend_Log::ERR,
81
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
82
+ );
83
+ }
84
+
85
+ return $this->_toHtml();
86
+ }
87
+
88
+ /**
89
+ * Returns the options for exchange rate cron frequency
90
+ *
91
+ * @return array
92
+ */
93
+ public function getOptions()
94
+ {
95
+ return $this->options;
96
+ }
97
+
98
+ /**
99
+ * Returns the id of the select id
100
+ *
101
+ * @return array
102
+ */
103
+ public function getSelectId()
104
+ {
105
+ return $this->element->getHtmlId();
106
+ }
107
+
108
+ /**
109
+ * Returns the name of the select tag
110
+ *
111
+ * @return array
112
+ */
113
+ public function getSelectName()
114
+ {
115
+ return $this->element->getName();
116
+ }
117
+
118
+ /**
119
+ * Returns the name of the hour select field
120
+ *
121
+ * @return array
122
+ */
123
+ public function getHourSelectName()
124
+ {
125
+ return self::HOUR_SELECT_NAME;
126
+ }
127
+
128
+ /**
129
+ * Returns the current value
130
+ *
131
+ * @return array
132
+ */
133
+ public function getCurrentValue()
134
+ {
135
+ /* @var Nosto_Tagging_Helper_Data $configHelper */
136
+ $configHelper = Mage::helper('nosto_tagging');
137
+ return $configHelper->getExchangeRateCronFrequency();
138
+ }
139
+ }
app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Formats.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Info block to show the current configured currency formats for the viewed
30
+ * store scope on the system config page.
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Block_Adminhtml_System_Config_Currency_Formats extends Mage_Adminhtml_Block_System_Config_Form_Field
37
+ {
38
+ /**
39
+ * @inheritdoc
40
+ */
41
+ protected function _construct()
42
+ {
43
+ parent::_construct();
44
+ $this->setTemplate('nostotagging/system/config/currency/formats.phtml');
45
+ }
46
+
47
+ /**
48
+ * @inheritdoc
49
+ */
50
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
51
+ {
52
+ return $this->_toHtml();
53
+ }
54
+
55
+ /**
56
+ * Returns a list of Zend_Currency objects for selected store scope,
57
+ * configured for the stores locale.
58
+ * These can be used to format the price string in the view file.
59
+ *
60
+ * @return array the currency objects per store.
61
+ */
62
+ public function getCurrencyFormats()
63
+ {
64
+ $formats = array();
65
+ $storeId = $this->getRequest()->getParam('store');
66
+ /** @var Mage_Core_Model_Store[] $stores */
67
+ if (!empty($storeId)) {
68
+ $stores = array(Mage::app()->getStore($storeId));
69
+ } else {
70
+ $stores = Mage::app()->getStores();
71
+ }
72
+ foreach ($stores as $store) {
73
+ $formats[$store->getName()] = array();
74
+ $currencyCodes = $store->getAvailableCurrencyCodes(true);
75
+ if (is_array($currencyCodes) && count($currencyCodes) > 0) {
76
+ $locale = $store->getConfig('general/locale/code');
77
+ foreach ($currencyCodes as $currencyCode) {
78
+ try {
79
+ $formats[$store->getName()][] = new Zend_Currency($currencyCode, $locale);
80
+ } catch (Zend_Exception $e) {
81
+ continue;
82
+ }
83
+ }
84
+ }
85
+ }
86
+ return $formats;
87
+ }
88
+ }
app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Method.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extension system setting source model for choosing the multi-currency method
30
+ * to use.
31
+ *
32
+ * Options are "Exchange Rate" and "Product Tagging". The former makes use of the built
33
+ * in currency exchange rates and is the preferred method. The latter is the old
34
+ * way of tagging all price variations on the product pages.
35
+ *
36
+ * @category Nosto
37
+ * @package Nosto_Tagging
38
+ * @author Nosto Solutions Ltd <magento@nosto.com>
39
+ */
40
+ class Nosto_Tagging_Block_Adminhtml_System_Config_Currency_Method extends Mage_Adminhtml_Block_System_Config_Form_Field
41
+ {
42
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
43
+ {
44
+ $store = null;
45
+ $disabled = false;
46
+ if ($code = $this->getRequest()->getParam('store')) {
47
+ $store = Mage::getModel('core/store')->load($code);
48
+ }
49
+ if ($store instanceof Mage_Core_Model_Store) {
50
+ /* @var Nosto_Tagging_Helper_Account $accountHelper */
51
+ $accountHelper = Mage::helper('nosto_tagging/account');
52
+ /* @var NostoAccount $nostoAccount */
53
+ $nostoAccount = $accountHelper->find($store);
54
+ if($nostoAccount instanceof NostoAccountInterface) {
55
+ foreach (NostoApiToken::getApiTokenNames() as $token) {
56
+ if (!$nostoAccount->getApiToken($token)) {
57
+ $disabled = true;
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ if ($disabled === true) {
65
+ /** @noinspection PhpUndefinedMethodInspection */
66
+ $element->setDisabled('disabled');
67
+ $metaOauth = new Nosto_Tagging_Model_Meta_Oauth();
68
+ /** @noinspection PhpUndefinedVariableInspection */
69
+ $metaOauth->loadData($store, $nostoAccount);
70
+ $client = new NostoOAuthClient($metaOauth);
71
+ $comment = sprintf(
72
+ 'Your Nosto account is missing required tokens' .
73
+ ' for updating settings to Nosto. Please click <a href="%s">' .
74
+ ' here to re-connect</a> your account.',
75
+ $client->getAuthorizationUrl()
76
+ );
77
+ $element->setData(
78
+ 'comment', $comment
79
+ );
80
+ }
81
+ return parent::_getElementHtml($element);
82
+ }
83
+ }
app/code/community/Nosto/Tagging/Block/Adminhtml/Wizard.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Block/Cart.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -43,8 +43,10 @@ class Nosto_Tagging_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
43
  */
44
  protected function _toHtml()
45
  {
 
 
46
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
47
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
48
  ) {
49
  return '';
50
  }
@@ -61,7 +63,9 @@ class Nosto_Tagging_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
61
  // come through a generic block that cannot be used for this specific
62
  // action.
63
  if (count($this->getItems()) > 0) {
64
- Mage::helper('nosto_tagging/customer')->updateNostoId();
 
 
65
  }
66
 
67
  return parent::_toHtml();
@@ -181,4 +185,15 @@ class Nosto_Tagging_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
181
 
182
  return $name;
183
  }
 
 
 
 
 
 
 
 
 
 
 
184
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
43
  */
44
  protected function _toHtml()
45
  {
46
+ /** @var Nosto_Tagging_Helper_Account $helper */
47
+ $helper = Mage::helper('nosto_tagging/account');
48
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
49
+ || !$helper->existsAndIsConnected()
50
  ) {
51
  return '';
52
  }
63
  // come through a generic block that cannot be used for this specific
64
  // action.
65
  if (count($this->getItems()) > 0) {
66
+ /** @var Nosto_Tagging_Helper_Customer $customerHelper */
67
+ $customerHelper = Mage::helper('nosto_tagging/customer');
68
+ $customerHelper->updateNostoId();
69
  }
70
 
71
  return parent::_toHtml();
185
 
186
  return $name;
187
  }
188
+
189
+ /*
190
+ * Returns the visitor's Nosto Id
191
+ */
192
+ public function getVisitorChecksum()
193
+ {
194
+ /* @var $helper Nosto_Tagging_Helper_Data */
195
+ $helper = Mage::helper('nosto_tagging');
196
+
197
+ return $helper->getVisitorChecksum();
198
+ }
199
  }
app/code/community/Nosto/Tagging/Block/Category.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -49,8 +49,10 @@ class Nosto_Tagging_Block_Category extends Mage_Core_Block_Template
49
  */
50
  protected function _toHtml()
51
  {
 
 
52
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
53
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
54
  || !$this->getCategory()
55
  ) {
56
  return '';
@@ -68,8 +70,9 @@ class Nosto_Tagging_Block_Category extends Mage_Core_Block_Template
68
  {
69
  if (!$this->_category) {
70
  $category = Mage::registry('current_category');
71
- $this->_category = Mage::helper('nosto_tagging')
72
- ->buildCategoryString($category);
 
73
  }
74
 
75
  return $this->_category;
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
49
  */
50
  protected function _toHtml()
51
  {
52
+ /** @var Nosto_Tagging_Helper_Account $helper */
53
+ $helper = Mage::helper('nosto_tagging/account');
54
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
55
+ || !$helper->existsAndIsConnected()
56
  || !$this->getCategory()
57
  ) {
58
  return '';
70
  {
71
  if (!$this->_category) {
72
  $category = Mage::registry('current_category');
73
+ /** @var Nosto_Tagging_Helper_Data $helper */
74
+ $helper = Mage::helper('nosto_tagging');
75
+ $this->_category = $helper->buildCategoryString($category);
76
  }
77
 
78
  return $this->_category;
app/code/community/Nosto/Tagging/Block/Customer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -43,13 +43,63 @@ class Nosto_Tagging_Block_Customer extends Mage_Customer_Block_Account_Dashboard
43
  */
44
  protected function _toHtml()
45
  {
46
- if (!$this->helper('customer')->isLoggedIn()
47
- || !$this->helper('nosto_tagging')->isModuleEnabled()
48
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
 
 
 
49
  ) {
50
  return '';
51
  }
52
 
53
  return parent::_toHtml();
54
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
43
  */
44
  protected function _toHtml()
45
  {
46
+ /** @var Nosto_Tagging_Helper_Account $helper */
47
+ $helper = Mage::helper('nosto_tagging/account');
48
+ /** @noinspection PhpUndefinedMethodInspection */
49
+ if (!Mage::helper('nosto_tagging')->isModuleEnabled()
50
+ || !$helper->existsAndIsConnected()
51
+ || !$this->helper('customer')->isLoggedIn()
52
  ) {
53
  return '';
54
  }
55
 
56
  return parent::_toHtml();
57
  }
58
+
59
+ /*
60
+ * Returns the visitor's Nosto Id
61
+ */
62
+ public function getVisitorChecksum()
63
+ {
64
+ /* @var $helper Nosto_Tagging_Helper_Data */
65
+ $helper = Mage::helper('nosto_tagging');
66
+
67
+ return $helper->getVisitorChecksum();
68
+ }
69
+
70
+ /*
71
+ * Returns the customer reference of the customer
72
+ */
73
+ protected function getCustomerReference()
74
+ {
75
+ try {
76
+ /* @var $customerHelper Nosto_Tagging_Helper_Customer */
77
+ $customerHelper = Mage::helper('nosto_tagging/customer');
78
+ /* @var $customer Mage_Customer_Model_Customer */
79
+ $customer = $this->getCustomer();
80
+ $ref = $customer->getData(
81
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
82
+ );
83
+ if (empty($ref)) {
84
+ $ref = $customerHelper->generateCustomerReference($customer);
85
+ $customer->setData(
86
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
87
+ $ref
88
+ );
89
+ $customer->save();
90
+ }
91
+ } catch (\Exception $e) {
92
+ Mage::log(
93
+ sprintf(
94
+ 'Could not get customer reference. Error was: %s',
95
+ $e->getMessage()
96
+ ),
97
+ Zend_Log::ERR,
98
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
99
+ );
100
+ $ref = null;
101
+ }
102
+
103
+ return $ref;
104
+ }
105
  }
app/code/community/Nosto/Tagging/Block/Element.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -50,8 +50,10 @@ class Nosto_Tagging_Block_Element extends Mage_Core_Block_Template
50
  */
51
  protected function _toHtml()
52
  {
 
 
53
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
54
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
55
  ) {
56
  return '';
57
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
50
  */
51
  protected function _toHtml()
52
  {
53
+ /** @var Nosto_Tagging_Helper_Account $helper */
54
+ $helper = Mage::helper('nosto_tagging/account');
55
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
56
+ || !$helper->existsAndIsConnected()
57
  ) {
58
  return '';
59
  }
app/code/community/Nosto/Tagging/Block/Embed.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -46,8 +46,10 @@ class Nosto_Tagging_Block_Embed extends Mage_Core_Block_Template
46
  */
47
  protected function _toHtml()
48
  {
 
 
49
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
50
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
51
  ) {
52
  return '';
53
  }
@@ -62,7 +64,9 @@ class Nosto_Tagging_Block_Embed extends Mage_Core_Block_Template
62
  */
63
  public function getAccountName()
64
  {
65
- $account = Mage::helper('nosto_tagging/account')->find();
 
 
66
  if ($account !== null) {
67
  return $account->name;
68
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
46
  */
47
  protected function _toHtml()
48
  {
49
+ /** @var Nosto_Tagging_Helper_Account $helper */
50
+ $helper = Mage::helper('nosto_tagging/account');
51
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
52
+ || !$helper->existsAndIsConnected()
53
  ) {
54
  return '';
55
  }
64
  */
65
  public function getAccountName()
66
  {
67
+ /** @var Nosto_Tagging_Helper_Account $helper */
68
+ $helper = Mage::helper('nosto_tagging/account');
69
+ $account = $helper->find();
70
  if ($account !== null) {
71
  return $account->name;
72
  }
app/code/community/Nosto/Tagging/Block/Meta.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -42,8 +42,10 @@ class Nosto_Tagging_Block_Meta extends Mage_Core_Block_Template
42
  */
43
  protected function _toHtml()
44
  {
 
 
45
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
46
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
47
  ) {
48
  return '';
49
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
42
  */
43
  protected function _toHtml()
44
  {
45
+ /** @var Nosto_Tagging_Helper_Account $helper */
46
+ $helper = Mage::helper('nosto_tagging/account');
47
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
48
+ || !$helper->existsAndIsConnected()
49
  ) {
50
  return '';
51
  }
app/code/community/Nosto/Tagging/Block/Order.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -43,8 +43,10 @@ class Nosto_Tagging_Block_Order extends Mage_Checkout_Block_Success
43
  */
44
  protected function _toHtml()
45
  {
 
 
46
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
47
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
48
  ) {
49
  return '';
50
  }
@@ -59,6 +61,7 @@ class Nosto_Tagging_Block_Order extends Mage_Checkout_Block_Success
59
  */
60
  public function getLastOrder()
61
  {
 
62
  $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
63
  /** @var Mage_Sales_Model_Order $order */
64
  $order = Mage::getModel('sales/order')->load($orderId);
@@ -67,4 +70,16 @@ class Nosto_Tagging_Block_Order extends Mage_Checkout_Block_Success
67
  $meta->loadData($order);
68
  return $meta;
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
43
  */
44
  protected function _toHtml()
45
  {
46
+ /** @var Nosto_Tagging_Helper_Account $helper */
47
+ $helper = Mage::helper('nosto_tagging/account');
48
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
49
+ || !$helper->existsAndIsConnected()
50
  ) {
51
  return '';
52
  }
61
  */
62
  public function getLastOrder()
63
  {
64
+ /** @noinspection PhpUndefinedMethodInspection */
65
  $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
66
  /** @var Mage_Sales_Model_Order $order */
67
  $order = Mage::getModel('sales/order')->load($orderId);
70
  $meta->loadData($order);
71
  return $meta;
72
  }
73
+
74
+ /*
75
+ * Returns the visitor's Nosto Id
76
+ */
77
+ public function getVisitorChecksum()
78
+ {
79
+ /* @var $helper Nosto_Tagging_Helper_Data */
80
+ $helper = Mage::helper('nosto_tagging');
81
+
82
+ return $helper->getVisitorChecksum();
83
+ }
84
+
85
  }
app/code/community/Nosto/Tagging/Block/Order/Vaimo/Klarna/Checkout.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Order tagging block.
30
+ * Adds meta-data to the HTML document for successful orders.
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Block_Order_Vaimo_Klarna_Checkout extends Mage_Checkout_Block_Success
37
+ {
38
+ /**
39
+ * Render order info as hidden meta data if the module is enabled for the
40
+ * current store.
41
+ *
42
+ * @return string
43
+ */
44
+ protected function _toHtml()
45
+ {
46
+ /** @var Nosto_Tagging_Helper_Account $helper */
47
+ $helper = Mage::helper('nosto_tagging/account');
48
+ if (!Mage::helper('nosto_tagging')->isModuleEnabled()
49
+ || !$helper->existsAndIsConnected()
50
+ ) {
51
+ return '';
52
+ }
53
+
54
+ return parent::_toHtml();
55
+ }
56
+
57
+ /**
58
+ * Return the last placed order meta data for the customer.
59
+ *
60
+ * @return Nosto_Tagging_Model_Meta_Order the order meta data model.
61
+ */
62
+ public function getLastOrder()
63
+ {
64
+ $nostoOrder = null;
65
+ try {
66
+ $checkoutId = Mage::getSingleton('checkout/session')->getKlarnaCheckoutPrevId();
67
+ /* @var Nosto_Tagging_Model_Meta_Order_Vaimo_Klarna_Checkout $nostoOrder */
68
+ $nostoOrder = Mage::getModel('nosto_tagging/meta_order_vaimo_klarna_checkout');
69
+ $nostoOrder->loadOrderByKlarnaCheckoutId($checkoutId);
70
+ } catch (Exception $e) {
71
+ Mage::log(
72
+ sprintf(
73
+ 'Could not create Nosto order from Klarna order. Error was: %s',
74
+ $e->getMessage()
75
+ ),
76
+ Zend_Log::ERR,
77
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
78
+ );
79
+ }
80
+
81
+ return $nostoOrder;
82
+ }
83
+
84
+ /*
85
+ * Returns the visitor's Nosto Id
86
+ */
87
+ public function getVisitorChecksum()
88
+ {
89
+ /* @var $helper Nosto_Tagging_Helper_Data */
90
+ $helper = Mage::helper('nosto_tagging');
91
+
92
+ return $helper->getVisitorChecksum();
93
+ }
94
+
95
+ }
app/code/community/Nosto/Tagging/Block/Pagetype.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Nosto page-type block.
30
+ * Defines the page-type so they can be used for the popup triggers
31
+ *
32
+ * @method string getPageType() Return the type of the page (defined in layout).
33
+ *
34
+ * @category Nosto
35
+ * @package Nosto_Tagging
36
+ * @author Nosto Solutions Ltd <magento@nosto.com>
37
+ */
38
+ class Nosto_Tagging_Block_Pagetype extends Mage_Core_Block_Template
39
+ {
40
+ /**
41
+ * Default type assigned to the page if none is set in the layout xml.
42
+ */
43
+ const DEFAULT_TYPE = 'unknown';
44
+
45
+ /**
46
+ * Render HTML for the page type if the module is enabled for the current
47
+ * store.
48
+ *
49
+ * @return string
50
+ */
51
+ protected function _toHtml()
52
+ {
53
+ if (!Mage::helper('nosto_tagging')->isModuleEnabled()
54
+ || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
55
+ ) {
56
+ return '';
57
+ }
58
+ return parent::_toHtml();
59
+ }
60
+
61
+ /**
62
+ * Return the page-type of the current page. If none is defined in the layout xml,
63
+ * then set a default one.
64
+ *
65
+ * @return string
66
+ */
67
+ public function getPageTypeName()
68
+ {
69
+ $type = $this->getPageType();
70
+ if ($type === null) {
71
+ $type = self::DEFAULT_TYPE;
72
+ }
73
+ return $type;
74
+ }
75
+ }
app/code/community/Nosto/Tagging/Block/Product.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -56,8 +56,10 @@ class Nosto_Tagging_Block_Product extends Mage_Catalog_Block_Product_Abstract
56
  */
57
  protected function _toHtml()
58
  {
 
 
59
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
60
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
61
  ) {
62
  return '';
63
  }
@@ -90,8 +92,9 @@ class Nosto_Tagging_Block_Product extends Mage_Catalog_Block_Product_Abstract
90
  {
91
  if (!$this->_currentCategory) {
92
  $category = Mage::registry('current_category');
93
- $this->_currentCategory = Mage::helper('nosto_tagging')
94
- ->buildCategoryString($category);
 
95
  }
96
 
97
  return $this->_currentCategory;
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
56
  */
57
  protected function _toHtml()
58
  {
59
+ /** @var Nosto_Tagging_Helper_Account $helper */
60
+ $helper = Mage::helper('nosto_tagging/account');
61
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
62
+ || !$helper->existsAndIsConnected()
63
  ) {
64
  return '';
65
  }
92
  {
93
  if (!$this->_currentCategory) {
94
  $category = Mage::registry('current_category');
95
+ /** @var Nosto_Tagging_Helper_Data $helper */
96
+ $helper = Mage::helper('nosto_tagging');
97
+ $this->_currentCategory = $helper->buildCategoryString($category);
98
  }
99
 
100
  return $this->_currentCategory;
app/code/community/Nosto/Tagging/Block/Searchterm.php CHANGED
@@ -42,8 +42,10 @@ class Nosto_Tagging_Block_Searchterm extends Mage_Core_Block_Template
42
  */
43
  protected function _toHtml()
44
  {
 
 
45
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
46
- || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()
47
  ) {
48
  return '';
49
  }
@@ -58,6 +60,8 @@ class Nosto_Tagging_Block_Searchterm extends Mage_Core_Block_Template
58
  */
59
  public function getSearchTerm()
60
  {
61
- return $this->helper('catalogsearch')->getQueryText();
 
 
62
  }
63
  }
42
  */
43
  protected function _toHtml()
44
  {
45
+ /** @var Nosto_Tagging_Helper_Account $helper */
46
+ $helper = Mage::helper('nosto_tagging/account');
47
  if (!Mage::helper('nosto_tagging')->isModuleEnabled()
48
+ || !$helper->existsAndIsConnected()
49
  ) {
50
  return '';
51
  }
60
  */
61
  public function getSearchTerm()
62
  {
63
+ /** @var Mage_CatalogSearch_Helper_Data $helper */
64
+ $helper = $this->helper('catalogsearch');
65
+ return $helper->getQueryText();
66
  }
67
  }
app/code/community/Nosto/Tagging/Block/Variation.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Current variation tagging block.
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Block_Variation extends Mage_Core_Block_Template
36
+ {
37
+ /**
38
+ * @var string variationId
39
+ */
40
+ protected $_variationId;
41
+
42
+ /**
43
+ * Render variation string as hidden meta data if the module is enabled for
44
+ * the current store.
45
+ *
46
+ * @return string
47
+ */
48
+ protected function _toHtml()
49
+ {
50
+ /** @var Nosto_Tagging_Helper_Account $helper */
51
+ $helper = Mage::helper('nosto_tagging/account');
52
+ if (!Mage::helper('nosto_tagging')->isModuleEnabled()
53
+ || !$helper->existsAndIsConnected()
54
+ ) {
55
+ return '';
56
+ }
57
+
58
+ return parent::_toHtml();
59
+ }
60
+
61
+ /**
62
+ * Return the current variation id
63
+ *
64
+ * @return string
65
+ */
66
+ public function getVariationId()
67
+ {
68
+ $store = Mage::app()->getStore();
69
+ return $store->getCurrentCurrencyCode();
70
+ }
71
+
72
+ /**
73
+ * Tells if store uses multiple currencies
74
+ *
75
+ * @return string
76
+ */
77
+ public function useMultiCurrency()
78
+ {
79
+ /** @var Nosto_Tagging_Helper_Data $helper */
80
+ $helper = Mage::helper('nosto_tagging');
81
+ $store = Mage::app()->getStore();
82
+
83
+ return $helper->isMultiCurrencyMethodExchangeRate($store);
84
+ }
85
+ }
app/code/community/Nosto/Tagging/Helper/Account.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -51,12 +51,16 @@ class Nosto_Tagging_Helper_Account extends Mage_Core_Helper_Abstract
51
  /**
52
  * Saves the account and the associated api tokens for the store view scope.
53
  *
54
- * @param NostoAccount $account the account to save.
55
- * @param Mage_Core_Model_Store|null $store the store view to save it for.
56
  *
57
  * @return bool true on success, false otherwise.
 
58
  */
59
- public function save(NostoAccount $account, Mage_Core_Model_Store $store = null)
 
 
 
60
  {
61
  if ($store === null) {
62
  $store = Mage::app()->getStore();
@@ -77,12 +81,19 @@ class Nosto_Tagging_Helper_Account extends Mage_Core_Helper_Abstract
77
  self::XML_PATH_TOKENS, json_encode($tokens), 'stores',
78
  $store->getId()
79
  );
80
- Mage::app()->getCacheInstance()->cleanType('config');
 
 
 
 
 
 
81
  return true;
82
  }
83
 
84
  /**
85
- * Removes an account with associated api tokens for the store view scope.
 
86
  *
87
  * @param NostoAccount $account the account to remove.
88
  * @param Mage_Core_Model_Store|null $store the store view to remove it for.
@@ -91,33 +102,24 @@ class Nosto_Tagging_Helper_Account extends Mage_Core_Helper_Abstract
91
  */
92
  public function remove(NostoAccount $account, Mage_Core_Model_Store $store = null)
93
  {
94
- if ($store === null) {
95
- $store = Mage::app()->getStore();
96
- }
97
- if ((int)$store->getId() < 1) {
98
- return false;
99
- }
100
- /** @var Mage_Core_Model_Config $config */
101
- $config = Mage::getModel('core/config');
102
- $config->saveConfig(
103
- self::XML_PATH_ACCOUNT, null, 'stores', $store->getId()
104
- );
105
- $config->saveConfig(
106
- self::XML_PATH_TOKENS, null, 'stores', $store->getId()
107
- );
108
- Mage::app()->getCacheInstance()->cleanType('config');
109
-
110
- try {
111
- // Notify Nosto that the account was deleted.
112
- $account->delete();
113
- } catch (NostoException $e) {
114
- // Failures are logged but not shown to the user.
115
- Mage::log(
116
- "\n" . $e->__toString(), Zend_Log::ERR, 'nostotagging.log'
117
- );
118
  }
119
 
120
- return true;
121
  }
122
 
123
  /**
@@ -198,6 +200,133 @@ class Nosto_Tagging_Helper_Account extends Mage_Core_Helper_Abstract
198
  /** @var Nosto_Tagging_Model_Meta_Account_Iframe $meta */
199
  $meta = Mage::getModel('nosto_tagging/meta_account_iframe');
200
  $meta->loadData($store);
201
- return Nosto::helper('iframe')->getUrl($meta, $account, $params);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
51
  /**
52
  * Saves the account and the associated api tokens for the store view scope.
53
  *
54
+ * @param NostoAccount $account the account to save.
55
+ * @param Mage_Core_Model_Store|null $store the store view to save it for.
56
  *
57
  * @return bool true on success, false otherwise.
58
+ *
59
  */
60
+ public function save(
61
+ NostoAccount $account,
62
+ Mage_Core_Model_Store $store = null
63
+ )
64
  {
65
  if ($store === null) {
66
  $store = Mage::app()->getStore();
81
  self::XML_PATH_TOKENS, json_encode($tokens), 'stores',
82
  $store->getId()
83
  );
84
+ /* @var $helperData Nosto_Tagging_Helper_Data */
85
+ $helperData = Mage::helper('nosto_tagging');
86
+ $helperData->saveCurrentStoreFrontPageUrl($store);
87
+ /** @var Nosto_Tagging_Helper_Cache $helperCache */
88
+ $helperCache = Mage::helper('nosto_tagging/cache');
89
+ $helperCache->flushCache();
90
+
91
  return true;
92
  }
93
 
94
  /**
95
+ * Removes an account with associated api tokens for the store view scope
96
+ * and informs Nosto about the removal via API.
97
  *
98
  * @param NostoAccount $account the account to remove.
99
  * @param Mage_Core_Model_Store|null $store the store view to remove it for.
102
  */
103
  public function remove(NostoAccount $account, Mage_Core_Model_Store $store = null)
104
  {
105
+ $success = true;
106
+ if ($this->resetAccountSettings($account, $store)) {
107
+ try {
108
+ // Notify Nosto that the account was deleted.
109
+ $account->delete();
110
+ } catch (NostoException $e) {
111
+ // Failures are logged but not shown to the user.
112
+ Mage::log(
113
+ "\n" . $e->__toString(),
114
+ Zend_Log::ERR,
115
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
116
+ );
117
+ }
118
+ } else {
119
+ $success = false;
 
 
 
 
 
 
 
 
 
120
  }
121
 
122
+ return $success;
123
  }
124
 
125
  /**
200
  /** @var Nosto_Tagging_Model_Meta_Account_Iframe $meta */
201
  $meta = Mage::getModel('nosto_tagging/meta_account_iframe');
202
  $meta->loadData($store);
203
+ /** @var NostoHelperIframe $helper */
204
+ $helper = Nosto::helper('iframe');
205
+ return $helper->getUrl($meta, $account, $params);
206
+ }
207
+
208
+ /**
209
+ * Sends a currency exchange rate update request to Nosto via the API.
210
+ *
211
+ * Checks if multi currency is enabled for the store before attempting to
212
+ * send the exchange rates.
213
+ *
214
+ * @param NostoAccount $account the account for which tp update the rates.
215
+ * @param Mage_Core_Model_Store $store the store which rates are to be updated.
216
+ *
217
+ * @return bool
218
+ */
219
+ public function updateCurrencyExchangeRates(NostoAccount $account, Mage_Core_Model_Store $store)
220
+ {
221
+ /** @var Nosto_Tagging_Helper_Data $helper */
222
+ $helper = Mage::helper('nosto_tagging');
223
+ if (!$helper->isMultiCurrencyMethodExchangeRate($store)) {
224
+ Mage::log(
225
+ sprintf(
226
+ 'Currency update called without exchange method enabled for account %s',
227
+ $account->getName()
228
+ ),
229
+ Zend_Log::DEBUG,
230
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
231
+ );
232
+ return false;
233
+ }
234
+ $currencyCodes = $store->getAvailableCurrencyCodes(true);
235
+ $baseCurrencyCode = $store->getBaseCurrencyCode();
236
+
237
+ /** @var Nosto_Tagging_Helper_Currency $helper */
238
+ $helper = Mage::helper('nosto_tagging/currency');
239
+ try {
240
+ /** @var Nosto_Tagging_Model_Collection_Rates $collection */
241
+ $collection = $helper
242
+ ->getExchangeRateCollection($baseCurrencyCode, $currencyCodes);
243
+ $service = new NostoOperationExchangeRate($account, $collection);
244
+ return $service->update();
245
+ } catch (NostoException $e) {
246
+ Mage::log("\n" . $e, Zend_Log::ERR, Nosto_Tagging_Model_Base::LOG_FILE_NAME);
247
+ }
248
+ return false;
249
+ }
250
+
251
+ /**
252
+ * Sends a update account request to Nosto via the API.
253
+ *
254
+ * This is used to update the details of a Nosto account from the
255
+ * "Advanced Settings" page, as well as after an account has been
256
+ * successfully connected through OAuth.
257
+ *
258
+ * @param NostoAccount $account the account to update.
259
+ * @param Mage_Core_Model_Store $store the store to which the account belongs.
260
+ *
261
+ * @return bool
262
+ */
263
+ public function updateAccount(NostoAccount $account, Mage_Core_Model_Store $store)
264
+ {
265
+ try {
266
+ $service = new NostoOperationAccount($account, $this->getMetaData($store));
267
+ return $service->update();
268
+ } catch (NostoException $e) {
269
+ Mage::log(
270
+ "\n" . $e, Zend_Log::ERR,
271
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
272
+ );
273
+ }
274
+ return false;
275
+ }
276
+
277
+ /**
278
+ * Resets all saved Nosto account settings in Magento. This does not reset
279
+ * tokens or any of the Nosto configurations.
280
+ *
281
+ * @param NostoAccount $account
282
+ * @param Mage_Core_Model_Store|null $store
283
+ *
284
+ * @return bool
285
+ */
286
+ public function resetAccountSettings(NostoAccount $account, Mage_Core_Model_Store $store = null)
287
+ {
288
+ if ($store === null) {
289
+ $store = Mage::app()->getStore();
290
+ }
291
+ if ((int)$store->getId() < 1) {
292
+ return false;
293
+ }
294
+ /** @var Mage_Core_Model_Config $config */
295
+ $config = Mage::getModel('core/config');
296
+ $config->saveConfig(
297
+ self::XML_PATH_ACCOUNT,
298
+ null,
299
+ 'stores',
300
+ $store->getId()
301
+ );
302
+ $config->saveConfig(
303
+ self::XML_PATH_TOKENS,
304
+ null,
305
+ 'stores',
306
+ $store->getId()
307
+ );
308
+
309
+ /** @var $dataHelper Nosto_Tagging_Helper_Data */
310
+ $dataHelper = Mage::helper('nosto_tagging/data');
311
+ $dataHelper->saveStoreFrontPageUrl($store, null);
312
+
313
+ //Enable API upserts by default when new account is added
314
+ // or account is reconnected
315
+ /* @var $nostoHelper Nosto_Tagging_Helper_Data */
316
+ $nostoHelper = Mage::helper('nosto_tagging');
317
+ if (!$nostoHelper->getUseProductApi($store)) {
318
+ $config->saveConfig(
319
+ Nosto_Tagging_Helper_Data::XML_PATH_USE_PRODUCT_API,
320
+ true,
321
+ 'stores',
322
+ $store->getId()
323
+ );
324
+ }
325
+
326
+ /** @var Nosto_Tagging_Helper_Cache $helper */
327
+ $helper = Mage::helper('nosto_tagging/cache');
328
+ $helper->flushCache();
329
+
330
+ return true;
331
  }
332
  }
app/code/community/Nosto/Tagging/Helper/Cache.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Helper class for working with the cache
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Helper_Cache extends Mage_Core_Helper_Abstract
36
+ {
37
+ /**
38
+ * Flushes the Magento caches, not all of them but some of them, normally
39
+ * after creating an account or connecting with nosto.
40
+ */
41
+ public function flushCache()
42
+ {
43
+ Mage::app()->getCacheInstance()->cleanType('config');
44
+ Mage::app()->getCacheInstance()->cleanType('layout');
45
+ Mage::app()->getCacheInstance()->cleanType('block_html');
46
+ }
47
+
48
+ /**
49
+ * Flushes the Magento caches, specifically the configuration cache
50
+ */
51
+ public function flushConfigCache()
52
+ {
53
+ Mage::app()->getCacheInstance()->cleanType('config');
54
+ }
55
+ }
app/code/community/Nosto/Tagging/Helper/Class.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ require_once __DIR__ . '/../bootstrap.php';
29
+
30
+ /**
31
+ * Helper class for loading pluggable classes.
32
+ *
33
+ * @category Nosto
34
+ * @package Nosto_Tagging
35
+ * @author Nosto Solutions Ltd <magento@nosto.com>
36
+ */
37
+ class Nosto_Tagging_Helper_Class extends Mage_Core_Helper_Abstract
38
+ {
39
+ /*
40
+ * Loads correct / plugable class based on payment provider
41
+ *
42
+ * @param Mage_Sales_Model_Order $order
43
+ *
44
+ * @return Nosto
45
+ */
46
+ public function getOrderClass(Mage_Sales_Model_Order $order)
47
+ {
48
+ $paymentProvider = false;
49
+ $orderClass = false;
50
+ $payment = $order->getPayment();
51
+ if (is_object($payment)) {
52
+ $paymentProvider = $payment->getMethod();
53
+ }
54
+
55
+ if (is_string($paymentProvider)) {
56
+ try {
57
+ $orderClass = Mage::getModel(
58
+ sprintf(
59
+ 'nosto_tagging/meta_order_%s',
60
+ $paymentProvider
61
+ )
62
+ );
63
+ } catch (Exception $e) {
64
+ $orderClass = false;
65
+ }
66
+ }
67
+
68
+ if ($orderClass instanceof NostoOrderInterface) {
69
+
70
+ return $orderClass;
71
+ } else {
72
+
73
+ return Mage::getModel('nosto_tagging/meta_order');
74
+ }
75
+ }
76
+ }
app/code/community/Nosto/Tagging/Helper/Currency.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Helper class for common currency operations.
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Helper_Currency extends Mage_Core_Helper_Abstract
36
+ {
37
+ /**
38
+ * Parses the format for a currency into a Nosto currency object.
39
+ *
40
+ * @param string $locale the locale to get the currency format in.
41
+ * @param string $currencyCode the currency ISO 4217 code to get the currency in.
42
+ * @return NostoCurrency the parsed currency.
43
+ */
44
+ public function getCurrencyObject($locale, $currencyCode)
45
+ {
46
+ $currency = new Zend_Currency($locale, $currencyCode);
47
+ $format = Zend_Locale_Data::getContent($locale, 'currencynumber');
48
+ $symbols = Zend_Locale_Data::getList($locale, 'symbols');
49
+
50
+ // Remove extra part, e.g. "¤ #,##0.00; (¤ #,##0.00)" => "¤ #,##0.00".
51
+ if (($pos = strpos($format, ';')) !== false) {
52
+ $format = substr($format, 0, $pos);
53
+ }
54
+ // Check if the currency symbol is before or after the amount.
55
+ $symbolPosition = (strpos(trim($format), '¤') === 0)
56
+ ? NostoCurrencySymbol::SYMBOL_POS_LEFT
57
+ : NostoCurrencySymbol::SYMBOL_POS_RIGHT;
58
+ // Remove all other characters than "0", "#", "." and ",",
59
+ $format = preg_replace('/[^0\#\.,]/', '', $format);
60
+ // Calculate the decimal precision.
61
+ $precision = 0;
62
+ if (($decimalPos = strpos($format, '.')) !== false) {
63
+ $precision = (strlen($format) - (strrpos($format, '.') + 1));
64
+ } else {
65
+ $decimalPos = strlen($format);
66
+ }
67
+ $decimalFormat = substr($format, $decimalPos);
68
+ if (($pos = strpos($decimalFormat, '#')) !== false){
69
+ $precision = strlen($decimalFormat) - $pos - $precision;
70
+ }
71
+ // Calculate the group length.
72
+ if (strrpos($format, ',') !== false) {
73
+ $groupLength = ($decimalPos - strrpos($format, ',') - 1);
74
+ } else {
75
+ $groupLength = strrpos($format, '.');
76
+ }
77
+ // If the symbol is missing for the current locale, use the ISO code.
78
+ $currencySymbol = $currency->getSymbol();
79
+ if (is_null($currencySymbol)) {
80
+ $currencySymbol = $currencyCode;
81
+ }
82
+
83
+ return new NostoCurrency(
84
+ new NostoCurrencyCode($currencyCode),
85
+ new NostoCurrencySymbol($currencySymbol, $symbolPosition),
86
+ new NostoCurrencyFormat(
87
+ $symbols['group'],
88
+ $groupLength,
89
+ $symbols['decimal'],
90
+ $precision
91
+ )
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Returns a collection of currency exchange rates.
97
+ *
98
+ * @param string $baseCurrencyCode the currency code to base the rates on.
99
+ * @param array $currencyCodes the currency codes to fetch the rates for.
100
+ *
101
+ * @return Nosto_Tagging_Model_Collection_Rates
102
+ */
103
+ public function getExchangeRateCollection($baseCurrencyCode, array $currencyCodes)
104
+ {
105
+ $collection = new Nosto_Tagging_Model_Collection_Rates();
106
+ /** @var Mage_Directory_Model_Currency $currency */
107
+ $currency = Mage::getModel('directory/currency');
108
+ $rates = $currency->getCurrencyRates($baseCurrencyCode, $currencyCodes);
109
+ foreach ($rates as $code => $rate) {
110
+ // Skip base currency.
111
+ if ($baseCurrencyCode === $code) {
112
+ continue;
113
+ }
114
+ $collection[] = new NostoExchangeRate($code, $code, $rate);
115
+ }
116
+ return $collection;
117
+ }
118
+ }
app/code/community/Nosto/Tagging/Helper/Customer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -41,7 +41,7 @@ class Nosto_Tagging_Helper_Customer extends Mage_Core_Helper_Abstract
41
  *
42
  * @param Mage_Sales_Model_Order $order the order to get the Nosto ID for.
43
  *
44
- * @return bool|string the Nosto ID or false if not found for order.
45
  */
46
  public function getNostoId(Mage_Sales_Model_Order $order)
47
  {
@@ -72,6 +72,8 @@ class Nosto_Tagging_Helper_Customer extends Mage_Core_Helper_Abstract
72
  ->getCollection()
73
  ->addFieldToFilter('quote_id', $quoteId)
74
  ->addFieldToFilter('nosto_id', $nostoId)
 
 
75
  ->getFirstItem();
76
  if ($customer->hasData()) {
77
  $customer->setUpdatedAt(date('Y-m-d H:i:s'));
@@ -84,4 +86,22 @@ class Nosto_Tagging_Helper_Customer extends Mage_Core_Helper_Abstract
84
  }
85
  }
86
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
41
  *
42
  * @param Mage_Sales_Model_Order $order the order to get the Nosto ID for.
43
  *
44
+ * @return string|bool
45
  */
46
  public function getNostoId(Mage_Sales_Model_Order $order)
47
  {
72
  ->getCollection()
73
  ->addFieldToFilter('quote_id', $quoteId)
74
  ->addFieldToFilter('nosto_id', $nostoId)
75
+ ->setPageSize(1)
76
+ ->setCurPage(1)
77
  ->getFirstItem();
78
  if ($customer->hasData()) {
79
  $customer->setUpdatedAt(date('Y-m-d H:i:s'));
86
  }
87
  }
88
  }
89
+
90
+ /**
91
+ * Return the checksum / customer reference for customer
92
+ *
93
+ * @param Mage_Customer_Model_Customer $customer
94
+ *
95
+ * @return string
96
+ */
97
+ public function generateCustomerReference(Mage_Customer_Model_Customer $customer)
98
+ {
99
+ $hash = md5($customer->getId().$customer->getEmail());
100
+ $uuid = uniqid(
101
+ substr($hash, 0, 8),
102
+ true
103
+ );
104
+
105
+ return $uuid;
106
+ }
107
  }
app/code/community/Nosto/Tagging/Helper/Data.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -44,23 +44,120 @@ class Nosto_Tagging_Helper_Data extends Mage_Core_Helper_Abstract
44
  */
45
  const XML_PATH_IMAGE_VERSION = 'nosto_tagging/image_options/image_version';
46
 
 
 
 
 
 
47
  /**
48
  * @var string the name of the cookie where the Nosto ID can be found.
49
  */
50
  const COOKIE_NAME = '2c_cId';
51
 
52
  /**
53
- * @var string the name of the cookie where the Nosto ID can be found.
54
  */
55
  const VISITOR_HASH_ALGO = 'sha256';
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * @inheritdoc
59
  */
60
  public function quoteEscape($data, $addSlashes = false)
61
  {
62
  if ($addSlashes === true) {
63
- $data = addslashes($data);
64
  }
65
  return htmlspecialchars($data, ENT_QUOTES, null, false);
66
  }
@@ -87,6 +184,7 @@ class Nosto_Tagging_Helper_Data extends Mage_Core_Helper_Abstract
87
  if (isset($categories[$id]) && $categories[$id]->getName()) {
88
  $data[] = $categories[$id]->getName();
89
  } else {
 
90
  break;
91
  }
92
  }
@@ -116,7 +214,10 @@ class Nosto_Tagging_Helper_Data extends Mage_Core_Helper_Abstract
116
  $config->saveConfig(
117
  self::XML_PATH_INSTALLATION_ID, $installationId, 'default', 0
118
  );
119
- Mage::app()->getCacheInstance()->cleanType('config');
 
 
 
120
  }
121
  return $installationId;
122
  }
@@ -132,4 +233,264 @@ class Nosto_Tagging_Helper_Data extends Mage_Core_Helper_Abstract
132
  {
133
  return Mage::getStoreConfig(self::XML_PATH_IMAGE_VERSION, $store);
134
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
44
  */
45
  const XML_PATH_IMAGE_VERSION = 'nosto_tagging/image_options/image_version';
46
 
47
+ /**
48
+ * Path to store config for attributes to tag
49
+ */
50
+ const XML_PATH_CUSTOM_TAGS = 'nosto_tagging/attribute_to_tag/';
51
+
52
  /**
53
  * @var string the name of the cookie where the Nosto ID can be found.
54
  */
55
  const COOKIE_NAME = '2c_cId';
56
 
57
  /**
58
+ * @var string the algorithm to use for hashing visitor id.
59
  */
60
  const VISITOR_HASH_ALGO = 'sha256';
61
 
62
+ /**
63
+ * Path to store config multi currency method setting.
64
+ */
65
+ const XML_PATH_MULTI_CURRENCY_METHOD = 'nosto_tagging/multi_currency/method';
66
+
67
+ /**
68
+ * Path to store config scheduled currency exchange rate update enabled setting.
69
+ */
70
+ const XML_PATH_SCHEDULED_CURRENCY_EXCHANGE_RATE_UPDATE_ENABLED = 'nosto_tagging/scheduled_currency_exchange_rate_update/enabled';
71
+
72
+ /**
73
+ * Multi currency method option for currency exchange rates.
74
+ */
75
+ const MULTI_CURRENCY_METHOD_EXCHANGE_RATE = 'exchangeRate';
76
+
77
+ /**
78
+ * Multi currency method option for price variations in tagging.
79
+ */
80
+ const MULTI_CURRENCY_METHOD_PRICE_VARIATION = 'priceVariation';
81
+
82
+ /**
83
+ * No multi currency
84
+ */
85
+ const MULTI_CURRENCY_DISABLED = 'disabled';
86
+
87
+ /**
88
+ * Path to store config for using the product API or not.
89
+ */
90
+ const XML_PATH_USE_PRODUCT_API = 'nosto_tagging/general/use_product_api';
91
+
92
+ /*
93
+ * @var boolean the path for setting for product urls
94
+ */
95
+ const XML_PATH_PRETTY_URL = 'nosto_tagging/pretty_url/in_use';
96
+
97
+ /**
98
+ * Path to store config for brand attribute
99
+ */
100
+ const XML_PATH_BRAND_ATTRIBUTE = 'nosto_tagging/brand_attribute/tag';
101
+
102
+ /**
103
+ * Path to store config for installed domain
104
+ */
105
+ const XML_PATH_STORE_FRONT_PAGE_URL = 'nosto_tagging/settings/front_page_url';
106
+
107
+ /*
108
+ * @var int the product attribute type id
109
+ */
110
+ const PRODUCT_TYPE_ATTRIBUTE_ID = 4;
111
+
112
+ /*
113
+ * @var string Nosto customer reference attribute name
114
+ */
115
+ const NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME = 'nosto_customer_reference';
116
+
117
+ /*
118
+ * @var string Nosto customer reference attribute name
119
+ */
120
+ const XML_PATH_EXCHANGE_RATE_CRON_FREQUENCY = 'nosto_tagging/scheduled_currency_exchange_rate_update/frequency';
121
+
122
+ /**
123
+ * List of strings to remove from the default Nosto account title
124
+ *
125
+ * @var array
126
+ */
127
+ public static $removeFromTitle = array(
128
+ 'Main Website - '
129
+ );
130
+
131
+ /**
132
+ * List of valid tag types
133
+ *
134
+ * @var array
135
+ */
136
+ public static $validTags = array(
137
+ 'tag1',
138
+ 'tag2',
139
+ 'tag3'
140
+ );
141
+
142
+ /**
143
+ * List of attributes that cannot be added to tags due to data type and
144
+ * Magento's internal processing of attributes
145
+ *
146
+ * @var array
147
+ */
148
+ public static $notValidAttributesForTags = array(
149
+ 'group_price',
150
+ 'tier_price',
151
+ 'media_gallery',
152
+ );
153
+
154
  /**
155
  * @inheritdoc
156
  */
157
  public function quoteEscape($data, $addSlashes = false)
158
  {
159
  if ($addSlashes === true) {
160
+ $data = addslashes($data); //@codingStandardsIgnoreLine
161
  }
162
  return htmlspecialchars($data, ENT_QUOTES, null, false);
163
  }
184
  if (isset($categories[$id]) && $categories[$id]->getName()) {
185
  $data[] = $categories[$id]->getName();
186
  } else {
187
+ $data = array();
188
  break;
189
  }
190
  }
214
  $config->saveConfig(
215
  self::XML_PATH_INSTALLATION_ID, $installationId, 'default', 0
216
  );
217
+
218
+ /** @var Nosto_Tagging_Helper_Cache $helper */
219
+ $helper = Mage::helper('nosto_tagging/cache');
220
+ $helper->flushConfigCache();
221
  }
222
  return $installationId;
223
  }
233
  {
234
  return Mage::getStoreConfig(self::XML_PATH_IMAGE_VERSION, $store);
235
  }
236
+
237
+ /**
238
+ * Return if virtual hosts / pretty urls should be used for products
239
+ *
240
+ * @param Mage_Core_Model_Store|null $store the store model or null.
241
+ *
242
+ * @return boolean
243
+ */
244
+ public function getUsePrettyProductUrls($store = null)
245
+ {
246
+ return Mage::getStoreConfig(self::XML_PATH_PRETTY_URL, $store);
247
+ }
248
+
249
+ /**
250
+ * Returns the attribute to be used for brand tagging
251
+ *
252
+ * @param Mage_Core_Model_Store|null $store the store model or null.
253
+ *
254
+ * @return string
255
+ */
256
+ public function getBrandAttribute($store = null)
257
+ {
258
+ return Mage::getStoreConfig(self::XML_PATH_BRAND_ATTRIBUTE, $store);
259
+ }
260
+
261
+ /**
262
+ * Returns the front page URL used for the store during Nosto account
263
+ * installation
264
+ *
265
+ * @param Mage_Core_Model_Store $store the store model
266
+ *
267
+ * @return string
268
+ */
269
+ public function getStoreFrontPageUrl(Mage_Core_Model_Store $store)
270
+ {
271
+ return Mage::getStoreConfig(self::XML_PATH_STORE_FRONT_PAGE_URL, $store);
272
+ }
273
+
274
+ /**
275
+ * Saves current front page url of the store into the settings. This is
276
+ * used for validating that Nosto account was actually installed into the
277
+ * current store and Magento installation.
278
+ *
279
+ * @param Mage_Core_Model_Store $store
280
+ */
281
+ public function saveCurrentStoreFrontPageUrl(Mage_Core_Model_Store $store)
282
+ {
283
+ /* @var $urlHelper Nosto_Tagging_Helper_Url */
284
+ $urlHelper = Mage::helper('nosto_tagging/url');
285
+ $frontPageUrl = $urlHelper->getFrontPageUrl($store);
286
+ $this->saveStoreFrontPageUrl($store, $frontPageUrl);
287
+ }
288
+
289
+ /**
290
+ * Saves the front page url of the store into the settings.
291
+ *
292
+ * @param Mage_Core_Model_Store $store
293
+ * @param string $url
294
+ */
295
+ public function saveStoreFrontPageUrl(Mage_Core_Model_Store $store, $url)
296
+ {
297
+ /** @var Mage_Core_Model_Config $config */
298
+ $config = Mage::getModel('core/config');
299
+ $config->saveConfig(
300
+ self::XML_PATH_STORE_FRONT_PAGE_URL,
301
+ $url,
302
+ 'stores',
303
+ $store->getId()
304
+ );
305
+ }
306
+
307
+ /**
308
+ * Return the Nosto cookie value
309
+ *
310
+ * @return string
311
+ */
312
+ public function getCookieId()
313
+ {
314
+ /** @noinspection PhpUndefinedMethodInspection */
315
+ return Mage::getModel('core/cookie')->get(self::COOKIE_NAME);
316
+ }
317
+
318
+ /**
319
+ * Return the checksum for visitor
320
+ *
321
+ * @return string
322
+ */
323
+ public function getVisitorChecksum()
324
+ {
325
+ $coo = $this->getCookieId();
326
+ if ($coo) {
327
+ return hash(self::VISITOR_HASH_ALGO, $coo);
328
+ }
329
+ return null;
330
+ }
331
+
332
+ /**
333
+ * Return the checksum for visitor
334
+ *
335
+ * @param string $name the title of the account
336
+ * @return string the cleaned title of the account
337
+ */
338
+ public function cleanUpAccountTitle($name)
339
+ {
340
+ $clean = str_replace(self::$removeFromTitle, '', $name);
341
+ return $clean;
342
+ }
343
+
344
+ /**
345
+ * Return the multi currency method in use, i.e. "exchangeRate" or
346
+ * "priceVariation".
347
+ *
348
+ * If "exchangeRate", it means that the product prices in the recommendation
349
+ * is updated through the Exchange Rate API to Nosto.
350
+ *
351
+ * If "priceVariation", it means that the product price variations should be
352
+ * tagged along side the product.
353
+ *
354
+ * @param Mage_Core_Model_Store|null $store the store model or null.
355
+ *
356
+ * @return string
357
+ */
358
+ public function getMultiCurrencyMethod($store = null)
359
+ {
360
+ if ($store instanceof Mage_Core_Model_Store === false) {
361
+ $store = Mage::app()->getStore();
362
+ }
363
+ return Mage::getStoreConfig(self::XML_PATH_MULTI_CURRENCY_METHOD, $store);
364
+ }
365
+
366
+ /**
367
+ * Checks if either exchange rates or price variants
368
+ * are used in store.
369
+ *
370
+ *
371
+ * @param Mage_Core_Model_Store|null $store the store model or null.
372
+ *
373
+ * @return bool
374
+ */
375
+ public function multiCurrencyDisabled($store = null)
376
+ {
377
+ $method = $this->getMultiCurrencyMethod($store);
378
+ return ($method === self::MULTI_CURRENCY_DISABLED);
379
+ }
380
+
381
+ /**
382
+ * Checks if the multi currency method in use is the "exchangeRate", i.e.
383
+ * the product prices in the recommendation is updated through the Exchange
384
+ * Rate API to Nosto.
385
+ *
386
+ * @param Mage_Core_Model_Store|null $store the store model or null.
387
+ *
388
+ * @return bool
389
+ */
390
+ public function isMultiCurrencyMethodExchangeRate($store = null)
391
+ {
392
+ $method = $this->getMultiCurrencyMethod($store);
393
+ return ($method === self::MULTI_CURRENCY_METHOD_EXCHANGE_RATE);
394
+ }
395
+
396
+ /**
397
+ * Returns if the scheduled currency exchange rate update is enabled.
398
+ *
399
+ * @param Mage_Core_Model_Store|null $store the store model or null.
400
+ *
401
+ * @return bool
402
+ */
403
+ public function isScheduledCurrencyExchangeRateUpdateEnabled($store = null)
404
+ {
405
+ return (bool)Mage::getStoreConfig(self::XML_PATH_SCHEDULED_CURRENCY_EXCHANGE_RATE_UPDATE_ENABLED, $store);
406
+ }
407
+
408
+ /**
409
+ * Returns product updates should be sent via API to Nosto
410
+ *
411
+ * @param Mage_Core_Model_Store|null $store the store model or null.
412
+ * @return boolean
413
+ */
414
+ public function getUseProductApi($store = null)
415
+ {
416
+ $useApi = (bool)Mage::getStoreConfig(self::XML_PATH_USE_PRODUCT_API, $store);
417
+ return $useApi;
418
+ }
419
+
420
+ /**
421
+ * Returns exchange rate cron frequency
422
+ *
423
+ * For possible return values
424
+ * @see Nosto_Tagging_Model_System_Config_Source_Cron_Frequency
425
+ *
426
+ * @return string
427
+ */
428
+ public function getExchangeRateCronFrequency()
429
+ {
430
+ return Mage::getStoreConfig(self::XML_PATH_EXCHANGE_RATE_CRON_FREQUENCY);
431
+ }
432
+
433
+ /**
434
+ * Returns the product attributes that can be used in Nosto tags
435
+ *
436
+ * @return array ['value' => $code, 'label' => $label]
437
+ */
438
+ public function getProductAttributeOptions()
439
+ {
440
+ $resourceModel = Mage::getResourceModel(
441
+ 'catalog/product_attribute_collection'
442
+ );
443
+ $attributes = $resourceModel
444
+ ->addFieldToFilter(
445
+ 'entity_type_id',
446
+ self::PRODUCT_TYPE_ATTRIBUTE_ID
447
+ )
448
+ ->setOrder(
449
+ 'attribute_code',
450
+ Varien_Data_Collection::SORT_ORDER_ASC
451
+ );
452
+ // Add single empty option as a first option. Otherwise multiselect
453
+ // cannot not be unset in Magento.
454
+ $attributeArray = array(
455
+ array(
456
+ 'value' => 0,
457
+ 'label' => 'None'
458
+ )
459
+ );
460
+ foreach($attributes as $attribute) {
461
+ $code = $attribute->getData('attribute_code');
462
+ if (in_array($code, self::$notValidAttributesForTags)) {
463
+ continue;
464
+ }
465
+ $label = $attribute->getData('frontend_label');
466
+ $attributeArray[] = array(
467
+ 'value' => $code,
468
+ 'label' => sprintf('%s (%s)', $code, $label)
469
+ );
470
+ }
471
+
472
+ return $attributeArray;
473
+ }
474
+
475
+ /**
476
+ * Return the attributes to be tagged in Nosto tags
477
+ *
478
+ * @param string $tag_id the name / identifier of the tag (e.g. tag1, tag2).
479
+ * @param Mage_Core_Model_Store|null $store the store model or null.
480
+ *
481
+ * @throws NostoException
482
+ *
483
+ * @return array
484
+ */
485
+ public function getAttributesToTag($tag_id, $store = null)
486
+ {
487
+ if (!in_array($tag_id, self::$validTags)) {
488
+ throw new NostoException(
489
+ sprintf('Invalid tag identifier %s', $tag_id)
490
+ );
491
+ }
492
+ $tag_path = self::XML_PATH_CUSTOM_TAGS . $tag_id;
493
+ $tags = Mage::getStoreConfig($tag_path, $store);
494
+ return explode(',', $tags);
495
+ }
496
  }
app/code/community/Nosto/Tagging/Helper/Date.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Helper/Oauth.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Helper/Price.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -37,13 +37,16 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
37
  /**
38
  * Formats price into Nosto format, e.g. 1000.99.
39
  *
40
- * @param string|int|float $price the price to format.
41
  *
42
  * @return string
43
  */
44
  public function getFormattedPrice($price)
45
  {
46
- return number_format($price, 2, '.', '');
 
 
 
47
  }
48
 
49
  /**
@@ -79,25 +82,35 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
79
  *
80
  * @return float
81
  */
82
- protected function _getProductPrice($product, $finalPrice = false, $inclTax = true)
83
- {
 
 
 
84
  $price = 0;
85
 
86
  switch ($product->getTypeId()) {
87
  case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
88
- // Get the bundle product "from" price.
89
- $price = $product->getPriceModel()
90
- ->getTotalPrices($product, 'min', $inclTax);
 
 
 
 
91
  break;
92
-
93
  case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
94
  // Get the grouped product "starting at" price.
 
 
 
 
 
95
  /** @var $tmpProduct Mage_Catalog_Model_Product */
96
  $tmpProduct = Mage::getModel('catalog/product')
97
  ->getCollection()
98
  ->addAttributeToSelect(
99
- Mage::getSingleton('catalog/config')
100
- ->getProductAttributes()
101
  )
102
  ->addAttributeToFilter('entity_id', $product->getId())
103
  ->setPage(1, 1)
@@ -106,23 +119,78 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
106
  ->load()
107
  ->getFirstItem();
108
  if ($tmpProduct) {
 
 
109
  $price = $tmpProduct->getMinimalPrice();
110
  if ($inclTax) {
111
- $price = Mage::helper('tax')
112
- ->getPrice($tmpProduct, $price, true);
113
  }
114
  }
115
  break;
116
-
117
- default:
118
- $price = $finalPrice
119
- ? $product->getFinalPrice()
120
- : $product->getPrice();
121
- if ($inclTax) {
122
- $price = Mage::helper('tax')
123
- ->getPrice($product, $price, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
125
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  return $price;
@@ -147,7 +215,9 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
147
  );
148
  $price = 0;
149
  }
150
- return Mage::helper('directory')->currencyConvert(
 
 
151
  $price,
152
  $store->getBaseCurrency()->getCode(),
153
  $store->getDefaultCurrency()->getCode()
@@ -164,12 +234,14 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
164
  */
165
  public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
166
  {
 
 
167
  $quantity = (double)$item->getQtyOrdered();
168
  $basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
169
  $orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
170
  $baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
171
  if ($orderCurrencyCode != $baseCurrencyCode) {
172
- $priceInOrderCurrency = Mage::helper('directory')->currencyConvert(
173
  $basePrice,
174
  $baseCurrencyCode,
175
  $orderCurrencyCode
@@ -183,4 +255,50 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
183
 
184
  return $priceInOrderCurrency;
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
37
  /**
38
  * Formats price into Nosto format, e.g. 1000.99.
39
  *
40
+ * @param int|float $price the price to format.
41
  *
42
  * @return string
43
  */
44
  public function getFormattedPrice($price)
45
  {
46
+ /* @var $nostoPriceHelper NostoHelperPrice */
47
+ $nostoPriceHelper = Nosto::helper('price');
48
+
49
+ return $nostoPriceHelper->format($price, 2, '.', '');
50
  }
51
 
52
  /**
82
  *
83
  * @return float
84
  */
85
+ protected function _getProductPrice(
86
+ $product,
87
+ $finalPrice = false,
88
+ $inclTax = true
89
+ ) {
90
  $price = 0;
91
 
92
  switch ($product->getTypeId()) {
93
  case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
94
+ // Get the bundle product "from" / min price.
95
+ // Price for bundled "parent" product cannot be configured in
96
+ // store admin. In practise there is no such thing as
97
+ // parent product for the bundled type product
98
+ /** @var Mage_Bundle_Model_Product_Price $model */
99
+ $model = $product->getPriceModel();
100
+ $price = $model->getTotalPrices($product, 'min', $inclTax);
101
  break;
 
102
  case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
103
  // Get the grouped product "starting at" price.
104
+ // Price for grouped "parent" product cannot be configured in
105
+ // store admin. In practise there is no such thing as
106
+ // parent product for the grouped type product
107
+ /** @var Mage_Catalog_Model_Config $config */
108
+ $config = Mage::getSingleton('catalog/config');
109
  /** @var $tmpProduct Mage_Catalog_Model_Product */
110
  $tmpProduct = Mage::getModel('catalog/product')
111
  ->getCollection()
112
  ->addAttributeToSelect(
113
+ $config->getProductAttributes()
 
114
  )
115
  ->addAttributeToFilter('entity_id', $product->getId())
116
  ->setPage(1, 1)
119
  ->load()
120
  ->getFirstItem();
121
  if ($tmpProduct) {
122
+ /** @var Mage_Tax_Helper_Data $helper */
123
+ $helper = Mage::helper('tax');
124
  $price = $tmpProduct->getMinimalPrice();
125
  if ($inclTax) {
126
+ $price = $helper->getPrice($tmpProduct, $price, true);
 
127
  }
128
  }
129
  break;
130
+ case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
131
+ // For configurable products we use the price defined for the
132
+ // "parent" product. If for some reason the parent product
133
+ // doesn't have a price configured we fetch the lowest price
134
+ // configured from a child product / variation
135
+ $price = $this->_getDefaultFromProduct(
136
+ $product,
137
+ $finalPrice,
138
+ $inclTax
139
+ );
140
+ if (!$price) {
141
+ $associatedProducts = Mage::getModel(
142
+ 'catalog/product_type_configurable'
143
+ )->getUsedProducts(null, $product);
144
+ $lowestPrice = false;
145
+ foreach ($associatedProducts as $associatedProduct) {
146
+ /* @var Mage_Catalog_Model_Product $productModel */
147
+ $productModel = Mage::getModel('catalog/product')->load(
148
+ $associatedProduct->getId()
149
+ );
150
+ if ($finalPrice) {
151
+ $variationPrice = $this->getProductFinalPriceInclTax($productModel);
152
+ } else {
153
+ $variationPrice = $this->getProductPriceInclTax($productModel);
154
+ }
155
+ if (!$lowestPrice || $variationPrice < $lowestPrice) {
156
+ $lowestPrice = $variationPrice;
157
+ }
158
+ }
159
+ $price = $lowestPrice;
160
  }
161
  break;
162
+ default:
163
+ $price = $this->_getDefaultFromProduct(
164
+ $product,
165
+ $finalPrice,
166
+ $inclTax
167
+ );
168
+ break;
169
+ }
170
+
171
+ return $price;
172
+ }
173
+
174
+ /**
175
+ * Returns the price from product
176
+ *
177
+ * @param $product
178
+ * @param bool $finalPrice
179
+ * @param bool $inclTax
180
+ * @return float
181
+ */
182
+ protected function _getDefaultFromProduct(
183
+ $product,
184
+ $finalPrice = false,
185
+ $inclTax = true
186
+ ) {
187
+ /** @var Mage_Tax_Helper_Data $helper */
188
+ $helper = Mage::helper('tax');
189
+ $price = $finalPrice
190
+ ? $product->getFinalPrice()
191
+ : $product->getPrice();
192
+ if ($inclTax) {
193
+ $price = $helper->getPrice($product, $price, true);
194
  }
195
 
196
  return $price;
215
  );
216
  $price = 0;
217
  }
218
+ /** @var Mage_Directory_Helper_Data $helper */
219
+ $helper = Mage::helper('directory');
220
+ return $helper->currencyConvert(
221
  $price,
222
  $store->getBaseCurrency()->getCode(),
223
  $store->getDefaultCurrency()->getCode()
234
  */
235
  public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
236
  {
237
+ /** @var Mage_Directory_Helper_Data $helper */
238
+ $helper = Mage::helper('directory');
239
  $quantity = (double)$item->getQtyOrdered();
240
  $basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
241
  $orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
242
  $baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
243
  if ($orderCurrencyCode != $baseCurrencyCode) {
244
+ $priceInOrderCurrency = $helper->currencyConvert(
245
  $basePrice,
246
  $baseCurrencyCode,
247
  $orderCurrencyCode
255
 
256
  return $priceInOrderCurrency;
257
  }
258
+
259
+ /**
260
+ * If the store uses multiple currencies the prices are converted from base
261
+ * currency into given currency. Otherwise the given price is returned.
262
+ *
263
+ * @param float $basePrice The price of a product in base currency
264
+ * @param string $currentCurrencyCode
265
+ * @param Mage_Core_Model_Store $store
266
+ * @return float
267
+ */
268
+ public function getTaggingPrice($basePrice, $currentCurrencyCode, Mage_Core_Model_Store $store)
269
+ {
270
+ /* @var Nosto_Tagging_Helper_Data $helper */
271
+ $helper = Mage::helper('nosto_tagging');
272
+ $baseCurrencyCode = $store->getBaseCurrencyCode();
273
+ $taggingPrice = $basePrice;
274
+ if ($helper->multiCurrencyDisabled($store) && $currentCurrencyCode !== $store->getBaseCurrencyCode()) {
275
+ $taggingPrice = Mage::helper('directory')->currencyConvert(
276
+ $basePrice,
277
+ $baseCurrencyCode,
278
+ $currentCurrencyCode
279
+ );
280
+ }
281
+
282
+ return $taggingPrice;
283
+ }
284
+
285
+ /**
286
+ * Returns the correct currency code for tagging
287
+ *
288
+ * @param $currentCurrencyCode
289
+ * @param Mage_Core_Model_Store $store
290
+ * @return string currency code in ISO 4217 format
291
+ */
292
+ public function getTaggingCurrencyCode($currentCurrencyCode, Mage_Core_Model_Store $store)
293
+ {
294
+ /* @var Nosto_Tagging_Helper_Data $helper */
295
+ $helper = Mage::helper('nosto_tagging');
296
+ if ($helper->multiCurrencyDisabled($store)) {
297
+ $taggingCurrencyCode = $currentCurrencyCode;
298
+ } else {
299
+ $taggingCurrencyCode = $store->getBaseCurrencyCode();
300
+ }
301
+
302
+ return $taggingCurrencyCode;
303
+ }
304
  }
app/code/community/Nosto/Tagging/Helper/Setup.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Helper class for Nosto related setups
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Helper_Setup extends Mage_Core_Helper_Abstract
36
+ {
37
+ /**
38
+ * Adds nosto_customer_reference as to the Customer entity
39
+ *
40
+ * @param $installer Nosto_Tagging_Model_Resource_Setup
41
+ * @param $reset bool if set to true the existing nosto_customer_ref is removed
42
+ *
43
+ * @return void
44
+ */
45
+ public function addNostoCustomerReferenceEav(Nosto_Tagging_Model_Resource_Setup $installer, $reset = false)
46
+ {
47
+ $installer->startSetup();
48
+ $entity = 'customer';
49
+ $attributeExists = $installer->getAttribute(
50
+ $entity,
51
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
52
+ );
53
+ if ($attributeExists && $reset === true) {
54
+ $installer->removeAttribute(
55
+ $entity,
56
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
57
+ );
58
+ $attributeExists = false;
59
+ }
60
+ if (!$attributeExists)
61
+ {
62
+ $attributeDefinition = array(
63
+ "type" => "varchar",
64
+ "label" => "Nosto Customer Reference",
65
+ "input" => "text",
66
+ "visible" => true,
67
+ "required" => false,
68
+ "unique" => true,
69
+ "note" => "Unique customer reference for Nosto"
70
+ );
71
+ $installer->addAttribute(
72
+ $entity,
73
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
74
+ $attributeDefinition
75
+ );
76
+
77
+ $attribute = Mage::getSingleton("eav/config")->getAttribute(
78
+ $entity,
79
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
80
+ );
81
+
82
+ $used_in_forms=array("adminhtml_customer");
83
+ $attribute->setData("used_in_forms",$used_in_forms)
84
+ ->setData("is_used_for_customer_segment", false)
85
+ ->setData("is_system", 1)
86
+ ->setData("is_user_defined", 0)
87
+ ->setData("is_visible", 1)
88
+ ->setData("sort_order", 100);
89
+
90
+ $attribute->save();
91
+ }
92
+ $installer->endSetup();
93
+ }
94
+
95
+ /**
96
+ * Changes the nosto_customer_reference frontend input type to text
97
+ *
98
+ * @param $installer Nosto_Tagging_Model_Resource_Setup
99
+ *
100
+ * @return void
101
+ */
102
+ public function alterCustomerReferenceInputType(Nosto_Tagging_Model_Resource_Setup $installer)
103
+ {
104
+ $installer->updateAttribute(
105
+ 'customer',
106
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
107
+ array(
108
+ 'frontend_input' => 'text',
109
+ )
110
+ );
111
+ }
112
+ }
app/code/community/Nosto/Tagging/Helper/Url.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -36,6 +36,87 @@
36
  */
37
  class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
38
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Gets the absolute preview URL to the current store view product page.
41
  * The product is the first one found in the database for the store.
@@ -47,10 +128,10 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
47
  */
48
  public function getPreviewUrlProduct(Mage_Core_Model_Store $store)
49
  {
 
50
  $collection = Mage::getModel('catalog/product')
51
  ->getCollection()
52
  ->addStoreFilter($store->getId())
53
- ->addAttributeToSelect('*')
54
  ->addAttributeToFilter(
55
  'status', array(
56
  'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
@@ -62,17 +143,14 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
62
  )
63
  ->setPageSize(1)
64
  ->setCurPage(1);
65
- foreach ($collection as $product) {
66
- /** @var Mage_Catalog_Model_Product $product */
67
- $url = $product->getProductUrl();
68
- $url = NostoHttpRequest::replaceQueryParamInUrl(
69
- '___store', $store->getCode(), $url
70
- );
71
- return NostoHttpRequest::replaceQueryParamInUrl(
72
- 'nostodebug', 'true', $url
73
- );
74
  }
75
- return '';
 
76
  }
77
 
78
  /**
@@ -87,24 +165,36 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
87
  public function getPreviewUrlCategory(Mage_Core_Model_Store $store)
88
  {
89
  $rootCategoryId = (int)$store->getRootCategoryId();
 
90
  $collection = Mage::getModel('catalog/category')
91
  ->getCollection()
92
  ->addFieldToFilter('is_active', 1)
93
  ->addFieldToFilter('path', array('like' => "1/$rootCategoryId/%"))
94
- ->addAttributeToSelect('*')
95
  ->setPageSize(1)
96
  ->setCurPage(1);
97
- foreach ($collection as $category) {
98
- /** @var Mage_Catalog_Model_Category $category */
 
99
  $url = $category->getUrl();
100
- $url = NostoHttpRequest::replaceQueryParamInUrl(
101
- '___store', $store->getCode(), $url
102
- );
103
- return NostoHttpRequest::replaceQueryParamInUrl(
104
- 'nostodebug', 'true', $url
 
 
 
 
 
 
 
 
 
105
  );
 
106
  }
107
- return '';
 
108
  }
109
 
110
  /**
@@ -119,15 +209,12 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
119
  public function getPreviewUrlSearch(Mage_Core_Model_Store $store)
120
  {
121
  $url = Mage::getUrl(
122
- 'catalogsearch/result', array(
123
- '_store' => $store->getId(),
124
- '_store_to_url' => true
125
- )
126
  );
127
  $url = NostoHttpRequest::replaceQueryParamInUrl('q', 'nosto', $url);
128
- return NostoHttpRequest::replaceQueryParamInUrl(
129
- 'nostodebug', 'true', $url
130
- );
131
  }
132
 
133
  /**
@@ -141,14 +228,11 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
141
  public function getPreviewUrlCart(Mage_Core_Model_Store $store)
142
  {
143
  $url = Mage::getUrl(
144
- 'checkout/cart', array(
145
- '_store' => $store->getId(),
146
- '_store_to_url' => true
147
- )
148
- );
149
- return NostoHttpRequest::replaceQueryParamInUrl(
150
- 'nostodebug', 'true', $url
151
  );
 
 
152
  }
153
 
154
  /**
@@ -160,15 +244,163 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
160
  * @return string the url.
161
  */
162
  public function getPreviewUrlFront(Mage_Core_Model_Store $store)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  {
164
  $url = Mage::getUrl(
165
- '', array(
166
- '_store' => $store->getId(),
167
- '_store_to_url' => true
168
- )
169
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  return NostoHttpRequest::replaceQueryParamInUrl(
171
- 'nostodebug', 'true', $url
 
 
172
  );
173
  }
174
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
36
  */
37
  class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
38
  {
39
+ /**
40
+ * The ___store parameter in Magento URLs
41
+ */
42
+ const MAGENTO_URL_PARAMETER_STORE = '___store';
43
+
44
+ /**
45
+ * The SID (session id) parameter in Magento URLs
46
+ */
47
+ const MAGENTO_URL_PARAMETER_SID = 'SID';
48
+
49
+ /**
50
+ * The array option key for store in Magento's URLs
51
+ */
52
+ const MAGENTO_URL_OPTION_STORE = '_store';
53
+
54
+ /**
55
+ * The array option key for store to url in Magento's URLs
56
+ */
57
+ const MAGENTO_URL_OPTION_STORE_TO_URL = '_store_to_url';
58
+
59
+ /**
60
+ * The array option key for no session id in Magento's URLs.
61
+ * The session id should be included into the URLs which are potentially
62
+ * used during the same session, e.g. Oauth redirect URL. For example for
63
+ * product URLs we cannot include the session id as the product URL should
64
+ * be the same for all visitors and it will be saved to Nosto.
65
+ */
66
+ const MAGENTO_URL_OPTION_NOSID = '_nosid';
67
+
68
+ /**
69
+ * The array option key for ignoring category in Magento's product URLs
70
+ */
71
+ const MAGENTO_URL_OPTION_IGNORE_CATEGORY = '_ignore_category';
72
+
73
+ /**
74
+ * The array option key for URL type in Magento's URLs
75
+ */
76
+ const MAGENTO_URL_OPTION_LINK_TYPE = '_type';
77
+
78
+ /**
79
+ * Path to Nosto oauth controller
80
+ */
81
+ const NOSTO_PATH_OAUTH = 'nosto/oauth';
82
+
83
+ /**
84
+ * Path to Magento's search controller
85
+ */
86
+ const MAGENTO_PATH_SEARCH = 'catalogsearch/result';
87
+
88
+ /**
89
+ * Path to Magento's cart controller
90
+ */
91
+ const MAGENTO_PATH_CART = 'checkout/cart';
92
+
93
+ /**
94
+ * The URL parameter to invoke Nosto debug mode in store
95
+ */
96
+ const NOSTO_URL_DEBUG_PARAMETER = 'nostodebug';
97
+
98
+ /**
99
+ * The url type to be used for links.
100
+ *
101
+ * This is the only URL type that works correctly the URls when
102
+ * "Add Store Code to Urls" setting is set to "Yes"
103
+ *
104
+ * Mage_Core_Model_Store::URL_TYPE_WEB
105
+ * - returns an URL without rewrites and without store codes
106
+ *
107
+ * Mage_Core_Model_Store::URL_TYPE_LINK
108
+ * - returns an URL with rewrites and with store codes in URL (if
109
+ * setting "Add Store Code to Urls" set to yes)
110
+ *
111
+ * Mage_Core_Model_Store::URL_TYPE_DIRECT_LINK
112
+ * - returns an URL with rewrites but without store codes
113
+ *
114
+ * @see Mage_Core_Model_Store::URL_TYPE_LINK
115
+ *
116
+ * @var string
117
+ */
118
+ public static $urlType = Mage_Core_Model_Store::URL_TYPE_LINK;
119
+
120
  /**
121
  * Gets the absolute preview URL to the current store view product page.
122
  * The product is the first one found in the database for the store.
128
  */
129
  public function getPreviewUrlProduct(Mage_Core_Model_Store $store)
130
  {
131
+ $productUrl = '';
132
  $collection = Mage::getModel('catalog/product')
133
  ->getCollection()
134
  ->addStoreFilter($store->getId())
 
135
  ->addAttributeToFilter(
136
  'status', array(
137
  'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
143
  )
144
  ->setPageSize(1)
145
  ->setCurPage(1);
146
+ /** @var Mage_Catalog_Model_Product $product */
147
+ $product = $collection->getFirstItem();
148
+ if ($product instanceof Mage_Catalog_Model_Product) {
149
+ $url = $this->generateProductUrl($product, $store);
150
+ $productUrl = $this->addNostoPreviewParameter($url);
 
 
 
 
151
  }
152
+
153
+ return $productUrl;
154
  }
155
 
156
  /**
165
  public function getPreviewUrlCategory(Mage_Core_Model_Store $store)
166
  {
167
  $rootCategoryId = (int)$store->getRootCategoryId();
168
+ $categoryUrl = '';
169
  $collection = Mage::getModel('catalog/category')
170
  ->getCollection()
171
  ->addFieldToFilter('is_active', 1)
172
  ->addFieldToFilter('path', array('like' => "1/$rootCategoryId/%"))
 
173
  ->setPageSize(1)
174
  ->setCurPage(1);
175
+ /** @var Mage_Catalog_Model_Category $category */
176
+ $category = $collection->getFirstItem();
177
+ if ($category instanceof Mage_Catalog_Model_Category) {
178
  $url = $category->getUrl();
179
+ /* @var Nosto_Tagging_Helper_Data $helper */
180
+ $helper = Mage::helper('nosto_tagging');
181
+ if (!$helper->getUsePrettyProductUrls($store)) {
182
+ $url = NostoHttpRequest::replaceQueryParamInUrl(
183
+ self::MAGENTO_URL_PARAMETER_STORE, $store->getCode(), $url
184
+ );
185
+ }
186
+
187
+ // Since the Mage_Catalog_Model_Category::getUrl() doesn't
188
+ // accept any arguments and always returns an url with SID,
189
+ // we'll need to remove the sid manually from the URL
190
+ $url = $this->removeQueryParamFromUrl(
191
+ $url,
192
+ self::MAGENTO_URL_PARAMETER_SID
193
  );
194
+ $categoryUrl = $this->addNostoPreviewParameter($url);
195
  }
196
+
197
+ return $categoryUrl;
198
  }
199
 
200
  /**
209
  public function getPreviewUrlSearch(Mage_Core_Model_Store $store)
210
  {
211
  $url = Mage::getUrl(
212
+ self::MAGENTO_PATH_SEARCH,
213
+ $this->getUrlOptionsWithNoSid($store)
 
 
214
  );
215
  $url = NostoHttpRequest::replaceQueryParamInUrl('q', 'nosto', $url);
216
+
217
+ return $this->addNostoPreviewParameter($url);
 
218
  }
219
 
220
  /**
228
  public function getPreviewUrlCart(Mage_Core_Model_Store $store)
229
  {
230
  $url = Mage::getUrl(
231
+ self::MAGENTO_PATH_CART,
232
+ $this->getUrlOptionsWithNoSid($store)
 
 
 
 
 
233
  );
234
+
235
+ return $this->addNostoPreviewParameter($url);
236
  }
237
 
238
  /**
244
  * @return string the url.
245
  */
246
  public function getPreviewUrlFront(Mage_Core_Model_Store $store)
247
+ {
248
+ $url = $this->getFrontPageUrl($store);
249
+
250
+ return $this->addNostoPreviewParameter($url);
251
+ }
252
+
253
+ /**
254
+ * Returns the default options for fetching Magento urls with no session id
255
+ *
256
+ * @param Mage_Core_Model_Store $store
257
+ * @return array
258
+ */
259
+ private function getUrlOptionsWithNoSid(Mage_Core_Model_Store $store)
260
+ {
261
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
262
+ $nosto_helper = Mage::helper('nosto_tagging');
263
+ $params = array(
264
+ self::MAGENTO_URL_OPTION_STORE => $store->getId(),
265
+ self::MAGENTO_URL_OPTION_STORE_TO_URL => true,
266
+ self::MAGENTO_URL_OPTION_NOSID => true,
267
+ self::MAGENTO_URL_OPTION_LINK_TYPE => self::$urlType
268
+ );
269
+ if ($nosto_helper->getUsePrettyProductUrls($store)) {
270
+ $params[self::MAGENTO_URL_OPTION_STORE_TO_URL] = false;
271
+ }
272
+
273
+ return $params;
274
+ }
275
+
276
+ /**
277
+ * Returns the default options for fetching Magento urls with session id
278
+ *
279
+ * @param Mage_Core_Model_Store $store
280
+ * @return array
281
+ */
282
+ private function getUrlOptionsWithSid(Mage_Core_Model_Store $store)
283
+ {
284
+ $params = $this->getUrlOptionsWithNoSid($store);
285
+ $params[self::MAGENTO_URL_OPTION_NOSID] = false;
286
+ return $params;
287
+ }
288
+
289
+ /**
290
+ * Generates url for a product
291
+ *
292
+ * @param Mage_Catalog_Model_Product $product
293
+ * @param Mage_Core_Model_Store $store
294
+ *
295
+ * @return string the url.
296
+ */
297
+ public function generateProductUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
298
+ {
299
+ // Unset the cached url first, as it won't include the `___store` param
300
+ // if it's cached. We need to define the specific store view in the url
301
+ // in case the same domain is used for all sites.
302
+ $product->unsetData('url');
303
+ /** @var Nosto_Tagging_Helper_Data $helper */
304
+ $helper = Mage::helper('nosto_tagging');
305
+ $url_params = array(
306
+ self::MAGENTO_URL_OPTION_NOSID => true,
307
+ self::MAGENTO_URL_OPTION_IGNORE_CATEGORY => true,
308
+ self::MAGENTO_URL_OPTION_STORE => $store->getId(),
309
+ self::MAGENTO_URL_OPTION_STORE_TO_URL => true
310
+ );
311
+ $product_url = $product->getUrlInStore($url_params);
312
+ if ($helper->getUsePrettyProductUrls($store)) {
313
+ $product_url = $this->removeQueryParamFromUrl(
314
+ $product_url,
315
+ self::MAGENTO_URL_PARAMETER_STORE
316
+ );
317
+ }
318
+
319
+ return $product_url;
320
+ }
321
+
322
+ /**
323
+ * Removes given parameter from the url
324
+ *
325
+ * @param $url
326
+ * @param $param
327
+ * @return string
328
+ */
329
+ public function removeQueryParamFromUrl($url, $param)
330
+ {
331
+ $modified_url = $url;
332
+ $url_parts = NostoHttpRequest::parseUrl($url);
333
+ if (
334
+ $url_parts !== false
335
+ && isset($url_parts['query'])
336
+ ) {
337
+ $query_array = NostoHttpRequest::parseQueryString($url_parts['query']);
338
+ if(isset($query_array[$param])) {
339
+ unset($query_array[$param]);
340
+ if (empty($query_array)) {
341
+ unset($url_parts['query']);
342
+ } else {
343
+ $url_parts['query'] = http_build_query($query_array);
344
+ }
345
+ $modified_url = NostoHttpRequest::buildUrl($url_parts);
346
+ }
347
+ }
348
+
349
+ return $modified_url;
350
+ }
351
+
352
+ /**
353
+ * Returns Oauth redirection URL
354
+ *
355
+ * @param Mage_Core_Model_Store $store
356
+ * @return string
357
+ */
358
+ public function getOauthRedirectUrl(Mage_Core_Model_Store $store)
359
  {
360
  $url = Mage::getUrl(
361
+ self::NOSTO_PATH_OAUTH,
362
+ $this->getUrlOptionsWithSid($store)
 
 
363
  );
364
+
365
+ return $url;
366
+ }
367
+
368
+ /**
369
+ * Returns front page URL of the store
370
+ *
371
+ * @param Mage_Core_Model_Store $store
372
+ * @return string
373
+ */
374
+ public function getFrontPageUrl(Mage_Core_Model_Store $store)
375
+ {
376
+ /* @var Nosto_Tagging_Helper_Data $helper */
377
+ $helper = Mage::helper('nosto_tagging');
378
+ if (!$helper->getUsePrettyProductUrls($store)) {
379
+ $url = NostoHttpRequest::replaceQueryParamInUrl(
380
+ self::MAGENTO_URL_PARAMETER_STORE,
381
+ $store->getCode(),
382
+ $store->getBaseUrl(self::$urlType)
383
+ );
384
+ } else {
385
+ $url = $store->getBaseUrl(self::$urlType);
386
+ }
387
+
388
+ return $url;
389
+ }
390
+
391
+ /**
392
+ * Adds nostodebug attribute to the given URL
393
+ *
394
+ * @param $url
395
+ *
396
+ * @return string
397
+ */
398
+ private function addNostoPreviewParameter($url)
399
+ {
400
  return NostoHttpRequest::replaceQueryParamInUrl(
401
+ self::NOSTO_URL_DEBUG_PARAMETER,
402
+ 'true',
403
+ $url
404
  );
405
  }
406
  }
app/code/community/Nosto/Tagging/Model/Base.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Collection/Rates.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Order collection for historical data exports.
30
+ */
31
+ class Nosto_Tagging_Model_Collection_Rates extends NostoExchangeRateCollection
32
+ {
33
+ }
app/code/community/Nosto/Tagging/Model/Container/Cart.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -33,6 +33,7 @@
33
  * @package Nosto_Tagging
34
  * @author Nosto Solutions Ltd <magento@nosto.com>
35
  */
 
36
  class Nosto_Tagging_Model_Container_Cart extends Enterprise_PageCache_Model_Container_Advanced_Quote
37
  {
38
  /**
@@ -43,6 +44,8 @@ class Nosto_Tagging_Model_Container_Cart extends Enterprise_PageCache_Model_Cont
43
  */
44
  protected function _getIdentifier()
45
  {
 
 
46
  return $this->_getCookieValue(
47
  Enterprise_PageCache_Model_Cookie::COOKIE_CART, ''
48
  )
@@ -57,13 +60,17 @@ class Nosto_Tagging_Model_Container_Cart extends Enterprise_PageCache_Model_Cont
57
  */
58
  protected function _renderBlock()
59
  {
 
 
60
  $block = $this->_getPlaceHolderBlock();
 
61
  Mage::dispatchEvent(
62
  'render_block', array(
63
  'block' => $block,
64
  'placeholder' => $this->_placeholder
65
  )
66
  );
 
67
  return $block->toHtml();
68
  }
69
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
33
  * @package Nosto_Tagging
34
  * @author Nosto Solutions Ltd <magento@nosto.com>
35
  */
36
+ /** @noinspection PhpUndefinedClassInspection */
37
  class Nosto_Tagging_Model_Container_Cart extends Enterprise_PageCache_Model_Container_Advanced_Quote
38
  {
39
  /**
44
  */
45
  protected function _getIdentifier()
46
  {
47
+ /** @noinspection PhpUndefinedMethodInspection */
48
+ /** @noinspection PhpUndefinedClassInspection */
49
  return $this->_getCookieValue(
50
  Enterprise_PageCache_Model_Cookie::COOKIE_CART, ''
51
  )
60
  */
61
  protected function _renderBlock()
62
  {
63
+ /** @noinspection PhpUndefinedMethodInspection */
64
+ /** @noinspection PhpUndefinedClassInspection */
65
  $block = $this->_getPlaceHolderBlock();
66
+ /** @noinspection PhpUndefinedFieldInspection */
67
  Mage::dispatchEvent(
68
  'render_block', array(
69
  'block' => $block,
70
  'placeholder' => $this->_placeholder
71
  )
72
  );
73
+ /** @noinspection PhpUndefinedMethodInspection */
74
  return $block->toHtml();
75
  }
76
  }
app/code/community/Nosto/Tagging/Model/Container/Customer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -33,6 +33,8 @@
33
  * @package Nosto_Tagging
34
  * @author Nosto Solutions Ltd <magento@nosto.com>
35
  */
 
 
36
  class Nosto_Tagging_Model_Container_Customer extends Enterprise_PageCache_Model_Container_Customer
37
  {
38
  /**
@@ -43,6 +45,8 @@ class Nosto_Tagging_Model_Container_Customer extends Enterprise_PageCache_Model_
43
  */
44
  protected function _getIdentifier()
45
  {
 
 
46
  return $this->_getCookieValue(
47
  Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, ''
48
  )
@@ -57,6 +61,8 @@ class Nosto_Tagging_Model_Container_Customer extends Enterprise_PageCache_Model_
57
  */
58
  protected function _getCacheId()
59
  {
 
 
60
  return 'CONTAINER_NOSTO_TAGGING_CUSTOMER_'
61
  . md5(
62
  $this->_placeholder->getAttribute('cache_id')
@@ -69,13 +75,16 @@ class Nosto_Tagging_Model_Container_Customer extends Enterprise_PageCache_Model_
69
  */
70
  protected function _renderBlock()
71
  {
 
72
  $block = $this->_getPlaceHolderBlock();
 
73
  Mage::dispatchEvent(
74
  'render_block', array(
75
  'block' => $block,
76
  'placeholder' => $this->_placeholder
77
  )
78
  );
 
79
  return $block->toHtml();
80
  }
81
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
33
  * @package Nosto_Tagging
34
  * @author Nosto Solutions Ltd <magento@nosto.com>
35
  */
36
+
37
+ /** @noinspection PhpUndefinedClassInspection */
38
  class Nosto_Tagging_Model_Container_Customer extends Enterprise_PageCache_Model_Container_Customer
39
  {
40
  /**
45
  */
46
  protected function _getIdentifier()
47
  {
48
+ /** @noinspection PhpUndefinedMethodInspection */
49
+ /** @noinspection PhpUndefinedClassInspection */
50
  return $this->_getCookieValue(
51
  Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, ''
52
  )
61
  */
62
  protected function _getCacheId()
63
  {
64
+ /** @noinspection PhpUndefinedFieldInspection */
65
+ /** @noinspection PhpDeprecationInspection */
66
  return 'CONTAINER_NOSTO_TAGGING_CUSTOMER_'
67
  . md5(
68
  $this->_placeholder->getAttribute('cache_id')
75
  */
76
  protected function _renderBlock()
77
  {
78
+ /** @noinspection PhpUndefinedMethodInspection */
79
  $block = $this->_getPlaceHolderBlock();
80
+ /** @noinspection PhpUndefinedFieldInspection */
81
  Mage::dispatchEvent(
82
  'render_block', array(
83
  'block' => $block,
84
  'placeholder' => $this->_placeholder
85
  )
86
  );
87
+ /** @noinspection PhpUndefinedMethodInspection */
88
  return $block->toHtml();
89
  }
90
  }
app/code/community/Nosto/Tagging/Model/Customer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Export/Collection/Order.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -38,11 +38,13 @@ class Nosto_Tagging_Model_Export_Collection_Order extends NostoOrderCollection i
38
  $array = array();
39
  /** @var Nosto_Tagging_Model_Meta_Order $item */
40
  foreach ($this->getArrayCopy() as $item) {
 
 
41
  $data = array(
42
  'order_number' => $item->getOrderNumber(),
43
  'external_order_ref' => $item->getExternalOrderRef(),
44
  'order_statuses' => array(),
45
- 'created_at' => Nosto::helper('date')->format($item->getCreatedDate()),
46
  'buyer' => array(),
47
  'payment_provider' => $item->getPaymentProvider(),
48
  'purchased_items' => array(),
@@ -51,12 +53,14 @@ class Nosto_Tagging_Model_Export_Collection_Order extends NostoOrderCollection i
51
  $data['order_status_code'] = $item->getOrderStatus()->getCode();
52
  $data['order_status_label'] = $item->getOrderStatus()->getLabel();
53
  }
 
 
54
  foreach ($item->getPurchasedItems() as $orderItem) {
55
  $data['purchased_items'][] = array(
56
  'product_id' => $orderItem->getProductId(),
57
  'quantity' => (int)$orderItem->getQuantity(),
58
  'name' => $orderItem->getName(),
59
- 'unit_price' => Nosto::helper('price')->format($orderItem->getUnitPrice()),
60
  'price_currency_code' => strtoupper($orderItem->getCurrencyCode()),
61
  );
62
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
38
  $array = array();
39
  /** @var Nosto_Tagging_Model_Meta_Order $item */
40
  foreach ($this->getArrayCopy() as $item) {
41
+ /** @var NostoHelperDate $dateHelper */
42
+ $dateHelper = Nosto::helper('date');
43
  $data = array(
44
  'order_number' => $item->getOrderNumber(),
45
  'external_order_ref' => $item->getExternalOrderRef(),
46
  'order_statuses' => array(),
47
+ 'created_at' => $dateHelper->format($item->getCreatedDate()),
48
  'buyer' => array(),
49
  'payment_provider' => $item->getPaymentProvider(),
50
  'purchased_items' => array(),
53
  $data['order_status_code'] = $item->getOrderStatus()->getCode();
54
  $data['order_status_label'] = $item->getOrderStatus()->getLabel();
55
  }
56
+ /** @var NostoHelperPrice $priceHelper */
57
+ $priceHelper = Nosto::helper('price');
58
  foreach ($item->getPurchasedItems() as $orderItem) {
59
  $data['purchased_items'][] = array(
60
  'product_id' => $orderItem->getProductId(),
61
  'quantity' => (int)$orderItem->getQuantity(),
62
  'name' => $orderItem->getName(),
63
+ 'unit_price' => $priceHelper->format($orderItem->getUnitPrice()),
64
  'price_currency_code' => strtoupper($orderItem->getCurrencyCode()),
65
  );
66
  }
app/code/community/Nosto/Tagging/Model/Meta/Account.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -80,6 +80,26 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
80
  */
81
  protected $_signUpApiToken = 'YBDKYwSqTCzSsU8Bwbg4im2pkHMcgTy9cCX7vevjJwON1UISJIwXOLMM0a8nZY7h';
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  /**
84
  * @inheritdoc
85
  */
@@ -95,17 +115,19 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
95
  */
96
  public function loadData(Mage_Core_Model_Store $store)
97
  {
98
- $this->_title = $store->getWebsite()->getName()
 
 
 
 
 
99
  . ' - '
100
  . $store->getGroup()->getName()
101
  . ' - '
102
- . $store->getName();
103
- $this->_name = substr(sha1(rand()), 0, 8);
104
- $this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl(
105
- '___store',
106
- $store->getCode(),
107
- $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
108
  );
 
 
109
  $this->_currencyCode = $store->getBaseCurrencyCode();
110
  $this->_languageCode = substr(
111
  $store->getConfig('general/locale/code'), 0, 2
@@ -116,13 +138,31 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
116
 
117
  /** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
118
  $owner = Mage::getModel('nosto_tagging/meta_account_owner');
119
- $owner->loadData($store);
120
  $this->_owner = $owner;
121
 
122
  /** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
123
  $billing = Mage::getModel('nosto_tagging/meta_account_billing');
124
  $billing->loadData($store);
125
  $this->_billing = $billing;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  /**
@@ -252,7 +292,7 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
252
  */
253
  public function getCurrencies()
254
  {
255
- return null;
256
  }
257
 
258
  /**
@@ -265,7 +305,7 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
265
  */
266
  public function getUseCurrencyExchangeRates()
267
  {
268
- return false;
269
  }
270
 
271
  /**
@@ -275,6 +315,26 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
275
  */
276
  public function getDefaultVariationId()
277
  {
278
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  }
280
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
80
  */
81
  protected $_signUpApiToken = 'YBDKYwSqTCzSsU8Bwbg4im2pkHMcgTy9cCX7vevjJwON1UISJIwXOLMM0a8nZY7h';
82
 
83
+ /**
84
+ * @var array|stdClass account details
85
+ */
86
+ protected $_details;
87
+
88
+ /**
89
+ * @var bool the flag to use exchange rates or not
90
+ */
91
+ protected $_useCurrencyExchangeRates;
92
+
93
+ /**
94
+ * @var array The array of currencies
95
+ */
96
+ protected $_currencies = array();
97
+
98
+ /**
99
+ * @var string The base currency of the store
100
+ */
101
+ protected $_defaultPriceVariationId;
102
+
103
  /**
104
  * @inheritdoc
105
  */
115
  */
116
  public function loadData(Mage_Core_Model_Store $store)
117
  {
118
+ /* @var Nosto_Tagging_Helper_Data $helper */
119
+ $helper = Mage::helper('nosto_tagging');
120
+ /* @var Nosto_Tagging_Helper_Url $helperUrl */
121
+ $helperUrl = Mage::helper('nosto_tagging/url');
122
+ $this->_title = $helper->cleanUpAccountTitle(
123
+ $store->getWebsite()->getName()
124
  . ' - '
125
  . $store->getGroup()->getName()
126
  . ' - '
127
+ . $store->getName()
 
 
 
 
 
128
  );
129
+ $this->_name = substr(sha1(rand()), 0, 8);
130
+ $this->_frontPageUrl = $helperUrl->getFrontPageUrl($store);
131
  $this->_currencyCode = $store->getBaseCurrencyCode();
132
  $this->_languageCode = substr(
133
  $store->getConfig('general/locale/code'), 0, 2
138
 
139
  /** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
140
  $owner = Mage::getModel('nosto_tagging/meta_account_owner');
141
+ $owner->loadData();
142
  $this->_owner = $owner;
143
 
144
  /** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
145
  $billing = Mage::getModel('nosto_tagging/meta_account_billing');
146
  $billing->loadData($store);
147
  $this->_billing = $billing;
148
+
149
+ $this->_useCurrencyExchangeRates = !$helper->multiCurrencyDisabled($store);
150
+ if (!$helper->multiCurrencyDisabled($store)) {
151
+ $this->_defaultPriceVariationId = $store->getBaseCurrencyCode();
152
+ } else {
153
+ $this->_defaultPriceVariationId = "";
154
+ }
155
+
156
+ $storeLocale = $store->getConfig('general/locale/code');
157
+ $currencyCodes = $store->getAvailableCurrencyCodes(true);
158
+ if (is_array($currencyCodes) && count($currencyCodes) > 0) {
159
+ /** @var Nosto_Tagging_Helper_Currency $currencyHelper */
160
+ $currencyHelper = Mage::helper('nosto_tagging/currency');
161
+ foreach ($currencyCodes as $currencyCode) {
162
+ $this->_currencies[$currencyCode] = $currencyHelper
163
+ ->getCurrencyObject($storeLocale, $currencyCode);
164
+ }
165
+ }
166
  }
167
 
168
  /**
292
  */
293
  public function getCurrencies()
294
  {
295
+ return $this->_currencies;
296
  }
297
 
298
  /**
305
  */
306
  public function getUseCurrencyExchangeRates()
307
  {
308
+ return $this->_useCurrencyExchangeRates;
309
  }
310
 
311
  /**
315
  */
316
  public function getDefaultVariationId()
317
  {
318
+ return $this->_defaultPriceVariationId;
319
+ }
320
+
321
+ /**
322
+ * Set details
323
+ *
324
+ * @param array|stdClass $details
325
+ */
326
+ public function setDetails($details)
327
+ {
328
+ $this->_details = $details;
329
+ }
330
+
331
+ /**
332
+ * Get the details
333
+ *
334
+ * @return array|stdClass
335
+ */
336
+ public function getDetails()
337
+ {
338
+ return $this->_details;
339
  }
340
  }
app/code/community/Nosto/Tagging/Model/Meta/Account/Billing.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Meta/Account/Iframe.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -116,12 +116,12 @@ class Nosto_Tagging_Model_Meta_Account_Iframe extends Mage_Core_Model_Abstract i
116
  public function loadData(Mage_Core_Model_Store $store)
117
  {
118
  /** @var Mage_Admin_Model_User $user */
 
119
  $user = Mage::getSingleton('admin/session')->getUser();
120
  /** @var Nosto_Tagging_Helper_Url $urlHelper */
121
  $urlHelper = Mage::helper('nosto_tagging/url');
122
  /** @var Nosto_Tagging_Helper_Data $dataHelper */
123
  $dataHelper = Mage::helper('nosto_tagging/data');
124
-
125
  $this->_firstName = $user->getFirstname();
126
  $this->_lastName = $user->getLastname();
127
  $this->_email = $user->getEmail();
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
116
  public function loadData(Mage_Core_Model_Store $store)
117
  {
118
  /** @var Mage_Admin_Model_User $user */
119
+ /** @noinspection PhpUndefinedMethodInspection */
120
  $user = Mage::getSingleton('admin/session')->getUser();
121
  /** @var Nosto_Tagging_Helper_Url $urlHelper */
122
  $urlHelper = Mage::helper('nosto_tagging/url');
123
  /** @var Nosto_Tagging_Helper_Data $dataHelper */
124
  $dataHelper = Mage::helper('nosto_tagging/data');
 
125
  $this->_firstName = $user->getFirstname();
126
  $this->_lastName = $user->getLastname();
127
  $this->_email = $user->getEmail();
app/code/community/Nosto/Tagging/Model/Meta/Account/Owner.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -59,17 +59,19 @@ class Nosto_Tagging_Model_Meta_Account_Owner extends Mage_Core_Model_Abstract im
59
  }
60
 
61
  /**
62
- * Loads the meta data for the given store.
63
  *
64
- * @param Mage_Core_Model_Store $store the store view to load the data for.
65
  */
66
- public function loadData(Mage_Core_Model_Store $store)
67
  {
68
  /** @var Mage_Admin_Model_User $user */
 
69
  $user = Mage::getSingleton('admin/session')->getUser();
70
- $this->_firstName = $user->getFirstname();
71
- $this->_lastName = $user->getLastname();
72
- $this->_email = $user->getEmail();
 
 
73
  }
74
 
75
  /**
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
59
  }
60
 
61
  /**
62
+ * Loads the user data from the active session.
63
  *
 
64
  */
65
+ public function loadData()
66
  {
67
  /** @var Mage_Admin_Model_User $user */
68
+ /** @noinspection PhpUndefinedMethodInspection */
69
  $user = Mage::getSingleton('admin/session')->getUser();
70
+ if ($user) {
71
+ $this->_firstName = $user->getFirstname();
72
+ $this->_lastName = $user->getLastname();
73
+ $this->_email = $user->getEmail();
74
+ }
75
  }
76
 
77
  /**
app/code/community/Nosto/Tagging/Model/Meta/Oauth.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -60,13 +60,9 @@ class Nosto_Tagging_Model_Meta_Oauth extends Mage_Core_Model_Abstract implements
60
  */
61
  public function loadData(Mage_Core_Model_Store $store)
62
  {
63
- $this->_redirectUrl = Mage::getUrl(
64
- 'nosto/oauth',
65
- array(
66
- '_store' => $store->getId(),
67
- '_store_to_url' => true
68
- )
69
- );
70
  $this->_languageIsoCode = substr(
71
  Mage::app()->getLocale()->getLocaleCode(), 0, 2
72
  );
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
60
  */
61
  public function loadData(Mage_Core_Model_Store $store)
62
  {
63
+ /* @var Nosto_Tagging_Helper_Url $urlHelper */
64
+ $urlHelper = Mage::helper('nosto_tagging/url');
65
+ $this->_redirectUrl = $urlHelper->getOauthRedirectUrl($store);
 
 
 
 
66
  $this->_languageIsoCode = substr(
67
  Mage::app()->getLocale()->getLocaleCode(), 0, 2
68
  );
app/code/community/Nosto/Tagging/Model/Meta/Order.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -190,12 +190,14 @@ class Nosto_Tagging_Model_Meta_Order extends Mage_Core_Model_Abstract implements
190
  try {
191
  $appliedRules = array();
192
  foreach ($order->getAllVisibleItems() as $item) {
 
193
  $itemAppliedRules = $item->getAppliedRuleIds();
194
  if (empty($itemAppliedRules)) {
195
  continue;
196
  }
197
  $ruleIds = explode(',', $item->getAppliedRuleIds());
198
  foreach ($ruleIds as $ruleId) {
 
199
  $rule = Mage::getModel('salesrule/rule')->load($ruleId);
200
  $appliedRules[$ruleId] = $rule->getName();
201
  }
@@ -223,7 +225,7 @@ class Nosto_Tagging_Model_Meta_Order extends Mage_Core_Model_Abstract implements
223
  */
224
  protected function buildItem(Mage_Sales_Model_Order_Item $item, Mage_Sales_Model_Order $order)
225
  {
226
- /* @var Nosto_Tagging_Helper_Price */
227
  $nostoPriceHelper = Mage::helper('nosto_tagging/price');
228
  return Mage::getModel(
229
  'nosto_tagging/meta_order_item',
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
190
  try {
191
  $appliedRules = array();
192
  foreach ($order->getAllVisibleItems() as $item) {
193
+ /** @var Mage_Sales_Model_Order_Item $item */
194
  $itemAppliedRules = $item->getAppliedRuleIds();
195
  if (empty($itemAppliedRules)) {
196
  continue;
197
  }
198
  $ruleIds = explode(',', $item->getAppliedRuleIds());
199
  foreach ($ruleIds as $ruleId) {
200
+ /** @var Mage_SalesRule_Model_Rule $rule */
201
  $rule = Mage::getModel('salesrule/rule')->load($ruleId);
202
  $appliedRules[$ruleId] = $rule->getName();
203
  }
225
  */
226
  protected function buildItem(Mage_Sales_Model_Order_Item $item, Mage_Sales_Model_Order $order)
227
  {
228
+ /* @var Nosto_Tagging_Helper_Price $nostoPriceHelper */
229
  $nostoPriceHelper = Mage::helper('nosto_tagging/price');
230
  return Mage::getModel(
231
  'nosto_tagging/meta_order_item',
app/code/community/Nosto/Tagging/Model/Meta/Order/Buyer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -60,6 +60,7 @@ class Nosto_Tagging_Model_Meta_Order_Buyer extends Mage_Core_Model_Abstract impl
60
  */
61
  public function __construct(array $args)
62
  {
 
63
  if (!isset($args['firstName']) || !is_string($args['firstName'])) {
64
  Mage::log(
65
  sprintf(
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
60
  */
61
  public function __construct(array $args)
62
  {
63
+ parent::__construct();
64
  if (!isset($args['firstName']) || !is_string($args['firstName'])) {
65
  Mage::log(
66
  sprintf(
app/code/community/Nosto/Tagging/Model/Meta/Order/Item.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -71,6 +71,7 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
71
  */
72
  public function __construct(array $args)
73
  {
 
74
  if (!isset($args['productId']) || empty($args['productId'])) {
75
  Mage::log(
76
  sprintf(
@@ -104,7 +105,7 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
104
  );
105
  $args['name'] = '';
106
  }
107
- if (!isset($args['unitPrice']) || empty($args['unitPrice'])) {
108
  Mage::log(
109
  sprintf(
110
  '%s.unitPrice must have a value',
@@ -114,7 +115,13 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
114
  Nosto_Tagging_Model_Base::LOG_FILE_NAME
115
  );
116
  $args['unitPrice'] = '';
 
 
 
 
 
117
  }
 
118
  if (!isset($args['currencyCode']) || empty($args['currencyCode'])) {
119
  Mage::log(
120
  sprintf(
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
71
  */
72
  public function __construct(array $args)
73
  {
74
+ parent::__construct();
75
  if (!isset($args['productId']) || empty($args['productId'])) {
76
  Mage::log(
77
  sprintf(
105
  );
106
  $args['name'] = '';
107
  }
108
+ if (!isset($args['unitPrice'])) {
109
  Mage::log(
110
  sprintf(
111
  '%s.unitPrice must have a value',
115
  Nosto_Tagging_Model_Base::LOG_FILE_NAME
116
  );
117
  $args['unitPrice'] = '';
118
+ } elseif (
119
+ empty($args['unitPrice'])
120
+ || !is_numeric($args['unitPrice'])
121
+ ) {
122
+ $args['unitPrice'] = 0;
123
  }
124
+
125
  if (!isset($args['currencyCode']) || empty($args['currencyCode'])) {
126
  Mage::log(
127
  sprintf(
app/code/community/Nosto/Tagging/Model/Meta/Order/Status.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -61,6 +61,7 @@ class Nosto_Tagging_Model_Meta_Order_Status extends Mage_Core_Model_Abstract imp
61
  */
62
  public function __construct(array $args)
63
  {
 
64
  if (!isset($args['code']) || !is_string($args['code'])) {
65
  Mage::log(
66
  sprintf(
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
61
  */
62
  public function __construct(array $args)
63
  {
64
+ parent::__construct();
65
  if (!isset($args['code']) || !is_string($args['code'])) {
66
  Mage::log(
67
  sprintf(
app/code/community/Nosto/Tagging/Model/Meta/Order/Vaimo/Klarna/Checkout.php ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Meta data class which holds information about an order.
30
+ * This is used during the order confirmation API request and the order
31
+ * history export.
32
+ *
33
+ * @category Nosto
34
+ * @package Nosto_Tagging
35
+ * @author Nosto Solutions Ltd <magento@nosto.com>
36
+ */
37
+ class Nosto_Tagging_Model_Meta_Order_Vaimo_Klarna_Checkout extends Nosto_Tagging_Model_Meta_Order
38
+ {
39
+
40
+ /**
41
+ * Defaul order status for completed checkouts
42
+ */
43
+ const DEFAULT_ORDER_STATUS = 'checkout_complete';
44
+
45
+ /**
46
+ * Discount factor for the order
47
+ * @var float
48
+ */
49
+ private $discountFactor;
50
+
51
+ /**
52
+ * Required fields for Klarna order
53
+ *
54
+ * @var array
55
+ */
56
+ public static $requiredFieldsForOrder = array(
57
+ 'completed_at',
58
+ 'status',
59
+ 'billing_address',
60
+ 'cart',
61
+ 'purchase_currency',
62
+ );
63
+
64
+ /**
65
+ * Loads the order data from a Magento quote model.
66
+ *
67
+ * @throws NostoException
68
+ * @return bool
69
+ * @param Mage_Sales_Model_Quote $quote the order model.
70
+ */
71
+ public function loadDataFromQuote(Mage_Sales_Model_Quote $quote)
72
+ {
73
+ $vaimoKlarnaOrder = null;
74
+ $checkoutId = $quote->getKlarnaCheckoutId();
75
+ $this->_orderNumber = $checkoutId;
76
+ $this->_externalOrderRef = null;
77
+ $this->_createdDate = $quote->getCreatedAt();
78
+ $this->_orderStatus = Mage::getModel(
79
+ 'nosto_tagging/meta_order_status',
80
+ array(
81
+ 'code' => self::DEFAULT_ORDER_STATUS,
82
+ 'label' => self::DEFAULT_ORDER_STATUS
83
+ )
84
+ );
85
+
86
+ $payment = $quote->getPayment();
87
+ if (
88
+ $payment instanceof Mage_Sales_Model_Quote_Payment
89
+ && $payment->getMethod()
90
+ ) {
91
+ $this->_paymentProvider = $payment->getMethod();
92
+ } else {
93
+ $this->_paymentProvider = 'unknown[from_vaimo_klarna_plugin]';
94
+ }
95
+ /* @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
96
+ $klarna = Mage::getModel('klarna/klarnacheckout');
97
+ if ($klarna instanceof Vaimo_Klarna_Model_Klarnacheckout === false) {
98
+ Nosto::throwException('No Vaimo_Klarna_Model_Klarnacheckout found');
99
+ }
100
+ $buyer_attributes = array(
101
+ 'firstName' => '',
102
+ 'lastName' => '',
103
+ 'email' => ''
104
+ );
105
+ $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
106
+ $vaimoKlarnaOrder = $klarna->getKlarnaOrderRaw($quote->getKlarnaCheckoutId());
107
+ try {
108
+ self::validateKlarnaOrder($vaimoKlarnaOrder);
109
+ } catch (NostoException $e) {
110
+ Mage::log(
111
+ sprintf(
112
+ 'Failed to validate VaimoKlarnaOrder. Error was %s',
113
+ $e->getMessage()
114
+ )
115
+ );
116
+
117
+ return false;
118
+ }
119
+ $vaimoKlarnaBilling = $vaimoKlarnaOrder['billing_address'];
120
+ if (!empty($vaimoKlarnaBilling['given_name'])) {
121
+ $buyer_attributes['firstName'] = $vaimoKlarnaBilling['given_name'];
122
+ }
123
+ if (!empty($vaimoKlarnaBilling['family_name'])) {
124
+ $buyer_attributes['lastName'] = $vaimoKlarnaBilling['family_name'];
125
+ }
126
+ if (!empty($vaimoKlarnaBilling['email'])) {
127
+ $buyer_attributes['email'] = $vaimoKlarnaBilling['email'];
128
+ }
129
+ $this->_buyer = Mage::getModel(
130
+ 'nosto_tagging/meta_order_buyer',
131
+ $buyer_attributes
132
+ );
133
+ try {
134
+ $this->buildItemsFromQuote($quote);
135
+ } catch (Exception $e) {
136
+ Mage::log(
137
+ sprintf(
138
+ 'Could not find klarnaCheckoutId from quote #%d. Error: %s',
139
+ $quote->getId(),
140
+ $e->getMessage()
141
+ ),
142
+ Zend_Log::ERR,
143
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
144
+ );
145
+ }
146
+
147
+ return true;
148
+ }
149
+
150
+ /**
151
+ * Buils item array from quote (items in cart)
152
+ *
153
+ * @param Mage_Sales_Model_Quote $quote
154
+ */
155
+ public function buildItemsFromQuote(Mage_Sales_Model_Quote $quote)
156
+ {
157
+ $discountFactor = $this->getDiscountFactor($quote);
158
+ /* @var Mage_Sales_Model_Quote_Item $quoteItem */
159
+ foreach ($quote->getAllItems() as $quoteItem) {
160
+ if ($discountFactor && is_numeric($discountFactor)) {
161
+ $itemPrice = round($quoteItem->getPriceInclTax(),2)*$discountFactor;
162
+ } else {
163
+ $itemPrice = $quoteItem->getPriceInclTax();
164
+ }
165
+ $itemArguments = array(
166
+ 'productId' => $quoteItem->getProductId(),
167
+ 'quantity' => $quoteItem->getQty(),
168
+ 'name' => $quoteItem->getName(),
169
+ 'unitPrice' => $itemPrice,
170
+ 'currencyCode' => strtoupper($quote->getQuoteCurrencyCode())
171
+ );
172
+ $nostoItem = Mage::getModel(
173
+ 'nosto_tagging/meta_order_item',
174
+ $itemArguments
175
+ );
176
+ $this->_items[] = $nostoItem;
177
+ }
178
+ if ($this->includeSpecialItems) {
179
+ $appliedRuleIds = $quote->getAppliedRuleIds();
180
+ if ($appliedRuleIds) {
181
+ $ruleIds = explode(',',$quote->getAppliedRuleIds());
182
+ if (is_array($ruleIds)) {
183
+ foreach ($ruleIds as $ruleId) {
184
+ /* @var Mage_SalesRule_Model_Rule $discountRule */
185
+ $discountRule = Mage::getModel('salesrule/rule')->load($ruleId);
186
+ $name = sprintf(
187
+ 'Discount (%s)',
188
+ $discountRule->getName()
189
+ );
190
+ $itemArguments = array(
191
+ 'productId' => -1,
192
+ 'quantity' => 1,
193
+ 'name' => $name,
194
+ 'unitPrice' => 0,
195
+ 'currencyCode' => strtoupper($quote->getQuoteCurrencyCode())
196
+ );
197
+ $nostoItem = Mage::getModel(
198
+ 'nosto_tagging/meta_order_item',
199
+ $itemArguments
200
+ );
201
+ $this->_items[] = $nostoItem;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Calculates the discount factor
210
+ *
211
+ * @param Mage_Sales_Model_Quote $quote
212
+ * @return float|int
213
+ */
214
+ private function getDiscountFactor(Mage_Sales_Model_Quote $quote) {
215
+ if (!$this->discountFactor) {
216
+ $totalPrice = $quote->getSubtotal();
217
+ $discountedPrice = $quote->getSubtotalWithDiscount();
218
+ $this->discountFactor = $discountedPrice / $totalPrice;
219
+ }
220
+
221
+ return $this->discountFactor;
222
+ }
223
+
224
+ /**
225
+ * Loads data based on klarna checkout id
226
+ *
227
+ * @param string $klarnaCheckoutId
228
+ */
229
+ public function loadOrderByKlarnaCheckoutId($klarnaCheckoutId)
230
+ {
231
+ /* @var Vaimo_Klarna_Helper_Data $klarna_helper */
232
+ $klarna_helper = Mage::helper('klarna');
233
+ if ($klarna_helper instanceof Vaimo_Klarna_Helper_Data) {
234
+ /* @var $quote Mage_Sales_Model_Quote */
235
+ $quote = $klarna_helper->findQuote($klarnaCheckoutId);
236
+ if ($quote instanceof Mage_Sales_Model_Quote) {
237
+ /* @var $order Mage_Sales_Model_Order */
238
+ $salesOrderModel = Mage::getModel('sales/order');
239
+ $order = $salesOrderModel->loadByAttribute(
240
+ 'quote_id',
241
+ $quote->getId()
242
+ );
243
+ if (
244
+ $order instanceof Mage_Sales_Model_Order
245
+ && $order->getId()
246
+ ) {
247
+ $this->loadData($order);
248
+ } else {
249
+ $this->loadDataFromQuote($quote);
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Loads data from order
257
+ *
258
+ * @param Mage_Sales_Model_Order $order
259
+ */
260
+ public function loadData(Mage_Sales_Model_Order $order)
261
+ {
262
+ $store = Mage::getSingleton('core/store')->load($order->store_id);
263
+ $quote = Mage::getModel('sales/quote')->setStore($store)->load($order->getQuoteId());
264
+ parent::loadData($order);
265
+ $klarnaCheckoutId = $quote->getKlarnaCheckoutId();
266
+ if (empty($klarnaCheckoutId)) {
267
+ Mage::log(
268
+ sprintf(
269
+ 'Could not find klarnaCheckoutId from quote #%d',
270
+ $order->quoteId()
271
+ ),
272
+ Zend_Log::ERR,
273
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
274
+ );
275
+ } else {
276
+ $this->_orderNumber = $klarnaCheckoutId;
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Validates Klarna entity
282
+ *
283
+ * @param $order
284
+ * @return bool
285
+ */
286
+ public static function validateKlarnaOrder($order)
287
+ {
288
+ return self::validateKlarnaEntity('Order', $order);
289
+ }
290
+
291
+ /**
292
+ * Validates Klarna entity
293
+ *
294
+ * @param $type
295
+ * @param $entity
296
+ * @return bool
297
+ */
298
+ public static function validateKlarnaEntity($type, $entity)
299
+ {
300
+ $rules = sprintf('requiredFieldsFor%s', ucfirst($type));
301
+ $empty = false;
302
+ foreach (self::$$rules as $field) {
303
+ if (
304
+ is_object($entity)
305
+ ) {
306
+ if (get_class($entity) === 'Varien_Object') {
307
+ $val = $entity->get($field);
308
+ if (empty($val)) {
309
+ $empty = true;
310
+ }
311
+ } elseif (isset($entity[$field])) {
312
+ $val = $entity[$field];
313
+ if (empty($val)) {
314
+ $empty = true;
315
+ }
316
+ }
317
+ } elseif (is_array($entity)) {
318
+ if (empty($entity[$field])) {
319
+ $empty = true;
320
+ }
321
+ }
322
+ if ($empty === true) {
323
+ Nosto::throwException(
324
+ sprintf(
325
+ 'Cannot create item - empty %s',
326
+ $field
327
+ )
328
+ );
329
+ }
330
+ }
331
+
332
+ return true;
333
+ }
334
+ }
app/code/community/Nosto/Tagging/Model/Meta/Product.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -36,26 +36,6 @@
36
  */
37
  class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implements NostoProductInterface, NostoValidatableInterface
38
  {
39
- /**
40
- * Product "in stock" tagging string.
41
- */
42
- const PRODUCT_IN_STOCK = 'InStock';
43
-
44
- /**
45
- * Product "out of stock" tagging string.
46
- */
47
- const PRODUCT_OUT_OF_STOCK = 'OutOfStock';
48
-
49
- /**
50
- * Product "invisible " tagging string.
51
- */
52
- const PRODUCT_INVISIBLE = 'Invisible';
53
-
54
- /**
55
- * Product "can be directly added to cart" tag string.
56
- */
57
- const PRODUCT_ADD_TO_CART = 'add-to-cart';
58
-
59
  /**
60
  * @var string the absolute url to the product page in the shop frontend.
61
  */
@@ -99,11 +79,7 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
99
  /**
100
  * @var array the tags for the product.
101
  */
102
- protected $_tags = array(
103
- 'tag1' => array(),
104
- 'tag2' => array(),
105
- 'tag3' => array(),
106
- );
107
 
108
  /**
109
  * @var array the categories the product is located in.
@@ -126,9 +102,77 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
126
  protected $_brand;
127
 
128
  /**
129
- * @var string the product publication date in the shop.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  */
131
- protected $_datePublished;
 
 
 
 
 
 
132
 
133
  /**
134
  * @inheritdoc
@@ -160,6 +204,15 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
160
  );
161
  }
162
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Loads the product info from a Magento product model.
165
  *
@@ -174,14 +227,25 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
174
 
175
  /** @var Nosto_Tagging_Helper_Price $priceHelper */
176
  $priceHelper = Mage::helper('nosto_tagging/price');
 
 
177
 
178
  $this->_url = $this->buildUrl($product, $store);
179
  $this->_productId = $product->getId();
180
  $this->_name = $product->getName();
181
  $this->_imageUrl = $this->buildImageUrl($product, $store);
182
- $this->_price = $priceHelper->convertToDefaultCurrency($priceHelper->getProductFinalPriceInclTax($product), $store);
183
- $this->_listPrice = $priceHelper->convertToDefaultCurrency($priceHelper->getProductPriceInclTax($product), $store);
184
- $this->_currencyCode = $store->getDefaultCurrency()->getCode();
 
 
 
 
 
 
 
 
 
185
  $this->_availability = $this->buildAvailability($product);
186
  $this->_categories = $this->buildCategories($product);
187
 
@@ -193,15 +257,18 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
193
  if ($product->hasData('description')) {
194
  $this->_description = $product->getData('description');
195
  }
196
- if ($product->hasData('manufacturer')) {
197
- $this->_brand = $product->getAttributeText('manufacturer');
 
198
  }
199
  if (($tags = $this->buildTags($product, $store)) !== array()) {
200
  $this->_tags['tag1'] = $tags;
201
  }
202
- if ($product->hasData('created_at')) {
203
- $this->_datePublished = $product->getData('created_at');
204
  }
 
 
205
  }
206
 
207
  /**
@@ -213,11 +280,11 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
213
  */
214
  protected function buildAvailability(Mage_Catalog_Model_Product $product)
215
  {
216
- $availability = self::PRODUCT_OUT_OF_STOCK;
217
  if(!$product->isVisibleInSiteVisibility()) {
218
- $availability = self::PRODUCT_INVISIBLE;
219
  } elseif ($product->isAvailable()) {
220
- $availability = self::PRODUCT_IN_STOCK;
221
  }
222
 
223
  return $availability;
@@ -259,12 +326,60 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
259
  }
260
 
261
  if (!$product->canConfigure()) {
262
- $tags[] = self::PRODUCT_ADD_TO_CART;
263
  }
264
 
 
265
  return $tags;
266
  }
267
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  /**
269
  * Builds the absolute store front url for the product page.
270
  *
@@ -279,18 +394,10 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
279
  */
280
  protected function buildUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
281
  {
282
- // Unset the cached url first, as it won't include the `___store` param
283
- // if it's cached. We need to define the specific store view in the url
284
- // in case the same domain is used for all sites.
285
- $product->unsetData('url');
286
- return $product
287
- ->getUrlInStore(
288
- array(
289
- '_nosid' => true,
290
- '_ignore_category' => true,
291
- '_store' => $store->getCode(),
292
- )
293
- );
294
  }
295
 
296
  /**
@@ -505,16 +612,6 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
505
  return $this->_brand;
506
  }
507
 
508
- /**
509
- * Returns the product publication date in the shop.
510
- *
511
- * @return string the date.
512
- */
513
- public function getDatePublished()
514
- {
515
- return $this->_datePublished;
516
- }
517
-
518
  /**
519
  * Returns the full product description,
520
  * i.e. both the "short" and "normal" descriptions concatenated.
@@ -540,6 +637,126 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
540
  */
541
  public function getVariationId()
542
  {
543
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  }
545
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
36
  */
37
  class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implements NostoProductInterface, NostoValidatableInterface
38
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * @var string the absolute url to the product page in the shop frontend.
41
  */
79
  /**
80
  * @var array the tags for the product.
81
  */
82
+ protected $_tags = array();
 
 
 
 
83
 
84
  /**
85
  * @var array the categories the product is located in.
102
  protected $_brand;
103
 
104
  /**
105
+ * @var string the default variation identifier of the shop
106
+ */
107
+ protected $_variationId;
108
+
109
+ /**
110
+ * @var float the price paid for the supplier
111
+ */
112
+ protected $_supplierCost;
113
+
114
+ /**
115
+ * @var int product stock
116
+ */
117
+ protected $_inventoryLevel;
118
+
119
+ /**
120
+ * @var int the amount of reviews
121
+ */
122
+ protected $_reviewCount;
123
+
124
+ /**
125
+ * @var float the value of the rating(s)
126
+ */
127
+ protected $_ratingValue;
128
+
129
+ /**
130
+ * @var array alternative image urls
131
+ */
132
+ protected $_alternateImageUrls;
133
+
134
+ /**
135
+ * @var string the condition of the product
136
+ */
137
+ protected $_condition;
138
+
139
+ /**
140
+ * @var string the gender (target group) of the product
141
+ */
142
+ protected $_gender;
143
+
144
+ /**
145
+ * @var string the the age group
146
+ */
147
+ protected $_ageGroup;
148
+
149
+ /**
150
+ * @var string the barcode
151
+ */
152
+ protected $_gtin;
153
+
154
+ /**
155
+ * @var string category used in Google's services
156
+ */
157
+ protected $_googleCategory;
158
+
159
+ /**
160
+ * @var string the pricing measure of the product. Pricing measure for a
161
+ * 0.33 liter bottle for example is "0.33".
162
+ */
163
+ protected $_unitPricingMeasure;
164
+
165
+ /**
166
+ * @var string the pricing base measure of the product. Pricing base measure
167
+ * for a 0.33l bottle is "1".
168
  */
169
+ protected $_unitPricingBaseMeasure;
170
+
171
+ /**
172
+ * @var string the pricing unit of the product. Pricing unit for a 0.33l
173
+ * bottle is "l" (litre).
174
+ */
175
+ protected $_unitPricingUnit;
176
 
177
  /**
178
  * @inheritdoc
204
  );
205
  }
206
 
207
+ public function __construct()
208
+ {
209
+ parent::__construct();
210
+ foreach (Nosto_Tagging_Helper_Data::$validTags as $validTag) {
211
+ $this->_tags[$validTag] = array();
212
+ }
213
+ $this->_alternateImageUrls = array();
214
+ }
215
+
216
  /**
217
  * Loads the product info from a Magento product model.
218
  *
227
 
228
  /** @var Nosto_Tagging_Helper_Price $priceHelper */
229
  $priceHelper = Mage::helper('nosto_tagging/price');
230
+ /** @var Nosto_Tagging_Helper_Data $dataHelper */
231
+ $dataHelper = Mage::helper('nosto_tagging');
232
 
233
  $this->_url = $this->buildUrl($product, $store);
234
  $this->_productId = $product->getId();
235
  $this->_name = $product->getName();
236
  $this->_imageUrl = $this->buildImageUrl($product, $store);
237
+ $currentCurrencyCode = $store->getCurrentCurrencyCode();
238
+ $this->_price = $priceHelper->getTaggingPrice(
239
+ $priceHelper->getProductFinalPriceInclTax($product),
240
+ $currentCurrencyCode,
241
+ $store
242
+ );
243
+ $this->_listPrice = $priceHelper->getTaggingPrice(
244
+ $priceHelper->getProductPriceInclTax($product),
245
+ $currentCurrencyCode,
246
+ $store
247
+ );
248
+ $this->_currencyCode = $priceHelper->getTaggingCurrencyCode($currentCurrencyCode, $store);
249
  $this->_availability = $this->buildAvailability($product);
250
  $this->_categories = $this->buildCategories($product);
251
 
257
  if ($product->hasData('description')) {
258
  $this->_description = $product->getData('description');
259
  }
260
+ $brandAttribute = $dataHelper->getBrandAttribute($store);
261
+ if ($product->hasData($brandAttribute)) {
262
+ $this->_brand = $this->getAttributeValue($product, $brandAttribute);
263
  }
264
  if (($tags = $this->buildTags($product, $store)) !== array()) {
265
  $this->_tags['tag1'] = $tags;
266
  }
267
+ if (!$dataHelper->multiCurrencyDisabled($store)) {
268
+ $this->_variationId = $store->getBaseCurrencyCode();
269
  }
270
+
271
+ $this->amendAttributeTags($product, $store);
272
  }
273
 
274
  /**
280
  */
281
  protected function buildAvailability(Mage_Catalog_Model_Product $product)
282
  {
283
+ $availability = self::OUT_OF_STOCK;
284
  if(!$product->isVisibleInSiteVisibility()) {
285
+ $availability = self::INVISIBLE;
286
  } elseif ($product->isAvailable()) {
287
+ $availability = self::IN_STOCK;
288
  }
289
 
290
  return $availability;
326
  }
327
 
328
  if (!$product->canConfigure()) {
329
+ $tags[] = self::ADD_TO_CART;
330
  }
331
 
332
+
333
  return $tags;
334
  }
335
 
336
+ /**
337
+ * Amends the product attributes to tags array if attributes are defined
338
+ * and are present in product
339
+ *
340
+ * @param Mage_Catalog_Model_Product $product the product model.
341
+ * @param Mage_Core_Model_Store $store the store model.
342
+ *
343
+ */
344
+ protected function amendAttributeTags(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
345
+ {
346
+ $product_attributes = $product->getAttributes();
347
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
348
+ $nosto_helper = Mage::helper("nosto_tagging");
349
+
350
+ foreach (Nosto_Tagging_Helper_Data::$validTags as $tag_id) {
351
+ $attributes_to_tag = $nosto_helper->getAttributesToTag($tag_id, $store->getId());
352
+ if (empty($attributes_to_tag) || !is_array($attributes_to_tag)) {
353
+ continue;
354
+ }
355
+ /* @var Mage_Catalog_Model_Resource_Eav_Attribute $product_attribute*/
356
+ foreach ($product_attributes as $key=>$product_attribute) {
357
+ if (in_array($key, $attributes_to_tag)) {
358
+ try {
359
+ $attribute_value = $this->getAttributeValue($product, $key);
360
+ if (!empty($attribute_value)) {
361
+ $this->_tags[$tag_id][] = sprintf(
362
+ '%s:%s',
363
+ $key,
364
+ $attribute_value
365
+ );
366
+ }
367
+ } catch (Exception $e) {
368
+ Mage::log(
369
+ sprintf(
370
+ 'Failed to add attribute %s to tags. Error message was: %s',
371
+ $key,
372
+ $e->getMessage()
373
+ ),
374
+ Zend_Log::WARN,
375
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
376
+ );
377
+ }
378
+ }
379
+ }
380
+ }
381
+ }
382
+
383
  /**
384
  * Builds the absolute store front url for the product page.
385
  *
394
  */
395
  protected function buildUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
396
  {
397
+ /** @var Nosto_Tagging_Helper_Url $url_helper */
398
+ $url_helper = Mage::helper('nosto_tagging/url');
399
+ $product_url = $url_helper->generateProductUrl($product, $store);
400
+ return $product_url;
 
 
 
 
 
 
 
 
401
  }
402
 
403
  /**
612
  return $this->_brand;
613
  }
614
 
 
 
 
 
 
 
 
 
 
 
615
  /**
616
  * Returns the full product description,
617
  * i.e. both the "short" and "normal" descriptions concatenated.
637
  */
638
  public function getVariationId()
639
  {
640
+ return $this->_variationId;
641
+ }
642
+
643
+ private function getAttributeValue(Mage_Catalog_Model_Product $product, $attributeName)
644
+ {
645
+ $attribute = $product->getResource()->getAttribute($attributeName);
646
+ if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
647
+ $attribute_data = $product->getData($attributeName);
648
+ $attribute_value = $product->getAttributeText($attributeName);
649
+ if (empty($attribute_value) && is_scalar($attribute_data)) {
650
+ $attribute_value = $attribute_data;
651
+ }
652
+ } else {
653
+ $attribute_value = null;
654
+ }
655
+
656
+ return trim($attribute_value);
657
+ }
658
+
659
+ /**
660
+ * @inheritdoc
661
+ */
662
+ public function getSupplierCost()
663
+ {
664
+ return $this->_supplierCost;
665
+ }
666
+
667
+ /**
668
+ * @inheritdoc
669
+ */
670
+ public function getInventoryLevel()
671
+ {
672
+ return $this->_inventoryLevel;
673
+ }
674
+
675
+ /**
676
+ * @inheritdoc
677
+ */
678
+ public function getReviewCount()
679
+ {
680
+ return $this->_reviewCount;
681
+ }
682
+
683
+ /**
684
+ * @inheritdoc
685
+ */
686
+ public function getRatingValue()
687
+ {
688
+ return $this->_ratingValue;
689
+ }
690
+
691
+ /**
692
+ * @inheritdoc
693
+ */
694
+ public function getAlternateImageUrls()
695
+ {
696
+ return $this->_alternateImageUrls;
697
+ }
698
+
699
+ /**
700
+ * @inheritdoc
701
+ */
702
+ public function getCondition()
703
+ {
704
+ return $this->_condition;
705
+ }
706
+
707
+ /**
708
+ * @inheritdoc
709
+ */
710
+ public function getGender()
711
+ {
712
+ return $this->_gender;
713
+ }
714
+
715
+ /**
716
+ * @inheritdoc
717
+ */
718
+ public function getAgeGroup()
719
+ {
720
+ return $this->_ageGroup;
721
+ }
722
+
723
+ /**
724
+ * @inheritdoc
725
+ */
726
+ public function getGtin()
727
+ {
728
+ return $this->_gtin;
729
+ }
730
+
731
+ /**
732
+ * @inheritdoc
733
+ */
734
+ public function getGoogleCategory()
735
+ {
736
+ return $this->_googleCategory;
737
+ }
738
+
739
+ /**
740
+ * @inheritdoc
741
+ */
742
+ public function getUnitPricingMeasure()
743
+ {
744
+ return $this->_unitPricingMeasure;
745
+ }
746
+
747
+ /**
748
+ * @inheritdoc
749
+ */
750
+ public function getUnitPricingBaseMeasure()
751
+ {
752
+ return $this->_unitPricingBaseMeasure;
753
+ }
754
+
755
+ /**
756
+ * @inheritdoc
757
+ */
758
+ public function getUnitPricingUnit()
759
+ {
760
+ return $this->_unitPricingUnit;
761
  }
762
  }
app/code/community/Nosto/Tagging/Model/Observer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -55,6 +55,7 @@ class Nosto_Tagging_Model_Observer
55
  {
56
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
57
  /** @var $layout Mage_Core_Model_Layout_Update */
 
58
  $layout = $observer->getEvent()->getLayout()->getUpdate();
59
  $layout->addHandle(self::XML_LAYOUT_PAGE_DEFAULT_FOOTER_HANDLE);
60
  }
@@ -74,6 +75,7 @@ class Nosto_Tagging_Model_Observer
74
  {
75
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
76
  /** @var Mage_Catalog_Model_Product $product */
 
77
  $product = $observer->getEvent()->getProduct();
78
  // Always "upsert" the product for all stores it is available in.
79
  // This is done to avoid data inconsistencies as even if a product
@@ -81,22 +83,31 @@ class Nosto_Tagging_Model_Observer
81
  // other stores as well.
82
  foreach ($product->getStoreIds() as $storeId) {
83
  $store = Mage::app()->getStore($storeId);
 
 
 
84
 
85
- /** @var NostoAccount $account */
86
- $account = Mage::helper('nosto_tagging/account')
87
- ->find($store);
88
- if ($account === null || !$account->isConnectedToNosto()) {
89
  continue;
90
  }
91
 
92
  // Load the product model for this particular store view.
93
- $product = Mage::getModel('catalog/product')
 
 
 
94
  ->setStoreId($store->getId())
95
  ->load($product->getId());
96
  if (is_null($product)) {
97
  continue;
98
  }
99
 
 
 
 
100
  /** @var Nosto_Tagging_Model_Meta_Product $model */
101
  $model = Mage::getModel('nosto_tagging/meta_product');
102
  $model->loadData($product, $store);
@@ -106,13 +117,14 @@ class Nosto_Tagging_Model_Observer
106
  $validator = new NostoValidator($model);
107
  if ($validator->validate()) {
108
  try {
109
- $op = new NostoOperationProduct($account);
110
- $op->addProduct($model);
111
- $op->upsert();
112
  } catch (NostoException $e) {
113
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
114
  }
115
  }
 
116
  }
117
  }
118
 
@@ -131,30 +143,33 @@ class Nosto_Tagging_Model_Observer
131
  {
132
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
133
  /** @var Mage_Catalog_Model_Product $product */
 
134
  $product = $observer->getEvent()->getProduct();
135
  // Products are always deleted from all store views, regardless of
136
  // the store view scope switcher on the product edit page.
137
  /** @var Mage_Core_Model_Store $store */
138
  foreach (Mage::app()->getStores() as $store) {
139
- /** @var NostoAccount $account */
140
- $account = Mage::helper('nosto_tagging/account')
141
- ->find($store);
142
 
143
  if ($account === null || !$account->isConnectedToNosto()) {
144
  continue;
145
  }
146
-
 
 
147
  /** @var Nosto_Tagging_Model_Meta_Product $model */
148
  $model = Mage::getModel('nosto_tagging/meta_product');
149
  $model->setProductId($product->getId());
150
-
151
  try {
152
- $op = new NostoOperationProduct($account);
153
- $op->addProduct($model);
154
- $op->delete();
155
  } catch (NostoException $e) {
156
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
157
  }
 
158
  }
159
  }
160
 
@@ -175,22 +190,136 @@ class Nosto_Tagging_Model_Observer
175
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
176
  try {
177
  /** @var Mage_Sales_Model_Order $mageOrder */
 
178
  $mageOrder = $observer->getEvent()->getOrder();
179
- /** @var Nosto_Tagging_Model_Meta_Order $order */
180
- $order = Mage::getModel('nosto_tagging/meta_order');
181
- $order->loadData($mageOrder);
182
- /** @var NostoAccount $account */
183
- $account = Mage::helper('nosto_tagging/account')
184
- ->find($mageOrder->getStore());
185
- $customerId = Mage::helper('nosto_tagging/customer')
186
- ->getNostoId($mageOrder);
187
- if ($account !== null && $account->isConnectedToNosto()) {
188
- /** @var Nosto_Tagging_Model_Service_Order $service */
189
- $service = Mage::getModel('nosto_tagging/service_order');
190
- $service->confirm($order, $account, $customerId);
 
 
 
 
 
 
191
  }
192
  } catch (NostoException $e) {
193
- Mage::log("\n" . $e->__toString(), Zend_Log::ERR, 'nostotagging.log');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
195
  }
196
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
55
  {
56
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
57
  /** @var $layout Mage_Core_Model_Layout_Update */
58
+ /** @noinspection PhpUndefinedMethodInspection */
59
  $layout = $observer->getEvent()->getLayout()->getUpdate();
60
  $layout->addHandle(self::XML_LAYOUT_PAGE_DEFAULT_FOOTER_HANDLE);
61
  }
75
  {
76
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
77
  /** @var Mage_Catalog_Model_Product $product */
78
+ /** @noinspection PhpUndefinedMethodInspection */
79
  $product = $observer->getEvent()->getProduct();
80
  // Always "upsert" the product for all stores it is available in.
81
  // This is done to avoid data inconsistencies as even if a product
83
  // other stores as well.
84
  foreach ($product->getStoreIds() as $storeId) {
85
  $store = Mage::app()->getStore($storeId);
86
+ /** @var Nosto_Tagging_Helper_Account $helper */
87
+ $helper = Mage::helper('nosto_tagging/account');
88
+ $account = $helper->find($store);
89
 
90
+ /* @var $nostoHelper Nosto_Tagging_Helper_Data */
91
+ $nostoHelper = Mage::helper('nosto_tagging');
92
+ if ($account === null || !$account->isConnectedToNosto()
93
+ || !$nostoHelper->getUseProductApi($store)) {
94
  continue;
95
  }
96
 
97
  // Load the product model for this particular store view.
98
+ /** @var Mage_Catalog_Model_Product $catalog */
99
+ $catalog = Mage::getModel('catalog/product');
100
+ /** @noinspection PhpUndefinedMethodInspection */
101
+ $product = $catalog
102
  ->setStoreId($store->getId())
103
  ->load($product->getId());
104
  if (is_null($product)) {
105
  continue;
106
  }
107
 
108
+ /* @var Mage_Core_Model_App_Emulation $emulation */
109
+ $emulation = Mage::getSingleton('core/app_emulation');
110
+ $env = $emulation->startEnvironmentEmulation($store->getId());
111
  /** @var Nosto_Tagging_Model_Meta_Product $model */
112
  $model = Mage::getModel('nosto_tagging/meta_product');
113
  $model->loadData($product, $store);
117
  $validator = new NostoValidator($model);
118
  if ($validator->validate()) {
119
  try {
120
+ $service = new NostoOperationProduct($account);
121
+ $service->addProduct($model);
122
+ $service->upsert();
123
  } catch (NostoException $e) {
124
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
125
  }
126
  }
127
+ $emulation->stopEnvironmentEmulation($env);
128
  }
129
  }
130
 
143
  {
144
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
145
  /** @var Mage_Catalog_Model_Product $product */
146
+ /** @noinspection PhpUndefinedMethodInspection */
147
  $product = $observer->getEvent()->getProduct();
148
  // Products are always deleted from all store views, regardless of
149
  // the store view scope switcher on the product edit page.
150
  /** @var Mage_Core_Model_Store $store */
151
  foreach (Mage::app()->getStores() as $store) {
152
+ /** @var Nosto_Tagging_Helper_Account $helper */
153
+ $helper = Mage::helper('nosto_tagging/account');
154
+ $account = $helper->find($store);
155
 
156
  if ($account === null || !$account->isConnectedToNosto()) {
157
  continue;
158
  }
159
+ /* @var Mage_Core_Model_App_Emulation $emulation */
160
+ $emulation = Mage::getSingleton('core/app_emulation');
161
+ $env = $emulation->startEnvironmentEmulation($store->getId());
162
  /** @var Nosto_Tagging_Model_Meta_Product $model */
163
  $model = Mage::getModel('nosto_tagging/meta_product');
164
  $model->setProductId($product->getId());
 
165
  try {
166
+ $service = new NostoOperationProduct($account);
167
+ $service->addProduct($model);
168
+ $service->delete();
169
  } catch (NostoException $e) {
170
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
171
  }
172
+ $emulation->stopEnvironmentEmulation($env);
173
  }
174
  }
175
 
190
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
191
  try {
192
  /** @var Mage_Sales_Model_Order $mageOrder */
193
+ /** @noinspection PhpUndefinedMethodInspection */
194
  $mageOrder = $observer->getEvent()->getOrder();
195
+
196
+ if ($mageOrder instanceof Mage_Sales_Model_Order) {
197
+ /** @var Nosto_Tagging_Helper_Class $helper */
198
+ $helper = Mage::helper('nosto_tagging/class');
199
+ /** @var Nosto_Tagging_Model_Meta_Order $order */
200
+ $order = $helper->getOrderClass($mageOrder);
201
+ $order->loadData($mageOrder);
202
+ /** @var Nosto_Tagging_Helper_Account $helper */
203
+ $helper = Mage::helper('nosto_tagging/account');
204
+ $account = $helper->find($mageOrder->getStore());
205
+ /** @var Nosto_Tagging_Helper_Customer $helper */
206
+ $helper = Mage::helper('nosto_tagging/customer');
207
+ $customerId = $helper->getNostoId($mageOrder);
208
+ if ($account !== null && $account->isConnectedToNosto()) {
209
+ /** @var Nosto_Tagging_Model_Service_Order $service */
210
+ $service = Mage::getModel('nosto_tagging/service_order');
211
+ $service->confirm($order, $account, $customerId);
212
+ }
213
  }
214
  } catch (NostoException $e) {
215
+ Mage::log(
216
+ "\n" . $e->__toString(),
217
+ Zend_Log::ERR,
218
+ 'nostotagging.log'
219
+ );
220
+ }
221
+ }
222
+
223
+ return $this;
224
+ }
225
+
226
+ /**
227
+ * Cron job for syncing currency exchange rates to Nosto.
228
+ * Only stores that have the scheduled update enabled, have more currencies
229
+ * than the default one defined and has a Nosto account are synced.
230
+ *
231
+ * @throws Mage_Cron_Exception
232
+ */
233
+ public function scheduledCurrencyExchangeRateUpdate()
234
+ {
235
+ /** @var Nosto_Tagging_Helper_Data $helper */
236
+ $helper = Mage::helper('nosto_tagging');
237
+ if ($helper->isModuleEnabled()) {
238
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
239
+ $accountHelper = Mage::helper('nosto_tagging/account');
240
+ $error = false;
241
+ foreach (Mage::app()->getStores() as $store) {
242
+ /** @var Mage_Core_Model_Store $store */
243
+ if (
244
+ !$helper->isScheduledCurrencyExchangeRateUpdateEnabled($store)
245
+ || !$helper->isMultiCurrencyMethodExchangeRate($store)
246
+ ) {
247
+ continue;
248
+ }
249
+ $account = $accountHelper->find($store);
250
+ if (is_null($account)) {
251
+ continue;
252
+ }
253
+ if (!$accountHelper->updateCurrencyExchangeRates($account, $store)) {
254
+ $error = true;
255
+ }
256
+ }
257
+ if ($error) {
258
+ throw Mage::exception(
259
+ 'Mage_Cron',
260
+ 'There was an error updating the exchange rates. More info in "var/log/nostotagging.log".'
261
+ );
262
+ }
263
+ }
264
+ }
265
+
266
+ /**
267
+ * Updates / synchronizes Nosto account settings via API to Nosto
268
+ * for each store that has Nosto account.
269
+ *
270
+ * Event 'admin_system_config_changed_section_nosto_tagging'.
271
+ *
272
+ * @param Varien_Event_Observer $observer
273
+ *
274
+ * @return Nosto_Tagging_Model_Observer
275
+ */
276
+ public function syncNostoAccount(/** @noinspection PhpUnusedParameterInspection */
277
+ Varien_Event_Observer $observer)
278
+ {
279
+ /** @var Nosto_Tagging_Helper_Data $helper */
280
+ $helper = Mage::helper('nosto_tagging');
281
+ if ($helper->isModuleEnabled()) {
282
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
283
+ $accountHelper = Mage::helper('nosto_tagging/account');
284
+ /** @var Mage_Core_Model_Store $store */
285
+ foreach (Mage::app()->getStores() as $store) {
286
+ $account = $accountHelper->find($store);
287
+ if ($account instanceof NostoAccount === false) {
288
+ continue;
289
+ }
290
+ /* @var Mage_Core_Model_App_Emulation $emulation */
291
+ $emulation = Mage::getSingleton('core/app_emulation');
292
+ $env = $emulation->startEnvironmentEmulation($store->getId());
293
+ if (!$accountHelper->updateAccount($account, $store)) {
294
+ Mage::log(
295
+ sprintf(
296
+ 'Failed sync account #%s for store #%s in class %s',
297
+ $account->getName(),
298
+ $store->getName(),
299
+ __CLASS__
300
+ ),
301
+ Zend_Log::WARN,
302
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
303
+ );
304
+ }
305
+ if ($helper->isMultiCurrencyMethodExchangeRate($store)) {
306
+ if (!$accountHelper->updateCurrencyExchangeRates(
307
+ $account, $store
308
+ )
309
+ ) {
310
+ Mage::log(
311
+ sprintf(
312
+ 'Failed sync currency rates #%s for store #%s in class %s',
313
+ $account->getName(),
314
+ $store->getName(),
315
+ __CLASS__
316
+ ),
317
+ Zend_Log::WARN,
318
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
319
+ );
320
+ }
321
+ }
322
+ $emulation->stopEnvironmentEmulation($env);
323
  }
324
  }
325
 
app/code/community/Nosto/Tagging/Model/Product.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Resource/Customer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Resource/Customer/Collection.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Resource/Product/Collection.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Resource/Setup.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/code/community/Nosto/Tagging/Model/Service/Order.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -84,11 +84,13 @@ class Nosto_Tagging_Model_Service_Order
84
  */
85
  protected function getOrderAsJson(Nosto_Tagging_Model_Meta_Order $order)
86
  {
 
 
87
  $data = array(
88
  'order_number' => $order->getOrderNumber(),
89
  'external_order_ref' => $order->getExternalOrderRef(),
90
  'buyer' => array(),
91
- 'created_at' => Nosto::helper('date')->format($order->getCreatedDate()),
92
  'payment_provider' => $order->getPaymentProvider(),
93
  'purchased_items' => array(),
94
  );
@@ -96,12 +98,14 @@ class Nosto_Tagging_Model_Service_Order
96
  $data['order_status_code'] = $order->getOrderStatus()->getCode();
97
  $data['order_status_label'] = $order->getOrderStatus()->getLabel();
98
  }
 
 
99
  foreach ($order->getPurchasedItems() as $item) {
100
  $data['purchased_items'][] = array(
101
  'product_id' => $item->getProductId(),
102
  'quantity' => $item->getQuantity(),
103
  'name' => $item->getName(),
104
- 'unit_price' => Nosto::helper('price')->format($item->getUnitPrice()),
105
  'price_currency_code' => strtoupper($item->getCurrencyCode()),
106
  );
107
  }
@@ -116,6 +120,7 @@ class Nosto_Tagging_Model_Service_Order
116
  $data['buyer']['email'] = $order->getBuyerInfo()->getEmail();
117
  }
118
  }
 
119
  return json_encode($data);
120
  }
121
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
84
  */
85
  protected function getOrderAsJson(Nosto_Tagging_Model_Meta_Order $order)
86
  {
87
+ /** @var NostoHelperDate $dateHelper */
88
+ $dateHelper = Nosto::helper('date');
89
  $data = array(
90
  'order_number' => $order->getOrderNumber(),
91
  'external_order_ref' => $order->getExternalOrderRef(),
92
  'buyer' => array(),
93
+ 'created_at' => $dateHelper->format($order->getCreatedDate()),
94
  'payment_provider' => $order->getPaymentProvider(),
95
  'purchased_items' => array(),
96
  );
98
  $data['order_status_code'] = $order->getOrderStatus()->getCode();
99
  $data['order_status_label'] = $order->getOrderStatus()->getLabel();
100
  }
101
+ /** @var NostoHelperPrice $priceHelper */
102
+ $priceHelper = Nosto::helper('price');
103
  foreach ($order->getPurchasedItems() as $item) {
104
  $data['purchased_items'][] = array(
105
  'product_id' => $item->getProductId(),
106
  'quantity' => $item->getQuantity(),
107
  'name' => $item->getName(),
108
+ 'unit_price' => $priceHelper->format($item->getUnitPrice()),
109
  'price_currency_code' => strtoupper($item->getCurrencyCode()),
110
  );
111
  }
120
  $data['buyer']['email'] = $order->getBuyerInfo()->getEmail();
121
  }
122
  }
123
+
124
  return json_encode($data);
125
  }
126
  }
app/code/community/Nosto/Tagging/Model/System/Config/Backend/Currency/Exchange/Rate/Cron.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extension system setting backend model for saving the scheduled currency
30
+ * exchange rate frequency, e.g. turns the setting into valid cron syntax.
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Model_System_Config_Backend_Currency_Exchange_Rate_Cron extends Mage_Core_Model_Config_Data
37
+ {
38
+ /**
39
+ * Path to the cron expression.
40
+ */
41
+ const CRON_STRING_PATH = 'crontab/jobs/nostotagging_currency_exchange_rate_update/schedule/cron_expr';
42
+
43
+ /**
44
+ * Generates the cron configuration for updating exchange rates update to
45
+ * Nosto.
46
+ *
47
+ * Note that if cron is ran Hourly the hour field is not posted at all
48
+ * as the hour selector gets disabled when frequency is set to hourly
49
+ *
50
+ * @inheritdoc
51
+ */
52
+ protected function _afterSave()
53
+ {
54
+ $time = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/time/value');
55
+ $frequency = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/frequency/value');
56
+
57
+ $weekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
58
+ $monthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
59
+ $hourly = Nosto_Tagging_Model_System_Config_Source_Cron_Frequency::CRON_HOURLY;
60
+ $cronExpr = implode(
61
+ ' ',
62
+ array(
63
+ ($frequency === $hourly) ? (int)$time[0] : (int)$time[1], # Minute
64
+ ($frequency === $hourly) ? '*' : (int)$time[0], # Hour
65
+ ($frequency === $monthly) ? '1' : '*', # Day of the Month
66
+ '*', # Month of the Year
67
+ ($frequency === $weekly) ? '1' : '*', # Day of the Week
68
+ )
69
+ );
70
+
71
+ try {
72
+ /** @var Mage_Core_Model_Config_Data $model */
73
+ $model = Mage::getModel('core/config_data');
74
+ $model = $model->load(self::CRON_STRING_PATH, 'path');
75
+ $model = $model->setValue($cronExpr);
76
+ $model = $model->setPath(self::CRON_STRING_PATH);
77
+ $model->save();
78
+ } catch (Exception $e) {
79
+ throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
80
+ }
81
+ }
82
+ }
app/code/community/Nosto/Tagging/Model/System/Config/Source/Brand.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extension system setting source model for choosing which attributes should
30
+ * be added to tags
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Model_System_Config_Source_Brand
37
+ {
38
+ /**
39
+ * Returns all available product attributes
40
+ *
41
+ * @return array the options.
42
+ */
43
+ public function toOptionArray()
44
+ {
45
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
46
+ $nosto_helper = Mage::helper('nosto_tagging');
47
+ return $nosto_helper->getProductAttributeOptions();
48
+ }
49
+ }
app/code/community/Nosto/Tagging/Model/System/Config/Source/Cron/Frequency.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extends system setting source model for choosing exchange cron frequency
30
+ *
31
+ * @category Nosto
32
+ * @package Nosto_Tagging
33
+ * @author Nosto Solutions Ltd <magento@nosto.com>
34
+ */
35
+ class Nosto_Tagging_Model_System_Config_Source_Cron_Frequency extends Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency
36
+ {
37
+ const CRON_HOURLY = 'H';
38
+
39
+ /**
40
+ * Returns the frequency options
41
+ *
42
+ * @return array the options.
43
+ */
44
+ public function toOptionArray()
45
+ {
46
+ $options = parent::toOptionArray();
47
+ if (empty($options[self::CRON_HOURLY])) {
48
+ array_unshift(
49
+ $options,
50
+ array(
51
+ 'label' => Mage::helper('cron')->__('Hourly'),
52
+ 'value' => self::CRON_HOURLY,
53
+ )
54
+ );
55
+ }
56
+
57
+ return $options;
58
+ }
59
+ }
app/code/community/Nosto/Tagging/Model/System/Config/Source/Custom/Tags.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extension system setting source model for choosing which attributes should
30
+ * be added to tags
31
+ *
32
+ * @category Nosto
33
+ * @package Nosto_Tagging
34
+ * @author Nosto Solutions Ltd <magento@nosto.com>
35
+ */
36
+ class Nosto_Tagging_Model_System_Config_Source_Custom_Tags
37
+ {
38
+ /**
39
+ * Returns all available product attributes
40
+ *
41
+ * @return array the options.
42
+ */
43
+ public function toOptionArray()
44
+ {
45
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
46
+ $nosto_helper = Mage::helper('nosto_tagging');
47
+
48
+ return $nosto_helper->getProductAttributeOptions();
49
+ }
50
+ }
app/code/community/Nosto/Tagging/Model/System/Config/Source/Image.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -44,18 +44,22 @@ class Nosto_Tagging_Model_System_Config_Source_Image
44
  {
45
  $options = array();
46
 
47
- $entityTypeId = Mage::getSingleton('eav/config')
 
 
48
  ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
49
  ->getId();
50
  $collection = Mage::getResourceModel('catalog/product_attribute_collection');
51
  $collection->setEntityTypeFilter($entityTypeId);
52
  $collection->setFrontendInputTypeFilter('media_image');
 
53
  foreach ($collection as $attribute) {
54
- /* @var $attribute Mage_Eav_Model_Entity_Attribute */
55
- $options[] = array(
56
- 'value' => $attribute->getAttributeCode(),
57
- 'label' => $attribute->getFrontend()->getLabel(),
58
- );
 
59
  }
60
 
61
  return $options;
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
44
  {
45
  $options = array();
46
 
47
+ /** @var Mage_Eav_Model_Config $config */
48
+ $config = Mage::getSingleton('eav/config');
49
+ $entityTypeId = $config
50
  ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
51
  ->getId();
52
  $collection = Mage::getResourceModel('catalog/product_attribute_collection');
53
  $collection->setEntityTypeFilter($entityTypeId);
54
  $collection->setFrontendInputTypeFilter('media_image');
55
+ /* @var $attribute Mage_Eav_Model_Entity_Attribute */
56
  foreach ($collection as $attribute) {
57
+ if ($attribute instanceof Mage_Eav_Model_Entity_Attribute) {
58
+ $options[] = array(
59
+ 'value' => $attribute->getAttributeCode(),
60
+ 'label' => $attribute->getFrontend()->getLabel(),
61
+ );
62
+ }
63
  }
64
 
65
  return $options;
app/code/community/Nosto/Tagging/Model/System/Config/Source/Multi/Currency/Method.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Extension system setting source model for choosing the multi-currency method
30
+ * to use.
31
+ *
32
+ * Options are "Exchange Rate" and "Product Tagging". The former makes use of the built
33
+ * in currency exchange rates and is the preferred method. The latter is the old
34
+ * way of tagging all price variations on the product pages.
35
+ *
36
+ * @category Nosto
37
+ * @package Nosto_Tagging
38
+ * @author Nosto Solutions Ltd <magento@nosto.com>
39
+ */
40
+ class Nosto_Tagging_Model_System_Config_Source_Multi_Currency_Method
41
+ {
42
+ /**
43
+ * Returns the method options to choose from.
44
+ *
45
+ * @return array the options.
46
+ */
47
+ public function toOptionArray()
48
+ {
49
+ return array(
50
+ array(
51
+ 'value' => Nosto_Tagging_Helper_Data::MULTI_CURRENCY_DISABLED,
52
+ 'label' => 'Disabled',
53
+ ),
54
+ array(
55
+ 'value' => Nosto_Tagging_Helper_Data::MULTI_CURRENCY_METHOD_EXCHANGE_RATE,
56
+ 'label' => 'Exchange Rate',
57
+ )
58
+ );
59
+ }
60
+ }
app/code/community/Nosto/Tagging/bootstrap.php CHANGED
@@ -1,38 +1,31 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without modification,
7
- * are permitted provided that the following conditions are met:
8
- *
9
- * 1. Redistributions of source code must retain the above copyright notice,
10
- * this list of conditions and the following disclaimer.
11
- *
12
- * 2. Redistributions in binary form must reproduce the above copyright notice,
13
- * this list of conditions and the following disclaimer in the documentation
14
- * and/or other materials provided with the distribution.
15
- *
16
- * 3. Neither the name of the copyright holder nor the names of its contributors
17
- * may be used to endorse or promote products derived from this software without
18
- * specific prior written permission.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
- * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
  */
35
 
 
36
  require_once Mage::getBaseDir('lib') . '/nosto/php-sdk/src/config.inc.php';
37
 
38
  $version = (string)Mage::getConfig()->getNode('modules/Nosto_Tagging/version');
1
  <?php
2
  /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 
 
 
 
 
 
 
 
26
  */
27
 
28
+ /** @noinspection PhpIncludeInspection */
29
  require_once Mage::getBaseDir('lib') . '/nosto/php-sdk/src/config.inc.php';
30
 
31
  $version = (string)Mage::getConfig()->getNode('modules/Nosto_Tagging/version');
app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,20 +11,19 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
-
28
  require_once __DIR__ . '/../../bootstrap.php';
29
 
30
  /**
@@ -83,6 +82,7 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
83
  // If we are not under a store view, then redirect to the first
84
  // found one. Nosto is configured per store.
85
  foreach (Mage::app()->getWebsites() as $website) {
 
86
  $storeId = $website->getDefaultGroup()->getDefaultStoreId();
87
  if (!empty($storeId)) {
88
  $this->_redirect('*/*/index', array('store' => $storeId));
@@ -104,8 +104,10 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
104
 
105
  $store = $this->getSelectedStore();
106
  if ($this->getRequest()->isPost() && $store !== null) {
 
 
107
  $client = new NostoOAuthClient(
108
- Mage::helper('nosto_tagging/oauth')->getMetaData($store)
109
  );
110
  $responseBody = array(
111
  'success' => true,
@@ -132,6 +134,43 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
132
  $this->getResponse()->setBody(json_encode($responseBody));
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  /**
136
  * Creates a new Nosto account for the current scope using the Nosto API.
137
  */
@@ -146,12 +185,17 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
146
  if ($this->getRequest()->isPost() && $store !== null) {
147
  try {
148
  $email = $this->getRequest()->getPost('email');
 
149
  $meta = $accountHelper->getMetaData($store);
150
  if (Zend_Validate::is($email, 'EmailAddress')) {
151
  $meta->getOwner()->setEmail($email);
152
  }
 
 
 
153
  $account = NostoAccount::create($meta);
154
  if ($accountHelper->save($account, $store)) {
 
155
  $responseBody = array(
156
  'success' => true,
157
  'redirect_url' => $accountHelper->getIframeUrl(
@@ -188,6 +232,57 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
188
  $this->getResponse()->setBody(json_encode($responseBody));
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  /**
192
  * Removes a Nosto account from the current scope and notifies Nosto.
193
  */
@@ -233,6 +328,112 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
233
  $this->getResponse()->setBody(json_encode($responseBody));
234
  }
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  /**
237
  * Returns the currently selected store view.
238
  * If it is single store setup, then just return the default store.
@@ -259,6 +460,8 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
259
  */
260
  protected function _isAllowed()
261
  {
262
- return Mage::getSingleton('admin/session')->isAllowed('nosto');
 
 
263
  }
264
  }
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
  require_once __DIR__ . '/../../bootstrap.php';
28
 
29
  /**
82
  // If we are not under a store view, then redirect to the first
83
  // found one. Nosto is configured per store.
84
  foreach (Mage::app()->getWebsites() as $website) {
85
+ /** @var Mage_Core_Model_Website $website */
86
  $storeId = $website->getDefaultGroup()->getDefaultStoreId();
87
  if (!empty($storeId)) {
88
  $this->_redirect('*/*/index', array('store' => $storeId));
104
 
105
  $store = $this->getSelectedStore();
106
  if ($this->getRequest()->isPost() && $store !== null) {
107
+ /** @var Nosto_Tagging_Helper_Oauth $helper */
108
+ $helper = Mage::helper('nosto_tagging/oauth');
109
  $client = new NostoOAuthClient(
110
+ $helper->getMetaData($store)
111
  );
112
  $responseBody = array(
113
  'success' => true,
134
  $this->getResponse()->setBody(json_encode($responseBody));
135
  }
136
 
137
+ /**
138
+ * Redirects user to the Nosto OAuth 2 authorization server to fetch missing
139
+ * scopes (API tokens) for an account.
140
+ */
141
+ public function syncAccountAction()
142
+ {
143
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
144
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
145
+ $accountHelper = Mage::helper('nosto_tagging/account');
146
+ $store = $this->getSelectedStore();
147
+ $account = !is_null($store) ? $accountHelper->find($store) : null;
148
+ if ($this->getRequest()->isPost() && !is_null($store) && !is_null($account)) {
149
+ /** @var Nosto_Tagging_Model_Meta_Oauth $meta */
150
+ $meta = new Nosto_Tagging_Model_Meta_Oauth();
151
+ $meta->loadData($store, $account);
152
+ $client = new NostoOAuthClient($meta);
153
+ $responseBody = array(
154
+ 'success' => true,
155
+ 'redirect_url' => $client->getAuthorizationUrl(),
156
+ );
157
+ }
158
+ if (!isset($responseBody)) {
159
+ $responseBody = array(
160
+ 'success' => false,
161
+ 'redirect_url' => $accountHelper->getIframeUrl(
162
+ $store,
163
+ $account,
164
+ array(
165
+ 'message_type' => NostoMessage::TYPE_ERROR,
166
+ 'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
167
+ )
168
+ )
169
+ );
170
+ }
171
+ $this->getResponse()->setBody(json_encode($responseBody));
172
+ }
173
+
174
  /**
175
  * Creates a new Nosto account for the current scope using the Nosto API.
176
  */
185
  if ($this->getRequest()->isPost() && $store !== null) {
186
  try {
187
  $email = $this->getRequest()->getPost('email');
188
+ $details = $this->getRequest()->getPost('details');
189
  $meta = $accountHelper->getMetaData($store);
190
  if (Zend_Validate::is($email, 'EmailAddress')) {
191
  $meta->getOwner()->setEmail($email);
192
  }
193
+ if (!empty($details)) {
194
+ $meta->setDetails(json_decode($details));
195
+ }
196
  $account = NostoAccount::create($meta);
197
  if ($accountHelper->save($account, $store)) {
198
+ $accountHelper->updateCurrencyExchangeRates($account, $store);
199
  $responseBody = array(
200
  'success' => true,
201
  'redirect_url' => $accountHelper->getIframeUrl(
232
  $this->getResponse()->setBody(json_encode($responseBody));
233
  }
234
 
235
+ /**
236
+ * Resets Nosto settings inside Magento
237
+ */
238
+ public function resetAccountSettingsAction()
239
+ {
240
+ $storeId = $this->getRequest()->getParam('store');
241
+ /* @var $adminSession Mage_Admin_Model_Session */
242
+ $adminSession = Mage::getSingleton('adminhtml/session');
243
+ if (empty($storeId)) {
244
+ $adminSession->addError(
245
+ 'Nosto account could not be resetted due to a missing store'
246
+ );
247
+ $this->_redirect('*/*/index');
248
+
249
+ return;
250
+ }
251
+
252
+ /* @var Nosto_Tagging_Helper_Account $accountHelper */
253
+ $accountHelper = Mage::helper('nosto_tagging/account');
254
+ /* @var $store Mage_Core_Model_Store */
255
+ $store = Mage::getModel('core/store')->load($storeId);
256
+ if ($store instanceof Mage_Core_Model_Store === false ) {
257
+ $adminSession->addError(
258
+ 'Nosto account could not be resetted due to a invalid store id'
259
+ );
260
+ $this->_redirect('*/*/index');
261
+
262
+ return;
263
+ }
264
+ $nostoAccount = $accountHelper->find($store);
265
+ if ($nostoAccount instanceof NostoAccount == false) {
266
+ $adminSession->addError(
267
+ 'No Nosto account found for this store'
268
+ );
269
+ $this->_redirect('*/*/index');
270
+
271
+ return;
272
+ }
273
+
274
+ $accountHelper->resetAccountSettings($nostoAccount, $store);
275
+ $adminSession->addSuccess(
276
+ 'Nosto account settings successfully resetted. Please create new account or connect with exising Nosto account'
277
+ );
278
+ $this->_redirect(
279
+ 'adminhtml/nosto/index/',
280
+ array('store'=>$store->getId())
281
+ );
282
+
283
+ return;
284
+ }
285
+
286
  /**
287
  * Removes a Nosto account from the current scope and notifies Nosto.
288
  */
328
  $this->getResponse()->setBody(json_encode($responseBody));
329
  }
330
 
331
+ /**
332
+ * Ajax action for updating the currency exchange rates.
333
+ *
334
+ * Used from the extension system configuration page.
335
+ * Checks if any stores support multi currency before trying to update the
336
+ * exchange rate for each store/account.
337
+ */
338
+ public function ajaxUpdateExchangeRatesAction()
339
+ {
340
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
341
+ $responseBody = array('success' => true, 'data' => array());
342
+ /** @var Nosto_Tagging_Helper_Data $helper */
343
+ $helper = Mage::helper('nosto_tagging');
344
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
345
+ $accountHelper = Mage::helper('nosto_tagging/account');
346
+ /** @var Mage_Core_Model_Store[] $stores */
347
+ $storeId = $this->getRequest()->getParam('store');
348
+ if (!empty($storeId)) {
349
+ $stores = array(Mage::app()->getStore($storeId));
350
+ } else {
351
+ $stores = Mage::app()->getStores();
352
+ }
353
+ $countStores = count($stores);
354
+ $countStoresWithoutMultiCurrency = 0;
355
+ foreach ($stores as $store) {
356
+ if (!$helper->isMultiCurrencyMethodExchangeRate($store)) {
357
+ $countStoresWithoutMultiCurrency++;
358
+ continue;
359
+ }
360
+ $account = $accountHelper->find($store);
361
+ if (is_null($account)) {
362
+ continue;
363
+ }
364
+ if ($accountHelper->updateCurrencyExchangeRates($account, $store)) {
365
+ $responseBody['data'][] = array(
366
+ 'type' => 'success',
367
+ 'message' => $helper->__(sprintf("The exchange rates have been updated for the %s store.", $store->getName()))
368
+ );
369
+ } else {
370
+ $responseBody['data'][] = array(
371
+ 'type' => 'error',
372
+ 'message' => $helper->__(sprintf("There was an error updating the exchange rates for the %s store.", $store->getName()))
373
+ );
374
+ }
375
+ }
376
+ if ($countStores === $countStoresWithoutMultiCurrency) {
377
+ $responseBody['data'][] = array(
378
+ 'type' => 'error',
379
+ 'message' => $helper->__("Failed to find any stores in the current scope with other currencies than the base currency configured.")
380
+ );
381
+ } elseif (empty($responseBody['data'])) {
382
+ $responseBody['data'][] = array(
383
+ 'type' => 'error',
384
+ 'message' => $helper->__("Nosto has not been installed in any of the stores in the current scope. Please make sure you have installed Nosto to at least one of your stores in the scope.")
385
+ );
386
+ }
387
+ $this->getResponse()->setBody(json_encode($responseBody));
388
+ }
389
+
390
+ /**
391
+ * Ajax action for updating a Nosto account.
392
+ *
393
+ * Used from the extension system configuration page.
394
+ * Checks the scope of the update on a store/website/global level.
395
+ */
396
+ public function ajaxUpdateAccountAction()
397
+ {
398
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
399
+ $responseBody = array('success' => true, 'data' => array());
400
+ /** @var Mage_Core_Model_Store[] $stores */
401
+ $storeId = $this->getRequest()->getParam('store');
402
+ if (!empty($storeId)) {
403
+ $stores = array(Mage::app()->getStore($storeId));
404
+ } else {
405
+ $stores = Mage::app()->getStores();
406
+ }
407
+ /** @var Nosto_Tagging_Helper_Data $helper */
408
+ $helper = Mage::helper('nosto_tagging');
409
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
410
+ $accountHelper = Mage::helper('nosto_tagging/account');
411
+ foreach ($stores as $store) {
412
+ $account = $accountHelper->find($store);
413
+ if (is_null($account)) {
414
+ continue;
415
+ }
416
+ if ($accountHelper->updateAccount($account, $store)) {
417
+ $responseBody['data'][] = array(
418
+ 'type' => 'success',
419
+ 'message' => $helper->__(sprintf("The account has been updated for the %s store.", $store->getName()))
420
+ );
421
+ } else {
422
+ $responseBody['data'][] = array(
423
+ 'type' => 'error',
424
+ 'message' => $helper->__(sprintf("There was an error updating the account for the %s store.", $store->getName()))
425
+ );
426
+ }
427
+ }
428
+ if (empty($responseBody['data'])) {
429
+ $responseBody['data'][] = array(
430
+ 'type' => 'error',
431
+ 'message' => $helper->__("Nosto has not been installed in any of the stores in the current scope. Please make sure you have installed Nosto to at least one of your stores in the scope.")
432
+ );
433
+ }
434
+ $this->getResponse()->setBody(json_encode($responseBody));
435
+ }
436
+
437
  /**
438
  * Returns the currently selected store view.
439
  * If it is single store setup, then just return the default store.
460
  */
461
  protected function _isAllowed()
462
  {
463
+ /** @var Mage_Admin_Model_Session $session */
464
+ $session = Mage::getSingleton('admin/session');
465
+ return $session->isAllowed('nosto');
466
  }
467
  }
app/code/community/Nosto/Tagging/controllers/ExportController.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -54,7 +54,9 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
54
  );
55
 
56
  protected function applyIdFilters(&$collection) {
 
57
  if ($id = $this->getRequest()->getParam(self::ID)) {
 
58
  $collectionModel = $collection->getModelName();
59
  if (
60
  !empty(self::$searchableFields[$collectionModel])
@@ -98,10 +100,12 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
98
  }
99
  /** @var Nosto_Tagging_Model_Export_Collection_Order $collection */
100
  $collection = Mage::getModel('nosto_tagging/export_collection_order');
 
101
  foreach ($orders as $order) {
102
- /** @var Nosto_Tagging_Model_Meta_Order $meta */
103
- $meta = Mage::getModel('nosto_tagging/meta_order');
104
- // We don't need special items like shipping cost and discounts.
 
105
  $meta->includeSpecialItems = true;
106
  $meta->loadData($order);
107
  $collection[] = $meta;
@@ -143,8 +147,8 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
143
  $products = array();
144
  }
145
  $collection = new NostoExportProductCollection();
 
146
  foreach ($products as $product) {
147
- /** @var Mage_Catalog_Model_Product $product */
148
  /** @var Nosto_Tagging_Model_Meta_Product $meta */
149
  $meta = Mage::getModel('nosto_tagging/meta_product');
150
  $meta->loadData($product);
@@ -164,7 +168,9 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
164
  */
165
  protected function export(NostoExportCollectionInterface $collection)
166
  {
167
- $account = Mage::helper('nosto_tagging/account')->find();
 
 
168
  if ($account !== null) {
169
  $cipherText = NostoExporter::export($account, $collection);
170
  echo $cipherText;
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
54
  );
55
 
56
  protected function applyIdFilters(&$collection) {
57
+ /** @var Mage_Sales_Model_Resource_Collection_Abstract $collection */
58
  if ($id = $this->getRequest()->getParam(self::ID)) {
59
+ /** @var string $collectionModel */
60
  $collectionModel = $collection->getModelName();
61
  if (
62
  !empty(self::$searchableFields[$collectionModel])
100
  }
101
  /** @var Nosto_Tagging_Model_Export_Collection_Order $collection */
102
  $collection = Mage::getModel('nosto_tagging/export_collection_order');
103
+ /* @var Mage_Sales_Model_Order $order */
104
  foreach ($orders as $order) {
105
+ /** @var Nosto_Tagging_Helper_Class $helper */
106
+ $helper = Mage::helper('nosto_tagging/class');
107
+ /** @var Nosto_Tagging_Model_Meta_Order $order */
108
+ $meta = $helper->getOrderClass($order);
109
  $meta->includeSpecialItems = true;
110
  $meta->loadData($order);
111
  $collection[] = $meta;
147
  $products = array();
148
  }
149
  $collection = new NostoExportProductCollection();
150
+ /** @var Mage_Catalog_Model_Product $product */
151
  foreach ($products as $product) {
 
152
  /** @var Nosto_Tagging_Model_Meta_Product $meta */
153
  $meta = Mage::getModel('nosto_tagging/meta_product');
154
  $meta->loadData($product);
168
  */
169
  protected function export(NostoExportCollectionInterface $collection)
170
  {
171
+ /** @var Nosto_Tagging_Helper_Account $helper */
172
+ $helper = Mage::helper('nosto_tagging/account');
173
+ $account = $helper->find();
174
  if ($account !== null) {
175
  $cipherText = NostoExporter::export($account, $collection);
176
  echo $cipherText;
app/code/community/Nosto/Tagging/controllers/OauthController.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -67,11 +67,16 @@ class Nosto_tagging_OauthController extends Mage_Core_Controller_Front_Action
67
  $store = Mage::app()->getStore();
68
  if (($code = $request->getParam('code')) !== null) {
69
  try {
 
 
70
  $account = NostoAccount::syncFromNosto(
71
- Mage::helper('nosto_tagging/oauth')->getMetaData($store),
72
  $code
73
  );
74
- if (Mage::helper('nosto_tagging/account')->save($account, $store)) {
 
 
 
75
  $params = array(
76
  'message_type' => NostoMessage::TYPE_SUCCESS,
77
  'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
@@ -88,6 +93,7 @@ class Nosto_tagging_OauthController extends Mage_Core_Controller_Front_Action
88
  $params = array(
89
  'message_type' => NostoMessage::TYPE_ERROR,
90
  'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
 
91
  'store' => (int)$store->getId(),
92
  '_store' => Mage_Core_Model_App::ADMIN_STORE_ID,
93
  );
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
67
  $store = Mage::app()->getStore();
68
  if (($code = $request->getParam('code')) !== null) {
69
  try {
70
+ /** @var Nosto_Tagging_Helper_Oauth $oauthHelper */
71
+ $oauthHelper = Mage::helper('nosto_tagging/oauth');
72
  $account = NostoAccount::syncFromNosto(
73
+ $oauthHelper->getMetaData($store),
74
  $code
75
  );
76
+
77
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
78
+ $accountHelper = Mage::helper('nosto_tagging/account');
79
+ if ($accountHelper->save($account, $store)) {
80
  $params = array(
81
  'message_type' => NostoMessage::TYPE_SUCCESS,
82
  'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
93
  $params = array(
94
  'message_type' => NostoMessage::TYPE_ERROR,
95
  'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
96
+ 'message_text' => $e->getMessage(),
97
  'store' => (int)$store->getId(),
98
  '_store' => Mage_Core_Model_App::ADMIN_STORE_ID,
99
  );
app/code/community/Nosto/Tagging/etc/adminhtml.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Nosto
23
- * @package Nosto_Tagging
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <menu>
31
  <nosto translate="title">
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <menu>
30
  <nosto translate="title">
app/code/community/Nosto/Tagging/etc/cache.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Nosto
23
- * @package Nosto_Tagging
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <placeholders>
31
  <nosto_tagging_cart>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <placeholders>
30
  <nosto_tagging_cart>
app/code/community/Nosto/Tagging/etc/config.xml CHANGED
@@ -1,35 +1,34 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Nosto
23
- * @package Nosto_Tagging
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <modules>
31
  <Nosto_Tagging>
32
- <version>2.6.14</version>
33
  </Nosto_Tagging>
34
  </modules>
35
  <global>
@@ -40,6 +39,25 @@
40
  <class>Nosto_Tagging_Model_Resource_Setup</class>
41
  </setup>
42
  </tagging_setup>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  </resources>
44
  <blocks>
45
  <nosto_tagging>
@@ -93,6 +111,15 @@
93
  </nosto_tagging_sales_order_save_commit_after>
94
  </observers>
95
  </sales_order_save_commit_after>
 
 
 
 
 
 
 
 
 
96
  </events>
97
  </global>
98
  <adminhtml>
@@ -155,9 +182,27 @@
155
  </frontend>
156
  <default>
157
  <nosto_tagging>
 
 
 
158
  <image_options>
159
  <image_version>image</image_version>
160
  </image_options>
 
 
 
 
 
 
161
  </nosto_tagging>
162
  </default>
163
- </config>
 
 
 
 
 
 
 
 
 
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <modules>
30
  <Nosto_Tagging>
31
+ <version>2.9.0</version>
32
  </Nosto_Tagging>
33
  </modules>
34
  <global>
39
  <class>Nosto_Tagging_Model_Resource_Setup</class>
40
  </setup>
41
  </tagging_setup>
42
+ <nosto_customer_reference_setup>
43
+ <setup>
44
+ <module>Nosto_Tagging</module>
45
+ <class>Nosto_Tagging_Model_Resource_Setup</class>
46
+ </setup>
47
+ <connection>
48
+ <use>core_setup</use>
49
+ </connection>
50
+ </nosto_customer_reference_setup>
51
+ <nosto_customer_reference_write>
52
+ <connection>
53
+ <use>core_write</use>
54
+ </connection>
55
+ </nosto_customer_reference_write>
56
+ <nosto_customer_reference_read>
57
+ <connection>
58
+ <use>core_read</use>
59
+ </connection>
60
+ </nosto_customer_reference_read>
61
  </resources>
62
  <blocks>
63
  <nosto_tagging>
111
  </nosto_tagging_sales_order_save_commit_after>
112
  </observers>
113
  </sales_order_save_commit_after>
114
+ <admin_system_config_changed_section_nosto_tagging>
115
+ <observers>
116
+ <nosto_tagging_custom>
117
+ <type>singleton</type>
118
+ <class>Nosto_Tagging_Model_Observer</class>
119
+ <method>syncNostoAccount</method>
120
+ </nosto_tagging_custom>
121
+ </observers>
122
+ </admin_system_config_changed_section_nosto_tagging>
123
  </events>
124
  </global>
125
  <adminhtml>
182
  </frontend>
183
  <default>
184
  <nosto_tagging>
185
+ <general>
186
+ <use_product_api>1</use_product_api>
187
+ </general>
188
  <image_options>
189
  <image_version>image</image_version>
190
  </image_options>
191
+ <multi_currency>
192
+ <method>disabled</method>
193
+ </multi_currency>
194
+ <brand_attribute>
195
+ <tag>manufacturer</tag>
196
+ </brand_attribute>
197
  </nosto_tagging>
198
  </default>
199
+ <crontab>
200
+ <jobs>
201
+ <nostotagging_currency_exchange_rate_update>
202
+ <run>
203
+ <model>nosto_tagging/observer::scheduledCurrencyExchangeRateUpdate</model>
204
+ </run>
205
+ </nostotagging_currency_exchange_rate_update>
206
+ </jobs>
207
+ </crontab>
208
+ </config>
app/code/community/Nosto/Tagging/etc/system.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Nosto
23
- * @package Nosto_Tagging
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <sections>
31
  <nosto_tagging translate="label">
@@ -36,14 +35,54 @@
36
  <show_in_website>1</show_in_website>
37
  <show_in_store>1</show_in_store>
38
  <groups>
39
- <image_options translate="label">
40
- <label>Image Options</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <frontend_type>text</frontend_type>
42
  <sort_order>20</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  <expanded>0</expanded>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  <fields>
48
  <image_version translate="label">
49
  <label>Image Version</label>
@@ -56,6 +95,148 @@
56
  </image_version>
57
  </fields>
58
  </image_options>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </groups>
60
  </nosto_tagging>
61
  </sections>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <sections>
30
  <nosto_tagging translate="label">
35
  <show_in_website>1</show_in_website>
36
  <show_in_store>1</show_in_store>
37
  <groups>
38
+ <general>
39
+ <label>General</label>
40
+ <frontend_type>text</frontend_type>
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
+ <expanded>0</expanded>
46
+ <fields>
47
+ <use_product_api translate="label">
48
+ <label>Real-time product updates to Nosto</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <sort_order>10</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </use_product_api>
56
+ </fields>
57
+ </general>
58
+ <currency_formats translate="label">
59
+ <label>Currency formats</label>
60
  <frontend_type>text</frontend_type>
61
  <sort_order>20</sort_order>
62
  <show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
  <expanded>0</expanded>
66
+ <fields>
67
+ <currency_formats translate="label">
68
+ <label>Currency Formats</label>
69
+ <comment>Preview of the current currency formats extracted from Magento.</comment>
70
+ <frontend_type>text</frontend_type>
71
+ <frontend_model>nosto_tagging/adminhtml_system_config_currency_formats</frontend_model>
72
+ <sort_order>20</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </currency_formats>
77
+ </fields>
78
+ </currency_formats>
79
+ <image_options translate="label">
80
+ <label>Image Options</label>
81
+ <sort_order>30</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <expanded>0</expanded>
86
  <fields>
87
  <image_version translate="label">
88
  <label>Image Version</label>
95
  </image_version>
96
  </fields>
97
  </image_options>
98
+ <pretty_url translate="label">
99
+ <label>URL structure</label>
100
+ <sort_order>40</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <expanded>0</expanded>
105
+ <fields>
106
+ <in_use translate="label">
107
+ <label>Remove store parameter from URLs</label>
108
+ <comment>Set this to yes if you have configured different URLs or domains for each store or if you are only using single store view.</comment>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>adminhtml/system_config_source_yesno</source_model>
111
+ <sort_order>10</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </in_use>
116
+ </fields>
117
+ </pretty_url>
118
+ <attribute_to_tag translate="label">
119
+ <label>Attributes to tags</label>
120
+ <sort_order>50</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ <expanded>0</expanded>
125
+ <fields>
126
+ <tag1 translate="label">
127
+ <label>Product attributes for Nosto tags 1</label>
128
+ <comment>Choose attributes that will be added to tags 1 when present</comment>
129
+ <frontend_type>multiselect</frontend_type>
130
+ <source_model>nosto_tagging/system_config_source_custom_tags</source_model>
131
+ <sort_order>10</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </tag1>
136
+ <tag2 translate="label">
137
+ <label>Product attributes for Nosto tags 2</label>
138
+ <comment>Choose attributes that will be added to tags 2 when present</comment>
139
+ <frontend_type>multiselect</frontend_type>
140
+ <source_model>nosto_tagging/system_config_source_custom_tags</source_model>
141
+ <sort_order>20</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>1</show_in_store>
145
+ </tag2>
146
+ <tag3 translate="label">
147
+ <label>Product attributes for Nosto tags 3</label>
148
+ <comment>Choose attributes that will be added to tags 3 when present</comment>
149
+ <frontend_type>multiselect</frontend_type>
150
+ <source_model>nosto_tagging/system_config_source_custom_tags</source_model>
151
+ <sort_order>30</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </tag3>
156
+ </fields>
157
+ </attribute_to_tag>
158
+ <brand_attribute translate="label">
159
+ <label>Brand attribute</label>
160
+ <sort_order>60</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ <expanded>0</expanded>
165
+ <fields>
166
+ <tag translate="label">
167
+ <label>Nosto brand attribute</label>
168
+ <comment>Choose attribute that will be used as a brand attribute for Nosto product tagging</comment>
169
+ <frontend_type>select</frontend_type>
170
+ <source_model>nosto_tagging/system_config_source_brand</source_model>
171
+ <sort_order>10</sort_order>
172
+ <show_in_default>1</show_in_default>
173
+ <show_in_website>1</show_in_website>
174
+ <show_in_store>1</show_in_store>
175
+ </tag>
176
+ </fields>
177
+ </brand_attribute>
178
+ <multi_currency translate="label">
179
+ <label>Multi Currency</label>
180
+ <frontend_type>text</frontend_type>
181
+ <sort_order>70</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ <expanded>0</expanded>
186
+ <fields>
187
+ <method translate="label">
188
+ <label>Multi Currency Method</label>
189
+ <comment>Use either exchange rates or price variations for multi currency product recommendations.</comment>
190
+ <frontend_type>select</frontend_type>
191
+ <frontend_model>nosto_tagging/adminhtml_system_config_currency_method</frontend_model>
192
+ <source_model>nosto_tagging/system_config_source_multi_currency_method</source_model>
193
+ <sort_order>10</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </method>
198
+ </fields>
199
+ </multi_currency>
200
+ <scheduled_currency_exchange_rate_update translate="label">
201
+ <label>Scheduled Currency Exchange Rate Update</label>
202
+ <frontend_type>text</frontend_type>
203
+ <sort_order>80</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>0</show_in_website>
206
+ <show_in_store>0</show_in_store>
207
+ <expanded>0</expanded>
208
+ <fields>
209
+ <enabled translate="label">
210
+ <label>Enabled</label>
211
+ <frontend_type>select</frontend_type>
212
+ <source_model>adminhtml/system_config_source_yesno</source_model>
213
+ <sort_order>10</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
+ </enabled>
218
+ <time translate="label">
219
+ <label>Start Time</label>
220
+ <comment>The start time is entered in the default timezone configured for the installation.</comment>
221
+ <frontend_type>time</frontend_type>
222
+ <sort_order>20</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>0</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </time>
227
+ <frequency translate="label">
228
+ <label>Frequency</label>
229
+ <frontend_type>select</frontend_type>
230
+ <source_model>nosto_tagging/system_config_source_cron_frequency</source_model>
231
+ <backend_model>nosto_tagging/system_config_backend_currency_exchange_rate_cron</backend_model>
232
+ <frontend_model>nosto_tagging/adminhtml_system_config_currency_cronFrequency</frontend_model>
233
+ <sort_order>30</sort_order>
234
+ <show_in_default>1</show_in_default>
235
+ <show_in_website>0</show_in_website>
236
+ <show_in_store>0</show_in_store>
237
+ </frequency>
238
+ </fields>
239
+ </scheduled_currency_exchange_rate_update>
240
  </groups>
241
  </nosto_tagging>
242
  </sections>
app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-install-2.8.0.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * This install script will run only when installing the version 2.8.0 or above
30
+ *
31
+ * Adds custom attribute `nosto_customer_reference` for the Customer object
32
+ *
33
+ */
34
+
35
+ /* @var $setupHelper Nosto_Tagging_Helper_Setup */
36
+ $setupHelper = Mage::helper('nosto_tagging/setup');
37
+ $setupHelper->addNostoCustomerReferenceEav($this);
app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-upgrade-2.8.0-2.8.2.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * This upgrade script will run when upgrading from 2.8.0 or 2.8.1 to 2.8.2
30
+ *
31
+ * Changes the attribute `nosto_customer_reference` frontend type to be text
32
+ *
33
+ */
34
+
35
+ /* @var $setupHelper Nosto_Tagging_Helper_Setup */
36
+ $setupHelper = Mage::helper('nosto_tagging/setup');
37
+ $setupHelper->alterCustomerReferenceInputType($this);
app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-install-1.2.0.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
@@ -37,47 +37,49 @@
37
  $installer = $this;
38
  $installer->startSetup();
39
 
40
- $table = $installer
41
- ->getConnection()
42
- ->newTable($installer->getTable('nosto_tagging/customer'))
43
- ->addColumn(
44
- 'customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
45
- 'unsigned' => true,
46
- 'nullable' => false,
47
- 'primary' => true,
48
- 'identity' => true
49
- )
50
- )
51
- ->addColumn(
52
- 'quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
53
- 'unsigned' => true,
54
- 'nullable' => false
55
  )
56
- )
57
- ->addColumn(
58
- 'nosto_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
59
- 'nullable' => false
 
60
  )
61
- )
62
- ->addColumn(
63
- 'created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
64
- 'nullable' => false
65
  )
66
- )
67
- ->addColumn(
68
- 'updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
69
- 'nullable' => true
70
  )
71
- )
72
- ->addIndex(
73
- $installer->getIdxName(
74
- 'nosto_tagging/customer', array('quote_id', 'nosto_id'),
75
- Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
76
- ),
77
- array('quote_id', 'nosto_id'), array(
78
- 'type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
79
  )
80
- );
81
- $installer->getConnection()->createTable($table);
 
 
 
 
 
 
 
 
 
82
 
83
  $installer->endSetup();
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
37
  $installer = $this;
38
  $installer->startSetup();
39
 
40
+ if (!$installer->getConnection()->isTableExists($installer->getTable('nosto_tagging/customer'))) {
41
+ $table = $installer
42
+ ->getConnection()
43
+ ->newTable($installer->getTable('nosto_tagging/customer'))
44
+ ->addColumn(
45
+ 'customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
46
+ 'unsigned' => true,
47
+ 'nullable' => false,
48
+ 'primary' => true,
49
+ 'identity' => true
50
+ )
 
 
 
 
51
  )
52
+ ->addColumn(
53
+ 'quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
54
+ 'unsigned' => true,
55
+ 'nullable' => false
56
+ )
57
  )
58
+ ->addColumn(
59
+ 'nosto_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
60
+ 'nullable' => false
61
+ )
62
  )
63
+ ->addColumn(
64
+ 'created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
65
+ 'nullable' => false
66
+ )
67
  )
68
+ ->addColumn(
69
+ 'updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
70
+ 'nullable' => true
71
+ )
 
 
 
 
72
  )
73
+ ->addIndex(
74
+ $installer->getIdxName(
75
+ 'nosto_tagging/customer', array('quote_id', 'nosto_id'),
76
+ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
77
+ ),
78
+ array('quote_id', 'nosto_id'), array(
79
+ 'type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
80
+ )
81
+ );
82
+ $installer->getConnection()->createTable($table);
83
+ }
84
 
85
  $installer->endSetup();
app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-upgrade-1.1.7-1.2.0.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
 
app/design/adminhtml/default/default/layout/nostotagging.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category design
23
- * @package adminhtml_default_default
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <!-- Nosto main menu link page -->
31
  <adminhtml_nosto_index>
@@ -52,4 +51,9 @@
52
  </block>
53
  </reference>
54
  </adminhtml_nosto_index>
 
 
 
 
 
55
  </config>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <!-- Nosto main menu link page -->
30
  <adminhtml_nosto_index>
51
  </block>
52
  </reference>
53
  </adminhtml_nosto_index>
54
+ <default>
55
+ <reference name="notifications">
56
+ <block type="nosto_tagging/adminhtml_notifications" name="nosto.notifications" template="nostotagging/notifications.phtml"/>
57
+ </reference>
58
+ </default>
59
  </config>
app/design/adminhtml/default/default/template/nostotagging/iframe.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package adminhtml_default_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
@@ -54,6 +54,7 @@ $params = array('store' => $this->getSelectedStore()->getId(), 'isAjax' => true)
54
  urls: {
55
  createAccount: "<?php echo $this->getUrl('*/*/createAccount', $params); ?>",
56
  connectAccount: "<?php echo $this->getUrl('*/*/connectAccount', $params); ?>",
 
57
  deleteAccount: "<?php echo $this->getUrl('*/*/removeAccount', $params); ?>"
58
  }
59
  };
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
54
  urls: {
55
  createAccount: "<?php echo $this->getUrl('*/*/createAccount', $params); ?>",
56
  connectAccount: "<?php echo $this->getUrl('*/*/connectAccount', $params); ?>",
57
+ syncAccount: "<?php echo $this->getUrl('*/*/syncAccount', $params); ?>",
58
  deleteAccount: "<?php echo $this->getUrl('*/*/removeAccount', $params); ?>"
59
  }
60
  };
app/design/adminhtml/default/default/template/nostotagging/notifications.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Nosto
23
+ * @package Nosto_Tagging
24
+ * @author Nosto Solutions Ltd <magento@nosto.com>
25
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /* @var $this Nosto_Tagging_Block_Adminhtml_Notifications */
30
+ ?>
31
+
32
+ <?php if (!$this->allAccountsOK()) : ?>
33
+ <div class="notification-global"><?php echo $this->helper('index')->__('One or more of your store views is using Nosto and has multi-currency enabled but does not have the necessary permissions granted. Check the Nosto accounts in each of your store views to grant the necessary permissions or disable multi-currency. Permissions can be re-granted by simply removing the Nosto account for that store view and connecting with Nosto again.') ?></div>
34
+ <?php elseif (!$this->cronEnabledIfNeeded()) : ?>
35
+ <div class="notification-global"><?php echo $this->helper('index')->__('One or more of your store views is using Nosto and has multi-currency enabled but does not have scheduled exchange-rates cron jobs enabled. Click here to go to the <a href="%s">Nosto Configuration</a> to enable them.', $this->getConfigureUrl()) ?></div>
36
+ <?php endif; ?>
37
+ <?php
38
+ $invalidAccountDomains = $this->getInvalidAccountDomains();
39
+ if (!empty($invalidAccountDomains) && is_array($invalidAccountDomains)) :
40
+ ?>
41
+ <?php foreach ($invalidAccountDomains as $invalidAccountDomain) : ?>
42
+ <div class="notification-global"><?php
43
+ echo $this->helper('index')->__(
44
+ sprintf(
45
+ 'It looks like you\'ve created Nosto account (%s) for <strong class="label">%s</strong> and currently store\'s (%s) front page is <strong class="label">%s</strong>. It is not possible to share Nosto accounts across multiple domains. Please reset the Nosto settings, and create a new Nosto account, or connect to an existing account.',
46
+ $invalidAccountDomain['nostoAccount'],
47
+ $invalidAccountDomain['savedUrl'],
48
+ $invalidAccountDomain['storeName'],
49
+ $invalidAccountDomain['currentUrl']
50
+ )
51
+ );
52
+ ?>
53
+ <a href="<?php echo $invalidAccountDomain['actionUrl']; ?>">Reset Nosto settings</a>
54
+ </div>
55
+ <?php endforeach; ?>
56
+ <?php endif; ?>
app/design/adminhtml/default/default/template/nostotagging/system/config/currency/cronFrequency.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+
29
+ <?php
30
+ /**
31
+ * @var $this Nosto_Tagging_Block_Adminhtml_System_Config_Currency_CronFrequency
32
+ */
33
+ ?>
34
+
35
+ <select id="<?php echo $this->getSelectId(); ?>" name="<?php echo $this->getSelectName(); ?>" class="select" onchange="nostoHandleCronSettings()">
36
+ <?php foreach ($this->getOptions() as $idx => $option): ?>
37
+ <?php
38
+ $currentValue = $this->getCurrentValue();
39
+ if ($option['value'] == $currentValue) {
40
+ $selected = 'selected';
41
+ } else {
42
+ $selected = '';
43
+ }
44
+ ?>
45
+ <option value="<?php echo $option['value']; ?>" <?php echo $selected; ?>><?php echo $option['label']; ?></option>
46
+ <?php endforeach; ?>
47
+ </select>
48
+ <!-- Form handler for exchange rates -->
49
+ <script type="text/javascript">
50
+ function nostoHandleCronSettings() {
51
+ var frequencyValue,hourField,frequencyField;
52
+ var hourField = document.getElementsByName("<?php echo $this->getHourSelectName(); ?>")[0];
53
+ var frequencyField = document.getElementById("<?php echo $this->getSelectId(); ?>");
54
+ if (frequencyField && hourField) {
55
+ var frequencyValue = frequencyField.value;
56
+ if (frequencyValue == 'H') {
57
+ var option = document.createElement("option");
58
+ option.value = '*';
59
+ option.text = '*';
60
+ option.selected = 'selected';
61
+ hourField.appendChild(option);
62
+ hourField.setAttribute("disabled", "disabled");
63
+ } else {
64
+ for (var i = 0; i < hourField.length; i++) {
65
+ if (hourField.options[i].value == '*') {
66
+ hourField.remove(i);
67
+ }
68
+ }
69
+ hourField.removeAttribute("disabled");
70
+ }
71
+ }
72
+
73
+ return false;
74
+ }
75
+ (function(){
76
+ nostoHandleCronSettings();
77
+ })();
78
+ </script>
app/design/adminhtml/default/default/template/nostotagging/system/config/currency/formats.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+
29
+ <?php
30
+ /**
31
+ * @var $this Nosto_Tagging_Block_Adminhtml_System_Config_Currency_Formats
32
+ * @var Zend_Currency[] $formats
33
+ */
34
+ ?>
35
+
36
+ <?php foreach ($this->getCurrencyFormats() as $storeName => $formats): ?>
37
+ <fieldset>
38
+ <legend style="visibility: visible; width: auto; height: auto; line-height: normal">
39
+ <?php echo $this->escapeHtml($storeName); ?>
40
+ </legend>
41
+ <ul>
42
+ <?php foreach ($formats as $format): ?>
43
+ <li><?php echo $format->toCurrency('1234.56'); ?></li>
44
+ <?php endforeach; ?>
45
+ </ul>
46
+ </fieldset>
47
+ <?php endforeach; ?>
app/design/adminhtml/default/default/template/nostotagging/wizard.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,17 +11,17 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package adminhtml_default_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
app/design/frontend/base/default/layout/nostotagging.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category design
23
- * @package frontend_base_default
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <layout version="1.0.0">
30
  <!-- -->
31
  <!-- Adds Nosto tagging meta-data to site -->
@@ -38,9 +37,14 @@
38
  <block type="nosto_tagging/meta" name="nosto.meta" template="nostotagging/meta.phtml" before="-"/>
39
  </reference>
40
 
 
 
 
 
 
41
  <!-- Adds Nosto embed script to head -->
42
  <reference name="head">
43
- <block type="nosto_tagging/embed" name="nosto.embed" template="nostotagging/embed.phtml"/>
44
  </reference>
45
 
46
  <!-- Adds Nosto `add-to-cart` script to head -->
@@ -58,6 +62,10 @@
58
  <block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
59
  </reference>
60
 
 
 
 
 
61
  </default>
62
 
63
  <!-- Tag category -->
@@ -87,6 +95,12 @@
87
  </reference>
88
  </checkout_onepage_success>
89
 
 
 
 
 
 
 
90
  <!-- -->
91
  <!-- Adds Nosto elements to site -->
92
  <!-- -->
@@ -142,6 +156,13 @@
142
  <cms_index_index>
143
  <!-- Add 4 content placeholders after the home page content -->
144
  <reference name="content">
 
 
 
 
 
 
 
145
  <block type="nosto_tagging/element" name="nosto.page.home1" after="-"
146
  template="nostotagging/element.phtml">
147
  <action method="setData">
@@ -177,6 +198,13 @@
177
  <checkout_cart_index>
178
  <!-- Adds 3 content placeholders after the cart content -->
179
  <reference name="content">
 
 
 
 
 
 
 
180
  <block type="nosto_tagging/element" name="nosto.page.cart1" after="checkout.cart"
181
  template="nostotagging/element.phtml">
182
  <action method="setData">
@@ -205,6 +233,13 @@
205
  <catalog_product_view>
206
  <!-- Adds 3 content placeholders after the product info -->
207
  <reference name="content">
 
 
 
 
 
 
 
208
  <block type="nosto_tagging/element" name="nosto.page.product1" after="product.info"
209
  template="nostotagging/element.phtml">
210
  <action method="setData">
@@ -239,6 +274,13 @@
239
  <nosto_tagging_catalog_category>
240
  <!-- Adds 2 content placeholders; 1 before and 1 after the products -->
241
  <reference name="content">
 
 
 
 
 
 
 
242
  <block type="nosto_tagging/element" name="nosto.page.category1" before="category.products"
243
  template="nostotagging/element.phtml">
244
  <action method="setData">
@@ -260,6 +302,13 @@
260
  <catalogsearch_result_index>
261
  <!-- Adds 2 content placeholders; 1 before and 1 after the search result -->
262
  <reference name="content">
 
 
 
 
 
 
 
263
  <block type="nosto_tagging/element" name="nosto.page.search1" before="search.result"
264
  template="nostotagging/element.phtml">
265
  <action method="setData">
@@ -283,6 +332,13 @@
283
  <!-- 404 Not found page -->
284
  <cms_index_noroute>
285
  <reference name="content">
 
 
 
 
 
 
 
286
  <block type="nosto_tagging/element" name="nosto.page.notfound1" after="-"
287
  template="nostotagging/element.phtml">
288
  <action method="setData">
@@ -310,6 +366,13 @@
310
  <!-- Order confirmation page -->
311
  <checkout_onepage_success>
312
  <reference name="content">
 
 
 
 
 
 
 
313
  <block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="-"
314
  template="nostotagging/element.phtml">
315
  <action method="setData">
@@ -326,4 +389,31 @@
326
  </block>
327
  </reference>
328
  </checkout_onepage_success>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  </layout>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <layout version="1.0.0">
29
  <!-- -->
30
  <!-- Adds Nosto tagging meta-data to site -->
37
  <block type="nosto_tagging/meta" name="nosto.meta" template="nostotagging/meta.phtml" before="-"/>
38
  </reference>
39
 
40
+ <!-- Adds Nosto js stub to head -->
41
+ <reference name="head">
42
+ <block type="core/template" name="nosto.js.stub" template="nostotagging/jsstub.phtml"/>
43
+ </reference>
44
+
45
  <!-- Adds Nosto embed script to head -->
46
  <reference name="head">
47
+ <block type="nosto_tagging/embed" name="nosto.embed" template="nostotagging/embed.phtml" after="nosto.js.stub"/>
48
  </reference>
49
 
50
  <!-- Adds Nosto `add-to-cart` script to head -->
62
  <block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
63
  </reference>
64
 
65
+ <!-- Tag currency variation -->
66
+ <reference name="after_body_start">
67
+ <block type="nosto_tagging/variation" name="nosto.variation" template="nostotagging/variation.phtml"/>
68
+ </reference>
69
  </default>
70
 
71
  <!-- Tag category -->
95
  </reference>
96
  </checkout_onepage_success>
97
 
98
+ <checkout_klarna_success>
99
+ <reference name="after_body_start">
100
+ <block type="nosto_tagging/order_vaimo_klarna_checkout" name="nosto.order.vaimo.klarna" template="nostotagging/order.phtml"/>
101
+ </reference>
102
+ </checkout_klarna_success>
103
+
104
  <!-- -->
105
  <!-- Adds Nosto elements to site -->
106
  <!-- -->
156
  <cms_index_index>
157
  <!-- Add 4 content placeholders after the home page content -->
158
  <reference name="content">
159
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.front" after="-"
160
+ template="nostotagging/pagetype.phtml">
161
+ <action method="setData">
162
+ <name>page_type</name>
163
+ <value>front</value>
164
+ </action>
165
+ </block>
166
  <block type="nosto_tagging/element" name="nosto.page.home1" after="-"
167
  template="nostotagging/element.phtml">
168
  <action method="setData">
198
  <checkout_cart_index>
199
  <!-- Adds 3 content placeholders after the cart content -->
200
  <reference name="content">
201
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.cart" after="-"
202
+ template="nostotagging/pagetype.phtml">
203
+ <action method="setData">
204
+ <name>page_type</name>
205
+ <value>cart</value>
206
+ </action>
207
+ </block>
208
  <block type="nosto_tagging/element" name="nosto.page.cart1" after="checkout.cart"
209
  template="nostotagging/element.phtml">
210
  <action method="setData">
233
  <catalog_product_view>
234
  <!-- Adds 3 content placeholders after the product info -->
235
  <reference name="content">
236
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.product" after="-"
237
+ template="nostotagging/pagetype.phtml">
238
+ <action method="setData">
239
+ <name>page_type</name>
240
+ <value>product</value>
241
+ </action>
242
+ </block>
243
  <block type="nosto_tagging/element" name="nosto.page.product1" after="product.info"
244
  template="nostotagging/element.phtml">
245
  <action method="setData">
274
  <nosto_tagging_catalog_category>
275
  <!-- Adds 2 content placeholders; 1 before and 1 after the products -->
276
  <reference name="content">
277
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.category" after="-"
278
+ template="nostotagging/pagetype.phtml">
279
+ <action method="setData">
280
+ <name>page_type</name>
281
+ <value>category</value>
282
+ </action>
283
+ </block>
284
  <block type="nosto_tagging/element" name="nosto.page.category1" before="category.products"
285
  template="nostotagging/element.phtml">
286
  <action method="setData">
302
  <catalogsearch_result_index>
303
  <!-- Adds 2 content placeholders; 1 before and 1 after the search result -->
304
  <reference name="content">
305
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.search" after="-"
306
+ template="nostotagging/pagetype.phtml">
307
+ <action method="setData">
308
+ <name>page_type</name>
309
+ <value>search</value>
310
+ </action>
311
+ </block>
312
  <block type="nosto_tagging/element" name="nosto.page.search1" before="search.result"
313
  template="nostotagging/element.phtml">
314
  <action method="setData">
332
  <!-- 404 Not found page -->
333
  <cms_index_noroute>
334
  <reference name="content">
335
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.notfound" after="-"
336
+ template="nostotagging/pagetype.phtml">
337
+ <action method="setData">
338
+ <name>page_type</name>
339
+ <value>notfound</value>
340
+ </action>
341
+ </block>
342
  <block type="nosto_tagging/element" name="nosto.page.notfound1" after="-"
343
  template="nostotagging/element.phtml">
344
  <action method="setData">
366
  <!-- Order confirmation page -->
367
  <checkout_onepage_success>
368
  <reference name="content">
369
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.order" after="-"
370
+ template="nostotagging/pagetype.phtml">
371
+ <action method="setData">
372
+ <name>page_type</name>
373
+ <value>order</value>
374
+ </action>
375
+ </block>
376
  <block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="-"
377
  template="nostotagging/element.phtml">
378
  <action method="setData">
389
  </block>
390
  </reference>
391
  </checkout_onepage_success>
392
+
393
+ <!-- Klarna Order confirmation page -->
394
+ <checkout_klarna_success>
395
+ <reference name="content">
396
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.order" after="-"
397
+ template="nostotagging/pagetype.phtml">
398
+ <action method="setData">
399
+ <name>page_type</name>
400
+ <value>order</value>
401
+ </action>
402
+ </block>
403
+ <block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="checkout"
404
+ template="nostotagging/element.phtml">
405
+ <action method="setData">
406
+ <name>div_id</name>
407
+ <value>thankyou-nosto-1</value>
408
+ </action>
409
+ </block>
410
+ <block type="nosto_tagging/element" name="nosto.page.orderconfirmation2" after="nosto.page.orderconfirmation1"
411
+ template="nostotagging/element.phtml">
412
+ <action method="setData">
413
+ <name>div_id</name>
414
+ <value>thankyou-nosto-2</value>
415
+ </action>
416
+ </block>
417
+ </reference>
418
+ </checkout_klarna_success>
419
  </layout>
app/design/frontend/base/default/template/nostotagging/addtocart.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,31 +11,39 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  $formAction = Mage::getUrl('checkout/cart/add');
31
- $formKey = Mage::getSingleton('core/session')->getFormKey();
 
 
32
  ?>
33
  <!-- Nosto `add-to-cart` Script -->
34
  <script type="text/javascript">
35
  if (typeof Nosto === "undefined") {
36
- var Nosto = {};
37
  }
38
- Nosto.addProductToCart = function (productId) {
 
 
 
 
 
 
 
 
39
  var form = document.createElement("form");
40
  form.setAttribute("method", "post");
41
  form.setAttribute("action", "<?php echo $formAction; ?>");
@@ -45,8 +53,8 @@ $formKey = Mage::getSingleton('core/session')->getFormKey();
45
  "form_key": "<?php echo $formKey; ?>"
46
  };
47
 
48
- for(var key in hiddenFields) {
49
- if(hiddenFields.hasOwnProperty(key)) {
50
  var hiddenField = document.createElement("input");
51
  hiddenField.setAttribute("type", "hidden");
52
  hiddenField.setAttribute("name", key);
@@ -58,4 +66,21 @@ $formKey = Mage::getSingleton('core/session')->getFormKey();
58
  document.body.appendChild(form);
59
  form.submit();
60
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </script>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  $formAction = Mage::getUrl('checkout/cart/add');
29
+ /** @var Mage_Core_Model_Session $session */
30
+ $session = Mage::getSingleton('core/session');
31
+ $formKey = $session->getFormKey();
32
  ?>
33
  <!-- Nosto `add-to-cart` Script -->
34
  <script type="text/javascript">
35
  if (typeof Nosto === "undefined") {
36
+ var Nosto = {};
37
  }
38
+ Nosto.addProductToCart = function (productId, element) {
39
+ if (typeof nostojs !== 'undefined' && typeof element == 'object') {
40
+ var slotId = Nosto.resolveContextSlotId(element);
41
+ if (slotId) {
42
+ nostojs(function (api) {
43
+ api.recommendedProductAddedToCart(productId, slotId);
44
+ });
45
+ }
46
+ }
47
  var form = document.createElement("form");
48
  form.setAttribute("method", "post");
49
  form.setAttribute("action", "<?php echo $formAction; ?>");
53
  "form_key": "<?php echo $formKey; ?>"
54
  };
55
 
56
+ for (var key in hiddenFields) {
57
+ if (hiddenFields.hasOwnProperty(key)) {
58
  var hiddenField = document.createElement("input");
59
  hiddenField.setAttribute("type", "hidden");
60
  hiddenField.setAttribute("name", key);
66
  document.body.appendChild(form);
67
  form.submit();
68
  };
69
+ Nosto.resolveContextSlotId = function (element) {
70
+ var m = 20;
71
+ var n = 0;
72
+ var e = element;
73
+ while (typeof e.parentElement !== "undefined" && e.parentElement) {
74
+ ++n;
75
+ e = e.parentElement;
76
+ if (e.getAttribute('class') == 'nosto_element' && e.getAttribute('id')) {
77
+ return e.getAttribute('id');
78
+ }
79
+ if (n >= m) {
80
+ return false;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+
86
  </script>
app/design/frontend/base/default/template/nostotagging/cart.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Cart
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
@@ -40,7 +38,8 @@ $nostoPriceHelper = Mage::helper('nosto_tagging/price');
40
 
41
  <!-- Nosto Cart Tagging -->
42
  <div class="nosto_cart" style="display:none">
43
- <?php foreach ($items as $item): ?>
 
44
  <div class="line_item">
45
  <span class="product_id"><?php echo $this->getProductId($item); ?></span>
46
  <span class="quantity"><?php echo $item->getQty(); ?></span>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Cart
30
  * @var $nostoHelper Nosto_Tagging_Helper_Data
38
 
39
  <!-- Nosto Cart Tagging -->
40
  <div class="nosto_cart" style="display:none">
41
+ <span class="hcid"><?php echo $this->getVisitorChecksum(); ?></span>
42
+ <?php /** @var Mage_Sales_Model_Quote_Item $item */ foreach ($items as $item): ?>
43
  <div class="line_item">
44
  <span class="product_id"><?php echo $this->getProductId($item); ?></span>
45
  <span class="quantity"><?php echo $item->getQty(); ?></span>
app/design/frontend/base/default/template/nostotagging/category.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Category
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Category
30
  * @var $nostoHelper Nosto_Tagging_Helper_Data
app/design/frontend/base/default/template/nostotagging/customer.phtml CHANGED
@@ -18,15 +18,13 @@
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Customer
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
@@ -37,7 +35,9 @@ $nostoHelper = Mage::helper('nosto_tagging');
37
 
38
  <!-- Nosto Customer Tagging -->
39
  <div class="nosto_customer" style="display:none">
40
- <span class="first_name"><?php echo $nostoHelper->escapeHtml($customer->getFirstname()); ?></span>
41
- <span class="last_name"><?php echo $nostoHelper->escapeHtml($customer->getLastname()); ?></span>
42
- <span class="email"><?php echo $nostoHelper->escapeHtml($customer->getEmail()); ?></span>
 
 
43
  </div>
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Customer
30
  * @var $nostoHelper Nosto_Tagging_Helper_Data
35
 
36
  <!-- Nosto Customer Tagging -->
37
  <div class="nosto_customer" style="display:none">
38
+ <span class="hcid"><?php echo $this->getVisitorChecksum(); ?></span>
39
+ <span class="first_name"><?php /** @noinspection PhpUndefinedMethodInspection */ echo $nostoHelper->escapeHtml($customer->getFirstname()); ?></span>
40
+ <span class="last_name"><?php /** @noinspection PhpUndefinedMethodInspection */ echo $nostoHelper->escapeHtml($customer->getLastname()); ?></span>
41
+ <span class="email"><?php /** @noinspection PhpUndefinedMethodInspection */ echo $nostoHelper->escapeHtml($customer->getEmail()); ?></span>
42
+ <span class="customer_reference"><?php echo $nostoHelper->escapeHtml($this->getCustomerReference()); ?></span>
43
  </div>
app/design/frontend/base/default/template/nostotagging/element.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Element
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Element
30
  * @var $nostoHelper Nosto_Tagging_Helper_Data
app/design/frontend/base/default/template/nostotagging/embed.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,30 +11,25 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Embed
32
  */
33
  ?>
34
  <!-- Nosto Tagging Script -->
35
- <script type="text/javascript">
36
- //<![CDATA[
37
- (function(){function a(a){var b,c,d=window.document.createElement("iframe");d.src="javascript:false",(d.frameElement||d).style.cssText="width: 0; height: 0; border: 0";var e=window.document.createElement("div");e.style.display="none";var f=window.document.createElement("div");e.appendChild(f),window.document.body.insertBefore(e,window.document.body.firstChild),f.appendChild(d);try{c=d.contentWindow.document}catch(g){b=document.domain,d.src="javascript:var d=document.open();d.domain='"+b+"';void(0);",c=d.contentWindow.document}return c.open()._l=function(){b&&(this.domain=b);var c=this.createElement("scr".concat("ipt"));c.src=a,this.body.appendChild(c)},c.write("<bo".concat('dy onload="document._l();">')),c.close(),d}var b="nostojs";window[b]=window[b]||function(a){(window[b].q=window[b].q||[]).push(a)},window[b].l=new Date;var c=function(d,e){if(!document.body)return setTimeout(function(){c(d,e)},30);e=e||{},window[b].o=e;var f=document.location.protocol,g=["https:"===f?f:"http:","//",e.host||"connect.nosto.com",e.path||"/include/",d].join("");a(g)};window[b].init=c})();
38
- nostojs.init('<?php echo $this->getAccountName(); ?>', { host: '<?php echo $this->getServerAddress() ?>'});
39
- //]]>
40
- </script>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Embed
30
  */
31
  ?>
32
  <!-- Nosto Tagging Script -->
33
+ <?php if ($this->getServerAddress() && $this->getAccountName()): ?>
34
+ <script type="text/javascript" src="//<?php echo $this->getServerAddress() ?>/include/<?php echo $this->getAccountName(); ?>" async></script>
35
+ <?php endif; ?>
 
 
 
app/design/frontend/base/default/template/nostotagging/jsstub.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * @var $this Mage_Core_Block_Template
30
+ */
31
+ ?>
32
+ <!-- Nosto Javascript Stub -->
33
+ <script type="text/javascript">
34
+ (function(){var name="nostojs";window[name]=window[name]||function(cb){(window[name].q=window[name].q||[]).push(cb);};})();
35
+ </script>
app/design/frontend/base/default/template/nostotagging/meta.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Meta
32
  * @var $helper Nosto_Tagging_Helper_Data
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Meta
30
  * @var $helper Nosto_Tagging_Helper_Data
app/design/frontend/base/default/template/nostotagging/order.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Order
32
  * @var $helper Nosto_Tagging_Helper_Data
@@ -40,6 +38,7 @@ $priceHelper = Mage::helper('nosto_tagging/price');
40
  <?php if ($order->getPurchasedItems() !== array()): ?>
41
  <!-- Nosto Order Tagging -->
42
  <div class="nosto_purchase_order" style="display:none">
 
43
  <span class="order_number"><?php echo $order->getOrderNumber(); ?></span>
44
  <span class="external_order_ref"><?php echo $helper->escapeHtml($order->getExternalOrderRef()); ?></span>
45
  <?php if ($order->getOrderStatus()): ?>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Order
30
  * @var $helper Nosto_Tagging_Helper_Data
38
  <?php if ($order->getPurchasedItems() !== array()): ?>
39
  <!-- Nosto Order Tagging -->
40
  <div class="nosto_purchase_order" style="display:none">
41
+ <span class="hcid"><?php echo $this->getVisitorChecksum(); ?></span>
42
  <span class="order_number"><?php echo $order->getOrderNumber(); ?></span>
43
  <span class="external_order_ref"><?php echo $helper->escapeHtml($order->getExternalOrderRef()); ?></span>
44
  <?php if ($order->getOrderStatus()): ?>
app/design/frontend/base/default/template/nostotagging/{category/view.phtml → pagetype.phtml} RENAMED
@@ -18,21 +18,20 @@
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
28
 
29
  <?php
30
  /**
31
- * @var $this Mage_Catalog_Block_Category_View
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
33
  */
34
- $category = $this->getCurrentCategory();
35
  $nostoHelper = Mage::helper('nosto_tagging');
36
  ?>
37
 
38
- <div class="nosto_element" id="<?php echo $nostoHelper->escapeHtml($category->getNostoId()); ?>"></div>
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
  ?>
28
 
29
  <?php
30
  /**
31
+ * @var $this Nosto_Tagging_Block_Pagetype
32
  * @var $nostoHelper Nosto_Tagging_Helper_Data
33
  */
 
34
  $nostoHelper = Mage::helper('nosto_tagging');
35
  ?>
36
 
37
+ <div class="nosto_page_type" style="display:none"><?php echo $nostoHelper->escapeHtml($this->getPageTypeName()); ?></div>
app/design/frontend/base/default/template/nostotagging/product.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package frontend_base_default
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Product
32
  * @var $helper Nosto_Tagging_Helper_Data
@@ -65,8 +63,8 @@ $dateHelper = Mage::helper('nosto_tagging/date');
65
  <span class="<?php echo $helper->quoteEscape($type); ?>"><?php echo $helper->escapeHtml($tag); ?></span>
66
  <?php endforeach; ?>
67
  <?php endforeach; ?>
68
- <?php if ($product->getDatePublished()): ?>
69
- <span class="date_published"><?php echo $dateHelper->getFormattedDate($product->getDatePublished()); ?></span>
70
  <?php endif; ?>
71
  </div>
72
  <?php if ($this->getCurrentCategory()): ?>
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Product
30
  * @var $helper Nosto_Tagging_Helper_Data
63
  <span class="<?php echo $helper->quoteEscape($type); ?>"><?php echo $helper->escapeHtml($tag); ?></span>
64
  <?php endforeach; ?>
65
  <?php endforeach; ?>
66
+ <?php if (!$helper->multiCurrencyDisabled()): ?>
67
+ <span class="variation_id"><?php echo $helper->escapeHtml($product->getVariationId()); ?></span>
68
  <?php endif; ?>
69
  </div>
70
  <?php if ($this->getCurrentCategory()): ?>
app/design/frontend/base/default/template/nostotagging/searchterm.phtml CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Magento
4
- *
5
  * NOTICE OF LICENSE
6
- *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
@@ -11,22 +11,20 @@
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
  * DISCLAIMER
16
- *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
  * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
27
- ?>
28
 
29
- <?php
30
  /**
31
  * @var $this Nosto_Tagging_Block_Searchterm
32
  * @var $helper Nosto_Tagging_Helper_Data
1
  <?php
2
  /**
3
  * Magento
4
+ *
5
  * NOTICE OF LICENSE
6
+ *
7
  * This source file is subject to the Open Software License (OSL 3.0)
8
  * that is bundled with this package in the file LICENSE.txt.
9
  * It is also available through the world-wide-web at this URL:
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
  * DISCLAIMER
16
+ *
17
  * Do not edit or add to this file if you wish to upgrade Magento to newer
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
  * @category Nosto
22
  * @package Nosto_Tagging
23
  * @author Nosto Solutions Ltd <magento@nosto.com>
24
  * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
  */
 
27
 
 
28
  /**
29
  * @var $this Nosto_Tagging_Block_Searchterm
30
  * @var $helper Nosto_Tagging_Helper_Data
app/design/frontend/base/default/template/nostotagging/variation.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Nosto
22
+ * @package Nosto_Tagging
23
+ * @author Nosto Solutions Ltd <magento@nosto.com>
24
+ * @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * @var $this Nosto_Tagging_Block_Variation
30
+ * @var $helper Nosto_Tagging_Helper_Data
31
+ */
32
+ $helper = Mage::helper('nosto_tagging');
33
+ ?>
34
+ <?php if (!$helper->multiCurrencyDisabled()): ?>
35
+ <!-- Nosto Price Variation Tagging -->
36
+ <div class="nosto_variation" style="display:none"><?php echo $helper->escapeHtml($this->getVariationId()); ?></div>
37
+ <?php endif; ?>
app/etc/modules/Nosto_Tagging.xml CHANGED
@@ -1,31 +1,30 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Nosto
23
- * @package Nosto_Tagging
24
- * @author Nosto Solutions Ltd <magento@nosto.com>
25
- * @copyright Copyright (c) 2013-2015 Nosto Solutions Ltd (http://www.nosto.com)
26
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
- */
28
- -->
29
  <config>
30
  <modules>
31
  <Nosto_Tagging>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magento
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~
7
+ ~ This source file is subject to the Open Software License (OSL 3.0)
8
+ ~ that is bundled with this package in the file LICENSE.txt.
9
+ ~ It is also available through the world-wide-web at this URL:
10
+ ~ http://opensource.org/licenses/osl-3.0.php
11
+ ~ If you did not receive a copy of the license and are unable to
12
+ ~ obtain it through the world-wide-web, please send an email
13
+ ~ to license@magentocommerce.com so we can send you a copy immediately.
14
+ ~
15
+ ~ DISCLAIMER
16
+ ~
17
+ ~ Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ ~ versions in the future. If you wish to customize Magento for your
19
+ ~ needs please refer to http://www.magentocommerce.com for more information.
20
+ ~
21
+ ~ @category Nosto
22
+ ~ @package Nosto_Tagging
23
+ ~ @author Nosto Solutions Ltd <magento@nosto.com>
24
+ ~ @copyright Copyright (c) 2013-2016 Nosto Solutions Ltd (http://www.nosto.com)
25
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ -->
27
+ <!--suppress XmlUnboundNsPrefix -->
 
28
  <config>
29
  <modules>
30
  <Nosto_Tagging>
js/nosto/iframeHandler.min.js CHANGED
@@ -1 +1 @@
1
- !function(a){"use strict";function b(b,e){var f=c({method:"POST",async:!0,data:{}},e);f.data.form_key=a.FORM_KEY;var g=new XMLHttpRequest;"function"==typeof f.success&&g.addEventListener("load",function(a){f.success(JSON.parse(a.target.response))},!1),g.open(f.method,decodeURIComponent(b),f.async),g.setRequestHeader("X-Requested-With","XMLHttpRequest"),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(d(f.data))}function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(""!==b&&(b+="&"),b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b}var e=function(d,e){var f="newAccount",g="connectAccount",h="removeAccount",i=c({iframeId:"nosto_iframe",urls:{createAccount:"",connectAccount:"",deleteAccount:""}},e),j=document.getElementById(i.iframeId);switch(d.type){case f:b(i.urls.createAccount,{data:{email:d.params.email},success:function(a){a.success&&a.redirect_url&&(j.src=a.redirect_url)}});break;case g:b(i.urls.connectAccount,{success:function(b){b.success&&b.redirect_url?a.location.href=b.redirect_url:!b.success&&b.redirect_url&&(j.src=b.redirect_url)}});break;case h:b(i.urls.deleteAccount,{success:function(a){a.success&&a.redirect_url&&(j.src=a.redirect_url)}});break;default:throw new Error("Nosto: invalid postMessage `type`.")}};a.Nosto=a.Nosto||{},a.Nosto.handlePostMessage=e}(window||{});
1
+ !function(a){"use strict";function b(b,e){var f=c({method:"POST",async:!0,data:{}},e);f.data.form_key=a.FORM_KEY;var g=new XMLHttpRequest;"function"==typeof f.success&&g.addEventListener("load",function(a){f.success(JSON.parse(a.target.response))},!1),g.open(f.method,decodeURIComponent(b),f.async),g.setRequestHeader("X-Requested-With","XMLHttpRequest"),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(d(f.data))}function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(""!==b&&(b+="&"),b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b}var e=function(d,e){var f="newAccount",g="connectAccount",h="removeAccount",i=c({iframeId:"nosto_iframe",urls:{createAccount:"",connectAccount:"",deleteAccount:""}},e),j=document.getElementById(i.iframeId);switch(d.type){case f:var k={email:d.params.email};d.params.details&&(k.details=JSON.stringify(d.params.details)),b(i.urls.createAccount,{data:k,success:function(a){a.success&&a.redirect_url&&(j.src=a.redirect_url)}});break;case g:b(i.urls.connectAccount,{success:function(b){b.success&&b.redirect_url?a.location.href=b.redirect_url:!b.success&&b.redirect_url&&(j.src=b.redirect_url)}});break;case h:b(i.urls.deleteAccount,{success:function(a){a.success&&a.redirect_url&&(j.src=a.redirect_url)}});break;default:throw new Error("Nosto: invalid postMessage `type`.")}};a.Nosto=a.Nosto||{},a.Nosto.handlePostMessage=e}(window||{});
lib/nosto/php-sdk/src/classes/Nosto.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -112,14 +113,53 @@ class Nosto
112
  * @param string $message the error message.
113
  * @param NostoHttpRequest $request the request object to take additional info from.
114
  * @param NostoHttpResponse $response the response object to take additional info from.
115
- * @throws NostoHttpException the exception.
116
  */
117
  public static function throwHttpException($message, NostoHttpRequest $request, NostoHttpResponse $response)
118
  {
119
- $message .= sprintf(' Error: %s.', $response->getCode());
120
- $message .= sprintf(' Request: %s.', $request);
121
- $message .= sprintf(' Response: %s.', $response);
122
- throw new NostoHttpException($message, $response->getCode());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }
124
 
125
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
113
  * @param string $message the error message.
114
  * @param NostoHttpRequest $request the request object to take additional info from.
115
  * @param NostoHttpResponse $response the response object to take additional info from.
116
+ * @throws NostoHttpException|NostoApiResponseException the exception.
117
  */
118
  public static function throwHttpException($message, NostoHttpRequest $request, NostoHttpResponse $response)
119
  {
120
+ $jsonResponse = $response->getJsonResult();
121
+
122
+ if (
123
+ isset($jsonResponse->type)
124
+ && isset($jsonResponse->message)
125
+ ) {
126
+ if (isset($jsonResponse->message)) {
127
+ $message .= '. ' . $jsonResponse->message;
128
+ }
129
+ throw new NostoApiResponseException(
130
+ $message,
131
+ $response->getCode(), // http status code
132
+ null,
133
+ $request,
134
+ $response
135
+ );
136
+ } else {
137
+ if ($response->getMessage()) {
138
+ $message .= '. ' . $response->getMessage();
139
+ }
140
+ throw new NostoHttpException(
141
+ $message,
142
+ $response->getCode(),
143
+ null,
144
+ $request,
145
+ $response
146
+ );
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Throws a new NostoException exception
152
+ *
153
+ * @param string $message the error message
154
+ * @param int $code the code
155
+ * @throws NostoException the exception
156
+ */
157
+ public static function throwException($message, $code = null)
158
+ {
159
+ throw new NostoException(
160
+ $message,
161
+ $code
162
+ );
163
  }
164
 
165
  /**
lib/nosto/php-sdk/src/classes/NostoAccount.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -109,6 +110,15 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
109
  $params['api_tokens'][] = 'api_'.$name;
110
  }
111
 
 
 
 
 
 
 
 
 
 
112
  $request = new NostoApiRequest();
113
  $request->setPath(NostoApiRequest::PATH_SIGN_UP);
114
  $request->setReplaceParams(array('{lang}' => $meta->getLanguageCode()));
@@ -116,8 +126,9 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
116
  $request->setAuthBasic('', $meta->getSignUpApiToken());
117
  $response = $request->post(json_encode($params));
118
 
 
119
  if ($response->getCode() !== 200) {
120
- Nosto::throwHttpException('Nosto account could not be created.', $request, $response);
121
  }
122
 
123
  $account = new self($meta->getPlatform().'-'.$meta->getName());
@@ -211,17 +222,28 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
211
  if (empty($this->tokens)) {
212
  return false;
213
  }
214
- $countTokens = count($this->tokens);
215
- $foundTokens = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  foreach (NostoApiToken::getApiTokenNames() as $name) {
217
- foreach ($this->tokens as $token) {
218
- if ($token->name === $name) {
219
- $foundTokens++;
220
- break;
221
- }
222
  }
223
  }
224
- return ($countTokens === $foundTokens);
225
  }
226
 
227
  /**
@@ -252,7 +274,9 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
252
  */
253
  public function getIframeUrl(NostoAccountMetaDataIframeInterface $meta, array $params = array())
254
  {
255
- return Nosto::helper('iframe')->getUrl($meta, $this, $params);
 
 
256
  }
257
 
258
  /**
@@ -309,4 +333,20 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
309
  }
310
  }
311
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
110
  $params['api_tokens'][] = 'api_'.$name;
111
  }
112
 
113
+ if ($meta->getDetails()) {
114
+ $params['details'] = $meta->getDetails();
115
+ }
116
+
117
+ $params['use_exchange_rates'] = $meta->getUseCurrencyExchangeRates();
118
+ if ($meta->getDefaultVariationId()) {
119
+ $params['default_variant_id'] = $meta->getDefaultVariationId();
120
+ }
121
+
122
  $request = new NostoApiRequest();
123
  $request->setPath(NostoApiRequest::PATH_SIGN_UP);
124
  $request->setReplaceParams(array('{lang}' => $meta->getLanguageCode()));
126
  $request->setAuthBasic('', $meta->getSignUpApiToken());
127
  $response = $request->post(json_encode($params));
128
 
129
+ /* In case of no result we have not been able to make the API call */
130
  if ($response->getCode() !== 200) {
131
+ Nosto::throwHttpException('Failed to create Nosto account', $request, $response);
132
  }
133
 
134
  $account = new self($meta->getPlatform().'-'.$meta->getName());
222
  if (empty($this->tokens)) {
223
  return false;
224
  }
225
+ foreach (NostoApiToken::getMandatoryApiTokenNames() as $name) {
226
+ if ($this->getApiToken($name) === null) {
227
+ return false;
228
+ }
229
+ }
230
+ return true;
231
+ }
232
+
233
+ /**
234
+ * @inheritdoc
235
+ */
236
+ public function hasMissingTokens()
237
+ {
238
+ if (empty($this->tokens)) {
239
+ return true;
240
+ }
241
  foreach (NostoApiToken::getApiTokenNames() as $name) {
242
+ if ($this->getApiToken($name) === null) {
243
+ return true;
 
 
 
244
  }
245
  }
246
+ return false;
247
  }
248
 
249
  /**
274
  */
275
  public function getIframeUrl(NostoAccountMetaDataIframeInterface $meta, array $params = array())
276
  {
277
+ /* @var $iframeHelper NostoHelperIframe */
278
+ $iframeHelper = Nosto::helper('iframe');
279
+ return $iframeHelper->getUrl($meta, $this, $params);
280
  }
281
 
282
  /**
333
  }
334
  }
335
  }
336
+
337
+ /**
338
+ * @inheritdoc
339
+ */
340
+ public function getMissingTokens()
341
+ {
342
+ $allTokens = NostoApiToken::getApiTokenNames();
343
+ $missingTokens = array();
344
+ foreach ($allTokens as $token) {
345
+ if (!$this->getApiToken($token)) {
346
+ $missingTokens[] = $token;
347
+ }
348
+ }
349
+
350
+ return $missingTokens;
351
+ }
352
  }
lib/nosto/php-sdk/src/classes/NostoAccountMeta.php CHANGED
@@ -1,26 +1,37 @@
1
  <?php
2
  /**
3
- * 2013-2016 Nosto Solutions Ltd
 
4
  *
5
- * NOTICE OF LICENSE
 
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to contact@nosto.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
 
 
16
  *
17
- * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18
- * versions in the future. If you wish to customize PrestaShop for your
19
- * needs please refer to http://www.prestashop.com for more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
- * @author Nosto Solutions Ltd <contact@nosto.com>
22
- * @copyright 2013-2016 Nosto Solutions Ltd
23
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
  */
25
 
26
  /**
@@ -83,6 +94,40 @@ abstract class NostoAccountMeta implements NostoAccountMetaDataInterface
83
  */
84
  protected $defaultVariationId = false;
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  /**
87
  * Sets the store title.
88
  *
@@ -125,14 +170,6 @@ abstract class NostoAccountMeta implements NostoAccountMetaDataInterface
125
  return $this->name;
126
  }
127
 
128
- /**
129
- * The name of the platform the account is used on.
130
- * A list of valid platform names is issued by Nosto.
131
- *
132
- * @return string the platform names.
133
- */
134
- abstract public function getPlatform();
135
-
136
  /**
137
  * Sets the store front page url.
138
  *
@@ -237,21 +274,6 @@ abstract class NostoAccountMeta implements NostoAccountMetaDataInterface
237
  return $this->billing;
238
  }
239
 
240
- /**
241
- * The API token used to identify an account creation.
242
- * This token is platform specific and issued by Nosto.
243
- *
244
- * @return string the API token.
245
- */
246
- abstract public function getSignUpApiToken();
247
-
248
- /**
249
- * Returns the partner code
250
- *
251
- * @return string
252
- */
253
- abstract public function getPartnerCode();
254
-
255
  /**
256
  * Returns an array of currencies used for this account
257
  *
@@ -301,17 +323,62 @@ abstract class NostoAccountMeta implements NostoAccountMetaDataInterface
301
  $this->defaultVariationId = $defaultVariationId;
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
305
- /*
306
- * Returns the default variation id
307
  *
308
  * @return string
309
  */
 
 
 
 
 
310
  /**
 
 
311
  * @return string
312
  */
313
- public function getDefaultVariationId()
314
  {
315
- return $this->defaultVariationId;
 
 
 
 
 
 
 
 
 
 
316
  }
317
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
+ * All rights reserved.
5
  *
6
+ * Redistribution and use in source and binary forms, with or without modification,
7
+ * are permitted provided that the following conditions are met:
8
  *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
 
 
 
 
 
11
  *
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
  *
16
+ * 3. Neither the name of the copyright holder nor the names of its contributors
17
+ * may be used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
  *
 
 
 
35
  */
36
 
37
  /**
94
  */
95
  protected $defaultVariationId = false;
96
 
97
+ /**
98
+ * @var string details
99
+ */
100
+ protected $details = false;
101
+
102
+ /**
103
+ * @var string sign up api token
104
+ */
105
+ protected $signupApiToken;
106
+
107
+ /**
108
+ * @var string platform name
109
+ */
110
+ protected $platform;
111
+
112
+ /**
113
+ * @var string partner code
114
+ */
115
+ protected $partnerCode;
116
+
117
+ /**
118
+ * Constructor
119
+ *
120
+ * @param string $platform
121
+ * @param string $signupApiToken
122
+ * @param string $partnerCode
123
+ */
124
+ public function __construct($platform, $signupApiToken, $partnerCode)
125
+ {
126
+ $this->platform = $platform;
127
+ $this->signupApiToken = $signupApiToken;
128
+ $this->partnerCode = $partnerCode;
129
+ }
130
+
131
  /**
132
  * Sets the store title.
133
  *
170
  return $this->name;
171
  }
172
 
 
 
 
 
 
 
 
 
173
  /**
174
  * Sets the store front page url.
175
  *
274
  return $this->billing;
275
  }
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  /**
278
  * Returns an array of currencies used for this account
279
  *
323
  $this->defaultVariationId = $defaultVariationId;
324
  }
325
 
326
+ /**
327
+ * Return the default variation id
328
+ *
329
+ * @return string
330
+ */
331
+ public function getDefaultVariationId()
332
+ {
333
+ return $this->defaultVariationId;
334
+ }
335
+
336
+ /**
337
+ * Sets the details
338
+ * @param string $details
339
+ */
340
+ public function setDetails($details)
341
+ {
342
+ $this->details = $details;
343
+ }
344
+
345
+ /**
346
+ * Returns the account details
347
+ *
348
+ * @return string
349
+ */
350
+ public function getDetails()
351
+ {
352
+ return $this->details;
353
+ }
354
 
355
+ /**
356
+ * Returns the partner code
357
  *
358
  * @return string
359
  */
360
+ public function getPartnerCode()
361
+ {
362
+ return $this->partnerCode;
363
+ }
364
+
365
  /**
366
+ * Returns the name of the platform
367
+ *
368
  * @return string
369
  */
370
+ public function getPlatform()
371
  {
372
+ return $this->platform;
373
+ }
374
+
375
+ /**
376
+ * Returns the signup api token
377
+ *
378
+ * @return string
379
+ */
380
+ public function getSignupApiToken()
381
+ {
382
+ return $this->signupApiToken;
383
  }
384
  }
lib/nosto/php-sdk/src/classes/NostoCipher.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoCurrency.php CHANGED
@@ -1,26 +1,37 @@
1
  <?php
2
  /**
3
- * 2013-2016 Nosto Solutions Ltd
 
4
  *
5
- * NOTICE OF LICENSE
 
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to contact@nosto.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
 
 
16
  *
17
- * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18
- * versions in the future. If you wish to customize PrestaShop for your
19
- * needs please refer to http://www.prestashop.com for more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
- * @author Nosto Solutions Ltd <contact@nosto.com>
22
- * @copyright 2013-2016 Nosto Solutions Ltd
23
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
  */
25
 
26
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
+ * All rights reserved.
5
  *
6
+ * Redistribution and use in source and binary forms, with or without modification,
7
+ * are permitted provided that the following conditions are met:
8
  *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
 
 
 
 
 
11
  *
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
  *
16
+ * 3. Neither the name of the copyright holder nor the names of its contributors
17
+ * may be used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
  *
 
 
 
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoDotEnv.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoExchangeRate.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoMessage.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoNotification.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without modification,
7
+ * are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ *
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * 3. Neither the name of the copyright holder nor the names of its contributors
17
+ * may be used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
+ */
36
+
37
+ /**
38
+ * Implementation for NostoNotificationInterface
39
+ */
40
+ class NostoNotification implements NostoNotificationInterface
41
+ {
42
+ /*
43
+ * @var int|string unique id of the store
44
+ */
45
+ protected $storeId;
46
+
47
+ /*
48
+ * @var string the name of the store
49
+ */
50
+ protected $storeName;
51
+
52
+ /*
53
+ * @var int|string unique id of language
54
+ */
55
+ protected $languageId;
56
+
57
+ /*
58
+ * @var string the name of the langue
59
+ */
60
+ protected $languageName;
61
+
62
+ /*
63
+ * @var string notification message
64
+ */
65
+ protected $message;
66
+
67
+ /*
68
+ * @var int type of the notification
69
+ * @see NostoNotificationInterface::TYPE_* constants
70
+ */
71
+ protected $notificationType;
72
+
73
+ /*
74
+ * @var int severity of the notification
75
+ * @see NostoNotificationInterface::SEVERITY_* constants
76
+ */
77
+ protected $notificationSeverity;
78
+
79
+ /*
80
+ * @var array of attributes required by the message
81
+ */
82
+ protected $messageAttributes;
83
+
84
+ /**
85
+ * @inheritdoc
86
+ */
87
+ public function getStoreId()
88
+ {
89
+ return $this->storeId;
90
+ }
91
+
92
+ /**
93
+ * Setter for store id
94
+ *
95
+ * @param int|string $storeId
96
+ */
97
+ public function setStoreId($storeId)
98
+ {
99
+ $this->storeId = $storeId;
100
+ }
101
+
102
+ /**
103
+ * @inheritdoc
104
+ */
105
+ public function getStoreName()
106
+ {
107
+ return $this->storeName;
108
+ }
109
+
110
+ /**
111
+ * Setter for store name
112
+ *
113
+ * @param string $storeName
114
+ */
115
+ public function setStoreName($storeName)
116
+ {
117
+ $this->storeName = $storeName;
118
+ }
119
+
120
+ /**
121
+ * @inheritdoc
122
+ */
123
+ public function getLanguageId()
124
+ {
125
+ return $this->languageId;
126
+ }
127
+
128
+ /**
129
+ * Setter for language id
130
+ *
131
+ * @param int/string $languageId
132
+ */
133
+ public function setLanguageId($languageId)
134
+ {
135
+ $this->languageId = $languageId;
136
+ }
137
+
138
+ /**
139
+ * @inheritdoc
140
+ */
141
+ public function getLanguageName()
142
+ {
143
+ return $this->languageName;
144
+ }
145
+
146
+ /**
147
+ * Setter for language name
148
+ * @param string $languageName
149
+ */
150
+ public function setLanguageName($languageName)
151
+ {
152
+ $this->languageName = $languageName;
153
+ }
154
+
155
+ /**
156
+ * @inheritdoc
157
+ */
158
+ public function getMessage()
159
+ {
160
+ return $this->message;
161
+ }
162
+
163
+ /**
164
+ * Setter for message
165
+ *
166
+ * @param mixed $message
167
+ */
168
+ public function setMessage($message)
169
+ {
170
+ $this->message = $message;
171
+ }
172
+
173
+ /**
174
+ * @inheritdoc
175
+ */
176
+ public function getNotificationType()
177
+ {
178
+ return $this->notificationType;
179
+ }
180
+
181
+ /**
182
+ * Setter for notification type
183
+ *
184
+ * @see NostoNotificationInterface::TYPE_*
185
+ * @param int $notificationType
186
+ */
187
+ public function setNotificationType($notificationType)
188
+ {
189
+ $this->notificationType = $notificationType;
190
+ }
191
+
192
+ /**
193
+ * @inheritdoc
194
+ */
195
+ public function getNotificationSeverity()
196
+ {
197
+ return $this->notificationSeverity;
198
+ }
199
+
200
+ /**
201
+ * Setter for notification severity
202
+ *
203
+ * @see NostoNotificationInterface::SEVERITY_*
204
+ * @param mixed $notificationSeverity
205
+ */
206
+ public function setNotificationSeverity($notificationSeverity)
207
+ {
208
+ $this->notificationSeverity = $notificationSeverity;
209
+ }
210
+
211
+ /**
212
+ * @inheritdoc
213
+ */
214
+ public function getMessageAttributes()
215
+ {
216
+ return $this->messageAttributes;
217
+ }
218
+
219
+ /**
220
+ * Sets all message attributes
221
+ *
222
+ * @param array $messageAttributes
223
+ */
224
+ public function setMessageAttributes(array $messageAttributes)
225
+ {
226
+ $this->messageAttributes = $messageAttributes;
227
+ }
228
+
229
+ /**
230
+ * Adds a message attribute
231
+ *
232
+ * @param int|string $messageAttribute
233
+ * @throws NostoException
234
+ */
235
+ public function addMessageAttribute($messageAttribute)
236
+ {
237
+ if (!is_scalar($messageAttribute)) {
238
+ throw new NostoException('Message attribute must be a scalar value');
239
+ }
240
+ $this->messageAttributes[] = $messageAttribute;
241
+ }
242
+
243
+ /**
244
+ * Returns formatted message
245
+ *
246
+ * @return string
247
+ */
248
+ public function formatMessage()
249
+ {
250
+ return vsprintf(
251
+ $this->getMessage(),
252
+ $this->getMessageAttributes()
253
+ );
254
+ }
255
+
256
+ }
lib/nosto/php-sdk/src/classes/NostoObject.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/NostoOrderConfirmation.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -78,8 +79,10 @@ class NostoOrderConfirmation
78
  ),
79
  'created_at' => Nosto::helper('date')->format($order->getCreatedDate()),
80
  'payment_provider' => $order->getPaymentProvider(),
 
81
  'purchased_items' => array(),
82
  );
 
83
  foreach ($order->getPurchasedItems() as $item) {
84
  $orderData['purchased_items'][] = array(
85
  'product_id' => $item->getProductId(),
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
79
  ),
80
  'created_at' => Nosto::helper('date')->format($order->getCreatedDate()),
81
  'payment_provider' => $order->getPaymentProvider(),
82
+ 'external_order_ref' => $order->getExternalOrderRef(),
83
  'purchased_items' => array(),
84
  );
85
+
86
  foreach ($order->getPurchasedItems() as $item) {
87
  $orderData['purchased_items'][] = array(
88
  'product_id' => $item->getProductId(),
lib/nosto/php-sdk/src/classes/NostoProductReCrawl.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -99,7 +100,9 @@ class NostoProductReCrawl
99
  {
100
  $token = $account->getApiToken('products');
101
  if ($token === null) {
102
- throw new NostoException('Failed to send product re-crawl to Nosto. No `products` API token found for account.');
 
 
103
  }
104
  $request = new NostoApiRequest();
105
  $request->setPath(NostoApiRequest::PATH_PRODUCT_RE_CRAWL);
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
100
  {
101
  $token = $account->getApiToken('products');
102
  if ($token === null) {
103
+ throw new NostoException(
104
+ 'Failed to send product re-crawl to Nosto. No `products` API token found for account.'
105
+ );
106
  }
107
  $request = new NostoApiRequest();
108
  $request->setPath(NostoApiRequest::PATH_PRODUCT_RE_CRAWL);
lib/nosto/php-sdk/src/classes/NostoValidator.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -41,12 +42,12 @@ class NostoValidator
41
  /**
42
  * @var NostoValidatableInterface the object to validate.
43
  */
44
- private $_object;
45
 
46
  /**
47
  * @var array map of validation errors per attribute.
48
  */
49
- private $_errors = array();
50
 
51
  /**
52
  * Constructor.
@@ -56,7 +57,7 @@ class NostoValidator
56
  */
57
  public function __construct(NostoValidatableInterface $object)
58
  {
59
- $this->_object = $object;
60
  }
61
 
62
  /**
@@ -67,7 +68,7 @@ class NostoValidator
67
  */
68
  public function validate()
69
  {
70
- foreach ($this->_object->getValidationRules() as $rule) {
71
  if (isset($rule[0], $rule[1])) {
72
  $properties = $rule[0];
73
  $validator = 'validate'.$rule[1];
@@ -91,7 +92,7 @@ class NostoValidator
91
  */
92
  public function hasErrors()
93
  {
94
- return (bool)count($this->_errors);
95
  }
96
 
97
  /**
@@ -101,7 +102,7 @@ class NostoValidator
101
  */
102
  public function getErrors()
103
  {
104
- return $this->_errors;
105
  }
106
 
107
  /**
@@ -112,10 +113,10 @@ class NostoValidator
112
  */
113
  protected function addError($attribute, $message)
114
  {
115
- if (!isset($this->_errors[$attribute])) {
116
- $this->_errors[$attribute] = array();
117
  }
118
- $this->_errors[$attribute][] = $message;
119
  }
120
 
121
  /**
@@ -127,7 +128,7 @@ class NostoValidator
127
  protected function validateRequired(array $properties)
128
  {
129
  foreach ($properties as $property) {
130
- $value = $this->_object->{$property};
131
  if (empty($value)) {
132
  $this->addError($property, sprintf('Property "%s" must not be empty.', $property));
133
  return false;
@@ -147,7 +148,7 @@ class NostoValidator
147
  {
148
  $supported = implode('", "', $values);
149
  foreach ($properties as $property) {
150
- $value = $this->_object->{$property};
151
  if (!in_array($value, $values)) {
152
  $this->addError(
153
  $property,
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
42
  /**
43
  * @var NostoValidatableInterface the object to validate.
44
  */
45
+ private $object;
46
 
47
  /**
48
  * @var array map of validation errors per attribute.
49
  */
50
+ private $errors = array();
51
 
52
  /**
53
  * Constructor.
57
  */
58
  public function __construct(NostoValidatableInterface $object)
59
  {
60
+ $this->object = $object;
61
  }
62
 
63
  /**
68
  */
69
  public function validate()
70
  {
71
+ foreach ($this->object->getValidationRules() as $rule) {
72
  if (isset($rule[0], $rule[1])) {
73
  $properties = $rule[0];
74
  $validator = 'validate'.$rule[1];
92
  */
93
  public function hasErrors()
94
  {
95
+ return (bool)count($this->errors);
96
  }
97
 
98
  /**
102
  */
103
  public function getErrors()
104
  {
105
+ return $this->errors;
106
  }
107
 
108
  /**
113
  */
114
  protected function addError($attribute, $message)
115
  {
116
+ if (!isset($this->errors[$attribute])) {
117
+ $this->errors[$attribute] = array();
118
  }
119
+ $this->errors[$attribute][] = $message;
120
  }
121
 
122
  /**
128
  protected function validateRequired(array $properties)
129
  {
130
  foreach ($properties as $property) {
131
+ $value = $this->object->{$property};
132
  if (empty($value)) {
133
  $this->addError($property, sprintf('Property "%s" must not be empty.', $property));
134
  return false;
148
  {
149
  $supported = implode('", "', $values);
150
  foreach ($properties as $property) {
151
+ $value = $this->object->{$property};
152
  if (!in_array($value, $values)) {
153
  $this->addError(
154
  $property,
lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/api/NostoApiToken.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -118,6 +119,19 @@ class NostoApiToken extends NostoObject implements NostoValidatableInterface
118
  return self::$tokenNames;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  /**
122
  * Returns the token name.
123
  *
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
119
  return self::$tokenNames;
120
  }
121
 
122
+ /**
123
+ * Returns mandatory API token names.
124
+ *
125
+ * @return array the token names.
126
+ */
127
+ public static function getMandatoryApiTokenNames()
128
+ {
129
+ return array(
130
+ self::API_SSO,
131
+ self::API_PRODUCTS
132
+ );
133
+ }
134
+
135
  /**
136
  * Returns the token name.
137
  *
lib/nosto/php-sdk/src/classes/collection/NostoCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/collection/NostoOrderCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/collection/NostoProductCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/exception/NostoApiResponseException.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without modification,
7
+ * are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ *
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * 3. Neither the name of the copyright holder nor the names of its contributors
17
+ * may be used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
+ */
36
+
37
+ /**
38
+ * Nosto exception class for api response errors within the sdk.
39
+ */
40
+ class NostoApiResponseException extends NostoHttpResponseException
41
+ {
42
+ }
lib/nosto/php-sdk/src/classes/exception/NostoException.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/exception/NostoHttpException.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -38,4 +39,65 @@
38
  */
39
  class NostoHttpException extends NostoException
40
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
39
  */
40
  class NostoHttpException extends NostoException
41
  {
42
+ /**
43
+ * @var NostoHttpResponse
44
+ */
45
+ private $response;
46
+
47
+ /**
48
+ * @var NostoHttpRequest
49
+ */
50
+ private $request;
51
+
52
+ /**
53
+ * NostoHttpException constructor.
54
+ * @param string $message
55
+ * @param null $code
56
+ * @param Throwable|null $previous
57
+ * @param NostoHttpRequest|null $request
58
+ * @param NostoHttpResponse|null $response
59
+ */
60
+ public function __construct(
61
+ $message = "",
62
+ $code = null,
63
+ Throwable $previous = null,
64
+ NostoHttpRequest $request = null,
65
+ NostoHttpResponse $response = null
66
+ ) {
67
+ parent::__construct($message, $code, $previous);
68
+ $this->setRequest($request);
69
+ $this->setResponse($response);
70
+ }
71
+
72
+ /**
73
+ * @return NostoHttpRequest
74
+ */
75
+ public function getRequest()
76
+ {
77
+ return $this->request;
78
+ }
79
+
80
+ /**
81
+ * @param NostoHttpRequest $request
82
+ */
83
+ public function setRequest(NostoHttpRequest $request)
84
+ {
85
+ $this->request = $request;
86
+ }
87
+
88
+ /**
89
+ * @return NostoHttpResponse
90
+ */
91
+ public function getResponse()
92
+ {
93
+ return $this->response;
94
+ }
95
+
96
+ /**
97
+ * @param NostoHttpResponse $response
98
+ */
99
+ public function setResponse(NostoHttpResponse $response)
100
+ {
101
+ $this->response = $response;
102
+ }
103
  }
lib/nosto/php-sdk/src/classes/exception/NostoHttpResponseException.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without modification,
7
+ * are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ *
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * 3. Neither the name of the copyright holder nor the names of its contributors
17
+ * may be used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
+ */
36
+
37
+ /**
38
+ * Nosto exception class for api response errors within the sdk.
39
+ */
40
+ class NostoHttpResponseException extends NostoHttpException
41
+ {
42
+ }
lib/nosto/php-sdk/src/classes/export/NostoExportOrderCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -58,6 +59,7 @@ class NostoExportOrderCollection extends NostoOrderCollection implements NostoEx
58
  'email' => $item->getBuyerInfo()->getEmail(),
59
  ),
60
  'payment_provider' => $item->getPaymentProvider(),
 
61
  'purchased_items' => array(),
62
  );
63
  foreach ($item->getPurchasedItems() as $orderItem) {
@@ -69,6 +71,7 @@ class NostoExportOrderCollection extends NostoOrderCollection implements NostoEx
69
  'price_currency_code' => strtoupper($orderItem->getCurrencyCode()),
70
  );
71
  }
 
72
  $array[] = $data;
73
  }
74
  return json_encode($array);
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
59
  'email' => $item->getBuyerInfo()->getEmail(),
60
  ),
61
  'payment_provider' => $item->getPaymentProvider(),
62
+ 'external_order_ref' => $item->getExternalOrderRef(),
63
  'purchased_items' => array(),
64
  );
65
  foreach ($item->getPurchasedItems() as $orderItem) {
71
  'price_currency_code' => strtoupper($orderItem->getCurrencyCode()),
72
  );
73
  }
74
+
75
  $array[] = $data;
76
  }
77
  return json_encode($array);
lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -47,42 +48,7 @@ class NostoExportProductCollection extends NostoProductCollection implements Nos
47
  $array = array();
48
  /** @var NostoProductInterface $item */
49
  foreach ($this->getArrayCopy() as $item) {
50
- $data = array(
51
- 'url' => $item->getUrl(),
52
- 'product_id' => $item->getProductId(),
53
- 'name' => $item->getName(),
54
- 'image_url' => $item->getImageUrl(),
55
- 'price' => Nosto::helper('price')->format($item->getPrice()),
56
- 'price_currency_code' => strtoupper($item->getCurrencyCode()),
57
- 'availability' => $item->getAvailability(),
58
- 'categories' => $item->getCategories(),
59
- );
60
-
61
- // Optional properties.
62
-
63
- if ($item->getFullDescription()) {
64
- $data['description'] = $item->getFullDescription();
65
- }
66
- if ($item->getListPrice()) {
67
- $data['list_price'] = Nosto::helper('price')->format($item->getListPrice());
68
- }
69
- if ($item->getBrand()) {
70
- $data['brand'] = $item->getBrand();
71
- }
72
- foreach ($item->getTags() as $type => $tags) {
73
- if (is_array($tags) && count($tags) > 0) {
74
- $data[$type] = $tags;
75
- }
76
- }
77
- if ($item->getDatePublished()) {
78
- $data['date_published'] = Nosto::helper('date')->format($item->getDatePublished());
79
- }
80
-
81
- if ($item->getVariationId()) {
82
- $data['variation_id'] = $item->getVariationId();
83
- }
84
-
85
- $array[] = $data;
86
  }
87
  return json_encode($array);
88
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
48
  $array = array();
49
  /** @var NostoProductInterface $item */
50
  foreach ($this->getArrayCopy() as $item) {
51
+ $array[] = NostoOperationProduct::getProductAsArray($item);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
  return json_encode($array);
54
  }
lib/nosto/php-sdk/src/classes/export/NostoExporter.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/helper/NostoHelper.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/helper/NostoHelperDate.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/helper/NostoHelperIframe.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -53,27 +54,34 @@ class NostoHelperIframe extends NostoHelper
53
  */
54
  public function getUrl(
55
  NostoAccountMetaDataIframeInterface $meta,
56
- NostoAccount $account = null,
57
  array $params = array()
58
  ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  $queryParams = http_build_query(
60
  array_merge(
61
- array(
62
- 'lang' => strtolower($meta->getLanguageIsoCode()),
63
- 'ps_version' => $meta->getVersionPlatform(),
64
- 'nt_version' => $meta->getVersionModule(),
65
- 'product_pu' => $meta->getPreviewUrlProduct(),
66
- 'category_pu' => $meta->getPreviewUrlCategory(),
67
- 'search_pu' => $meta->getPreviewUrlSearch(),
68
- 'cart_pu' => $meta->getPreviewUrlCart(),
69
- 'front_pu' => $meta->getPreviewUrlFront(),
70
- 'shop_lang' => strtolower($meta->getLanguageIsoCodeShop()),
71
- 'shop_name' => $meta->getShopName(),
72
- 'unique_id' => $meta->getUniqueId(),
73
- 'fname' => $meta->getFirstName(),
74
- 'lname' => $meta->getLastName(),
75
- 'email' => $meta->getEmail(),
76
- ),
77
  $params
78
  )
79
  );
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
54
  */
55
  public function getUrl(
56
  NostoAccountMetaDataIframeInterface $meta,
57
+ NostoAccountInterface $account = null,
58
  array $params = array()
59
  ) {
60
+ $defaultParameters = array(
61
+ 'lang' => strtolower($meta->getLanguageIsoCode()),
62
+ 'ps_version' => $meta->getVersionPlatform(),
63
+ 'nt_version' => $meta->getVersionModule(),
64
+ 'product_pu' => $meta->getPreviewUrlProduct(),
65
+ 'category_pu' => $meta->getPreviewUrlCategory(),
66
+ 'search_pu' => $meta->getPreviewUrlSearch(),
67
+ 'cart_pu' => $meta->getPreviewUrlCart(),
68
+ 'front_pu' => $meta->getPreviewUrlFront(),
69
+ 'shop_lang' => strtolower($meta->getLanguageIsoCodeShop()),
70
+ 'shop_name' => $meta->getShopName(),
71
+ 'unique_id' => $meta->getUniqueId(),
72
+ 'fname' => $meta->getFirstName(),
73
+ 'lname' => $meta->getLastName(),
74
+ 'email' => $meta->getEmail(),
75
+ );
76
+ if ($account instanceof NostoAccountInterface) {
77
+ $missingScopes = $account->getMissingTokens();
78
+ if (!empty($missingScopes)) {
79
+ $defaultParameters['missing_scopes'] = implode(',', $missingScopes);
80
+ }
81
+ }
82
  $queryParams = http_build_query(
83
  array_merge(
84
+ $defaultParameters,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  $params
86
  )
87
  );
lib/nosto/php-sdk/src/classes/helper/NostoHelperPrice.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -41,11 +42,16 @@ class NostoHelperPrice extends NostoHelper
41
  /**
42
  * Formats price into Nosto format, e.g. 1000.99.
43
  *
44
- * @param string|int|float $price the price string to format.
45
  * @return string the formatted price.
46
  */
47
  public function format($price)
48
  {
49
- return number_format($price, 2, '.', '');
 
 
 
 
 
50
  }
51
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
42
  /**
43
  * Formats price into Nosto format, e.g. 1000.99.
44
  *
45
+ * @param int|float $price the price string to format.
46
  * @return string the formatted price.
47
  */
48
  public function format($price)
49
  {
50
+ $formatted = null;
51
+ if (is_numeric($price)) {
52
+ $formatted = number_format($price, 2, '.', '');
53
+ }
54
+
55
+ return $formatted;
56
  }
57
  }
lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -54,6 +55,16 @@ class NostoHttpRequest
54
  */
55
  public static $userAgent = '';
56
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * @var string the request url.
59
  */
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
55
  */
56
  public static $userAgent = '';
57
 
58
+ /**
59
+ * @var int timeout for waiting response from the api
60
+ */
61
+ public static $responseTimeout = 5;
62
+
63
+ /**
64
+ * @var int timeout for connecting to the api
65
+ */
66
+ public static $connectTimeout = 5;
67
+
68
  /**
69
  * @var string the request url.
70
  */
lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapter.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -69,8 +70,7 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
69
  CURLOPT_FRESH_CONNECT => 1,
70
  CURLOPT_RETURNTRANSFER => 1,
71
  CURLOPT_FORBID_REUSE => 1,
72
- CURLOPT_TIMEOUT => 60,
73
- )
74
  );
75
  }
76
 
@@ -89,7 +89,6 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
89
  CURLOPT_FRESH_CONNECT => 1,
90
  CURLOPT_RETURNTRANSFER => 1,
91
  CURLOPT_FORBID_REUSE => 1,
92
- CURLOPT_TIMEOUT => 60,
93
  )
94
  );
95
  }
@@ -109,7 +108,6 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
109
  CURLOPT_FRESH_CONNECT => 1,
110
  CURLOPT_RETURNTRANSFER => 1,
111
  CURLOPT_FORBID_REUSE => 1,
112
- CURLOPT_TIMEOUT => 60,
113
  )
114
  );
115
  }
@@ -128,7 +126,6 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
128
  CURLOPT_FRESH_CONNECT => 1,
129
  CURLOPT_RETURNTRANSFER => 1,
130
  CURLOPT_FORBID_REUSE => 1,
131
- CURLOPT_TIMEOUT => 60,
132
  )
133
  );
134
  }
@@ -147,6 +144,12 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
147
  if (!in_array(CURLOPT_USERAGENT, $curlOptions) && $this->userAgent) {
148
  $curlOptions[CURLOPT_USERAGENT] = $this->userAgent;
149
  }
 
 
 
 
 
 
150
  $ch = curl_init();
151
  curl_setopt_array($ch, $curlOptions);
152
  $result = curl_exec($ch);
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
70
  CURLOPT_FRESH_CONNECT => 1,
71
  CURLOPT_RETURNTRANSFER => 1,
72
  CURLOPT_FORBID_REUSE => 1,
73
+ )
 
74
  );
75
  }
76
 
89
  CURLOPT_FRESH_CONNECT => 1,
90
  CURLOPT_RETURNTRANSFER => 1,
91
  CURLOPT_FORBID_REUSE => 1,
 
92
  )
93
  );
94
  }
108
  CURLOPT_FRESH_CONNECT => 1,
109
  CURLOPT_RETURNTRANSFER => 1,
110
  CURLOPT_FORBID_REUSE => 1,
 
111
  )
112
  );
113
  }
126
  CURLOPT_FRESH_CONNECT => 1,
127
  CURLOPT_RETURNTRANSFER => 1,
128
  CURLOPT_FORBID_REUSE => 1,
 
129
  )
130
  );
131
  }
144
  if (!in_array(CURLOPT_USERAGENT, $curlOptions) && $this->userAgent) {
145
  $curlOptions[CURLOPT_USERAGENT] = $this->userAgent;
146
  }
147
+ if (!in_array(CURLOPT_TIMEOUT, $curlOptions)) {
148
+ $curlOptions[CURLOPT_TIMEOUT] = NostoHttpRequest::$responseTimeout;
149
+ }
150
+ if (!in_array(CURLOPT_CONNECTTIMEOUT, $curlOptions)) {
151
+ $curlOptions[CURLOPT_CONNECTTIMEOUT] = NostoHttpRequest::$connectTimeout;
152
+ }
153
  $ch = curl_init();
154
  curl_setopt_array($ch, $curlOptions);
155
  $result = curl_exec($ch);
lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -149,6 +150,9 @@ class NostoHttpRequestAdapterSocket extends NostoHttpRequestAdapter
149
  if (!array_key_exists('user_agent', $streamOptions['http']) && $this->userAgent) {
150
  $streamOptions['http']['user_agent'] = $this->userAgent;
151
  }
 
 
 
152
  $context = stream_context_create($streamOptions);
153
  // We use file_get_contents() directly here as we need the http response headers which are automatically
154
  // populated into $headers, which is only available in the local scope where file_get_contents()
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
150
  if (!array_key_exists('user_agent', $streamOptions['http']) && $this->userAgent) {
151
  $streamOptions['http']['user_agent'] = $this->userAgent;
152
  }
153
+ if (!array_key_exists('timeout', $streamOptions['http'])) {
154
+ $streamOptions['http']['timeout'] = NostoHttpRequest::$responseTimeout;
155
+ }
156
  $context = stream_context_create($streamOptions);
157
  // We use file_get_contents() directly here as we need the http response headers which are automatically
158
  // populated into $headers, which is only available in the local scope where file_get_contents()
lib/nosto/php-sdk/src/classes/http/NostoHttpResponse.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -56,7 +57,7 @@ class NostoHttpResponse
56
  /**
57
  * @var int runtime cache for the http response code.
58
  */
59
- private $_code;
60
 
61
  /**
62
  * Constructor.
@@ -117,7 +118,7 @@ class NostoHttpResponse
117
  */
118
  public function getCode()
119
  {
120
- if (is_null($this->_code)) {
121
  $code = 0;
122
  if (!empty($this->headers)) {
123
  foreach ($this->headers as $header) {
@@ -128,9 +129,9 @@ class NostoHttpResponse
128
  }
129
  }
130
  }
131
- $this->_code = $code;
132
  }
133
- return $this->_code;
134
  }
135
 
136
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
57
  /**
58
  * @var int runtime cache for the http response code.
59
  */
60
+ private $code;
61
 
62
  /**
63
  * Constructor.
118
  */
119
  public function getCode()
120
  {
121
+ if (is_null($this->code)) {
122
  $code = 0;
123
  if (!empty($this->headers)) {
124
  foreach ($this->headers as $header) {
129
  }
130
  }
131
  }
132
+ $this->code = $code;
133
  }
134
+ return $this->code;
135
  }
136
 
137
  /**
lib/nosto/php-sdk/src/classes/oauth/NostoOAuthClient.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -39,8 +40,8 @@
39
  */
40
  class NostoOAuthClient
41
  {
42
- const PATH_AUTH = '?client_id={cid}&redirect_uri={uri}&response_type=code&scope={sco}&lang={iso}';
43
- const PATH_TOKEN = '/token?code={cod}&client_id={cid}&client_secret={sec}&redirect_uri={uri}&grant_type=authorization_code';
44
 
45
  /**
46
  * @var string the nosto oauth endpoint base url.
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
40
  */
41
  class NostoOAuthClient
42
  {
43
+ const PATH_AUTH = '?client_id={cid}&redirect_uri={uri}&response_type=code&scope={sco}&lang={iso}'; // @codingStandardsIgnoreLine
44
+ const PATH_TOKEN = '/token?code={cod}&client_id={cid}&client_secret={sec}&redirect_uri={uri}&grant_type=authorization_code'; // @codingStandardsIgnoreLine
45
 
46
  /**
47
  * @var string the nosto oauth endpoint base url.
lib/nosto/php-sdk/src/classes/oauth/NostoOAuthToken.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php CHANGED
@@ -31,6 +31,7 @@
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -74,11 +75,13 @@ class NostoOperationExchangeRate
74
  $request = $this->initApiRequest();
75
  $response = $request->post($this->getCollectionAsJson());
76
  if ($response->getCode() !== 200) {
77
- throw new NostoException(
78
  sprintf(
79
  'Failed to update currencyCode exchange rates for account %s.',
80
  $this->account->getName()
81
- )
 
 
82
  );
83
  }
84
  return true;
@@ -94,7 +97,7 @@ class NostoOperationExchangeRate
94
  {
95
  $token = $this->account->getApiToken(NostoApiToken::API_EXCHANGE_RATES);
96
  if (is_null($token)) {
97
- throw new NostoException(
98
  sprintf(
99
  'No `%s` API token found for account "%s".',
100
  NostoApiToken::API_EXCHANGE_RATES,
@@ -142,7 +145,7 @@ class NostoOperationExchangeRate
142
  );
143
  }
144
  if (empty($data['rates'])) {
145
- throw new NostoException(
146
  sprintf(
147
  'Failed to update currencyCode exchange rates for account %s. No rates found in collection.',
148
  $this->account->getName()
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
  * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
75
  $request = $this->initApiRequest();
76
  $response = $request->post($this->getCollectionAsJson());
77
  if ($response->getCode() !== 200) {
78
+ Nosto::throwHttpException(
79
  sprintf(
80
  'Failed to update currencyCode exchange rates for account %s.',
81
  $this->account->getName()
82
+ ),
83
+ $request,
84
+ $response
85
  );
86
  }
87
  return true;
97
  {
98
  $token = $this->account->getApiToken(NostoApiToken::API_EXCHANGE_RATES);
99
  if (is_null($token)) {
100
+ Nosto::throwException(
101
  sprintf(
102
  'No `%s` API token found for account "%s".',
103
  NostoApiToken::API_EXCHANGE_RATES,
145
  );
146
  }
147
  if (empty($data['rates'])) {
148
+ Nosto::throwException(
149
  sprintf(
150
  'Failed to update currencyCode exchange rates for account %s. No rates found in collection.',
151
  $this->account->getName()
lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -180,32 +181,34 @@ class NostoOperationProduct
180
  * 'tag1' => array('Men'),
181
  * 'tag2' => array('Foldable'),
182
  * 'tag3' => array('Brown', 'Black', 'Orange'),
183
- * 'date_published' => '2011-12-31'
184
  * )
185
  *
186
  * @param NostoProductInterface $product the object.
187
  * @return array the newly created array.
188
  */
189
- protected function getProductAsArray(NostoProductInterface $product)
190
  {
 
 
191
  $data = array(
192
  'url' => $product->getUrl(),
193
  'product_id' => $product->getProductId(),
194
  'name' => $product->getName(),
195
  'image_url' => $product->getImageUrl(),
196
- 'price' => Nosto::helper('price')->format($product->getPrice()),
197
  'price_currency_code' => strtoupper($product->getCurrencyCode()),
198
  'availability' => $product->getAvailability(),
199
  'categories' => $product->getCategories(),
200
  );
201
 
202
  // Optional properties.
203
-
204
  if ($product->getFullDescription()) {
205
  $data['description'] = $product->getFullDescription();
206
  }
207
  if ($product->getListPrice()) {
208
- $data['list_price'] = Nosto::helper('price')->format($product->getListPrice());
 
 
209
  }
210
  if ($product->getBrand()) {
211
  $data['brand'] = $product->getBrand();
@@ -215,12 +218,54 @@ class NostoOperationProduct
215
  $data[$type] = $tags;
216
  }
217
  }
218
- if ($product->getDatePublished()) {
219
- $data['date_published'] = Nosto::helper('date')->format($product->getDatePublished());
220
- }
221
  if ($product->getVariationId()) {
222
  $data['variation_id'] = $product->getVariationId();
223
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  return $data;
226
  }
@@ -238,7 +283,7 @@ class NostoOperationProduct
238
  /** @var NostoProductInterface|NostoValidatableInterface $item */
239
  $validator = new NostoValidator($item);
240
  if ($validator->validate()) {
241
- $data[] = $this->getProductAsArray($item);
242
  }
243
  }
244
  if (empty($data)) {
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
181
  * 'tag1' => array('Men'),
182
  * 'tag2' => array('Foldable'),
183
  * 'tag3' => array('Brown', 'Black', 'Orange'),
 
184
  * )
185
  *
186
  * @param NostoProductInterface $product the object.
187
  * @return array the newly created array.
188
  */
189
+ public static function getProductAsArray(NostoProductInterface $product)
190
  {
191
+ /* @var NostoHelperPrice $nostoPriceHelper */
192
+ $nostoPriceHelper = Nosto::helper('price');
193
  $data = array(
194
  'url' => $product->getUrl(),
195
  'product_id' => $product->getProductId(),
196
  'name' => $product->getName(),
197
  'image_url' => $product->getImageUrl(),
198
+ 'price' => $nostoPriceHelper->format($product->getPrice()),
199
  'price_currency_code' => strtoupper($product->getCurrencyCode()),
200
  'availability' => $product->getAvailability(),
201
  'categories' => $product->getCategories(),
202
  );
203
 
204
  // Optional properties.
 
205
  if ($product->getFullDescription()) {
206
  $data['description'] = $product->getFullDescription();
207
  }
208
  if ($product->getListPrice()) {
209
+ $data['list_price'] = $nostoPriceHelper->format(
210
+ $product->getListPrice()
211
+ );
212
  }
213
  if ($product->getBrand()) {
214
  $data['brand'] = $product->getBrand();
218
  $data[$type] = $tags;
219
  }
220
  }
 
 
 
221
  if ($product->getVariationId()) {
222
  $data['variation_id'] = $product->getVariationId();
223
  }
224
+ if ($product->getSupplierCost()) {
225
+ $data['supplier_cost'] = $nostoPriceHelper->format(
226
+ $product->getSupplierCost()
227
+ );
228
+ }
229
+ if ($product->getInventoryLevel()) {
230
+ $data['inventory_level'] = $product->getInventoryLevel();
231
+ }
232
+ if ($product->getReviewCount()) {
233
+ $data['review_count'] = $product->getReviewCount();
234
+ }
235
+ if ($product->getRatingValue()) {
236
+ $data['rating_value'] = $product->getRatingValue();
237
+ }
238
+ if (
239
+ is_array($product->getAlternateImageUrls())
240
+ && count($product->getAlternateImageUrls() > 0)
241
+ ) {
242
+ $data['alternate_image_urls'] = $product->getAlternateImageUrls();
243
+ }
244
+ if ($product->getCondition()) {
245
+ $data['condition'] = $product->getCondition();
246
+ }
247
+ if ($product->getGender()) {
248
+ $data['gender'] = $product->getGender();
249
+ }
250
+ if ($product->getAgeGroup()) {
251
+ $data['age_group'] = $product->getAgeGroup();
252
+ }
253
+ if ($product->getGtin()) {
254
+ $data['gtin'] = $product->getGtin();
255
+ }
256
+ if ($product->getGoogleCategory()) {
257
+ $data['google_category'] = $product->getGoogleCategory();
258
+ }
259
+ if ($product->getUnitPricingMeasure()) {
260
+ $data['unit_pricing_measure'] = $product->getUnitPricingMeasure();
261
+ }
262
+ if ($product->getUnitPricingBaseMeasure()) {
263
+ $data['unit_pricing_base_measure']
264
+ = $product->getUnitPricingBaseMeasure();
265
+ }
266
+ if ($product->getUnitPricingUnit()) {
267
+ $data['unit_pricing_unit'] = $product->getUnitPricingUnit();
268
+ }
269
 
270
  return $data;
271
  }
283
  /** @var NostoProductInterface|NostoValidatableInterface $item */
284
  $validator = new NostoValidator($item);
285
  if ($validator->validate()) {
286
+ $data[] = self::getProductAsArray($item);
287
  }
288
  }
289
  if (empty($data)) {
lib/nosto/php-sdk/src/config.inc.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  // Interfaces
@@ -50,6 +51,7 @@ require_once(dirname(__FILE__).'/interfaces/NostoProductInterface.php');
50
  require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
51
  require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
52
  require_once(dirname(__FILE__).'/interfaces/NostoExchangeRateInterface.php');
 
53
 
54
  // Classes
55
  require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
@@ -65,6 +67,8 @@ require_once(dirname(__FILE__).'/classes/collection/NostoExchangeRateCollection.
65
 
66
  require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
67
  require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
 
 
68
 
69
  require_once(dirname(__FILE__).'/classes/export/NostoExporter.php');
70
  require_once(dirname(__FILE__).'/classes/export/NostoExportProductCollection.php');
@@ -102,6 +106,7 @@ require_once(dirname(__FILE__).'/classes/NostoCurrencyCode.php');
102
  require_once(dirname(__FILE__).'/classes/NostoCurrencySymbol.php');
103
  require_once(dirname(__FILE__).'/classes/NostoCurrencyFormat.php');
104
  require_once(dirname(__FILE__).'/classes/NostoCurrencyInfo.php');
 
105
 
106
  // Libs
107
  require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  // Interfaces
51
  require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
52
  require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
53
  require_once(dirname(__FILE__).'/interfaces/NostoExchangeRateInterface.php');
54
+ require_once(dirname(__FILE__).'/interfaces/NostoNotificationInterface.php');
55
 
56
  // Classes
57
  require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
67
 
68
  require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
69
  require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
70
+ require_once(dirname(__FILE__).'/classes/exception/NostoHttpResponseException.php');
71
+ require_once(dirname(__FILE__).'/classes/exception/NostoApiResponseException.php');
72
 
73
  require_once(dirname(__FILE__).'/classes/export/NostoExporter.php');
74
  require_once(dirname(__FILE__).'/classes/export/NostoExportProductCollection.php');
106
  require_once(dirname(__FILE__).'/classes/NostoCurrencySymbol.php');
107
  require_once(dirname(__FILE__).'/classes/NostoCurrencyFormat.php');
108
  require_once(dirname(__FILE__).'/classes/NostoCurrencyInfo.php');
109
+ require_once(dirname(__FILE__).'/classes/NostoNotification.php');
110
 
111
  // Libs
112
  require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/NostoExportCollectionInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/NostoNotificationInterface.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 2013-2016 Nosto Solutions Ltd
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to contact@nosto.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18
+ * versions in the future. If you wish to customize PrestaShop for your
19
+ * needs please refer to http://www.prestashop.com for more information.
20
+ *
21
+ * @author Nosto Solutions Ltd <contact@nosto.com>
22
+ * @copyright 2013-2016 Nosto Solutions Ltd
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ /**
27
+ * Interface for Nosto notification.
28
+ * The client implements the "Authorization Code" OAuth2 spec.
29
+ * @see https://tools.ietf.org/html/rfc6749
30
+ */
31
+ interface NostoNotificationInterface
32
+ {
33
+ /*
34
+ * Notification severities
35
+ */
36
+ const SEVERITY_INFO = 'info';
37
+ const SEVERITY_WARNING = 'warning';
38
+ const SEVERITY_ERROR = 'error';
39
+
40
+ /*
41
+ * Notification types
42
+ */
43
+ const TYPE_MISSING_INSTALLATION = 'missing_installation';
44
+ const TYPE_MISSING_TOKENS = 'missing_tokens';
45
+ const TYPE_MULTI_CURRENCY_DISABLED = 'multi_currency_disabled';
46
+
47
+ /**
48
+ * The id of the store
49
+ *
50
+ * @return string|int the client id.
51
+ */
52
+ public function getStoreId();
53
+
54
+ /**
55
+ * The name of the store.
56
+ *
57
+ * @return string the client secret.
58
+ */
59
+ public function getStoreName();
60
+
61
+ /**
62
+ * The id of the language
63
+ *
64
+ * @return string|int
65
+ */
66
+ public function getLanguageId();
67
+
68
+ /**
69
+ * The name of the language.
70
+ *
71
+ * @return string
72
+ */
73
+ public function getLanguageName();
74
+
75
+ /**
76
+ * The notification message.
77
+ *
78
+ * @return string
79
+ */
80
+ public function getMessage();
81
+
82
+ /**
83
+ * The message attributes for sprintf. Array must contain only scalar values.
84
+ *
85
+ * @return array
86
+ */
87
+ public function getMessageAttributes();
88
+
89
+ /**
90
+ * The notification type
91
+ *
92
+ * For return values
93
+ * @see self::TYPE_*
94
+ *
95
+ * @return int
96
+ */
97
+ public function getNotificationType();
98
+
99
+ /**
100
+ * The notification severity
101
+ *
102
+ * For return values
103
+ * @see self::SEVERITY_*
104
+ *
105
+ * @return int
106
+ */
107
+ public function getNotificationSeverity();
108
+ }
lib/nosto/php-sdk/src/interfaces/NostoOAuthClientMetaDataInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -39,6 +40,12 @@
39
  */
40
  interface NostoProductInterface
41
  {
 
 
 
 
 
 
42
  /**
43
  * Returns the absolute url to the product page in the shop frontend.
44
  *
@@ -139,16 +146,103 @@ interface NostoProductInterface
139
  public function getBrand();
140
 
141
  /**
142
- * Returns the product publication date in the shop.
143
  *
144
- * @return string the date in format "Y-m-d".
145
  */
146
- public function getDatePublished();
147
 
148
  /**
149
- * Returns the product variation id.
150
  *
151
- * @return mixed|null
152
  */
153
- public function getVariationId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
40
  */
41
  interface NostoProductInterface
42
  {
43
+ const IN_STOCK = 'InStock';
44
+ const OUT_OF_STOCK = 'OutOfStock';
45
+ const INVISIBLE = 'Invisible';
46
+ const DISCONTINUED = 'Discontinued';
47
+ const ADD_TO_CART = 'add-to-cart';
48
+
49
  /**
50
  * Returns the absolute url to the product page in the shop frontend.
51
  *
146
  public function getBrand();
147
 
148
  /**
149
+ * Returns the product variation id.
150
  *
151
+ * @return mixed|null
152
  */
153
+ public function getVariationId();
154
 
155
  /**
156
+ * Returns the supplier cost
157
  *
158
+ * @return float|null
159
  */
160
+ public function getSupplierCost();
161
+
162
+ /**
163
+ * Returns the inventory level
164
+ *
165
+ * @return int|null
166
+ */
167
+ public function getInventoryLevel();
168
+
169
+ /**
170
+ * Returns the count of reviews
171
+ *
172
+ * @return int|null
173
+ */
174
+ public function getReviewCount();
175
+
176
+ /**
177
+ * Returns the value of the rating(s)
178
+ *
179
+ * @return float|null
180
+ */
181
+ public function getRatingValue();
182
+
183
+ /**
184
+ * Returns the alternative images
185
+ *
186
+ * @return array|null
187
+ */
188
+ public function getAlternateImageUrls();
189
+
190
+ /**
191
+ * Returns the condition
192
+ *
193
+ * @return string|null
194
+ */
195
+ public function getCondition();
196
+
197
+ /**
198
+ * Returns the gender
199
+ *
200
+ * @return string|null
201
+ */
202
+ public function getGender();
203
+
204
+ /**
205
+ * Returns the age group
206
+ *
207
+ * @return string|null
208
+ */
209
+ public function getAgeGroup();
210
+
211
+ /**
212
+ * Returns the gtin / barcode
213
+ *
214
+ * @return string|null
215
+ */
216
+ public function getGtin();
217
+
218
+ /**
219
+ * Returns the category used for Google's services
220
+ *
221
+ * @return string|null
222
+ */
223
+ public function getGoogleCategory();
224
+
225
+ /**
226
+ * Returns the pricing measure of the product. Pricing measure for a 0.33
227
+ * liter bottle for example is "0.33".
228
+ *
229
+ * @return float|null
230
+ */
231
+ public function getUnitPricingMeasure();
232
+
233
+ /**
234
+ * Returns the pricing base measure of the product. Pricing base measure
235
+ * for a 0.33l bottle is "1".
236
+ *
237
+ * @return float|null
238
+ */
239
+ public function getUnitPricingBaseMeasure();
240
+
241
+ /**
242
+ * Returns the pricing unit of the product. Pricing unit for a 0.33l
243
+ * bottle is "l" (litre).
244
+ *
245
+ * @return string|null
246
+ */
247
+ public function getUnitPricingUnit();
248
  }
lib/nosto/php-sdk/src/interfaces/NostoValidatableInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/account/NostoAccountInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -73,12 +74,27 @@ interface NostoAccountInterface
73
  public function getName();
74
 
75
  /**
76
- * Checks if this account has been connected to Nosto, i.e. all API tokens exist.
 
77
  *
78
  * @return bool true if it is connected, false otherwise.
79
  */
80
  public function isConnectedToNosto();
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Gets an api token associated with this account by it's name , e.g. "sso".
84
  *
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
74
  public function getName();
75
 
76
  /**
77
+ * Checks if this account has been connected to Nosto,
78
+ * i.e. all mandatory API tokens exist.
79
  *
80
  * @return bool true if it is connected, false otherwise.
81
  */
82
  public function isConnectedToNosto();
83
 
84
+ /**
85
+ * Checks if this account has all API tokens
86
+ *
87
+ * @return bool true if some token(s) are missing, false otherwise.
88
+ */
89
+ public function hasMissingTokens();
90
+
91
+ /**
92
+ * Returns the missing API tokens
93
+ *
94
+ * @return array
95
+ */
96
+ public function getMissingTokens();
97
+
98
  /**
99
  * Gets an api token associated with this account by it's name , e.g. "sso".
100
  *
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataBillingDetailsInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataIframeInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -142,4 +143,11 @@ interface NostoAccountMetaDataInterface
142
  * @return string
143
  */
144
  public function getDefaultVariationId();
 
 
 
 
 
 
 
145
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
143
  * @return string
144
  */
145
  public function getDefaultVariationId();
146
+
147
+ /**
148
+ * Returns the account details
149
+ *
150
+ * @return string
151
+ */
152
+ public function getDetails();
153
  }
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataOwnerInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/order/NostoOrderBuyerInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/order/NostoOrderInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
@@ -80,4 +81,11 @@ interface NostoOrderInterface
80
  * @return NostoOrderStatusInterface the model.
81
  */
82
  public function getOrderStatus();
 
 
 
 
 
 
 
83
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
81
  * @return NostoOrderStatusInterface the model.
82
  */
83
  public function getOrderStatus();
84
+
85
+ /**
86
+ * Returns the external order ref.
87
+ *
88
+ * @return string the external order ref.
89
+ */
90
+ public function getExternalOrderRef();
91
  }
lib/nosto/php-sdk/src/interfaces/order/NostoOrderPurchasedItemInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/interfaces/order/NostoOrderStatusInterface.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2015, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
@@ -29,8 +29,9 @@
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
- * @copyright 2015 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
34
  */
35
 
36
  /**
1
  <?php
2
  /**
3
+ * Copyright (c) 2016, Nosto Solutions Ltd
4
  * All rights reserved.
5
  *
6
  * Redistribution and use in source and binary forms, with or without modification,
29
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
  *
31
  * @author Nosto Solutions Ltd <contact@nosto.com>
32
+ * @copyright 2016 Nosto Solutions Ltd
33
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
34
+ *
35
  */
36
 
37
  /**
lib/nosto/php-sdk/src/js/src/NostoIframe.js CHANGED
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) 2015, Nosto Solutions Ltd
3
  * All rights reserved.
4
  *
5
  * Redistribution and use in source and binary forms, with or without modification,
@@ -28,8 +28,9 @@
28
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
  *
30
  * @author Nosto Solutions Ltd <contact@nosto.com>
31
- * @copyright 2015 Nosto Solutions Ltd
32
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 
33
  */
34
 
35
  // Define the "Nosto" namespace if not already defined.
1
+ /*
2
+ * Copyright (c) 2016, Nosto Solutions Ltd
3
  * All rights reserved.
4
  *
5
  * Redistribution and use in source and binary forms, with or without modification,
28
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
  *
30
  * @author Nosto Solutions Ltd <contact@nosto.com>
31
+ * @copyright 2016 Nosto Solutions Ltd
32
  * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
33
+ *
34
  */
35
 
36
  // Define the "Nosto" namespace if not already defined.
package.xml CHANGED
@@ -1,14 +1,14 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Nosto_Tagging</name>
4
- <version>2.6.14</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Personalization for Magento</summary>
10
  <description>Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.</description>
11
- <notes>- Bug fixes</notes>
12
  <authors>
13
  <author>
14
  <name>Nosto</name>
@@ -16,106 +16,162 @@
16
  <email>magento@nosto.com</email>
17
  </author>
18
  </authors>
19
- <date>2016-05-13</date>
20
- <time>14:15:56</time>
21
  <contents>
22
  <target name="magecommunity">
23
  <dir name="Nosto">
24
  <dir name="Tagging">
25
  <dir name="Block">
26
- <file name="Addtocart.php" hash="61d645e5cc9e54a5170ae03797f0426a"/>
27
  <dir name="Adminhtml">
28
- <file name="Iframe.php" hash="f9e8bc4dcdff141b2f070777d025960d"/>
29
- <file name="Wizard.php" hash="f98931a1a6e327c0d05e43b73063f672"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  </dir>
31
- <file name="Cart.php" hash="c1c707dad76c98d807d5160b90c06ac6"/>
32
- <file name="Category.php" hash="177a5d8d9f1ba9e246d149c228c3aec8"/>
33
- <file name="Customer.php" hash="d35777ca399244e4fb441456320f8ad7"/>
34
- <file name="Element.php" hash="e5b12bb118b92eb7075ff7a6e16e0eba"/>
35
- <file name="Embed.php" hash="e8b628b6bc49fb865697552300d08526"/>
36
- <file name="Meta.php" hash="1f761e731214b7572ef139d9e0577ea1"/>
37
- <file name="Order.php" hash="32115070d380e654f093da11dd6e4d85"/>
38
- <file name="Product.php" hash="ac7b85e6d03d94d03c59416b622b0039"/>
39
- <file name="Searchterm.php" hash="884cbca118486d922e73821242d8fc83"/>
40
  </dir>
41
  <dir name="Helper">
42
- <file name="Account.php" hash="30f3d55fb86876108a0440ffc3153610"/>
43
- <file name="Customer.php" hash="8faa27321f26ece8ff5ebf12058f546f"/>
44
- <file name="Data.php" hash="11b848036443a431eafbbd155b72e40d"/>
45
- <file name="Date.php" hash="1a108a4ec8169b73411b6c11b86a1d80"/>
46
- <file name="Oauth.php" hash="d8932bd97b03116774e7aaac62a25103"/>
47
- <file name="Price.php" hash="364bb50e9ee5453a4d61bf3e484cd894"/>
48
- <file name="Url.php" hash="289294904d246c56e4de96798927a7f6"/>
 
 
 
 
49
  </dir>
50
  <dir name="Model">
51
- <file name="Base.php" hash="c4246068fa6667578188a8c1fc289334"/>
 
 
 
52
  <dir name="Container">
53
- <file name="Cart.php" hash="20d2936693361999575f1e6ac56f2e40"/>
54
- <file name="Customer.php" hash="b03bca89845b6c939521add8df1f7e9a"/>
55
  </dir>
56
- <file name="Customer.php" hash="6d992a43a75f29836ed1450e130df560"/>
57
  <dir name="Export">
58
  <dir name="Collection">
59
- <file name="Order.php" hash="29c370bdfcaedab833df0abcc83f9f32"/>
60
  </dir>
61
  </dir>
62
  <dir name="Meta">
63
  <dir name="Account">
64
- <file name="Billing.php" hash="353e807f832a37591bf7359857044ca1"/>
65
- <file name="Iframe.php" hash="731e2bf424e1b9d4e00d403f55a87b54"/>
66
- <file name="Owner.php" hash="6fd3228a2758d06f78729c0250f7fd30"/>
67
  </dir>
68
- <file name="Account.php" hash="8bfa659be33a3dd3eeabe4846bdb14c4"/>
69
- <file name="Oauth.php" hash="0863271d8a3db0de93525f0e64308f1c"/>
70
  <dir name="Order">
71
- <file name="Buyer.php" hash="45ee761ba052ef3372846c22e28921d8"/>
72
- <file name="Item.php" hash="d28e1c901b168ad381696dde605551db"/>
73
- <file name="Status.php" hash="795b2e53be043aeb0b27bbd500e2c412"/>
 
 
 
 
 
74
  </dir>
75
- <file name="Order.php" hash="1a5d115199f87ead195e0b3510ab1439"/>
76
- <file name="Product.php" hash="0c06e4a7dfd59522f267c825fa37c357"/>
77
  </dir>
78
- <file name="Observer.php" hash="dc91cb5a878ca1fb85b402883a68382f"/>
79
- <file name="Product.php" hash="3630a2a688f013b296d1865e6f32e1d2"/>
80
  <dir name="Resource">
81
  <dir name="Customer">
82
- <file name="Collection.php" hash="0c99b46d5108a6fe31cad1190d8ef47c"/>
83
  </dir>
84
- <file name="Customer.php" hash="f92e4e5334b5e3493e8f04664b20f105"/>
85
  <dir name="Product">
86
- <file name="Collection.php" hash="fe8114fbccd62fe3a0bca18732e5d852"/>
87
  </dir>
88
- <file name="Setup.php" hash="506b08bcb10cbe74e95812c5f646429f"/>
89
  </dir>
90
  <dir name="Service">
91
- <file name="Order.php" hash="63670c0cb5d3cc0804e13e90b47afbb8"/>
92
  </dir>
93
  <dir name="System">
94
  <dir name="Config">
 
 
 
 
 
 
 
 
 
95
  <dir name="Source">
96
- <file name="Image.php" hash="d1fcc96aab01342627b96edf6fad1dd1"/>
 
 
 
 
 
 
 
 
 
 
 
 
97
  </dir>
98
  </dir>
99
  </dir>
100
  </dir>
101
- <file name="bootstrap.php" hash="366135b22b216e1167118021dbf2aacf"/>
102
  <dir name="controllers">
103
  <dir name="Adminhtml">
104
- <file name="NostoController.php" hash="fc79c34f2c363911d47e49207716d6b0"/>
105
  </dir>
106
- <file name="ExportController.php" hash="0e0c8972da54575e8b73c9adb9830c81"/>
107
- <file name="OauthController.php" hash="78a92e0e413bb6d7f2e8eaf594a40f1d"/>
108
  </dir>
109
  <dir name="etc">
110
- <file name="adminhtml.xml" hash="7ea210738a77630f299a14b442f3b8d0"/>
111
- <file name="cache.xml" hash="e874fbbf2eb89b325deb1a62afbcfb4d"/>
112
- <file name="config.xml" hash="caa04383a2d6c212878c966b403e8cb9"/>
113
- <file name="system.xml" hash="7deba6544a09d7af8c07e6b5edc0975a"/>
114
  </dir>
115
  <dir name="sql">
 
 
 
 
116
  <dir name="tagging_setup">
117
- <file name="mysql4-install-1.2.0.php" hash="3cbc52834c44870859562eec7969b9fd"/>
118
- <file name="mysql4-upgrade-1.1.7-1.2.0.php" hash="0d8eb7990461a9d4b74b479120067aeb"/>
119
  </dir>
120
  </dir>
121
  </dir>
@@ -126,12 +182,21 @@
126
  <dir name="default">
127
  <dir name="default">
128
  <dir name="layout">
129
- <file name="nostotagging.xml" hash="81c0aa3f71e1c509475410e8ec017214"/>
130
  </dir>
131
  <dir name="template">
132
  <dir name="nostotagging">
133
- <file name="iframe.phtml" hash="8b6a8faca7d5ab5240b9411993021ca8"/>
134
- <file name="wizard.phtml" hash="3f92e94e5ee3d3cd9906a6b0942a3a1b"/>
 
 
 
 
 
 
 
 
 
135
  </dir>
136
  </dir>
137
  </dir>
@@ -141,23 +206,23 @@
141
  <dir name="base">
142
  <dir name="default">
143
  <dir name="layout">
144
- <file name="nostotagging.xml" hash="7d69705eb6a9cce411671b792ec2b08b"/>
145
  </dir>
146
  <dir name="template">
147
  <dir name="nostotagging">
148
- <file name="addtocart.phtml" hash="e8776f59ec4c7c7b6eea2fae9d56e2a4"/>
149
- <file name="cart.phtml" hash="fe8a33cf63709d05e4be388b0a92addf"/>
150
- <dir name="category">
151
- <file name="view.phtml" hash="fc09e2770ad6281ec96c8e92accc01f1"/>
152
- </dir>
153
- <file name="category.phtml" hash="81f36742cb4e3adbf9f692cc8f0ea8a8"/>
154
- <file name="customer.phtml" hash="e9bc92bb7f7df989cc706c7eaee3614a"/>
155
- <file name="element.phtml" hash="e1d38981789e632a3607ccf2e171f0cb"/>
156
- <file name="embed.phtml" hash="9193ddd1ae373b68c53f8364f511b0a5"/>
157
- <file name="meta.phtml" hash="c1b862a4993503fae420fb0eba194b00"/>
158
- <file name="order.phtml" hash="a7940109561b6ec9d74c8a566d24c3f3"/>
159
- <file name="product.phtml" hash="9df3ff9f6e363e478d7fd68bd09827b1"/>
160
- <file name="searchterm.phtml" hash="5a61837f4d4b787e24c6133afd43a507"/>
161
  </dir>
162
  </dir>
163
  </dir>
@@ -166,7 +231,7 @@
166
  </target>
167
  <target name="mageetc">
168
  <dir name="modules">
169
- <file name="Nosto_Tagging.xml" hash="1705cb7e6db28388662ef52882d61701"/>
170
  </dir>
171
  </target>
172
  <target name="magelib">
@@ -174,89 +239,93 @@
174
  <dir name="php-sdk">
175
  <dir name="src">
176
  <dir name="classes">
177
- <file name="Nosto.php" hash="c595c5f646f6e513b6604848f8d10118"/>
178
- <file name="NostoAccount.php" hash="c422a7f104c5ebc6eac9d83986280579"/>
179
- <file name="NostoAccountMeta.php" hash="8a30b97aaf66823ff554ba4ea6956cad"/>
180
- <file name="NostoCipher.php" hash="a3d7d148311aa0319387c0918e5e26dc"/>
181
- <file name="NostoCurrency.php" hash="e1b92eb7f46c51c83abb2afe34a30c3b"/>
182
- <file name="NostoCurrencyCode.php" hash="70849a5592e559ae88c5648930055905"/>
183
- <file name="NostoCurrencyFormat.php" hash="dc1f0bc1dff3d855ff3fcea970ea16ab"/>
184
- <file name="NostoCurrencyInfo.php" hash="4706d8e1de526d2a5fe2755028ff887b"/>
185
- <file name="NostoCurrencySymbol.php" hash="9b84b959987edb5b8c8fbf49e3d2df2e"/>
186
- <file name="NostoDotEnv.php" hash="90b23c1b02095c9368372f1d5346c3f9"/>
187
- <file name="NostoExchangeRate.php" hash="f23f06c5bc1bcda5e4164edd8a0b6ca7"/>
188
- <file name="NostoMessage.php" hash="5933eadd2ad08427010b0bf16657266b"/>
189
- <file name="NostoObject.php" hash="187808f0c55d02294d41e9395f4c5d58"/>
190
- <file name="NostoOrderConfirmation.php" hash="2a3fd5efb196bc0dcb7ad57fb61a81d0"/>
191
- <file name="NostoProductReCrawl.php" hash="f370c539409dd74fc98b7aa1ea0f6387"/>
192
- <file name="NostoValidator.php" hash="2096ddc9979ec77f8f0b1ec58b459329"/>
 
193
  <dir name="api">
194
- <file name="NostoApiRequest.php" hash="fd6d7d1b33137a7b7eaef5edbd50e2ec"/>
195
- <file name="NostoApiToken.php" hash="72f179170de6c469b8d8e97d40d0aec4"/>
196
  </dir>
197
  <dir name="collection">
198
- <file name="NostoCollection.php" hash="35cea0282628354413f629062b58663a"/>
199
- <file name="NostoExchangeRateCollection.php" hash="28bd7b287b825a780300b2b3790c8209"/>
200
- <file name="NostoOrderCollection.php" hash="db6f517948c1258e1521ceb1ce49d477"/>
201
- <file name="NostoProductCollection.php" hash="3ae29dbbcb7effa234fa83461d3e6901"/>
202
  </dir>
203
  <dir name="exception">
204
- <file name="NostoException.php" hash="c4610fb70278d01bd85bc83b8e74df30"/>
205
- <file name="NostoHttpException.php" hash="dabf4298746db898c8fe709ea9e25818"/>
 
 
206
  </dir>
207
  <dir name="export">
208
- <file name="NostoExportOrderCollection.php" hash="91bdd99a2be75be062fe5c7cde1803e4"/>
209
- <file name="NostoExportProductCollection.php" hash="3be4f5974cf15adc1f79136566efaf48"/>
210
- <file name="NostoExporter.php" hash="72ad0af4bce8e57ada5a29e3634df94f"/>
211
  </dir>
212
  <dir name="helper">
213
- <file name="NostoHelper.php" hash="f4ca6c78e047fec93c32b7eb822b0692"/>
214
- <file name="NostoHelperDate.php" hash="081a2d8bfec710f2baa52192a99a2658"/>
215
- <file name="NostoHelperIframe.php" hash="303668f25103c245396b43811a15c28d"/>
216
- <file name="NostoHelperPrice.php" hash="ee9f217dc1b8e0fc679fb56ca3fd3ca1"/>
217
  </dir>
218
  <dir name="http">
219
- <file name="NostoHttpRequest.php" hash="46cc219301911bd29383d7efd559a4cf"/>
220
- <file name="NostoHttpRequestAdapter.php" hash="d8bf8e5db44ad982b655372529f4d88c"/>
221
- <file name="NostoHttpRequestAdapterCurl.php" hash="0af177b860f6aef58b69154ec2f7c988"/>
222
- <file name="NostoHttpRequestAdapterSocket.php" hash="40f5ca4bbbd0dcc46e8cd3af981b40e0"/>
223
- <file name="NostoHttpResponse.php" hash="9982d3ed15bfcc8f0147b2b4cc400223"/>
224
  </dir>
225
  <dir name="oauth">
226
- <file name="NostoOAuthClient.php" hash="2672d9de80d23c91776d97b9803d01b4"/>
227
- <file name="NostoOAuthToken.php" hash="f81c1c1e5c4fc2010162d8f69de2cb33"/>
228
  </dir>
229
  <dir name="operation">
230
- <file name="NostoOperationAccount.php" hash="3d41614e4e81b1b625dc688faf984f64"/>
231
- <file name="NostoOperationExchangeRate.php" hash="c46784f0b73fb6343a46627dc1391bdd"/>
232
- <file name="NostoOperationProduct.php" hash="eccdbd3d54af0ad3779e9edfcd760161"/>
233
  </dir>
234
  </dir>
235
- <file name="config.inc.php" hash="61c514981d155acdd4f60e3cc0b47139"/>
236
  <dir name="interfaces">
237
- <file name="NostoExchangeRateInterface.php" hash="217538d3c06e0eb2e5349b4dfd1cb1a6"/>
238
- <file name="NostoExportCollectionInterface.php" hash="63c833c17fe43ce48b45e0f552313a8b"/>
239
- <file name="NostoOAuthClientMetaDataInterface.php" hash="75a82417bfc27cd82e41ea9810d31428"/>
240
- <file name="NostoProductInterface.php" hash="687c6f112f76c2cfed28b067ef96b855"/>
241
- <file name="NostoValidatableInterface.php" hash="57ad8b28225344127843b97049f5868d"/>
 
242
  <dir name="account">
243
- <file name="NostoAccountInterface.php" hash="063da0d25a5420f4e727938467c078f3"/>
244
- <file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="ef31f0c3b41591fd76f85a25021f0fe4"/>
245
- <file name="NostoAccountMetaDataIframeInterface.php" hash="c739e6a3ef39a308df6852361f2fd1d7"/>
246
- <file name="NostoAccountMetaDataInterface.php" hash="f31c8943b0de8b3c6bf8dd5cd3ce0be9"/>
247
- <file name="NostoAccountMetaDataOwnerInterface.php" hash="4c037b8cb1b529c16c91f25cce2b0ed7"/>
248
  </dir>
249
  <dir name="order">
250
- <file name="NostoOrderBuyerInterface.php" hash="890884e45bcca61f96f0f98cda40b6c1"/>
251
- <file name="NostoOrderInterface.php" hash="d341b4faf020bfca01336c5d60ca5e48"/>
252
- <file name="NostoOrderPurchasedItemInterface.php" hash="e33b94290465eea80d614db35144b75a"/>
253
- <file name="NostoOrderStatusInterface.php" hash="8c89cf4296629b635f52b53a9b800b1f"/>
254
  </dir>
255
  </dir>
256
  <dir name="js">
257
  <file name="NostoIframe.min.js" hash="5fd9f5b418dd796c469aaa0c58b34aaa"/>
258
  <dir name="src">
259
- <file name="NostoIframe.js" hash="ca03585215f846258d2dbb58724e48fa"/>
260
  </dir>
261
  </dir>
262
  <dir name="libs">
@@ -276,7 +345,7 @@
276
  <target name="mageweb">
277
  <dir name="js">
278
  <dir name="nosto">
279
- <file name="iframeHandler.min.js" hash="c13b574b829791cd061ed63c81060680"/>
280
  <file name="iframeResizer.min.js" hash="163b065c9dd702dc364913a951b81fee"/>
281
  </dir>
282
  </dir>
@@ -287,13 +356,13 @@
287
  <required>
288
  <php>
289
  <min>5.2.0</min>
290
- <max>6.0.0</max>
291
  </php>
292
  <package>
293
  <name>Mage_Core_Modules</name>
294
  <channel>community</channel>
295
  <min>1.6.0.0</min>
296
- <max>1.9.2.4</max>
297
  </package>
298
  </required>
299
  </dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Nosto_Tagging</name>
4
+ <version>2.9.0</version>
5
  <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/OSL-3.0">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Personalization for Magento</summary>
10
  <description>Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.</description>
11
+ <notes>- Add support for sending the account details &amp; new platform UI&amp;#xD;- Add check if table `nosto_tagging_customer` already exists before creating it&amp;#xD;- Add visitor checksum tagging&amp;#xD;- Strip out _Main Website_ from the default account title&amp;#xD;- Disable tagging categories if there are hidden categories in the category path</notes>
12
  <authors>
13
  <author>
14
  <name>Nosto</name>
16
  <email>magento@nosto.com</email>
17
  </author>
18
  </authors>
19
+ <date>2016-06-16</date>
20
+ <time>08:12:43</time>
21
  <contents>
22
  <target name="magecommunity">
23
  <dir name="Nosto">
24
  <dir name="Tagging">
25
  <dir name="Block">
26
+ <file name="Addtocart.php" hash="5826823458e7e8b3328b3c69a78096de"/>
27
  <dir name="Adminhtml">
28
+ <file name="Iframe.php" hash="133470ce21ccd21a84125086a12f30e4"/>
29
+ <file name="Notifications.php" hash="ad2b090cd80adb74728466802a17cb56"/>
30
+ <dir name="System">
31
+ <dir name="Config">
32
+ <dir name="Currency">
33
+ <file name="CronFrequency.php" hash="594dd9b5e00cc41ccfed0c8cf4eb9c46"/>
34
+ <file name="Formats.php" hash="40d2263695ef3a33bd665c0a4704a776"/>
35
+ <file name="Method.php" hash="3aa8ec759e8ef78af1c1af6c89e77c8c"/>
36
+ </dir>
37
+ </dir>
38
+ </dir>
39
+ <file name="Wizard.php" hash="7a67ca3cf25ccd8085426a3bdda3be9b"/>
40
+ </dir>
41
+ <file name="Cart.php" hash="c964dcfc2be12646b8f81b4c3d1c0ca6"/>
42
+ <file name="Category.php" hash="c581a779c9bce1d149af21556eee9836"/>
43
+ <file name="Customer.php" hash="5f025903a9a0236a0933976652b0ca3a"/>
44
+ <file name="Element.php" hash="686d217784356fb2d784081a4a0cd40a"/>
45
+ <file name="Embed.php" hash="adf20605d8583c41d001288c3cb769bb"/>
46
+ <file name="Meta.php" hash="4d0e7b19695614fcde6e497979cdac99"/>
47
+ <dir name="Order">
48
+ <dir name="Vaimo">
49
+ <dir name="Klarna">
50
+ <file name="Checkout.php" hash="c51a16d1203e55d58a11cb6d6e428345"/>
51
+ </dir>
52
+ </dir>
53
  </dir>
54
+ <file name="Order.php" hash="2826b0c2fad017466693514c30e5d547"/>
55
+ <file name="Pagetype.php" hash="54021165b35f12d8d45d6af771e50367"/>
56
+ <file name="Product.php" hash="389f2219a6c37b3a1358b3ce9838b079"/>
57
+ <file name="Searchterm.php" hash="aeb8c43940a21e084cd6890bcfc3e477"/>
58
+ <file name="Variation.php" hash="ca164dfd2b4b8cdb67b9ce09e55a0578"/>
 
 
 
 
59
  </dir>
60
  <dir name="Helper">
61
+ <file name="Account.php" hash="5e96d093c7946edcc17f942f984b3508"/>
62
+ <file name="Cache.php" hash="87750033d028279c8c902eeeafc80de9"/>
63
+ <file name="Class.php" hash="73616d0f115cf8626a5f1c102a38f0fe"/>
64
+ <file name="Currency.php" hash="810867804e5595c7a2759d0ddcbb18f7"/>
65
+ <file name="Customer.php" hash="eb58f97b441dfae26ff34f09abd77f55"/>
66
+ <file name="Data.php" hash="e48a24acf5a5b67090735e6f1ac7a01d"/>
67
+ <file name="Date.php" hash="7d1b55282770627291f781dc9dd55eff"/>
68
+ <file name="Oauth.php" hash="a9ddbf62971f77b3e86c05bb4a23ee66"/>
69
+ <file name="Price.php" hash="ea7a1c4866ba5cef9f2658842859d0da"/>
70
+ <file name="Setup.php" hash="bc8085939a65b26b3cdbf9b812f48535"/>
71
+ <file name="Url.php" hash="35316855bb74f31a58596c6e14e82e76"/>
72
  </dir>
73
  <dir name="Model">
74
+ <file name="Base.php" hash="512d57dbb91fec6b61d331ffacc93f20"/>
75
+ <dir name="Collection">
76
+ <file name="Rates.php" hash="baddf50f68deae5bc976e6578d152f77"/>
77
+ </dir>
78
  <dir name="Container">
79
+ <file name="Cart.php" hash="9513669040ef6fc0d028b57c1a33ffa3"/>
80
+ <file name="Customer.php" hash="b482fd6b704728c5e8dfcea973f7a53d"/>
81
  </dir>
82
+ <file name="Customer.php" hash="72c0d0d5f2f22881f75e82aa2488ea59"/>
83
  <dir name="Export">
84
  <dir name="Collection">
85
+ <file name="Order.php" hash="77479fb26b90f1b6fd63538aaadf05e8"/>
86
  </dir>
87
  </dir>
88
  <dir name="Meta">
89
  <dir name="Account">
90
+ <file name="Billing.php" hash="d26a6d06313a546cc197832c8b6a72e6"/>
91
+ <file name="Iframe.php" hash="dceca4d9b4d40a68a45391bb5fd4571a"/>
92
+ <file name="Owner.php" hash="076f8ae3c01994fde2fcf7c0dec714cc"/>
93
  </dir>
94
+ <file name="Account.php" hash="a0fcf8edb86256b45a853280783f0c90"/>
95
+ <file name="Oauth.php" hash="9e754049da2993013bc540eb80ce3e1b"/>
96
  <dir name="Order">
97
+ <file name="Buyer.php" hash="29ef1477ab88c234271f9e075387af21"/>
98
+ <file name="Item.php" hash="8c2ca18a6b29a794eb6c4963a36e3231"/>
99
+ <file name="Status.php" hash="2abe147745bd832cfacb7aeebfcda7e0"/>
100
+ <dir name="Vaimo">
101
+ <dir name="Klarna">
102
+ <file name="Checkout.php" hash="6555fb602ee8c55fed5fca82527f1730"/>
103
+ </dir>
104
+ </dir>
105
  </dir>
106
+ <file name="Order.php" hash="ed1e8b3bdf4cf4fe9a23de6e2cdf69d4"/>
107
+ <file name="Product.php" hash="0b381d642e1a86183b2f1fd5f345bf86"/>
108
  </dir>
109
+ <file name="Observer.php" hash="33c095fcaf6f885808e83ad0e4c7819b"/>
110
+ <file name="Product.php" hash="df071b5a356793a1a2d3eae36a87d713"/>
111
  <dir name="Resource">
112
  <dir name="Customer">
113
+ <file name="Collection.php" hash="cb50bd89badc31867fc8927afff833ff"/>
114
  </dir>
115
+ <file name="Customer.php" hash="2db99b6ea05d69d33747525f3895fe35"/>
116
  <dir name="Product">
117
+ <file name="Collection.php" hash="b16d1c3559661fa840a79637a01ddd33"/>
118
  </dir>
119
+ <file name="Setup.php" hash="688082f95af4cd0676f9dac374c48fc3"/>
120
  </dir>
121
  <dir name="Service">
122
+ <file name="Order.php" hash="95b087b90689a13e5a563ce7cdf596fa"/>
123
  </dir>
124
  <dir name="System">
125
  <dir name="Config">
126
+ <dir name="Backend">
127
+ <dir name="Currency">
128
+ <dir name="Exchange">
129
+ <dir name="Rate">
130
+ <file name="Cron.php" hash="de3e1b39245ee7655544b67fb6e8a737"/>
131
+ </dir>
132
+ </dir>
133
+ </dir>
134
+ </dir>
135
  <dir name="Source">
136
+ <file name="Brand.php" hash="aee4b68fe55beb7072ec1cc29961657e"/>
137
+ <dir name="Cron">
138
+ <file name="Frequency.php" hash="72db23dacdf0df792ce71718e934d810"/>
139
+ </dir>
140
+ <dir name="Custom">
141
+ <file name="Tags.php" hash="22b6f2cb8a52f57ab6b7ae712a98dd8f"/>
142
+ </dir>
143
+ <file name="Image.php" hash="0377e330d49c691e87983b02e8a85423"/>
144
+ <dir name="Multi">
145
+ <dir name="Currency">
146
+ <file name="Method.php" hash="8744977f5cb26630befcb6eb5d5c66d9"/>
147
+ </dir>
148
+ </dir>
149
  </dir>
150
  </dir>
151
  </dir>
152
  </dir>
153
+ <file name="bootstrap.php" hash="3b334002827272f5e0dc682e1e0d5ef9"/>
154
  <dir name="controllers">
155
  <dir name="Adminhtml">
156
+ <file name="NostoController.php" hash="eac8ecefd90166d4912b96a1cbf1e1db"/>
157
  </dir>
158
+ <file name="ExportController.php" hash="93fd8d025350a2ad1ff830f99e77c0e1"/>
159
+ <file name="OauthController.php" hash="9b564c2987d5c8e388cc040b515bb9d9"/>
160
  </dir>
161
  <dir name="etc">
162
+ <file name="adminhtml.xml" hash="94c1710b2a8f0b7b0a15918f7c88d975"/>
163
+ <file name="cache.xml" hash="b034f279196c596f2602102bd5e44c2c"/>
164
+ <file name="config.xml" hash="6aa63049b756b7f0bcf7836b82a6a4f4"/>
165
+ <file name="system.xml" hash="0cd3534e23b6a769710e31139764b755"/>
166
  </dir>
167
  <dir name="sql">
168
+ <dir name="nosto_customer_reference_setup">
169
+ <file name="mysql4-install-2.8.0.php" hash="a50fd9bb9d3276e305a84dc9057332c8"/>
170
+ <file name="mysql4-upgrade-2.8.0-2.8.2.php" hash="94ead241a19c8b71a564ba598cbdfeb1"/>
171
+ </dir>
172
  <dir name="tagging_setup">
173
+ <file name="mysql4-install-1.2.0.php" hash="be30ee06f46c101c5f078f9d55bb139d"/>
174
+ <file name="mysql4-upgrade-1.1.7-1.2.0.php" hash="ff774ae3c70648b33eb5eae68debd555"/>
175
  </dir>
176
  </dir>
177
  </dir>
182
  <dir name="default">
183
  <dir name="default">
184
  <dir name="layout">
185
+ <file name="nostotagging.xml" hash="a367ca196e0c6f7202ff6f6f4f073f75"/>
186
  </dir>
187
  <dir name="template">
188
  <dir name="nostotagging">
189
+ <file name="iframe.phtml" hash="3c156000e4522c237ff0600aa8eafa10"/>
190
+ <file name="notifications.phtml" hash="bbf3b98b2509019bd8e4abe7e669d90b"/>
191
+ <dir name="system">
192
+ <dir name="config">
193
+ <dir name="currency">
194
+ <file name="cronFrequency.phtml" hash="91bcf7dd5f388b39cb15935d412df2f5"/>
195
+ <file name="formats.phtml" hash="2587f642e4d46340f7057c6c40fa20dd"/>
196
+ </dir>
197
+ </dir>
198
+ </dir>
199
+ <file name="wizard.phtml" hash="02b937a25e316e9dfe957104e44be0be"/>
200
  </dir>
201
  </dir>
202
  </dir>
206
  <dir name="base">
207
  <dir name="default">
208
  <dir name="layout">
209
+ <file name="nostotagging.xml" hash="729cc2c86a3a2c3d7a8d939753301e42"/>
210
  </dir>
211
  <dir name="template">
212
  <dir name="nostotagging">
213
+ <file name="addtocart.phtml" hash="e495fdcaf779479c23f025885dfd5cee"/>
214
+ <file name="cart.phtml" hash="a5df7adacaf2dfaf77211aec705ba576"/>
215
+ <file name="category.phtml" hash="320ccee20c5efaac60de2fa88b4ed996"/>
216
+ <file name="customer.phtml" hash="f9ceeeac8c9909b2650f57743400592b"/>
217
+ <file name="element.phtml" hash="c982ed5ae7ac44267ef6b4e7405d0df6"/>
218
+ <file name="embed.phtml" hash="9980a5cd3fb315962e052497127b8332"/>
219
+ <file name="jsstub.phtml" hash="e457758e3b1465e60710feea150bcb9f"/>
220
+ <file name="meta.phtml" hash="0f409190231247732707e17766364233"/>
221
+ <file name="order.phtml" hash="69ee18e576e0afa297ef5c96f1b4d812"/>
222
+ <file name="pagetype.phtml" hash="9ecf0d771936492f41f07add170455f5"/>
223
+ <file name="product.phtml" hash="472c255b7d3ef59052d1563c4627009a"/>
224
+ <file name="searchterm.phtml" hash="f3f87d0f7757a96307aa87ce03e5f292"/>
225
+ <file name="variation.phtml" hash="80cf94a8a820ef595ee992df1e0eba7d"/>
226
  </dir>
227
  </dir>
228
  </dir>
231
  </target>
232
  <target name="mageetc">
233
  <dir name="modules">
234
+ <file name="Nosto_Tagging.xml" hash="2f413332dea61ddd8277998e0f059df5"/>
235
  </dir>
236
  </target>
237
  <target name="magelib">
239
  <dir name="php-sdk">
240
  <dir name="src">
241
  <dir name="classes">
242
+ <file name="Nosto.php" hash="2c7b6c163a017b509a85a5c2a6869e42"/>
243
+ <file name="NostoAccount.php" hash="2118871d67a97f7133070fa95dadfccd"/>
244
+ <file name="NostoAccountMeta.php" hash="f6e81dbead7b9425afed98f13faec9c9"/>
245
+ <file name="NostoCipher.php" hash="f0af45e9fc48fe2734b6798ee5e3cdfc"/>
246
+ <file name="NostoCurrency.php" hash="511399f42ff5793de445944b5456c28e"/>
247
+ <file name="NostoCurrencyCode.php" hash="e2f14283c22f7aac9744150b9bd6457a"/>
248
+ <file name="NostoCurrencyFormat.php" hash="e676309a9f9420f0912bbf65b5363bda"/>
249
+ <file name="NostoCurrencyInfo.php" hash="2c8b7f50bfa483f1df764909441351fa"/>
250
+ <file name="NostoCurrencySymbol.php" hash="9f16f03a3d7187710daa37dac7ecf1c2"/>
251
+ <file name="NostoDotEnv.php" hash="be272235f6d48705023beeb6a24f2ce9"/>
252
+ <file name="NostoExchangeRate.php" hash="d6b70ad6bb434aba02bc450f1d066d34"/>
253
+ <file name="NostoMessage.php" hash="48912d9e00c08b5b5374eee368067cb4"/>
254
+ <file name="NostoNotification.php" hash="f25d0237e2ce1b04468a09bea328ba3c"/>
255
+ <file name="NostoObject.php" hash="0a348871fed339e7bdc57237e7947441"/>
256
+ <file name="NostoOrderConfirmation.php" hash="4f3ceb7ecbbdd2b78824e5d030fd60cf"/>
257
+ <file name="NostoProductReCrawl.php" hash="0b24f2fb00c9601e9b3d529f61a23bc5"/>
258
+ <file name="NostoValidator.php" hash="70523f08482bd8ef3a1a52a7fda2e237"/>
259
  <dir name="api">
260
+ <file name="NostoApiRequest.php" hash="e3f7acbded105c2c521233e25f4c740b"/>
261
+ <file name="NostoApiToken.php" hash="bf46e7be1d5bbb1c5e79cbb55b2e559e"/>
262
  </dir>
263
  <dir name="collection">
264
+ <file name="NostoCollection.php" hash="9e85a39ac3a860becd63d2d3cc64659f"/>
265
+ <file name="NostoExchangeRateCollection.php" hash="c06337ff17993eb7da1f2b653a74bccb"/>
266
+ <file name="NostoOrderCollection.php" hash="57cf60f4c4bc7ad57211d9c542420e15"/>
267
+ <file name="NostoProductCollection.php" hash="fcae6d129e8fad82099a05600fef8eea"/>
268
  </dir>
269
  <dir name="exception">
270
+ <file name="NostoApiResponseException.php" hash="e5430f3d3cfdc1a8f02cc68cb351da40"/>
271
+ <file name="NostoException.php" hash="d73bdc24769b5f9483a46b218254c488"/>
272
+ <file name="NostoHttpException.php" hash="9abf965891309b45ab9d0cd60382432e"/>
273
+ <file name="NostoHttpResponseException.php" hash="1549798afd49cf52e522fd6d8d9481f3"/>
274
  </dir>
275
  <dir name="export">
276
+ <file name="NostoExportOrderCollection.php" hash="9e1c115ef84617f96e9896ffc67f3586"/>
277
+ <file name="NostoExportProductCollection.php" hash="d29c326d88ead2aac65fb35997fc6b25"/>
278
+ <file name="NostoExporter.php" hash="6c242c8b66a504483bff29ee83e795b8"/>
279
  </dir>
280
  <dir name="helper">
281
+ <file name="NostoHelper.php" hash="87ab4af83eb0f346238677e07acdd49e"/>
282
+ <file name="NostoHelperDate.php" hash="071e881ba63521bd3adfa50d14acfe43"/>
283
+ <file name="NostoHelperIframe.php" hash="884c5c05823f7cd47af2ead0f7ca6b83"/>
284
+ <file name="NostoHelperPrice.php" hash="49ea7add4987844de5566c16c6e54112"/>
285
  </dir>
286
  <dir name="http">
287
+ <file name="NostoHttpRequest.php" hash="cc72e0324cb6d3244c4f40f2bd760689"/>
288
+ <file name="NostoHttpRequestAdapter.php" hash="e3ee66855cb2a81795172d85cafd75f0"/>
289
+ <file name="NostoHttpRequestAdapterCurl.php" hash="7ed6a572e36d5a2e3e6ff3ac7a1382c1"/>
290
+ <file name="NostoHttpRequestAdapterSocket.php" hash="703f6b9a7d54a920b2b442ab30c3d13a"/>
291
+ <file name="NostoHttpResponse.php" hash="6e6b6a155679604637e86b2a1faa29db"/>
292
  </dir>
293
  <dir name="oauth">
294
+ <file name="NostoOAuthClient.php" hash="d0ffcdcac250639715bfc1927f10e59c"/>
295
+ <file name="NostoOAuthToken.php" hash="b771e384b2751a0255f0f5755f5fb6c6"/>
296
  </dir>
297
  <dir name="operation">
298
+ <file name="NostoOperationAccount.php" hash="dc7e52907b64b5e5149814bb048eb283"/>
299
+ <file name="NostoOperationExchangeRate.php" hash="65b411b16d3ef340f156aaf7f9fd81d2"/>
300
+ <file name="NostoOperationProduct.php" hash="e1968fe0710fa41d8b0f85feab92c725"/>
301
  </dir>
302
  </dir>
303
+ <file name="config.inc.php" hash="d9eb6b2e263a107d9e37a26fba7182e2"/>
304
  <dir name="interfaces">
305
+ <file name="NostoExchangeRateInterface.php" hash="6c68bd4b564021cf0cb7e3f5b4b16ebe"/>
306
+ <file name="NostoExportCollectionInterface.php" hash="5de9b4dbbbbc1d1b41a53990536a51b5"/>
307
+ <file name="NostoNotificationInterface.php" hash="e0f4b3fde8e1111bb16793e9ce934c86"/>
308
+ <file name="NostoOAuthClientMetaDataInterface.php" hash="98f06f774b4a9af07ef4024bb49ce447"/>
309
+ <file name="NostoProductInterface.php" hash="68b6e532e0f70e04a789678c06f44291"/>
310
+ <file name="NostoValidatableInterface.php" hash="9a14e13c2f20653ceb202b8f247e46ce"/>
311
  <dir name="account">
312
+ <file name="NostoAccountInterface.php" hash="39d271fd254aaca1fb51eebe2867d823"/>
313
+ <file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="7e294f596d899af9aa5cf8dea94390e0"/>
314
+ <file name="NostoAccountMetaDataIframeInterface.php" hash="11ae6877125b32ca25a2545b41f91b9e"/>
315
+ <file name="NostoAccountMetaDataInterface.php" hash="c9d9a739d88db6cc4b3137f06ef930b7"/>
316
+ <file name="NostoAccountMetaDataOwnerInterface.php" hash="be8d01705b37778a8ed61e01db2178f6"/>
317
  </dir>
318
  <dir name="order">
319
+ <file name="NostoOrderBuyerInterface.php" hash="400f680f5e1827bf76fea06a454c3ecd"/>
320
+ <file name="NostoOrderInterface.php" hash="b5c3f5d59b7ac97b925e13ef9d13d96b"/>
321
+ <file name="NostoOrderPurchasedItemInterface.php" hash="978d961aefce11ec732fa2257d667df0"/>
322
+ <file name="NostoOrderStatusInterface.php" hash="80dc0acc4644d007279af286515d8073"/>
323
  </dir>
324
  </dir>
325
  <dir name="js">
326
  <file name="NostoIframe.min.js" hash="5fd9f5b418dd796c469aaa0c58b34aaa"/>
327
  <dir name="src">
328
+ <file name="NostoIframe.js" hash="53eaf62450081dd7fc86bd2203512cb6"/>
329
  </dir>
330
  </dir>
331
  <dir name="libs">
345
  <target name="mageweb">
346
  <dir name="js">
347
  <dir name="nosto">
348
+ <file name="iframeHandler.min.js" hash="7a4eec2ab2082f0669b106511985ccf7"/>
349
  <file name="iframeResizer.min.js" hash="163b065c9dd702dc364913a951b81fee"/>
350
  </dir>
351
  </dir>
356
  <required>
357
  <php>
358
  <min>5.2.0</min>
359
+ <max>7.1.0</max>
360
  </php>
361
  <package>
362
  <name>Mage_Core_Modules</name>
363
  <channel>community</channel>
364
  <min>1.6.0.0</min>
365
+ <max>1.9.3.1</max>
366
  </package>
367
  </required>
368
  </dependencies>