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.10.0 |
Comparing to | |
See all releases |
Code changes from version 2.6.14 to 2.10.0
- app/code/community/Nosto/Tagging/Block/Addtocart.php +9 -7
- app/code/community/Nosto/Tagging/Block/Adminhtml/Iframe.php +20 -11
- app/code/community/Nosto/Tagging/Block/Adminhtml/Notifications.php +196 -0
- app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/CronFrequency.php +139 -0
- app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Formats.php +88 -0
- app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Method.php +83 -0
- app/code/community/Nosto/Tagging/Block/Cart.php +23 -8
- app/code/community/Nosto/Tagging/Block/Category.php +12 -9
- app/code/community/Nosto/Tagging/Block/Customer.php +59 -9
- app/code/community/Nosto/Tagging/Block/Element.php +9 -7
- app/code/community/Nosto/Tagging/Block/Embed.php +12 -8
- app/code/community/Nosto/Tagging/Block/Meta.php +9 -7
- app/code/community/Nosto/Tagging/Block/Order.php +22 -7
- app/code/community/Nosto/Tagging/Block/Order/Vaimo/Klarna/Checkout.php +96 -0
- app/code/community/Nosto/Tagging/Block/Pagetype.php +79 -0
- app/code/community/Nosto/Tagging/Block/Product.php +12 -9
- app/code/community/Nosto/Tagging/Block/Searchterm.php +7 -3
- app/code/community/Nosto/Tagging/Block/Variation.php +85 -0
- app/code/community/Nosto/Tagging/Helper/Account.php +166 -37
- app/code/community/Nosto/Tagging/Helper/Cache.php +55 -0
- app/code/community/Nosto/Tagging/Helper/Class.php +143 -0
- app/code/community/Nosto/Tagging/Helper/Currency.php +118 -0
- app/code/community/Nosto/Tagging/Helper/Customer.php +28 -7
- app/code/community/Nosto/Tagging/Helper/Data.php +393 -9
- app/code/community/Nosto/Tagging/Helper/Date.php +6 -6
- app/code/community/Nosto/Tagging/Helper/Module.php +126 -0
- app/code/community/Nosto/Tagging/Helper/Oauth.php +6 -6
- app/code/community/Nosto/Tagging/Helper/Price.php +150 -28
- app/code/community/Nosto/Tagging/Helper/Rating.php +143 -0
- app/code/community/Nosto/Tagging/Helper/Setup.php +113 -0
- app/code/community/Nosto/Tagging/Helper/Stock.php +128 -0
- app/code/community/Nosto/Tagging/Helper/Url.php +279 -45
- app/code/community/Nosto/Tagging/Model/Base.php +6 -6
- app/code/community/Nosto/Tagging/Model/{Resource/Setup.php → Collection/Rates.php} +8 -12
- app/code/community/Nosto/Tagging/Model/Container/Cart.php +13 -6
- app/code/community/Nosto/Tagging/Model/Container/Customer.php +15 -6
- app/code/community/Nosto/Tagging/Model/Customer.php +6 -6
- app/code/community/Nosto/Tagging/Model/Export/Collection/Order.php +12 -8
- app/code/community/Nosto/Tagging/Model/Meta/Account.php +77 -17
- app/code/community/Nosto/Tagging/Model/Meta/Account/Billing.php +6 -6
- app/code/community/Nosto/Tagging/Model/Meta/Account/Iframe.php +23 -7
- app/code/community/Nosto/Tagging/Model/Meta/Account/Owner.php +14 -12
- app/code/community/Nosto/Tagging/Model/Meta/Oauth.php +9 -13
- app/code/community/Nosto/Tagging/Model/Meta/Order.php +9 -7
- app/code/community/Nosto/Tagging/Model/Meta/Order/Buyer.php +7 -6
- app/code/community/Nosto/Tagging/Model/Meta/Order/Item.php +14 -7
- app/code/community/Nosto/Tagging/Model/Meta/Order/Status.php +7 -6
- app/code/community/Nosto/Tagging/Model/Meta/Order/Vaimo/Klarna/Checkout.php +342 -0
- app/code/community/Nosto/Tagging/Model/Meta/Product.php +426 -67
- app/code/community/Nosto/Tagging/Model/Meta/Rating.php +87 -0
- app/code/community/Nosto/Tagging/Model/Meta/Rating/Interface.php +68 -0
- app/code/community/Nosto/Tagging/Model/Meta/Rating/Mage/Rating.php +68 -0
- app/code/community/Nosto/Tagging/Model/Meta/Rating/Yotpo/Yotpo.php +106 -0
- app/code/community/Nosto/Tagging/Model/Observer.php +156 -65
- app/code/community/Nosto/Tagging/Model/Product.php +6 -6
- app/code/community/Nosto/Tagging/Model/Resource/Customer.php +6 -6
- app/code/community/Nosto/Tagging/Model/Resource/Customer/Collection.php +6 -6
- app/code/community/Nosto/Tagging/Model/Resource/Product/Collection.php +6 -6
- app/code/community/Nosto/Tagging/Model/Service/Order.php +73 -9
- app/code/community/Nosto/Tagging/Model/Service/Product.php +143 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Backend/Currency/Exchange/Rate/Cron.php +82 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Attribute.php +134 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Cron/Frequency.php +59 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Custom/Tags.php +46 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Image.php +16 -12
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Multi/Currency/Method.php +60 -0
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Price/Attribute.php +60 -0
- app/code/community/Nosto/Tagging/{Block/Adminhtml/Wizard.php → Model/System/Config/Source/Product/Attribute.php} +11 -4
- app/code/community/Nosto/Tagging/Model/System/Config/Source/Ratings/Provider.php +66 -0
- app/code/community/Nosto/Tagging/bootstrap.php +24 -31
- app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php +213 -9
- app/code/community/Nosto/Tagging/controllers/ExportController.php +17 -11
- app/code/community/Nosto/Tagging/controllers/OauthController.php +14 -8
- app/code/community/Nosto/Tagging/etc/adminhtml.xml +25 -26
- app/code/community/Nosto/Tagging/etc/cache.xml +25 -26
- app/code/community/Nosto/Tagging/etc/config.xml +81 -29
- app/code/community/Nosto/Tagging/etc/system.xml +260 -28
- app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-install-2.8.0.php +37 -0
- app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-upgrade-2.8.0-2.8.2.php +37 -0
- app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-install-1.2.0.php +46 -44
- app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-upgrade-1.1.7-1.2.0.php +7 -7
- app/design/adminhtml/default/default/layout/nostotagging.xml +31 -27
- app/design/adminhtml/default/default/template/nostotagging/iframe.phtml +9 -8
- app/design/adminhtml/default/default/template/nostotagging/notifications.phtml +56 -0
- app/design/adminhtml/default/default/template/nostotagging/system/config/currency/cronFrequency.phtml +78 -0
- app/design/adminhtml/default/default/template/nostotagging/system/config/currency/formats.phtml +47 -0
- app/design/adminhtml/default/default/template/nostotagging/wizard.phtml +9 -9
- app/design/frontend/base/default/layout/nostotagging.xml +117 -27
- app/design/frontend/base/default/template/nostotagging/addtocart.phtml +40 -15
- app/design/frontend/base/default/template/nostotagging/cart.phtml +10 -11
- app/design/frontend/base/default/template/nostotagging/category.phtml +8 -10
- app/design/frontend/base/default/template/nostotagging/customer.phtml +8 -8
- app/design/frontend/base/default/template/nostotagging/element.phtml +8 -10
- app/design/frontend/base/default/template/nostotagging/embed.phtml +11 -16
- app/design/frontend/base/default/template/nostotagging/jsstub.phtml +35 -0
- app/design/frontend/base/default/template/nostotagging/meta.phtml +8 -10
- app/design/frontend/base/default/template/nostotagging/order.phtml +9 -10
- app/design/frontend/base/default/template/nostotagging/{category/view.phtml → pagetype.phtml} +5 -6
- app/design/frontend/base/default/template/nostotagging/product.phtml +14 -7
- app/design/frontend/base/default/template/nostotagging/searchterm.phtml +6 -8
- app/design/frontend/base/default/template/nostotagging/variation.phtml +37 -0
- app/etc/modules/Nosto_Tagging.xml +25 -26
- js/nosto/iframeHandler.min.js +1 -1
- lib/nosto/php-sdk/src/classes/Nosto.php +47 -7
- lib/nosto/php-sdk/src/classes/NostoAccount.php +52 -12
- lib/nosto/php-sdk/src/classes/NostoAccountMeta.php +110 -43
- lib/nosto/php-sdk/src/classes/NostoCipher.php +3 -2
- lib/nosto/php-sdk/src/classes/NostoCurrency.php +27 -16
- lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php +1 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php +1 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php +1 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php +1 -0
- lib/nosto/php-sdk/src/classes/NostoDotEnv.php +3 -2
- lib/nosto/php-sdk/src/classes/NostoExchangeRate.php +1 -0
- lib/nosto/php-sdk/src/classes/NostoMessage.php +3 -2
- lib/nosto/php-sdk/src/classes/NostoNotification.php +256 -0
- lib/nosto/php-sdk/src/classes/NostoObject.php +3 -2
- lib/nosto/php-sdk/src/classes/NostoOrderConfirmation.php +5 -2
- lib/nosto/php-sdk/src/classes/NostoProductReCrawl.php +6 -3
- lib/nosto/php-sdk/src/classes/NostoValidator.php +14 -13
- lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php +3 -2
- lib/nosto/php-sdk/src/classes/api/NostoApiToken.php +16 -2
- lib/nosto/php-sdk/src/classes/collection/NostoCollection.php +3 -2
- lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php +3 -2
- lib/nosto/php-sdk/src/classes/collection/NostoOrderCollection.php +3 -2
- lib/nosto/php-sdk/src/classes/collection/NostoProductCollection.php +3 -2
- lib/nosto/php-sdk/src/classes/exception/NostoApiResponseException.php +42 -0
- lib/nosto/php-sdk/src/classes/exception/NostoException.php +3 -2
- lib/nosto/php-sdk/src/classes/exception/NostoHttpException.php +64 -2
- lib/nosto/php-sdk/src/classes/exception/NostoHttpResponseException.php +42 -0
- lib/nosto/php-sdk/src/classes/export/NostoExportOrderCollection.php +5 -2
- lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php +4 -38
- lib/nosto/php-sdk/src/classes/export/NostoExporter.php +3 -2
- lib/nosto/php-sdk/src/classes/helper/NostoHelper.php +3 -2
- lib/nosto/php-sdk/src/classes/helper/NostoHelperDate.php +3 -2
- lib/nosto/php-sdk/src/classes/helper/NostoHelperIframe.php +28 -19
- lib/nosto/php-sdk/src/classes/helper/NostoHelperPrice.php +10 -4
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php +13 -2
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapter.php +3 -2
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php +10 -7
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php +6 -2
- lib/nosto/php-sdk/src/classes/http/NostoHttpResponse.php +7 -6
- lib/nosto/php-sdk/src/classes/oauth/NostoOAuthClient.php +5 -4
- lib/nosto/php-sdk/src/classes/oauth/NostoOAuthToken.php +3 -2
- lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php +1 -0
- lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php +7 -4
- lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php +56 -11
- lib/nosto/php-sdk/src/config.inc.php +7 -2
- lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/NostoExportCollectionInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/NostoNotificationInterface.php +108 -0
- lib/nosto/php-sdk/src/interfaces/NostoOAuthClientMetaDataInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php +102 -8
- lib/nosto/php-sdk/src/interfaces/NostoValidatableInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountInterface.php +19 -3
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataBillingDetailsInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataIframeInterface.php +10 -2
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php +10 -2
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataOwnerInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/order/NostoOrderBuyerInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/order/NostoOrderInterface.php +10 -2
- lib/nosto/php-sdk/src/interfaces/order/NostoOrderPurchasedItemInterface.php +3 -2
- lib/nosto/php-sdk/src/interfaces/order/NostoOrderStatusInterface.php +3 -2
- lib/nosto/php-sdk/src/js/src/NostoIframe.js +4 -3
- package.xml +225 -135
app/code/community/Nosto/Tagging/Block/Addtocart.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
||
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -36,16 +36,17 @@
|
|
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.
|
42 |
*/
|
43 |
-
|
44 |
|
45 |
/**
|
46 |
* @var Mage_Core_Model_Store the currently selected store view.
|
47 |
*/
|
48 |
-
|
49 |
|
50 |
/**
|
51 |
* Gets the iframe url for the account settings page from Nosto.
|
@@ -77,10 +78,18 @@ class Nosto_Tagging_Block_Adminhtml_Iframe extends Mage_Adminhtml_Block_Template
|
|
77 |
$session->setData('nosto_message', null);
|
78 |
}
|
79 |
}
|
|
|
80 |
$store = $this->getSelectedStore();
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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.
|
43 |
*/
|
44 |
+
protected $_iframeUrl;
|
45 |
|
46 |
/**
|
47 |
* @var Mage_Core_Model_Store the currently selected store view.
|
48 |
*/
|
49 |
+
protected $_store;
|
50 |
|
51 |
/**
|
52 |
* Gets the iframe url for the account settings page from Nosto.
|
78 |
$session->setData('nosto_message', null);
|
79 |
}
|
80 |
}
|
81 |
+
$params['v'] = self::IFRAME_VERSION;
|
82 |
$store = $this->getSelectedStore();
|
83 |
+
/* @var Mage_Core_Model_App_Emulation $emulation */
|
84 |
+
$emulation = Mage::getSingleton('core/app_emulation');
|
85 |
+
$env = $emulation->startEnvironmentEmulation($store->getId());
|
86 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
87 |
+
$helper = Mage::helper('nosto_tagging/account');
|
88 |
+
$account = $helper->find($store);
|
89 |
+
$this->_iframeUrl = $helper->getIframeUrl($store, $account, $params);
|
90 |
+
$emulation->stopEnvironmentEmulation($env);
|
91 |
+
|
92 |
+
return $this->_iframeUrl;
|
93 |
}
|
94 |
|
95 |
/**
|
app/code/community/Nosto/Tagging/Block/Adminhtml/Notifications.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
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-2017 Nosto 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 exchange rate cron is configured
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
const EXCHANGE_RATE_CRON_FRAGMENT = 'nosto_tagging_scheduled_currency_exchange_rate_update-head';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Returns the status of the accounts for showing the notification. If any
|
47 |
+
* of the accounts use multi-currency and have tokens missing, then the
|
48 |
+
* notification bar should inform the merchant
|
49 |
+
*
|
50 |
+
* @return bool true or false indicating the status of the accounts
|
51 |
+
*/
|
52 |
+
public function allAccountsOK()
|
53 |
+
{
|
54 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
55 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
56 |
+
/** @var Nosto_Tagging_Helper_Data $dataHelper */
|
57 |
+
$dataHelper = Mage::helper('nosto_tagging/data');
|
58 |
+
foreach (Mage::app()->getStores() as $store) {
|
59 |
+
/** @var NostoAccount $account */
|
60 |
+
$account = $accountHelper->find($store);
|
61 |
+
if ($account !== null
|
62 |
+
&& $account->isConnectedToNosto()
|
63 |
+
&& $account->hasMissingTokens()
|
64 |
+
&& !$dataHelper->multiCurrencyDisabled($store)) {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
return true;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Get index management url
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function getConfigureUrl()
|
77 |
+
{
|
78 |
+
return $this->getUrl(
|
79 |
+
'adminhtml/system_config/edit/section/nosto_tagging',
|
80 |
+
array(
|
81 |
+
'_fragment' => self::EXCHANGE_RATE_CRON_FRAGMENT
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Returns the status of the cron of the accounts for showing the
|
88 |
+
* notification. If any of the accounts use multi-currency but cron is
|
89 |
+
* disabled then the notification bar should inform the merchant
|
90 |
+
*
|
91 |
+
* @return bool true or false indicating the cron status
|
92 |
+
*/
|
93 |
+
public function cronEnabledIfNeeded()
|
94 |
+
{
|
95 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
96 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
97 |
+
/** @var Nosto_Tagging_Helper_Data $dataHelper */
|
98 |
+
$dataHelper = Mage::helper('nosto_tagging/data');
|
99 |
+
foreach (Mage::app()->getStores() as $store) {
|
100 |
+
$account = $accountHelper->find($store);
|
101 |
+
if ($account !== null
|
102 |
+
&& !$dataHelper->multiCurrencyDisabled($store)
|
103 |
+
&& !$dataHelper->isScheduledCurrencyExchangeRateUpdateEnabled($store)) {
|
104 |
+
return false;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
return true;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if any of the Nosto accounts where previously installed into a
|
112 |
+
* different store or magento installation. 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 |
+
|
147 |
+
$currentFrontPageUrl = $urlHelper->getFrontPageUrl($store);
|
148 |
+
if (
|
149 |
+
!self::storeUrlsMatch(
|
150 |
+
$savedFrontPageUrl,
|
151 |
+
$currentFrontPageUrl
|
152 |
+
)
|
153 |
+
) {
|
154 |
+
$invalidConfig = array(
|
155 |
+
'savedUrl' => $savedFrontPageUrl,
|
156 |
+
'currentUrl' => $currentFrontPageUrl,
|
157 |
+
'storeName' => $store->getName(),
|
158 |
+
'nostoAccount' => $nostoAccount->getName(),
|
159 |
+
'actionUrl' => $this->getUrl(
|
160 |
+
'adminhtml/nosto/resetAccountSettings/',
|
161 |
+
array('store'=>$store->getId())
|
162 |
+
)
|
163 |
+
);
|
164 |
+
|
165 |
+
$result[] = $invalidConfig;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
return $result;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Compares two URLs with host and path part
|
174 |
+
* @param string $installedUrl
|
175 |
+
* @param string $currentUrl
|
176 |
+
* @return bool
|
177 |
+
*/
|
178 |
+
protected static function storeUrlsMatch(
|
179 |
+
$installedUrl,
|
180 |
+
$currentUrl
|
181 |
+
)
|
182 |
+
{
|
183 |
+
$match = true;
|
184 |
+
/* @var Mage_Core_Model_Url $mageUrl */
|
185 |
+
$mageUrl = Mage::getSingleton('core/url');
|
186 |
+
$installedModel = clone $mageUrl->parseUrl($installedUrl);;
|
187 |
+
$currentModel = $mageUrl->parseUrl($currentUrl);
|
188 |
+
$concatInstalled = $installedModel->getHost() . $installedModel->getPath();
|
189 |
+
$concatCurrent= $currentModel->getHost() . $currentModel->getPath();
|
190 |
+
if ($concatCurrent != $concatInstalled) {
|
191 |
+
$match = false;
|
192 |
+
}
|
193 |
+
|
194 |
+
return $match;
|
195 |
+
}
|
196 |
+
}
|
app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/CronFrequency.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Block for editing Nosto's currency exchange cron frequency
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Block_Adminhtml_System_Config_Currency_CronFrequency
|
36 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* The select name
|
40 |
+
*/
|
41 |
+
const HOUR_SELECT_NAME = 'groups[scheduled_currency_exchange_rate_update][fields][time][value][]';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Array of the available frequency options
|
45 |
+
*
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
protected $options;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Form element to be rendered
|
52 |
+
*
|
53 |
+
* @var Varien_Data_Form_Element_Abstract
|
54 |
+
*/
|
55 |
+
protected $element;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @inheritdoc
|
59 |
+
*/
|
60 |
+
protected function _construct()
|
61 |
+
{
|
62 |
+
parent::_construct();
|
63 |
+
$this->setTemplate(
|
64 |
+
'nostotagging/system/config/currency/cronFrequency.phtml'
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @inheritdoc
|
70 |
+
*/
|
71 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
72 |
+
{
|
73 |
+
$this->element = $element;
|
74 |
+
$data = $this->element->getData();
|
75 |
+
if (isset($data['values']) && is_array($data['values'])) {
|
76 |
+
$this->options = $data['values'];
|
77 |
+
} else {
|
78 |
+
Mage::log(
|
79 |
+
'Could not find any options for cron frequency',
|
80 |
+
Zend_Log::ERR,
|
81 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $this->_toHtml();
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns the options for exchange rate cron frequency
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
public function getOptions()
|
94 |
+
{
|
95 |
+
return $this->options;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Returns the id of the select id
|
100 |
+
*
|
101 |
+
* @return array
|
102 |
+
*/
|
103 |
+
public function getSelectId()
|
104 |
+
{
|
105 |
+
return $this->element->getHtmlId();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Returns the name of the select tag
|
110 |
+
*
|
111 |
+
* @return array
|
112 |
+
*/
|
113 |
+
public function getSelectName()
|
114 |
+
{
|
115 |
+
return $this->element->getName();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Returns the name of the hour select field
|
120 |
+
*
|
121 |
+
* @return array
|
122 |
+
*/
|
123 |
+
public function getHourSelectName()
|
124 |
+
{
|
125 |
+
return self::HOUR_SELECT_NAME;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Returns the current value
|
130 |
+
*
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function getCurrentValue()
|
134 |
+
{
|
135 |
+
/* @var Nosto_Tagging_Helper_Data $configHelper */
|
136 |
+
$configHelper = Mage::helper('nosto_tagging');
|
137 |
+
return $configHelper->getExchangeRateCronFrequency();
|
138 |
+
}
|
139 |
+
}
|
app/code/community/Nosto/Tagging/Block/Adminhtml/System/Config/Currency/Formats.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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-2017 Nosto 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);
|
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/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-
|
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 |
-
||
|
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 |
-
|
|
|
|
|
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-2017 Nosto 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-
|
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 |
-
||
|
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 |
-
|
72 |
-
|
|
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -43,13 +43,63 @@ class Nosto_Tagging_Block_Customer extends Mage_Customer_Block_Account_Dashboard
|
|
43 |
*/
|
44 |
protected function _toHtml()
|
45 |
{
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
43 |
*/
|
44 |
protected function _toHtml()
|
45 |
{
|
46 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
47 |
+
$helper = Mage::helper('nosto_tagging/account');
|
48 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
49 |
+
if (!Mage::helper('nosto_tagging')->isModuleEnabled()
|
50 |
+
|| !$helper->existsAndIsConnected()
|
51 |
+
|| !$this->helper('customer')->isLoggedIn()
|
52 |
) {
|
53 |
return '';
|
54 |
}
|
55 |
|
56 |
return parent::_toHtml();
|
57 |
}
|
58 |
+
|
59 |
+
/*
|
60 |
+
* Returns the visitor's Nosto Id
|
61 |
+
*/
|
62 |
+
public function getVisitorChecksum()
|
63 |
+
{
|
64 |
+
/* @var $helper Nosto_Tagging_Helper_Data */
|
65 |
+
$helper = Mage::helper('nosto_tagging');
|
66 |
+
|
67 |
+
return $helper->getVisitorChecksum();
|
68 |
+
}
|
69 |
+
|
70 |
+
/*
|
71 |
+
* Returns the customer reference of the customer
|
72 |
+
*/
|
73 |
+
protected function getCustomerReference()
|
74 |
+
{
|
75 |
+
try {
|
76 |
+
/* @var $customerHelper Nosto_Tagging_Helper_Customer */
|
77 |
+
$customerHelper = Mage::helper('nosto_tagging/customer');
|
78 |
+
/* @var $customer Mage_Customer_Model_Customer */
|
79 |
+
$customer = $this->getCustomer();
|
80 |
+
$ref = $customer->getData(
|
81 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
|
82 |
+
);
|
83 |
+
if (empty($ref)) {
|
84 |
+
$ref = $customerHelper->generateCustomerReference($customer);
|
85 |
+
$customer->setData(
|
86 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
|
87 |
+
$ref
|
88 |
+
);
|
89 |
+
$customer->save();
|
90 |
+
}
|
91 |
+
} catch (\Exception $e) {
|
92 |
+
Mage::log(
|
93 |
+
sprintf(
|
94 |
+
'Could not get customer reference. Error was: %s',
|
95 |
+
$e->getMessage()
|
96 |
+
),
|
97 |
+
Zend_Log::ERR,
|
98 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
99 |
+
);
|
100 |
+
$ref = null;
|
101 |
+
}
|
102 |
+
|
103 |
+
return $ref;
|
104 |
+
}
|
105 |
}
|
app/code/community/Nosto/Tagging/Block/Element.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
||
|
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-2017 Nosto 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-
|
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 |
-
||
|
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 |
-
|
|
|
|
|
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-2017 Nosto 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-
|
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 |
-
||
|
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-2017 Nosto 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-
|
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 |
-
||
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
43 |
*/
|
44 |
protected function _toHtml()
|
45 |
{
|
46 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
47 |
+
$helper = Mage::helper('nosto_tagging/account');
|
48 |
if (!Mage::helper('nosto_tagging')->isModuleEnabled()
|
49 |
+
|| !$helper->existsAndIsConnected()
|
50 |
) {
|
51 |
return '';
|
52 |
}
|
61 |
*/
|
62 |
public function getLastOrder()
|
63 |
{
|
64 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
65 |
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
66 |
/** @var Mage_Sales_Model_Order $order */
|
67 |
$order = Mage::getModel('sales/order')->load($orderId);
|
70 |
$meta->loadData($order);
|
71 |
return $meta;
|
72 |
}
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Returns the visitor's Nosto Id
|
76 |
+
*/
|
77 |
+
public function getVisitorChecksum()
|
78 |
+
{
|
79 |
+
/* @var $helper Nosto_Tagging_Helper_Data */
|
80 |
+
$helper = Mage::helper('nosto_tagging');
|
81 |
+
|
82 |
+
return $helper->getVisitorChecksum();
|
83 |
+
}
|
84 |
+
|
85 |
}
|
app/code/community/Nosto/Tagging/Block/Order/Vaimo/Klarna/Checkout.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Order tagging block.
|
30 |
+
* Adds meta-data to the HTML document for successful orders.
|
31 |
+
*
|
32 |
+
* @category Nosto
|
33 |
+
* @package Nosto_Tagging
|
34 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
35 |
+
*/
|
36 |
+
class Nosto_Tagging_Block_Order_Vaimo_Klarna_Checkout extends Mage_Checkout_Block_Success
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Render order info as hidden meta data if the module is enabled for the
|
40 |
+
* current store.
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
protected function _toHtml()
|
45 |
+
{
|
46 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
47 |
+
$helper = Mage::helper('nosto_tagging/account');
|
48 |
+
if (!Mage::helper('nosto_tagging')->isModuleEnabled()
|
49 |
+
|| !$helper->existsAndIsConnected()
|
50 |
+
) {
|
51 |
+
return '';
|
52 |
+
}
|
53 |
+
|
54 |
+
return parent::_toHtml();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Return the last placed order meta data for the customer.
|
59 |
+
*
|
60 |
+
* @return Nosto_Tagging_Model_Meta_Order the order meta data model.
|
61 |
+
*/
|
62 |
+
public function getLastOrder()
|
63 |
+
{
|
64 |
+
$nostoOrder = null;
|
65 |
+
try {
|
66 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
67 |
+
$checkoutId = Mage::getSingleton('checkout/session')->getKlarnaCheckoutPrevId();
|
68 |
+
/* @var Nosto_Tagging_Model_Meta_Order_Vaimo_Klarna_Checkout $nostoOrder */
|
69 |
+
$nostoOrder = Mage::getModel('nosto_tagging/meta_order_vaimo_klarna_checkout');
|
70 |
+
$nostoOrder->loadOrderByKlarnaCheckoutId($checkoutId);
|
71 |
+
} catch (Exception $e) {
|
72 |
+
Mage::log(
|
73 |
+
sprintf(
|
74 |
+
'Could not create Nosto order from Klarna order. Error was: %s',
|
75 |
+
$e->getMessage()
|
76 |
+
),
|
77 |
+
Zend_Log::ERR,
|
78 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
return $nostoOrder;
|
83 |
+
}
|
84 |
+
|
85 |
+
/*
|
86 |
+
* Returns the visitor's Nosto Id
|
87 |
+
*/
|
88 |
+
public function getVisitorChecksum()
|
89 |
+
{
|
90 |
+
/* @var $helper Nosto_Tagging_Helper_Data */
|
91 |
+
$helper = Mage::helper('nosto_tagging');
|
92 |
+
|
93 |
+
return $helper->getVisitorChecksum();
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
app/code/community/Nosto/Tagging/Block/Pagetype.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 |
+
/* @var Nosto_Tagging_Helper_Data $dataHelper */
|
54 |
+
$dataHelper = Mage::helper('nosto_tagging');
|
55 |
+
/* @var Nosto_Tagging_Helper_Account $accountHelper */
|
56 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
57 |
+
if (!$dataHelper->isModuleEnabled()
|
58 |
+
|| !$accountHelper->existsAndIsConnected()
|
59 |
+
) {
|
60 |
+
return '';
|
61 |
+
}
|
62 |
+
return parent::_toHtml();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Return the page-type of the current page. If none is defined in the layout xml,
|
67 |
+
* then set a default one.
|
68 |
+
*
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function getPageTypeName()
|
72 |
+
{
|
73 |
+
$type = $this->getPageType();
|
74 |
+
if ($type === null) {
|
75 |
+
$type = self::DEFAULT_TYPE;
|
76 |
+
}
|
77 |
+
return $type;
|
78 |
+
}
|
79 |
+
}
|
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-
|
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 |
-
||
|
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 |
-
|
94 |
-
|
|
|
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-2017 Nosto 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
@@ -21,7 +21,7 @@
|
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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_Searchterm extends Mage_Core_Block_Template
|
|
42 |
*/
|
43 |
protected function _toHtml()
|
44 |
{
|
|
|
|
|
45 |
if (!Mage::helper('nosto_tagging')->isModuleEnabled()
|
46 |
-
||
|
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 |
-
|
|
|
|
|
62 |
}
|
63 |
}
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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 |
}
|
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-2017 Nosto 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-
|
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
|
55 |
-
* @param Mage_Core_Model_Store|null $store
|
56 |
*
|
57 |
* @return bool true on success, false otherwise.
|
|
|
58 |
*/
|
59 |
-
public function save(
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
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
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-2017 Nosto 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Helper class for working with the cache
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Helper_Cache extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Flushes the Magento caches, not all of them but some of them, normally
|
39 |
+
* after creating an account or connecting with nosto.
|
40 |
+
*/
|
41 |
+
public function flushCache()
|
42 |
+
{
|
43 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
44 |
+
Mage::app()->getCacheInstance()->cleanType('layout');
|
45 |
+
Mage::app()->getCacheInstance()->cleanType('block_html');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Flushes the Magento caches, specifically the configuration cache
|
50 |
+
*/
|
51 |
+
public function flushConfigCache()
|
52 |
+
{
|
53 |
+
Mage::app()->getCacheInstance()->cleanType('config');
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Nosto/Tagging/Helper/Class.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 loading plugable classes.
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Helper_Class extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
/*
|
38 |
+
* Loads correct / plugable order class based on payment provider
|
39 |
+
*
|
40 |
+
* @param Mage_Sales_Model_Order $order
|
41 |
+
*
|
42 |
+
* @return NostoOrderInterface
|
43 |
+
*/
|
44 |
+
/**
|
45 |
+
* @param Mage_Sales_Model_Order $order
|
46 |
+
* @return false|Mage_Core_Model_Abstract|null
|
47 |
+
*/
|
48 |
+
public function getOrderClass(Mage_Sales_Model_Order $order)
|
49 |
+
{
|
50 |
+
$paymentProvider = '';
|
51 |
+
$payment = $order->getPayment();
|
52 |
+
if (is_object($payment)) {
|
53 |
+
$paymentProvider = $payment->getMethod();
|
54 |
+
}
|
55 |
+
$classId = sprintf(
|
56 |
+
'nosto_tagging/meta_order_%s',
|
57 |
+
$paymentProvider
|
58 |
+
);
|
59 |
+
return $this->getClass(
|
60 |
+
$classId,
|
61 |
+
'NostoOrderInterface',
|
62 |
+
'nosto_tagging/meta_order'
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
/*
|
67 |
+
* Loads correct / plugable rating class
|
68 |
+
*
|
69 |
+
*
|
70 |
+
* @param Mage_Core_Model_Store $store
|
71 |
+
* @return Nosto_Tagging_Model_Meta_Rating|null
|
72 |
+
*/
|
73 |
+
/**
|
74 |
+
* @param Mage_Core_Model_Store $store
|
75 |
+
* @return false|Mage_Core_Model_Abstract|null
|
76 |
+
*/
|
77 |
+
public function getRatingClass(Mage_Core_Model_Store $store)
|
78 |
+
{
|
79 |
+
$class = null;
|
80 |
+
/* @var Nosto_Tagging_Helper_Data $dataHelper */
|
81 |
+
$dataHelper = Mage::helper('nosto_tagging');
|
82 |
+
|
83 |
+
if ($provider = $dataHelper->getRatingsAndReviewsProvider($store)) {
|
84 |
+
/* @var Nosto_Tagging_Helper_Rating $ratingHelper */
|
85 |
+
$ratingHelper = Mage::helper('nosto_tagging/rating');
|
86 |
+
$providerName = $ratingHelper->getModuleNameByProvider($provider);
|
87 |
+
|
88 |
+
$classId = self::createClassId('meta_rating_%s', $providerName);
|
89 |
+
$class = $this->getClass(
|
90 |
+
$classId,
|
91 |
+
'Nosto_Tagging_Model_Meta_Rating_Interface'
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
return $class;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Creates a class identifier
|
100 |
+
*
|
101 |
+
* @param $classString
|
102 |
+
* @param $identifier
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
protected static function createClassId($classString, $identifier)
|
106 |
+
{
|
107 |
+
$classId = sprintf(
|
108 |
+
'nosto_tagging/' . $classString,
|
109 |
+
$identifier
|
110 |
+
);
|
111 |
+
|
112 |
+
return strtolower($classId);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Tries to find class by given attributes
|
117 |
+
*
|
118 |
+
* @param string $classId
|
119 |
+
* @param string $expected
|
120 |
+
* @param bool $fallback
|
121 |
+
* @return false|Mage_Core_Model_Abstract|null
|
122 |
+
*/
|
123 |
+
protected function getClass($classId, $expected, $fallback = false) {
|
124 |
+
$class = null;
|
125 |
+
try {
|
126 |
+
if (is_string($classId)) {
|
127 |
+
$className = Mage::getConfig()->getModelClassName($classId);
|
128 |
+
if (class_exists($className)) {
|
129 |
+
$class = Mage::getModel($classId);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
if ($class instanceof $expected == false && $fallback !== false) {
|
133 |
+
$class = Mage::getModel($fallback);
|
134 |
+
}
|
135 |
+
} catch (Exception $e) {
|
136 |
+
if ($fallback !== false) {
|
137 |
+
$class = Mage::getModel($fallback);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
return $class;
|
142 |
+
}
|
143 |
+
}
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -41,7 +41,7 @@ class Nosto_Tagging_Helper_Customer extends Mage_Core_Helper_Abstract
|
|
41 |
*
|
42 |
* @param Mage_Sales_Model_Order $order the order to get the Nosto ID for.
|
43 |
*
|
44 |
-
* @return bool
|
45 |
*/
|
46 |
public function getNostoId(Mage_Sales_Model_Order $order)
|
47 |
{
|
@@ -72,6 +72,8 @@ class Nosto_Tagging_Helper_Customer extends Mage_Core_Helper_Abstract
|
|
72 |
->getCollection()
|
73 |
->addFieldToFilter('quote_id', $quoteId)
|
74 |
->addFieldToFilter('nosto_id', $nostoId)
|
|
|
|
|
75 |
->getFirstItem();
|
76 |
if ($customer->hasData()) {
|
77 |
$customer->setUpdatedAt(date('Y-m-d H:i:s'));
|
@@ -84,4 +86,23 @@ 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
41 |
*
|
42 |
* @param Mage_Sales_Model_Order $order the order to get the Nosto ID for.
|
43 |
*
|
44 |
+
* @return string|bool
|
45 |
*/
|
46 |
public function getNostoId(Mage_Sales_Model_Order $order)
|
47 |
{
|
72 |
->getCollection()
|
73 |
->addFieldToFilter('quote_id', $quoteId)
|
74 |
->addFieldToFilter('nosto_id', $nostoId)
|
75 |
+
->setPageSize(1)
|
76 |
+
->setCurPage(1)
|
77 |
->getFirstItem();
|
78 |
if ($customer->hasData()) {
|
79 |
$customer->setUpdatedAt(date('Y-m-d H:i:s'));
|
86 |
}
|
87 |
}
|
88 |
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return the checksum / customer reference for customer
|
92 |
+
*
|
93 |
+
* @param Mage_Customer_Model_Customer $customer
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function generateCustomerReference(Mage_Customer_Model_Customer $customer)
|
98 |
+
{
|
99 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
100 |
+
$hash = md5($customer->getId().$customer->getEmail());
|
101 |
+
$uuid = uniqid(
|
102 |
+
substr($hash, 0, 8),
|
103 |
+
true
|
104 |
+
);
|
105 |
+
|
106 |
+
return $uuid;
|
107 |
+
}
|
108 |
}
|
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-
|
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
|
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 |
-
|
|
|
|
|
|
|
120 |
}
|
121 |
return $installationId;
|
122 |
}
|
@@ -132,4 +226,294 @@ 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-2017 Nosto 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 string Nosto customer reference attribute name
|
109 |
+
*/
|
110 |
+
const NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME = 'nosto_customer_reference';
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @var string Nosto customer reference attribute name
|
114 |
+
*/
|
115 |
+
const XML_PATH_EXCHANGE_RATE_CRON_FREQUENCY = 'nosto_tagging/scheduled_currency_exchange_rate_update/frequency';
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Path to store attribute map
|
119 |
+
*/
|
120 |
+
const XML_PATH_ATTRIBUTE_MAP = 'nosto_tagging/attribute_map';
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Path to store rating provider
|
124 |
+
*/
|
125 |
+
const XML_PATH_RATING_PROVIDER = 'nosto_tagging/ratings_and_reviews/provider';
|
126 |
+
|
127 |
+
/**
|
128 |
+
* List of strings to remove from the default Nosto account title
|
129 |
+
*
|
130 |
+
* @var array
|
131 |
+
*/
|
132 |
+
public static $removeFromTitle = array(
|
133 |
+
'Main Website - '
|
134 |
+
);
|
135 |
+
|
136 |
+
/**
|
137 |
+
* List of valid tag types
|
138 |
+
*
|
139 |
+
* @var array
|
140 |
+
*/
|
141 |
+
public static $validTags = array(
|
142 |
+
'tag1',
|
143 |
+
'tag2',
|
144 |
+
'tag3'
|
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(
|
252 |
+
self::XML_PATH_BRAND_ATTRIBUTE, $store
|
253 |
+
);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Returns the mapped attribute
|
258 |
+
*
|
259 |
+
* @param string $attribute
|
260 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
261 |
+
* @return string
|
262 |
+
*/
|
263 |
+
public function getMappedAttribute($attribute, $store = null)
|
264 |
+
{
|
265 |
+
$xmlPath = self::XML_PATH_ATTRIBUTE_MAP . "/" . $attribute;
|
266 |
+
return Mage::getStoreConfig($xmlPath, $store);
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Returns the front page URL used for the store during Nosto account
|
271 |
+
* installation
|
272 |
+
*
|
273 |
+
* @param Mage_Core_Model_Store $store the store model
|
274 |
+
*
|
275 |
+
* @return string
|
276 |
+
*/
|
277 |
+
public function getStoreFrontPageUrl(Mage_Core_Model_Store $store)
|
278 |
+
{
|
279 |
+
return Mage::getStoreConfig(self::XML_PATH_STORE_FRONT_PAGE_URL, $store);
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Saves current front page url of the store into the settings. This is
|
284 |
+
* used for validating that Nosto account was actually installed into the
|
285 |
+
* current store and Magento installation.
|
286 |
+
*
|
287 |
+
* @param Mage_Core_Model_Store $store
|
288 |
+
*/
|
289 |
+
public function saveCurrentStoreFrontPageUrl(Mage_Core_Model_Store $store)
|
290 |
+
{
|
291 |
+
/* @var $urlHelper Nosto_Tagging_Helper_Url */
|
292 |
+
$urlHelper = Mage::helper('nosto_tagging/url');
|
293 |
+
$frontPageUrl = $urlHelper->getFrontPageUrl($store);
|
294 |
+
$this->saveStoreFrontPageUrl($store, $frontPageUrl);
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Saves the front page url of the store into the settings.
|
299 |
+
*
|
300 |
+
* @param Mage_Core_Model_Store $store
|
301 |
+
* @param string $url
|
302 |
+
*/
|
303 |
+
public function saveStoreFrontPageUrl(Mage_Core_Model_Store $store, $url)
|
304 |
+
{
|
305 |
+
/** @var Mage_Core_Model_Config $config */
|
306 |
+
$config = Mage::getModel('core/config');
|
307 |
+
$config->saveConfig(
|
308 |
+
self::XML_PATH_STORE_FRONT_PAGE_URL,
|
309 |
+
$url,
|
310 |
+
'stores',
|
311 |
+
$store->getId()
|
312 |
+
);
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Return the Nosto cookie value
|
317 |
+
*
|
318 |
+
* @return string
|
319 |
+
*/
|
320 |
+
public function getCookieId()
|
321 |
+
{
|
322 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
323 |
+
return Mage::getModel('core/cookie')->get(self::COOKIE_NAME);
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Return the checksum for visitor
|
328 |
+
*
|
329 |
+
* @return string
|
330 |
+
*/
|
331 |
+
public function getVisitorChecksum()
|
332 |
+
{
|
333 |
+
$coo = $this->getCookieId();
|
334 |
+
if ($coo) {
|
335 |
+
return hash(self::VISITOR_HASH_ALGO, $coo);
|
336 |
+
}
|
337 |
+
return null;
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Return the checksum for visitor
|
342 |
+
*
|
343 |
+
* @param string $name the title of the account
|
344 |
+
* @return string the cleaned title of the account
|
345 |
+
*/
|
346 |
+
public function cleanUpAccountTitle($name)
|
347 |
+
{
|
348 |
+
$clean = str_replace(self::$removeFromTitle, '', $name);
|
349 |
+
return $clean;
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Return the multi currency method in use, i.e. "exchangeRate" or
|
354 |
+
* "priceVariation".
|
355 |
+
*
|
356 |
+
* If "exchangeRate", it means that the product prices in the recommendation
|
357 |
+
* is updated through the Exchange Rate API to Nosto.
|
358 |
+
*
|
359 |
+
* If "priceVariation", it means that the product price variations should be
|
360 |
+
* tagged along side the product.
|
361 |
+
*
|
362 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
363 |
+
*
|
364 |
+
* @return string
|
365 |
+
*/
|
366 |
+
public function getMultiCurrencyMethod($store = null)
|
367 |
+
{
|
368 |
+
if ($store instanceof Mage_Core_Model_Store === false) {
|
369 |
+
$store = Mage::app()->getStore();
|
370 |
+
}
|
371 |
+
return Mage::getStoreConfig(self::XML_PATH_MULTI_CURRENCY_METHOD, $store);
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Checks if either exchange rates or price variants
|
376 |
+
* are used in store.
|
377 |
+
*
|
378 |
+
*
|
379 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
380 |
+
*
|
381 |
+
* @return bool
|
382 |
+
*/
|
383 |
+
public function multiCurrencyDisabled($store = null)
|
384 |
+
{
|
385 |
+
$method = $this->getMultiCurrencyMethod($store);
|
386 |
+
return ($method === self::MULTI_CURRENCY_DISABLED);
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Checks if the multi currency method in use is the "exchangeRate", i.e.
|
391 |
+
* the product prices in the recommendation is updated through the Exchange
|
392 |
+
* Rate API to Nosto.
|
393 |
+
*
|
394 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
395 |
+
*
|
396 |
+
* @return bool
|
397 |
+
*/
|
398 |
+
public function isMultiCurrencyMethodExchangeRate($store = null)
|
399 |
+
{
|
400 |
+
$method = $this->getMultiCurrencyMethod($store);
|
401 |
+
return ($method === self::MULTI_CURRENCY_METHOD_EXCHANGE_RATE);
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Returns if the scheduled currency exchange rate update is enabled.
|
406 |
+
*
|
407 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
408 |
+
*
|
409 |
+
* @return bool
|
410 |
+
*/
|
411 |
+
public function isScheduledCurrencyExchangeRateUpdateEnabled($store = null)
|
412 |
+
{
|
413 |
+
return (bool)Mage::getStoreConfig(self::XML_PATH_SCHEDULED_CURRENCY_EXCHANGE_RATE_UPDATE_ENABLED, $store);
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Returns product updates should be sent via API to Nosto
|
418 |
+
*
|
419 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
420 |
+
* @return boolean
|
421 |
+
*/
|
422 |
+
public function getUseProductApi($store = null)
|
423 |
+
{
|
424 |
+
$useApi = (bool)Mage::getStoreConfig(self::XML_PATH_USE_PRODUCT_API, $store);
|
425 |
+
return $useApi;
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Returns exchange rate cron frequency
|
430 |
+
*
|
431 |
+
* For possible return values
|
432 |
+
* @see Nosto_Tagging_Model_System_Config_Source_Cron_Frequency
|
433 |
+
*
|
434 |
+
* @return string
|
435 |
+
*/
|
436 |
+
public function getExchangeRateCronFrequency()
|
437 |
+
{
|
438 |
+
return Mage::getStoreConfig(self::XML_PATH_EXCHANGE_RATE_CRON_FREQUENCY);
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Return the attributes to be tagged in Nosto tags
|
443 |
+
*
|
444 |
+
* @param string $tag_id the name / identifier of the tag (e.g. tag1, tag2).
|
445 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
446 |
+
*
|
447 |
+
* @throws NostoException
|
448 |
+
*
|
449 |
+
* @return array
|
450 |
+
*/
|
451 |
+
public function getAttributesToTag($tag_id, $store = null)
|
452 |
+
{
|
453 |
+
if (!in_array($tag_id, self::$validTags)) {
|
454 |
+
throw new NostoException(
|
455 |
+
sprintf('Invalid tag identifier %s', $tag_id)
|
456 |
+
);
|
457 |
+
}
|
458 |
+
$tag_path = self::XML_PATH_CUSTOM_TAGS . $tag_id;
|
459 |
+
$tags = Mage::getStoreConfig($tag_path, $store);
|
460 |
+
return explode(',', $tags);
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Return the ratings and reviews provider
|
465 |
+
*
|
466 |
+
* @param Mage_Core_Model_Store|null $store the store model or null.
|
467 |
+
*
|
468 |
+
* @return string
|
469 |
+
*/
|
470 |
+
public function getRatingsAndReviewsProvider($store = null)
|
471 |
+
{
|
472 |
+
return Mage::getStoreConfig(self::XML_PATH_RATING_PROVIDER, $store);
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Returns all store views for the installation
|
477 |
+
*
|
478 |
+
* @return Store[]
|
479 |
+
*/
|
480 |
+
public function getAllStoreViews()
|
481 |
+
{
|
482 |
+
$response = array();
|
483 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
484 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
485 |
+
foreach ($website->getGroups() as $group) {
|
486 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
487 |
+
$stores = $group->getStores();
|
488 |
+
foreach ($stores as $store) {
|
489 |
+
$response[] = $store;
|
490 |
+
}
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
return $response;
|
495 |
+
}
|
496 |
+
|
497 |
+
/**
|
498 |
+
* Returns an array of store config in each store view
|
499 |
+
*
|
500 |
+
* @param $path
|
501 |
+
* @return array
|
502 |
+
*/
|
503 |
+
public function getConfigInAllStores($path)
|
504 |
+
{
|
505 |
+
$stores = $this->getAllStoreViews();
|
506 |
+
$values = array();
|
507 |
+
/* @var Mage_Core_Model_Store $store */
|
508 |
+
foreach ($stores as $store) {
|
509 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
510 |
+
$storeId = $store->getStoreId();
|
511 |
+
if ($storeId) {
|
512 |
+
$values[$storeId] = Mage::getStoreConfig($path, $store);
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
return $values;
|
517 |
+
}
|
518 |
}
|
519 |
+
|
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-
|
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-2017 Nosto 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/Module.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 |
+
use Nosto_Tagging_Helper_Rating as RatingHelper;
|
29 |
+
use Nosto_Tagging_Helper_Data as DataHelper;
|
30 |
+
/**
|
31 |
+
* Helper class for common Magento modules.
|
32 |
+
*
|
33 |
+
* @category Nosto
|
34 |
+
* @package Nosto_Tagging
|
35 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
36 |
+
*/
|
37 |
+
class Nosto_Tagging_Helper_Module extends Mage_Core_Helper_Abstract
|
38 |
+
{
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Field for config path
|
42 |
+
*/
|
43 |
+
const FIELD_CONFIG_PATH = 'config_path';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Field for expected value
|
47 |
+
*/
|
48 |
+
const FIELD_EXPECTED_VALUE = 'expected_value';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* An array of supported / integrated modules
|
52 |
+
*
|
53 |
+
* @var array
|
54 |
+
*/
|
55 |
+
public static $integratedModules = array(
|
56 |
+
RatingHelper::RATING_PROVIDER_YOTPO => array(
|
57 |
+
self::FIELD_CONFIG_PATH => DataHelper::XML_PATH_RATING_PROVIDER,
|
58 |
+
self::FIELD_EXPECTED_VALUE => RatingHelper::RATING_PROVIDER_YOTPO
|
59 |
+
)
|
60 |
+
);
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Gets a list of all installed modules
|
64 |
+
*
|
65 |
+
* @return array
|
66 |
+
*/
|
67 |
+
public function getAllModules()
|
68 |
+
{
|
69 |
+
$configElement = Mage::getConfig()->getNode('modules');
|
70 |
+
$modules = get_object_vars($configElement);
|
71 |
+
|
72 |
+
return $modules;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Gets a list of all active modules
|
77 |
+
*
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
public function getAllActiveModules()
|
81 |
+
{
|
82 |
+
$active = array();
|
83 |
+
$all = $this->getAllModules();
|
84 |
+
foreach ($all as $moduleName=>$module) {
|
85 |
+
if ($module->active != "false") {
|
86 |
+
$active[$moduleName] = $module;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
return $active;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Gets a list of installed modules that integrate with Nosto
|
95 |
+
*
|
96 |
+
* @return array
|
97 |
+
*/
|
98 |
+
public function getModulesForIntegration()
|
99 |
+
{
|
100 |
+
/* @var DataHelper $dataHelper */
|
101 |
+
$dataHelper = Mage::helper('nosto_tagging');
|
102 |
+
$validForIntegration = array();
|
103 |
+
$activeModules = $this->getAllActiveModules();
|
104 |
+
|
105 |
+
foreach ($activeModules as $moduleName => $moduleConfig) {
|
106 |
+
if (array_key_exists($moduleName, self::$integratedModules)) {
|
107 |
+
$integrated = 0;
|
108 |
+
$integratedModuleConfig = self::$integratedModules[$moduleName];
|
109 |
+
$validForIntegration[$moduleName] = $integrated;
|
110 |
+
$path = $integratedModuleConfig[self::FIELD_CONFIG_PATH];
|
111 |
+
$configValues = $dataHelper->getConfigInAllStores(
|
112 |
+
$path
|
113 |
+
);
|
114 |
+
foreach ($configValues as $configValue) {
|
115 |
+
if ($configValue === $integratedModuleConfig[self::FIELD_EXPECTED_VALUE]) {
|
116 |
+
$integrated = 1;
|
117 |
+
break;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
$validForIntegration[$moduleName] = $integrated;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
return $validForIntegration;
|
125 |
+
}
|
126 |
+
}
|
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-
|
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-2017 Nosto 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-
|
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
|
41 |
*
|
42 |
* @return string
|
43 |
*/
|
44 |
public function getFormattedPrice($price)
|
45 |
{
|
46 |
-
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -79,25 +82,35 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
|
|
79 |
*
|
80 |
* @return float
|
81 |
*/
|
82 |
-
protected function _getProductPrice(
|
83 |
-
|
|
|
|
|
|
|
84 |
$price = 0;
|
85 |
|
86 |
switch ($product->getTypeId()) {
|
87 |
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
|
88 |
-
// Get the bundle product "from" price.
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
100 |
-
->getProductAttributes()
|
101 |
)
|
102 |
->addAttributeToFilter('entity_id', $product->getId())
|
103 |
->setPage(1, 1)
|
@@ -106,23 +119,80 @@ 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 =
|
112 |
-
->getPrice($tmpProduct, $price, true);
|
113 |
}
|
114 |
}
|
115 |
break;
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
$
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
return $price;
|
@@ -147,7 +217,9 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
|
|
147 |
);
|
148 |
$price = 0;
|
149 |
}
|
150 |
-
|
|
|
|
|
151 |
$price,
|
152 |
$store->getBaseCurrency()->getCode(),
|
153 |
$store->getDefaultCurrency()->getCode()
|
@@ -164,12 +236,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 =
|
173 |
$basePrice,
|
174 |
$baseCurrencyCode,
|
175 |
$orderCurrencyCode
|
@@ -183,4 +257,52 @@ 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
37 |
/**
|
38 |
* Formats price into Nosto format, e.g. 1000.99.
|
39 |
*
|
40 |
+
* @param int|float $price the price to format.
|
41 |
*
|
42 |
* @return string
|
43 |
*/
|
44 |
public function getFormattedPrice($price)
|
45 |
{
|
46 |
+
/* @var $nostoPriceHelper NostoHelperPrice */
|
47 |
+
$nostoPriceHelper = Nosto::helper('price');
|
48 |
+
|
49 |
+
return $nostoPriceHelper->format($price, 2, '.', '');
|
50 |
}
|
51 |
|
52 |
/**
|
82 |
*
|
83 |
* @return float
|
84 |
*/
|
85 |
+
protected function _getProductPrice(
|
86 |
+
Mage_Catalog_Model_Product $product,
|
87 |
+
$finalPrice = false,
|
88 |
+
$inclTax = true
|
89 |
+
) {
|
90 |
$price = 0;
|
91 |
|
92 |
switch ($product->getTypeId()) {
|
93 |
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
|
94 |
+
// Get the bundle product "from" / min price.
|
95 |
+
// Price for bundled "parent" product cannot be configured in
|
96 |
+
// store admin. In practise there is no such thing as
|
97 |
+
// parent product for the bundled type product
|
98 |
+
/** @var Mage_Bundle_Model_Product_Price $model */
|
99 |
+
$model = $product->getPriceModel();
|
100 |
+
$price = $model->getTotalPrices($product, 'min', $inclTax);
|
101 |
break;
|
|
|
102 |
case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
|
103 |
// Get the grouped product "starting at" price.
|
104 |
+
// Price for grouped "parent" product cannot be configured in
|
105 |
+
// store admin. In practise there is no such thing as
|
106 |
+
// parent product for the grouped type product
|
107 |
+
/** @var Mage_Catalog_Model_Config $config */
|
108 |
+
$config = Mage::getSingleton('catalog/config');
|
109 |
/** @var $tmpProduct Mage_Catalog_Model_Product */
|
110 |
$tmpProduct = Mage::getModel('catalog/product')
|
111 |
->getCollection()
|
112 |
->addAttributeToSelect(
|
113 |
+
$config->getProductAttributes()
|
|
|
114 |
)
|
115 |
->addAttributeToFilter('entity_id', $product->getId())
|
116 |
->setPage(1, 1)
|
119 |
->load()
|
120 |
->getFirstItem();
|
121 |
if ($tmpProduct) {
|
122 |
+
/** @var Mage_Tax_Helper_Data $helper */
|
123 |
+
$helper = Mage::helper('tax');
|
124 |
$price = $tmpProduct->getMinimalPrice();
|
125 |
if ($inclTax) {
|
126 |
+
$price = $helper->getPrice($tmpProduct, $price, true);
|
|
|
127 |
}
|
128 |
}
|
129 |
break;
|
130 |
+
case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
|
131 |
+
// For configurable products we use the price defined for the
|
132 |
+
// "parent" product. If for some reason the parent product
|
133 |
+
// doesn't have a price configured we fetch the lowest price
|
134 |
+
// configured from a child product / variation
|
135 |
+
$price = $this->_getDefaultFromProduct(
|
136 |
+
$product,
|
137 |
+
$finalPrice,
|
138 |
+
$inclTax
|
139 |
+
);
|
140 |
+
if (!$price) {
|
141 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
142 |
+
$associatedProducts = Mage::getModel(
|
143 |
+
'catalog/product_type_configurable'
|
144 |
+
)->getUsedProducts(null, $product);
|
145 |
+
$lowestPrice = false;
|
146 |
+
/* @var Mage_Catalog_Model_Product $associatedProduct */
|
147 |
+
foreach ($associatedProducts as $associatedProduct) {
|
148 |
+
/* @var Mage_Catalog_Model_Product $productModel */
|
149 |
+
$productModel = Mage::getModel('catalog/product')->load(
|
150 |
+
$associatedProduct->getId()
|
151 |
+
);
|
152 |
+
if ($finalPrice) {
|
153 |
+
$variationPrice = $this->getProductFinalPriceInclTax($productModel);
|
154 |
+
} else {
|
155 |
+
$variationPrice = $this->getProductPriceInclTax($productModel);
|
156 |
+
}
|
157 |
+
if (!$lowestPrice || $variationPrice < $lowestPrice) {
|
158 |
+
$lowestPrice = $variationPrice;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
$price = $lowestPrice;
|
162 |
}
|
163 |
break;
|
164 |
+
default:
|
165 |
+
$price = $this->_getDefaultFromProduct(
|
166 |
+
$product,
|
167 |
+
$finalPrice,
|
168 |
+
$inclTax
|
169 |
+
);
|
170 |
+
break;
|
171 |
+
}
|
172 |
+
|
173 |
+
return $price;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Returns the price from product
|
178 |
+
*
|
179 |
+
* @param Mage_Catalog_Model_Product $product
|
180 |
+
* @param bool $finalPrice
|
181 |
+
* @param bool $inclTax
|
182 |
+
* @return float
|
183 |
+
*/
|
184 |
+
protected function _getDefaultFromProduct(
|
185 |
+
Mage_Catalog_Model_Product $product,
|
186 |
+
$finalPrice = false,
|
187 |
+
$inclTax = true
|
188 |
+
) {
|
189 |
+
/** @var Mage_Tax_Helper_Data $helper */
|
190 |
+
$helper = Mage::helper('tax');
|
191 |
+
$price = $finalPrice
|
192 |
+
? $product->getFinalPrice()
|
193 |
+
: $product->getPrice();
|
194 |
+
if ($inclTax) {
|
195 |
+
$price = $helper->getPrice($product, $price, true);
|
196 |
}
|
197 |
|
198 |
return $price;
|
217 |
);
|
218 |
$price = 0;
|
219 |
}
|
220 |
+
/** @var Mage_Directory_Helper_Data $helper */
|
221 |
+
$helper = Mage::helper('directory');
|
222 |
+
return $helper->currencyConvert(
|
223 |
$price,
|
224 |
$store->getBaseCurrency()->getCode(),
|
225 |
$store->getDefaultCurrency()->getCode()
|
236 |
*/
|
237 |
public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
|
238 |
{
|
239 |
+
/** @var Mage_Directory_Helper_Data $helper */
|
240 |
+
$helper = Mage::helper('directory');
|
241 |
$quantity = (double)$item->getQtyOrdered();
|
242 |
$basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
|
243 |
$orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
|
244 |
$baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
|
245 |
if ($orderCurrencyCode != $baseCurrencyCode) {
|
246 |
+
$priceInOrderCurrency = $helper->currencyConvert(
|
247 |
$basePrice,
|
248 |
$baseCurrencyCode,
|
249 |
$orderCurrencyCode
|
257 |
|
258 |
return $priceInOrderCurrency;
|
259 |
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* If the store uses multiple currencies the prices are converted from base
|
263 |
+
* currency into given currency. Otherwise the given price is returned.
|
264 |
+
*
|
265 |
+
* @param float $basePrice The price of a product in base currency
|
266 |
+
* @param string $currentCurrencyCode
|
267 |
+
* @param Mage_Core_Model_Store $store
|
268 |
+
* @return float
|
269 |
+
*/
|
270 |
+
public function getTaggingPrice($basePrice, $currentCurrencyCode, Mage_Core_Model_Store $store)
|
271 |
+
{
|
272 |
+
/* @var Nosto_Tagging_Helper_Data $helper */
|
273 |
+
$helper = Mage::helper('nosto_tagging');
|
274 |
+
$baseCurrencyCode = $store->getBaseCurrencyCode();
|
275 |
+
$taggingPrice = $basePrice;
|
276 |
+
if ($helper->multiCurrencyDisabled($store) && $currentCurrencyCode !== $store->getBaseCurrencyCode()) {
|
277 |
+
/* @var Mage_Directory_Helper_Data $directory */
|
278 |
+
$directory = Mage::helper('directory');
|
279 |
+
$taggingPrice = $directory->currencyConvert(
|
280 |
+
$basePrice,
|
281 |
+
$baseCurrencyCode,
|
282 |
+
$currentCurrencyCode
|
283 |
+
);
|
284 |
+
}
|
285 |
+
|
286 |
+
return $taggingPrice;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Returns the correct currency code for tagging
|
291 |
+
*
|
292 |
+
* @param $currentCurrencyCode
|
293 |
+
* @param Mage_Core_Model_Store $store
|
294 |
+
* @return string currency code in ISO 4217 format
|
295 |
+
*/
|
296 |
+
public function getTaggingCurrencyCode($currentCurrencyCode, Mage_Core_Model_Store $store)
|
297 |
+
{
|
298 |
+
/* @var Nosto_Tagging_Helper_Data $helper */
|
299 |
+
$helper = Mage::helper('nosto_tagging');
|
300 |
+
if ($helper->multiCurrencyDisabled($store)) {
|
301 |
+
$taggingCurrencyCode = $currentCurrencyCode;
|
302 |
+
} else {
|
303 |
+
$taggingCurrencyCode = $store->getBaseCurrencyCode();
|
304 |
+
}
|
305 |
+
|
306 |
+
return $taggingCurrencyCode;
|
307 |
+
}
|
308 |
}
|
app/code/community/Nosto/Tagging/Helper/Rating.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 rating and review operations.
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Helper_Rating extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* The ratings and reviews provider name for Yotpo
|
39 |
+
*/
|
40 |
+
const RATING_PROVIDER_YOTPO = 'Yotpo_Yotpo';
|
41 |
+
/**
|
42 |
+
* The ratings and reviews provider name for Yotpo
|
43 |
+
*/
|
44 |
+
const RATING_PROVIDER_MAGENTO = 'Mage_Rating';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Array key for provider description
|
48 |
+
*/
|
49 |
+
const FIELD_DESCRIPTION = 'description';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Array key for provider module name
|
53 |
+
*/
|
54 |
+
const FIELD_MODULE = 'module';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Array key for provider module name
|
58 |
+
*/
|
59 |
+
const FIELD_CONFIG_PATH = 'config_path';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* A list of out-of-the-box supported ratings and reviews providers
|
63 |
+
* Note that these modules need to be enabled also
|
64 |
+
* @var array
|
65 |
+
*/
|
66 |
+
protected static $ratingProviders = array(
|
67 |
+
self::RATING_PROVIDER_YOTPO => array(
|
68 |
+
self::FIELD_DESCRIPTION => 'Yotpo Product Reviews',
|
69 |
+
self::FIELD_MODULE => 'Yotpo_Yotpo'
|
70 |
+
|
71 |
+
),
|
72 |
+
self::RATING_PROVIDER_MAGENTO => array(
|
73 |
+
self::FIELD_DESCRIPTION => 'Magento\'s native product reviews',
|
74 |
+
self::FIELD_MODULE => 'Mage_Rating'
|
75 |
+
),
|
76 |
+
);
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Returns and array of supported rating providers
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function getSupportedRatingProviders()
|
84 |
+
{
|
85 |
+
return self::$ratingProviders;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns installed and supported ratings and reviews providers
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
public function getActiveRatingProviders()
|
94 |
+
{
|
95 |
+
$installed = array();
|
96 |
+
foreach ($this->getSupportedRatingProviders() as $provider=>$config) {
|
97 |
+
if (
|
98 |
+
Mage::helper('core')->isModuleEnabled($config[self::FIELD_MODULE])
|
99 |
+
) {
|
100 |
+
$installed[$provider] = $config;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
return $installed;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Returns the module name for the given provider
|
109 |
+
*
|
110 |
+
* @param $provider
|
111 |
+
* @return null
|
112 |
+
*/
|
113 |
+
public function getModuleNameByProvider($provider)
|
114 |
+
{
|
115 |
+
$module = null;
|
116 |
+
if (
|
117 |
+
!empty(self::$ratingProviders[$provider])
|
118 |
+
&& !empty(self::$ratingProviders[$provider][self::FIELD_MODULE])
|
119 |
+
) {
|
120 |
+
$module = self::$ratingProviders[$provider][self::FIELD_MODULE];
|
121 |
+
}
|
122 |
+
return $module;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Tries to load class for handling the ratings and reviews for the
|
127 |
+
* given provider
|
128 |
+
*
|
129 |
+
* @param $provider
|
130 |
+
* @return null
|
131 |
+
*/
|
132 |
+
public function loadClass($provider)
|
133 |
+
{
|
134 |
+
$module = null;
|
135 |
+
if (
|
136 |
+
!empty(self::$ratingProviders[$provider])
|
137 |
+
&& !empty(self::$ratingProviders[$provider][self::FIELD_MODULE])
|
138 |
+
) {
|
139 |
+
$module = self::$ratingProviders[$provider][self::FIELD_MODULE];
|
140 |
+
}
|
141 |
+
return $module;
|
142 |
+
}
|
143 |
+
}
|
app/code/community/Nosto/Tagging/Helper/Setup.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 Mage_Eav_Model_Entity_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(Mage_Eav_Model_Entity_Setup $installer, $reset = false)
|
46 |
+
{
|
47 |
+
$installer->startSetup();
|
48 |
+
$entity = 'customer';
|
49 |
+
$attributeExists = $installer->getAttribute(
|
50 |
+
$entity,
|
51 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
|
52 |
+
);
|
53 |
+
if ($attributeExists && $reset === true) {
|
54 |
+
$installer->removeAttribute(
|
55 |
+
$entity,
|
56 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
|
57 |
+
);
|
58 |
+
$attributeExists = false;
|
59 |
+
}
|
60 |
+
if (!$attributeExists)
|
61 |
+
{
|
62 |
+
$attributeDefinition = array(
|
63 |
+
"type" => "varchar",
|
64 |
+
"label" => "Nosto Customer Reference",
|
65 |
+
"input" => "text",
|
66 |
+
"visible" => true,
|
67 |
+
"required" => false,
|
68 |
+
"unique" => true,
|
69 |
+
"note" => "Unique customer reference for Nosto"
|
70 |
+
);
|
71 |
+
$installer->addAttribute(
|
72 |
+
$entity,
|
73 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
|
74 |
+
$attributeDefinition
|
75 |
+
);
|
76 |
+
/* @var Mage_Eav_Model_Config $eavConfig */
|
77 |
+
$eavConfig = Mage::getSingleton("eav/config");
|
78 |
+
$attribute = $eavConfig->getAttribute(
|
79 |
+
$entity,
|
80 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME
|
81 |
+
);
|
82 |
+
|
83 |
+
$used_in_forms=array("adminhtml_customer");
|
84 |
+
$attribute->setData("used_in_forms",$used_in_forms)
|
85 |
+
->setData("is_used_for_customer_segment", false)
|
86 |
+
->setData("is_system", 1)
|
87 |
+
->setData("is_user_defined", 0)
|
88 |
+
->setData("is_visible", 1)
|
89 |
+
->setData("sort_order", 100);
|
90 |
+
|
91 |
+
$attribute->save();
|
92 |
+
}
|
93 |
+
$installer->endSetup();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Changes the nosto_customer_reference frontend input type to text
|
98 |
+
*
|
99 |
+
* @param $installer Mage_Eav_Model_Entity_Setup
|
100 |
+
*
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
public function alterCustomerReferenceInputType(Mage_Eav_Model_Entity_Setup $installer)
|
104 |
+
{
|
105 |
+
$installer->updateAttribute(
|
106 |
+
'customer',
|
107 |
+
Nosto_Tagging_Helper_Data::NOSTO_CUSTOMER_REFERENCE_ATTRIBUTE_NAME,
|
108 |
+
array(
|
109 |
+
'frontend_input' => 'text',
|
110 |
+
)
|
111 |
+
);
|
112 |
+
}
|
113 |
+
}
|
app/code/community/Nosto/Tagging/Helper/Stock.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 stock operations.
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Helper_Stock extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Calculates the total qty in stock. If the product is configurable the
|
39 |
+
* the sum of associated products will be calculated.
|
40 |
+
*
|
41 |
+
* @param Mage_Catalog_Model_Product $product
|
42 |
+
*
|
43 |
+
* @return int
|
44 |
+
*/
|
45 |
+
public function getQty(Mage_Catalog_Model_Product $product)
|
46 |
+
{
|
47 |
+
$qty = 0;
|
48 |
+
|
49 |
+
switch ($product->getTypeId()) {
|
50 |
+
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
|
51 |
+
$bundledItemIds = Mage::getResourceSingleton('bundle/selection')
|
52 |
+
->getChildrenIds($product->getId(), $required=true);
|
53 |
+
$products = array();
|
54 |
+
foreach ($bundledItemIds as $variants) {
|
55 |
+
if (is_array($variants) && count($variants) > 0) {
|
56 |
+
foreach ($variants as $variantId) {
|
57 |
+
/* @var Mage_Catalog_Model_Product $productModel */
|
58 |
+
$productModel = Mage::getModel('catalog/product')->load(
|
59 |
+
$variantId
|
60 |
+
);
|
61 |
+
$products[] = $productModel;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
$qty = $this->getMinQty($products);
|
66 |
+
break;
|
67 |
+
case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
|
68 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
69 |
+
$products = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
70 |
+
$qty = $this->getMinQty($products);
|
71 |
+
break;
|
72 |
+
case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
|
73 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
74 |
+
$products = Mage::getModel(
|
75 |
+
'catalog/product_type_configurable'
|
76 |
+
)->getUsedProducts(null, $product);
|
77 |
+
$qty = $this->getQtySum($products);
|
78 |
+
break;
|
79 |
+
default:
|
80 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item');
|
81 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
82 |
+
$qty += $stockItem->loadByProduct($product)->getQty();
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
|
86 |
+
return $qty;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Searches the minimum quantity from the products collection
|
91 |
+
*
|
92 |
+
* @param array|Mage_Catalog_Model_Product[] $productCollection
|
93 |
+
|
94 |
+
* @return int|mixed
|
95 |
+
*/
|
96 |
+
protected function getMinQty(array $productCollection)
|
97 |
+
{
|
98 |
+
$quantities = array();
|
99 |
+
$minQty = 0;
|
100 |
+
/* @var Mage_Catalog_Model_Product $product */
|
101 |
+
foreach ($productCollection as $product) {
|
102 |
+
$quantities[] = $this->getQty($product);
|
103 |
+
}
|
104 |
+
if(!empty($quantities)) {
|
105 |
+
rsort($quantities, SORT_NUMERIC);
|
106 |
+
$minQty = array_pop($quantities);
|
107 |
+
}
|
108 |
+
|
109 |
+
return $minQty;
|
110 |
+
}
|
111 |
+
|
112 |
+
/*
|
113 |
+
* Sums quantities for all products in array
|
114 |
+
*
|
115 |
+
* @param array|Mage_Catalog_Model_Product[] $productCollection
|
116 |
+
* @return int
|
117 |
+
*/
|
118 |
+
protected function getQtySum(array $productCollection)
|
119 |
+
{
|
120 |
+
$qty = 0;
|
121 |
+
/* @var Mage_Catalog_Model_Product $product */
|
122 |
+
foreach ($productCollection as $product) {
|
123 |
+
$qty += $this->getQty($product);
|
124 |
+
}
|
125 |
+
|
126 |
+
return $qty;
|
127 |
+
}
|
128 |
+
}
|
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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -36,6 +36,87 @@
|
|
36 |
*/
|
37 |
class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
38 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Gets the absolute preview URL to the current store view product page.
|
41 |
* The product is the first one found in the database for the store.
|
@@ -47,10 +128,11 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
47 |
*/
|
48 |
public function getPreviewUrlProduct(Mage_Core_Model_Store $store)
|
49 |
{
|
|
|
|
|
50 |
$collection = Mage::getModel('catalog/product')
|
51 |
->getCollection()
|
52 |
->addStoreFilter($store->getId())
|
53 |
-
->addAttributeToSelect('*')
|
54 |
->addAttributeToFilter(
|
55 |
'status', array(
|
56 |
'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
|
@@ -62,17 +144,14 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
62 |
)
|
63 |
->setPageSize(1)
|
64 |
->setCurPage(1);
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$url =
|
69 |
-
|
70 |
-
);
|
71 |
-
return NostoHttpRequest::replaceQueryParamInUrl(
|
72 |
-
'nostodebug', 'true', $url
|
73 |
-
);
|
74 |
}
|
75 |
-
|
|
|
76 |
}
|
77 |
|
78 |
/**
|
@@ -87,24 +166,37 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
87 |
public function getPreviewUrlCategory(Mage_Core_Model_Store $store)
|
88 |
{
|
89 |
$rootCategoryId = (int)$store->getRootCategoryId();
|
|
|
|
|
90 |
$collection = Mage::getModel('catalog/category')
|
91 |
->getCollection()
|
92 |
->addFieldToFilter('is_active', 1)
|
93 |
->addFieldToFilter('path', array('like' => "1/$rootCategoryId/%"))
|
94 |
-
->addAttributeToSelect('*')
|
95 |
->setPageSize(1)
|
96 |
->setCurPage(1);
|
97 |
-
|
98 |
-
|
|
|
99 |
$url = $category->getUrl();
|
100 |
-
$
|
101 |
-
|
102 |
-
)
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
);
|
|
|
106 |
}
|
107 |
-
|
|
|
108 |
}
|
109 |
|
110 |
/**
|
@@ -119,15 +211,12 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
119 |
public function getPreviewUrlSearch(Mage_Core_Model_Store $store)
|
120 |
{
|
121 |
$url = Mage::getUrl(
|
122 |
-
|
123 |
-
|
124 |
-
'_store_to_url' => true
|
125 |
-
)
|
126 |
);
|
127 |
$url = NostoHttpRequest::replaceQueryParamInUrl('q', 'nosto', $url);
|
128 |
-
|
129 |
-
|
130 |
-
);
|
131 |
}
|
132 |
|
133 |
/**
|
@@ -141,14 +230,11 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
141 |
public function getPreviewUrlCart(Mage_Core_Model_Store $store)
|
142 |
{
|
143 |
$url = Mage::getUrl(
|
144 |
-
|
145 |
-
|
146 |
-
'_store_to_url' => true
|
147 |
-
)
|
148 |
-
);
|
149 |
-
return NostoHttpRequest::replaceQueryParamInUrl(
|
150 |
-
'nostodebug', 'true', $url
|
151 |
);
|
|
|
|
|
152 |
}
|
153 |
|
154 |
/**
|
@@ -160,15 +246,163 @@ class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
|
160 |
* @return string the url.
|
161 |
*/
|
162 |
public function getPreviewUrlFront(Mage_Core_Model_Store $store)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
{
|
164 |
$url = Mage::getUrl(
|
165 |
-
|
166 |
-
|
167 |
-
'_store_to_url' => true
|
168 |
-
)
|
169 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
return NostoHttpRequest::replaceQueryParamInUrl(
|
171 |
-
|
|
|
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
36 |
*/
|
37 |
class Nosto_Tagging_Helper_Url extends Mage_Core_Helper_Abstract
|
38 |
{
|
39 |
+
/**
|
40 |
+
* The ___store parameter in Magento URLs
|
41 |
+
*/
|
42 |
+
const MAGENTO_URL_PARAMETER_STORE = '___store';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The SID (session id) parameter in Magento URLs
|
46 |
+
*/
|
47 |
+
const MAGENTO_URL_PARAMETER_SID = 'SID';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The array option key for store in Magento's URLs
|
51 |
+
*/
|
52 |
+
const MAGENTO_URL_OPTION_STORE = '_store';
|
53 |
+
|
54 |
+
/**
|
55 |
+
* The array option key for store to url in Magento's URLs
|
56 |
+
*/
|
57 |
+
const MAGENTO_URL_OPTION_STORE_TO_URL = '_store_to_url';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* The array option key for no session id in Magento's URLs.
|
61 |
+
* The session id should be included into the URLs which are potentially
|
62 |
+
* used during the same session, e.g. Oauth redirect URL. For example for
|
63 |
+
* product URLs we cannot include the session id as the product URL should
|
64 |
+
* be the same for all visitors and it will be saved to Nosto.
|
65 |
+
*/
|
66 |
+
const MAGENTO_URL_OPTION_NOSID = '_nosid';
|
67 |
+
|
68 |
+
/**
|
69 |
+
* The array option key for ignoring category in Magento's product URLs
|
70 |
+
*/
|
71 |
+
const MAGENTO_URL_OPTION_IGNORE_CATEGORY = '_ignore_category';
|
72 |
+
|
73 |
+
/**
|
74 |
+
* The array option key for URL type in Magento's URLs
|
75 |
+
*/
|
76 |
+
const MAGENTO_URL_OPTION_LINK_TYPE = '_type';
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Path to Nosto oauth controller
|
80 |
+
*/
|
81 |
+
const NOSTO_PATH_OAUTH = 'nosto/oauth';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Path to Magento's search controller
|
85 |
+
*/
|
86 |
+
const MAGENTO_PATH_SEARCH = 'catalogsearch/result';
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Path to Magento's cart controller
|
90 |
+
*/
|
91 |
+
const MAGENTO_PATH_CART = 'checkout/cart';
|
92 |
+
|
93 |
+
/**
|
94 |
+
* The URL parameter to invoke Nosto debug mode in store
|
95 |
+
*/
|
96 |
+
const NOSTO_URL_DEBUG_PARAMETER = 'nostodebug';
|
97 |
+
|
98 |
+
/**
|
99 |
+
* The url type to be used for links.
|
100 |
+
*
|
101 |
+
* This is the only URL type that works correctly the URls when
|
102 |
+
* "Add Store Code to Urls" setting is set to "Yes"
|
103 |
+
*
|
104 |
+
* Mage_Core_Model_Store::URL_TYPE_WEB
|
105 |
+
* - returns an URL without rewrites and without store codes
|
106 |
+
*
|
107 |
+
* Mage_Core_Model_Store::URL_TYPE_LINK
|
108 |
+
* - returns an URL with rewrites and with store codes in URL (if
|
109 |
+
* setting "Add Store Code to Urls" set to yes)
|
110 |
+
*
|
111 |
+
* Mage_Core_Model_Store::URL_TYPE_DIRECT_LINK
|
112 |
+
* - returns an URL with rewrites but without store codes
|
113 |
+
*
|
114 |
+
* @see Mage_Core_Model_Store::URL_TYPE_LINK
|
115 |
+
*
|
116 |
+
* @var string
|
117 |
+
*/
|
118 |
+
public static $urlType = Mage_Core_Model_Store::URL_TYPE_LINK;
|
119 |
+
|
120 |
/**
|
121 |
* Gets the absolute preview URL to the current store view product page.
|
122 |
* The product is the first one found in the database for the store.
|
128 |
*/
|
129 |
public function getPreviewUrlProduct(Mage_Core_Model_Store $store)
|
130 |
{
|
131 |
+
$productUrl = '';
|
132 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
|
133 |
$collection = Mage::getModel('catalog/product')
|
134 |
->getCollection()
|
135 |
->addStoreFilter($store->getId())
|
|
|
136 |
->addAttributeToFilter(
|
137 |
'status', array(
|
138 |
'eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED
|
144 |
)
|
145 |
->setPageSize(1)
|
146 |
->setCurPage(1);
|
147 |
+
/** @var Mage_Catalog_Model_Product $product */
|
148 |
+
$product = $collection->getFirstItem();
|
149 |
+
if ($product instanceof Mage_Catalog_Model_Product) {
|
150 |
+
$url = $this->generateProductUrl($product, $store);
|
151 |
+
$productUrl = $this->addNostoPreviewParameter($url);
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
+
|
154 |
+
return $productUrl;
|
155 |
}
|
156 |
|
157 |
/**
|
166 |
public function getPreviewUrlCategory(Mage_Core_Model_Store $store)
|
167 |
{
|
168 |
$rootCategoryId = (int)$store->getRootCategoryId();
|
169 |
+
$categoryUrl = '';
|
170 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
|
171 |
$collection = Mage::getModel('catalog/category')
|
172 |
->getCollection()
|
173 |
->addFieldToFilter('is_active', 1)
|
174 |
->addFieldToFilter('path', array('like' => "1/$rootCategoryId/%"))
|
|
|
175 |
->setPageSize(1)
|
176 |
->setCurPage(1);
|
177 |
+
/** @var Mage_Catalog_Model_Category $category */
|
178 |
+
$category = $collection->getFirstItem();
|
179 |
+
if ($category instanceof Mage_Catalog_Model_Category) {
|
180 |
$url = $category->getUrl();
|
181 |
+
/* @var Nosto_Tagging_Helper_Data $helper */
|
182 |
+
$helper = Mage::helper('nosto_tagging');
|
183 |
+
if (!$helper->getUsePrettyProductUrls($store)) {
|
184 |
+
$url = NostoHttpRequest::replaceQueryParamInUrl(
|
185 |
+
self::MAGENTO_URL_PARAMETER_STORE, $store->getCode(), $url
|
186 |
+
);
|
187 |
+
}
|
188 |
+
|
189 |
+
// Since the Mage_Catalog_Model_Category::getUrl() doesn't
|
190 |
+
// accept any arguments and always returns an url with SID,
|
191 |
+
// we'll need to remove the sid manually from the URL
|
192 |
+
$url = $this->removeQueryParamFromUrl(
|
193 |
+
$url,
|
194 |
+
self::MAGENTO_URL_PARAMETER_SID
|
195 |
);
|
196 |
+
$categoryUrl = $this->addNostoPreviewParameter($url);
|
197 |
}
|
198 |
+
|
199 |
+
return $categoryUrl;
|
200 |
}
|
201 |
|
202 |
/**
|
211 |
public function getPreviewUrlSearch(Mage_Core_Model_Store $store)
|
212 |
{
|
213 |
$url = Mage::getUrl(
|
214 |
+
self::MAGENTO_PATH_SEARCH,
|
215 |
+
$this->getUrlOptionsWithNoSid($store)
|
|
|
|
|
216 |
);
|
217 |
$url = NostoHttpRequest::replaceQueryParamInUrl('q', 'nosto', $url);
|
218 |
+
|
219 |
+
return $this->addNostoPreviewParameter($url);
|
|
|
220 |
}
|
221 |
|
222 |
/**
|
230 |
public function getPreviewUrlCart(Mage_Core_Model_Store $store)
|
231 |
{
|
232 |
$url = Mage::getUrl(
|
233 |
+
self::MAGENTO_PATH_CART,
|
234 |
+
$this->getUrlOptionsWithNoSid($store)
|
|
|
|
|
|
|
|
|
|
|
235 |
);
|
236 |
+
|
237 |
+
return $this->addNostoPreviewParameter($url);
|
238 |
}
|
239 |
|
240 |
/**
|
246 |
* @return string the url.
|
247 |
*/
|
248 |
public function getPreviewUrlFront(Mage_Core_Model_Store $store)
|
249 |
+
{
|
250 |
+
$url = $this->getFrontPageUrl($store);
|
251 |
+
|
252 |
+
return $this->addNostoPreviewParameter($url);
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Returns the default options for fetching Magento urls with no session id
|
257 |
+
*
|
258 |
+
* @param Mage_Core_Model_Store $store
|
259 |
+
* @return array
|
260 |
+
*/
|
261 |
+
protected function getUrlOptionsWithNoSid(Mage_Core_Model_Store $store)
|
262 |
+
{
|
263 |
+
/* @var Nosto_Tagging_Helper_Data $nosto_helper */
|
264 |
+
$nosto_helper = Mage::helper('nosto_tagging');
|
265 |
+
$params = array(
|
266 |
+
self::MAGENTO_URL_OPTION_STORE => $store->getId(),
|
267 |
+
self::MAGENTO_URL_OPTION_STORE_TO_URL => true,
|
268 |
+
self::MAGENTO_URL_OPTION_NOSID => true,
|
269 |
+
self::MAGENTO_URL_OPTION_LINK_TYPE => self::$urlType
|
270 |
+
);
|
271 |
+
if ($nosto_helper->getUsePrettyProductUrls($store)) {
|
272 |
+
$params[self::MAGENTO_URL_OPTION_STORE_TO_URL] = false;
|
273 |
+
}
|
274 |
+
|
275 |
+
return $params;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Returns the default options for fetching Magento urls with session id
|
280 |
+
*
|
281 |
+
* @param Mage_Core_Model_Store $store
|
282 |
+
* @return array
|
283 |
+
*/
|
284 |
+
protected function getUrlOptionsWithSid(Mage_Core_Model_Store $store)
|
285 |
+
{
|
286 |
+
$params = $this->getUrlOptionsWithNoSid($store);
|
287 |
+
$params[self::MAGENTO_URL_OPTION_NOSID] = false;
|
288 |
+
return $params;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Generates url for a product
|
293 |
+
*
|
294 |
+
* @param Mage_Catalog_Model_Product $product
|
295 |
+
* @param Mage_Core_Model_Store $store
|
296 |
+
*
|
297 |
+
* @return string the url.
|
298 |
+
*/
|
299 |
+
public function generateProductUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
|
300 |
+
{
|
301 |
+
// Unset the cached url first, as it won't include the `___store` param
|
302 |
+
// if it's cached. We need to define the specific store view in the url
|
303 |
+
// in case the same domain is used for all sites.
|
304 |
+
$product->unsetData('url');
|
305 |
+
/** @var Nosto_Tagging_Helper_Data $helper */
|
306 |
+
$helper = Mage::helper('nosto_tagging');
|
307 |
+
$url_params = array(
|
308 |
+
self::MAGENTO_URL_OPTION_NOSID => true,
|
309 |
+
self::MAGENTO_URL_OPTION_IGNORE_CATEGORY => true,
|
310 |
+
self::MAGENTO_URL_OPTION_STORE => $store->getId(),
|
311 |
+
self::MAGENTO_URL_OPTION_STORE_TO_URL => true
|
312 |
+
);
|
313 |
+
$product_url = $product->getUrlInStore($url_params);
|
314 |
+
if ($helper->getUsePrettyProductUrls($store)) {
|
315 |
+
$product_url = $this->removeQueryParamFromUrl(
|
316 |
+
$product_url,
|
317 |
+
self::MAGENTO_URL_PARAMETER_STORE
|
318 |
+
);
|
319 |
+
}
|
320 |
+
|
321 |
+
return $product_url;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Removes given parameter from the url
|
326 |
+
*
|
327 |
+
* @param $url
|
328 |
+
* @param $param
|
329 |
+
* @return string
|
330 |
+
*/
|
331 |
+
public function removeQueryParamFromUrl($url, $param)
|
332 |
+
{
|
333 |
+
$modified_url = $url;
|
334 |
+
$url_parts = NostoHttpRequest::parseUrl($url);
|
335 |
+
if (
|
336 |
+
$url_parts !== false
|
337 |
+
&& isset($url_parts['query'])
|
338 |
+
) {
|
339 |
+
$query_array = NostoHttpRequest::parseQueryString($url_parts['query']);
|
340 |
+
if(isset($query_array[$param])) {
|
341 |
+
unset($query_array[$param]);
|
342 |
+
if (empty($query_array)) {
|
343 |
+
unset($url_parts['query']);
|
344 |
+
} else {
|
345 |
+
$url_parts['query'] = http_build_query($query_array);
|
346 |
+
}
|
347 |
+
$modified_url = NostoHttpRequest::buildUrl($url_parts);
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
return $modified_url;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Returns Oauth redirection URL
|
356 |
+
*
|
357 |
+
* @param Mage_Core_Model_Store $store
|
358 |
+
* @return string
|
359 |
+
*/
|
360 |
+
public function getOauthRedirectUrl(Mage_Core_Model_Store $store)
|
361 |
{
|
362 |
$url = Mage::getUrl(
|
363 |
+
self::NOSTO_PATH_OAUTH,
|
364 |
+
$this->getUrlOptionsWithSid($store)
|
|
|
|
|
365 |
);
|
366 |
+
|
367 |
+
return $url;
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Returns front page URL of the store
|
372 |
+
*
|
373 |
+
* @param Mage_Core_Model_Store $store
|
374 |
+
* @return string
|
375 |
+
*/
|
376 |
+
public function getFrontPageUrl(Mage_Core_Model_Store $store)
|
377 |
+
{
|
378 |
+
/* @var Nosto_Tagging_Helper_Data $helper */
|
379 |
+
$helper = Mage::helper('nosto_tagging');
|
380 |
+
if (!$helper->getUsePrettyProductUrls($store)) {
|
381 |
+
$url = NostoHttpRequest::replaceQueryParamInUrl(
|
382 |
+
self::MAGENTO_URL_PARAMETER_STORE,
|
383 |
+
$store->getCode(),
|
384 |
+
$store->getBaseUrl(self::$urlType)
|
385 |
+
);
|
386 |
+
} else {
|
387 |
+
$url = $store->getBaseUrl(self::$urlType);
|
388 |
+
}
|
389 |
+
|
390 |
+
return $url;
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Adds nostodebug attribute to the given URL
|
395 |
+
*
|
396 |
+
* @param $url
|
397 |
+
*
|
398 |
+
* @return string
|
399 |
+
*/
|
400 |
+
protected function addNostoPreviewParameter($url)
|
401 |
+
{
|
402 |
return NostoHttpRequest::replaceQueryParamInUrl(
|
403 |
+
self::NOSTO_URL_DEBUG_PARAMETER,
|
404 |
+
'true',
|
405 |
+
$url
|
406 |
);
|
407 |
}
|
408 |
}
|
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-
|
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-2017 Nosto 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 → Collection/Rates.php}
RENAMED
@@ -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,27 +11,23 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
-
*
|
31 |
-
* @category Nosto
|
32 |
-
* @package Nosto_Tagging
|
33 |
-
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
*/
|
35 |
-
class
|
36 |
{
|
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:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
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' =>
|
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' =>
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -80,6 +80,26 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
80 |
*/
|
81 |
protected $_signUpApiToken = 'YBDKYwSqTCzSsU8Bwbg4im2pkHMcgTy9cCX7vevjJwON1UISJIwXOLMM0a8nZY7h';
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
/**
|
84 |
* @inheritdoc
|
85 |
*/
|
@@ -95,17 +115,19 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
95 |
*/
|
96 |
public function loadData(Mage_Core_Model_Store $store)
|
97 |
{
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
. ' - '
|
100 |
. $store->getGroup()->getName()
|
101 |
. ' - '
|
102 |
-
. $store->getName()
|
103 |
-
$this->_name = substr(sha1(rand()), 0, 8);
|
104 |
-
$this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl(
|
105 |
-
'___store',
|
106 |
-
$store->getCode(),
|
107 |
-
$store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
|
108 |
);
|
|
|
|
|
109 |
$this->_currencyCode = $store->getBaseCurrencyCode();
|
110 |
$this->_languageCode = substr(
|
111 |
$store->getConfig('general/locale/code'), 0, 2
|
@@ -116,13 +138,31 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
116 |
|
117 |
/** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
|
118 |
$owner = Mage::getModel('nosto_tagging/meta_account_owner');
|
119 |
-
$owner->loadData(
|
120 |
$this->_owner = $owner;
|
121 |
|
122 |
/** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
|
123 |
$billing = Mage::getModel('nosto_tagging/meta_account_billing');
|
124 |
$billing->loadData($store);
|
125 |
$this->_billing = $billing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
/**
|
@@ -252,7 +292,7 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
252 |
*/
|
253 |
public function getCurrencies()
|
254 |
{
|
255 |
-
return
|
256 |
}
|
257 |
|
258 |
/**
|
@@ -265,7 +305,7 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
265 |
*/
|
266 |
public function getUseCurrencyExchangeRates()
|
267 |
{
|
268 |
-
return
|
269 |
}
|
270 |
|
271 |
/**
|
@@ -275,6 +315,26 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
275 |
*/
|
276 |
public function getDefaultVariationId()
|
277 |
{
|
278 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
80 |
*/
|
81 |
protected $_signUpApiToken = 'YBDKYwSqTCzSsU8Bwbg4im2pkHMcgTy9cCX7vevjJwON1UISJIwXOLMM0a8nZY7h';
|
82 |
|
83 |
+
/**
|
84 |
+
* @var array|stdClass account details
|
85 |
+
*/
|
86 |
+
protected $_details;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @var bool the flag to use exchange rates or not
|
90 |
+
*/
|
91 |
+
protected $_useCurrencyExchangeRates;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @var array The array of currencies
|
95 |
+
*/
|
96 |
+
protected $_currencies = array();
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @var string The base currency of the store
|
100 |
+
*/
|
101 |
+
protected $_defaultPriceVariationId;
|
102 |
+
|
103 |
/**
|
104 |
* @inheritdoc
|
105 |
*/
|
115 |
*/
|
116 |
public function loadData(Mage_Core_Model_Store $store)
|
117 |
{
|
118 |
+
/* @var Nosto_Tagging_Helper_Data $helper */
|
119 |
+
$helper = Mage::helper('nosto_tagging');
|
120 |
+
/* @var Nosto_Tagging_Helper_Url $helperUrl */
|
121 |
+
$helperUrl = Mage::helper('nosto_tagging/url');
|
122 |
+
$this->_title = $helper->cleanUpAccountTitle(
|
123 |
+
$store->getWebsite()->getName()
|
124 |
. ' - '
|
125 |
. $store->getGroup()->getName()
|
126 |
. ' - '
|
127 |
+
. $store->getName()
|
|
|
|
|
|
|
|
|
|
|
128 |
);
|
129 |
+
$this->_name = substr(sha1(rand()), 0, 8);
|
130 |
+
$this->_frontPageUrl = $helperUrl->getFrontPageUrl($store);
|
131 |
$this->_currencyCode = $store->getBaseCurrencyCode();
|
132 |
$this->_languageCode = substr(
|
133 |
$store->getConfig('general/locale/code'), 0, 2
|
138 |
|
139 |
/** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
|
140 |
$owner = Mage::getModel('nosto_tagging/meta_account_owner');
|
141 |
+
$owner->loadData();
|
142 |
$this->_owner = $owner;
|
143 |
|
144 |
/** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
|
145 |
$billing = Mage::getModel('nosto_tagging/meta_account_billing');
|
146 |
$billing->loadData($store);
|
147 |
$this->_billing = $billing;
|
148 |
+
|
149 |
+
$this->_useCurrencyExchangeRates = !$helper->multiCurrencyDisabled($store);
|
150 |
+
if (!$helper->multiCurrencyDisabled($store)) {
|
151 |
+
$this->_defaultPriceVariationId = $store->getBaseCurrencyCode();
|
152 |
+
} else {
|
153 |
+
$this->_defaultPriceVariationId = "";
|
154 |
+
}
|
155 |
+
|
156 |
+
$storeLocale = $store->getConfig('general/locale/code');
|
157 |
+
$currencyCodes = $store->getAvailableCurrencyCodes(true);
|
158 |
+
if (is_array($currencyCodes) && count($currencyCodes) > 0) {
|
159 |
+
/** @var Nosto_Tagging_Helper_Currency $currencyHelper */
|
160 |
+
$currencyHelper = Mage::helper('nosto_tagging/currency');
|
161 |
+
foreach ($currencyCodes as $currencyCode) {
|
162 |
+
$this->_currencies[$currencyCode] = $currencyHelper
|
163 |
+
->getCurrencyObject($storeLocale, $currencyCode);
|
164 |
+
}
|
165 |
+
}
|
166 |
}
|
167 |
|
168 |
/**
|
292 |
*/
|
293 |
public function getCurrencies()
|
294 |
{
|
295 |
+
return $this->_currencies;
|
296 |
}
|
297 |
|
298 |
/**
|
305 |
*/
|
306 |
public function getUseCurrencyExchangeRates()
|
307 |
{
|
308 |
+
return $this->_useCurrencyExchangeRates;
|
309 |
}
|
310 |
|
311 |
/**
|
315 |
*/
|
316 |
public function getDefaultVariationId()
|
317 |
{
|
318 |
+
return $this->_defaultPriceVariationId;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Set details
|
323 |
+
*
|
324 |
+
* @param array|stdClass $details
|
325 |
+
*/
|
326 |
+
public function setDetails($details)
|
327 |
+
{
|
328 |
+
$this->_details = $details;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Get the details
|
333 |
+
*
|
334 |
+
* @return array|stdClass
|
335 |
+
*/
|
336 |
+
public function getDetails()
|
337 |
+
{
|
338 |
+
return $this->_details;
|
339 |
}
|
340 |
}
|
app/code/community/Nosto/Tagging/Model/Meta/Account/Billing.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -100,6 +100,11 @@ class Nosto_Tagging_Model_Meta_Account_Iframe extends Mage_Core_Model_Abstract i
|
|
100 |
*/
|
101 |
protected $_shopName;
|
102 |
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* @inheritdoc
|
105 |
*/
|
@@ -116,12 +121,14 @@ class Nosto_Tagging_Model_Meta_Account_Iframe extends Mage_Core_Model_Abstract i
|
|
116 |
public function loadData(Mage_Core_Model_Store $store)
|
117 |
{
|
118 |
/** @var Mage_Admin_Model_User $user */
|
|
|
119 |
$user = Mage::getSingleton('admin/session')->getUser();
|
120 |
/** @var Nosto_Tagging_Helper_Url $urlHelper */
|
121 |
$urlHelper = Mage::helper('nosto_tagging/url');
|
122 |
/** @var Nosto_Tagging_Helper_Data $dataHelper */
|
123 |
$dataHelper = Mage::helper('nosto_tagging/data');
|
124 |
-
|
|
|
125 |
$this->_firstName = $user->getFirstname();
|
126 |
$this->_lastName = $user->getLastname();
|
127 |
$this->_email = $user->getEmail();
|
@@ -138,6 +145,7 @@ class Nosto_Tagging_Model_Meta_Account_Iframe extends Mage_Core_Model_Abstract i
|
|
138 |
$this->_previewUrlCart = $urlHelper->getPreviewUrlCart($store);
|
139 |
$this->_previewUrlFront = $urlHelper->getPreviewUrlFront($store);
|
140 |
$this->_shopName = $store->getName();
|
|
|
141 |
}
|
142 |
|
143 |
/**
|
@@ -318,4 +326,12 @@ class Nosto_Tagging_Model_Meta_Account_Iframe extends Mage_Core_Model_Abstract i
|
|
318 |
{
|
319 |
return $this->_shopName;
|
320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
100 |
*/
|
101 |
protected $_shopName;
|
102 |
|
103 |
+
/**
|
104 |
+
* @var array the name of modules / extensions
|
105 |
+
*/
|
106 |
+
protected $_modules = array();
|
107 |
+
|
108 |
/**
|
109 |
* @inheritdoc
|
110 |
*/
|
121 |
public function loadData(Mage_Core_Model_Store $store)
|
122 |
{
|
123 |
/** @var Mage_Admin_Model_User $user */
|
124 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
125 |
$user = Mage::getSingleton('admin/session')->getUser();
|
126 |
/** @var Nosto_Tagging_Helper_Url $urlHelper */
|
127 |
$urlHelper = Mage::helper('nosto_tagging/url');
|
128 |
/** @var Nosto_Tagging_Helper_Data $dataHelper */
|
129 |
$dataHelper = Mage::helper('nosto_tagging/data');
|
130 |
+
/** @var Nosto_Tagging_Helper_Module $moduleHelper */
|
131 |
+
$moduleHelper = Mage::helper('nosto_tagging/module');
|
132 |
$this->_firstName = $user->getFirstname();
|
133 |
$this->_lastName = $user->getLastname();
|
134 |
$this->_email = $user->getEmail();
|
145 |
$this->_previewUrlCart = $urlHelper->getPreviewUrlCart($store);
|
146 |
$this->_previewUrlFront = $urlHelper->getPreviewUrlFront($store);
|
147 |
$this->_shopName = $store->getName();
|
148 |
+
$this->_modules = $moduleHelper->getModulesForIntegration();
|
149 |
}
|
150 |
|
151 |
/**
|
326 |
{
|
327 |
return $this->_shopName;
|
328 |
}
|
329 |
+
|
330 |
+
/*
|
331 |
+
* @inheritdoc
|
332 |
+
*/
|
333 |
+
public function getModules()
|
334 |
+
{
|
335 |
+
return $this->_modules;
|
336 |
+
}
|
337 |
}
|
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-
|
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
|
63 |
*
|
64 |
-
* @param Mage_Core_Model_Store $store the store view to load the data for.
|
65 |
*/
|
66 |
-
public function loadData(
|
67 |
{
|
68 |
/** @var Mage_Admin_Model_User $user */
|
|
|
69 |
$user = Mage::getSingleton('admin/session')->getUser();
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -60,13 +60,9 @@ class Nosto_Tagging_Model_Meta_Oauth extends Mage_Core_Model_Abstract implements
|
|
60 |
*/
|
61 |
public function loadData(Mage_Core_Model_Store $store)
|
62 |
{
|
63 |
-
$
|
64 |
-
|
65 |
-
|
66 |
-
'_store' => $store->getId(),
|
67 |
-
'_store_to_url' => true
|
68 |
-
)
|
69 |
-
);
|
70 |
$this->_languageIsoCode = substr(
|
71 |
Mage::app()->getLocale()->getLocaleCode(), 0, 2
|
72 |
);
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
60 |
*/
|
61 |
public function loadData(Mage_Core_Model_Store $store)
|
62 |
{
|
63 |
+
/* @var Nosto_Tagging_Helper_Url $urlHelper */
|
64 |
+
$urlHelper = Mage::helper('nosto_tagging/url');
|
65 |
+
$this->_redirectUrl = $urlHelper->getOauthRedirectUrl($store);
|
|
|
|
|
|
|
|
|
66 |
$this->_languageIsoCode = substr(
|
67 |
Mage::app()->getLocale()->getLocaleCode(), 0, 2
|
68 |
);
|
app/code/community/Nosto/Tagging/Model/Meta/Order.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -71,6 +71,7 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
|
|
71 |
*/
|
72 |
public function __construct(array $args)
|
73 |
{
|
|
|
74 |
if (!isset($args['productId']) || empty($args['productId'])) {
|
75 |
Mage::log(
|
76 |
sprintf(
|
@@ -104,7 +105,7 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
|
|
104 |
);
|
105 |
$args['name'] = '';
|
106 |
}
|
107 |
-
if (!isset($args['unitPrice'])
|
108 |
Mage::log(
|
109 |
sprintf(
|
110 |
'%s.unitPrice must have a value',
|
@@ -114,7 +115,13 @@ class Nosto_Tagging_Model_Meta_Order_Item extends Mage_Core_Model_Abstract imple
|
|
114 |
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
115 |
);
|
116 |
$args['unitPrice'] = '';
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
|
|
118 |
if (!isset($args['currencyCode']) || empty($args['currencyCode'])) {
|
119 |
Mage::log(
|
120 |
sprintf(
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
71 |
*/
|
72 |
public function __construct(array $args)
|
73 |
{
|
74 |
+
parent::__construct();
|
75 |
if (!isset($args['productId']) || empty($args['productId'])) {
|
76 |
Mage::log(
|
77 |
sprintf(
|
105 |
);
|
106 |
$args['name'] = '';
|
107 |
}
|
108 |
+
if (!isset($args['unitPrice'])) {
|
109 |
Mage::log(
|
110 |
sprintf(
|
111 |
'%s.unitPrice must have a value',
|
115 |
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
116 |
);
|
117 |
$args['unitPrice'] = '';
|
118 |
+
} elseif (
|
119 |
+
empty($args['unitPrice'])
|
120 |
+
|| !is_numeric($args['unitPrice'])
|
121 |
+
) {
|
122 |
+
$args['unitPrice'] = 0;
|
123 |
}
|
124 |
+
|
125 |
if (!isset($args['currencyCode']) || empty($args['currencyCode'])) {
|
126 |
Mage::log(
|
127 |
sprintf(
|
app/code/community/Nosto/Tagging/Model/Meta/Order/Status.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
61 |
*/
|
62 |
public function __construct(array $args)
|
63 |
{
|
64 |
+
parent::__construct();
|
65 |
if (!isset($args['code']) || !is_string($args['code'])) {
|
66 |
Mage::log(
|
67 |
sprintf(
|
app/code/community/Nosto/Tagging/Model/Meta/Order/Vaimo/Klarna/Checkout.php
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Meta data class which holds information about an order.
|
30 |
+
* This is used during the order confirmation API request and the order
|
31 |
+
* history export.
|
32 |
+
*
|
33 |
+
* @category Nosto
|
34 |
+
* @package Nosto_Tagging
|
35 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
36 |
+
*/
|
37 |
+
class Nosto_Tagging_Model_Meta_Order_Vaimo_Klarna_Checkout extends Nosto_Tagging_Model_Meta_Order
|
38 |
+
{
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Default order status for completed checkouts
|
42 |
+
*/
|
43 |
+
const DEFAULT_ORDER_STATUS = 'checkout_complete';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Discount factor for the order
|
47 |
+
* @var float
|
48 |
+
*/
|
49 |
+
protected $discountFactor;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Required fields for Klarna order
|
53 |
+
*
|
54 |
+
* @var array
|
55 |
+
*/
|
56 |
+
public static $requiredFieldsForOrder = array(
|
57 |
+
'completed_at',
|
58 |
+
'status',
|
59 |
+
'billing_address',
|
60 |
+
'cart',
|
61 |
+
'purchase_currency',
|
62 |
+
);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Loads the order data from a Magento quote model.
|
66 |
+
*
|
67 |
+
* @throws NostoException
|
68 |
+
* @return bool
|
69 |
+
* @param Mage_Sales_Model_Quote $quote the order model.
|
70 |
+
*/
|
71 |
+
public function loadDataFromQuote(Mage_Sales_Model_Quote $quote)
|
72 |
+
{
|
73 |
+
$vaimoKlarnaOrder = null;
|
74 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
75 |
+
$checkoutId = $quote->getKlarnaCheckoutId();
|
76 |
+
$this->_orderNumber = $checkoutId;
|
77 |
+
$this->_externalOrderRef = null;
|
78 |
+
$this->_createdDate = $quote->getCreatedAt();
|
79 |
+
$this->_orderStatus = Mage::getModel(
|
80 |
+
'nosto_tagging/meta_order_status',
|
81 |
+
array(
|
82 |
+
'code' => self::DEFAULT_ORDER_STATUS,
|
83 |
+
'label' => self::DEFAULT_ORDER_STATUS
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
+
$payment = $quote->getPayment();
|
88 |
+
if (
|
89 |
+
$payment instanceof Mage_Sales_Model_Quote_Payment
|
90 |
+
&& $payment->getMethod()
|
91 |
+
) {
|
92 |
+
$this->_paymentProvider = $payment->getMethod();
|
93 |
+
} else {
|
94 |
+
$this->_paymentProvider = 'unknown[from_vaimo_klarna_plugin]';
|
95 |
+
}
|
96 |
+
/* @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
|
97 |
+
$klarna = Mage::getModel('klarna/klarnacheckout');
|
98 |
+
if ($klarna instanceof Vaimo_Klarna_Model_Klarnacheckout === false) {
|
99 |
+
Nosto::throwException('No Vaimo_Klarna_Model_Klarnacheckout found');
|
100 |
+
}
|
101 |
+
$buyer_attributes = array(
|
102 |
+
'firstName' => '',
|
103 |
+
'lastName' => '',
|
104 |
+
'email' => ''
|
105 |
+
);
|
106 |
+
$klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
107 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
108 |
+
$vaimoKlarnaOrder = $klarna->getKlarnaOrderRaw($quote->getKlarnaCheckoutId());
|
109 |
+
try {
|
110 |
+
self::validateKlarnaOrder($vaimoKlarnaOrder);
|
111 |
+
} catch (NostoException $e) {
|
112 |
+
Mage::log(
|
113 |
+
sprintf(
|
114 |
+
'Failed to validate VaimoKlarnaOrder. Error was %s',
|
115 |
+
$e->getMessage()
|
116 |
+
)
|
117 |
+
);
|
118 |
+
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
$vaimoKlarnaBilling = $vaimoKlarnaOrder['billing_address'];
|
122 |
+
if (!empty($vaimoKlarnaBilling['given_name'])) {
|
123 |
+
$buyer_attributes['firstName'] = $vaimoKlarnaBilling['given_name'];
|
124 |
+
}
|
125 |
+
if (!empty($vaimoKlarnaBilling['family_name'])) {
|
126 |
+
$buyer_attributes['lastName'] = $vaimoKlarnaBilling['family_name'];
|
127 |
+
}
|
128 |
+
if (!empty($vaimoKlarnaBilling['email'])) {
|
129 |
+
$buyer_attributes['email'] = $vaimoKlarnaBilling['email'];
|
130 |
+
}
|
131 |
+
$this->_buyer = Mage::getModel(
|
132 |
+
'nosto_tagging/meta_order_buyer',
|
133 |
+
$buyer_attributes
|
134 |
+
);
|
135 |
+
try {
|
136 |
+
$this->buildItemsFromQuote($quote);
|
137 |
+
} catch (Exception $e) {
|
138 |
+
Mage::log(
|
139 |
+
sprintf(
|
140 |
+
'Could not find klarnaCheckoutId from quote #%d. Error: %s',
|
141 |
+
$quote->getId(),
|
142 |
+
$e->getMessage()
|
143 |
+
),
|
144 |
+
Zend_Log::ERR,
|
145 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
146 |
+
);
|
147 |
+
}
|
148 |
+
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Builds item array from quote (items in cart)
|
154 |
+
*
|
155 |
+
* @param Mage_Sales_Model_Quote $quote
|
156 |
+
*/
|
157 |
+
public function buildItemsFromQuote(Mage_Sales_Model_Quote $quote)
|
158 |
+
{
|
159 |
+
$discountFactor = $this->getDiscountFactor($quote);
|
160 |
+
/* @var Mage_Sales_Model_Quote_Item $quoteItem */
|
161 |
+
foreach ($quote->getAllItems() as $quoteItem) {
|
162 |
+
if ($discountFactor && is_numeric($discountFactor)) {
|
163 |
+
$itemPrice = round($quoteItem->getPriceInclTax(),2)*$discountFactor;
|
164 |
+
} else {
|
165 |
+
$itemPrice = $quoteItem->getPriceInclTax();
|
166 |
+
}
|
167 |
+
$itemArguments = array(
|
168 |
+
'productId' => $quoteItem->getProductId(),
|
169 |
+
'quantity' => $quoteItem->getQty(),
|
170 |
+
'name' => $quoteItem->getName(),
|
171 |
+
'unitPrice' => $itemPrice,
|
172 |
+
'currencyCode' => strtoupper($quote->getQuoteCurrencyCode())
|
173 |
+
);
|
174 |
+
$nostoItem = Mage::getModel(
|
175 |
+
'nosto_tagging/meta_order_item',
|
176 |
+
$itemArguments
|
177 |
+
);
|
178 |
+
$this->_items[] = $nostoItem;
|
179 |
+
}
|
180 |
+
if ($this->includeSpecialItems) {
|
181 |
+
$appliedRuleIds = $quote->getAppliedRuleIds();
|
182 |
+
if ($appliedRuleIds) {
|
183 |
+
$ruleIds = explode(',',$quote->getAppliedRuleIds());
|
184 |
+
if (is_array($ruleIds)) {
|
185 |
+
foreach ($ruleIds as $ruleId) {
|
186 |
+
/* @var Mage_SalesRule_Model_Rule $discountRule */
|
187 |
+
$discountRule = Mage::getModel('salesrule/rule')->load($ruleId);
|
188 |
+
$name = sprintf(
|
189 |
+
'Discount (%s)',
|
190 |
+
$discountRule->getName()
|
191 |
+
);
|
192 |
+
$itemArguments = array(
|
193 |
+
'productId' => -1,
|
194 |
+
'quantity' => 1,
|
195 |
+
'name' => $name,
|
196 |
+
'unitPrice' => 0,
|
197 |
+
'currencyCode' => strtoupper($quote->getQuoteCurrencyCode())
|
198 |
+
);
|
199 |
+
$nostoItem = Mage::getModel(
|
200 |
+
'nosto_tagging/meta_order_item',
|
201 |
+
$itemArguments
|
202 |
+
);
|
203 |
+
$this->_items[] = $nostoItem;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Calculates the discount factor
|
212 |
+
*
|
213 |
+
* @param Mage_Sales_Model_Quote $quote
|
214 |
+
* @return float|int
|
215 |
+
*/
|
216 |
+
protected function getDiscountFactor(Mage_Sales_Model_Quote $quote) {
|
217 |
+
if (!$this->discountFactor) {
|
218 |
+
$totalPrice = $quote->getSubtotal();
|
219 |
+
$discountedPrice = $quote->getSubtotalWithDiscount();
|
220 |
+
$this->discountFactor = $discountedPrice / $totalPrice;
|
221 |
+
}
|
222 |
+
|
223 |
+
return $this->discountFactor;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Loads data based on klarna checkout id
|
228 |
+
*
|
229 |
+
* @param string $klarnaCheckoutId
|
230 |
+
*/
|
231 |
+
public function loadOrderByKlarnaCheckoutId($klarnaCheckoutId)
|
232 |
+
{
|
233 |
+
/* @var Vaimo_Klarna_Helper_Data $klarna_helper */
|
234 |
+
$klarna_helper = Mage::helper('klarna');
|
235 |
+
if ($klarna_helper instanceof Vaimo_Klarna_Helper_Data) {
|
236 |
+
/* @var $quote Mage_Sales_Model_Quote */
|
237 |
+
$quote = $klarna_helper->findQuote($klarnaCheckoutId);
|
238 |
+
if ($quote instanceof Mage_Sales_Model_Quote) {
|
239 |
+
/* @var $order Mage_Sales_Model_Order */
|
240 |
+
$salesOrderModel = Mage::getModel('sales/order');
|
241 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
242 |
+
$order = $salesOrderModel->loadByAttribute(
|
243 |
+
'quote_id',
|
244 |
+
$quote->getId()
|
245 |
+
);
|
246 |
+
if (
|
247 |
+
$order instanceof Mage_Sales_Model_Order
|
248 |
+
&& $order->getId()
|
249 |
+
) {
|
250 |
+
$this->loadData($order);
|
251 |
+
} else {
|
252 |
+
$this->loadDataFromQuote($quote);
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Loads data from order
|
260 |
+
*
|
261 |
+
* @param Mage_Sales_Model_Order $order
|
262 |
+
*/
|
263 |
+
public function loadData(Mage_Sales_Model_Order $order)
|
264 |
+
{
|
265 |
+
$store = Mage::getSingleton('core/store')->load($order->store_id);
|
266 |
+
/* @var Mage_Sales_Model_Quote $quoteModel */
|
267 |
+
$quoteModel = Mage::getModel('sales/quote');
|
268 |
+
$quote = $quoteModel->setStore($store)->load($order->getQuoteId());
|
269 |
+
parent::loadData($order);
|
270 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
271 |
+
$klarnaCheckoutId = $quote->getKlarnaCheckoutId();
|
272 |
+
if (empty($klarnaCheckoutId)) {
|
273 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
274 |
+
Mage::log(
|
275 |
+
sprintf(
|
276 |
+
'Could not find klarnaCheckoutId from quote #%d',
|
277 |
+
$order->quoteId()
|
278 |
+
),
|
279 |
+
Zend_Log::ERR,
|
280 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
281 |
+
);
|
282 |
+
} else {
|
283 |
+
$this->_orderNumber = $klarnaCheckoutId;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Validates Klarna entity
|
289 |
+
*
|
290 |
+
* @param $order
|
291 |
+
* @return bool
|
292 |
+
*/
|
293 |
+
public static function validateKlarnaOrder($order)
|
294 |
+
{
|
295 |
+
return self::validateKlarnaEntity('Order', $order);
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Validates Klarna entity
|
300 |
+
*
|
301 |
+
* @param $type
|
302 |
+
* @param $entity
|
303 |
+
* @return bool
|
304 |
+
*/
|
305 |
+
public static function validateKlarnaEntity($type, $entity)
|
306 |
+
{
|
307 |
+
$rules = sprintf('requiredFieldsFor%s', ucfirst($type));
|
308 |
+
$empty = false;
|
309 |
+
foreach (self::$$rules as $field) {
|
310 |
+
if (
|
311 |
+
is_object($entity)
|
312 |
+
) {
|
313 |
+
if (get_class($entity) === 'Varien_Object') {
|
314 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
315 |
+
$val = $entity->get($field);
|
316 |
+
if (empty($val)) {
|
317 |
+
$empty = true;
|
318 |
+
}
|
319 |
+
} elseif (isset($entity[$field])) {
|
320 |
+
$val = $entity[$field];
|
321 |
+
if (empty($val)) {
|
322 |
+
$empty = true;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
} elseif (is_array($entity)) {
|
326 |
+
if (empty($entity[$field])) {
|
327 |
+
$empty = true;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
if ($empty === true) {
|
331 |
+
Nosto::throwException(
|
332 |
+
sprintf(
|
333 |
+
'Cannot create item - empty %s',
|
334 |
+
$field
|
335 |
+
)
|
336 |
+
);
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
return true;
|
341 |
+
}
|
342 |
+
}
|
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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -36,26 +36,6 @@
|
|
36 |
*/
|
37 |
class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implements NostoProductInterface, NostoValidatableInterface
|
38 |
{
|
39 |
-
/**
|
40 |
-
* Product "in stock" tagging string.
|
41 |
-
*/
|
42 |
-
const PRODUCT_IN_STOCK = 'InStock';
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Product "out of stock" tagging string.
|
46 |
-
*/
|
47 |
-
const PRODUCT_OUT_OF_STOCK = 'OutOfStock';
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Product "invisible " tagging string.
|
51 |
-
*/
|
52 |
-
const PRODUCT_INVISIBLE = 'Invisible';
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Product "can be directly added to cart" tag string.
|
56 |
-
*/
|
57 |
-
const PRODUCT_ADD_TO_CART = 'add-to-cart';
|
58 |
-
|
59 |
/**
|
60 |
* @var string the absolute url to the product page in the shop frontend.
|
61 |
*/
|
@@ -99,11 +79,7 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
|
|
99 |
/**
|
100 |
* @var array the tags for the product.
|
101 |
*/
|
102 |
-
protected $_tags = array(
|
103 |
-
'tag1' => array(),
|
104 |
-
'tag2' => array(),
|
105 |
-
'tag3' => array(),
|
106 |
-
);
|
107 |
|
108 |
/**
|
109 |
* @var array the categories the product is located in.
|
@@ -126,9 +102,77 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
|
|
126 |
protected $_brand;
|
127 |
|
128 |
/**
|
129 |
-
* @var string the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
*/
|
131 |
-
protected $
|
132 |
|
133 |
/**
|
134 |
* @inheritdoc
|
@@ -160,6 +204,26 @@ 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 +238,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 |
-
$
|
183 |
-
$this->
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
$this->_availability = $this->buildAvailability($product);
|
186 |
$this->_categories = $this->buildCategories($product);
|
187 |
|
@@ -193,15 +268,22 @@ 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 |
-
|
197 |
-
|
|
|
198 |
}
|
199 |
if (($tags = $this->buildTags($product, $store)) !== array()) {
|
200 |
$this->_tags['tag1'] = $tags;
|
201 |
}
|
202 |
-
if (
|
203 |
-
$this->
|
204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
|
207 |
/**
|
@@ -213,11 +295,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::
|
217 |
if(!$product->isVisibleInSiteVisibility()) {
|
218 |
-
$availability = self::
|
219 |
} elseif ($product->isAvailable()) {
|
220 |
-
$availability = self::
|
221 |
}
|
222 |
|
223 |
return $availability;
|
@@ -259,12 +341,167 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
|
|
259 |
}
|
260 |
|
261 |
if (!$product->canConfigure()) {
|
262 |
-
$tags[] = self::
|
263 |
}
|
264 |
|
265 |
return $tags;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
/**
|
269 |
* Builds the absolute store front url for the product page.
|
270 |
*
|
@@ -279,18 +516,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 |
-
|
283 |
-
|
284 |
-
|
285 |
-
$
|
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 +734,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 +759,146 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
|
|
540 |
*/
|
541 |
public function getVariationId()
|
542 |
{
|
543 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
36 |
*/
|
37 |
class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implements NostoProductInterface, NostoValidatableInterface
|
38 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* @var string the absolute url to the product page in the shop frontend.
|
41 |
*/
|
79 |
/**
|
80 |
* @var array the tags for the product.
|
81 |
*/
|
82 |
+
protected $_tags = array();
|
|
|
|
|
|
|
|
|
83 |
|
84 |
/**
|
85 |
* @var array the categories the product is located in.
|
102 |
protected $_brand;
|
103 |
|
104 |
/**
|
105 |
+
* @var string the default variation identifier of the shop
|
106 |
+
*/
|
107 |
+
protected $_variationId;
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @var float the price paid for the supplier
|
111 |
+
*/
|
112 |
+
protected $_supplierCost;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @var int product stock
|
116 |
+
*/
|
117 |
+
protected $_inventoryLevel;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @var int the amount of reviews
|
121 |
+
*/
|
122 |
+
protected $_reviewCount;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @var float the value of the rating(s)
|
126 |
+
*/
|
127 |
+
protected $_ratingValue;
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @var array alternative image urls
|
131 |
+
*/
|
132 |
+
protected $_alternateImageUrls;
|
133 |
+
|
134 |
+
/**
|
135 |
+
* @var string the condition of the product
|
136 |
+
*/
|
137 |
+
protected $_condition;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @var string the gender (target group) of the product
|
141 |
+
*/
|
142 |
+
protected $_gender;
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @var string the the age group
|
146 |
+
*/
|
147 |
+
protected $_ageGroup;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @var string the barcode
|
151 |
+
*/
|
152 |
+
protected $_gtin;
|
153 |
+
|
154 |
+
/**
|
155 |
+
* @var string category used in Google's services
|
156 |
+
*/
|
157 |
+
protected $_googleCategory;
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @var string the pricing measure of the product. Pricing measure for a
|
161 |
+
* 0.33 liter bottle for example is "0.33".
|
162 |
+
*/
|
163 |
+
protected $_unitPricingMeasure;
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @var string the pricing base measure of the product. Pricing base measure
|
167 |
+
* for a 0.33l bottle is "1".
|
168 |
+
*/
|
169 |
+
protected $_unitPricingBaseMeasure;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @var string the pricing unit of the product. Pricing unit for a 0.33l
|
173 |
+
* bottle is "l" (litre).
|
174 |
*/
|
175 |
+
protected $_unitPricingUnit;
|
176 |
|
177 |
/**
|
178 |
* @inheritdoc
|
204 |
);
|
205 |
}
|
206 |
|
207 |
+
/**
|
208 |
+
* Array of attributes that can be customized from Nosto's store admin
|
209 |
+
* settings
|
210 |
+
*
|
211 |
+
* @var array
|
212 |
+
*/
|
213 |
+
public static $customizableAttributes = array(
|
214 |
+
'gtin' => '_gtin',
|
215 |
+
'supplier_cost' => '_supplierCost',
|
216 |
+
);
|
217 |
+
|
218 |
+
public function __construct()
|
219 |
+
{
|
220 |
+
parent::__construct();
|
221 |
+
foreach (Nosto_Tagging_Helper_Data::$validTags as $validTag) {
|
222 |
+
$this->_tags[$validTag] = array();
|
223 |
+
}
|
224 |
+
$this->_alternateImageUrls = array();
|
225 |
+
}
|
226 |
+
|
227 |
/**
|
228 |
* Loads the product info from a Magento product model.
|
229 |
*
|
238 |
|
239 |
/** @var Nosto_Tagging_Helper_Price $priceHelper */
|
240 |
$priceHelper = Mage::helper('nosto_tagging/price');
|
241 |
+
/** @var Nosto_Tagging_Helper_Data $dataHelper */
|
242 |
+
$dataHelper = Mage::helper('nosto_tagging');
|
243 |
|
244 |
$this->_url = $this->buildUrl($product, $store);
|
245 |
$this->_productId = $product->getId();
|
246 |
$this->_name = $product->getName();
|
247 |
$this->_imageUrl = $this->buildImageUrl($product, $store);
|
248 |
+
$currentCurrencyCode = $store->getCurrentCurrencyCode();
|
249 |
+
$this->_price = $priceHelper->getTaggingPrice(
|
250 |
+
$priceHelper->getProductFinalPriceInclTax($product),
|
251 |
+
$currentCurrencyCode,
|
252 |
+
$store
|
253 |
+
);
|
254 |
+
$this->_listPrice = $priceHelper->getTaggingPrice(
|
255 |
+
$priceHelper->getProductPriceInclTax($product),
|
256 |
+
$currentCurrencyCode,
|
257 |
+
$store
|
258 |
+
);
|
259 |
+
$this->_currencyCode = $priceHelper->getTaggingCurrencyCode($currentCurrencyCode, $store);
|
260 |
$this->_availability = $this->buildAvailability($product);
|
261 |
$this->_categories = $this->buildCategories($product);
|
262 |
|
268 |
if ($product->hasData('description')) {
|
269 |
$this->_description = $product->getData('description');
|
270 |
}
|
271 |
+
$brandAttribute = $dataHelper->getBrandAttribute($store);
|
272 |
+
if ($product->hasData($brandAttribute)) {
|
273 |
+
$this->_brand = $this->getAttributeValue($product, $brandAttribute);
|
274 |
}
|
275 |
if (($tags = $this->buildTags($product, $store)) !== array()) {
|
276 |
$this->_tags['tag1'] = $tags;
|
277 |
}
|
278 |
+
if (!$dataHelper->multiCurrencyDisabled($store)) {
|
279 |
+
$this->_variationId = $store->getBaseCurrencyCode();
|
280 |
}
|
281 |
+
|
282 |
+
$this->amendAttributeTags($product, $store);
|
283 |
+
$this->amendReviews($product, $store);
|
284 |
+
$this->amendCustomizableAttributes($product, $store);
|
285 |
+
$this->amendAlternativeImages($product, $store);
|
286 |
+
$this->amendInventoryLevel($product);
|
287 |
}
|
288 |
|
289 |
/**
|
295 |
*/
|
296 |
protected function buildAvailability(Mage_Catalog_Model_Product $product)
|
297 |
{
|
298 |
+
$availability = self::OUT_OF_STOCK;
|
299 |
if(!$product->isVisibleInSiteVisibility()) {
|
300 |
+
$availability = self::INVISIBLE;
|
301 |
} elseif ($product->isAvailable()) {
|
302 |
+
$availability = self::IN_STOCK;
|
303 |
}
|
304 |
|
305 |
return $availability;
|
341 |
}
|
342 |
|
343 |
if (!$product->canConfigure()) {
|
344 |
+
$tags[] = self::ADD_TO_CART;
|
345 |
}
|
346 |
|
347 |
return $tags;
|
348 |
}
|
349 |
|
350 |
+
/**
|
351 |
+
* Adds the stock level / inventory level
|
352 |
+
*
|
353 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
354 |
+
*
|
355 |
+
*/
|
356 |
+
protected function amendInventoryLevel(
|
357 |
+
Mage_Catalog_Model_Product $product
|
358 |
+
) {
|
359 |
+
/* @var Nosto_Tagging_Helper_Stock $stockHelper */
|
360 |
+
$stockHelper = Mage::helper('nosto_tagging/stock');
|
361 |
+
try {
|
362 |
+
$this->_inventoryLevel = $stockHelper->getQty($product);
|
363 |
+
} catch (Exception $e) {
|
364 |
+
Mage::log(
|
365 |
+
sprintf(
|
366 |
+
'Failed to resolve inventory level for product %d to tags. Error message was: %s',
|
367 |
+
$product->getId(),
|
368 |
+
$e->getMessage()
|
369 |
+
),
|
370 |
+
Zend_Log::WARN,
|
371 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
372 |
+
);
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Adds the alternative image urls
|
378 |
+
*
|
379 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
380 |
+
* @param Mage_Core_Model_Store $store the store model.
|
381 |
+
*
|
382 |
+
*/
|
383 |
+
protected function amendAlternativeImages(
|
384 |
+
Mage_Catalog_Model_Product $product,
|
385 |
+
Mage_Core_Model_Store $store
|
386 |
+
) {
|
387 |
+
/* @var Mage_Catalog_Model_Product_Attribute_Media_Api $mediaApi */
|
388 |
+
$mediaApi = Mage::getModel('catalog/product_attribute_media_api');
|
389 |
+
$mediaItems = $mediaApi->items($product->getId(), $store);
|
390 |
+
if (is_array($mediaItems)) {
|
391 |
+
foreach ($mediaItems as $image) {
|
392 |
+
$this->addAlternateImage($image);
|
393 |
+
}
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Amends the product reviews product
|
399 |
+
*
|
400 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
401 |
+
* @param Mage_Core_Model_Store $store the store model.
|
402 |
+
*
|
403 |
+
*/
|
404 |
+
protected function amendReviews(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
|
405 |
+
{
|
406 |
+
/* @var Nosto_Tagging_Helper_Data $dataHelper*/
|
407 |
+
$dataHelper = Mage::helper('nosto_tagging');
|
408 |
+
$ratingProvider = $dataHelper->getRatingsAndReviewsProvider($store);
|
409 |
+
if ($ratingProvider) {
|
410 |
+
/* @var Nosto_Tagging_Helper_Class $classHelper */
|
411 |
+
$classHelper = Mage::helper('nosto_tagging/class');
|
412 |
+
/* @var Nosto_Tagging_Model_Meta_Rating $ratingClass */
|
413 |
+
$ratingClass = $classHelper->getRatingClass($store);
|
414 |
+
if ($ratingClass instanceof Nosto_Tagging_Model_Meta_Rating_Interface) {
|
415 |
+
$ratingClass->init($product, $store);
|
416 |
+
if ($ratingClass->getRating()) {
|
417 |
+
$this->_ratingValue = $ratingClass->getRating();
|
418 |
+
}
|
419 |
+
if ($ratingClass->getReviewCount()) {
|
420 |
+
$this->_reviewCount = $ratingClass->getReviewCount();
|
421 |
+
}
|
422 |
+
} else {
|
423 |
+
Mage::log(
|
424 |
+
sprintf(
|
425 |
+
'No rating class implementation found for %s',
|
426 |
+
$ratingProvider
|
427 |
+
),
|
428 |
+
Zend_Log::WARN,
|
429 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
430 |
+
);
|
431 |
+
}
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Amends the customizable attributes
|
437 |
+
*
|
438 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
439 |
+
* @param Mage_Core_Model_Store $store the store model.
|
440 |
+
*
|
441 |
+
*/
|
442 |
+
protected function amendCustomizableAttributes(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
|
443 |
+
{
|
444 |
+
/* @var Nosto_Tagging_Helper_Data $nosto_helper */
|
445 |
+
$nosto_helper = Mage::helper("nosto_tagging");
|
446 |
+
|
447 |
+
foreach (self::$customizableAttributes as $mageAttr => $nostoAttr) {
|
448 |
+
$mapped = $nosto_helper->getMappedAttribute($mageAttr, $store);
|
449 |
+
if ($mapped) {
|
450 |
+
$value = $this->getAttributeValue($product, $mapped);
|
451 |
+
if(!empty($value)) {
|
452 |
+
$this->$nostoAttr = $value;
|
453 |
+
}
|
454 |
+
}
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Amends the product attributes to tags array if attributes are defined
|
460 |
+
* and are present in product
|
461 |
+
*
|
462 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
463 |
+
* @param Mage_Core_Model_Store $store the store model.
|
464 |
+
*
|
465 |
+
*/
|
466 |
+
protected function amendAttributeTags(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
|
467 |
+
{
|
468 |
+
$product_attributes = $product->getAttributes();
|
469 |
+
/* @var Nosto_Tagging_Helper_Data $nosto_helper */
|
470 |
+
$nosto_helper = Mage::helper("nosto_tagging");
|
471 |
+
|
472 |
+
foreach (Nosto_Tagging_Helper_Data::$validTags as $tag_id) {
|
473 |
+
$attributes_to_tag = $nosto_helper->getAttributesToTag($tag_id, $store->getId());
|
474 |
+
if (empty($attributes_to_tag) || !is_array($attributes_to_tag)) {
|
475 |
+
continue;
|
476 |
+
}
|
477 |
+
/* @var Mage_Catalog_Model_Resource_Eav_Attribute $product_attribute*/
|
478 |
+
foreach ($product_attributes as $key=>$product_attribute) {
|
479 |
+
if (in_array($key, $attributes_to_tag)) {
|
480 |
+
try {
|
481 |
+
$attribute_value = $this->getAttributeValue($product, $key);
|
482 |
+
if (!empty($attribute_value)) {
|
483 |
+
$this->_tags[$tag_id][] = sprintf(
|
484 |
+
'%s:%s',
|
485 |
+
$key,
|
486 |
+
$attribute_value
|
487 |
+
);
|
488 |
+
}
|
489 |
+
} catch (Exception $e) {
|
490 |
+
Mage::log(
|
491 |
+
sprintf(
|
492 |
+
'Failed to add attribute %s to tags. Error message was: %s',
|
493 |
+
$key,
|
494 |
+
$e->getMessage()
|
495 |
+
),
|
496 |
+
Zend_Log::WARN,
|
497 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
498 |
+
);
|
499 |
+
}
|
500 |
+
}
|
501 |
+
}
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
/**
|
506 |
* Builds the absolute store front url for the product page.
|
507 |
*
|
516 |
*/
|
517 |
protected function buildUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
|
518 |
{
|
519 |
+
/** @var Nosto_Tagging_Helper_Url $url_helper */
|
520 |
+
$url_helper = Mage::helper('nosto_tagging/url');
|
521 |
+
$product_url = $url_helper->generateProductUrl($product, $store);
|
522 |
+
return $product_url;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
|
525 |
/**
|
734 |
return $this->_brand;
|
735 |
}
|
736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
/**
|
738 |
* Returns the full product description,
|
739 |
* i.e. both the "short" and "normal" descriptions concatenated.
|
759 |
*/
|
760 |
public function getVariationId()
|
761 |
{
|
762 |
+
return $this->_variationId;
|
763 |
+
}
|
764 |
+
|
765 |
+
/**
|
766 |
+
* Fetches the value of a product attribute
|
767 |
+
*
|
768 |
+
* @param Mage_Catalog_Model_Product $product
|
769 |
+
* @param string $attributeName
|
770 |
+
* @return string
|
771 |
+
*/
|
772 |
+
protected function getAttributeValue(Mage_Catalog_Model_Product $product, $attributeName)
|
773 |
+
{
|
774 |
+
$attribute = $product->getResource()->getAttribute($attributeName);
|
775 |
+
if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
|
776 |
+
$attribute_data = $product->getData($attributeName);
|
777 |
+
/** @noinspection PhpParamsInspection */
|
778 |
+
$attribute_value = $product->getAttributeText($attributeName);
|
779 |
+
if (empty($attribute_value) && is_scalar($attribute_data)) {
|
780 |
+
$attribute_value = $attribute_data;
|
781 |
+
}
|
782 |
+
} else {
|
783 |
+
$attribute_value = null;
|
784 |
+
}
|
785 |
+
|
786 |
+
return trim($attribute_value);
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* @inheritdoc
|
791 |
+
*/
|
792 |
+
public function getSupplierCost()
|
793 |
+
{
|
794 |
+
return $this->_supplierCost;
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* @inheritdoc
|
799 |
+
*/
|
800 |
+
public function getInventoryLevel()
|
801 |
+
{
|
802 |
+
return $this->_inventoryLevel;
|
803 |
+
}
|
804 |
+
|
805 |
+
/**
|
806 |
+
* @inheritdoc
|
807 |
+
*/
|
808 |
+
public function getReviewCount()
|
809 |
+
{
|
810 |
+
return $this->_reviewCount;
|
811 |
+
}
|
812 |
+
|
813 |
+
/**
|
814 |
+
* @inheritdoc
|
815 |
+
*/
|
816 |
+
public function getRatingValue()
|
817 |
+
{
|
818 |
+
return $this->_ratingValue;
|
819 |
+
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* @inheritdoc
|
823 |
+
*/
|
824 |
+
public function getAlternateImageUrls()
|
825 |
+
{
|
826 |
+
return $this->_alternateImageUrls;
|
827 |
+
}
|
828 |
+
|
829 |
+
/**
|
830 |
+
* @inheritdoc
|
831 |
+
*/
|
832 |
+
public function getCondition()
|
833 |
+
{
|
834 |
+
return $this->_condition;
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* @inheritdoc
|
839 |
+
*/
|
840 |
+
public function getGender()
|
841 |
+
{
|
842 |
+
return $this->_gender;
|
843 |
+
}
|
844 |
+
|
845 |
+
/**
|
846 |
+
* @inheritdoc
|
847 |
+
*/
|
848 |
+
public function getAgeGroup()
|
849 |
+
{
|
850 |
+
return $this->_ageGroup;
|
851 |
+
}
|
852 |
+
|
853 |
+
/**
|
854 |
+
* @inheritdoc
|
855 |
+
*/
|
856 |
+
public function getGtin()
|
857 |
+
{
|
858 |
+
return $this->_gtin;
|
859 |
+
}
|
860 |
+
|
861 |
+
/**
|
862 |
+
* @inheritdoc
|
863 |
+
*/
|
864 |
+
public function getGoogleCategory()
|
865 |
+
{
|
866 |
+
return $this->_googleCategory;
|
867 |
+
}
|
868 |
+
|
869 |
+
/**
|
870 |
+
* @inheritdoc
|
871 |
+
*/
|
872 |
+
public function getUnitPricingMeasure()
|
873 |
+
{
|
874 |
+
return $this->_unitPricingMeasure;
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* @inheritdoc
|
879 |
+
*/
|
880 |
+
public function getUnitPricingBaseMeasure()
|
881 |
+
{
|
882 |
+
return $this->_unitPricingBaseMeasure;
|
883 |
+
}
|
884 |
+
|
885 |
+
/**
|
886 |
+
* @inheritdoc
|
887 |
+
*/
|
888 |
+
public function getUnitPricingUnit()
|
889 |
+
{
|
890 |
+
return $this->_unitPricingUnit;
|
891 |
+
}
|
892 |
+
|
893 |
+
public function addAlternateImage(array $image)
|
894 |
+
{
|
895 |
+
if (
|
896 |
+
isset($image['url'])
|
897 |
+
&& (isset($image['exclude']) && empty($image['exclude']))
|
898 |
+
&& !in_array($image['url'], $this->_alternateImageUrls)
|
899 |
+
&& $image['url'] != $this->_imageUrl
|
900 |
+
) {
|
901 |
+
$this->_alternateImageUrls[] = $image['url'];
|
902 |
+
}
|
903 |
}
|
904 |
}
|
app/code/community/Nosto/Tagging/Model/Meta/Rating.php
ADDED
@@ -0,0 +1,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:
|
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-2017 Nosto 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 |
+
* A class to load the ratings.
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
abstract class Nosto_Tagging_Model_Meta_Rating
|
36 |
+
implements Nosto_Tagging_Model_Meta_Rating_Interface
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* @var int
|
40 |
+
*/
|
41 |
+
protected $reviewCount;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var float
|
45 |
+
*/
|
46 |
+
protected $rating;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @inheritdoc
|
50 |
+
*/
|
51 |
+
public function getReviewCount()
|
52 |
+
{
|
53 |
+
return $this->reviewCount;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @inheritdoc
|
58 |
+
*/
|
59 |
+
public function setReviewCount($reviewCount)
|
60 |
+
{
|
61 |
+
$this->reviewCount = (int)$reviewCount;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @inheritdoc
|
66 |
+
*/
|
67 |
+
public function getRating()
|
68 |
+
{
|
69 |
+
return $this->rating;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @inheritdoc
|
74 |
+
*/
|
75 |
+
public function setRating($rating)
|
76 |
+
{
|
77 |
+
$this->rating = (float)$rating;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @inheritdoc
|
82 |
+
*/
|
83 |
+
abstract public function init(
|
84 |
+
Mage_Catalog_Model_Product $product,
|
85 |
+
Mage_Core_Model_Store $store
|
86 |
+
);
|
87 |
+
}
|
app/code/community/Nosto/Tagging/Model/Meta/Rating/Interface.php
ADDED
@@ -0,0 +1,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:
|
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-2017 Nosto 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 |
+
* Interface for rating model
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
interface Nosto_Tagging_Model_Meta_Rating_Interface
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* @return int
|
39 |
+
*/
|
40 |
+
public function getReviewCount();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param int $reviewCount
|
44 |
+
*/
|
45 |
+
public function setReviewCount($reviewCount);
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return float
|
49 |
+
*/
|
50 |
+
public function getRating();
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @param float $rating
|
54 |
+
*/
|
55 |
+
public function setRating($rating);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Populates rating and review count
|
59 |
+
*
|
60 |
+
* @param Mage_Catalog_Model_Product $product the product model.
|
61 |
+
* @param Mage_Core_Model_Store $store the store model.
|
62 |
+
*
|
63 |
+
*/
|
64 |
+
public function init(
|
65 |
+
Mage_Catalog_Model_Product $product,
|
66 |
+
Mage_Core_Model_Store $store
|
67 |
+
);
|
68 |
+
}
|
app/code/community/Nosto/Tagging/Model/Meta/Rating/Mage/Rating.php
ADDED
@@ -0,0 +1,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:
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Meta data class which holds information about an order.
|
30 |
+
* This is used during the order confirmation API request and the order
|
31 |
+
* history export.
|
32 |
+
*
|
33 |
+
* @category Nosto
|
34 |
+
* @package Nosto_Tagging
|
35 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
36 |
+
*/
|
37 |
+
class Nosto_Tagging_Model_Meta_Rating_Mage_Rating extends Nosto_Tagging_Model_Meta_Rating
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* @inheritdoc
|
41 |
+
*/
|
42 |
+
public function init(
|
43 |
+
Mage_Catalog_Model_Product $product,
|
44 |
+
Mage_Core_Model_Store $store
|
45 |
+
)
|
46 |
+
{
|
47 |
+
/* @var Mage_Rating_Model_Rating $review_summary */
|
48 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
49 |
+
$ratingSummary = Mage::getModel('review/review_summary')
|
50 |
+
->setStoreId($store->getId())
|
51 |
+
->load($product->getId());
|
52 |
+
if (
|
53 |
+
$ratingSummary instanceof Mage_Review_Model_Review_Summary
|
54 |
+
&& $ratingSummary->getRatingSummary()
|
55 |
+
) {
|
56 |
+
$this->setRating(
|
57 |
+
number_format(
|
58 |
+
round(
|
59 |
+
$ratingSummary->getRatingSummary()/20,
|
60 |
+
1
|
61 |
+
),
|
62 |
+
1
|
63 |
+
)
|
64 |
+
);
|
65 |
+
$this->setReviewCount($ratingSummary->getReviewsCount());
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Nosto/Tagging/Model/Meta/Rating/Yotpo/Yotpo.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Meta data class which holds information about an order.
|
30 |
+
* This is used during the order confirmation API request and the order
|
31 |
+
* history export.
|
32 |
+
*
|
33 |
+
* @category Nosto
|
34 |
+
* @package Nosto_Tagging
|
35 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
36 |
+
*/
|
37 |
+
class Nosto_Tagging_Model_Meta_Rating_Yotpo_Yotpo extends Nosto_Tagging_Model_Meta_Rating
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Keeps track if the product in Mage registry is changed
|
41 |
+
*
|
42 |
+
* @var Mage_Catalog_Model_Product|null
|
43 |
+
*/
|
44 |
+
protected $originalRegistryProduct;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The name of the registry entry for product
|
48 |
+
*/
|
49 |
+
const REGISTRY_PRODUCT = 'product';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @inheritdoc
|
53 |
+
*/
|
54 |
+
public function init(
|
55 |
+
Mage_Catalog_Model_Product $product,
|
56 |
+
Mage_Core_Model_Store $store
|
57 |
+
) {
|
58 |
+
try {
|
59 |
+
$this->setRegistryProduct($product);
|
60 |
+
/* @var Yotpo_Yotpo_Helper_RichSnippets $yotpoHelper */
|
61 |
+
$yotpoHelper = Mage::helper('yotpo/RichSnippets');
|
62 |
+
if ($yotpoHelper instanceof Yotpo_Yotpo_Helper_RichSnippets) {
|
63 |
+
$values = $yotpoHelper->getRichSnippet();
|
64 |
+
if (
|
65 |
+
is_array($values)
|
66 |
+
&& !empty($values['average_score'])
|
67 |
+
&& !empty($values['reviews_count'])
|
68 |
+
) {
|
69 |
+
$this->setRating($values['average_score']);
|
70 |
+
$this->setReviewCount($values['reviews_count']);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
} catch (Exception $e) {
|
74 |
+
Mage::log(
|
75 |
+
sprintf(
|
76 |
+
'Could not find Yotpo helper. Error was: %s',
|
77 |
+
$e->getMessage()
|
78 |
+
),
|
79 |
+
Zend_Log::ERR,
|
80 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
81 |
+
);
|
82 |
+
}
|
83 |
+
$this->resetRegistryProduct();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Sets product to Mage registry
|
88 |
+
*
|
89 |
+
* @param Mage_Catalog_Model_Product $product
|
90 |
+
*/
|
91 |
+
protected function setRegistryProduct(Mage_Catalog_Model_Product $product)
|
92 |
+
{
|
93 |
+
$this->originalRegistryProduct = Mage::registry(self::REGISTRY_PRODUCT);
|
94 |
+
Mage::unregister(self::REGISTRY_PRODUCT);
|
95 |
+
Mage::register(self::REGISTRY_PRODUCT, $product);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Resets the product to Mage registry
|
100 |
+
*/
|
101 |
+
protected function resetRegistryProduct()
|
102 |
+
{
|
103 |
+
Mage::unregister(self::REGISTRY_PRODUCT);
|
104 |
+
Mage::register(self::REGISTRY_PRODUCT, $this->originalRegistryProduct);
|
105 |
+
}
|
106 |
+
}
|
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-
|
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,45 +75,15 @@ 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
|
80 |
-
// is edited for only one store, the updated data can reflect in
|
81 |
-
// other stores as well.
|
82 |
-
foreach ($product->getStoreIds() as $storeId) {
|
83 |
-
$store = Mage::app()->getStore($storeId);
|
84 |
-
|
85 |
-
/** @var NostoAccount $account */
|
86 |
-
$account = Mage::helper('nosto_tagging/account')
|
87 |
-
->find($store);
|
88 |
-
if ($account === null || !$account->isConnectedToNosto()) {
|
89 |
-
continue;
|
90 |
-
}
|
91 |
-
|
92 |
-
// Load the product model for this particular store view.
|
93 |
-
$product = Mage::getModel('catalog/product')
|
94 |
-
->setStoreId($store->getId())
|
95 |
-
->load($product->getId());
|
96 |
-
if (is_null($product)) {
|
97 |
-
continue;
|
98 |
-
}
|
99 |
|
100 |
-
|
101 |
-
$
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
$validator = new NostoValidator($model);
|
107 |
-
if ($validator->validate()) {
|
108 |
-
try {
|
109 |
-
$op = new NostoOperationProduct($account);
|
110 |
-
$op->addProduct($model);
|
111 |
-
$op->upsert();
|
112 |
-
} catch (NostoException $e) {
|
113 |
-
Mage::log("\n" . $e, Zend_Log::ERR, 'nostotagging.log');
|
114 |
-
}
|
115 |
-
}
|
116 |
}
|
117 |
}
|
118 |
|
@@ -131,30 +102,33 @@ class Nosto_Tagging_Model_Observer
|
|
131 |
{
|
132 |
if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
|
133 |
/** @var Mage_Catalog_Model_Product $product */
|
|
|
134 |
$product = $observer->getEvent()->getProduct();
|
135 |
// Products are always deleted from all store views, regardless of
|
136 |
// the store view scope switcher on the product edit page.
|
137 |
/** @var Mage_Core_Model_Store $store */
|
138 |
foreach (Mage::app()->getStores() as $store) {
|
139 |
-
/** @var
|
140 |
-
$
|
141 |
-
|
142 |
|
143 |
if ($account === null || !$account->isConnectedToNosto()) {
|
144 |
continue;
|
145 |
}
|
146 |
-
|
|
|
|
|
147 |
/** @var Nosto_Tagging_Model_Meta_Product $model */
|
148 |
$model = Mage::getModel('nosto_tagging/meta_product');
|
149 |
$model->setProductId($product->getId());
|
150 |
-
|
151 |
try {
|
152 |
-
$
|
153 |
-
$
|
154 |
-
$
|
155 |
} catch (NostoException $e) {
|
156 |
-
Mage::log("\n" . $e, Zend_Log::ERR,
|
157 |
}
|
|
|
158 |
}
|
159 |
}
|
160 |
|
@@ -175,22 +149,139 @@ 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 |
-
|
180 |
-
$
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
->
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$
|
190 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
} catch (NostoException $e) {
|
193 |
-
Mage::log(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
}
|
196 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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 |
|
81 |
+
try {
|
82 |
+
/* @var Nosto_Tagging_Model_Service_Product $service */
|
83 |
+
$service = Mage::getModel('nosto_tagging/service_product');
|
84 |
+
$service->updateProduct($product);
|
85 |
+
} catch (NostoException $e) {
|
86 |
+
Mage::log("\n" . $e, Zend_Log::ERR, Nosto_Tagging_Model_Base::LOG_FILE_NAME);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
}
|
89 |
|
102 |
{
|
103 |
if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
|
104 |
/** @var Mage_Catalog_Model_Product $product */
|
105 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
106 |
$product = $observer->getEvent()->getProduct();
|
107 |
// Products are always deleted from all store views, regardless of
|
108 |
// the store view scope switcher on the product edit page.
|
109 |
/** @var Mage_Core_Model_Store $store */
|
110 |
foreach (Mage::app()->getStores() as $store) {
|
111 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
112 |
+
$helper = Mage::helper('nosto_tagging/account');
|
113 |
+
$account = $helper->find($store);
|
114 |
|
115 |
if ($account === null || !$account->isConnectedToNosto()) {
|
116 |
continue;
|
117 |
}
|
118 |
+
/* @var Mage_Core_Model_App_Emulation $emulation */
|
119 |
+
$emulation = Mage::getSingleton('core/app_emulation');
|
120 |
+
$env = $emulation->startEnvironmentEmulation($store->getId());
|
121 |
/** @var Nosto_Tagging_Model_Meta_Product $model */
|
122 |
$model = Mage::getModel('nosto_tagging/meta_product');
|
123 |
$model->setProductId($product->getId());
|
|
|
124 |
try {
|
125 |
+
$service = new NostoOperationProduct($account);
|
126 |
+
$service->addProduct($model);
|
127 |
+
$service->delete();
|
128 |
} catch (NostoException $e) {
|
129 |
+
Mage::log("\n" . $e, Zend_Log::ERR, Nosto_Tagging_Model_Base::LOG_FILE_NAME);
|
130 |
}
|
131 |
+
$emulation->stopEnvironmentEmulation($env);
|
132 |
}
|
133 |
}
|
134 |
|
149 |
if (Mage::helper('nosto_tagging')->isModuleEnabled()) {
|
150 |
try {
|
151 |
/** @var Mage_Sales_Model_Order $mageOrder */
|
152 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
153 |
$mageOrder = $observer->getEvent()->getOrder();
|
154 |
+
|
155 |
+
if ($mageOrder instanceof Mage_Sales_Model_Order) {
|
156 |
+
/** @var Nosto_Tagging_Helper_Class $helper */
|
157 |
+
$helper = Mage::helper('nosto_tagging/class');
|
158 |
+
/** @var Nosto_Tagging_Model_Meta_Order $order */
|
159 |
+
$order = $helper->getOrderClass($mageOrder);
|
160 |
+
$order->loadData($mageOrder);
|
161 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
162 |
+
$helper = Mage::helper('nosto_tagging/account');
|
163 |
+
$account = $helper->find($mageOrder->getStore());
|
164 |
+
/** @var Nosto_Tagging_Helper_Customer $helper */
|
165 |
+
$helper = Mage::helper('nosto_tagging/customer');
|
166 |
+
$customerId = $helper->getNostoId($mageOrder);
|
167 |
+
if ($account !== null && $account->isConnectedToNosto()) {
|
168 |
+
/** @var Nosto_Tagging_Model_Service_Order $service */
|
169 |
+
$service = Mage::getModel('nosto_tagging/service_order');
|
170 |
+
$service->confirm($order, $account, $customerId);
|
171 |
+
}
|
172 |
}
|
173 |
} catch (NostoException $e) {
|
174 |
+
Mage::log(
|
175 |
+
"\n" . $e->__toString(),
|
176 |
+
Zend_Log::ERR,
|
177 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
178 |
+
);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
return $this;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Cron job for syncing currency exchange rates to Nosto.
|
187 |
+
* Only stores that have the scheduled update enabled, have more currencies
|
188 |
+
* than the default one defined and has a Nosto account are synced.
|
189 |
+
*
|
190 |
+
* @throws Mage_Cron_Exception
|
191 |
+
*/
|
192 |
+
public function scheduledCurrencyExchangeRateUpdate()
|
193 |
+
{
|
194 |
+
/** @var Nosto_Tagging_Helper_Data $helper */
|
195 |
+
$helper = Mage::helper('nosto_tagging');
|
196 |
+
if ($helper->isModuleEnabled()) {
|
197 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
198 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
199 |
+
$error = false;
|
200 |
+
foreach (Mage::app()->getStores() as $store) {
|
201 |
+
/** @var Mage_Core_Model_Store $store */
|
202 |
+
if (
|
203 |
+
!$helper->isScheduledCurrencyExchangeRateUpdateEnabled($store)
|
204 |
+
|| !$helper->isMultiCurrencyMethodExchangeRate($store)
|
205 |
+
) {
|
206 |
+
continue;
|
207 |
+
}
|
208 |
+
$account = $accountHelper->find($store);
|
209 |
+
if (is_null($account)) {
|
210 |
+
continue;
|
211 |
+
}
|
212 |
+
if (!$accountHelper->updateCurrencyExchangeRates($account, $store)) {
|
213 |
+
$error = true;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
if ($error) {
|
217 |
+
throw Mage::exception(
|
218 |
+
'Mage_Cron',
|
219 |
+
sprintf(
|
220 |
+
'There was an error updating the exchange rates. More info in "%".',
|
221 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
222 |
+
)
|
223 |
+
);
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Updates / synchronizes Nosto account settings via API to Nosto
|
230 |
+
* for each store that has Nosto account.
|
231 |
+
*
|
232 |
+
* Event 'admin_system_config_changed_section_nosto_tagging'.
|
233 |
+
*
|
234 |
+
* @param Varien_Event_Observer $observer
|
235 |
+
*
|
236 |
+
* @return Nosto_Tagging_Model_Observer
|
237 |
+
*/
|
238 |
+
public function syncNostoAccount(/** @noinspection PhpUnusedParameterInspection */
|
239 |
+
Varien_Event_Observer $observer)
|
240 |
+
{
|
241 |
+
/** @var Nosto_Tagging_Helper_Data $helper */
|
242 |
+
$helper = Mage::helper('nosto_tagging');
|
243 |
+
if ($helper->isModuleEnabled()) {
|
244 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
245 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
246 |
+
/** @var Mage_Core_Model_Store $store */
|
247 |
+
foreach (Mage::app()->getStores() as $store) {
|
248 |
+
$account = $accountHelper->find($store);
|
249 |
+
if ($account instanceof NostoAccount === false) {
|
250 |
+
continue;
|
251 |
+
}
|
252 |
+
/* @var Mage_Core_Model_App_Emulation $emulation */
|
253 |
+
$emulation = Mage::getSingleton('core/app_emulation');
|
254 |
+
$env = $emulation->startEnvironmentEmulation($store->getId());
|
255 |
+
if (!$accountHelper->updateAccount($account, $store)) {
|
256 |
+
Mage::log(
|
257 |
+
sprintf(
|
258 |
+
'Failed sync account #%s for store #%s in class %s',
|
259 |
+
$account->getName(),
|
260 |
+
$store->getName(),
|
261 |
+
__CLASS__
|
262 |
+
),
|
263 |
+
Zend_Log::WARN,
|
264 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
265 |
+
);
|
266 |
+
}
|
267 |
+
if ($helper->isMultiCurrencyMethodExchangeRate($store)) {
|
268 |
+
if (!$accountHelper->updateCurrencyExchangeRates(
|
269 |
+
$account, $store
|
270 |
+
)
|
271 |
+
) {
|
272 |
+
Mage::log(
|
273 |
+
sprintf(
|
274 |
+
'Failed sync currency rates #%s for store #%s in class %s',
|
275 |
+
$account->getName(),
|
276 |
+
$store->getName(),
|
277 |
+
__CLASS__
|
278 |
+
),
|
279 |
+
Zend_Log::WARN,
|
280 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
281 |
+
);
|
282 |
+
}
|
283 |
+
}
|
284 |
+
$emulation->stopEnvironmentEmulation($env);
|
285 |
}
|
286 |
}
|
287 |
|
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-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
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-2017 Nosto 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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -37,7 +37,15 @@
|
|
37 |
class Nosto_Tagging_Model_Service_Order
|
38 |
{
|
39 |
/**
|
40 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
*
|
42 |
* @param Nosto_Tagging_Model_Meta_Order $order the order to confirm.
|
43 |
* @param NostoAccount $account the Nosto account object.
|
@@ -52,9 +60,60 @@ class Nosto_Tagging_Model_Service_Order
|
|
52 |
if ($response->getCode() !== 200) {
|
53 |
Nosto::throwHttpException('Failed to send order confirmation to Nosto.', $request, $response);
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
return true;
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* Builds the API request and returns it.
|
60 |
*
|
@@ -84,11 +143,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' =>
|
92 |
'payment_provider' => $order->getPaymentProvider(),
|
93 |
'purchased_items' => array(),
|
94 |
);
|
@@ -96,12 +157,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' =>
|
105 |
'price_currency_code' => strtoupper($item->getCurrencyCode()),
|
106 |
);
|
107 |
}
|
@@ -116,6 +179,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-2017 Nosto 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 |
class Nosto_Tagging_Model_Service_Order
|
38 |
{
|
39 |
/**
|
40 |
+
* Flag for disabling inventory sync for slow connections
|
41 |
+
*
|
42 |
+
* @var bool
|
43 |
+
*/
|
44 |
+
public static $syncInventoriesAfterOrder = true;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Sends an order confirmation to Nosto and also batch updates all products
|
48 |
+
* that were included in the order.
|
49 |
*
|
50 |
* @param Nosto_Tagging_Model_Meta_Order $order the order to confirm.
|
51 |
* @param NostoAccount $account the Nosto account object.
|
60 |
if ($response->getCode() !== 200) {
|
61 |
Nosto::throwHttpException('Failed to send order confirmation to Nosto.', $request, $response);
|
62 |
}
|
63 |
+
|
64 |
+
try {
|
65 |
+
$this->syncInventoryLevel($order);
|
66 |
+
} catch (NostoException $e) {
|
67 |
+
Mage::log(
|
68 |
+
sprintf(
|
69 |
+
'Failed to sync inventory level to Nosto. Error was %s',
|
70 |
+
$e->getMessage()
|
71 |
+
),
|
72 |
+
Zend_Log::ERR,
|
73 |
+
Nosto_Tagging_Model_Base::LOG_FILE_NAME
|
74 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
return true;
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Sends product updates to Nosto to keep up with the inventory level
|
82 |
+
*
|
83 |
+
* @param Nosto_Tagging_Model_Meta_Order $order
|
84 |
+
*/
|
85 |
+
public function syncInventoryLevel(Nosto_Tagging_Model_Meta_Order $order)
|
86 |
+
{
|
87 |
+
if (self::$syncInventoriesAfterOrder === true) {
|
88 |
+
$purchasedItems = $order->getPurchasedItems();
|
89 |
+
$productIds = array();
|
90 |
+
/* @var Nosto_Tagging_Model_Meta_Order_Item $item */
|
91 |
+
foreach ($purchasedItems as $item) {
|
92 |
+
$productId = $item->getProductId();
|
93 |
+
if (empty($productId) || $productId < 0) {
|
94 |
+
continue;
|
95 |
+
}
|
96 |
+
$productIds[] = $productId;
|
97 |
+
}
|
98 |
+
if (count($productIds) > 0) {
|
99 |
+
/* @var Nosto_Tagging_Model_Resource_Product_Collection $productIds*/
|
100 |
+
$products= Mage::getModel('nosto_tagging/product')
|
101 |
+
->getCollection()
|
102 |
+
->addAttributeToSelect('*')
|
103 |
+
->addIdFilter($productIds);
|
104 |
+
|
105 |
+
if(
|
106 |
+
$products instanceof Nosto_Tagging_Model_Resource_Product_Collection
|
107 |
+
&& count($products) > 0
|
108 |
+
) {
|
109 |
+
/* @var Nosto_Tagging_Model_Service_Product $productService */
|
110 |
+
$productService = Mage::getModel('nosto_tagging/service_product');
|
111 |
+
$productService->updateBatch($products);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
/**
|
118 |
* Builds the API request and returns it.
|
119 |
*
|
143 |
*/
|
144 |
protected function getOrderAsJson(Nosto_Tagging_Model_Meta_Order $order)
|
145 |
{
|
146 |
+
/** @var NostoHelperDate $dateHelper */
|
147 |
+
$dateHelper = Nosto::helper('date');
|
148 |
$data = array(
|
149 |
'order_number' => $order->getOrderNumber(),
|
150 |
'external_order_ref' => $order->getExternalOrderRef(),
|
151 |
'buyer' => array(),
|
152 |
+
'created_at' => $dateHelper->format($order->getCreatedDate()),
|
153 |
'payment_provider' => $order->getPaymentProvider(),
|
154 |
'purchased_items' => array(),
|
155 |
);
|
157 |
$data['order_status_code'] = $order->getOrderStatus()->getCode();
|
158 |
$data['order_status_label'] = $order->getOrderStatus()->getLabel();
|
159 |
}
|
160 |
+
/** @var NostoHelperPrice $priceHelper */
|
161 |
+
$priceHelper = Nosto::helper('price');
|
162 |
foreach ($order->getPurchasedItems() as $item) {
|
163 |
$data['purchased_items'][] = array(
|
164 |
'product_id' => $item->getProductId(),
|
165 |
'quantity' => $item->getQuantity(),
|
166 |
'name' => $item->getName(),
|
167 |
+
'unit_price' => $priceHelper->format($item->getUnitPrice()),
|
168 |
'price_currency_code' => strtoupper($item->getCurrencyCode()),
|
169 |
);
|
170 |
}
|
179 |
$data['buyer']['email'] = $order->getBuyerInfo()->getEmail();
|
180 |
}
|
181 |
}
|
182 |
+
|
183 |
return json_encode($data);
|
184 |
}
|
185 |
}
|
app/code/community/Nosto/Tagging/Model/Service/Product.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 |
+
* Handles sending product updates to Nosto via the API.
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
class Nosto_Tagging_Model_Service_Product
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Maximum batch size. If exceeded the batches will be splitted into smaller
|
36 |
+
* ones.
|
37 |
+
*
|
38 |
+
* @var int
|
39 |
+
*/
|
40 |
+
public static $maxBatchSize = 500;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Max time to wait for Nosto's API response
|
44 |
+
*
|
45 |
+
* @var int
|
46 |
+
*/
|
47 |
+
public static $apiWaitTimeout = 60;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Sends a product update to Nosto for all stores and installed Nosto
|
51 |
+
* accounts
|
52 |
+
*
|
53 |
+
* @param Mage_Catalog_Model_Product[] $products
|
54 |
+
* @return bool
|
55 |
+
* @throws NostoException
|
56 |
+
*/
|
57 |
+
protected function update(array $products)
|
58 |
+
{
|
59 |
+
NostoHttpRequest::$responseTimeout = self::$apiWaitTimeout;
|
60 |
+
$productsInStore = array();
|
61 |
+
$counter = 0;
|
62 |
+
$batch = 1;
|
63 |
+
foreach ($products as $product) {
|
64 |
+
if ($counter > 0 && $counter % self::$maxBatchSize === 0) {
|
65 |
+
++$batch;
|
66 |
+
}
|
67 |
+
++$counter;
|
68 |
+
if ($product instanceof Mage_Catalog_Model_Product === false) {
|
69 |
+
Nosto::throwException(
|
70 |
+
sprintf(
|
71 |
+
'Invalid data type, expecting Mage_Catalog_Model_Product' .
|
72 |
+
', got %s',
|
73 |
+
get_class($product)
|
74 |
+
)
|
75 |
+
);
|
76 |
+
}
|
77 |
+
foreach ($product->getStoreIds() as $storeId) {
|
78 |
+
if (!isset($productsInStore[$storeId])) {
|
79 |
+
$productsInStore[$storeId] = array();
|
80 |
+
}
|
81 |
+
if (!isset($productsInStore[$storeId][$batch])) {
|
82 |
+
$productsInStore[$storeId][$batch] = array();
|
83 |
+
}
|
84 |
+
$productsInStore[$storeId][$batch][] = $product;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
foreach ($productsInStore as $storeId => $productBatches) {
|
88 |
+
$store = Mage::app()->getStore($storeId);
|
89 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
90 |
+
$helper = Mage::helper('nosto_tagging/account');
|
91 |
+
$account = $helper->find($store);
|
92 |
+
/* @var $nostoHelper Nosto_Tagging_Helper_Data */
|
93 |
+
$nostoHelper = Mage::helper('nosto_tagging');
|
94 |
+
if (
|
95 |
+
$account === null
|
96 |
+
|| !$account->isConnectedToNosto()
|
97 |
+
|| !$nostoHelper->getUseProductApi($store)
|
98 |
+
) {
|
99 |
+
continue;
|
100 |
+
}
|
101 |
+
/* @var Mage_Core_Model_App_Emulation $emulation */
|
102 |
+
$emulation = Mage::getSingleton('core/app_emulation');
|
103 |
+
$env = $emulation->startEnvironmentEmulation($store->getId());
|
104 |
+
foreach ($productBatches as $productsInStore) {
|
105 |
+
$service = new NostoOperationProduct($account);
|
106 |
+
foreach ($productsInStore as $mageProduct) {
|
107 |
+
/** @var Nosto_Tagging_Model_Meta_Product $nostoProduct */
|
108 |
+
$nostoProduct = Mage::getModel('nosto_tagging/meta_product');
|
109 |
+
$nostoProduct->loadData($mageProduct, $store);
|
110 |
+
$service->addProduct($nostoProduct);
|
111 |
+
}
|
112 |
+
$service->upsert();
|
113 |
+
}
|
114 |
+
$emulation->stopEnvironmentEmulation($env);
|
115 |
+
}
|
116 |
+
|
117 |
+
return true;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Updates a batch of products to Nosto
|
122 |
+
*
|
123 |
+
* @param Nosto_Tagging_Model_Resource_Product_Collection $products
|
124 |
+
* @return true
|
125 |
+
*/
|
126 |
+
public function updateBatch(Nosto_Tagging_Model_Resource_Product_Collection $products)
|
127 |
+
{
|
128 |
+
$productsArray = iterator_to_array($products);
|
129 |
+
return $this->update($productsArray);
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Updates single product to Nosto
|
134 |
+
*
|
135 |
+
* @param Mage_Catalog_Model_Product $product
|
136 |
+
* @return true
|
137 |
+
*/
|
138 |
+
public function updateProduct(Mage_Catalog_Model_Product $product)
|
139 |
+
{
|
140 |
+
return $this->update(array($product));
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
app/code/community/Nosto/Tagging/Model/System/Config/Backend/Currency/Exchange/Rate/Cron.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Extension system setting backend model for saving the scheduled currency
|
30 |
+
* exchange rate frequency, e.g. turns the setting into valid cron syntax.
|
31 |
+
*
|
32 |
+
* @category Nosto
|
33 |
+
* @package Nosto_Tagging
|
34 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
35 |
+
*/
|
36 |
+
class Nosto_Tagging_Model_System_Config_Backend_Currency_Exchange_Rate_Cron extends Mage_Core_Model_Config_Data
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Path to the cron expression.
|
40 |
+
*/
|
41 |
+
const CRON_STRING_PATH = 'crontab/jobs/nostotagging_currency_exchange_rate_update/schedule/cron_expr';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Generates the cron configuration for updating exchange rates update to
|
45 |
+
* Nosto.
|
46 |
+
*
|
47 |
+
* Note that if cron is ran Hourly the hour field is not posted at all
|
48 |
+
* as the hour selector gets disabled when frequency is set to hourly
|
49 |
+
*
|
50 |
+
* @inheritdoc
|
51 |
+
*/
|
52 |
+
protected function _afterSave()
|
53 |
+
{
|
54 |
+
$time = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/time/value');
|
55 |
+
$frequency = $this->getData('groups/scheduled_currency_exchange_rate_update/fields/frequency/value');
|
56 |
+
|
57 |
+
$weekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
|
58 |
+
$monthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
|
59 |
+
$hourly = Nosto_Tagging_Model_System_Config_Source_Cron_Frequency::CRON_HOURLY;
|
60 |
+
$cronExpr = implode(
|
61 |
+
' ',
|
62 |
+
array(
|
63 |
+
($frequency === $hourly) ? (int)$time[0] : (int)$time[1], # Minute
|
64 |
+
($frequency === $hourly) ? '*' : (int)$time[0], # Hour
|
65 |
+
($frequency === $monthly) ? '1' : '*', # Day of the Month
|
66 |
+
'*', # Month of the Year
|
67 |
+
($frequency === $weekly) ? '1' : '*', # Day of the Week
|
68 |
+
)
|
69 |
+
);
|
70 |
+
|
71 |
+
try {
|
72 |
+
/** @var Mage_Core_Model_Config_Data $model */
|
73 |
+
$model = Mage::getModel('core/config_data');
|
74 |
+
$model = $model->load(self::CRON_STRING_PATH, 'path');
|
75 |
+
$model = $model->setValue($cronExpr);
|
76 |
+
$model = $model->setPath(self::CRON_STRING_PATH);
|
77 |
+
$model->save();
|
78 |
+
} catch (Exception $e) {
|
79 |
+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Nosto/Tagging/Model/System/Config/Source/Attribute.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 |
+
* Abstract source model class for product attributes
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
abstract class Nosto_Tagging_Model_System_Config_Source_Attribute
|
36 |
+
{
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var int the product attribute type id
|
40 |
+
*/
|
41 |
+
const PRODUCT_TYPE_ATTRIBUTE_ID = 4;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string the form key for the value
|
45 |
+
*/
|
46 |
+
const OPTION_KEY_VALUE = 'value';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var string the form key for the label
|
50 |
+
*/
|
51 |
+
const OPTION_KEY_LABEL = 'label';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns all available product attributes
|
55 |
+
*
|
56 |
+
* @param array $filters ['field_to_filter' => 'value']
|
57 |
+
* @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
|
58 |
+
*/
|
59 |
+
public function getProductAttributesCollection(array $filters=array())
|
60 |
+
{
|
61 |
+
$resourceModel = Mage::getResourceModel(
|
62 |
+
'catalog/product_attribute_collection'
|
63 |
+
);
|
64 |
+
|
65 |
+
if (is_array($filters) && !empty($filters)) {
|
66 |
+
foreach ($filters as $attribute => $value) {
|
67 |
+
$resourceModel->addFieldToFilter(
|
68 |
+
$attribute,
|
69 |
+
$value
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
$attributes = $resourceModel
|
74 |
+
->addFieldToFilter(
|
75 |
+
'entity_type_id',
|
76 |
+
self::PRODUCT_TYPE_ATTRIBUTE_ID
|
77 |
+
)
|
78 |
+
->setOrder(
|
79 |
+
'attribute_code',
|
80 |
+
Varien_Data_Collection::SORT_ORDER_ASC
|
81 |
+
);
|
82 |
+
|
83 |
+
return $attributes;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* List of attributes that cannot be added to tags due to data type and
|
88 |
+
* Magento's internal processing of attributes
|
89 |
+
*
|
90 |
+
* @var array
|
91 |
+
*/
|
92 |
+
public static $notValidCustomAttributes = array(
|
93 |
+
'group_price',
|
94 |
+
'tier_price',
|
95 |
+
'media_gallery',
|
96 |
+
);
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Returns all available attributes
|
100 |
+
*
|
101 |
+
* @return array the options.
|
102 |
+
*/
|
103 |
+
public function toOptionArray()
|
104 |
+
{
|
105 |
+
$attributes = $this->getProductAttributes();
|
106 |
+
$attributeArray = array(
|
107 |
+
array(
|
108 |
+
self::OPTION_KEY_VALUE => 0,
|
109 |
+
self::OPTION_KEY_LABEL => 'None'
|
110 |
+
)
|
111 |
+
);
|
112 |
+
foreach($attributes as $attribute) {
|
113 |
+
$code = $attribute->getData('attribute_code');
|
114 |
+
if (in_array($code, self::$notValidCustomAttributes)) {
|
115 |
+
continue;
|
116 |
+
}
|
117 |
+
$label = $attribute->getData('frontend_label');
|
118 |
+
$attributeArray[] = array(
|
119 |
+
self::OPTION_KEY_VALUE => $code,
|
120 |
+
self::OPTION_KEY_LABEL => sprintf('%s (%s)', $code, $label)
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return $attributeArray;
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Returns a collection of attributes defined by the child class
|
130 |
+
*
|
131 |
+
* @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
|
132 |
+
*/
|
133 |
+
abstract public function getProductAttributes();
|
134 |
+
}
|
app/code/community/Nosto/Tagging/Model/System/Config/Source/Cron/Frequency.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Extends system setting source model for choosing exchange cron frequency
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Model_System_Config_Source_Cron_Frequency extends Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency
|
36 |
+
{
|
37 |
+
const CRON_HOURLY = 'H';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Returns the frequency options
|
41 |
+
*
|
42 |
+
* @return array the options.
|
43 |
+
*/
|
44 |
+
public function toOptionArray()
|
45 |
+
{
|
46 |
+
$options = parent::toOptionArray();
|
47 |
+
if (empty($options[self::CRON_HOURLY])) {
|
48 |
+
array_unshift(
|
49 |
+
$options,
|
50 |
+
array(
|
51 |
+
'label' => Mage::helper('cron')->__('Hourly'),
|
52 |
+
'value' => self::CRON_HOURLY,
|
53 |
+
)
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
return $options;
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Nosto/Tagging/Model/System/Config/Source/Custom/Tags.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Extension system setting source model for choosing which attributes should
|
30 |
+
* be added to tags
|
31 |
+
*
|
32 |
+
* @category Nosto
|
33 |
+
* @package Nosto_Tagging
|
34 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
35 |
+
*/
|
36 |
+
class Nosto_Tagging_Model_System_Config_Source_Custom_Tags
|
37 |
+
extends Nosto_Tagging_Model_System_Config_Source_Attribute
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* @inheritdoc
|
41 |
+
*/
|
42 |
+
public function getProductAttributes()
|
43 |
+
{
|
44 |
+
return parent::getProductAttributesCollection();
|
45 |
+
}
|
46 |
+
}
|
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-
|
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 |
-
|
|
|
|
|
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 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
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-2017 Nosto 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-2017 Nosto 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/Model/System/Config/Source/Price/Attribute.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-2017 Nosto 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 |
+
* Source model available product price attributes
|
30 |
+
*
|
31 |
+
* @category Nosto
|
32 |
+
* @package Nosto_Tagging
|
33 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
+
*/
|
35 |
+
class Nosto_Tagging_Model_System_Config_Source_Price_Attribute
|
36 |
+
extends Nosto_Tagging_Model_System_Config_Source_Attribute
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* EAV field name for input type
|
40 |
+
*/
|
41 |
+
const EAV_FRONTEND_INPUT_FIELD = 'frontend_input';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* EAV input type for prices
|
45 |
+
*/
|
46 |
+
const EAV_PRICE_INPUT = 'price';
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @inheritdoc
|
51 |
+
*/
|
52 |
+
public function getProductAttributes()
|
53 |
+
{
|
54 |
+
return parent::getProductAttributesCollection(
|
55 |
+
array(
|
56 |
+
self::EAV_FRONTEND_INPUT_FIELD => self::EAV_PRICE_INPUT
|
57 |
+
)
|
58 |
+
);
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Nosto/Tagging/{Block/Adminhtml/Wizard.php → Model/System/Config/Source/Product/Attribute.php}
RENAMED
@@ -21,18 +21,25 @@
|
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
-
* Adds the 'wizard' markup for creating and managing Nosto accounts.
|
31 |
*
|
32 |
* @category Nosto
|
33 |
* @package Nosto_Tagging
|
34 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
35 |
*/
|
36 |
-
class
|
|
|
37 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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 |
+
* Source model for all available product attributes
|
|
|
30 |
*
|
31 |
* @category Nosto
|
32 |
* @package Nosto_Tagging
|
33 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
34 |
*/
|
35 |
+
class Nosto_Tagging_Model_System_Config_Source_Product_Attribute
|
36 |
+
extends Nosto_Tagging_Model_System_Config_Source_Attribute
|
37 |
{
|
38 |
+
/**
|
39 |
+
* @inheritdoc
|
40 |
+
*/
|
41 |
+
public function getProductAttributes()
|
42 |
+
{
|
43 |
+
return parent::getProductAttributesCollection();
|
44 |
+
}
|
45 |
}
|
app/code/community/Nosto/Tagging/Model/System/Config/Source/Ratings/Provider.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* 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-2017 Nosto 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 |
+
use Nosto_Tagging_Helper_Rating as RatingHelper;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Extension system setting source model for choosing which attributes should
|
32 |
+
* be added to tags
|
33 |
+
*
|
34 |
+
* @category Nosto
|
35 |
+
* @package Nosto_Tagging
|
36 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
37 |
+
*/
|
38 |
+
class Nosto_Tagging_Model_System_Config_Source_Ratings_Provider
|
39 |
+
{
|
40 |
+
/**
|
41 |
+
* Returns all available product attributes
|
42 |
+
*
|
43 |
+
* @return array the options.
|
44 |
+
*/
|
45 |
+
public function toOptionArray()
|
46 |
+
{
|
47 |
+
/* @var Nosto_Tagging_Helper_Rating $nostoHelperRatings */
|
48 |
+
$nostoHelperRatings = Mage::helper('nosto_tagging/rating');
|
49 |
+
$ratingProviders = $nostoHelperRatings->getActiveRatingProviders();
|
50 |
+
$options = array(
|
51 |
+
array(
|
52 |
+
'value' => 0,
|
53 |
+
'label' => 'Not in use'
|
54 |
+
)
|
55 |
+
);
|
56 |
+
foreach ($ratingProviders as $key=>$ratingProvider) {
|
57 |
+
$option = array(
|
58 |
+
'value' => $key,
|
59 |
+
'label' => $ratingProvider[RatingHelper::FIELD_DESCRIPTION]
|
60 |
+
);
|
61 |
+
$options[] = $option;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $options;
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Nosto/Tagging/bootstrap.php
CHANGED
@@ -1,38 +1,31 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
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-2017 Nosto 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-
|
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 |
-
|
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,18 @@ 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 +233,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 +329,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 +461,8 @@ class Nosto_Tagging_Adminhtml_NostoController extends Mage_Adminhtml_Controller_
|
|
259 |
*/
|
260 |
protected function _isAllowed()
|
261 |
{
|
262 |
-
|
|
|
|
|
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-2017 Nosto 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);
|
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 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
192 |
$meta->getOwner()->setEmail($email);
|
193 |
}
|
194 |
+
if (!empty($details)) {
|
195 |
+
$meta->setDetails(json_decode($details));
|
196 |
+
}
|
197 |
$account = NostoAccount::create($meta);
|
198 |
if ($accountHelper->save($account, $store)) {
|
199 |
+
$accountHelper->updateCurrencyExchangeRates($account, $store);
|
200 |
$responseBody = array(
|
201 |
'success' => true,
|
202 |
'redirect_url' => $accountHelper->getIframeUrl(
|
233 |
$this->getResponse()->setBody(json_encode($responseBody));
|
234 |
}
|
235 |
|
236 |
+
/**
|
237 |
+
* Resets Nosto settings inside Magento
|
238 |
+
*/
|
239 |
+
public function resetAccountSettingsAction()
|
240 |
+
{
|
241 |
+
$storeId = $this->getRequest()->getParam('store');
|
242 |
+
/* @var $adminSession Mage_Admin_Model_Session */
|
243 |
+
$adminSession = Mage::getSingleton('adminhtml/session');
|
244 |
+
if (empty($storeId)) {
|
245 |
+
$adminSession->addError(
|
246 |
+
'Nosto account could not be resetted due to a missing store'
|
247 |
+
);
|
248 |
+
$this->_redirect('*/*/index');
|
249 |
+
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
|
253 |
+
/* @var Nosto_Tagging_Helper_Account $accountHelper */
|
254 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
255 |
+
/* @var $store Mage_Core_Model_Store */
|
256 |
+
$store = Mage::getModel('core/store')->load($storeId);
|
257 |
+
if ($store instanceof Mage_Core_Model_Store === false ) {
|
258 |
+
$adminSession->addError(
|
259 |
+
'Nosto account could not be resetted due to a invalid store id'
|
260 |
+
);
|
261 |
+
$this->_redirect('*/*/index');
|
262 |
+
|
263 |
+
return;
|
264 |
+
}
|
265 |
+
$nostoAccount = $accountHelper->find($store);
|
266 |
+
if ($nostoAccount instanceof NostoAccount == false) {
|
267 |
+
$adminSession->addError(
|
268 |
+
'No Nosto account found for this store'
|
269 |
+
);
|
270 |
+
$this->_redirect('*/*/index');
|
271 |
+
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
|
275 |
+
$accountHelper->resetAccountSettings($nostoAccount, $store);
|
276 |
+
$adminSession->addSuccess(
|
277 |
+
'Nosto account settings successfully resetted. Please create new account or connect with existing Nosto account'
|
278 |
+
);
|
279 |
+
$this->_redirect(
|
280 |
+
'adminhtml/nosto/index/',
|
281 |
+
array('store'=>$store->getId())
|
282 |
+
);
|
283 |
+
|
284 |
+
return;
|
285 |
+
}
|
286 |
+
|
287 |
/**
|
288 |
* Removes a Nosto account from the current scope and notifies Nosto.
|
289 |
*/
|
329 |
$this->getResponse()->setBody(json_encode($responseBody));
|
330 |
}
|
331 |
|
332 |
+
/**
|
333 |
+
* Ajax action for updating the currency exchange rates.
|
334 |
+
*
|
335 |
+
* Used from the extension system configuration page.
|
336 |
+
* Checks if any stores support multi currency before trying to update the
|
337 |
+
* exchange rate for each store/account.
|
338 |
+
*/
|
339 |
+
public function ajaxUpdateExchangeRatesAction()
|
340 |
+
{
|
341 |
+
$this->getResponse()->setHeader('Content-type', 'application/json', true);
|
342 |
+
$responseBody = array('success' => true, 'data' => array());
|
343 |
+
/** @var Nosto_Tagging_Helper_Data $helper */
|
344 |
+
$helper = Mage::helper('nosto_tagging');
|
345 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
346 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
347 |
+
/** @var Mage_Core_Model_Store[] $stores */
|
348 |
+
$storeId = $this->getRequest()->getParam('store');
|
349 |
+
if (!empty($storeId)) {
|
350 |
+
$stores = array(Mage::app()->getStore($storeId));
|
351 |
+
} else {
|
352 |
+
$stores = Mage::app()->getStores();
|
353 |
+
}
|
354 |
+
$countStores = count($stores);
|
355 |
+
$countStoresWithoutMultiCurrency = 0;
|
356 |
+
foreach ($stores as $store) {
|
357 |
+
if (!$helper->isMultiCurrencyMethodExchangeRate($store)) {
|
358 |
+
$countStoresWithoutMultiCurrency++;
|
359 |
+
continue;
|
360 |
+
}
|
361 |
+
$account = $accountHelper->find($store);
|
362 |
+
if (is_null($account)) {
|
363 |
+
continue;
|
364 |
+
}
|
365 |
+
if ($accountHelper->updateCurrencyExchangeRates($account, $store)) {
|
366 |
+
$responseBody['data'][] = array(
|
367 |
+
'type' => 'success',
|
368 |
+
'message' => $helper->__(sprintf("The exchange rates have been updated for the %s store.", $store->getName()))
|
369 |
+
);
|
370 |
+
} else {
|
371 |
+
$responseBody['data'][] = array(
|
372 |
+
'type' => 'error',
|
373 |
+
'message' => $helper->__(sprintf("There was an error updating the exchange rates for the %s store.", $store->getName()))
|
374 |
+
);
|
375 |
+
}
|
376 |
+
}
|
377 |
+
if ($countStores === $countStoresWithoutMultiCurrency) {
|
378 |
+
$responseBody['data'][] = array(
|
379 |
+
'type' => 'error',
|
380 |
+
'message' => $helper->__("Failed to find any stores in the current scope with other currencies than the base currency configured.")
|
381 |
+
);
|
382 |
+
} elseif (empty($responseBody['data'])) {
|
383 |
+
$responseBody['data'][] = array(
|
384 |
+
'type' => 'error',
|
385 |
+
'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.")
|
386 |
+
);
|
387 |
+
}
|
388 |
+
$this->getResponse()->setBody(json_encode($responseBody));
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Ajax action for updating a Nosto account.
|
393 |
+
*
|
394 |
+
* Used from the extension system configuration page.
|
395 |
+
* Checks the scope of the update on a store/website/global level.
|
396 |
+
*/
|
397 |
+
public function ajaxUpdateAccountAction()
|
398 |
+
{
|
399 |
+
$this->getResponse()->setHeader('Content-type', 'application/json', true);
|
400 |
+
$responseBody = array('success' => true, 'data' => array());
|
401 |
+
/** @var Mage_Core_Model_Store[] $stores */
|
402 |
+
$storeId = $this->getRequest()->getParam('store');
|
403 |
+
if (!empty($storeId)) {
|
404 |
+
$stores = array(Mage::app()->getStore($storeId));
|
405 |
+
} else {
|
406 |
+
$stores = Mage::app()->getStores();
|
407 |
+
}
|
408 |
+
/** @var Nosto_Tagging_Helper_Data $helper */
|
409 |
+
$helper = Mage::helper('nosto_tagging');
|
410 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
411 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
412 |
+
foreach ($stores as $store) {
|
413 |
+
$account = $accountHelper->find($store);
|
414 |
+
if (is_null($account)) {
|
415 |
+
continue;
|
416 |
+
}
|
417 |
+
if ($accountHelper->updateAccount($account, $store)) {
|
418 |
+
$responseBody['data'][] = array(
|
419 |
+
'type' => 'success',
|
420 |
+
'message' => $helper->__(sprintf("The account has been updated for the %s store.", $store->getName()))
|
421 |
+
);
|
422 |
+
} else {
|
423 |
+
$responseBody['data'][] = array(
|
424 |
+
'type' => 'error',
|
425 |
+
'message' => $helper->__(sprintf("There was an error updating the account for the %s store.", $store->getName()))
|
426 |
+
);
|
427 |
+
}
|
428 |
+
}
|
429 |
+
if (empty($responseBody['data'])) {
|
430 |
+
$responseBody['data'][] = array(
|
431 |
+
'type' => 'error',
|
432 |
+
'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.")
|
433 |
+
);
|
434 |
+
}
|
435 |
+
$this->getResponse()->setBody(json_encode($responseBody));
|
436 |
+
}
|
437 |
+
|
438 |
/**
|
439 |
* Returns the currently selected store view.
|
440 |
* If it is single store setup, then just return the default store.
|
461 |
*/
|
462 |
protected function _isAllowed()
|
463 |
{
|
464 |
+
/** @var Mage_Admin_Model_Session $session */
|
465 |
+
$session = Mage::getSingleton('admin/session');
|
466 |
+
return $session->isAllowed('nosto');
|
467 |
}
|
468 |
}
|
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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -44,7 +44,7 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
|
|
44 |
const OFFSET = 'offset';
|
45 |
const CREATED_AT = 'created_at';
|
46 |
|
47 |
-
|
48 |
'sales/order' => array(
|
49 |
self::ID => 'entity_id'
|
50 |
),
|
@@ -54,7 +54,9 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
|
|
54 |
);
|
55 |
|
56 |
protected function applyIdFilters(&$collection) {
|
|
|
57 |
if ($id = $this->getRequest()->getParam(self::ID)) {
|
|
|
58 |
$collectionModel = $collection->getModelName();
|
59 |
if (
|
60 |
!empty(self::$searchableFields[$collectionModel])
|
@@ -98,10 +100,12 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
|
|
98 |
}
|
99 |
/** @var Nosto_Tagging_Model_Export_Collection_Order $collection */
|
100 |
$collection = Mage::getModel('nosto_tagging/export_collection_order');
|
|
|
101 |
foreach ($orders as $order) {
|
|
|
|
|
102 |
/** @var Nosto_Tagging_Model_Meta_Order $meta */
|
103 |
-
$meta =
|
104 |
-
// We don't need special items like shipping cost and discounts.
|
105 |
$meta->includeSpecialItems = true;
|
106 |
$meta->loadData($order);
|
107 |
$collection[] = $meta;
|
@@ -143,8 +147,8 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
|
|
143 |
$products = array();
|
144 |
}
|
145 |
$collection = new NostoExportProductCollection();
|
|
|
146 |
foreach ($products as $product) {
|
147 |
-
/** @var Mage_Catalog_Model_Product $product */
|
148 |
/** @var Nosto_Tagging_Model_Meta_Product $meta */
|
149 |
$meta = Mage::getModel('nosto_tagging/meta_product');
|
150 |
$meta->loadData($product);
|
@@ -164,7 +168,9 @@ class Nosto_Tagging_ExportController extends Mage_Core_Controller_Front_Action
|
|
164 |
*/
|
165 |
protected function export(NostoExportCollectionInterface $collection)
|
166 |
{
|
167 |
-
|
|
|
|
|
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-2017 Nosto 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 |
const OFFSET = 'offset';
|
45 |
const CREATED_AT = 'created_at';
|
46 |
|
47 |
+
protected static $searchableFields = array(
|
48 |
'sales/order' => array(
|
49 |
self::ID => 'entity_id'
|
50 |
),
|
54 |
);
|
55 |
|
56 |
protected function applyIdFilters(&$collection) {
|
57 |
+
/** @var Mage_Sales_Model_Resource_Collection_Abstract $collection */
|
58 |
if ($id = $this->getRequest()->getParam(self::ID)) {
|
59 |
+
/** @var string $collectionModel */
|
60 |
$collectionModel = $collection->getModelName();
|
61 |
if (
|
62 |
!empty(self::$searchableFields[$collectionModel])
|
100 |
}
|
101 |
/** @var Nosto_Tagging_Model_Export_Collection_Order $collection */
|
102 |
$collection = Mage::getModel('nosto_tagging/export_collection_order');
|
103 |
+
/* @var Mage_Sales_Model_Order $order */
|
104 |
foreach ($orders as $order) {
|
105 |
+
/** @var Nosto_Tagging_Helper_Class $helper */
|
106 |
+
$helper = Mage::helper('nosto_tagging/class');
|
107 |
/** @var Nosto_Tagging_Model_Meta_Order $meta */
|
108 |
+
$meta = $helper->getOrderClass($order);
|
|
|
109 |
$meta->includeSpecialItems = true;
|
110 |
$meta->loadData($order);
|
111 |
$collection[] = $meta;
|
147 |
$products = array();
|
148 |
}
|
149 |
$collection = new NostoExportProductCollection();
|
150 |
+
/** @var Mage_Catalog_Model_Product $product */
|
151 |
foreach ($products as $product) {
|
|
|
152 |
/** @var Nosto_Tagging_Model_Meta_Product $meta */
|
153 |
$meta = Mage::getModel('nosto_tagging/meta_product');
|
154 |
$meta->loadData($product);
|
168 |
*/
|
169 |
protected function export(NostoExportCollectionInterface $collection)
|
170 |
{
|
171 |
+
/** @var Nosto_Tagging_Helper_Account $helper */
|
172 |
+
$helper = Mage::helper('nosto_tagging/account');
|
173 |
+
$account = $helper->find();
|
174 |
if ($account !== null) {
|
175 |
$cipherText = NostoExporter::export($account, $collection);
|
176 |
echo $cipherText;
|
app/code/community/Nosto/Tagging/controllers/OauthController.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
|
72 |
$code
|
73 |
);
|
74 |
-
|
|
|
|
|
|
|
75 |
$params = array(
|
76 |
'message_type' => NostoMessage::TYPE_SUCCESS,
|
77 |
'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
|
@@ -88,6 +93,7 @@ class Nosto_tagging_OauthController extends Mage_Core_Controller_Front_Action
|
|
88 |
$params = array(
|
89 |
'message_type' => NostoMessage::TYPE_ERROR,
|
90 |
'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
|
|
|
91 |
'store' => (int)$store->getId(),
|
92 |
'_store' => Mage_Core_Model_App::ADMIN_STORE_ID,
|
93 |
);
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
* DISCLAIMER
|
16 |
+
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
67 |
$store = Mage::app()->getStore();
|
68 |
if (($code = $request->getParam('code')) !== null) {
|
69 |
try {
|
70 |
+
/** @var Nosto_Tagging_Helper_Oauth $oauthHelper */
|
71 |
+
$oauthHelper = Mage::helper('nosto_tagging/oauth');
|
72 |
$account = NostoAccount::syncFromNosto(
|
73 |
+
$oauthHelper->getMetaData($store),
|
74 |
$code
|
75 |
);
|
76 |
+
|
77 |
+
/** @var Nosto_Tagging_Helper_Account $accountHelper */
|
78 |
+
$accountHelper = Mage::helper('nosto_tagging/account');
|
79 |
+
if ($accountHelper->save($account, $store)) {
|
80 |
$params = array(
|
81 |
'message_type' => NostoMessage::TYPE_SUCCESS,
|
82 |
'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
|
93 |
$params = array(
|
94 |
'message_type' => NostoMessage::TYPE_ERROR,
|
95 |
'message_code' => NostoMessage::CODE_ACCOUNT_CONNECT,
|
96 |
+
'message_text' => $e->getMessage(),
|
97 |
'store' => (int)$store->getId(),
|
98 |
'_store' => Mage_Core_Model_App::ADMIN_STORE_ID,
|
99 |
);
|
app/code/community/Nosto/Tagging/etc/adminhtml.xml
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
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-2017 Nosto 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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
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-2017 Nosto 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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
-->
|
29 |
<config>
|
30 |
<modules>
|
31 |
<Nosto_Tagging>
|
32 |
-
<version>2.
|
33 |
</Nosto_Tagging>
|
34 |
</modules>
|
35 |
<global>
|
@@ -37,9 +36,28 @@
|
|
37 |
<tagging_setup>
|
38 |
<setup>
|
39 |
<module>Nosto_Tagging</module>
|
40 |
-
<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,34 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-2017 Nosto 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.10.0</version>
|
32 |
</Nosto_Tagging>
|
33 |
</modules>
|
34 |
<global>
|
36 |
<tagging_setup>
|
37 |
<setup>
|
38 |
<module>Nosto_Tagging</module>
|
39 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
40 |
</setup>
|
41 |
</tagging_setup>
|
42 |
+
<nosto_customer_reference_setup>
|
43 |
+
<setup>
|
44 |
+
<module>Nosto_Tagging</module>
|
45 |
+
<class>Mage_Eav_Model_Entity_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 |
+
<attribute_map>
|
198 |
+
<gtin>0</gtin>
|
199 |
+
<supplier_cost>cost</supplier_cost>
|
200 |
+
</attribute_map>
|
201 |
+
<ratings_and_reviews>
|
202 |
+
<provider>0</provider>
|
203 |
+
</ratings_and_reviews>
|
204 |
</nosto_tagging>
|
205 |
</default>
|
206 |
+
<crontab>
|
207 |
+
<jobs>
|
208 |
+
<nostotagging_currency_exchange_rate_update>
|
209 |
+
<run>
|
210 |
+
<model>nosto_tagging/observer::scheduledCurrencyExchangeRateUpdate</model>
|
211 |
+
</run>
|
212 |
+
</nostotagging_currency_exchange_rate_update>
|
213 |
+
</jobs>
|
214 |
+
</crontab>
|
215 |
+
</config>
|
app/code/community/Nosto/Tagging/etc/system.xml
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
-->
|
29 |
<config>
|
30 |
<sections>
|
31 |
<nosto_tagging translate="label">
|
@@ -36,14 +35,54 @@
|
|
36 |
<show_in_website>1</show_in_website>
|
37 |
<show_in_store>1</show_in_store>
|
38 |
<groups>
|
39 |
-
<
|
40 |
-
<label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<frontend_type>text</frontend_type>
|
42 |
<sort_order>20</sort_order>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
<expanded>0</expanded>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<fields>
|
48 |
<image_version translate="label">
|
49 |
<label>Image Version</label>
|
@@ -56,6 +95,199 @@
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
-->
|
27 |
+
<!--suppress XmlUnboundNsPrefix -->
|
|
|
28 |
<config>
|
29 |
<sections>
|
30 |
<nosto_tagging translate="label">
|
35 |
<show_in_website>1</show_in_website>
|
36 |
<show_in_store>1</show_in_store>
|
37 |
<groups>
|
38 |
+
<general>
|
39 |
+
<label>General</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<expanded>0</expanded>
|
46 |
+
<fields>
|
47 |
+
<use_product_api translate="label">
|
48 |
+
<label>Real-time product updates to Nosto</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>10</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</use_product_api>
|
56 |
+
</fields>
|
57 |
+
</general>
|
58 |
+
<currency_formats translate="label">
|
59 |
+
<label>Currency formats</label>
|
60 |
<frontend_type>text</frontend_type>
|
61 |
<sort_order>20</sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
63 |
<show_in_website>1</show_in_website>
|
64 |
<show_in_store>1</show_in_store>
|
65 |
<expanded>0</expanded>
|
66 |
+
<fields>
|
67 |
+
<currency_formats translate="label">
|
68 |
+
<label>Currency Formats</label>
|
69 |
+
<comment>Preview of the current currency formats extracted from Magento.</comment>
|
70 |
+
<frontend_type>text</frontend_type>
|
71 |
+
<frontend_model>nosto_tagging/adminhtml_system_config_currency_formats</frontend_model>
|
72 |
+
<sort_order>20</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>1</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
</currency_formats>
|
77 |
+
</fields>
|
78 |
+
</currency_formats>
|
79 |
+
<image_options translate="label">
|
80 |
+
<label>Image Options</label>
|
81 |
+
<sort_order>30</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
<expanded>0</expanded>
|
86 |
<fields>
|
87 |
<image_version translate="label">
|
88 |
<label>Image Version</label>
|
95 |
</image_version>
|
96 |
</fields>
|
97 |
</image_options>
|
98 |
+
<pretty_url translate="label">
|
99 |
+
<label>URL structure</label>
|
100 |
+
<sort_order>40</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
<expanded>0</expanded>
|
105 |
+
<fields>
|
106 |
+
<in_use translate="label">
|
107 |
+
<label>Remove store parameter from URLs</label>
|
108 |
+
<comment>Set this to yes if you have configured different URLs or domains for each store or if you are only using single store view.</comment>
|
109 |
+
<frontend_type>select</frontend_type>
|
110 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
111 |
+
<sort_order>10</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
</in_use>
|
116 |
+
</fields>
|
117 |
+
</pretty_url>
|
118 |
+
<attribute_to_tag translate="label">
|
119 |
+
<label>Attributes to tags</label>
|
120 |
+
<sort_order>50</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
<expanded>0</expanded>
|
125 |
+
<fields>
|
126 |
+
<tag1 translate="label">
|
127 |
+
<label>Product attributes for Nosto tags 1</label>
|
128 |
+
<comment>Choose attributes that will be added to tags 1 when present</comment>
|
129 |
+
<frontend_type>multiselect</frontend_type>
|
130 |
+
<source_model>nosto_tagging/system_config_source_custom_tags</source_model>
|
131 |
+
<sort_order>10</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
</tag1>
|
136 |
+
<tag2 translate="label">
|
137 |
+
<label>Product attributes for Nosto tags 2</label>
|
138 |
+
<comment>Choose attributes that will be added to tags 2 when present</comment>
|
139 |
+
<frontend_type>multiselect</frontend_type>
|
140 |
+
<source_model>nosto_tagging/system_config_source_custom_tags</source_model>
|
141 |
+
<sort_order>20</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>1</show_in_website>
|
144 |
+
<show_in_store>1</show_in_store>
|
145 |
+
</tag2>
|
146 |
+
<tag3 translate="label">
|
147 |
+
<label>Product attributes for Nosto tags 3</label>
|
148 |
+
<comment>Choose attributes that will be added to tags 3 when present</comment>
|
149 |
+
<frontend_type>multiselect</frontend_type>
|
150 |
+
<source_model>nosto_tagging/system_config_source_custom_tags</source_model>
|
151 |
+
<sort_order>30</sort_order>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>1</show_in_website>
|
154 |
+
<show_in_store>1</show_in_store>
|
155 |
+
</tag3>
|
156 |
+
</fields>
|
157 |
+
</attribute_to_tag>
|
158 |
+
<brand_attribute translate="label">
|
159 |
+
<label>Brand attribute</label>
|
160 |
+
<sort_order>60</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
<show_in_store>1</show_in_store>
|
164 |
+
<expanded>0</expanded>
|
165 |
+
<fields>
|
166 |
+
<tag translate="label">
|
167 |
+
<label>Nosto brand attribute</label>
|
168 |
+
<comment>Choose attribute that will be used as a brand attribute for Nosto product tagging</comment>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>nosto_tagging/system_config_source_product_attribute</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 |
+
<attribute_map translate="label">
|
179 |
+
<label>Optional attributes</label>
|
180 |
+
<sort_order>60</sort_order>
|
181 |
+
<show_in_default>1</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>1</show_in_store>
|
184 |
+
<expanded>0</expanded>
|
185 |
+
<fields>
|
186 |
+
<gtin translate="label">
|
187 |
+
<label>GTIN / barcode attribute</label>
|
188 |
+
<comment>Choose attribute that will be used as GTIN / barcode attribute for Nosto product tagging</comment>
|
189 |
+
<frontend_type>select</frontend_type>
|
190 |
+
<source_model>nosto_tagging/system_config_source_product_attribute</source_model>
|
191 |
+
<sort_order>80</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
</gtin>
|
196 |
+
<supplier_cost translate="label">
|
197 |
+
<label>Supplier cost</label>
|
198 |
+
<comment>Choose attribute that will be used as a supplier cost for Nosto product. Please note that this field will not be tagged into the html source. It will be only sent via API to Nosto.</comment>
|
199 |
+
<frontend_type>select</frontend_type>
|
200 |
+
<source_model>nosto_tagging/system_config_source_price_attribute</source_model>
|
201 |
+
<sort_order>90</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
</supplier_cost>
|
206 |
+
</fields>
|
207 |
+
</attribute_map>
|
208 |
+
<multi_currency translate="label">
|
209 |
+
<label>Multi Currency</label>
|
210 |
+
<frontend_type>text</frontend_type>
|
211 |
+
<sort_order>70</sort_order>
|
212 |
+
<show_in_default>1</show_in_default>
|
213 |
+
<show_in_website>1</show_in_website>
|
214 |
+
<show_in_store>1</show_in_store>
|
215 |
+
<expanded>0</expanded>
|
216 |
+
<fields>
|
217 |
+
<method translate="label">
|
218 |
+
<label>Multi Currency Method</label>
|
219 |
+
<comment>Use either exchange rates or price variations for multi currency product recommendations.</comment>
|
220 |
+
<frontend_type>select</frontend_type>
|
221 |
+
<frontend_model>nosto_tagging/adminhtml_system_config_currency_method</frontend_model>
|
222 |
+
<source_model>nosto_tagging/system_config_source_multi_currency_method</source_model>
|
223 |
+
<sort_order>10</sort_order>
|
224 |
+
<show_in_default>1</show_in_default>
|
225 |
+
<show_in_website>1</show_in_website>
|
226 |
+
<show_in_store>1</show_in_store>
|
227 |
+
</method>
|
228 |
+
</fields>
|
229 |
+
</multi_currency>
|
230 |
+
<scheduled_currency_exchange_rate_update translate="label">
|
231 |
+
<label>Scheduled Currency Exchange Rate Update</label>
|
232 |
+
<frontend_type>text</frontend_type>
|
233 |
+
<sort_order>80</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>0</show_in_website>
|
236 |
+
<show_in_store>0</show_in_store>
|
237 |
+
<expanded>0</expanded>
|
238 |
+
<fields>
|
239 |
+
<enabled translate="label">
|
240 |
+
<label>Enabled</label>
|
241 |
+
<frontend_type>select</frontend_type>
|
242 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
243 |
+
<sort_order>10</sort_order>
|
244 |
+
<show_in_default>1</show_in_default>
|
245 |
+
<show_in_website>0</show_in_website>
|
246 |
+
<show_in_store>0</show_in_store>
|
247 |
+
</enabled>
|
248 |
+
<time translate="label">
|
249 |
+
<label>Start Time</label>
|
250 |
+
<comment>The start time is entered in the default timezone configured for the installation.</comment>
|
251 |
+
<frontend_type>time</frontend_type>
|
252 |
+
<sort_order>20</sort_order>
|
253 |
+
<show_in_default>1</show_in_default>
|
254 |
+
<show_in_website>0</show_in_website>
|
255 |
+
<show_in_store>0</show_in_store>
|
256 |
+
</time>
|
257 |
+
<frequency translate="label">
|
258 |
+
<label>Frequency</label>
|
259 |
+
<frontend_type>select</frontend_type>
|
260 |
+
<source_model>nosto_tagging/system_config_source_cron_frequency</source_model>
|
261 |
+
<backend_model>nosto_tagging/system_config_backend_currency_exchange_rate_cron</backend_model>
|
262 |
+
<frontend_model>nosto_tagging/adminhtml_system_config_currency_cronFrequency</frontend_model>
|
263 |
+
<sort_order>30</sort_order>
|
264 |
+
<show_in_default>1</show_in_default>
|
265 |
+
<show_in_website>0</show_in_website>
|
266 |
+
<show_in_store>0</show_in_store>
|
267 |
+
</frequency>
|
268 |
+
</fields>
|
269 |
+
</scheduled_currency_exchange_rate_update>
|
270 |
+
<ratings_and_reviews translate="label">
|
271 |
+
<label>Ratings & Reviews</label>
|
272 |
+
<frontend_type>text</frontend_type>
|
273 |
+
<sort_order>80</sort_order>
|
274 |
+
<show_in_default>1</show_in_default>
|
275 |
+
<show_in_website>1</show_in_website>
|
276 |
+
<show_in_store>1</show_in_store>
|
277 |
+
<expanded>1</expanded>
|
278 |
+
<fields>
|
279 |
+
<provider translate="label">
|
280 |
+
<label>Ratings source</label>
|
281 |
+
<comment>Select source for product ratings and reviews.</comment>
|
282 |
+
<frontend_type>select</frontend_type>
|
283 |
+
<source_model>nosto_tagging/system_config_source_ratings_provider</source_model>
|
284 |
+
<sort_order>30</sort_order>
|
285 |
+
<show_in_default>1</show_in_default>
|
286 |
+
<show_in_website>1</show_in_website>
|
287 |
+
<show_in_store>1</show_in_store>
|
288 |
+
</provider>
|
289 |
+
</fields>
|
290 |
+
</ratings_and_reviews>
|
291 |
</groups>
|
292 |
</nosto_tagging>
|
293 |
</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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* This install script will run only when installing the version 2.8.0 or above
|
30 |
+
*
|
31 |
+
* Adds custom attribute `nosto_customer_reference` for the Customer object
|
32 |
+
*
|
33 |
+
*/
|
34 |
+
|
35 |
+
/* @var $setupHelper Nosto_Tagging_Helper_Setup */
|
36 |
+
$setupHelper = Mage::helper('nosto_tagging/setup');
|
37 |
+
$setupHelper->addNostoCustomerReferenceEav($this);
|
app/code/community/Nosto/Tagging/sql/nosto_customer_reference_setup/mysql4-upgrade-2.8.0-2.8.2.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* This upgrade script will run when upgrading from 2.8.0 or 2.8.1 to 2.8.2
|
30 |
+
*
|
31 |
+
* Changes the attribute `nosto_customer_reference` frontend type to be text
|
32 |
+
*
|
33 |
+
*/
|
34 |
+
|
35 |
+
/* @var $setupHelper Nosto_Tagging_Helper_Setup */
|
36 |
+
$setupHelper = Mage::helper('nosto_tagging/setup');
|
37 |
+
$setupHelper->alterCustomerReferenceInputType($this);
|
app/code/community/Nosto/Tagging/sql/tagging_setup/mysql4-install-1.2.0.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,17 +11,17 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
* @category Nosto
|
22 |
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -31,53 +31,55 @@
|
|
31 |
*
|
32 |
* Creates the db table for matching Magento cart quotes to nosto customer ids.
|
33 |
*
|
34 |
-
* @var
|
35 |
*/
|
36 |
|
37 |
$installer = $this;
|
38 |
$installer->startSetup();
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
->addColumn(
|
52 |
-
'quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
|
53 |
-
'unsigned' => true,
|
54 |
-
'nullable' => false
|
55 |
)
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
)
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
)
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
)
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
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->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
31 |
*
|
32 |
* Creates the db table for matching Magento cart quotes to nosto customer ids.
|
33 |
*
|
34 |
+
* @var Mage_Eav_Model_Entity_Setup $installer
|
35 |
*/
|
36 |
|
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-
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
@@ -31,7 +31,7 @@
|
|
31 |
* Deletes all existing module configurations.
|
32 |
* Creates the db table for matching Magento cart quotes to nosto customer ids.
|
33 |
*
|
34 |
-
* @var
|
35 |
*/
|
36 |
|
37 |
$installer = $this;
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
31 |
* Deletes all existing module configurations.
|
32 |
* Creates the db table for matching Magento cart quotes to nosto customer ids.
|
33 |
*
|
34 |
+
* @var Mage_Eav_Model_Entity_Setup $installer
|
35 |
*/
|
36 |
|
37 |
$installer = $this;
|
app/design/adminhtml/default/default/layout/nostotagging.xml
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
-->
|
29 |
<config>
|
30 |
<!-- Nosto main menu link page -->
|
31 |
<adminhtml_nosto_index>
|
@@ -42,7 +41,7 @@
|
|
42 |
</reference>
|
43 |
<!-- Page content -->
|
44 |
<reference name="content">
|
45 |
-
<block type="
|
46 |
<!-- Store switcher -->
|
47 |
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
48 |
<action method="setUseConfirm"><params>0</params></action>
|
@@ -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-2017 Nosto 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>
|
41 |
</reference>
|
42 |
<!-- Page content -->
|
43 |
<reference name="content">
|
44 |
+
<block type="adminhtml/template" name="nosto.wizard" template="nostotagging/wizard.phtml">
|
45 |
<!-- Store switcher -->
|
46 |
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
47 |
<action method="setUseConfirm"><params>0</params></action>
|
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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
27 |
+
*/
|
28 |
+
|
29 |
+
/* @var $this Nosto_Tagging_Block_Adminhtml_Notifications */
|
30 |
+
?>
|
31 |
+
|
32 |
+
<?php if (!$this->allAccountsOK()) : ?>
|
33 |
+
<div class="notification-global"><?php echo $this->helper('index')->__('One or more of your store views is using Nosto and has multi-currency enabled but does not have the necessary permissions granted. Check the Nosto accounts in each of your store views to grant the necessary permissions or disable multi-currency. Permissions can be re-granted by simply removing the Nosto account for that store view and connecting with Nosto again.') ?></div>
|
34 |
+
<?php elseif (!$this->cronEnabledIfNeeded()) : ?>
|
35 |
+
<div class="notification-global"><?php echo $this->helper('index')->__('One or more of your store views is using Nosto and has multi-currency enabled but does not have scheduled exchange-rates cron jobs enabled. Click here to go to the <a href="%s">Nosto Configuration</a> to enable them.', $this->getConfigureUrl()) ?></div>
|
36 |
+
<?php endif; ?>
|
37 |
+
<?php
|
38 |
+
$invalidAccountDomains = $this->getInvalidAccountDomains();
|
39 |
+
if (!empty($invalidAccountDomains) && is_array($invalidAccountDomains)) :
|
40 |
+
?>
|
41 |
+
<?php foreach ($invalidAccountDomains as $invalidAccountDomain) : ?>
|
42 |
+
<div class="notification-global"><?php
|
43 |
+
echo $this->helper('index')->__(
|
44 |
+
sprintf(
|
45 |
+
'It looks like you\'ve created Nosto account (%s) for <strong class="label">%s</strong> and currently store\'s (%s) front page is <strong class="label">%s</strong>. It is not possible to share Nosto accounts across multiple domains. Please reset the Nosto settings, and create a new Nosto account, or connect to an existing account.',
|
46 |
+
$invalidAccountDomain['nostoAccount'],
|
47 |
+
$invalidAccountDomain['savedUrl'],
|
48 |
+
$invalidAccountDomain['storeName'],
|
49 |
+
$invalidAccountDomain['currentUrl']
|
50 |
+
)
|
51 |
+
);
|
52 |
+
?>
|
53 |
+
<a href="<?php echo $invalidAccountDomain['actionUrl']; ?>">Reset Nosto settings</a>
|
54 |
+
</div>
|
55 |
+
<?php endforeach; ?>
|
56 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/nostotagging/system/config/currency/cronFrequency.phtml
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
?>
|
28 |
+
|
29 |
+
<?php
|
30 |
+
/**
|
31 |
+
* @var $this Nosto_Tagging_Block_Adminhtml_System_Config_Currency_CronFrequency
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
|
35 |
+
<!--suppress HtmlFormInputWithoutLabel -->
|
36 |
+
<select id="<?php echo $this->getSelectId(); ?>" name="<?php echo $this->getSelectName(); ?>" class="select" onchange="nostoHandleCronSettings()">
|
37 |
+
<?php foreach ($this->getOptions() as $idx => $option): ?>
|
38 |
+
<?php
|
39 |
+
$currentValue = $this->getCurrentValue();
|
40 |
+
if ($option['value'] == $currentValue) {
|
41 |
+
$selected = 'selected';
|
42 |
+
} else {
|
43 |
+
$selected = '';
|
44 |
+
}
|
45 |
+
?>
|
46 |
+
<option value="<?php echo $option['value']; ?>" <?php echo $selected; ?>><?php echo $option['label']; ?></option>
|
47 |
+
<?php endforeach; ?>
|
48 |
+
</select>
|
49 |
+
<!-- Form handler for exchange rates -->
|
50 |
+
<script type="text/javascript">
|
51 |
+
function nostoHandleCronSettings() {
|
52 |
+
var hourField = document.getElementsByName("<?php echo $this->getHourSelectName(); ?>")[0];
|
53 |
+
var frequencyField = document.getElementById("<?php echo $this->getSelectId(); ?>");
|
54 |
+
if (frequencyField && hourField) {
|
55 |
+
var frequencyValue = frequencyField.value;
|
56 |
+
if (frequencyValue == 'H') {
|
57 |
+
var option = document.createElement("option");
|
58 |
+
option.value = '*';
|
59 |
+
option.text = '*';
|
60 |
+
option.selected = 'selected';
|
61 |
+
hourField.appendChild(option);
|
62 |
+
hourField.setAttribute("disabled", "disabled");
|
63 |
+
} else {
|
64 |
+
for (var i = 0; i < hourField.length; i++) {
|
65 |
+
if (hourField.options[i].value == '*') {
|
66 |
+
hourField.remove(i);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
hourField.removeAttribute("disabled");
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
(function(){
|
76 |
+
nostoHandleCronSettings();
|
77 |
+
})();
|
78 |
+
</script>
|
app/design/adminhtml/default/default/template/nostotagging/system/config/currency/formats.phtml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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,24 +11,24 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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
|
32 |
*/
|
33 |
?>
|
34 |
<div class="content-header">
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
+
*
|
5 |
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* 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-2017 Nosto 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_Core_Block_Template
|
32 |
*/
|
33 |
?>
|
34 |
<div class="content-header">
|
app/design/frontend/base/default/layout/nostotagging.xml
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
-->
|
29 |
<layout version="1.0.0">
|
30 |
<!-- -->
|
31 |
<!-- Adds Nosto tagging meta-data to site -->
|
@@ -38,9 +37,14 @@
|
|
38 |
<block type="nosto_tagging/meta" name="nosto.meta" template="nostotagging/meta.phtml" before="-"/>
|
39 |
</reference>
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
<!-- Adds Nosto embed script to head -->
|
42 |
<reference name="head">
|
43 |
-
<block type="nosto_tagging/embed" name="nosto.embed" template="nostotagging/embed.phtml"/>
|
44 |
</reference>
|
45 |
|
46 |
<!-- Adds Nosto `add-to-cart` script to head -->
|
@@ -58,6 +62,10 @@
|
|
58 |
<block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
|
59 |
</reference>
|
60 |
|
|
|
|
|
|
|
|
|
61 |
</default>
|
62 |
|
63 |
<!-- Tag category -->
|
@@ -87,6 +95,12 @@
|
|
87 |
</reference>
|
88 |
</checkout_onepage_success>
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
<!-- -->
|
91 |
<!-- Adds Nosto elements to site -->
|
92 |
<!-- -->
|
@@ -142,6 +156,13 @@
|
|
142 |
<cms_index_index>
|
143 |
<!-- Add 4 content placeholders after the home page content -->
|
144 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
<block type="nosto_tagging/element" name="nosto.page.home1" after="-"
|
146 |
template="nostotagging/element.phtml">
|
147 |
<action method="setData">
|
@@ -177,6 +198,13 @@
|
|
177 |
<checkout_cart_index>
|
178 |
<!-- Adds 3 content placeholders after the cart content -->
|
179 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
<block type="nosto_tagging/element" name="nosto.page.cart1" after="checkout.cart"
|
181 |
template="nostotagging/element.phtml">
|
182 |
<action method="setData">
|
@@ -205,6 +233,13 @@
|
|
205 |
<catalog_product_view>
|
206 |
<!-- Adds 3 content placeholders after the product info -->
|
207 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<block type="nosto_tagging/element" name="nosto.page.product1" after="product.info"
|
209 |
template="nostotagging/element.phtml">
|
210 |
<action method="setData">
|
@@ -239,6 +274,13 @@
|
|
239 |
<nosto_tagging_catalog_category>
|
240 |
<!-- Adds 2 content placeholders; 1 before and 1 after the products -->
|
241 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
<block type="nosto_tagging/element" name="nosto.page.category1" before="category.products"
|
243 |
template="nostotagging/element.phtml">
|
244 |
<action method="setData">
|
@@ -260,6 +302,13 @@
|
|
260 |
<catalogsearch_result_index>
|
261 |
<!-- Adds 2 content placeholders; 1 before and 1 after the search result -->
|
262 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
<block type="nosto_tagging/element" name="nosto.page.search1" before="search.result"
|
264 |
template="nostotagging/element.phtml">
|
265 |
<action method="setData">
|
@@ -283,6 +332,13 @@
|
|
283 |
<!-- 404 Not found page -->
|
284 |
<cms_index_noroute>
|
285 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
<block type="nosto_tagging/element" name="nosto.page.notfound1" after="-"
|
287 |
template="nostotagging/element.phtml">
|
288 |
<action method="setData">
|
@@ -310,6 +366,13 @@
|
|
310 |
<!-- Order confirmation page -->
|
311 |
<checkout_onepage_success>
|
312 |
<reference name="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
<block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="-"
|
314 |
template="nostotagging/element.phtml">
|
315 |
<action method="setData">
|
@@ -326,4 +389,31 @@
|
|
326 |
</block>
|
327 |
</reference>
|
328 |
</checkout_onepage_success>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
+
~ Magento
|
4 |
+
~
|
5 |
+
~ NOTICE OF LICENSE
|
6 |
+
~
|
7 |
+
~ This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
~ that is bundled with this package in the file LICENSE.txt.
|
9 |
+
~ It is also available through the world-wide-web at this URL:
|
10 |
+
~ http://opensource.org/licenses/osl-3.0.php
|
11 |
+
~ If you did not receive a copy of the license and are unable to
|
12 |
+
~ obtain it through the world-wide-web, please send an email
|
13 |
+
~ to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
~
|
15 |
+
~ DISCLAIMER
|
16 |
+
~
|
17 |
+
~ Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
~ versions in the future. If you wish to customize Magento for your
|
19 |
+
~ needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
~
|
21 |
+
~ @category Nosto
|
22 |
+
~ @package Nosto_Tagging
|
23 |
+
~ @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
~ @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
-->
|
27 |
+
<!--suppress XmlUnboundNsPrefix -->
|
|
|
28 |
<layout version="1.0.0">
|
29 |
<!-- -->
|
30 |
<!-- Adds Nosto tagging meta-data to site -->
|
37 |
<block type="nosto_tagging/meta" name="nosto.meta" template="nostotagging/meta.phtml" before="-"/>
|
38 |
</reference>
|
39 |
|
40 |
+
<!-- Adds Nosto js stub to head -->
|
41 |
+
<reference name="head">
|
42 |
+
<block type="core/template" name="nosto.js.stub" template="nostotagging/jsstub.phtml"/>
|
43 |
+
</reference>
|
44 |
+
|
45 |
<!-- Adds Nosto embed script to head -->
|
46 |
<reference name="head">
|
47 |
+
<block type="nosto_tagging/embed" name="nosto.embed" template="nostotagging/embed.phtml" after="nosto.js.stub"/>
|
48 |
</reference>
|
49 |
|
50 |
<!-- Adds Nosto `add-to-cart` script to head -->
|
62 |
<block type="nosto_tagging/customer" name="nosto.customer" template="nostotagging/customer.phtml"/>
|
63 |
</reference>
|
64 |
|
65 |
+
<!-- Tag currency variation -->
|
66 |
+
<reference name="after_body_start">
|
67 |
+
<block type="nosto_tagging/variation" name="nosto.variation" template="nostotagging/variation.phtml"/>
|
68 |
+
</reference>
|
69 |
</default>
|
70 |
|
71 |
<!-- Tag category -->
|
95 |
</reference>
|
96 |
</checkout_onepage_success>
|
97 |
|
98 |
+
<checkout_klarna_success>
|
99 |
+
<reference name="after_body_start">
|
100 |
+
<block type="nosto_tagging/order_vaimo_klarna_checkout" name="nosto.order.vaimo.klarna" template="nostotagging/order.phtml"/>
|
101 |
+
</reference>
|
102 |
+
</checkout_klarna_success>
|
103 |
+
|
104 |
<!-- -->
|
105 |
<!-- Adds Nosto elements to site -->
|
106 |
<!-- -->
|
156 |
<cms_index_index>
|
157 |
<!-- Add 4 content placeholders after the home page content -->
|
158 |
<reference name="content">
|
159 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.front" after="-"
|
160 |
+
template="nostotagging/pagetype.phtml">
|
161 |
+
<action method="setData">
|
162 |
+
<name>page_type</name>
|
163 |
+
<value>front</value>
|
164 |
+
</action>
|
165 |
+
</block>
|
166 |
<block type="nosto_tagging/element" name="nosto.page.home1" after="-"
|
167 |
template="nostotagging/element.phtml">
|
168 |
<action method="setData">
|
198 |
<checkout_cart_index>
|
199 |
<!-- Adds 3 content placeholders after the cart content -->
|
200 |
<reference name="content">
|
201 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.cart" after="-"
|
202 |
+
template="nostotagging/pagetype.phtml">
|
203 |
+
<action method="setData">
|
204 |
+
<name>page_type</name>
|
205 |
+
<value>cart</value>
|
206 |
+
</action>
|
207 |
+
</block>
|
208 |
<block type="nosto_tagging/element" name="nosto.page.cart1" after="checkout.cart"
|
209 |
template="nostotagging/element.phtml">
|
210 |
<action method="setData">
|
233 |
<catalog_product_view>
|
234 |
<!-- Adds 3 content placeholders after the product info -->
|
235 |
<reference name="content">
|
236 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.product" after="-"
|
237 |
+
template="nostotagging/pagetype.phtml">
|
238 |
+
<action method="setData">
|
239 |
+
<name>page_type</name>
|
240 |
+
<value>product</value>
|
241 |
+
</action>
|
242 |
+
</block>
|
243 |
<block type="nosto_tagging/element" name="nosto.page.product1" after="product.info"
|
244 |
template="nostotagging/element.phtml">
|
245 |
<action method="setData">
|
274 |
<nosto_tagging_catalog_category>
|
275 |
<!-- Adds 2 content placeholders; 1 before and 1 after the products -->
|
276 |
<reference name="content">
|
277 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.category" after="-"
|
278 |
+
template="nostotagging/pagetype.phtml">
|
279 |
+
<action method="setData">
|
280 |
+
<name>page_type</name>
|
281 |
+
<value>category</value>
|
282 |
+
</action>
|
283 |
+
</block>
|
284 |
<block type="nosto_tagging/element" name="nosto.page.category1" before="category.products"
|
285 |
template="nostotagging/element.phtml">
|
286 |
<action method="setData">
|
302 |
<catalogsearch_result_index>
|
303 |
<!-- Adds 2 content placeholders; 1 before and 1 after the search result -->
|
304 |
<reference name="content">
|
305 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.search" after="-"
|
306 |
+
template="nostotagging/pagetype.phtml">
|
307 |
+
<action method="setData">
|
308 |
+
<name>page_type</name>
|
309 |
+
<value>search</value>
|
310 |
+
</action>
|
311 |
+
</block>
|
312 |
<block type="nosto_tagging/element" name="nosto.page.search1" before="search.result"
|
313 |
template="nostotagging/element.phtml">
|
314 |
<action method="setData">
|
332 |
<!-- 404 Not found page -->
|
333 |
<cms_index_noroute>
|
334 |
<reference name="content">
|
335 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.notfound" after="-"
|
336 |
+
template="nostotagging/pagetype.phtml">
|
337 |
+
<action method="setData">
|
338 |
+
<name>page_type</name>
|
339 |
+
<value>notfound</value>
|
340 |
+
</action>
|
341 |
+
</block>
|
342 |
<block type="nosto_tagging/element" name="nosto.page.notfound1" after="-"
|
343 |
template="nostotagging/element.phtml">
|
344 |
<action method="setData">
|
366 |
<!-- Order confirmation page -->
|
367 |
<checkout_onepage_success>
|
368 |
<reference name="content">
|
369 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.order" after="-"
|
370 |
+
template="nostotagging/pagetype.phtml">
|
371 |
+
<action method="setData">
|
372 |
+
<name>page_type</name>
|
373 |
+
<value>order</value>
|
374 |
+
</action>
|
375 |
+
</block>
|
376 |
<block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="-"
|
377 |
template="nostotagging/element.phtml">
|
378 |
<action method="setData">
|
389 |
</block>
|
390 |
</reference>
|
391 |
</checkout_onepage_success>
|
392 |
+
|
393 |
+
<!-- Klarna Order confirmation page -->
|
394 |
+
<checkout_klarna_success>
|
395 |
+
<reference name="content">
|
396 |
+
<block type="nosto_tagging/pagetype" name="nosto.page.type.order" after="-"
|
397 |
+
template="nostotagging/pagetype.phtml">
|
398 |
+
<action method="setData">
|
399 |
+
<name>page_type</name>
|
400 |
+
<value>order</value>
|
401 |
+
</action>
|
402 |
+
</block>
|
403 |
+
<block type="nosto_tagging/element" name="nosto.page.orderconfirmation1" after="checkout"
|
404 |
+
template="nostotagging/element.phtml">
|
405 |
+
<action method="setData">
|
406 |
+
<name>div_id</name>
|
407 |
+
<value>thankyou-nosto-1</value>
|
408 |
+
</action>
|
409 |
+
</block>
|
410 |
+
<block type="nosto_tagging/element" name="nosto.page.orderconfirmation2" after="nosto.page.orderconfirmation1"
|
411 |
+
template="nostotagging/element.phtml">
|
412 |
+
<action method="setData">
|
413 |
+
<name>div_id</name>
|
414 |
+
<value>thankyou-nosto-2</value>
|
415 |
+
</action>
|
416 |
+
</block>
|
417 |
+
</reference>
|
418 |
+
</checkout_klarna_success>
|
419 |
</layout>
|
app/design/frontend/base/default/template/nostotagging/addtocart.phtml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,31 +11,39 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
|
|
|
|
|
32 |
?>
|
33 |
<!-- Nosto `add-to-cart` Script -->
|
34 |
<script type="text/javascript">
|
35 |
if (typeof Nosto === "undefined") {
|
36 |
-
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
|
|
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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="
|
41 |
-
<span class="
|
42 |
-
<span class="
|
|
|
|
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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 |
-
|
36 |
-
|
37 |
-
|
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-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
/**
|
29 |
* @var $this Nosto_Tagging_Block_Embed
|
30 |
*/
|
31 |
?>
|
32 |
<!-- Nosto Tagging Script -->
|
33 |
+
<?php if ($this->getServerAddress() && $this->getAccountName()): ?>
|
34 |
+
<script type="text/javascript" src="//<?php echo $this->getServerAddress() ?>/include/<?php echo $this->getAccountName(); ?>" async></script>
|
35 |
+
<?php endif; ?>
|
|
|
|
|
|
app/design/frontend/base/default/template/nostotagging/jsstub.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
+
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto Solutions Ltd (http://www.nosto.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var $this Mage_Core_Block_Template
|
30 |
+
*/
|
31 |
+
?>
|
32 |
+
<!-- Nosto Javascript Stub -->
|
33 |
+
<script type="text/javascript">
|
34 |
+
(function(){var name="nostojs";window[name]=window[name]||function(cb){(window[name].q=window[name].q||[]).push(cb);};})();
|
35 |
+
</script>
|
app/design/frontend/base/default/template/nostotagging/meta.phtml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Magento
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
@@ -11,22 +11,20 @@
|
|
11 |
* If you did not receive a copy of the license and are unable to
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
* DISCLAIMER
|
16 |
-
*
|
17 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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-2017 Nosto 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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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
|
32 |
* @var $nostoHelper Nosto_Tagging_Helper_Data
|
33 |
*/
|
34 |
-
$category = $this->getCurrentCategory();
|
35 |
$nostoHelper = Mage::helper('nosto_tagging');
|
36 |
?>
|
37 |
|
38 |
-
<div class="
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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
@@ -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
|
22 |
-
* @package
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
-
* @copyright Copyright (c) 2013-
|
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,17 @@ $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 (
|
69 |
-
<span class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
<?php endif; ?>
|
71 |
</div>
|
72 |
<?php if ($this->getCurrentCategory()): ?>
|
18 |
* versions in the future. If you wish to customize Magento for your
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
+
* @category Nosto
|
22 |
+
* @package Nosto_Tagging
|
23 |
* @author Nosto Solutions Ltd <magento@nosto.com>
|
24 |
+
* @copyright Copyright (c) 2013-2017 Nosto 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 |
+
<?php foreach ($product->getAlternateImageUrls() as $alternateImageUrl): ?>
|
70 |
+
<span class="alternate_image_url"><?php echo $helper->escapeHtml($alternateImageUrl); ?></span>
|
71 |
+
<?php endforeach; ?>
|
72 |
+
<?php if ($product->getReviewCount()): ?>
|
73 |
+
<span class="review_count"><?php echo $helper->escapeHtml($product->getReviewCount()); ?></span>
|
74 |
+
<?php endif; ?>
|
75 |
+
<?php if ($product->getRatingValue()): ?>
|
76 |
+
<span class="rating_value"><?php echo $helper->escapeHtml($product->getRatingValue()); ?></span>
|
77 |
<?php endif; ?>
|
78 |
</div>
|
79 |
<?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-
|
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-2017 Nosto 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-2017 Nosto 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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
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-2017 Nosto 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:
|
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)
|
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
|
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 |
-
$
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
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
|
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('
|
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 |
-
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
foreach (NostoApiToken::getApiTokenNames() as $name) {
|
217 |
-
|
218 |
-
|
219 |
-
$foundTokens++;
|
220 |
-
break;
|
221 |
-
}
|
222 |
}
|
223 |
}
|
224 |
-
return
|
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 |
-
|
|
|
|
|
256 |
}
|
257 |
|
258 |
/**
|
@@ -309,4 +333,20 @@ class NostoAccount extends NostoObject implements NostoAccountInterface, NostoVa
|
|
309 |
}
|
310 |
}
|
311 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
110 |
$params['api_tokens'][] = 'api_'.$name;
|
111 |
}
|
112 |
|
113 |
+
if ($meta->getDetails()) {
|
114 |
+
$params['details'] = $meta->getDetails();
|
115 |
+
}
|
116 |
+
|
117 |
+
$params['use_exchange_rates'] = $meta->getUseCurrencyExchangeRates();
|
118 |
+
if ($meta->getDefaultVariationId()) {
|
119 |
+
$params['default_variant_id'] = $meta->getDefaultVariationId();
|
120 |
+
}
|
121 |
+
|
122 |
$request = new NostoApiRequest();
|
123 |
$request->setPath(NostoApiRequest::PATH_SIGN_UP);
|
124 |
$request->setReplaceParams(array('{lang}' => $meta->getLanguageCode()));
|
126 |
$request->setAuthBasic('', $meta->getSignUpApiToken());
|
127 |
$response = $request->post(json_encode($params));
|
128 |
|
129 |
+
/* In case of no result we have not been able to make the API call */
|
130 |
if ($response->getCode() !== 200) {
|
131 |
+
Nosto::throwHttpException('Failed to create Nosto account', $request, $response);
|
132 |
}
|
133 |
|
134 |
$account = new self($meta->getPlatform().'-'.$meta->getName());
|
222 |
if (empty($this->tokens)) {
|
223 |
return false;
|
224 |
}
|
225 |
+
foreach (NostoApiToken::getMandatoryApiTokenNames() as $name) {
|
226 |
+
if ($this->getApiToken($name) === null) {
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
return true;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* @inheritdoc
|
235 |
+
*/
|
236 |
+
public function hasMissingTokens()
|
237 |
+
{
|
238 |
+
if (empty($this->tokens)) {
|
239 |
+
return true;
|
240 |
+
}
|
241 |
foreach (NostoApiToken::getApiTokenNames() as $name) {
|
242 |
+
if ($this->getApiToken($name) === null) {
|
243 |
+
return true;
|
|
|
|
|
|
|
244 |
}
|
245 |
}
|
246 |
+
return false;
|
247 |
}
|
248 |
|
249 |
/**
|
274 |
*/
|
275 |
public function getIframeUrl(NostoAccountMetaDataIframeInterface $meta, array $params = array())
|
276 |
{
|
277 |
+
/* @var $iframeHelper NostoHelperIframe */
|
278 |
+
$iframeHelper = Nosto::helper('iframe');
|
279 |
+
return $iframeHelper->getUrl($meta, $this, $params);
|
280 |
}
|
281 |
|
282 |
/**
|
333 |
}
|
334 |
}
|
335 |
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* @inheritdoc
|
339 |
+
*/
|
340 |
+
public function getMissingTokens()
|
341 |
+
{
|
342 |
+
$allTokens = NostoApiToken::getApiTokenNames();
|
343 |
+
$missingTokens = array();
|
344 |
+
foreach ($allTokens as $token) {
|
345 |
+
if (!$this->getApiToken($token)) {
|
346 |
+
$missingTokens[] = $token;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
return $missingTokens;
|
351 |
+
}
|
352 |
}
|
lib/nosto/php-sdk/src/classes/NostoAccountMeta.php
CHANGED
@@ -1,26 +1,37 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
|
|
4 |
*
|
5 |
-
*
|
|
|
6 |
*
|
7 |
-
*
|
8 |
-
*
|
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 |
-
*
|
|
|
|
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
307 |
*
|
308 |
* @return string
|
309 |
*/
|
|
|
|
|
|
|
|
|
|
|
310 |
/**
|
|
|
|
|
311 |
* @return string
|
312 |
*/
|
313 |
-
public function
|
314 |
{
|
315 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
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
|
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 |
-
*
|
|
|
4 |
*
|
5 |
-
*
|
|
|
6 |
*
|
7 |
-
*
|
8 |
-
*
|
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 |
-
*
|
|
|
|
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
lib/nosto/php-sdk/src/classes/NostoNotification.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Implementation for NostoNotificationInterface
|
39 |
+
*/
|
40 |
+
class NostoNotification implements NostoNotificationInterface
|
41 |
+
{
|
42 |
+
/*
|
43 |
+
* @var int|string unique id of the store
|
44 |
+
*/
|
45 |
+
protected $storeId;
|
46 |
+
|
47 |
+
/*
|
48 |
+
* @var string the name of the store
|
49 |
+
*/
|
50 |
+
protected $storeName;
|
51 |
+
|
52 |
+
/*
|
53 |
+
* @var int|string unique id of language
|
54 |
+
*/
|
55 |
+
protected $languageId;
|
56 |
+
|
57 |
+
/*
|
58 |
+
* @var string the name of the langue
|
59 |
+
*/
|
60 |
+
protected $languageName;
|
61 |
+
|
62 |
+
/*
|
63 |
+
* @var string notification message
|
64 |
+
*/
|
65 |
+
protected $message;
|
66 |
+
|
67 |
+
/*
|
68 |
+
* @var int type of the notification
|
69 |
+
* @see NostoNotificationInterface::TYPE_* constants
|
70 |
+
*/
|
71 |
+
protected $notificationType;
|
72 |
+
|
73 |
+
/*
|
74 |
+
* @var int severity of the notification
|
75 |
+
* @see NostoNotificationInterface::SEVERITY_* constants
|
76 |
+
*/
|
77 |
+
protected $notificationSeverity;
|
78 |
+
|
79 |
+
/*
|
80 |
+
* @var array of attributes required by the message
|
81 |
+
*/
|
82 |
+
protected $messageAttributes;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @inheritdoc
|
86 |
+
*/
|
87 |
+
public function getStoreId()
|
88 |
+
{
|
89 |
+
return $this->storeId;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Setter for store id
|
94 |
+
*
|
95 |
+
* @param int|string $storeId
|
96 |
+
*/
|
97 |
+
public function setStoreId($storeId)
|
98 |
+
{
|
99 |
+
$this->storeId = $storeId;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @inheritdoc
|
104 |
+
*/
|
105 |
+
public function getStoreName()
|
106 |
+
{
|
107 |
+
return $this->storeName;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Setter for store name
|
112 |
+
*
|
113 |
+
* @param string $storeName
|
114 |
+
*/
|
115 |
+
public function setStoreName($storeName)
|
116 |
+
{
|
117 |
+
$this->storeName = $storeName;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @inheritdoc
|
122 |
+
*/
|
123 |
+
public function getLanguageId()
|
124 |
+
{
|
125 |
+
return $this->languageId;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Setter for language id
|
130 |
+
*
|
131 |
+
* @param int/string $languageId
|
132 |
+
*/
|
133 |
+
public function setLanguageId($languageId)
|
134 |
+
{
|
135 |
+
$this->languageId = $languageId;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @inheritdoc
|
140 |
+
*/
|
141 |
+
public function getLanguageName()
|
142 |
+
{
|
143 |
+
return $this->languageName;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Setter for language name
|
148 |
+
* @param string $languageName
|
149 |
+
*/
|
150 |
+
public function setLanguageName($languageName)
|
151 |
+
{
|
152 |
+
$this->languageName = $languageName;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @inheritdoc
|
157 |
+
*/
|
158 |
+
public function getMessage()
|
159 |
+
{
|
160 |
+
return $this->message;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Setter for message
|
165 |
+
*
|
166 |
+
* @param mixed $message
|
167 |
+
*/
|
168 |
+
public function setMessage($message)
|
169 |
+
{
|
170 |
+
$this->message = $message;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @inheritdoc
|
175 |
+
*/
|
176 |
+
public function getNotificationType()
|
177 |
+
{
|
178 |
+
return $this->notificationType;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Setter for notification type
|
183 |
+
*
|
184 |
+
* @see NostoNotificationInterface::TYPE_*
|
185 |
+
* @param int $notificationType
|
186 |
+
*/
|
187 |
+
public function setNotificationType($notificationType)
|
188 |
+
{
|
189 |
+
$this->notificationType = $notificationType;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @inheritdoc
|
194 |
+
*/
|
195 |
+
public function getNotificationSeverity()
|
196 |
+
{
|
197 |
+
return $this->notificationSeverity;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Setter for notification severity
|
202 |
+
*
|
203 |
+
* @see NostoNotificationInterface::SEVERITY_*
|
204 |
+
* @param mixed $notificationSeverity
|
205 |
+
*/
|
206 |
+
public function setNotificationSeverity($notificationSeverity)
|
207 |
+
{
|
208 |
+
$this->notificationSeverity = $notificationSeverity;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @inheritdoc
|
213 |
+
*/
|
214 |
+
public function getMessageAttributes()
|
215 |
+
{
|
216 |
+
return $this->messageAttributes;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Sets all message attributes
|
221 |
+
*
|
222 |
+
* @param array $messageAttributes
|
223 |
+
*/
|
224 |
+
public function setMessageAttributes(array $messageAttributes)
|
225 |
+
{
|
226 |
+
$this->messageAttributes = $messageAttributes;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Adds a message attribute
|
231 |
+
*
|
232 |
+
* @param int|string $messageAttribute
|
233 |
+
* @throws NostoException
|
234 |
+
*/
|
235 |
+
public function addMessageAttribute($messageAttribute)
|
236 |
+
{
|
237 |
+
if (!is_scalar($messageAttribute)) {
|
238 |
+
throw new NostoException('Message attribute must be a scalar value');
|
239 |
+
}
|
240 |
+
$this->messageAttributes[] = $messageAttribute;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Returns formatted message
|
245 |
+
*
|
246 |
+
* @return string
|
247 |
+
*/
|
248 |
+
public function formatMessage()
|
249 |
+
{
|
250 |
+
return vsprintf(
|
251 |
+
$this->getMessage(),
|
252 |
+
$this->getMessageAttributes()
|
253 |
+
);
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoObject.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
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)
|
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
|
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(
|
|
|
|
|
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)
|
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
|
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 $
|
45 |
|
46 |
/**
|
47 |
* @var array map of validation errors per attribute.
|
48 |
*/
|
49 |
-
private $
|
50 |
|
51 |
/**
|
52 |
* Constructor.
|
@@ -56,7 +57,7 @@ class NostoValidator
|
|
56 |
*/
|
57 |
public function __construct(NostoValidatableInterface $object)
|
58 |
{
|
59 |
-
$this->
|
60 |
}
|
61 |
|
62 |
/**
|
@@ -67,7 +68,7 @@ class NostoValidator
|
|
67 |
*/
|
68 |
public function validate()
|
69 |
{
|
70 |
-
foreach ($this->
|
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->
|
95 |
}
|
96 |
|
97 |
/**
|
@@ -101,7 +102,7 @@ class NostoValidator
|
|
101 |
*/
|
102 |
public function getErrors()
|
103 |
{
|
104 |
-
return $this->
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -112,10 +113,10 @@ class NostoValidator
|
|
112 |
*/
|
113 |
protected function addError($attribute, $message)
|
114 |
{
|
115 |
-
if (!isset($this->
|
116 |
-
$this->
|
117 |
}
|
118 |
-
$this->
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -127,7 +128,7 @@ class NostoValidator
|
|
127 |
protected function validateRequired(array $properties)
|
128 |
{
|
129 |
foreach ($properties as $property) {
|
130 |
-
$value = $this->
|
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->
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -47,42 +48,7 @@ class NostoExportProductCollection extends NostoProductCollection implements Nos
|
|
47 |
$array = array();
|
48 |
/** @var NostoProductInterface $item */
|
49 |
foreach ($this->getArrayCopy() as $item) {
|
50 |
-
$
|
51 |
-
'url' => $item->getUrl(),
|
52 |
-
'product_id' => $item->getProductId(),
|
53 |
-
'name' => $item->getName(),
|
54 |
-
'image_url' => $item->getImageUrl(),
|
55 |
-
'price' => Nosto::helper('price')->format($item->getPrice()),
|
56 |
-
'price_currency_code' => strtoupper($item->getCurrencyCode()),
|
57 |
-
'availability' => $item->getAvailability(),
|
58 |
-
'categories' => $item->getCategories(),
|
59 |
-
);
|
60 |
-
|
61 |
-
// Optional properties.
|
62 |
-
|
63 |
-
if ($item->getFullDescription()) {
|
64 |
-
$data['description'] = $item->getFullDescription();
|
65 |
-
}
|
66 |
-
if ($item->getListPrice()) {
|
67 |
-
$data['list_price'] = Nosto::helper('price')->format($item->getListPrice());
|
68 |
-
}
|
69 |
-
if ($item->getBrand()) {
|
70 |
-
$data['brand'] = $item->getBrand();
|
71 |
-
}
|
72 |
-
foreach ($item->getTags() as $type => $tags) {
|
73 |
-
if (is_array($tags) && count($tags) > 0) {
|
74 |
-
$data[$type] = $tags;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
if ($item->getDatePublished()) {
|
78 |
-
$data['date_published'] = Nosto::helper('date')->format($item->getDatePublished());
|
79 |
-
}
|
80 |
-
|
81 |
-
if ($item->getVariationId()) {
|
82 |
-
$data['variation_id'] = $item->getVariationId();
|
83 |
-
}
|
84 |
-
|
85 |
-
$array[] = $data;
|
86 |
}
|
87 |
return json_encode($array);
|
88 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
48 |
$array = array();
|
49 |
/** @var NostoProductInterface $item */
|
50 |
foreach ($this->getArrayCopy() as $item) {
|
51 |
+
$array[] = NostoOperationProduct::getProductAsArray($item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
return json_encode($array);
|
54 |
}
|
lib/nosto/php-sdk/src/classes/export/NostoExporter.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -53,27 +54,35 @@ class NostoHelperIframe extends NostoHelper
|
|
53 |
*/
|
54 |
public function getUrl(
|
55 |
NostoAccountMetaDataIframeInterface $meta,
|
56 |
-
|
57 |
array $params = array()
|
58 |
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
$queryParams = http_build_query(
|
60 |
array_merge(
|
61 |
-
|
62 |
-
'lang' => strtolower($meta->getLanguageIsoCode()),
|
63 |
-
'ps_version' => $meta->getVersionPlatform(),
|
64 |
-
'nt_version' => $meta->getVersionModule(),
|
65 |
-
'product_pu' => $meta->getPreviewUrlProduct(),
|
66 |
-
'category_pu' => $meta->getPreviewUrlCategory(),
|
67 |
-
'search_pu' => $meta->getPreviewUrlSearch(),
|
68 |
-
'cart_pu' => $meta->getPreviewUrlCart(),
|
69 |
-
'front_pu' => $meta->getPreviewUrlFront(),
|
70 |
-
'shop_lang' => strtolower($meta->getLanguageIsoCodeShop()),
|
71 |
-
'shop_name' => $meta->getShopName(),
|
72 |
-
'unique_id' => $meta->getUniqueId(),
|
73 |
-
'fname' => $meta->getFirstName(),
|
74 |
-
'lname' => $meta->getLastName(),
|
75 |
-
'email' => $meta->getEmail(),
|
76 |
-
),
|
77 |
$params
|
78 |
)
|
79 |
);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
54 |
*/
|
55 |
public function getUrl(
|
56 |
NostoAccountMetaDataIframeInterface $meta,
|
57 |
+
NostoAccountInterface $account = null,
|
58 |
array $params = array()
|
59 |
) {
|
60 |
+
$defaultParameters = array(
|
61 |
+
'lang' => strtolower($meta->getLanguageIsoCode()),
|
62 |
+
'ps_version' => $meta->getVersionPlatform(),
|
63 |
+
'nt_version' => $meta->getVersionModule(),
|
64 |
+
'product_pu' => $meta->getPreviewUrlProduct(),
|
65 |
+
'category_pu' => $meta->getPreviewUrlCategory(),
|
66 |
+
'search_pu' => $meta->getPreviewUrlSearch(),
|
67 |
+
'cart_pu' => $meta->getPreviewUrlCart(),
|
68 |
+
'front_pu' => $meta->getPreviewUrlFront(),
|
69 |
+
'shop_lang' => strtolower($meta->getLanguageIsoCodeShop()),
|
70 |
+
'shop_name' => $meta->getShopName(),
|
71 |
+
'unique_id' => $meta->getUniqueId(),
|
72 |
+
'fname' => $meta->getFirstName(),
|
73 |
+
'lname' => $meta->getLastName(),
|
74 |
+
'email' => $meta->getEmail(),
|
75 |
+
'modules' => $meta->getModules(),
|
76 |
+
);
|
77 |
+
if ($account instanceof NostoAccountInterface) {
|
78 |
+
$missingScopes = $account->getMissingTokens();
|
79 |
+
if (!empty($missingScopes)) {
|
80 |
+
$defaultParameters['missing_scopes'] = implode(',', $missingScopes);
|
81 |
+
}
|
82 |
+
}
|
83 |
$queryParams = http_build_query(
|
84 |
array_merge(
|
85 |
+
$defaultParameters,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$params
|
87 |
)
|
88 |
);
|
lib/nosto/php-sdk/src/classes/helper/NostoHelperPrice.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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
|
45 |
* @return string the formatted price.
|
46 |
*/
|
47 |
public function format($price)
|
48 |
{
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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 |
-
|
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)
|
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
|
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)
|
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
|
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 $
|
60 |
|
61 |
/**
|
62 |
* Constructor.
|
@@ -117,7 +118,7 @@ class NostoHttpResponse
|
|
117 |
*/
|
118 |
public function getCode()
|
119 |
{
|
120 |
-
if (is_null($this->
|
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->
|
132 |
}
|
133 |
-
return $this->
|
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)
|
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
|
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)
|
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
|
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 |
-
|
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 |
-
|
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 |
-
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -180,32 +181,34 @@ class NostoOperationProduct
|
|
180 |
* 'tag1' => array('Men'),
|
181 |
* 'tag2' => array('Foldable'),
|
182 |
* 'tag3' => array('Brown', 'Black', 'Orange'),
|
183 |
-
* 'date_published' => '2011-12-31'
|
184 |
* )
|
185 |
*
|
186 |
* @param NostoProductInterface $product the object.
|
187 |
* @return array the newly created array.
|
188 |
*/
|
189 |
-
|
190 |
{
|
|
|
|
|
191 |
$data = array(
|
192 |
'url' => $product->getUrl(),
|
193 |
'product_id' => $product->getProductId(),
|
194 |
'name' => $product->getName(),
|
195 |
'image_url' => $product->getImageUrl(),
|
196 |
-
'price' =>
|
197 |
'price_currency_code' => strtoupper($product->getCurrencyCode()),
|
198 |
'availability' => $product->getAvailability(),
|
199 |
'categories' => $product->getCategories(),
|
200 |
);
|
201 |
|
202 |
// Optional properties.
|
203 |
-
|
204 |
if ($product->getFullDescription()) {
|
205 |
$data['description'] = $product->getFullDescription();
|
206 |
}
|
207 |
if ($product->getListPrice()) {
|
208 |
-
$data['list_price'] =
|
|
|
|
|
209 |
}
|
210 |
if ($product->getBrand()) {
|
211 |
$data['brand'] = $product->getBrand();
|
@@ -215,12 +218,54 @@ class NostoOperationProduct
|
|
215 |
$data[$type] = $tags;
|
216 |
}
|
217 |
}
|
218 |
-
if ($product->getDatePublished()) {
|
219 |
-
$data['date_published'] = Nosto::helper('date')->format($product->getDatePublished());
|
220 |
-
}
|
221 |
if ($product->getVariationId()) {
|
222 |
$data['variation_id'] = $product->getVariationId();
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
return $data;
|
226 |
}
|
@@ -238,7 +283,7 @@ class NostoOperationProduct
|
|
238 |
/** @var NostoProductInterface|NostoValidatableInterface $item */
|
239 |
$validator = new NostoValidator($item);
|
240 |
if ($validator->validate()) {
|
241 |
-
$data[] =
|
242 |
}
|
243 |
}
|
244 |
if (empty($data)) {
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
181 |
* 'tag1' => array('Men'),
|
182 |
* 'tag2' => array('Foldable'),
|
183 |
* 'tag3' => array('Brown', 'Black', 'Orange'),
|
|
|
184 |
* )
|
185 |
*
|
186 |
* @param NostoProductInterface $product the object.
|
187 |
* @return array the newly created array.
|
188 |
*/
|
189 |
+
public static function getProductAsArray(NostoProductInterface $product)
|
190 |
{
|
191 |
+
/* @var NostoHelperPrice $nostoPriceHelper */
|
192 |
+
$nostoPriceHelper = Nosto::helper('price');
|
193 |
$data = array(
|
194 |
'url' => $product->getUrl(),
|
195 |
'product_id' => $product->getProductId(),
|
196 |
'name' => $product->getName(),
|
197 |
'image_url' => $product->getImageUrl(),
|
198 |
+
'price' => $nostoPriceHelper->format($product->getPrice()),
|
199 |
'price_currency_code' => strtoupper($product->getCurrencyCode()),
|
200 |
'availability' => $product->getAvailability(),
|
201 |
'categories' => $product->getCategories(),
|
202 |
);
|
203 |
|
204 |
// Optional properties.
|
|
|
205 |
if ($product->getFullDescription()) {
|
206 |
$data['description'] = $product->getFullDescription();
|
207 |
}
|
208 |
if ($product->getListPrice()) {
|
209 |
+
$data['list_price'] = $nostoPriceHelper->format(
|
210 |
+
$product->getListPrice()
|
211 |
+
);
|
212 |
}
|
213 |
if ($product->getBrand()) {
|
214 |
$data['brand'] = $product->getBrand();
|
218 |
$data[$type] = $tags;
|
219 |
}
|
220 |
}
|
|
|
|
|
|
|
221 |
if ($product->getVariationId()) {
|
222 |
$data['variation_id'] = $product->getVariationId();
|
223 |
}
|
224 |
+
if ($product->getSupplierCost()) {
|
225 |
+
$data['supplier_cost'] = $nostoPriceHelper->format(
|
226 |
+
$product->getSupplierCost()
|
227 |
+
);
|
228 |
+
}
|
229 |
+
if ($product->getInventoryLevel()) {
|
230 |
+
$data['inventory_level'] = $product->getInventoryLevel();
|
231 |
+
}
|
232 |
+
if ($product->getReviewCount()) {
|
233 |
+
$data['review_count'] = $product->getReviewCount();
|
234 |
+
}
|
235 |
+
if ($product->getRatingValue()) {
|
236 |
+
$data['rating_value'] = $product->getRatingValue();
|
237 |
+
}
|
238 |
+
if (
|
239 |
+
is_array($product->getAlternateImageUrls())
|
240 |
+
&& count($product->getAlternateImageUrls() > 0)
|
241 |
+
) {
|
242 |
+
$data['alternate_image_urls'] = $product->getAlternateImageUrls();
|
243 |
+
}
|
244 |
+
if ($product->getCondition()) {
|
245 |
+
$data['condition'] = $product->getCondition();
|
246 |
+
}
|
247 |
+
if ($product->getGender()) {
|
248 |
+
$data['gender'] = $product->getGender();
|
249 |
+
}
|
250 |
+
if ($product->getAgeGroup()) {
|
251 |
+
$data['age_group'] = $product->getAgeGroup();
|
252 |
+
}
|
253 |
+
if ($product->getGtin()) {
|
254 |
+
$data['gtin'] = $product->getGtin();
|
255 |
+
}
|
256 |
+
if ($product->getGoogleCategory()) {
|
257 |
+
$data['google_category'] = $product->getGoogleCategory();
|
258 |
+
}
|
259 |
+
if ($product->getUnitPricingMeasure()) {
|
260 |
+
$data['unit_pricing_measure'] = $product->getUnitPricingMeasure();
|
261 |
+
}
|
262 |
+
if ($product->getUnitPricingBaseMeasure()) {
|
263 |
+
$data['unit_pricing_base_measure']
|
264 |
+
= $product->getUnitPricingBaseMeasure();
|
265 |
+
}
|
266 |
+
if ($product->getUnitPricingUnit()) {
|
267 |
+
$data['unit_pricing_unit'] = $product->getUnitPricingUnit();
|
268 |
+
}
|
269 |
|
270 |
return $data;
|
271 |
}
|
283 |
/** @var NostoProductInterface|NostoValidatableInterface $item */
|
284 |
$validator = new NostoValidator($item);
|
285 |
if ($validator->validate()) {
|
286 |
+
$data[] = self::getProductAsArray($item);
|
287 |
}
|
288 |
}
|
289 |
if (empty($data)) {
|
lib/nosto/php-sdk/src/config.inc.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
// Interfaces
|
@@ -50,6 +51,7 @@ require_once(dirname(__FILE__).'/interfaces/NostoProductInterface.php');
|
|
50 |
require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
|
51 |
require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
|
52 |
require_once(dirname(__FILE__).'/interfaces/NostoExchangeRateInterface.php');
|
|
|
53 |
|
54 |
// Classes
|
55 |
require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
|
@@ -65,6 +67,8 @@ require_once(dirname(__FILE__).'/classes/collection/NostoExchangeRateCollection.
|
|
65 |
|
66 |
require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
|
67 |
require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
|
|
|
|
|
68 |
|
69 |
require_once(dirname(__FILE__).'/classes/export/NostoExporter.php');
|
70 |
require_once(dirname(__FILE__).'/classes/export/NostoExportProductCollection.php');
|
@@ -102,6 +106,7 @@ require_once(dirname(__FILE__).'/classes/NostoCurrencyCode.php');
|
|
102 |
require_once(dirname(__FILE__).'/classes/NostoCurrencySymbol.php');
|
103 |
require_once(dirname(__FILE__).'/classes/NostoCurrencyFormat.php');
|
104 |
require_once(dirname(__FILE__).'/classes/NostoCurrencyInfo.php');
|
|
|
105 |
|
106 |
// Libs
|
107 |
require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
// Interfaces
|
51 |
require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
|
52 |
require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
|
53 |
require_once(dirname(__FILE__).'/interfaces/NostoExchangeRateInterface.php');
|
54 |
+
require_once(dirname(__FILE__).'/interfaces/NostoNotificationInterface.php');
|
55 |
|
56 |
// Classes
|
57 |
require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
|
67 |
|
68 |
require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
|
69 |
require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
|
70 |
+
require_once(dirname(__FILE__).'/classes/exception/NostoHttpResponseException.php');
|
71 |
+
require_once(dirname(__FILE__).'/classes/exception/NostoApiResponseException.php');
|
72 |
|
73 |
require_once(dirname(__FILE__).'/classes/export/NostoExporter.php');
|
74 |
require_once(dirname(__FILE__).'/classes/export/NostoExportProductCollection.php');
|
106 |
require_once(dirname(__FILE__).'/classes/NostoCurrencySymbol.php');
|
107 |
require_once(dirname(__FILE__).'/classes/NostoCurrencyFormat.php');
|
108 |
require_once(dirname(__FILE__).'/classes/NostoCurrencyInfo.php');
|
109 |
+
require_once(dirname(__FILE__).'/classes/NostoNotification.php');
|
110 |
|
111 |
// Libs
|
112 |
require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
|
lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
lib/nosto/php-sdk/src/interfaces/NostoNotificationInterface.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 2013-2016 Nosto Solutions Ltd
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to contact@nosto.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
18 |
+
* versions in the future. If you wish to customize PrestaShop for your
|
19 |
+
* needs please refer to http://www.prestashop.com for more information.
|
20 |
+
*
|
21 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
22 |
+
* @copyright 2013-2016 Nosto Solutions Ltd
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Interface for Nosto notification.
|
28 |
+
* The client implements the "Authorization Code" OAuth2 spec.
|
29 |
+
* @see https://tools.ietf.org/html/rfc6749
|
30 |
+
*/
|
31 |
+
interface NostoNotificationInterface
|
32 |
+
{
|
33 |
+
/*
|
34 |
+
* Notification severities
|
35 |
+
*/
|
36 |
+
const SEVERITY_INFO = 'info';
|
37 |
+
const SEVERITY_WARNING = 'warning';
|
38 |
+
const SEVERITY_ERROR = 'error';
|
39 |
+
|
40 |
+
/*
|
41 |
+
* Notification types
|
42 |
+
*/
|
43 |
+
const TYPE_MISSING_INSTALLATION = 'missing_installation';
|
44 |
+
const TYPE_MISSING_TOKENS = 'missing_tokens';
|
45 |
+
const TYPE_MULTI_CURRENCY_DISABLED = 'multi_currency_disabled';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* The id of the store
|
49 |
+
*
|
50 |
+
* @return string|int the client id.
|
51 |
+
*/
|
52 |
+
public function getStoreId();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* The name of the store.
|
56 |
+
*
|
57 |
+
* @return string the client secret.
|
58 |
+
*/
|
59 |
+
public function getStoreName();
|
60 |
+
|
61 |
+
/**
|
62 |
+
* The id of the language
|
63 |
+
*
|
64 |
+
* @return string|int
|
65 |
+
*/
|
66 |
+
public function getLanguageId();
|
67 |
+
|
68 |
+
/**
|
69 |
+
* The name of the language.
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function getLanguageName();
|
74 |
+
|
75 |
+
/**
|
76 |
+
* The notification message.
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getMessage();
|
81 |
+
|
82 |
+
/**
|
83 |
+
* The message attributes for sprintf. Array must contain only scalar values.
|
84 |
+
*
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public function getMessageAttributes();
|
88 |
+
|
89 |
+
/**
|
90 |
+
* The notification type
|
91 |
+
*
|
92 |
+
* For return values
|
93 |
+
* @see self::TYPE_*
|
94 |
+
*
|
95 |
+
* @return int
|
96 |
+
*/
|
97 |
+
public function getNotificationType();
|
98 |
+
|
99 |
+
/**
|
100 |
+
* The notification severity
|
101 |
+
*
|
102 |
+
* For return values
|
103 |
+
* @see self::SEVERITY_*
|
104 |
+
*
|
105 |
+
* @return int
|
106 |
+
*/
|
107 |
+
public function getNotificationSeverity();
|
108 |
+
}
|
lib/nosto/php-sdk/src/interfaces/NostoOAuthClientMetaDataInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -39,6 +40,12 @@
|
|
39 |
*/
|
40 |
interface NostoProductInterface
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Returns the absolute url to the product page in the shop frontend.
|
44 |
*
|
@@ -139,16 +146,103 @@ interface NostoProductInterface
|
|
139 |
public function getBrand();
|
140 |
|
141 |
/**
|
142 |
-
* Returns the product
|
143 |
*
|
144 |
-
* @return
|
145 |
*/
|
146 |
-
public function
|
147 |
|
148 |
/**
|
149 |
-
* Returns the
|
150 |
*
|
151 |
-
* @return
|
152 |
*/
|
153 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
40 |
*/
|
41 |
interface NostoProductInterface
|
42 |
{
|
43 |
+
const IN_STOCK = 'InStock';
|
44 |
+
const OUT_OF_STOCK = 'OutOfStock';
|
45 |
+
const INVISIBLE = 'Invisible';
|
46 |
+
const DISCONTINUED = 'Discontinued';
|
47 |
+
const ADD_TO_CART = 'add-to-cart';
|
48 |
+
|
49 |
/**
|
50 |
* Returns the absolute url to the product page in the shop frontend.
|
51 |
*
|
146 |
public function getBrand();
|
147 |
|
148 |
/**
|
149 |
+
* Returns the product variation id.
|
150 |
*
|
151 |
+
* @return mixed|null
|
152 |
*/
|
153 |
+
public function getVariationId();
|
154 |
|
155 |
/**
|
156 |
+
* Returns the supplier cost
|
157 |
*
|
158 |
+
* @return float|null
|
159 |
*/
|
160 |
+
public function getSupplierCost();
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Returns the inventory level
|
164 |
+
*
|
165 |
+
* @return int|null
|
166 |
+
*/
|
167 |
+
public function getInventoryLevel();
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Returns the count of reviews
|
171 |
+
*
|
172 |
+
* @return int|null
|
173 |
+
*/
|
174 |
+
public function getReviewCount();
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Returns the value of the rating(s)
|
178 |
+
*
|
179 |
+
* @return float|null
|
180 |
+
*/
|
181 |
+
public function getRatingValue();
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Returns the alternative images
|
185 |
+
*
|
186 |
+
* @return array|null
|
187 |
+
*/
|
188 |
+
public function getAlternateImageUrls();
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Returns the condition
|
192 |
+
*
|
193 |
+
* @return string|null
|
194 |
+
*/
|
195 |
+
public function getCondition();
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Returns the gender
|
199 |
+
*
|
200 |
+
* @return string|null
|
201 |
+
*/
|
202 |
+
public function getGender();
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Returns the age group
|
206 |
+
*
|
207 |
+
* @return string|null
|
208 |
+
*/
|
209 |
+
public function getAgeGroup();
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Returns the gtin / barcode
|
213 |
+
*
|
214 |
+
* @return string|null
|
215 |
+
*/
|
216 |
+
public function getGtin();
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Returns the category used for Google's services
|
220 |
+
*
|
221 |
+
* @return string|null
|
222 |
+
*/
|
223 |
+
public function getGoogleCategory();
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Returns the pricing measure of the product. Pricing measure for a 0.33
|
227 |
+
* liter bottle for example is "0.33".
|
228 |
+
*
|
229 |
+
* @return float|null
|
230 |
+
*/
|
231 |
+
public function getUnitPricingMeasure();
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Returns the pricing base measure of the product. Pricing base measure
|
235 |
+
* for a 0.33l bottle is "1".
|
236 |
+
*
|
237 |
+
* @return float|null
|
238 |
+
*/
|
239 |
+
public function getUnitPricingBaseMeasure();
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Returns the pricing unit of the product. Pricing unit for a 0.33l
|
243 |
+
* bottle is "l" (litre).
|
244 |
+
*
|
245 |
+
* @return string|null
|
246 |
+
*/
|
247 |
+
public function getUnitPricingUnit();
|
248 |
}
|
lib/nosto/php-sdk/src/interfaces/NostoValidatableInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -73,12 +74,27 @@ interface NostoAccountInterface
|
|
73 |
public function getName();
|
74 |
|
75 |
/**
|
76 |
-
* Checks if this account has been connected to Nosto,
|
|
|
77 |
*
|
78 |
* @return bool true if it is connected, false otherwise.
|
79 |
*/
|
80 |
public function isConnectedToNosto();
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
/**
|
83 |
* Gets an api token associated with this account by it's name , e.g. "sso".
|
84 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
* All rights reserved.
|
5 |
*
|
6 |
* Redistribution and use in source and binary forms, with or without modification,
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*
|
31 |
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*
|
35 |
*/
|
36 |
|
37 |
/**
|
74 |
public function getName();
|
75 |
|
76 |
/**
|
77 |
+
* Checks if this account has been connected to Nosto,
|
78 |
+
* i.e. all mandatory API tokens exist.
|
79 |
*
|
80 |
* @return bool true if it is connected, false otherwise.
|
81 |
*/
|
82 |
public function isConnectedToNosto();
|
83 |
|
84 |
+
/**
|
85 |
+
* Checks if this account has all API tokens
|
86 |
+
*
|
87 |
+
* @return bool true if some token(s) are missing, false otherwise.
|
88 |
+
*/
|
89 |
+
public function hasMissingTokens();
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Returns the missing API tokens
|
93 |
+
*
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
public function getMissingTokens();
|
97 |
+
|
98 |
/**
|
99 |
* Gets an api token associated with this account by it's name , e.g. "sso".
|
100 |
*
|
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataBillingDetailsInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
33 |
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
|
|
34 |
*/
|
35 |
|
36 |
/**
|
@@ -154,4 +155,11 @@ interface NostoAccountMetaDataIframeInterface
|
|
154 |
* @return string the name.
|
155 |
*/
|
156 |
public function getShopName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
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 |
/**
|
155 |
* @return string the name.
|
156 |
*/
|
157 |
public function getShopName();
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Returns associative array with install modules.
|
161 |
+
*
|
162 |
+
* @return array array(moduleName=1, moduleName=0)
|
163 |
+
*/
|
164 |
+
public function getModules();
|
165 |
}
|
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (c)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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)
|
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
|
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.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="
|
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>-
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>Nosto</name>
|
@@ -16,106 +16,183 @@
|
|
16 |
<email>magento@nosto.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
-
<date>2016-
|
20 |
-
<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="
|
27 |
<dir name="Adminhtml">
|
28 |
-
<file name="Iframe.php" hash="
|
29 |
-
<file name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</dir>
|
31 |
-
<file name="Cart.php" hash="
|
32 |
-
<file name="Category.php" hash="
|
33 |
-
<file name="Customer.php" hash="
|
34 |
-
<file name="Element.php" hash="
|
35 |
-
<file name="Embed.php" hash="
|
36 |
-
<file name="Meta.php" hash="
|
37 |
-
<
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</dir>
|
41 |
<dir name="Helper">
|
42 |
-
<file name="Account.php" hash="
|
43 |
-
<file name="
|
44 |
-
<file name="
|
45 |
-
<file name="
|
46 |
-
<file name="
|
47 |
-
<file name="
|
48 |
-
<file name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
</dir>
|
50 |
<dir name="Model">
|
51 |
-
<file name="Base.php" hash="
|
|
|
|
|
|
|
52 |
<dir name="Container">
|
53 |
-
<file name="Cart.php" hash="
|
54 |
-
<file name="Customer.php" hash="
|
55 |
</dir>
|
56 |
-
<file name="Customer.php" hash="
|
57 |
<dir name="Export">
|
58 |
<dir name="Collection">
|
59 |
-
<file name="Order.php" hash="
|
60 |
</dir>
|
61 |
</dir>
|
62 |
<dir name="Meta">
|
63 |
<dir name="Account">
|
64 |
-
<file name="Billing.php" hash="
|
65 |
-
<file name="Iframe.php" hash="
|
66 |
-
<file name="Owner.php" hash="
|
67 |
</dir>
|
68 |
-
<file name="Account.php" hash="
|
69 |
-
<file name="Oauth.php" hash="
|
70 |
<dir name="Order">
|
71 |
-
<file name="Buyer.php" hash="
|
72 |
-
<file name="Item.php" hash="
|
73 |
-
<file name="Status.php" hash="
|
|
|
|
|
|
|
|
|
|
|
74 |
</dir>
|
75 |
-
<file name="Order.php" hash="
|
76 |
-
<file name="Product.php" hash="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</dir>
|
78 |
-
<file name="Observer.php" hash="
|
79 |
-
<file name="Product.php" hash="
|
80 |
<dir name="Resource">
|
81 |
<dir name="Customer">
|
82 |
-
<file name="Collection.php" hash="
|
83 |
</dir>
|
84 |
-
<file name="Customer.php" hash="
|
85 |
<dir name="Product">
|
86 |
-
<file name="Collection.php" hash="
|
87 |
</dir>
|
88 |
-
<file name="Setup.php" hash="506b08bcb10cbe74e95812c5f646429f"/>
|
89 |
</dir>
|
90 |
<dir name="Service">
|
91 |
-
<file name="Order.php" hash="
|
|
|
92 |
</dir>
|
93 |
<dir name="System">
|
94 |
<dir name="Config">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
<dir name="Source">
|
96 |
-
<file name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
</dir>
|
98 |
</dir>
|
99 |
</dir>
|
100 |
</dir>
|
101 |
-
<file name="bootstrap.php" hash="
|
102 |
<dir name="controllers">
|
103 |
<dir name="Adminhtml">
|
104 |
-
<file name="NostoController.php" hash="
|
105 |
</dir>
|
106 |
-
<file name="ExportController.php" hash="
|
107 |
-
<file name="OauthController.php" hash="
|
108 |
</dir>
|
109 |
<dir name="etc">
|
110 |
-
<file name="adminhtml.xml" hash="
|
111 |
-
<file name="cache.xml" hash="
|
112 |
-
<file name="config.xml" hash="
|
113 |
-
<file name="system.xml" hash="
|
114 |
</dir>
|
115 |
<dir name="sql">
|
|
|
|
|
|
|
|
|
116 |
<dir name="tagging_setup">
|
117 |
-
<file name="mysql4-install-1.2.0.php" hash="
|
118 |
-
<file name="mysql4-upgrade-1.1.7-1.2.0.php" hash="
|
119 |
</dir>
|
120 |
</dir>
|
121 |
</dir>
|
@@ -126,12 +203,21 @@
|
|
126 |
<dir name="default">
|
127 |
<dir name="default">
|
128 |
<dir name="layout">
|
129 |
-
<file name="nostotagging.xml" hash="
|
130 |
</dir>
|
131 |
<dir name="template">
|
132 |
<dir name="nostotagging">
|
133 |
-
<file name="iframe.phtml" hash="
|
134 |
-
<file name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</dir>
|
136 |
</dir>
|
137 |
</dir>
|
@@ -141,23 +227,23 @@
|
|
141 |
<dir name="base">
|
142 |
<dir name="default">
|
143 |
<dir name="layout">
|
144 |
-
<file name="nostotagging.xml" hash="
|
145 |
</dir>
|
146 |
<dir name="template">
|
147 |
<dir name="nostotagging">
|
148 |
-
<file name="addtocart.phtml" hash="
|
149 |
-
<file name="cart.phtml" hash="
|
150 |
-
<
|
151 |
-
|
152 |
-
|
153 |
-
<file name="
|
154 |
-
<file name="
|
155 |
-
<file name="
|
156 |
-
<file name="
|
157 |
-
<file name="
|
158 |
-
<file name="
|
159 |
-
<file name="
|
160 |
-
<file name="
|
161 |
</dir>
|
162 |
</dir>
|
163 |
</dir>
|
@@ -166,7 +252,7 @@
|
|
166 |
</target>
|
167 |
<target name="mageetc">
|
168 |
<dir name="modules">
|
169 |
-
<file name="Nosto_Tagging.xml" hash="
|
170 |
</dir>
|
171 |
</target>
|
172 |
<target name="magelib">
|
@@ -174,89 +260,93 @@
|
|
174 |
<dir name="php-sdk">
|
175 |
<dir name="src">
|
176 |
<dir name="classes">
|
177 |
-
<file name="Nosto.php" hash="
|
178 |
-
<file name="NostoAccount.php" hash="
|
179 |
-
<file name="NostoAccountMeta.php" hash="
|
180 |
-
<file name="NostoCipher.php" hash="
|
181 |
-
<file name="NostoCurrency.php" hash="
|
182 |
-
<file name="NostoCurrencyCode.php" hash="
|
183 |
-
<file name="NostoCurrencyFormat.php" hash="
|
184 |
-
<file name="NostoCurrencyInfo.php" hash="
|
185 |
-
<file name="NostoCurrencySymbol.php" hash="
|
186 |
-
<file name="NostoDotEnv.php" hash="
|
187 |
-
<file name="NostoExchangeRate.php" hash="
|
188 |
-
<file name="NostoMessage.php" hash="
|
189 |
-
<file name="
|
190 |
-
<file name="
|
191 |
-
<file name="
|
192 |
-
<file name="
|
|
|
193 |
<dir name="api">
|
194 |
-
<file name="NostoApiRequest.php" hash="
|
195 |
-
<file name="NostoApiToken.php" hash="
|
196 |
</dir>
|
197 |
<dir name="collection">
|
198 |
-
<file name="NostoCollection.php" hash="
|
199 |
-
<file name="NostoExchangeRateCollection.php" hash="
|
200 |
-
<file name="NostoOrderCollection.php" hash="
|
201 |
-
<file name="NostoProductCollection.php" hash="
|
202 |
</dir>
|
203 |
<dir name="exception">
|
204 |
-
<file name="
|
205 |
-
<file name="
|
|
|
|
|
206 |
</dir>
|
207 |
<dir name="export">
|
208 |
-
<file name="NostoExportOrderCollection.php" hash="
|
209 |
-
<file name="NostoExportProductCollection.php" hash="
|
210 |
-
<file name="NostoExporter.php" hash="
|
211 |
</dir>
|
212 |
<dir name="helper">
|
213 |
-
<file name="NostoHelper.php" hash="
|
214 |
-
<file name="NostoHelperDate.php" hash="
|
215 |
-
<file name="NostoHelperIframe.php" hash="
|
216 |
-
<file name="NostoHelperPrice.php" hash="
|
217 |
</dir>
|
218 |
<dir name="http">
|
219 |
-
<file name="NostoHttpRequest.php" hash="
|
220 |
-
<file name="NostoHttpRequestAdapter.php" hash="
|
221 |
-
<file name="NostoHttpRequestAdapterCurl.php" hash="
|
222 |
-
<file name="NostoHttpRequestAdapterSocket.php" hash="
|
223 |
-
<file name="NostoHttpResponse.php" hash="
|
224 |
</dir>
|
225 |
<dir name="oauth">
|
226 |
-
<file name="NostoOAuthClient.php" hash="
|
227 |
-
<file name="NostoOAuthToken.php" hash="
|
228 |
</dir>
|
229 |
<dir name="operation">
|
230 |
-
<file name="NostoOperationAccount.php" hash="
|
231 |
-
<file name="NostoOperationExchangeRate.php" hash="
|
232 |
-
<file name="NostoOperationProduct.php" hash="
|
233 |
</dir>
|
234 |
</dir>
|
235 |
-
<file name="config.inc.php" hash="
|
236 |
<dir name="interfaces">
|
237 |
-
<file name="NostoExchangeRateInterface.php" hash="
|
238 |
-
<file name="NostoExportCollectionInterface.php" hash="
|
239 |
-
<file name="
|
240 |
-
<file name="
|
241 |
-
<file name="
|
|
|
242 |
<dir name="account">
|
243 |
-
<file name="NostoAccountInterface.php" hash="
|
244 |
-
<file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="
|
245 |
-
<file name="NostoAccountMetaDataIframeInterface.php" hash="
|
246 |
-
<file name="NostoAccountMetaDataInterface.php" hash="
|
247 |
-
<file name="NostoAccountMetaDataOwnerInterface.php" hash="
|
248 |
</dir>
|
249 |
<dir name="order">
|
250 |
-
<file name="NostoOrderBuyerInterface.php" hash="
|
251 |
-
<file name="NostoOrderInterface.php" hash="
|
252 |
-
<file name="NostoOrderPurchasedItemInterface.php" hash="
|
253 |
-
<file name="NostoOrderStatusInterface.php" hash="
|
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="
|
260 |
</dir>
|
261 |
</dir>
|
262 |
<dir name="libs">
|
@@ -276,7 +366,7 @@
|
|
276 |
<target name="mageweb">
|
277 |
<dir name="js">
|
278 |
<dir name="nosto">
|
279 |
-
<file name="iframeHandler.min.js" hash="
|
280 |
<file name="iframeResizer.min.js" hash="163b065c9dd702dc364913a951b81fee"/>
|
281 |
</dir>
|
282 |
</dir>
|
@@ -287,13 +377,13 @@
|
|
287 |
<required>
|
288 |
<php>
|
289 |
<min>5.2.0</min>
|
290 |
-
<max>
|
291 |
</php>
|
292 |
<package>
|
293 |
<name>Mage_Core_Modules</name>
|
294 |
<channel>community</channel>
|
295 |
<min>1.6.0.0</min>
|
296 |
-
<max>1.9.
|
297 |
</package>
|
298 |
</required>
|
299 |
</dependencies>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Nosto_Tagging</name>
|
4 |
+
<version>2.10.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="https://opensource.org/licenses/OSL-3.0">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Personalization for Magento</summary>
|
10 |
<description>Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.</description>
|
11 |
+
<notes>- Add support for sending the account details & new platform UI&#xD;- Add check if table `nosto_tagging_customer` already exists before creating it&#xD;- Add visitor checksum tagging&#xD;- Strip out _Main Website_ from the default account title&#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="58f66c749428f51a0a98fc34966086f2"/>
|
27 |
<dir name="Adminhtml">
|
28 |
+
<file name="Iframe.php" hash="a4b82b4c32551a1124cb19a6fbf2ac06"/>
|
29 |
+
<file name="Notifications.php" hash="150ef46fd911e3cb195815e874a78201"/>
|
30 |
+
<dir name="System">
|
31 |
+
<dir name="Config">
|
32 |
+
<dir name="Currency">
|
33 |
+
<file name="CronFrequency.php" hash="cae58cc7dca4f18d5fdcac875b60b1ef"/>
|
34 |
+
<file name="Formats.php" hash="24a30c47452ddb60b462c2d1790104ab"/>
|
35 |
+
<file name="Method.php" hash="3c46a01e0582210cd2fba2c037da8f03"/>
|
36 |
+
</dir>
|
37 |
+
</dir>
|
38 |
+
</dir>
|
39 |
</dir>
|
40 |
+
<file name="Cart.php" hash="d7b0b3f82486b4a5663f359e7c5546d1"/>
|
41 |
+
<file name="Category.php" hash="14f1017b36cabc2cd56a1b26cef46212"/>
|
42 |
+
<file name="Customer.php" hash="9d2a1885bfa7e8e7a02861a685de84e7"/>
|
43 |
+
<file name="Element.php" hash="6ffb05ee556971c328425281cbdfe134"/>
|
44 |
+
<file name="Embed.php" hash="3787566c4c4c2dcdaba87be9f720d314"/>
|
45 |
+
<file name="Meta.php" hash="9c4e5a209af6348e3a3a92823fa6738d"/>
|
46 |
+
<dir name="Order">
|
47 |
+
<dir name="Vaimo">
|
48 |
+
<dir name="Klarna">
|
49 |
+
<file name="Checkout.php" hash="5489469c3be2e1f8c97d439b3008c3f5"/>
|
50 |
+
</dir>
|
51 |
+
</dir>
|
52 |
+
</dir>
|
53 |
+
<file name="Order.php" hash="4153d69f4a0d0619bae4ab67363030f0"/>
|
54 |
+
<file name="Pagetype.php" hash="638aa004f1e1a236682e2b97e093b63a"/>
|
55 |
+
<file name="Product.php" hash="4832e686951892a3ca008bd3fe027023"/>
|
56 |
+
<file name="Searchterm.php" hash="c49e3cf47b9668cc0a86e5c9763d3fe5"/>
|
57 |
+
<file name="Variation.php" hash="05e29d79fb0e20a33a96da893c7a5b58"/>
|
58 |
</dir>
|
59 |
<dir name="Helper">
|
60 |
+
<file name="Account.php" hash="1e304ad44185af0d8812cd0c640a3b4e"/>
|
61 |
+
<file name="Cache.php" hash="9ba36c5cc9fd73859bfc8d76f79c7374"/>
|
62 |
+
<file name="Class.php" hash="4d7bd9a0b4037ba7bc6c39f73090c321"/>
|
63 |
+
<file name="Currency.php" hash="8d5103facaaedbb3c41724af756e8836"/>
|
64 |
+
<file name="Customer.php" hash="db103fbc887c8631310f115e3131bd15"/>
|
65 |
+
<file name="Data.php" hash="bbac810ebdfd69552b71d2959e8f9aad"/>
|
66 |
+
<file name="Date.php" hash="b67357655ab09bbf66b2b700c52c5fc7"/>
|
67 |
+
<file name="Module.php" hash="8703155a2780a87d542595ec7096b1f2"/>
|
68 |
+
<file name="Oauth.php" hash="5917fa5b1cb67643975d723d21281e8a"/>
|
69 |
+
<file name="Price.php" hash="ab521d6fa5ea9812d2cdb432f4cffc47"/>
|
70 |
+
<file name="Rating.php" hash="7493398286eb9db0d651a7946c9a4d1d"/>
|
71 |
+
<file name="Setup.php" hash="02de694a7f621361421f632234fa05aa"/>
|
72 |
+
<file name="Stock.php" hash="79c15c363cd7b5b1683f6b9b1731596f"/>
|
73 |
+
<file name="Url.php" hash="b1985fc546bf6229c95f62d8387ab6c5"/>
|
74 |
</dir>
|
75 |
<dir name="Model">
|
76 |
+
<file name="Base.php" hash="1b3e09fb5dbfabea6e4c433ae3e93e5c"/>
|
77 |
+
<dir name="Collection">
|
78 |
+
<file name="Rates.php" hash="1d7dd8716fa67bbdc4ae1685c42d9421"/>
|
79 |
+
</dir>
|
80 |
<dir name="Container">
|
81 |
+
<file name="Cart.php" hash="0cf9c4de233b774d8978451fec7a3b9e"/>
|
82 |
+
<file name="Customer.php" hash="6ffdaaf8eaf9014cd41b9e6c191967d4"/>
|
83 |
</dir>
|
84 |
+
<file name="Customer.php" hash="9e0fe9564cb8080c0c2bcfcb278c9f29"/>
|
85 |
<dir name="Export">
|
86 |
<dir name="Collection">
|
87 |
+
<file name="Order.php" hash="012f2ff14016ac1cd52df82eefa82efd"/>
|
88 |
</dir>
|
89 |
</dir>
|
90 |
<dir name="Meta">
|
91 |
<dir name="Account">
|
92 |
+
<file name="Billing.php" hash="fef5eeeb9738ff9d01b9216a9e1c6d73"/>
|
93 |
+
<file name="Iframe.php" hash="325d5c73756ce05f860cdbfa1158323b"/>
|
94 |
+
<file name="Owner.php" hash="3b8cd653420d52bd4852c18615897e89"/>
|
95 |
</dir>
|
96 |
+
<file name="Account.php" hash="289b0ea7a6ace640675c92a6ee3ebac5"/>
|
97 |
+
<file name="Oauth.php" hash="1d6363a95cafaaf68763276cf9fd7e58"/>
|
98 |
<dir name="Order">
|
99 |
+
<file name="Buyer.php" hash="42afc58da863e3c42bb58d13212b329c"/>
|
100 |
+
<file name="Item.php" hash="8c5bf612c51465c4f1299fae0a16d33c"/>
|
101 |
+
<file name="Status.php" hash="e186a9713b1e653643fcb180ef0cc104"/>
|
102 |
+
<dir name="Vaimo">
|
103 |
+
<dir name="Klarna">
|
104 |
+
<file name="Checkout.php" hash="b858f8cbd22b2e67366ccb2888868e45"/>
|
105 |
+
</dir>
|
106 |
+
</dir>
|
107 |
</dir>
|
108 |
+
<file name="Order.php" hash="96a0277063f686bc71cac5680da58727"/>
|
109 |
+
<file name="Product.php" hash="d6f6c39e3ba61998964b8f068d03022a"/>
|
110 |
+
<dir name="Rating">
|
111 |
+
<file name="Interface.php" hash="4e4b2266e0613db97dc0ca140bd33b46"/>
|
112 |
+
<dir name="Mage">
|
113 |
+
<file name="Rating.php" hash="0a9a4370bab0ad68b0381e16e5b0fed8"/>
|
114 |
+
</dir>
|
115 |
+
<dir name="Yotpo">
|
116 |
+
<file name="Yotpo.php" hash="93995fe547a705bb29db92b326a2fb3d"/>
|
117 |
+
</dir>
|
118 |
+
</dir>
|
119 |
+
<file name="Rating.php" hash="25fe10f2e5c766465cf0f9f8431204dd"/>
|
120 |
</dir>
|
121 |
+
<file name="Observer.php" hash="6085f4218e327eec6c9c2a1296a9f9d2"/>
|
122 |
+
<file name="Product.php" hash="9c3954b08d499571e3891f3690f1021e"/>
|
123 |
<dir name="Resource">
|
124 |
<dir name="Customer">
|
125 |
+
<file name="Collection.php" hash="007b5342849f9e269ff495c68a6ee20d"/>
|
126 |
</dir>
|
127 |
+
<file name="Customer.php" hash="cc888f8ba1f05ca7b14e9da087ae2336"/>
|
128 |
<dir name="Product">
|
129 |
+
<file name="Collection.php" hash="20c6f3672973a796202d39c17325770b"/>
|
130 |
</dir>
|
|
|
131 |
</dir>
|
132 |
<dir name="Service">
|
133 |
+
<file name="Order.php" hash="bdb9f2df2455f5e21a55c7aab68f6975"/>
|
134 |
+
<file name="Product.php" hash="407fc39da7217a53717a26bebe541fa4"/>
|
135 |
</dir>
|
136 |
<dir name="System">
|
137 |
<dir name="Config">
|
138 |
+
<dir name="Backend">
|
139 |
+
<dir name="Currency">
|
140 |
+
<dir name="Exchange">
|
141 |
+
<dir name="Rate">
|
142 |
+
<file name="Cron.php" hash="ad3e89bc741b27a17deee8dd2d64b8b8"/>
|
143 |
+
</dir>
|
144 |
+
</dir>
|
145 |
+
</dir>
|
146 |
+
</dir>
|
147 |
<dir name="Source">
|
148 |
+
<file name="Attribute.php" hash="cb132aedabb1a952f29fae6a8dfe6136"/>
|
149 |
+
<dir name="Cron">
|
150 |
+
<file name="Frequency.php" hash="e15d95f73c84dc4829c83f498f37d46d"/>
|
151 |
+
</dir>
|
152 |
+
<dir name="Custom">
|
153 |
+
<file name="Tags.php" hash="b3ac4a462c42bcd3f78505efff9eafde"/>
|
154 |
+
</dir>
|
155 |
+
<file name="Image.php" hash="ba1ab52ea064054e14cafeeee8f7bb23"/>
|
156 |
+
<dir name="Multi">
|
157 |
+
<dir name="Currency">
|
158 |
+
<file name="Method.php" hash="4808b4da5cf5b9a134c0765ad7ff4508"/>
|
159 |
+
</dir>
|
160 |
+
</dir>
|
161 |
+
<dir name="Price">
|
162 |
+
<file name="Attribute.php" hash="fcf89c89df623732ef3f41577415b6a2"/>
|
163 |
+
</dir>
|
164 |
+
<dir name="Product">
|
165 |
+
<file name="Attribute.php" hash="ca32299ff96f43b903ee6ed3c311c3e1"/>
|
166 |
+
</dir>
|
167 |
+
<dir name="Ratings">
|
168 |
+
<file name="Provider.php" hash="cc4df78fba5a00ae33a30b06d2bfa746"/>
|
169 |
+
</dir>
|
170 |
</dir>
|
171 |
</dir>
|
172 |
</dir>
|
173 |
</dir>
|
174 |
+
<file name="bootstrap.php" hash="5e832074a8ba83edada8e8551d30fb93"/>
|
175 |
<dir name="controllers">
|
176 |
<dir name="Adminhtml">
|
177 |
+
<file name="NostoController.php" hash="146d4f92d551f1e5a258ccfb9c7be208"/>
|
178 |
</dir>
|
179 |
+
<file name="ExportController.php" hash="59f5bf538a64e6a5c5cbfd7dac8839c8"/>
|
180 |
+
<file name="OauthController.php" hash="67832f287b820ce79b3b20728551efdb"/>
|
181 |
</dir>
|
182 |
<dir name="etc">
|
183 |
+
<file name="adminhtml.xml" hash="cb87f65b962de804b9f417c0ceaabfb3"/>
|
184 |
+
<file name="cache.xml" hash="5028e7c591de7ad2f463cc031faa42be"/>
|
185 |
+
<file name="config.xml" hash="976a17f07587b27b365df311cbcfe7a7"/>
|
186 |
+
<file name="system.xml" hash="849b2e04772b32ef861fdc3e8275ca77"/>
|
187 |
</dir>
|
188 |
<dir name="sql">
|
189 |
+
<dir name="nosto_customer_reference_setup">
|
190 |
+
<file name="mysql4-install-2.8.0.php" hash="72b2466b1799f742fa639ac833d4f569"/>
|
191 |
+
<file name="mysql4-upgrade-2.8.0-2.8.2.php" hash="acc62f2988c2735636cd05f093c879a7"/>
|
192 |
+
</dir>
|
193 |
<dir name="tagging_setup">
|
194 |
+
<file name="mysql4-install-1.2.0.php" hash="8182fb1e8408e5d233fe7927593624d0"/>
|
195 |
+
<file name="mysql4-upgrade-1.1.7-1.2.0.php" hash="c870ffb19d08257deabc2af30b163dc0"/>
|
196 |
</dir>
|
197 |
</dir>
|
198 |
</dir>
|
203 |
<dir name="default">
|
204 |
<dir name="default">
|
205 |
<dir name="layout">
|
206 |
+
<file name="nostotagging.xml" hash="3ce300441a76d773da319a3aa43243e7"/>
|
207 |
</dir>
|
208 |
<dir name="template">
|
209 |
<dir name="nostotagging">
|
210 |
+
<file name="iframe.phtml" hash="40bcfd138a111edb758fc607b55fa68d"/>
|
211 |
+
<file name="notifications.phtml" hash="d8e43794ba52eab95d62e86bb261bf4b"/>
|
212 |
+
<dir name="system">
|
213 |
+
<dir name="config">
|
214 |
+
<dir name="currency">
|
215 |
+
<file name="cronFrequency.phtml" hash="9f49a5967b433ab75b27272e020bf93b"/>
|
216 |
+
<file name="formats.phtml" hash="2a02cb1ea7c3b935272a8d961f39bd71"/>
|
217 |
+
</dir>
|
218 |
+
</dir>
|
219 |
+
</dir>
|
220 |
+
<file name="wizard.phtml" hash="d9b6305c43d9a1098a0fdcbe24a48644"/>
|
221 |
</dir>
|
222 |
</dir>
|
223 |
</dir>
|
227 |
<dir name="base">
|
228 |
<dir name="default">
|
229 |
<dir name="layout">
|
230 |
+
<file name="nostotagging.xml" hash="9fcbc9d014f73445b1fb2b8f466b04bb"/>
|
231 |
</dir>
|
232 |
<dir name="template">
|
233 |
<dir name="nostotagging">
|
234 |
+
<file name="addtocart.phtml" hash="f77bac92d27914c74cb51ca082c6aaab"/>
|
235 |
+
<file name="cart.phtml" hash="911c3ef430caf03979775d8cd86699ab"/>
|
236 |
+
<file name="category.phtml" hash="2bfc56d69173200f5de1141072545895"/>
|
237 |
+
<file name="customer.phtml" hash="1dab61e9124cb276368e99cfd164d220"/>
|
238 |
+
<file name="element.phtml" hash="9d5066836d31a0f1b199d3b9c45dbd8f"/>
|
239 |
+
<file name="embed.phtml" hash="9b91c4492f4a3c02ac03d8a1bbadc94e"/>
|
240 |
+
<file name="jsstub.phtml" hash="f1de821f7185fc1d3cf37cb39716bd05"/>
|
241 |
+
<file name="meta.phtml" hash="6e5d05e1aada01126fd3201165003e03"/>
|
242 |
+
<file name="order.phtml" hash="342f09db90f2e515662ba9d529c0d6e4"/>
|
243 |
+
<file name="pagetype.phtml" hash="093194433d9b24ffec0c85d3876c3492"/>
|
244 |
+
<file name="product.phtml" hash="80b1db0b105c599d13ce53a2201ab622"/>
|
245 |
+
<file name="searchterm.phtml" hash="a31b6881eaaa7eea62ae62992414879f"/>
|
246 |
+
<file name="variation.phtml" hash="3c048f9a0569089ee56103ef35fef9ac"/>
|
247 |
</dir>
|
248 |
</dir>
|
249 |
</dir>
|
252 |
</target>
|
253 |
<target name="mageetc">
|
254 |
<dir name="modules">
|
255 |
+
<file name="Nosto_Tagging.xml" hash="f9ec42788065c60b21806c9927f7b254"/>
|
256 |
</dir>
|
257 |
</target>
|
258 |
<target name="magelib">
|
260 |
<dir name="php-sdk">
|
261 |
<dir name="src">
|
262 |
<dir name="classes">
|
263 |
+
<file name="Nosto.php" hash="2c7b6c163a017b509a85a5c2a6869e42"/>
|
264 |
+
<file name="NostoAccount.php" hash="2118871d67a97f7133070fa95dadfccd"/>
|
265 |
+
<file name="NostoAccountMeta.php" hash="f6e81dbead7b9425afed98f13faec9c9"/>
|
266 |
+
<file name="NostoCipher.php" hash="f0af45e9fc48fe2734b6798ee5e3cdfc"/>
|
267 |
+
<file name="NostoCurrency.php" hash="511399f42ff5793de445944b5456c28e"/>
|
268 |
+
<file name="NostoCurrencyCode.php" hash="e2f14283c22f7aac9744150b9bd6457a"/>
|
269 |
+
<file name="NostoCurrencyFormat.php" hash="e676309a9f9420f0912bbf65b5363bda"/>
|
270 |
+
<file name="NostoCurrencyInfo.php" hash="2c8b7f50bfa483f1df764909441351fa"/>
|
271 |
+
<file name="NostoCurrencySymbol.php" hash="9f16f03a3d7187710daa37dac7ecf1c2"/>
|
272 |
+
<file name="NostoDotEnv.php" hash="be272235f6d48705023beeb6a24f2ce9"/>
|
273 |
+
<file name="NostoExchangeRate.php" hash="d6b70ad6bb434aba02bc450f1d066d34"/>
|
274 |
+
<file name="NostoMessage.php" hash="48912d9e00c08b5b5374eee368067cb4"/>
|
275 |
+
<file name="NostoNotification.php" hash="f25d0237e2ce1b04468a09bea328ba3c"/>
|
276 |
+
<file name="NostoObject.php" hash="0a348871fed339e7bdc57237e7947441"/>
|
277 |
+
<file name="NostoOrderConfirmation.php" hash="4f3ceb7ecbbdd2b78824e5d030fd60cf"/>
|
278 |
+
<file name="NostoProductReCrawl.php" hash="0b24f2fb00c9601e9b3d529f61a23bc5"/>
|
279 |
+
<file name="NostoValidator.php" hash="70523f08482bd8ef3a1a52a7fda2e237"/>
|
280 |
<dir name="api">
|
281 |
+
<file name="NostoApiRequest.php" hash="e3f7acbded105c2c521233e25f4c740b"/>
|
282 |
+
<file name="NostoApiToken.php" hash="bf46e7be1d5bbb1c5e79cbb55b2e559e"/>
|
283 |
</dir>
|
284 |
<dir name="collection">
|
285 |
+
<file name="NostoCollection.php" hash="9e85a39ac3a860becd63d2d3cc64659f"/>
|
286 |
+
<file name="NostoExchangeRateCollection.php" hash="c06337ff17993eb7da1f2b653a74bccb"/>
|
287 |
+
<file name="NostoOrderCollection.php" hash="57cf60f4c4bc7ad57211d9c542420e15"/>
|
288 |
+
<file name="NostoProductCollection.php" hash="fcae6d129e8fad82099a05600fef8eea"/>
|
289 |
</dir>
|
290 |
<dir name="exception">
|
291 |
+
<file name="NostoApiResponseException.php" hash="e5430f3d3cfdc1a8f02cc68cb351da40"/>
|
292 |
+
<file name="NostoException.php" hash="d73bdc24769b5f9483a46b218254c488"/>
|
293 |
+
<file name="NostoHttpException.php" hash="9abf965891309b45ab9d0cd60382432e"/>
|
294 |
+
<file name="NostoHttpResponseException.php" hash="1549798afd49cf52e522fd6d8d9481f3"/>
|
295 |
</dir>
|
296 |
<dir name="export">
|
297 |
+
<file name="NostoExportOrderCollection.php" hash="9e1c115ef84617f96e9896ffc67f3586"/>
|
298 |
+
<file name="NostoExportProductCollection.php" hash="d29c326d88ead2aac65fb35997fc6b25"/>
|
299 |
+
<file name="NostoExporter.php" hash="6c242c8b66a504483bff29ee83e795b8"/>
|
300 |
</dir>
|
301 |
<dir name="helper">
|
302 |
+
<file name="NostoHelper.php" hash="87ab4af83eb0f346238677e07acdd49e"/>
|
303 |
+
<file name="NostoHelperDate.php" hash="071e881ba63521bd3adfa50d14acfe43"/>
|
304 |
+
<file name="NostoHelperIframe.php" hash="1a40e60acb1c3c1f8fb87a4f334af146"/>
|
305 |
+
<file name="NostoHelperPrice.php" hash="49ea7add4987844de5566c16c6e54112"/>
|
306 |
</dir>
|
307 |
<dir name="http">
|
308 |
+
<file name="NostoHttpRequest.php" hash="cc72e0324cb6d3244c4f40f2bd760689"/>
|
309 |
+
<file name="NostoHttpRequestAdapter.php" hash="e3ee66855cb2a81795172d85cafd75f0"/>
|
310 |
+
<file name="NostoHttpRequestAdapterCurl.php" hash="7ed6a572e36d5a2e3e6ff3ac7a1382c1"/>
|
311 |
+
<file name="NostoHttpRequestAdapterSocket.php" hash="703f6b9a7d54a920b2b442ab30c3d13a"/>
|
312 |
+
<file name="NostoHttpResponse.php" hash="6e6b6a155679604637e86b2a1faa29db"/>
|
313 |
</dir>
|
314 |
<dir name="oauth">
|
315 |
+
<file name="NostoOAuthClient.php" hash="d0ffcdcac250639715bfc1927f10e59c"/>
|
316 |
+
<file name="NostoOAuthToken.php" hash="b771e384b2751a0255f0f5755f5fb6c6"/>
|
317 |
</dir>
|
318 |
<dir name="operation">
|
319 |
+
<file name="NostoOperationAccount.php" hash="dc7e52907b64b5e5149814bb048eb283"/>
|
320 |
+
<file name="NostoOperationExchangeRate.php" hash="65b411b16d3ef340f156aaf7f9fd81d2"/>
|
321 |
+
<file name="NostoOperationProduct.php" hash="e1968fe0710fa41d8b0f85feab92c725"/>
|
322 |
</dir>
|
323 |
</dir>
|
324 |
+
<file name="config.inc.php" hash="d9eb6b2e263a107d9e37a26fba7182e2"/>
|
325 |
<dir name="interfaces">
|
326 |
+
<file name="NostoExchangeRateInterface.php" hash="6c68bd4b564021cf0cb7e3f5b4b16ebe"/>
|
327 |
+
<file name="NostoExportCollectionInterface.php" hash="5de9b4dbbbbc1d1b41a53990536a51b5"/>
|
328 |
+
<file name="NostoNotificationInterface.php" hash="e0f4b3fde8e1111bb16793e9ce934c86"/>
|
329 |
+
<file name="NostoOAuthClientMetaDataInterface.php" hash="98f06f774b4a9af07ef4024bb49ce447"/>
|
330 |
+
<file name="NostoProductInterface.php" hash="68b6e532e0f70e04a789678c06f44291"/>
|
331 |
+
<file name="NostoValidatableInterface.php" hash="9a14e13c2f20653ceb202b8f247e46ce"/>
|
332 |
<dir name="account">
|
333 |
+
<file name="NostoAccountInterface.php" hash="39d271fd254aaca1fb51eebe2867d823"/>
|
334 |
+
<file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="7e294f596d899af9aa5cf8dea94390e0"/>
|
335 |
+
<file name="NostoAccountMetaDataIframeInterface.php" hash="f1dbe472269ab2e71feddad65489bd22"/>
|
336 |
+
<file name="NostoAccountMetaDataInterface.php" hash="c9d9a739d88db6cc4b3137f06ef930b7"/>
|
337 |
+
<file name="NostoAccountMetaDataOwnerInterface.php" hash="be8d01705b37778a8ed61e01db2178f6"/>
|
338 |
</dir>
|
339 |
<dir name="order">
|
340 |
+
<file name="NostoOrderBuyerInterface.php" hash="400f680f5e1827bf76fea06a454c3ecd"/>
|
341 |
+
<file name="NostoOrderInterface.php" hash="b5c3f5d59b7ac97b925e13ef9d13d96b"/>
|
342 |
+
<file name="NostoOrderPurchasedItemInterface.php" hash="978d961aefce11ec732fa2257d667df0"/>
|
343 |
+
<file name="NostoOrderStatusInterface.php" hash="80dc0acc4644d007279af286515d8073"/>
|
344 |
</dir>
|
345 |
</dir>
|
346 |
<dir name="js">
|
347 |
<file name="NostoIframe.min.js" hash="5fd9f5b418dd796c469aaa0c58b34aaa"/>
|
348 |
<dir name="src">
|
349 |
+
<file name="NostoIframe.js" hash="53eaf62450081dd7fc86bd2203512cb6"/>
|
350 |
</dir>
|
351 |
</dir>
|
352 |
<dir name="libs">
|
366 |
<target name="mageweb">
|
367 |
<dir name="js">
|
368 |
<dir name="nosto">
|
369 |
+
<file name="iframeHandler.min.js" hash="7a4eec2ab2082f0669b106511985ccf7"/>
|
370 |
<file name="iframeResizer.min.js" hash="163b065c9dd702dc364913a951b81fee"/>
|
371 |
</dir>
|
372 |
</dir>
|
377 |
<required>
|
378 |
<php>
|
379 |
<min>5.2.0</min>
|
380 |
+
<max>7.1.0</max>
|
381 |
</php>
|
382 |
<package>
|
383 |
<name>Mage_Core_Modules</name>
|
384 |
<channel>community</channel>
|
385 |
<min>1.6.0.0</min>
|
386 |
+
<max>1.9.3.1</max>
|
387 |
</package>
|
388 |
</required>
|
389 |
</dependencies>
|