Nosto_Tagging - Version 2.8.1

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.8.1
Comparing to
See all releases


Code changes from version 2.6.14 to 2.8.1

Files changed (146) hide show
  1. app/code/community/Nosto/Tagging/Block/Addtocart.php +9 -7
  2. app/code/community/Nosto/Tagging/Block/Adminhtml/Iframe.php +12 -8
  3. app/code/community/Nosto/Tagging/Block/Adminhtml/Notifications.php +165 -0
  4. app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Formats.php +88 -0
  5. app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Method.php +83 -0
  6. app/code/community/Nosto/Tagging/Block/Adminhtml/Wizard.php +6 -6
  7. app/code/community/Nosto/Tagging/Block/Cart.php +23 -8
  8. app/code/community/Nosto/Tagging/Block/Category.php +12 -9
  9. app/code/community/Nosto/Tagging/Block/Customer.php +60 -9
  10. app/code/community/Nosto/Tagging/Block/Element.php +9 -7
  11. app/code/community/Nosto/Tagging/Block/Embed.php +12 -8
  12. app/code/community/Nosto/Tagging/Block/Meta.php +9 -7
  13. app/code/community/Nosto/Tagging/Block/Order.php +22 -7
  14. app/code/community/Nosto/Tagging/Block/Pagetype.php +75 -0
  15. app/code/community/Nosto/Tagging/Block/Product.php +12 -9
  16. app/code/community/Nosto/Tagging/Block/Searchterm.php +6 -2
  17. app/code/community/Nosto/Tagging/Block/Variation.php +85 -0
  18. app/code/community/Nosto/Tagging/Helper/Account.php +166 -37
  19. app/code/community/Nosto/Tagging/Helper/Cache.php +55 -0
  20. app/code/community/Nosto/Tagging/Helper/Currency.php +118 -0
  21. app/code/community/Nosto/Tagging/Helper/Customer.php +24 -6
  22. app/code/community/Nosto/Tagging/Helper/Data.php +345 -9
  23. app/code/community/Nosto/Tagging/Helper/Date.php +6 -6
  24. app/code/community/Nosto/Tagging/Helper/Oauth.php +6 -6
  25. app/code/community/Nosto/Tagging/Helper/Price.php +75 -18
  26. app/code/community/Nosto/Tagging/Helper/Setup.php +94 -0
  27. app/code/community/Nosto/Tagging/Helper/Url.php +123 -34
  28. app/code/community/Nosto/Tagging/Model/Base.php +6 -6
  29. app/code/community/Nosto/Tagging/Model/Collection/Rates.php +33 -0
  30. app/code/community/Nosto/Tagging/Model/Container/Cart.php +13 -6
  31. app/code/community/Nosto/Tagging/Model/Container/Customer.php +15 -6
  32. app/code/community/Nosto/Tagging/Model/Customer.php +6 -6
  33. app/code/community/Nosto/Tagging/Model/Export/Collection/Order.php +12 -8
  34. app/code/community/Nosto/Tagging/Model/Meta/Account.php +83 -17
  35. app/code/community/Nosto/Tagging/Model/Meta/Account/Billing.php +6 -6
  36. app/code/community/Nosto/Tagging/Model/Meta/Account/Iframe.php +7 -6
  37. app/code/community/Nosto/Tagging/Model/Meta/Account/Owner.php +14 -12
  38. app/code/community/Nosto/Tagging/Model/Meta/Oauth.php +8 -7
  39. app/code/community/Nosto/Tagging/Model/Meta/Order.php +9 -7
  40. app/code/community/Nosto/Tagging/Model/Meta/Order/Buyer.php +7 -6
  41. app/code/community/Nosto/Tagging/Model/Meta/Order/Item.php +7 -6
  42. app/code/community/Nosto/Tagging/Model/Meta/Order/Status.php +7 -6
  43. app/code/community/Nosto/Tagging/Model/Meta/Product.php +111 -67
  44. app/code/community/Nosto/Tagging/Model/Observer.php +135 -25
  45. app/code/community/Nosto/Tagging/Model/Product.php +6 -6
  46. app/code/community/Nosto/Tagging/Model/Resource/Customer.php +6 -6
  47. app/code/community/Nosto/Tagging/Model/Resource/Customer/Collection.php +6 -6
  48. app/code/community/Nosto/Tagging/Model/Resource/Product/Collection.php +6 -6
  49. app/code/community/Nosto/Tagging/Model/Resource/Setup.php +6 -6
  50. app/code/community/Nosto/Tagging/Model/Service/Order.php +13 -8
  51. app/code/community/Nosto/Tagging/Model/System/Config/Backend/Currency/Exchange/Rate/Cron.php +75 -0
  52. app/code/community/Nosto/Tagging/Model/System/Config/Brand/Source.php +49 -0
  53. app/code/community/Nosto/Tagging/Model/System/Config/CustomTags/Source.php +50 -0
  54. app/code/community/Nosto/Tagging/Model/System/Config/Source/Image.php +16 -12
  55. app/code/community/Nosto/Tagging/Model/System/Config/Source/Multi/Currency/Method.php +60 -0
  56. app/code/community/Nosto/Tagging/bootstrap.php +24 -31
  57. app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php +212 -9
  58. app/code/community/Nosto/Tagging/controllers/ExportController.php +11 -7
  59. app/code/community/Nosto/Tagging/controllers/OauthController.php +13 -8
  60. app/code/community/Nosto/Tagging/etc/adminhtml.xml +25 -26
  61. app/code/community/Nosto/Tagging/etc/cache.xml +25 -26
  62. app/code/community/Nosto/Tagging/etc/config.xml +73 -28
  63. app/code/community/Nosto/Tagging/etc/system.xml +210 -30
  64. app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-install-2.8.0.php +37 -0
  65. app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-install-1.2.0.php +45 -43
  66. app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-upgrade-1.1.7-1.2.0.php +6 -6
  67. app/design/adminhtml/default/default/layout/nostotagging.xml +30 -26
  68. app/design/adminhtml/default/default/template/nostotagging/iframe.phtml +9 -8
  69. app/design/adminhtml/default/default/template/nostotagging/notifications.phtml +56 -0
  70. app/design/adminhtml/default/default/template/nostotagging/system/config/currency/formats.phtml +47 -0
  71. app/design/adminhtml/default/default/template/nostotagging/wizard.phtml +8 -8
  72. app/design/frontend/base/default/layout/nostotagging.xml +78 -26
  73. app/design/frontend/base/default/template/nostotagging/addtocart.phtml +40 -15
  74. app/design/frontend/base/default/template/nostotagging/cart.phtml +10 -11
  75. app/design/frontend/base/default/template/nostotagging/category.phtml +8 -10
  76. app/design/frontend/base/default/template/nostotagging/customer.phtml +8 -8
  77. app/design/frontend/base/default/template/nostotagging/element.phtml +8 -10
  78. app/design/frontend/base/default/template/nostotagging/embed.phtml +11 -16
  79. app/design/frontend/base/default/template/nostotagging/meta.phtml +8 -10
  80. app/design/frontend/base/default/template/nostotagging/order.phtml +9 -10
  81. app/design/frontend/base/default/template/nostotagging/{category/view.phtml → pagetype.phtml} +5 -6
  82. app/design/frontend/base/default/template/nostotagging/product.phtml +10 -12
  83. app/design/frontend/base/default/template/nostotagging/searchterm.phtml +5 -7
  84. app/design/frontend/base/default/template/nostotagging/variation.phtml +37 -0
  85. app/etc/modules/Nosto_Tagging.xml +25 -26
  86. js/nosto/iframeHandler.min.js +1 -1
  87. lib/nosto/php-sdk/src/classes/Nosto.php +47 -7
  88. lib/nosto/php-sdk/src/classes/NostoAccount.php +36 -12
  89. lib/nosto/php-sdk/src/classes/NostoAccountMeta.php +110 -43
  90. lib/nosto/php-sdk/src/classes/NostoCipher.php +3 -2
  91. lib/nosto/php-sdk/src/classes/NostoCurrency.php +27 -16
  92. lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php +1 -0
  93. lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php +1 -0
  94. lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php +1 -0
  95. lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php +1 -0
  96. lib/nosto/php-sdk/src/classes/NostoDotEnv.php +3 -2
  97. lib/nosto/php-sdk/src/classes/NostoExchangeRate.php +1 -0
  98. lib/nosto/php-sdk/src/classes/NostoMessage.php +3 -2
  99. lib/nosto/php-sdk/src/classes/NostoObject.php +3 -2
  100. lib/nosto/php-sdk/src/classes/NostoOrderConfirmation.php +5 -2
  101. lib/nosto/php-sdk/src/classes/NostoProductReCrawl.php +6 -3
  102. lib/nosto/php-sdk/src/classes/NostoValidator.php +14 -13
  103. lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php +3 -2
  104. lib/nosto/php-sdk/src/classes/api/NostoApiToken.php +16 -2
  105. lib/nosto/php-sdk/src/classes/collection/NostoCollection.php +3 -2
  106. lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php +3 -2
  107. lib/nosto/php-sdk/src/classes/collection/NostoOrderCollection.php +3 -2
  108. lib/nosto/php-sdk/src/classes/collection/NostoProductCollection.php +3 -2
  109. lib/nosto/php-sdk/src/classes/exception/NostoApiResponseException.php +42 -0
  110. lib/nosto/php-sdk/src/classes/exception/NostoException.php +3 -2
  111. lib/nosto/php-sdk/src/classes/exception/NostoHttpException.php +64 -2
  112. lib/nosto/php-sdk/src/classes/exception/NostoHttpResponseException.php +42 -0
  113. lib/nosto/php-sdk/src/classes/export/NostoExportOrderCollection.php +5 -2
  114. lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php +3 -8
  115. lib/nosto/php-sdk/src/classes/export/NostoExporter.php +3 -2
  116. lib/nosto/php-sdk/src/classes/helper/NostoHelper.php +3 -2
  117. lib/nosto/php-sdk/src/classes/helper/NostoHelperDate.php +3 -2
  118. lib/nosto/php-sdk/src/classes/helper/NostoHelperIframe.php +3 -2
  119. lib/nosto/php-sdk/src/classes/helper/NostoHelperPrice.php +10 -4
  120. lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php +13 -2
  121. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapter.php +3 -2
  122. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php +10 -7
  123. lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php +6 -2
  124. lib/nosto/php-sdk/src/classes/http/NostoHttpResponse.php +7 -6
  125. lib/nosto/php-sdk/src/classes/oauth/NostoOAuthClient.php +5 -4
  126. lib/nosto/php-sdk/src/classes/oauth/NostoOAuthToken.php +3 -2
  127. lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php +1 -0
  128. lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php +7 -4
  129. lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php +3 -6
  130. lib/nosto/php-sdk/src/config.inc.php +5 -2
  131. lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php +3 -2
  132. lib/nosto/php-sdk/src/interfaces/NostoExportCollectionInterface.php +3 -2
  133. lib/nosto/php-sdk/src/interfaces/NostoOAuthClientMetaDataInterface.php +3 -2
  134. lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php +9 -9
  135. lib/nosto/php-sdk/src/interfaces/NostoValidatableInterface.php +3 -2
  136. lib/nosto/php-sdk/src/interfaces/account/NostoAccountInterface.php +12 -3
  137. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataBillingDetailsInterface.php +3 -2
  138. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataIframeInterface.php +3 -2
  139. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php +10 -2
  140. lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataOwnerInterface.php +3 -2
  141. lib/nosto/php-sdk/src/interfaces/order/NostoOrderBuyerInterface.php +3 -2
  142. lib/nosto/php-sdk/src/interfaces/order/NostoOrderInterface.php +10 -2
  143. lib/nosto/php-sdk/src/interfaces/order/NostoOrderPurchasedItemInterface.php +3 -2
  144. lib/nosto/php-sdk/src/interfaces/order/NostoOrderStatusInterface.php +3 -2
  145. lib/nosto/php-sdk/src/js/src/NostoIframe.js +4 -3
  146. package.xml +182 -133
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,9 +78,12 @@ 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
 
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 Nosto_Tagging_Helper_Account $helper */
84
+ $helper = Mage::helper('nosto_tagging/account');
85
+ $account = $helper->find($store);
86
+ return $this->_iframeUrl = $helper
87
  ->getIframeUrl($store, $account, $params);
88
  }
89
 
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 Nosto_Tagging_Model_Meta_Account $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->getFrontPageUrlForStore($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/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,64 @@ 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
+ $ref = $customerHelper->generateCustomerReference($customer);
84
+ if (empty($ref)) {
85
+ $ref = $customerHelper->generateCustomerReference($customer);
86
+ $customer->setData(
87
+ Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
88
+ $ref
89
+ );
90
+ $customer->save();
91
+ }
92
+ } catch (\Exception $e) {
93
+ Mage::log(
94
+ sprintf(
95
+ 'Could not get customer reference. Error was: %s',
96
+ $e->getMessage()
97
+ ),
98
+ Zend_Log::ERR,
99
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
100
+ );
101
+ $ref = null;
102
+ }
103
+
104
+ return $ref;
105
+ }
106
  }
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/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/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
 
@@ -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,20 @@ 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
 
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
+ * @return string
94
+ */
95
+ public function generateCustomerReference(Mage_Customer_Model_Customer $customer)
96
+ {
97
+ $hash = md5($customer->getId().$customer->getEmail());
98
+ $uuid = uniqid(
99
+ substr($hash, 0, 8),
100
+ true
101
+ );
102
+
103
+ return $uuid;
104
+ }
105
  }
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,113 @@ 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 +177,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 +207,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 +226,246 @@ 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 srtring Nosto customer reference attribute name
114
+ */
115
+ const NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME = 'nosto_customer_reference';
116
+
117
+ /**
118
+ * List of strings to remove from the default Nosto account title
119
+ *
120
+ * @var array
121
+ */
122
+ public static $removeFromTitle = array(
123
+ 'Main Website - '
124
+ );
125
+
126
+ /**
127
+ * List of valid tag types
128
+ *
129
+ * @var array
130
+ */
131
+ public static $validTags = array(
132
+ 'tag1',
133
+ 'tag2',
134
+ 'tag3'
135
+ );
136
+
137
+ /**
138
+ * List of attributes that cannot be added to tags due to buggy internal
139
+ * processing of attributes
140
+ *
141
+ * @var array
142
+ */
143
+ public static $notValidAttributesForTags = array(
144
+ 'group_price', // Magento fails to get the value
145
+ );
146
+
147
  /**
148
  * @inheritdoc
149
  */
150
  public function quoteEscape($data, $addSlashes = false)
151
  {
152
  if ($addSlashes === true) {
153
+ $data = addslashes($data); //@codingStandardsIgnoreLine
154
  }
155
  return htmlspecialchars($data, ENT_QUOTES, null, false);
156
  }
177
  if (isset($categories[$id]) && $categories[$id]->getName()) {
178
  $data[] = $categories[$id]->getName();
179
  } else {
180
+ $data = array();
181
  break;
182
  }
183
  }
207
  $config->saveConfig(
208
  self::XML_PATH_INSTALLATION_ID, $installationId, 'default', 0
209
  );
210
+
211
+ /** @var Nosto_Tagging_Helper_Cache $helper */
212
+ $helper = Mage::helper('nosto_tagging/cache');
213
+ $helper->flushConfigCache();
214
  }
215
  return $installationId;
216
  }
226
  {
227
  return Mage::getStoreConfig(self::XML_PATH_IMAGE_VERSION, $store);
228
  }
229
+
230
+ /**
231
+ * Return if virtual hosts / pretty urls should be used for products
232
+ *
233
+ * @param Mage_Core_Model_Store|null $store the store model or null.
234
+ *
235
+ * @return boolean
236
+ */
237
+ public function getUsePrettyProductUrls($store = null)
238
+ {
239
+ return Mage::getStoreConfig(self::XML_PATH_PRETTY_URL, $store);
240
+ }
241
+
242
+ /**
243
+ * Returns the attribute to be used for brand tagging
244
+ *
245
+ * @param Mage_Core_Model_Store|null $store the store model or null.
246
+ *
247
+ * @return string
248
+ */
249
+ public function getBrandAttribute($store = null)
250
+ {
251
+ return Mage::getStoreConfig(self::XML_PATH_BRAND_ATTRIBUTE, $store);
252
+ }
253
+
254
+ /**
255
+ * Returns the front page URL used for the store during Nosto account
256
+ * installation
257
+ *
258
+ * @param Mage_Core_Model_Store $store the store model
259
+ *
260
+ * @return string
261
+ */
262
+ public function getStoreFrontPageUrl(Mage_Core_Model_Store $store)
263
+ {
264
+ return Mage::getStoreConfig(self::XML_PATH_STORE_FRONT_PAGE_URL, $store);
265
+ }
266
+
267
+ /**
268
+ * Saves current front page url of the store into the settings. This is
269
+ * used for validating that Nosto account was actually installed into the
270
+ * current store and Magento installation.
271
+ *
272
+ * @param Mage_Core_Model_Store $store
273
+ */
274
+ public function saveCurrentStoreFrontPageUrl(Mage_Core_Model_Store $store)
275
+ {
276
+ /* @var $urlHelper Nosto_Tagging_Helper_Url */
277
+ $urlHelper = Mage::helper('nosto_tagging/url');
278
+ $frontPageUrl = $urlHelper->getFrontPageUrlForStore($store);
279
+ $this->saveStoreFrontPageUrl($store, $frontPageUrl);
280
+ }
281
+
282
+ /**
283
+ * Saves the front page url of the store into the settings.
284
+ *
285
+ * @param Mage_Core_Model_Store $store
286
+ * @param string $url
287
+ */
288
+ public function saveStoreFrontPageUrl(Mage_Core_Model_Store $store, $url)
289
+ {
290
+ /** @var Mage_Core_Model_Config $config */
291
+ $config = Mage::getModel('core/config');
292
+ $config->saveConfig(
293
+ self::XML_PATH_STORE_FRONT_PAGE_URL,
294
+ $url,
295
+ 'stores',
296
+ $store->getId()
297
+ );
298
+ }
299
+
300
+ /**
301
+ * Return the Nosto cookie value
302
+ *
303
+ * @return string
304
+ */
305
+ public function getCookieId()
306
+ {
307
+ /** @noinspection PhpUndefinedMethodInspection */
308
+ return Mage::getModel('core/cookie')->get(self::COOKIE_NAME);
309
+ }
310
+
311
+ /**
312
+ * Return the checksum for visitor
313
+ *
314
+ * @return string
315
+ */
316
+ public function getVisitorChecksum()
317
+ {
318
+ $coo = $this->getCookieId();
319
+ if ($coo) {
320
+ return hash(self::VISITOR_HASH_ALGO, $coo);
321
+ }
322
+ return null;
323
+ }
324
+
325
+ /**
326
+ * Return the checksum for visitor
327
+ *
328
+ * @param string $name the title of the account
329
+ * @return string the cleaned title of the account
330
+ */
331
+ public function cleanUpAccountTitle($name)
332
+ {
333
+ $clean = str_replace(self::$removeFromTitle, '', $name);
334
+ return $clean;
335
+ }
336
+
337
+ /**
338
+ * Return the multi currency method in use, i.e. "exchangeRate" or
339
+ * "priceVariation".
340
+ *
341
+ * If "exchangeRate", it means that the product prices in the recommendation
342
+ * is updated through the Exchange Rate API to Nosto.
343
+ *
344
+ * If "priceVariation", it means that the product price variations should be
345
+ * tagged along side the product.
346
+ *
347
+ * @param Mage_Core_Model_Store|null $store the store model or null.
348
+ *
349
+ * @return string
350
+ */
351
+ public function getMultiCurrencyMethod($store = null)
352
+ {
353
+ if ($store instanceof Mage_Core_Model_Store === false) {
354
+ $store = Mage::app()->getStore();
355
+ }
356
+ return Mage::getStoreConfig(self::XML_PATH_MULTI_CURRENCY_METHOD, $store);
357
+ }
358
+
359
+ /**
360
+ * Checks if either exchange rates or price variants
361
+ * are used in store.
362
+ *
363
+ *
364
+ * @param Mage_Core_Model_Store|null $store the store model or null.
365
+ *
366
+ * @return bool
367
+ */
368
+ public function multiCurrencyDisabled($store = null)
369
+ {
370
+ $method = $this->getMultiCurrencyMethod($store);
371
+ return ($method === self::MULTI_CURRENCY_DISABLED);
372
+ }
373
+
374
+ /**
375
+ * Checks if the multi currency method in use is the "exchangeRate", i.e.
376
+ * the product prices in the recommendation is updated through the Exchange
377
+ * Rate API to Nosto.
378
+ *
379
+ * @param Mage_Core_Model_Store|null $store the store model or null.
380
+ *
381
+ * @return bool
382
+ */
383
+ public function isMultiCurrencyMethodExchangeRate($store = null)
384
+ {
385
+ $method = $this->getMultiCurrencyMethod($store);
386
+ return ($method === self::MULTI_CURRENCY_METHOD_EXCHANGE_RATE);
387
+ }
388
+
389
+ /**
390
+ * Returns if the scheduled currency exchange rate update is enabled.
391
+ *
392
+ * @param Mage_Core_Model_Store|null $store the store model or null.
393
+ *
394
+ * @return bool
395
+ */
396
+ public function isScheduledCurrencyExchangeRateUpdateEnabled($store = null)
397
+ {
398
+ return (bool)Mage::getStoreConfig(self::XML_PATH_SCHEDULED_CURRENCY_EXCHANGE_RATE_UPDATE_ENABLED, $store);
399
+ }
400
+
401
+ /**
402
+ * Returns product updates should be sent via API to Nosto
403
+ *
404
+ * @param Mage_Core_Model_Store|null $store the store model or null.
405
+ * @return boolean
406
+ */
407
+ public function getUseProductApi($store = null)
408
+ {
409
+ $useApi = (bool)Mage::getStoreConfig(self::XML_PATH_USE_PRODUCT_API, $store);
410
+ return $useApi;
411
+ }
412
+
413
+ public function getProductAttributeOptions()
414
+ {
415
+ $resourceModel = Mage::getResourceModel(
416
+ 'catalog/product_attribute_collection'
417
+ );
418
+ $attributes = $resourceModel
419
+ ->addFieldToFilter(
420
+ 'entity_type_id',
421
+ self::PRODUCT_TYPE_ATTRIBUTE_ID
422
+ )
423
+ ->setOrder(
424
+ 'attribute_code',
425
+ Varien_Data_Collection::SORT_ORDER_ASC
426
+ );
427
+ // Add single empty option as a first option. Otherwise multiselect
428
+ // cannot not be unset in Magento.
429
+ $attributeArray = array(
430
+ array(
431
+ 'value' => 0,
432
+ 'label' => 'None'
433
+ )
434
+ );
435
+ foreach($attributes as $attribute) {
436
+ $code = $attribute->getData('attribute_code');
437
+ if (in_array($code, self::$notValidAttributesForTags)) {
438
+ continue;
439
+ }
440
+ $label = $attribute->getData('frontend_label');
441
+ $attributeArray[] = array(
442
+ 'value' => $code,
443
+ 'label' => sprintf('%s (%s)', $code, $label)
444
+ );
445
+ }
446
+
447
+ return $attributeArray;
448
+ }
449
+
450
+ /**
451
+ * Return the attributes to be tagged in Nosto tags
452
+ *
453
+ * @param string $tag_id the name / identifier of the tag (e.g. tag1, tag2).
454
+ * @param Mage_Core_Model_Store|null $store the store model or null.
455
+ *
456
+ * @throws NostoException
457
+ *
458
+ * @return array
459
+ */
460
+ public function getAttributesToTag($tag_id, $store = null)
461
+ {
462
+ if (!in_array($tag_id, self::$validTags)) {
463
+ throw new NostoException(
464
+ sprintf('Invalid tag identifier %s', $tag_id)
465
+ );
466
+ }
467
+ $tag_path = self::XML_PATH_CUSTOM_TAGS . $tag_id;
468
+ $tags = Mage::getStoreConfig($tag_path, $store);
469
+ return explode(',', $tags);
470
+ }
471
  }
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
  /**
@@ -86,18 +89,20 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
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,21 +111,23 @@ 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
  }
@@ -147,7 +154,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 +173,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 +194,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
  /**
89
  switch ($product->getTypeId()) {
90
  case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
91
  // Get the bundle product "from" price.
92
+ /** @var Mage_Bundle_Model_Product_Price $model */
93
+ $model = $product->getPriceModel();
94
+ $price = $model->getTotalPrices($product, 'min', $inclTax);
95
  break;
96
 
97
  case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
98
  // Get the grouped product "starting at" price.
99
+ /** @var Mage_Catalog_Model_Config $config */
100
+ $config = Mage::getSingleton('catalog/config');
101
  /** @var $tmpProduct Mage_Catalog_Model_Product */
102
  $tmpProduct = Mage::getModel('catalog/product')
103
  ->getCollection()
104
  ->addAttributeToSelect(
105
+ $config->getProductAttributes()
 
106
  )
107
  ->addAttributeToFilter('entity_id', $product->getId())
108
  ->setPage(1, 1)
111
  ->load()
112
  ->getFirstItem();
113
  if ($tmpProduct) {
114
+ /** @var Mage_Tax_Helper_Data $helper */
115
+ $helper = Mage::helper('tax');
116
  $price = $tmpProduct->getMinimalPrice();
117
  if ($inclTax) {
118
+ $price = $helper->getPrice($tmpProduct, $price, true);
 
119
  }
120
  }
121
  break;
122
 
123
  default:
124
+ /** @var Mage_Tax_Helper_Data $helper */
125
+ $helper = Mage::helper('tax');
126
  $price = $finalPrice
127
  ? $product->getFinalPrice()
128
  : $product->getPrice();
129
  if ($inclTax) {
130
+ $price = $helper->getPrice($product, $price, true);
 
131
  }
132
  break;
133
  }
154
  );
155
  $price = 0;
156
  }
157
+ /** @var Mage_Directory_Helper_Data $helper */
158
+ $helper = Mage::helper('directory');
159
+ return $helper->currencyConvert(
160
  $price,
161
  $store->getBaseCurrency()->getCode(),
162
  $store->getDefaultCurrency()->getCode()
173
  */
174
  public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
175
  {
176
+ /** @var Mage_Directory_Helper_Data $helper */
177
+ $helper = Mage::helper('directory');
178
  $quantity = (double)$item->getQtyOrdered();
179
  $basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
180
  $orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
181
  $baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
182
  if ($orderCurrencyCode != $baseCurrencyCode) {
183
+ $priceInOrderCurrency = $helper->currencyConvert(
184
  $basePrice,
185
  $baseCurrencyCode,
186
  $orderCurrencyCode
194
 
195
  return $priceInOrderCurrency;
196
  }
197
+
198
+ /**
199
+ * If the store uses multiple currencies the prices are converted from base
200
+ * currency into given currency. Otherwise the given price is returned.
201
+ *
202
+ * @param float $basePrice The price of a product in base currency
203
+ * @param string $currentCurrencyCode
204
+ * @param Mage_Core_Model_Store $store
205
+ * @return float
206
+ */
207
+ public function getTaggingPrice($basePrice, $currentCurrencyCode, Mage_Core_Model_Store $store)
208
+ {
209
+ /* @var Nosto_Tagging_Helper_Data $helper */
210
+ $helper = Mage::helper('nosto_tagging');
211
+ $baseCurrencyCode = $store->getBaseCurrencyCode();
212
+ $taggingPrice = $basePrice;
213
+ if ($helper->multiCurrencyDisabled($store) && $currentCurrencyCode !== $store->getBaseCurrencyCode()) {
214
+ $taggingPrice = Mage::helper('directory')->currencyConvert(
215
+ $basePrice,
216
+ $baseCurrencyCode,
217
+ $currentCurrencyCode
218
+ );
219
+ }
220
+
221
+ return $taggingPrice;
222
+ }
223
+
224
+ /**
225
+ * Returns the correct currency code for tagging
226
+ *
227
+ * @param $currentCurrencyCode
228
+ * @param Mage_Core_Model_Store $store
229
+ * @return string currency code in ISO 4217 format
230
+ */
231
+ public function getTaggingCurrencyCode($currentCurrencyCode, Mage_Core_Model_Store $store)
232
+ {
233
+ /* @var Nosto_Tagging_Helper_Data $helper */
234
+ $helper = Mage::helper('nosto_tagging');
235
+ if ($helper->multiCurrencyDisabled($store)) {
236
+ $taggingCurrencyCode = $currentCurrencyCode;
237
+ } else {
238
+ $taggingCurrencyCode = $store->getBaseCurrencyCode();
239
+ }
240
+
241
+ return $taggingCurrencyCode;
242
+ }
243
  }
app/code/community/Nosto/Tagging/Helper/Setup.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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" => "label",
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
+ }
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,11 @@
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 +52,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
@@ -64,10 +69,12 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
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
  );
@@ -86,20 +93,22 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
86
  */
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
  );
@@ -118,12 +127,7 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
118
  */
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
@@ -140,12 +144,7 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
140
  */
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
  );
@@ -161,14 +160,104 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
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_STORE_URL_PARAMETER = '___store';
43
+
44
  /**
45
  * Gets the absolute preview URL to the current store view product page.
46
  * The product is the first one found in the database for the store.
52
  */
53
  public function getPreviewUrlProduct(Mage_Core_Model_Store $store)
54
  {
55
+ $url_options = $this->getUrlOptions($store);
56
  $collection = Mage::getModel('catalog/product')
57
  ->getCollection()
58
  ->addStoreFilter($store->getId())
 
59
  ->addAttributeToFilter(
60
  'status', array(
61
  'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
69
  ->setCurPage(1);
70
  foreach ($collection as $product) {
71
  /** @var Mage_Catalog_Model_Product $product */
72
+ $url = $product->getProductUrl(!$url_options['_nosid']);
73
+ if ($url_options['_store_to_url']) {
74
+ $url = NostoHttpRequest::replaceQueryParamInUrl(
75
+ '___store', $store->getCode(), $url
76
+ );
77
+ }
78
  return NostoHttpRequest::replaceQueryParamInUrl(
79
  'nostodebug', 'true', $url
80
  );
93
  */
94
  public function getPreviewUrlCategory(Mage_Core_Model_Store $store)
95
  {
96
+ $url_options = $this->getUrlOptions($store);
97
  $rootCategoryId = (int)$store->getRootCategoryId();
98
  $collection = Mage::getModel('catalog/category')
99
  ->getCollection()
100
  ->addFieldToFilter('is_active', 1)
101
  ->addFieldToFilter('path', array('like' => "1/$rootCategoryId/%"))
 
102
  ->setPageSize(1)
103
  ->setCurPage(1);
104
+ /** @var Mage_Catalog_Model_Category $category */
105
  foreach ($collection as $category) {
 
106
  $url = $category->getUrl();
107
+ if ($url_options['_store_to_url']) {
108
+ $url = NostoHttpRequest::replaceQueryParamInUrl(
109
+ '___store', $store->getCode(), $url
110
+ );
111
+ }
112
  return NostoHttpRequest::replaceQueryParamInUrl(
113
  'nostodebug', 'true', $url
114
  );
127
  */
128
  public function getPreviewUrlSearch(Mage_Core_Model_Store $store)
129
  {
130
+ $url = Mage::getUrl('catalogsearch/result', $this->getUrlOptions($store));
 
 
 
 
 
131
  $url = NostoHttpRequest::replaceQueryParamInUrl('q', 'nosto', $url);
132
  return NostoHttpRequest::replaceQueryParamInUrl(
133
  'nostodebug', 'true', $url
144
  */
145
  public function getPreviewUrlCart(Mage_Core_Model_Store $store)
146
  {
147
+ $url = Mage::getUrl('checkout/cart', $this->getUrlOptions($store));
 
 
 
 
 
148
  return NostoHttpRequest::replaceQueryParamInUrl(
149
  'nostodebug', 'true', $url
150
  );
160
  */
161
  public function getPreviewUrlFront(Mage_Core_Model_Store $store)
162
  {
163
+ $url = Mage::getUrl('', $this->getUrlOptions($store));
 
 
 
 
 
164
  return NostoHttpRequest::replaceQueryParamInUrl(
165
  'nostodebug', 'true', $url
166
  );
167
  }
168
+
169
+ /**
170
+ * Returns the default options for fetching Magento urls
171
+ *
172
+ * @param Mage_Core_Model_Store $store
173
+ * @return array
174
+ */
175
+ private function getUrlOptions(Mage_Core_Model_Store $store)
176
+ {
177
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
178
+ $nosto_helper = Mage::helper('nosto_tagging');
179
+ $params = array(
180
+ '_store' => $store->getId(),
181
+ '_store_to_url' => true,
182
+ '_nosid' => true
183
+ );
184
+ if ($nosto_helper->getUsePrettyProductUrls($store)) {
185
+ $params['_store_to_url'] = false;
186
+ }
187
+
188
+ return $params;
189
+ }
190
+
191
+ /**
192
+ * Generates url for a product
193
+ *
194
+ * @param Mage_Catalog_Model_Product $product
195
+ * @param Mage_Core_Model_Store $store
196
+ *
197
+ * @return string the url.
198
+ */
199
+ public function generateProductUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
200
+ {
201
+ // Unset the cached url first, as it won't include the `___store` param
202
+ // if it's cached. We need to define the specific store view in the url
203
+ // in case the same domain is used for all sites.
204
+ $product->unsetData('url');
205
+ /** @var Nosto_Tagging_Helper_Data $helper */
206
+ $helper = Mage::helper('nosto_tagging');
207
+ $url_params = array(
208
+ '_nosid' => true,
209
+ '_ignore_category' => true,
210
+ '_store' => $store->getId(),
211
+ '_store_to_url' => true
212
+ );
213
+ $product_url = $product->getUrlInStore($url_params);
214
+ if ($helper->getUsePrettyProductUrls($store)) {
215
+ $product_url = $this->removeQueryParamFromUrl($product_url, '___store');
216
+ }
217
+
218
+ return $product_url;
219
+ }
220
+
221
+
222
+ /**
223
+ * Removes given parameter from the url
224
+ *
225
+ * @param $url
226
+ * @param $param
227
+ * @return string
228
+ */
229
+ public function removeQueryParamFromUrl($url, $param)
230
+ {
231
+ $modified_url = $url;
232
+ $url_parts = NostoHttpRequest::parseUrl($url);
233
+ if (
234
+ $url_parts !== false
235
+ && isset($url_parts['query'])
236
+ ) {
237
+ $query_array = NostoHttpRequest::parseQueryString($url_parts['query']);
238
+ if(isset($query_array[$param])) {
239
+ unset($query_array[$param]);
240
+ if (empty($query_array)) {
241
+ unset($url_parts['query']);
242
+ } else {
243
+ $url_parts['query'] = http_build_query($query_array);
244
+ }
245
+ $modified_url = NostoHttpRequest::buildUrl($url_parts);
246
+ }
247
+ }
248
+
249
+ return $modified_url;
250
+ }
251
+
252
+ /**
253
+ * Returns the front page url configured for a store
254
+ *
255
+ * @param Mage_Core_Model_Store $store
256
+ * @return string
257
+ */
258
+ public function getFrontPageUrlForStore(Mage_Core_Model_Store $store)
259
+ {
260
+
261
+ return $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
262
+ }
263
  }
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,25 @@ 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 +144,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 +298,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 +311,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 +321,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
+ $this->_title = $helper->cleanUpAccountTitle(
121
+ $store->getWebsite()->getName()
122
  . ' - '
123
  . $store->getGroup()->getName()
124
  . ' - '
125
+ . $store->getName()
 
 
 
 
 
126
  );
127
+ $this->_name = substr(sha1(rand()), 0, 8);
128
+ if (!$helper->getUsePrettyProductUrls()) {
129
+ $this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl(
130
+ '___store',
131
+ $store->getCode(),
132
+ $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
133
+ );
134
+ } else {
135
+ $this->_frontPageUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
136
+ }
137
  $this->_currencyCode = $store->getBaseCurrencyCode();
138
  $this->_languageCode = substr(
139
  $store->getConfig('general/locale/code'), 0, 2
144
 
145
  /** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
146
  $owner = Mage::getModel('nosto_tagging/meta_account_owner');
147
+ $owner->loadData();
148
  $this->_owner = $owner;
149
 
150
  /** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
151
  $billing = Mage::getModel('nosto_tagging/meta_account_billing');
152
  $billing->loadData($store);
153
  $this->_billing = $billing;
154
+
155
+ $this->_useCurrencyExchangeRates = !$helper->multiCurrencyDisabled($store);
156
+ if (!$helper->multiCurrencyDisabled($store)) {
157
+ $this->_defaultPriceVariationId = $store->getBaseCurrencyCode();
158
+ } else {
159
+ $this->_defaultPriceVariationId = "";
160
+ }
161
+
162
+ $storeLocale = $store->getConfig('general/locale/code');
163
+ $currencyCodes = $store->getAvailableCurrencyCodes(true);
164
+ if (is_array($currencyCodes) && count($currencyCodes) > 0) {
165
+ /** @var Nosto_Tagging_Helper_Currency $currencyHelper */
166
+ $currencyHelper = Mage::helper('nosto_tagging/currency');
167
+ foreach ($currencyCodes as $currencyCode) {
168
+ $this->_currencies[$currencyCode] = $currencyHelper
169
+ ->getCurrencyObject($storeLocale, $currencyCode);
170
+ }
171
+ }
172
  }
173
 
174
  /**
298
  */
299
  public function getCurrencies()
300
  {
301
+ return $this->_currencies;
302
  }
303
 
304
  /**
311
  */
312
  public function getUseCurrencyExchangeRates()
313
  {
314
+ return $this->_useCurrencyExchangeRates;
315
  }
316
 
317
  /**
321
  */
322
  public function getDefaultVariationId()
323
  {
324
+ return $this->_defaultPriceVariationId;
325
+ }
326
+
327
+ /**
328
+ * Set details
329
+ *
330
+ * @param array|stdClass $details
331
+ */
332
+ public function setDetails($details)
333
+ {
334
+ $this->_details = $details;
335
+ }
336
+
337
+ /**
338
+ * Get the details
339
+ *
340
+ * @return array|stdClass
341
+ */
342
+ public function getDetails()
343
+ {
344
+ return $this->_details;
345
  }
346
  }
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,6 +116,7 @@ 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');
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');
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
 
@@ -64,7 +64,8 @@ class Nosto_Tagging_Model_Meta_Oauth extends Mage_Core_Model_Abstract implements
64
  'nosto/oauth',
65
  array(
66
  '_store' => $store->getId(),
67
- '_store_to_url' => true
 
68
  )
69
  );
70
  $this->_languageIsoCode = substr(
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
 
64
  'nosto/oauth',
65
  array(
66
  '_store' => $store->getId(),
67
+ '_store_to_url' => true,
68
+ '_type' => Mage_Core_Model_Store::URL_TYPE_WEB,
69
  )
70
  );
71
  $this->_languageIsoCode = substr(
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(
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(
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/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,9 @@ 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 +136,14 @@ 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 +158,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 +188,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 +211,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 +257,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 +325,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 +543,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 +568,22 @@ 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
  * @inheritdoc
136
  );
137
  }
138
 
139
+ public function __construct()
140
+ {
141
+ parent::__construct();
142
+ foreach (Nosto_Tagging_Helper_Data::$validTags as $validTag) {
143
+ $this->_tags[$validTag] = array();
144
+ }
145
+ }
146
+
147
  /**
148
  * Loads the product info from a Magento product model.
149
  *
158
 
159
  /** @var Nosto_Tagging_Helper_Price $priceHelper */
160
  $priceHelper = Mage::helper('nosto_tagging/price');
161
+ /** @var Nosto_Tagging_Helper_Data $dataHelper */
162
+ $dataHelper = Mage::helper('nosto_tagging');
163
 
164
  $this->_url = $this->buildUrl($product, $store);
165
  $this->_productId = $product->getId();
166
  $this->_name = $product->getName();
167
  $this->_imageUrl = $this->buildImageUrl($product, $store);
168
+ $currentCurrencyCode = $store->getCurrentCurrencyCode();
169
+ $this->_price = $priceHelper->getTaggingPrice(
170
+ $priceHelper->getProductFinalPriceInclTax($product),
171
+ $currentCurrencyCode,
172
+ $store
173
+ );
174
+ $this->_listPrice = $priceHelper->getTaggingPrice(
175
+ $priceHelper->getProductPriceInclTax($product),
176
+ $currentCurrencyCode,
177
+ $store
178
+ );
179
+ $this->_currencyCode = $priceHelper->getTaggingCurrencyCode($currentCurrencyCode, $store);
180
  $this->_availability = $this->buildAvailability($product);
181
  $this->_categories = $this->buildCategories($product);
182
 
188
  if ($product->hasData('description')) {
189
  $this->_description = $product->getData('description');
190
  }
191
+ $brandAttribute = $dataHelper->getBrandAttribute($store);
192
+ if ($product->hasData($brandAttribute)) {
193
+ $this->_brand = $this->getAttributeValue($product, $brandAttribute);
194
  }
195
  if (($tags = $this->buildTags($product, $store)) !== array()) {
196
  $this->_tags['tag1'] = $tags;
197
  }
198
+ if (!$dataHelper->multiCurrencyDisabled($store)) {
199
+ $this->_variationId = $store->getBaseCurrencyCode();
200
  }
201
+
202
+ $this->amendAttributeTags($product, $store);
203
  }
204
 
205
  /**
211
  */
212
  protected function buildAvailability(Mage_Catalog_Model_Product $product)
213
  {
214
+ $availability = self::OUT_OF_STOCK;
215
  if(!$product->isVisibleInSiteVisibility()) {
216
+ $availability = self::INVISIBLE;
217
  } elseif ($product->isAvailable()) {
218
+ $availability = self::IN_STOCK;
219
  }
220
 
221
  return $availability;
257
  }
258
 
259
  if (!$product->canConfigure()) {
260
+ $tags[] = self::ADD_TO_CART;
261
  }
262
 
263
+
264
  return $tags;
265
  }
266
 
267
+ /**
268
+ * Amends the product attributes to tags array if attributes are defined
269
+ * and are present in product
270
+ *
271
+ * @param Mage_Catalog_Model_Product $product the product model.
272
+ * @param Mage_Core_Model_Store $store the store model.
273
+ *
274
+ */
275
+ protected function amendAttributeTags(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
276
+ {
277
+ $product_attributes = $product->getAttributes();
278
+ /* @var Nosto_Tagging_Helper_Data $nosto_helper */
279
+ $nosto_helper = Mage::helper("nosto_tagging");
280
+
281
+ foreach (Nosto_Tagging_Helper_Data::$validTags as $tag_id) {
282
+ $attributes_to_tag = $nosto_helper->getAttributesToTag($tag_id, $store->getId());
283
+ if (empty($attributes_to_tag) || !is_array($attributes_to_tag)) {
284
+ continue;
285
+ }
286
+ /* @var Mage_Catalog_Model_Resource_Eav_Attribute $product_attribute*/
287
+ foreach ($product_attributes as $key=>$product_attribute) {
288
+ if (in_array($key, $attributes_to_tag)) {
289
+ try {
290
+ $attribute_value = $this->getAttributeValue($product, $key);
291
+ if (!empty($attribute_value)) {
292
+ $this->_tags[$tag_id][] = sprintf(
293
+ '%s:%s',
294
+ $key,
295
+ $attribute_value
296
+ );
297
+ }
298
+ } catch (Exception $e) {
299
+ Mage::log(
300
+ sprintf(
301
+ 'Failed to add attribute %s to tags. Error message was: %s',
302
+ $key,
303
+ $e->getMessage()
304
+ ),
305
+ Zend_Log::WARN,
306
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
307
+ );
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+
314
  /**
315
  * Builds the absolute store front url for the product page.
316
  *
325
  */
326
  protected function buildUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
327
  {
328
+ /** @var Nosto_Tagging_Helper_Url $url_helper */
329
+ $url_helper = Mage::helper('nosto_tagging/url');
330
+ $product_url = $url_helper->generateProductUrl($product, $store);
331
+ return $product_url;
 
 
 
 
 
 
 
 
332
  }
333
 
334
  /**
543
  return $this->_brand;
544
  }
545
 
 
 
 
 
 
 
 
 
 
 
546
  /**
547
  * Returns the full product description,
548
  * i.e. both the "short" and "normal" descriptions concatenated.
568
  */
569
  public function getVariationId()
570
  {
571
+ return $this->_variationId;
572
+ }
573
+
574
+ private function getAttributeValue(Mage_Catalog_Model_Product $product, $attributeName)
575
+ {
576
+ $attribute = $product->getResource()->getAttribute($attributeName);
577
+ if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
578
+ $attribute_data = $product->getData($attributeName);
579
+ $attribute_value = $product->getAttributeText($attributeName);
580
+ if (empty($attribute_value) && is_scalar($attribute_data)) {
581
+ $attribute_value = $attribute_data;
582
+ }
583
+ } else {
584
+ $attribute_value = null;
585
+ }
586
+ return trim($attribute_value);
587
+
588
  }
589
  }
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
@@ -82,15 +84,22 @@ class Nosto_Tagging_Model_Observer
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)) {
@@ -106,9 +115,9 @@ 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
  }
@@ -131,14 +140,15 @@ 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;
@@ -149,9 +159,9 @@ class Nosto_Tagging_Model_Observer
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
  }
@@ -175,15 +185,17 @@ 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');
@@ -196,4 +208,102 @@ class Nosto_Tagging_Model_Observer
196
 
197
  return $this;
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
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
84
  foreach ($product->getStoreIds() as $storeId) {
85
  $store = Mage::app()->getStore($storeId);
86
 
87
+ /** @var Nosto_Tagging_Helper_Account $helper */
88
+ $helper = Mage::helper('nosto_tagging/account');
89
+ $account = $helper->find($store);
90
+
91
+ /* @var $nostoHelper Nosto_Tagging_Helper_Data */
92
+ $nostoHelper = Mage::helper('nosto_tagging');
93
+ if ($account === null || !$account->isConnectedToNosto()
94
+ || !$nostoHelper->getUseProductApi($store)) {
95
  continue;
96
  }
97
 
98
  // Load the product model for this particular store view.
99
+ /** @var Mage_Catalog_Model_Product $catalog */
100
+ $catalog = Mage::getModel('catalog/product');
101
+ /** @noinspection PhpUndefinedMethodInspection */
102
+ $product = $catalog
103
  ->setStoreId($store->getId())
104
  ->load($product->getId());
105
  if (is_null($product)) {
115
  $validator = new NostoValidator($model);
116
  if ($validator->validate()) {
117
  try {
118
+ $service = new NostoOperationProduct($account);
119
+ $service->addProduct($model);
120
+ $service->upsert();
121
  } catch (NostoException $e) {
122
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
123
  }
140
  {
141
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
142
  /** @var Mage_Catalog_Model_Product $product */
143
+ /** @noinspection PhpUndefinedMethodInspection */
144
  $product = $observer->getEvent()->getProduct();
145
  // Products are always deleted from all store views, regardless of
146
  // the store view scope switcher on the product edit page.
147
  /** @var Mage_Core_Model_Store $store */
148
  foreach (Mage::app()->getStores() as $store) {
149
+ /** @var Nosto_Tagging_Helper_Account $helper */
150
+ $helper = Mage::helper('nosto_tagging/account');
151
+ $account = $helper->find($store);
152
 
153
  if ($account === null || !$account->isConnectedToNosto()) {
154
  continue;
159
  $model->setProductId($product->getId());
160
 
161
  try {
162
+ $service = new NostoOperationProduct($account);
163
+ $service->addProduct($model);
164
+ $service->delete();
165
  } catch (NostoException $e) {
166
  Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
167
  }
185
  if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
186
  try {
187
  /** @var Mage_Sales_Model_Order $mageOrder */
188
+ /** @noinspection PhpUndefinedMethodInspection */
189
  $mageOrder = $observer->getEvent()->getOrder();
190
  /** @var Nosto_Tagging_Model_Meta_Order $order */
191
  $order = Mage::getModel('nosto_tagging/meta_order');
192
  $order->loadData($mageOrder);
193
+ /** @var Nosto_Tagging_Helper_Account $helper */
194
+ $helper = Mage::helper('nosto_tagging/account');
195
+ $account = $helper->find($mageOrder->getStore());
196
+ /** @var Nosto_Tagging_Helper_Customer $helper */
197
+ $helper = Mage::helper('nosto_tagging/customer');
198
+ $customerId = $helper->getNostoId($mageOrder);
199
  if ($account !== null && $account->isConnectedToNosto()) {
200
  /** @var Nosto_Tagging_Model_Service_Order $service */
201
  $service = Mage::getModel('nosto_tagging/service_order');
208
 
209
  return $this;
210
  }
211
+
212
+ /**
213
+ * Cron job for syncing currency exchange rates to Nosto.
214
+ * Only stores that have the scheduled update enabled, have more currencies
215
+ * than the default one defined and has a Nosto account are synced.
216
+ *
217
+ * @throws Mage_Cron_Exception
218
+ */
219
+ public function scheduledCurrencyExchangeRateUpdate()
220
+ {
221
+ /** @var Nosto_Tagging_Helper_Data $helper */
222
+ $helper = Mage::helper('nosto_tagging');
223
+ if ($helper->isModuleEnabled()) {
224
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
225
+ $accountHelper = Mage::helper('nosto_tagging/account');
226
+ $error = false;
227
+ foreach (Mage::app()->getStores() as $store) {
228
+ /** @var Mage_Core_Model_Store $store */
229
+ if (
230
+ !$helper->isScheduledCurrencyExchangeRateUpdateEnabled($store)
231
+ || !$helper->isMultiCurrencyMethodExchangeRate($store)
232
+ ) {
233
+ continue;
234
+ }
235
+ $account = $accountHelper->find($store);
236
+ if (is_null($account)) {
237
+ continue;
238
+ }
239
+ if (!$accountHelper->updateCurrencyExchangeRates($account, $store)) {
240
+ $error = true;
241
+ }
242
+ }
243
+ if ($error) {
244
+ throw Mage::exception(
245
+ 'Mage_Cron',
246
+ 'There was an error updating the exchange rates. More info in "var/log/nostotagging.log".'
247
+ );
248
+ }
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Updates / synchronizes Nosto account settings via API to Nosto
254
+ * for each store that has Nosto account.
255
+ *
256
+ * Event 'admin_system_config_changed_section_nosto_tagging'.
257
+ *
258
+ * @param Varien_Event_Observer $observer
259
+ *
260
+ * @return Nosto_Tagging_Model_Observer
261
+ */
262
+ public function syncNostoAccount(/** @noinspection PhpUnusedParameterInspection */
263
+ Varien_Event_Observer $observer)
264
+ {
265
+ /** @var Nosto_Tagging_Helper_Data $helper */
266
+ $helper = Mage::helper('nosto_tagging');
267
+ if ($helper->isModuleEnabled()) {
268
+ /** @var Nosto_Tagging_Helper_Account $accountHelper */
269
+ $accountHelper = Mage::helper('nosto_tagging/account');
270
+ /** @var Mage_Core_Model_Store $store */
271
+ foreach (Mage::app()->getStores() as $store) {
272
+ $account = $accountHelper->find($store);
273
+ if ($account instanceof NostoAccount === false) {
274
+ continue;
275
+ }
276
+ if (!$accountHelper->updateAccount($account, $store)) {
277
+ Mage::log(
278
+ sprintf(
279
+ 'Failed sync account #%s for store #%s in class %s',
280
+ $account->getName(),
281
+ $store->getName(),
282
+ __CLASS__
283
+ ),
284
+ Zend_Log::WARN,
285
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
286
+ );
287
+ }
288
+ if ($helper->isMultiCurrencyMethodExchangeRate($store)) {
289
+ if (!$accountHelper->updateCurrencyExchangeRates(
290
+ $account, $store
291
+ )
292
+ ) {
293
+ Mage::log(
294
+ sprintf(
295
+ 'Failed sync currency rates #%s for store #%s in class %s',
296
+ $account->getName(),
297
+ $store->getName(),
298
+ __CLASS__
299
+ ),
300
+ Zend_Log::WARN,
301
+ Nosto_Tagging_Model_Base::LOG_FILE_NAME
302
+ );
303
+ }
304
+ }
305
+ }
306
+ }
307
+ return $this;
308
+ }
309
  }
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,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
+ * 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
+ * @inheritdoc
45
+ */
46
+ protected function _afterSave()
47
+ {
48
+ $time = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/time/value');
49
+ $frequency = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/frequency/value');
50
+
51
+ $weekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
52
+ $monthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
53
+ $cronExpr = implode(
54
+ ' ',
55
+ array(
56
+ (int)$time[1], # Minute
57
+ (int)$time[0], # Hour
58
+ ($frequency === $monthly) ? '1' : '*', # Day of the Month
59
+ '*', # Month of the Year
60
+ ($frequency === $weekly) ? '1' : '*', # Day of the Week
61
+ )
62
+ );
63
+
64
+ try {
65
+ /** @var Mage_Core_Model_Config_Data $model */
66
+ $model = Mage::getModel('core/config_data');
67
+ $model = $model->load(self::CRON_STRING_PATH, 'path');
68
+ $model = $model->setValue($cronExpr);
69
+ $model = $model->setPath(self::CRON_STRING_PATH);
70
+ $model->save();
71
+ } catch (Exception $e) {
72
+ throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
73
+ }
74
+ }
75
+ }
app/code/community/Nosto/Tagging/Model/System/Config/Brand/Source.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_Brand_Source
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/CustomTags/Source.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_CustomTags_Source
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])
@@ -164,7 +166,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])
166
  */
167
  protected function export(NostoExportCollectionInterface $collection)
168
  {
169
+ /** @var Nosto_Tagging_Helper_Account $helper */
170
+ $helper = Mage::helper('nosto_tagging/account');
171
+ $account = $helper->find();
172
  if ($account !== null) {
173
  $cipherText = NostoExporter::export($account, $collection);
174
  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,
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,
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.8.1</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,26 +35,207 @@
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>
50
  <frontend_type>select</frontend_type>
51
  <source_model>nosto_tagging/system_config_source_image</source_model>
52
  <sort_order>10</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
  <show_in_store>1</show_in_store>
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>0</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>0</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>1</expanded>
86
  <fields>
87
  <image_version translate="label">
88
  <label>Image Version</label>
89
  <frontend_type>select</frontend_type>
90
  <source_model>nosto_tagging/system_config_source_image</source_model>
91
  <sort_order>10</sort_order>
92
+ <show_in_default>0</show_in_default>
93
+ <show_in_website>0</show_in_website>
94
  <show_in_store>1</show_in_store>
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>1</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>0</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_customTags_source</source_model>
131
+ <sort_order>10</sort_order>
132
+ <show_in_default>0</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_customTags_source</source_model>
141
+ <sort_order>20</sort_order>
142
+ <show_in_default>0</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_customTags_source</source_model>
151
+ <sort_order>30</sort_order>
152
+ <show_in_default>0</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>1</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_brand_source</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>0</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>70</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</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>adminhtml/system_config_source_cron_frequency</source_model>
231
+ <backend_model>nosto_tagging/system_config_backend_currency_exchange_rate_cron</backend_model>
232
+ <sort_order>30</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>0</show_in_website>
235
+ <show_in_store>0</show_in_store>
236
+ </frequency>
237
+ </fields>
238
+ </scheduled_currency_exchange_rate_update>
239
  </groups>
240
  </nosto_tagging>
241
  </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/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/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 -->
@@ -58,6 +57,10 @@
58
  <block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
59
  </reference>
60
 
 
 
 
 
61
  </default>
62
 
63
  <!-- Tag category -->
@@ -142,6 +145,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 +187,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 +222,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 +263,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 +291,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 +321,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 +355,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">
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 -->
57
  <block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
58
  </reference>
59
 
60
+ <!-- Tag currency variation -->
61
+ <reference name="after_body_start">
62
+ <block type="nosto_tagging/variation" name="nosto.variation" template="nostotagging/variation.phtml"/>
63
+ </reference>
64
  </default>
65
 
66
  <!-- Tag category -->
145
  <cms_index_index>
146
  <!-- Add 4 content placeholders after the home page content -->
147
  <reference name="content">
148
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.front" after="-"
149
+ template="nostotagging/pagetype.phtml">
150
+ <action method="setData">
151
+ <name>page_type</name>
152
+ <value>front</value>
153
+ </action>
154
+ </block>
155
  <block type="nosto_tagging/element" name="nosto.page.home1" after="-"
156
  template="nostotagging/element.phtml">
157
  <action method="setData">
187
  <checkout_cart_index>
188
  <!-- Adds 3 content placeholders after the cart content -->
189
  <reference name="content">
190
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.cart" after="-"
191
+ template="nostotagging/pagetype.phtml">
192
+ <action method="setData">
193
+ <name>page_type</name>
194
+ <value>cart</value>
195
+ </action>
196
+ </block>
197
  <block type="nosto_tagging/element" name="nosto.page.cart1" after="checkout.cart"
198
  template="nostotagging/element.phtml">
199
  <action method="setData">
222
  <catalog_product_view>
223
  <!-- Adds 3 content placeholders after the product info -->
224
  <reference name="content">
225
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.product" after="-"
226
+ template="nostotagging/pagetype.phtml">
227
+ <action method="setData">
228
+ <name>page_type</name>
229
+ <value>product</value>
230
+ </action>
231
+ </block>
232
  <block type="nosto_tagging/element" name="nosto.page.product1" after="product.info"
233
  template="nostotagging/element.phtml">
234
  <action method="setData">
263
  <nosto_tagging_catalog_category>
264
  <!-- Adds 2 content placeholders; 1 before and 1 after the products -->
265
  <reference name="content">
266
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.category" after="-"
267
+ template="nostotagging/pagetype.phtml">
268
+ <action method="setData">
269
+ <name>page_type</name>
270
+ <value>category</value>
271
+ </action>
272
+ </block>
273
  <block type="nosto_tagging/element" name="nosto.page.category1" before="category.products"
274
  template="nostotagging/element.phtml">
275
  <action method="setData">
291
  <catalogsearch_result_index>
292
  <!-- Adds 2 content placeholders; 1 before and 1 after the search result -->
293
  <reference name="content">
294
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.search" after="-"
295
+ template="nostotagging/pagetype.phtml">
296
+ <action method="setData">
297
+ <name>page_type</name>
298
+ <value>search</value>
299
+ </action>
300
+ </block>
301
  <block type="nosto_tagging/element" name="nosto.page.search1" before="search.result"
302
  template="nostotagging/element.phtml">
303
  <action method="setData">
321
  <!-- 404 Not found page -->
322
  <cms_index_noroute>
323
  <reference name="content">
324
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.notfound" after="-"
325
+ template="nostotagging/pagetype.phtml">
326
+ <action method="setData">
327
+ <name>page_type</name>
328
+ <value>notfound</value>
329
+ </action>
330
+ </block>
331
  <block type="nosto_tagging/element" name="nosto.page.notfound1" after="-"
332
  template="nostotagging/element.phtml">
333
  <action method="setData">
355
  <!-- Order confirmation page -->
356
  <checkout_onepage_success>
357
  <reference name="content">
358
+ <block type="nosto_tagging/pagetype" name="nosto.page.type.order" after="-"
359
+ template="nostotagging/pagetype.phtml">
360
+ <action method="setData">
361
+ <name>page_type</name>
362
+ <value>order</value>
363
+ </action>
364
+ </block>
365
  <block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="-"
366
  template="nostotagging/element.phtml">
367
  <action method="setData">
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/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
  /**
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
  /**
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/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
  /**
@@ -59,7 +60,6 @@ class NostoExportProductCollection extends NostoProductCollection implements Nos
59
  );
60
 
61
  // Optional properties.
62
-
63
  if ($item->getFullDescription()) {
64
  $data['description'] = $item->getFullDescription();
65
  }
@@ -74,14 +74,9 @@ class NostoExportProductCollection extends NostoProductCollection implements Nos
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);
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
  /**
60
  );
61
 
62
  // Optional properties.
 
63
  if ($item->getFullDescription()) {
64
  $data['description'] = $item->getFullDescription();
65
  }
74
  $data[$type] = $tags;
75
  }
76
  }
 
 
 
 
77
  if ($item->getVariationId()) {
78
  $data['variation_id'] = $item->getVariationId();
79
  }
 
80
  $array[] = $data;
81
  }
82
  return json_encode($array);
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
  /**
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/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,7 +181,6 @@ 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.
@@ -215,9 +215,6 @@ 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
  }
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.
215
  $data[$type] = $tags;
216
  }
217
  }
 
 
 
218
  if ($product->getVariationId()) {
219
  $data['variation_id'] = $product->getVariationId();
220
  }
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
@@ -65,6 +66,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');
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
66
 
67
  require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
68
  require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
69
+ require_once(dirname(__FILE__).'/classes/exception/NostoHttpResponseException.php');
70
+ require_once(dirname(__FILE__).'/classes/exception/NostoApiResponseException.php');
71
 
72
  require_once(dirname(__FILE__).'/classes/export/NostoExporter.php');
73
  require_once(dirname(__FILE__).'/classes/export/NostoExportProductCollection.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/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
  *
@@ -138,13 +145,6 @@ interface NostoProductInterface
138
  */
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
  *
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
  *
145
  */
146
  public function getBrand();
147
 
 
 
 
 
 
 
 
148
  /**
149
  * Returns the product variation id.
150
  *
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,20 @@ 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
  * Gets an api token associated with this account by it's name , e.g. "sso".
93
  *
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,146 @@
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 +166,20 @@
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 +189,22 @@
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 +213,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 +221,91 @@
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 +325,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,7 +336,7 @@
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Nosto_Tagging</name>
4
+ <version>2.8.1</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>- 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="a1097337517f9cec22db015b82c22e25"/>
29
+ <file name="Notifications.php" hash="a516e30a101c1e2c51955d7cb403d5b4"/>
30
+ <dir name="System">
31
+ <dir name="Config">
32
+ <dir name="Currency">
33
+ <file name="Formats.php" hash="40d2263695ef3a33bd665c0a4704a776"/>
34
+ <file name="Method.php" hash="3aa8ec759e8ef78af1c1af6c89e77c8c"/>
35
+ </dir>
36
+ </dir>
37
+ </dir>
38
+ <file name="Wizard.php" hash="7a67ca3cf25ccd8085426a3bdda3be9b"/>
39
  </dir>
40
+ <file name="Cart.php" hash="c964dcfc2be12646b8f81b4c3d1c0ca6"/>
41
+ <file name="Category.php" hash="c581a779c9bce1d149af21556eee9836"/>
42
+ <file name="Customer.php" hash="d6eaf09edbc14b537c5cfabb48afb7a2"/>
43
+ <file name="Element.php" hash="686d217784356fb2d784081a4a0cd40a"/>
44
+ <file name="Embed.php" hash="adf20605d8583c41d001288c3cb769bb"/>
45
+ <file name="Meta.php" hash="4d0e7b19695614fcde6e497979cdac99"/>
46
+ <file name="Order.php" hash="2826b0c2fad017466693514c30e5d547"/>
47
+ <file name="Pagetype.php" hash="54021165b35f12d8d45d6af771e50367"/>
48
+ <file name="Product.php" hash="389f2219a6c37b3a1358b3ce9838b079"/>
49
+ <file name="Searchterm.php" hash="aeb8c43940a21e084cd6890bcfc3e477"/>
50
+ <file name="Variation.php" hash="ca164dfd2b4b8cdb67b9ce09e55a0578"/>
51
  </dir>
52
  <dir name="Helper">
53
+ <file name="Account.php" hash="5e96d093c7946edcc17f942f984b3508"/>
54
+ <file name="Cache.php" hash="87750033d028279c8c902eeeafc80de9"/>
55
+ <file name="Currency.php" hash="810867804e5595c7a2759d0ddcbb18f7"/>
56
+ <file name="Customer.php" hash="71b7028f93de312e19e9ab18f14d0074"/>
57
+ <file name="Data.php" hash="94433e64ad6ee7433f756f83a3f05e3b"/>
58
+ <file name="Date.php" hash="7d1b55282770627291f781dc9dd55eff"/>
59
+ <file name="Oauth.php" hash="a9ddbf62971f77b3e86c05bb4a23ee66"/>
60
+ <file name="Price.php" hash="18e911306dd3eeb3b6d48ad84fa6f768"/>
61
+ <file name="Setup.php" hash="b129c5dad0c285615414d9a9345dea96"/>
62
+ <file name="Url.php" hash="46303a9ea11c3d9c1ab3d27415381dd3"/>
63
  </dir>
64
  <dir name="Model">
65
+ <file name="Base.php" hash="512d57dbb91fec6b61d331ffacc93f20"/>
66
+ <dir name="Collection">
67
+ <file name="Rates.php" hash="baddf50f68deae5bc976e6578d152f77"/>
68
+ </dir>
69
  <dir name="Container">
70
+ <file name="Cart.php" hash="9513669040ef6fc0d028b57c1a33ffa3"/>
71
+ <file name="Customer.php" hash="b482fd6b704728c5e8dfcea973f7a53d"/>
72
  </dir>
73
+ <file name="Customer.php" hash="72c0d0d5f2f22881f75e82aa2488ea59"/>
74
  <dir name="Export">
75
  <dir name="Collection">
76
+ <file name="Order.php" hash="77479fb26b90f1b6fd63538aaadf05e8"/>
77
  </dir>
78
  </dir>
79
  <dir name="Meta">
80
  <dir name="Account">
81
+ <file name="Billing.php" hash="d26a6d06313a546cc197832c8b6a72e6"/>
82
+ <file name="Iframe.php" hash="ac0df1a92b5202fd5ad8b583073a18cc"/>
83
+ <file name="Owner.php" hash="076f8ae3c01994fde2fcf7c0dec714cc"/>
84
  </dir>
85
+ <file name="Account.php" hash="5c8c4d737dbd45f5d5aa32d357e954a0"/>
86
+ <file name="Oauth.php" hash="25e361de164751c01872cda7e85cb60f"/>
87
  <dir name="Order">
88
+ <file name="Buyer.php" hash="29ef1477ab88c234271f9e075387af21"/>
89
+ <file name="Item.php" hash="5ee46c5b23204c0c8679620ef98e83b4"/>
90
+ <file name="Status.php" hash="2abe147745bd832cfacb7aeebfcda7e0"/>
91
  </dir>
92
+ <file name="Order.php" hash="ed1e8b3bdf4cf4fe9a23de6e2cdf69d4"/>
93
+ <file name="Product.php" hash="e4d7ebab75f6b050fc0120947fd213e8"/>
94
  </dir>
95
+ <file name="Observer.php" hash="f4a09b58fcd625a67d460a7797d2f334"/>
96
+ <file name="Product.php" hash="df071b5a356793a1a2d3eae36a87d713"/>
97
  <dir name="Resource">
98
  <dir name="Customer">
99
+ <file name="Collection.php" hash="cb50bd89badc31867fc8927afff833ff"/>
100
  </dir>
101
+ <file name="Customer.php" hash="2db99b6ea05d69d33747525f3895fe35"/>
102
  <dir name="Product">
103
+ <file name="Collection.php" hash="b16d1c3559661fa840a79637a01ddd33"/>
104
  </dir>
105
+ <file name="Setup.php" hash="688082f95af4cd0676f9dac374c48fc3"/>
106
  </dir>
107
  <dir name="Service">
108
+ <file name="Order.php" hash="95b087b90689a13e5a563ce7cdf596fa"/>
109
  </dir>
110
  <dir name="System">
111
  <dir name="Config">
112
+ <dir name="Backend">
113
+ <dir name="Currency">
114
+ <dir name="Exchange">
115
+ <dir name="Rate">
116
+ <file name="Cron.php" hash="b77cd590d717ce92aa4f38e20700d6b8"/>
117
+ </dir>
118
+ </dir>
119
+ </dir>
120
+ </dir>
121
+ <dir name="Brand">
122
+ <file name="Source.php" hash="ca6de651a9ea79a881abfbcf11da8f7d"/>
123
+ </dir>
124
+ <dir name="CustomTags">
125
+ <file name="Source.php" hash="556abacec5981385850f1e2c263eca9d"/>
126
+ </dir>
127
  <dir name="Source">
128
+ <file name="Image.php" hash="0377e330d49c691e87983b02e8a85423"/>
129
+ <dir name="Multi">
130
+ <dir name="Currency">
131
+ <file name="Method.php" hash="8744977f5cb26630befcb6eb5d5c66d9"/>
132
+ </dir>
133
+ </dir>
134
  </dir>
135
  </dir>
136
  </dir>
137
  </dir>
138
+ <file name="bootstrap.php" hash="3b334002827272f5e0dc682e1e0d5ef9"/>
139
  <dir name="controllers">
140
  <dir name="Adminhtml">
141
+ <file name="NostoController.php" hash="eac8ecefd90166d4912b96a1cbf1e1db"/>
142
  </dir>
143
+ <file name="ExportController.php" hash="79bebd19f52d85d3335abc4270fd8ff7"/>
144
+ <file name="OauthController.php" hash="16d7d1b58090a748f2c35cebd1b3b01a"/>
145
  </dir>
146
  <dir name="etc">
147
+ <file name="adminhtml.xml" hash="94c1710b2a8f0b7b0a15918f7c88d975"/>
148
+ <file name="cache.xml" hash="b034f279196c596f2602102bd5e44c2c"/>
149
+ <file name="config.xml" hash="7bd3c51a1432c468cca56bdb12860eea"/>
150
+ <file name="system.xml" hash="376a97fabcaab7ec6b433e3a3fcde835"/>
151
  </dir>
152
  <dir name="sql">
153
+ <dir name="nosto_customer_reference_setup">
154
+ <file name="mysql4-install-2.8.0.php" hash="a50fd9bb9d3276e305a84dc9057332c8"/>
155
+ </dir>
156
  <dir name="tagging_setup">
157
+ <file name="mysql4-install-1.2.0.php" hash="be30ee06f46c101c5f078f9d55bb139d"/>
158
+ <file name="mysql4-upgrade-1.1.7-1.2.0.php" hash="ff774ae3c70648b33eb5eae68debd555"/>
159
  </dir>
160
  </dir>
161
  </dir>
166
  <dir name="default">
167
  <dir name="default">
168
  <dir name="layout">
169
+ <file name="nostotagging.xml" hash="a367ca196e0c6f7202ff6f6f4f073f75"/>
170
  </dir>
171
  <dir name="template">
172
  <dir name="nostotagging">
173
+ <file name="iframe.phtml" hash="3c156000e4522c237ff0600aa8eafa10"/>
174
+ <file name="notifications.phtml" hash="bbf3b98b2509019bd8e4abe7e669d90b"/>
175
+ <dir name="system">
176
+ <dir name="config">
177
+ <dir name="currency">
178
+ <file name="formats.phtml" hash="2587f642e4d46340f7057c6c40fa20dd"/>
179
+ </dir>
180
+ </dir>
181
+ </dir>
182
+ <file name="wizard.phtml" hash="02b937a25e316e9dfe957104e44be0be"/>
183
  </dir>
184
  </dir>
185
  </dir>
189
  <dir name="base">
190
  <dir name="default">
191
  <dir name="layout">
192
+ <file name="nostotagging.xml" hash="2cc1f8fd94ea409cb200e8e53d15c1fc"/>
193
  </dir>
194
  <dir name="template">
195
  <dir name="nostotagging">
196
+ <file name="addtocart.phtml" hash="e495fdcaf779479c23f025885dfd5cee"/>
197
+ <file name="cart.phtml" hash="a5df7adacaf2dfaf77211aec705ba576"/>
198
+ <file name="category.phtml" hash="320ccee20c5efaac60de2fa88b4ed996"/>
199
+ <file name="customer.phtml" hash="f9ceeeac8c9909b2650f57743400592b"/>
200
+ <file name="element.phtml" hash="c982ed5ae7ac44267ef6b4e7405d0df6"/>
201
+ <file name="embed.phtml" hash="9980a5cd3fb315962e052497127b8332"/>
202
+ <file name="meta.phtml" hash="0f409190231247732707e17766364233"/>
203
+ <file name="order.phtml" hash="69ee18e576e0afa297ef5c96f1b4d812"/>
204
+ <file name="pagetype.phtml" hash="9ecf0d771936492f41f07add170455f5"/>
205
+ <file name="product.phtml" hash="472c255b7d3ef59052d1563c4627009a"/>
206
+ <file name="searchterm.phtml" hash="f3f87d0f7757a96307aa87ce03e5f292"/>
207
+ <file name="variation.phtml" hash="80cf94a8a820ef595ee992df1e0eba7d"/>
 
208
  </dir>
209
  </dir>
210
  </dir>
213
  </target>
214
  <target name="mageetc">
215
  <dir name="modules">
216
+ <file name="Nosto_Tagging.xml" hash="2f413332dea61ddd8277998e0f059df5"/>
217
  </dir>
218
  </target>
219
  <target name="magelib">
221
  <dir name="php-sdk">
222
  <dir name="src">
223
  <dir name="classes">
224
+ <file name="Nosto.php" hash="2c7b6c163a017b509a85a5c2a6869e42"/>
225
+ <file name="NostoAccount.php" hash="d1ade30ca8630ac04149b7f0e12e113a"/>
226
+ <file name="NostoAccountMeta.php" hash="f6e81dbead7b9425afed98f13faec9c9"/>
227
+ <file name="NostoCipher.php" hash="f0af45e9fc48fe2734b6798ee5e3cdfc"/>
228
+ <file name="NostoCurrency.php" hash="511399f42ff5793de445944b5456c28e"/>
229
+ <file name="NostoCurrencyCode.php" hash="e2f14283c22f7aac9744150b9bd6457a"/>
230
+ <file name="NostoCurrencyFormat.php" hash="e676309a9f9420f0912bbf65b5363bda"/>
231
+ <file name="NostoCurrencyInfo.php" hash="2c8b7f50bfa483f1df764909441351fa"/>
232
+ <file name="NostoCurrencySymbol.php" hash="9f16f03a3d7187710daa37dac7ecf1c2"/>
233
+ <file name="NostoDotEnv.php" hash="be272235f6d48705023beeb6a24f2ce9"/>
234
+ <file name="NostoExchangeRate.php" hash="d6b70ad6bb434aba02bc450f1d066d34"/>
235
+ <file name="NostoMessage.php" hash="48912d9e00c08b5b5374eee368067cb4"/>
236
+ <file name="NostoObject.php" hash="0a348871fed339e7bdc57237e7947441"/>
237
+ <file name="NostoOrderConfirmation.php" hash="4f3ceb7ecbbdd2b78824e5d030fd60cf"/>
238
+ <file name="NostoProductReCrawl.php" hash="0b24f2fb00c9601e9b3d529f61a23bc5"/>
239
+ <file name="NostoValidator.php" hash="70523f08482bd8ef3a1a52a7fda2e237"/>
240
  <dir name="api">
241
+ <file name="NostoApiRequest.php" hash="e3f7acbded105c2c521233e25f4c740b"/>
242
+ <file name="NostoApiToken.php" hash="bf46e7be1d5bbb1c5e79cbb55b2e559e"/>
243
  </dir>
244
  <dir name="collection">
245
+ <file name="NostoCollection.php" hash="9e85a39ac3a860becd63d2d3cc64659f"/>
246
+ <file name="NostoExchangeRateCollection.php" hash="c06337ff17993eb7da1f2b653a74bccb"/>
247
+ <file name="NostoOrderCollection.php" hash="57cf60f4c4bc7ad57211d9c542420e15"/>
248
+ <file name="NostoProductCollection.php" hash="fcae6d129e8fad82099a05600fef8eea"/>
249
  </dir>
250
  <dir name="exception">
251
+ <file name="NostoApiResponseException.php" hash="e5430f3d3cfdc1a8f02cc68cb351da40"/>
252
+ <file name="NostoException.php" hash="d73bdc24769b5f9483a46b218254c488"/>
253
+ <file name="NostoHttpException.php" hash="9abf965891309b45ab9d0cd60382432e"/>
254
+ <file name="NostoHttpResponseException.php" hash="1549798afd49cf52e522fd6d8d9481f3"/>
255
  </dir>
256
  <dir name="export">
257
+ <file name="NostoExportOrderCollection.php" hash="9e1c115ef84617f96e9896ffc67f3586"/>
258
+ <file name="NostoExportProductCollection.php" hash="a4a01403ec51898b390e0ac07e79bd13"/>
259
+ <file name="NostoExporter.php" hash="6c242c8b66a504483bff29ee83e795b8"/>
260
  </dir>
261
  <dir name="helper">
262
+ <file name="NostoHelper.php" hash="87ab4af83eb0f346238677e07acdd49e"/>
263
+ <file name="NostoHelperDate.php" hash="071e881ba63521bd3adfa50d14acfe43"/>
264
+ <file name="NostoHelperIframe.php" hash="a83dd911b45db7bd69bbfa38a6bb9d3b"/>
265
+ <file name="NostoHelperPrice.php" hash="49ea7add4987844de5566c16c6e54112"/>
266
  </dir>
267
  <dir name="http">
268
+ <file name="NostoHttpRequest.php" hash="cc72e0324cb6d3244c4f40f2bd760689"/>
269
+ <file name="NostoHttpRequestAdapter.php" hash="e3ee66855cb2a81795172d85cafd75f0"/>
270
+ <file name="NostoHttpRequestAdapterCurl.php" hash="7ed6a572e36d5a2e3e6ff3ac7a1382c1"/>
271
+ <file name="NostoHttpRequestAdapterSocket.php" hash="703f6b9a7d54a920b2b442ab30c3d13a"/>
272
+ <file name="NostoHttpResponse.php" hash="6e6b6a155679604637e86b2a1faa29db"/>
273
  </dir>
274
  <dir name="oauth">
275
+ <file name="NostoOAuthClient.php" hash="d0ffcdcac250639715bfc1927f10e59c"/>
276
+ <file name="NostoOAuthToken.php" hash="b771e384b2751a0255f0f5755f5fb6c6"/>
277
  </dir>
278
  <dir name="operation">
279
+ <file name="NostoOperationAccount.php" hash="dc7e52907b64b5e5149814bb048eb283"/>
280
+ <file name="NostoOperationExchangeRate.php" hash="65b411b16d3ef340f156aaf7f9fd81d2"/>
281
+ <file name="NostoOperationProduct.php" hash="4efa9da47169eea8f23df78bdd9a23ef"/>
282
  </dir>
283
  </dir>
284
+ <file name="config.inc.php" hash="2588b6b13b9877dd14a1d4d7d0747c2f"/>
285
  <dir name="interfaces">
286
+ <file name="NostoExchangeRateInterface.php" hash="6c68bd4b564021cf0cb7e3f5b4b16ebe"/>
287
+ <file name="NostoExportCollectionInterface.php" hash="5de9b4dbbbbc1d1b41a53990536a51b5"/>
288
+ <file name="NostoOAuthClientMetaDataInterface.php" hash="98f06f774b4a9af07ef4024bb49ce447"/>
289
+ <file name="NostoProductInterface.php" hash="81f39209104ef2b79e026c9bbd392957"/>
290
+ <file name="NostoValidatableInterface.php" hash="9a14e13c2f20653ceb202b8f247e46ce"/>
291
  <dir name="account">
292
+ <file name="NostoAccountInterface.php" hash="7cceb9174b7a3960ef978be416448e6c"/>
293
+ <file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="7e294f596d899af9aa5cf8dea94390e0"/>
294
+ <file name="NostoAccountMetaDataIframeInterface.php" hash="11ae6877125b32ca25a2545b41f91b9e"/>
295
+ <file name="NostoAccountMetaDataInterface.php" hash="c9d9a739d88db6cc4b3137f06ef930b7"/>
296
+ <file name="NostoAccountMetaDataOwnerInterface.php" hash="be8d01705b37778a8ed61e01db2178f6"/>
297
  </dir>
298
  <dir name="order">
299
+ <file name="NostoOrderBuyerInterface.php" hash="400f680f5e1827bf76fea06a454c3ecd"/>
300
+ <file name="NostoOrderInterface.php" hash="b5c3f5d59b7ac97b925e13ef9d13d96b"/>
301
+ <file name="NostoOrderPurchasedItemInterface.php" hash="978d961aefce11ec732fa2257d667df0"/>
302
+ <file name="NostoOrderStatusInterface.php" hash="80dc0acc4644d007279af286515d8073"/>
303
  </dir>
304
  </dir>
305
  <dir name="js">
306
  <file name="NostoIframe.min.js" hash="5fd9f5b418dd796c469aaa0c58b34aaa"/>
307
  <dir name="src">
308
+ <file name="NostoIframe.js" hash="53eaf62450081dd7fc86bd2203512cb6"/>
309
  </dir>
310
  </dir>
311
  <dir name="libs">
325
  <target name="mageweb">
326
  <dir name="js">
327
  <dir name="nosto">
328
+ <file name="iframeHandler.min.js" hash="7a4eec2ab2082f0669b106511985ccf7"/>
329
  <file name="iframeResizer.min.js" hash="163b065c9dd702dc364913a951b81fee"/>
330
  </dir>
331
  </dir>
336
  <required>
337
  <php>
338
  <min>5.2.0</min>
339
+ <max>7.1.0</max>
340
  </php>
341
  <package>
342
  <name>Mage_Core_Modules</name>