diff --git a/.circleci/config.yml b/.circleci/config.yml
index 50bfa1b24..a9932ff96 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -41,16 +41,18 @@ shared: &shared
name: Before setup
command: |
echo 'memory_limit = 256M' | sudo tee /usr/local/etc/php/php.ini
- wget https://alg.li/algolia-keys && chmod +x algolia-keys
+
+ - run:
+ name: Get keys from dealer
+ command: |
+ if [ "$CIRCLE_PR_REPONAME" ]; then
+ curl -s https://algoliasearch-client-keygen.herokuapp.com | sh >> $BASH_ENV
+ fi
- run:
name: Run tests
command: |
cd ~/magento_directory/dev/tests/integration
- export CI_BUILD_NUM=$CIRCLE_BUILD_NUM
- export CI_PROJ_USERNAME=$CIRCLE_PROJECT_USERNAME
- export CI_PROJ_REPONAME=$CIRCLE_PROJECT_REPONAME
- eval $(~/build_directory/algoliasearch-magento-2/algolia-keys export)
sudo service elasticsearch start # for some reasons has to be launched with the step
sleep 10
php -dmemory_limit=-1 ../../../vendor/bin/phpunit --debug ../../../vendor/algolia/algoliasearch-magento-2/Test
diff --git a/Block/Adminhtml/Category/Merchandising.php b/Block/Adminhtml/Category/Merchandising.php
index 45534ad95..5630b36fb 100644
--- a/Block/Adminhtml/Category/Merchandising.php
+++ b/Block/Adminhtml/Category/Merchandising.php
@@ -4,7 +4,6 @@
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Algolia\AlgoliaSearch\Helper\Data;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Magento\Backend\Block\Template\Context;
use Magento\Catalog\Model\Category;
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class Merchandising extends \Magento\Backend\Block\Template
/** @var Data */
private $coreHelper;
- /** @var ProxyHelper */
- private $proxyHelper;
-
/** @var \Magento\Store\Model\StoreManagerInterface */
private $storeManager;
@@ -34,7 +30,6 @@ class Merchandising extends \Magento\Backend\Block\Template
* @param Registry $registry
* @param ConfigHelper $configHelper
* @param Data $coreHelper
- * @param ProxyHelper $proxyHelper
* @param array $data
*/
public function __construct(
@@ -42,13 +37,11 @@ public function __construct(
Registry $registry,
ConfigHelper $configHelper,
Data $coreHelper,
- ProxyHelper $proxyHelper,
array $data = []
) {
$this->registry = $registry;
$this->configHelper = $configHelper;
$this->coreHelper = $coreHelper;
- $this->proxyHelper = $proxyHelper;
$this->storeManager = $context->getStoreManager();
parent::__construct($context, $data);
@@ -89,20 +82,6 @@ public function getCoreHelper()
return $this->coreHelper;
}
- /** @return bool */
- public function isQueryRulesEnabled()
- {
- $info = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_QUERY_RULES);
-
- // In case the call to API proxy fails,
- // be "nice" and return true
- if ($info && array_key_exists('query_rules', $info)) {
- return $info['query_rules'];
- }
-
- return true;
- }
-
/**
* @throws \Magento\Framework\Exception\NoSuchEntityException
*
diff --git a/Block/Adminhtml/LandingPage/SearchConfiguration.php b/Block/Adminhtml/LandingPage/SearchConfiguration.php
index 2c3055958..edb1584c0 100644
--- a/Block/Adminhtml/LandingPage/SearchConfiguration.php
+++ b/Block/Adminhtml/LandingPage/SearchConfiguration.php
@@ -4,7 +4,6 @@
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Algolia\AlgoliaSearch\Helper\Data;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\LandingPage;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
/** @var Data */
private $coreHelper;
- /** @var ProxyHelper */
- protected $proxyHelper;
-
/** @var int */
protected $planLevel;
@@ -34,7 +30,6 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
* @param Registry $registry
* @param ConfigHelper $configHelper
* @param Data $coreHelper
- * @param ProxyHelper $proxyHelper
* @param array $data
*/
public function __construct(
@@ -42,13 +37,11 @@ public function __construct(
Registry $registry,
ConfigHelper $configHelper,
Data $coreHelper,
- ProxyHelper $proxyHelper,
array $data = []
) {
$this->registry = $registry;
$this->configHelper = $configHelper;
$this->coreHelper = $coreHelper;
- $this->proxyHelper = $proxyHelper;
parent::__construct($context, $data);
}
@@ -70,20 +63,4 @@ public function getCoreHelper()
{
return $this->coreHelper;
}
-
- /** @return int */
- public function getPlanLevel()
- {
- if ($this->planLevel == null) {
- $planLevel = 1;
- $planLevelInfo = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_PLAN_LEVEL);
-
- if (isset($planLevelInfo['plan_level'])) {
- $planLevel = (int) $planLevelInfo['plan_level'];
- }
- $this->planLevel = $planLevel;
- }
-
- return $this->planLevel;
- }
}
diff --git a/Block/Adminhtml/Query/Merchandising.php b/Block/Adminhtml/Query/Merchandising.php
index 9fa45ddc8..c4d378831 100644
--- a/Block/Adminhtml/Query/Merchandising.php
+++ b/Block/Adminhtml/Query/Merchandising.php
@@ -4,7 +4,6 @@
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Algolia\AlgoliaSearch\Helper\Data;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\Query;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class Merchandising extends \Magento\Backend\Block\Template
/** @var Data */
private $coreHelper;
- /** @var ProxyHelper */
- private $proxyHelper;
-
/** @var \Magento\Store\Model\StoreManagerInterface */
private $storeManager;
@@ -34,7 +30,6 @@ class Merchandising extends \Magento\Backend\Block\Template
* @param Registry $registry
* @param ConfigHelper $configHelper
* @param Data $coreHelper
- * @param ProxyHelper $proxyHelper
* @param array $data
*/
public function __construct(
@@ -42,13 +37,11 @@ public function __construct(
Registry $registry,
ConfigHelper $configHelper,
Data $coreHelper,
- ProxyHelper $proxyHelper,
array $data = []
) {
$this->registry = $registry;
$this->configHelper = $configHelper;
$this->coreHelper = $coreHelper;
- $this->proxyHelper = $proxyHelper;
$this->storeManager = $context->getStoreManager();
parent::__construct($context, $data);
@@ -72,20 +65,6 @@ public function getCoreHelper()
return $this->coreHelper;
}
- /** @return bool */
- public function isQueryRulesEnabled()
- {
- $info = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_QUERY_RULES);
-
- // In case the call to API proxy fails,
- // be "nice" and return true
- if ($info && array_key_exists('query_rules', $info)) {
- return $info['query_rules'];
- }
-
- return true;
- }
-
/**
* @throws \Magento\Framework\Exception\NoSuchEntityException
*
diff --git a/Block/Configuration.php b/Block/Configuration.php
index c43ce4572..468382e56 100755
--- a/Block/Configuration.php
+++ b/Block/Configuration.php
@@ -286,13 +286,7 @@ public function getConfiguration()
private function areCategoriesInFacets($facets)
{
- foreach ($facets as $facet) {
- if ($facet['attribute'] === 'categories') {
- return true;
- }
- }
-
- return false;
+ return in_array('categories', array_column($facets, 'attribute'));
}
private function getUrlTrackedParameters()
@@ -336,28 +330,16 @@ private function isLandingPage()
private function getLandingPageId()
{
- if (!$this->isLandingPage()) {
- return '';
- }
-
- return $this->getCurrentLandingPage()->getId();
+ return $this->isLandingPage() ? $this->getCurrentLandingPage()->getId() : '';
}
private function getLandingPageQuery()
{
- if (!$this->isLandingPage()) {
- return '';
- }
-
- return $this->getCurrentLandingPage()->getQuery();
+ return $this->isLandingPage() ? $this->getCurrentLandingPage()->getQuery() : '';
}
private function getLandingPageConfiguration()
{
- if (!$this->isLandingPage()) {
- return json_encode([]);
- }
-
- return $this->getCurrentLandingPage()->getConfiguration();
+ return $this->isLandingPage() ? $this->getCurrentLandingPage()->getConfiguration() : json_encode([]);
}
}
diff --git a/Block/System/Form/Field/Logo.php b/Block/System/Form/Field/Logo.php
deleted file mode 100644
index 6c6f7a278..000000000
--- a/Block/System/Form/Field/Logo.php
+++ /dev/null
@@ -1,46 +0,0 @@
-proxyHelper = $proxyHelper;
- }
-
- protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
- {
- if ($this->showLogo()) {
- $element->setDisabled(true);
- $element->setValue(0);
-
- $comment = __('Do you want to remove Algolia logo from autocomplete menu?')
- . '
⚠'
- . __('Only paid customers are allowed to remove the logo.');
-
- $element->setComment($comment);
- }
-
- return parent::_getElementHtml($element);
- }
-
- /**
- * @return bool
- */
- public function showLogo()
- {
- $info = $this->proxyHelper->getClientConfigurationData();
-
- return isset($info['require_logo']) && $info['require_logo'] == 1;
- }
-}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f383f0023..668b77b69 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,37 @@
# CHANGE LOG
+## 3.2.0
+
+### UPDATES
+- Update module sequence and indexers (#1132)
+- Add additional attributes for customer groups (#1144)
+- Add priceRanges back to uistate (#1151)
+- Set visibility of getTaxPrice() to public in ProductWithoutChildren (#1159) (@JeroenVanLeusden)
+- Improve check: and try to handle URL by URL rewrites if request path is NULL. (#1149) (@vmalyk)
+- Unfilter getCoreCategories() from private getCategoryById() (#1154)
+- Add ability to change region for Analytics call (#1131) (@bchatard)
+
+### FIXES
+- Add missing indexName for autocomplete sections (#1133)
+- Add check if color object is defined for adaptive images (#1135)
+- Add small change on category indexing for Enterprise Edition (#1136)
+- Refactor loops and fix analytics overview issues (#1137)
+- Fix missing 'out of' translation on search results page (#1139) (@NickdeK)
+- Restore query value in custom instant search box (#1142) (@vmalyk)
+- Fix instantsearch rangeInput labels (#1148)
+- Recalculate special price if zero default pricing (#1160)
+- Add missing label for queue method rebuildCategoryIndex (#1152) (@tezlopchan)
+- Fix max original price for product with children (#1155) (@valeriish)
+- Store scope category merchandising based on store_id param (#1156)
+- Fix Subproduct Image Data (#1157)
+- Add try/catch to add to cart push events (#1158)
+- Fix for BE side renderting and caching 2 types of content (#1161) (@sudma)
+- Fix: categories not included filtering on product listing (#1163)
+- Fix: removing old feature checking for C&C that triggers deprecated endpoint (#1164)
+
+### TOOLING
+- Update CI testing (#1140)
+
## 3.1.0
### UPDATES
diff --git a/Controller/Adminhtml/Landingpage/AbstractAction.php b/Controller/Adminhtml/Landingpage/AbstractAction.php
index 70b92482a..05d7c8559 100644
--- a/Controller/Adminhtml/Landingpage/AbstractAction.php
+++ b/Controller/Adminhtml/Landingpage/AbstractAction.php
@@ -3,7 +3,6 @@
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Landingpage;
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\LandingPageFactory;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
@@ -20,9 +19,6 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
/** @var MerchandisingHelper */
protected $merchandisingHelper;
- /** @var ProxyHelper */
- protected $proxyHelper;
-
/** @var StoreManagerInterface */
protected $storeManager;
@@ -31,7 +27,6 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
* @param Registry $coreRegistry
* @param LandingPageFactory $landingPageFactory
* @param MerchandisingHelper $merchandisingHelper
- * @param ProxyHelper $proxyHelper
* @param StoreManagerInterface $storeManager
*/
public function __construct(
@@ -39,7 +34,6 @@ public function __construct(
Registry $coreRegistry,
LandingPageFactory $landingPageFactory,
MerchandisingHelper $merchandisingHelper,
- ProxyHelper $proxyHelper,
StoreManagerInterface $storeManager
) {
parent::__construct($context);
@@ -47,7 +41,6 @@ public function __construct(
$this->coreRegistry = $coreRegistry;
$this->landingPageFactory = $landingPageFactory;
$this->merchandisingHelper = $merchandisingHelper;
- $this->proxyHelper = $proxyHelper;
$this->storeManager = $storeManager;
}
@@ -57,35 +50,6 @@ protected function _isAllowed()
return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
}
- /**
- * {@inheritdoc}
- */
- public function dispatch(\Magento\Framework\App\RequestInterface $request)
- {
- $planLevelInfo = $this->proxyHelper->getClientConfigurationData();
- $planLevel = isset($planLevelInfo['plan_level']) ? (int) $planLevelInfo['plan_level'] : 1;
-
- if ($planLevel <= 1) {
- $this->_response->setStatusHeader(403, '1.1', 'Forbidden');
- if (!$this->_auth->isLoggedIn()) {
- return $this->_redirect('*/auth/login');
- }
- $this->_view->loadLayout(
- ['default', 'algolia_algoliasearch_handle_access_denied'],
- true,
- true,
- false
- );
- $this->_view->getLayout();
- $this->_view->renderLayout();
- $this->_request->setDispatched(true);
-
- return $this->_response;
- }
-
- return parent::dispatch($request);
- }
-
/** @return \Algolia\AlgoliaSearch\Model\LandingPage */
protected function initLandingPage()
{
diff --git a/Controller/Adminhtml/Landingpage/Save.php b/Controller/Adminhtml/Landingpage/Save.php
index b88e55a4b..b3eb9f132 100644
--- a/Controller/Adminhtml/Landingpage/Save.php
+++ b/Controller/Adminhtml/Landingpage/Save.php
@@ -3,7 +3,6 @@
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Landingpage;
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\LandingPageFactory;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\Controller\ResultFactory;
@@ -24,7 +23,6 @@ class Save extends AbstractAction
* @param \Magento\Framework\Registry $coreRegistry
* @param LandingPageFactory $landingPageFactory
* @param MerchandisingHelper $merchandisingHelper
- * @param ProxyHelper $proxyHelper
* @param StoreManagerInterface $storeManager
* @param DataPersistorInterface $dataPersistor
*
@@ -35,7 +33,6 @@ public function __construct(
\Magento\Framework\Registry $coreRegistry,
LandingPageFactory $landingPageFactory,
MerchandisingHelper $merchandisingHelper,
- ProxyHelper $proxyHelper,
StoreManagerInterface $storeManager,
DataPersistorInterface $dataPersistor
) {
@@ -46,7 +43,6 @@ public function __construct(
$coreRegistry,
$landingPageFactory,
$merchandisingHelper,
- $proxyHelper,
$storeManager
);
}
diff --git a/Controller/Adminhtml/Query/AbstractAction.php b/Controller/Adminhtml/Query/AbstractAction.php
index 07d678e24..1ccba4d82 100644
--- a/Controller/Adminhtml/Query/AbstractAction.php
+++ b/Controller/Adminhtml/Query/AbstractAction.php
@@ -3,7 +3,6 @@
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Query;
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\QueryFactory;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
@@ -20,9 +19,6 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
/** @var MerchandisingHelper */
protected $merchandisingHelper;
- /** @var ProxyHelper */
- protected $proxyHelper;
-
/** @var StoreManagerInterface */
protected $storeManager;
@@ -31,7 +27,6 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
* @param Registry $coreRegistry
* @param QueryFactory $queryFactory
* @param MerchandisingHelper $merchandisingHelper
- * @param ProxyHelper $proxyHelper
* @param StoreManagerInterface $storeManager
*/
public function __construct(
@@ -39,7 +34,6 @@ public function __construct(
Registry $coreRegistry,
QueryFactory $queryFactory,
MerchandisingHelper $merchandisingHelper,
- ProxyHelper $proxyHelper,
StoreManagerInterface $storeManager
) {
parent::__construct($context);
@@ -47,7 +41,6 @@ public function __construct(
$this->coreRegistry = $coreRegistry;
$this->queryFactory = $queryFactory;
$this->merchandisingHelper = $merchandisingHelper;
- $this->proxyHelper = $proxyHelper;
$this->storeManager = $storeManager;
}
@@ -57,35 +50,6 @@ protected function _isAllowed()
return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
}
- /**
- * {@inheritdoc}
- */
- public function dispatch(\Magento\Framework\App\RequestInterface $request)
- {
- $planLevelInfo = $this->proxyHelper->getClientConfigurationData();
- $planLevel = isset($planLevelInfo['plan_level']) ? (int) $planLevelInfo['plan_level'] : 1;
-
- if ($planLevel < 3) {
- $this->_response->setStatusHeader(403, '1.1', 'Forbidden');
- if (!$this->_auth->isLoggedIn()) {
- return $this->_redirect('*/auth/login');
- }
- $this->_view->loadLayout(
- ['default', 'algolia_algoliasearch_handle_query_access_denied'],
- true,
- true,
- false
- );
- $this->_view->getLayout();
- $this->_view->renderLayout();
- $this->_request->setDispatched(true);
-
- return $this->_response;
- }
-
- return parent::dispatch($request);
- }
-
/** @return \Algolia\AlgoliaSearch\Model\Query */
protected function initQuery()
{
diff --git a/Controller/Adminhtml/Query/Save.php b/Controller/Adminhtml/Query/Save.php
index 75c1366fa..fa3f61408 100644
--- a/Controller/Adminhtml/Query/Save.php
+++ b/Controller/Adminhtml/Query/Save.php
@@ -4,7 +4,6 @@
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\ImageUploader;
use Algolia\AlgoliaSearch\Model\QueryFactory;
use Magento\Framework\App\Request\DataPersistorInterface;
@@ -36,7 +35,6 @@ class Save extends AbstractAction
* @param \Magento\Framework\Registry $coreRegistry
* @param QueryFactory $queryFactory
* @param MerchandisingHelper $merchandisingHelper
- * @param ProxyHelper $proxyHelper
* @param StoreManagerInterface $storeManager
* @param DataPersistorInterface $dataPersistor
* @param ConfigHelper $configHelper
@@ -49,7 +47,6 @@ public function __construct(
\Magento\Framework\Registry $coreRegistry,
QueryFactory $queryFactory,
MerchandisingHelper $merchandisingHelper,
- ProxyHelper $proxyHelper,
StoreManagerInterface $storeManager,
DataPersistorInterface $dataPersistor,
ConfigHelper $configHelper,
@@ -64,7 +61,6 @@ public function __construct(
$coreRegistry,
$queryFactory,
$merchandisingHelper,
- $proxyHelper,
$storeManager
);
}
@@ -114,10 +110,6 @@ public function execute()
$storeId = isset($data['store_id']) && $data['store_id'] != 0 ? $data['store_id'] : null;
- $this->trackQueryMerchandisingData($query, 'banner_image', 'Uploaded Banner', $storeId);
- $this->trackQueryMerchandisingData($query, 'banner_alt', 'Add Alt Text', $storeId);
- $this->trackQueryMerchandisingData($query, 'banner_url', 'Add Banner URL', $storeId);
-
try {
$query->getResource()->save($query);
@@ -209,22 +201,4 @@ private function prepareBannerContent($data)
return $content;
}
-
- /**
- * @param string $query
- * @param string $attributeCode
- * @param string $eventName
- * @param int|null $storeId
- */
- private function trackQueryMerchandisingData($query, $attributeCode, $eventName, $storeId = null)
- {
- if (($query->isObjectNew() && $query->getData($attributeCode))
- || $query->getOrigData($attributeCode) !== $query->getData($attributeCode)) {
- $this->proxyHelper->trackEvent(
- $this->configHelper->getApplicationID($storeId),
- $eventName,
- ['source' => 'magento2.querymerch.edit']
- );
- }
- }
}
diff --git a/Controller/Adminhtml/Support/AbstractAction.php b/Controller/Adminhtml/Support/AbstractAction.php
deleted file mode 100644
index 736a2b3a1..000000000
--- a/Controller/Adminhtml/Support/AbstractAction.php
+++ /dev/null
@@ -1,28 +0,0 @@
-resultFactory = $context->getResultFactory();
- }
-
- /** @return bool */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
- }
-}
diff --git a/Controller/Adminhtml/Support/Contact.php b/Controller/Adminhtml/Support/Contact.php
deleted file mode 100644
index 0d65267d2..000000000
--- a/Controller/Adminhtml/Support/Contact.php
+++ /dev/null
@@ -1,145 +0,0 @@
-supportHelper = $supportHelper;
- }
-
- /**
- * @throws \Zend_Db_Statement_Exception
- * @throws LocalizedException
- *
- * @return Redirect | Page
- */
- public function execute()
- {
- if ($this->supportHelper->isExtensionSupportEnabled() === false) {
- $this->messageManager->addErrorMessage('Your Algolia app is not eligible for e-mail support.');
-
- $resultRedirect = $this->resultRedirectFactory->create();
- $resultRedirect->setPath('*/*/index');
-
- return $resultRedirect;
- }
-
- $params = $this->getRequest()->getParams();
- if ($this->isFormSubmitted($params) && $data = $this->validateForm($params)) {
- $processed = $this->supportHelper->processContactForm($data);
- if ($processed === true) {
- $this->messageManager->addSuccessMessage('You ticket was successfully sent to Algolia support team.');
-
- $resultRedirect = $this->resultRedirectFactory->create();
- $resultRedirect->setPath('*/*/index');
-
- return $resultRedirect;
- }
-
- $this->messageManager->addErrorMessage('There was an error while sending your ticket. Please, try it again.');
- }
-
- $breadMain = __('Algolia | Contact Us');
-
- /** @var Page $resultPage */
- $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
- $resultPage->getConfig()->getTitle()->prepend($breadMain);
-
- return $resultPage;
- }
-
- /**
- * @param array $data
- *
- * @return bool
- */
- private function isFormSubmitted($data)
- {
- return array_key_exists('sent', $data) && $data['sent'] === 'sent';
- }
-
- /**
- * @param array $data
- *
- * @return array|bool
- */
- private function validateForm($data)
- {
- $attributes = [
- 'name' => 'Name',
- 'email' => 'E-mail',
- 'subject' => 'Subject',
- 'message' => 'Message',
- ];
-
- $cleanData = [];
- $isValid = true;
-
- foreach ($attributes as $attribute => $caption) {
- $value = trim($data[$attribute]);
-
- if ($value === '') {
- $isValid = false;
- $this->messageManager->addErrorMessage('Please, fill in your "' . $caption . '".');
-
- continue;
- }
-
- if ($attribute === 'email' && $this->validateEmail($value) === false) {
- $isValid = false;
- $this->messageManager->addErrorMessage('Please enter a valid e-mail address (Ex: johndoe@domain.com).');
-
- continue;
- }
-
- $cleanData[$attribute] = $value;
- }
-
- if ($isValid === false) {
- return false;
- }
-
- $cleanData['send_additional_info'] = false;
- if (array_key_exists('send_additional_info', $data) && $data['send_additional_info'] === '1') {
- $cleanData['send_additional_info'] = true;
- }
-
- return $cleanData;
- }
-
- /**
- * @param string $email
- *
- * @return bool
- */
- private function validateEmail($email)
- {
- $atom = "[-a-z0-9!#$%&'*+/=?^_`{|}~]";
- $alpha = "a-z\x80-\xFF";
-
- $isValid = (bool) preg_match("(^
- (\"([ !#-[\\]-~]*|\\\\[ -~])+\"|$atom+(\\.$atom+)*)
- @
- ([0-9$alpha]([-0-9$alpha]{0,61}[0-9$alpha])?\\.)+
- [$alpha]([-0-9$alpha]{0,17}[$alpha])?\\z)ix", $email);
-
- return $isValid;
- }
-}
diff --git a/Controller/Adminhtml/Support/Index.php b/Controller/Adminhtml/Support/Index.php
index e7f119277..9850d1d31 100644
--- a/Controller/Adminhtml/Support/Index.php
+++ b/Controller/Adminhtml/Support/Index.php
@@ -2,10 +2,30 @@
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Support;
+use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\ResultFactory;
-class Index extends AbstractAction
+class Index extends \Magento\Backend\App\Action
{
+ /** @var ResultFactory */
+ protected $resultFactory;
+
+ /**
+ * @param Context $context
+ */
+ public function __construct(Context $context)
+ {
+ parent::__construct($context);
+
+ $this->resultFactory = $context->getResultFactory();
+ }
+
+ /** @return bool */
+ protected function _isAllowed()
+ {
+ return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
+ }
+
/**
* @return \Magento\Framework\View\Result\Page
*/
diff --git a/Helper/AnalyticsHelper.php b/Helper/AnalyticsHelper.php
index be010d5b9..36eeeb843 100644
--- a/Helper/AnalyticsHelper.php
+++ b/Helper/AnalyticsHelper.php
@@ -23,9 +23,6 @@ class AnalyticsHelper
/** @var IndexEntityDataProvider */
private $entityHelper;
- /** @var ProxyHelper */
- private $proxyHelper;
-
/** @var Logger */
private $logger;
@@ -53,27 +50,34 @@ class AnalyticsHelper
*/
private $analyticsConfig;
+ /**
+ * Can be changed through DI
+ *
+ * @var string
+ */
+ private $region;
+
/**
* @param AlgoliaHelper $algoliaHelper
* @param ConfigHelper $configHelper
* @param IndexEntityDataProvider $entityHelper
- * @param ProxyHelper $proxyHelper
* @param Logger $logger
+ * @param string $region
*/
public function __construct(
AlgoliaHelper $algoliaHelper,
ConfigHelper $configHelper,
IndexEntityDataProvider $entityHelper,
- ProxyHelper $proxyHelper,
- Logger $logger
+ Logger $logger,
+ string $region = 'us'
) {
$this->algoliaHelper = $algoliaHelper;
$this->configHelper = $configHelper;
$this->entityHelper = $entityHelper;
- $this->proxyHelper = $proxyHelper;
$this->logger = $logger;
+ $this->region = $region;
}
private function setupAnalyticsClient()
@@ -84,12 +88,14 @@ private function setupAnalyticsClient()
$this->analyticsClient = AnalyticsClient::create(
$this->configHelper->getApplicationID(),
- $this->configHelper->getAPIKey()
+ $this->configHelper->getAPIKey(),
+ $this->region
);
$this->analyticsConfig = AnalyticsConfig::create(
$this->configHelper->getApplicationID(),
- $this->configHelper->getAPIKey()
+ $this->configHelper->getAPIKey(),
+ $this->region
);
}
@@ -305,25 +311,9 @@ public function getConversionRateByDates(array $params)
return $conversion && isset($conversion['dates']) ? $conversion['dates'] : [];
}
- /**
- * Client Data Check
- *
- * @return mixed
- */
- public function getClientData()
- {
- if (!$this->clientData) {
- $this->clientData = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_ANALYTICS);
- }
-
- return $this->clientData;
- }
-
public function isAnalyticsApiEnabled()
{
- $clientData = $this->getClientData();
-
- return (bool) $clientData && isset($clientData['analytics_api']) ? $clientData['analytics_api'] : 0;
+ return true;
}
public function isClickAnalyticsEnabled()
@@ -332,9 +322,7 @@ public function isClickAnalyticsEnabled()
return false;
}
- $clientData = $this->getClientData();
-
- return (bool) $clientData && isset($clientData['click_analytics']) ? $clientData['click_analytics'] : 0;
+ return true;
}
/**
diff --git a/Helper/ConfigHelper.php b/Helper/ConfigHelper.php
index beb5a5d00..9ce26de1c 100755
--- a/Helper/ConfigHelper.php
+++ b/Helper/ConfigHelper.php
@@ -120,7 +120,6 @@ class ConfigHelper
private $eventManager;
private $currencyManager;
private $serializer;
- private $maxRecordSize;
public function __construct(
Magento\Framework\App\Config\ScopeConfigInterface $configInterface,
@@ -889,6 +888,8 @@ public function getAttributesToRetrieve($groupId)
'in_stock',
'type_id',
'value',
+ 'query', # suggestions
+ 'path', # categories
]);
$currencies = $this->dirCurrency->getConfigAllowCurrencies();
@@ -1098,29 +1099,7 @@ public function getDefaultMaxRecordSize()
public function getMaxRecordSizeLimit($storeId = null)
{
- if ($this->maxRecordSize) {
- return $this->maxRecordSize;
- }
-
- $configValue = $this->configInterface->getValue(self::MAX_RECORD_SIZE_LIMIT, ScopeInterface::SCOPE_STORE, $storeId);
- if ($configValue) {
- $this->maxRecordSize = $configValue;
-
- return $this->maxRecordSize;
- }
- /** @var \Algolia\AlgoliaSearch\Helper\ProxyHelper $proxyHelper */
- $proxyHelper = $this->objectManager->create('Algolia\AlgoliaSearch\Helper\ProxyHelper');
- $clientData = $proxyHelper->getClientConfigurationData();
- if ($clientData && isset($clientData['max_record_size'])) {
- /** @var \Magento\Framework\App\Config\Storage\Writer $configWriter */
- $configWriter = $this->objectManager->create('Magento\Framework\App\Config\Storage\Writer');
- $configWriter->save(self::MAX_RECORD_SIZE_LIMIT, $clientData['max_record_size']);
- $this->maxRecordSize = $clientData['max_record_size'];
- } else {
- $this->maxRecordSize = self::getDefaultMaxRecordSize();
- }
-
- return $this->maxRecordSize;
+ return self::getDefaultMaxRecordSize();
}
public function getArchiveLogClearLimit($storeId = null)
diff --git a/Helper/Configuration/NoticeHelper.php b/Helper/Configuration/NoticeHelper.php
index 0b4e2b411..a154ed33d 100644
--- a/Helper/Configuration/NoticeHelper.php
+++ b/Helper/Configuration/NoticeHelper.php
@@ -3,7 +3,6 @@
namespace Algolia\AlgoliaSearch\Helper\Configuration;
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
-use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\ExtensionNotification;
use Algolia\AlgoliaSearch\Model\ResourceModel\Job\CollectionFactory as JobCollectionFactory;
use Magento\Framework\Module\Manager as ModuleManager;
@@ -16,9 +15,6 @@ class NoticeHelper extends \Magento\Framework\App\Helper\AbstractHelper
/** @var ConfigHelper */
private $configHelper;
- /** @var ProxyHelper */
- private $proxyHelper;
-
/** @var PersonalizationHelper */
private $personalizationHelper;
@@ -46,7 +42,6 @@ class NoticeHelper extends \Magento\Framework\App\Helper\AbstractHelper
'getMsiNotice',
'getVersionNotice',
'getClickAnalyticsNotice',
- 'getQueryRulesNotice',
'getPersonalizationNotice',
];
@@ -65,7 +60,6 @@ class NoticeHelper extends \Magento\Framework\App\Helper\AbstractHelper
public function __construct(
\Magento\Framework\App\Helper\Context $context,
ConfigHelper $configHelper,
- ProxyHelper $proxyHelper,
PersonalizationHelper $personalizationHelper,
ModuleManager $moduleManager,
ObjectManagerInterface $objectManager,
@@ -75,7 +69,6 @@ public function __construct(
AssetRepository $assetRepository
) {
$this->configHelper = $configHelper;
- $this->proxyHelper = $proxyHelper;
$this->personalizationHelper = $personalizationHelper;
$this->moduleManager = $moduleManager;
$this->objectManager = $objectManager;
@@ -184,7 +177,7 @@ protected function getVersionNotice()
protected function getClickAnalyticsNotice()
{
// If the feature is enabled both in Magento Admin and Algolia dashboard, no need to display a notice
- if ($this->isClickAnalyticsEnabled() && $this->configHelper->isClickConversionAnalyticsEnabled()) {
+ if ($this->configHelper->isClickConversionAnalyticsEnabled()) {
return;
}
@@ -192,33 +185,20 @@ protected function getClickAnalyticsNotice()
$selector = '';
$method = 'before';
- // If the feature is not enabled in the Algolia dashboard
- if (! $this->isClickAnalyticsEnabled()) {
- $noticeContent = '
-
diff --git a/view/adminhtml/layout/default.xml b/view/adminhtml/layout/default.xml index 056cdb1ab..6f1ffe325 100755 --- a/view/adminhtml/layout/default.xml +++ b/view/adminhtml/layout/default.xml @@ -3,12 +3,4 @@
-
-
- \ No newline at end of file + diff --git a/view/adminhtml/templates/configuration.phtml b/view/adminhtml/templates/configuration.phtml index 7067797fb..843fe77ec 100755 --- a/view/adminhtml/templates/configuration.phtml +++ b/view/adminhtml/templates/configuration.phtml @@ -14,10 +14,6 @@ $extensionNotices = []; $personalizationStatus = 0; if (preg_match('/algoliasearch_/', $section)) { - if ($section === 'algoliasearch_cc_analytics') { - $isClickAnalyticsEnabled = $viewModel->isClickAnalyticsEnabled(); - } - $linksAndVideoTemplate = $viewModel->getLinksAndVideoTemplate($section); $extensionNotices = $viewModel->getExtensionNotices(); $personalizationStatus = $viewModel->getPersonalizationStatus(); diff --git a/view/adminhtml/templates/landingpage/access_denied.phtml b/view/adminhtml/templates/landingpage/access_denied.phtml deleted file mode 100644 index d079049b3..000000000 --- a/view/adminhtml/templates/landingpage/access_denied.phtml +++ /dev/null @@ -1,21 +0,0 @@ -getViewFileUrl('Algolia_AlgoliaSearch::images/illu-lpb.svg'); -$bookIllustration = $block->getViewFileUrl('Algolia_AlgoliaSearch::images/icon-book.svg'); -$starsIllustration = $block->getViewFileUrl('Algolia_AlgoliaSearch::images/icon-stars.svg'); -?> -
-
The Landing Page Builder allows you to easily create customised landing pages out of search queries.
-It is a powerful marketing tool to promote products, with a strong focus on SEO. To find out more about the Landing Page Builder, please see our documentation.
-To get access to this Algolia feature, please consider upgrading to a higher plan.
-diff --git a/view/adminhtml/templates/landingpage/search-configuration.phtml b/view/adminhtml/templates/landingpage/search-configuration.phtml index 1eed9efc7..c32ae2e52 100644 --- a/view/adminhtml/templates/landingpage/search-configuration.phtml +++ b/view/adminhtml/templates/landingpage/search-configuration.phtml @@ -77,21 +77,13 @@ $isConfig = [
To be able to sort search results in particular order (promote or demote items), please consider upgrading to a higher plan.
-@@ -106,9 +98,7 @@ $isConfig = [
- getPlanLevel() == 3) : ?> -
- +
@@ -177,9 +163,7 @@ $isConfig = [
- getPlanLevel() == 3) : ?> -
- +
@@ -232,9 +212,7 @@ $isConfig = [
@@ -660,12 +636,10 @@ $isConfig = [ } ); - getPlanLevel() == 3) : ?> search.on('render', function() { initAutocomplete(); initSortableTable(); }); - search.start(); diff --git a/view/adminhtml/templates/merchandising/page.phtml b/view/adminhtml/templates/merchandising/page.phtml index b2d65c8ab..1ae3de7eb 100644 --- a/view/adminhtml/templates/merchandising/page.phtml +++ b/view/adminhtml/templates/merchandising/page.phtml @@ -1,7 +1,5 @@ -getViewModel(); ?> +/** @var \Magento\Backend\Block\Template $block */ ?>
escapeHtml(__('Easily promote or demote products for a search. Based on Algolia\'s Query rules, the Query merchandiser allows you to enhance the ranking behavior for specific search queries.')) ?>
escapeHtml(__('Give more visibility to specific products within a category page. Promote or demote displayed items by using a simple drag and drop mechanism.')) ?>
escapeHtml(__('The Landing Page Builder allows you to easily create customised landing pages out of search queries. It is a powerful marketing tool to promote products, with a strong focus on SEO.')) ?>
Easily promote or demote products for a search. Based on Algolia's Query rules, the Query Merchandiser allows you to enchance the ranking behaviour for specific search queries.
-Merchandising a query will create a new query rule (which are part of your Algolia plan). To find out more about the Query Merchandiser, please see our documentation.
-To get access to this Algolia feature, please consider upgrading to a higher plan.
-There's Documentation, Tutorials and Videos - But we also offer expert advice and solutions through direct email support by Algolia engineers and product specialists.
-To get access to this Algolia feature, please consider upgrading to a higher plan.
-- -
- diff --git a/view/adminhtml/templates/tracking.phtml b/view/adminhtml/templates/tracking.phtml deleted file mode 100644 index 0952f2963..000000000 --- a/view/adminhtml/templates/tracking.phtml +++ /dev/null @@ -1,389 +0,0 @@ -getViewModel(); -$applicationId = $view->getApplicationId(); -?> - - \ No newline at end of file diff --git a/view/adminhtml/templates/ui/upsell-plan.phtml b/view/adminhtml/templates/ui/upsell-plan.phtml deleted file mode 100644 index ef4e2f79b..000000000 --- a/view/adminhtml/templates/ui/upsell-plan.phtml +++ /dev/null @@ -1,7 +0,0 @@ - -
To get access to this Algolia feature, please consider upgrading to a higher plan.
-\ No newline at end of file diff --git a/view/adminhtml/web/css/analytics.css b/view/adminhtml/web/css/analytics.css index a4c456833..88e42226e 100644 --- a/view/adminhtml/web/css/analytics.css +++ b/view/adminhtml/web/css/analytics.css @@ -73,6 +73,10 @@ padding: 2rem; } +.algoliasearch-analytics-overview .section.popular-results { + margin-left: 2% +} + .algoliasearch-analytics-overview .analytics-footer { margin-top: 1.5rem; text-align: left; diff --git a/view/adminhtml/web/css/landing-page.css b/view/adminhtml/web/css/landing-page.css index 2d9e91ad2..e70d6532f 100644 --- a/view/adminhtml/web/css/landing-page.css +++ b/view/adminhtml/web/css/landing-page.css @@ -783,7 +783,7 @@ a.ais-current-refined-values--link:hover { padding-top: 50px; } -@media (max-width: 992px) { +@media (max-width: 991px) { #algolia_instant_selector .facets { padding-top: 10px; } diff --git a/view/adminhtml/web/css/support.css b/view/adminhtml/web/css/support.css index 811a894fa..ca788df5a 100644 --- a/view/adminhtml/web/css/support.css +++ b/view/adminhtml/web/css/support.css @@ -362,10 +362,6 @@ a.footer { padding-top: 20px; } -#algolia-contact-panel { - display: none; -} - /* access denied */ .algolia-suggestions-header { width : 100%; diff --git a/view/frontend/templates/instant/stats.phtml b/view/frontend/templates/instant/stats.phtml index 5b740847c..65c246220 100644 --- a/view/frontend/templates/instant/stats.phtml +++ b/view/frontend/templates/instant/stats.phtml @@ -2,7 +2,7 @@ {{#hasOneResult}}1 escapeHtml(__('result')); ?> found{{/hasOneResult}} {{#hasManyResults}} - {{^hasNoResults}}{{first}}-{{last}} out of{{/hasNoResults}} + {{^hasNoResults}}{{first}}-{{last}} escapeHtml(__('out of')); ?>{{/hasNoResults}} {{nbHits}} escapeHtml(__('results found')); ?> diff --git a/view/frontend/web/instantsearch.js b/view/frontend/web/instantsearch.js index 624e03d8f..deb9831a0 100644 --- a/view/frontend/web/instantsearch.js +++ b/view/frontend/web/instantsearch.js @@ -477,12 +477,10 @@ requirejs(['algoliaBundle', 'Magento_Catalog/js/price-utils'], function (algolia return ['rangeInput', { container: facet.wrapper.appendChild(createISWidgetContainer(facet.attribute)), attribute: facet.attribute, - labels: { - currency: algoliaConfig.currencySymbol, - separator: algoliaConfig.translations.to, - button: algoliaConfig.translations.go - }, - templates: templates, + templates: $.extend({ + separatorText: algoliaConfig.translations.to, + submitText: algoliaConfig.translations.go + }, templates), cssClasses: { root: 'conjunctive' }, @@ -619,6 +617,8 @@ requirejs(['algoliaBundle', 'Magento_Catalog/js/price-utils'], function (algolia input.value = ''; }); } + + input.value = renderOptions.query; } }); diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index c4768ea52..23ebda35b 100644 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -98,7 +98,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { var colors = []; $.each(hit._highlightResult.color, function (i, color) { - if (color.matchLevel === 'none') { + if (color.matchLevel === undefined || color.matchLevel === 'none') { return; } @@ -106,7 +106,6 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { if (algoliaConfig.useAdaptiveImage === true) { var matchedColor = color.matchedWords.join(' '); - if (hit.images_data && color.fullyHighlighted && color.fullyHighlighted === true) { matchedColors.push(matchedColor); } @@ -292,6 +291,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { hit.displayKey = hit.displayKey || hit.name; + hit.__indexName = algoliaConfig.indexName + "_" + section.name; hit.__queryID = payload.queryID; hit.__position = payload.hits.indexOf(hit) + 1; @@ -336,6 +336,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { var toEscape = hit._highlightResult.query.value; hit._highlightResult.query.value = algoliaBundle.autocomplete.escapeHighlightedString(toEscape); + hit.__indexName = algoliaConfig.indexName + "_" + section.name; hit.__queryID = payload.queryID; hit.__position = payload.hits.indexOf(hit) + 1; @@ -355,6 +356,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { suggestion: function (hit, payload) { hit.url = algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + hit.value + '&refinement_key=' + encodeURIComponent(section.name); + hit.__indexName = algoliaConfig.indexName + "_section_" + section.name; hit.__queryID = payload.queryID; hit.__position = payload.hits.indexOf(hit) + 1; @@ -569,7 +571,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { uiStateProductIndex.hierarchicalMenu[currentFacet.attribute+ '.level0'].join('~')); } // Handle sliders - if (currentFacet.type == 'slider') { + if (currentFacet.type == 'slider' || currentFacet.type == 'priceRanges') { routeParameters[currentFacet.attribute] = (uiStateProductIndex.range && uiStateProductIndex.range[currentFacet.attribute] && uiStateProductIndex.range[currentFacet.attribute]); @@ -621,7 +623,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { uiStateProductIndex['hierarchicalMenu']['categories.level0'] = [algoliaConfig.request.path]; } // Handle sliders - if (currentFacet.type == 'slider') { + if (currentFacet.type == 'slider' || currentFacet.type == 'priceRanges') { var currentFacetAttribute = currentFacet.attribute; if (currentFacetAttribute.indexOf("price") !== -1) { currentFacetAttribute += algoliaConfig.priceKey; diff --git a/view/frontend/web/internals/grid.css b/view/frontend/web/internals/grid.css index 3fffe2706..16308eb09 100644 --- a/view/frontend/web/internals/grid.css +++ b/view/frontend/web/internals/grid.css @@ -105,7 +105,7 @@ } } -@media (max-width: 992px) { +@media (max-width: 991px) { #algolia_instant_selector .visible-sm { display: block !important; }