Skip to content

Commit

Permalink
Merge branch 'dev' into 'main'
Browse files Browse the repository at this point in the history
Add V3 facets support

See merge request engineering/sm/magento-discovery-connector!19
  • Loading branch information
lachire committed Jul 31, 2024
2 parents 3a5fc99 + 0b2f9a1 commit 5deab7e
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 17,607 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
node_modules/
dist/
.magento/
.env

# Compiled Java class files
*.class
Expand Down
34 changes: 33 additions & 1 deletion Block/CategoryInfoBlock.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
<?php
/**
* Bloomreach Connector extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the Bloomreach Proprietary License
* that is bundled with this package in the file LICENSE.txt.
*
* @category Bloomreach
* @package Connector
* @copyright Copyright (c) 2021-current Bloomreach Inc.
*/
namespace Bloomreach\Connector\Block;

/**
* Class CategoryInfoBlock
* package Bloomreach\Connector\Block
*/
class CategoryInfoBlock extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Framework\Registry
*/
protected $_registry;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
Expand All @@ -15,19 +39,27 @@ public function __construct(
parent::__construct($context, $data);
}

/**
* @return CategoryInfoBlock
*/
public function _prepareLayout()
{
return parent::_prepareLayout();
}

/**
* @return mixed|null
*/
public function getCurrentCategory()
{
return $this->_registry->registry('current_category');
}

/**
* @return mixed|null
*/
public function getCurrentProduct()
{
return $this->_registry->registry('current_product');
}
}
?>
4 changes: 4 additions & 0 deletions Observer/ConfigObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class ConfigObserver implements ObserverInterface
* @var RequestInterface
*/
private $request;
/**
* @var WriterInterface
*/
private $configWriter;

/**
* ConfigChange constructor.
Expand Down
10 changes: 10 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.8.0

## Added

- [`ADDED`]: Added support for [Bloomreach Discovery Facet Response V3](https://documentation.bloomreach.com/discovery/reference/facet-response-v3-unified-ranking).

## Fixed

- [`FIXED`]: When adding multiple Recommendations widgets in storefronts, only one was showing.

## 1.7.1

## Fixed
Expand Down
5 changes: 1 addition & 4 deletions ViewModel/Head/ScriptInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Directory\Model\Currency;


/**
* Class ScriptInit
* package Bloomreach\Connector\ViewModel\Head
Expand Down Expand Up @@ -687,7 +686,6 @@ public function isPixelDevelopment()
{
$val = $this->getStoreConfigValue(self::RECOMM_PIXEL_DEVELOPMENT);
return 1 == $val;

}

/**
Expand Down Expand Up @@ -730,8 +728,7 @@ public function getAccountId()
}

/**
* Get current customer unique id. This will become a visitor ID if customer
* is not logged in.
* Get current customer unique id. This will become a visitor ID if customer is not logged in.
*/
public function getCustomerId()
{
Expand Down
1 change: 1 addition & 0 deletions bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const commander = require("commander");
const path = require("path");
const shell = require("shelljs");
require('dotenv').config();

const { Command } = commander;
const program = new Command();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bloomreach/bloomreach-connector-magento",
"description": "Bloomreach connector for autosuggest,collection and product search",
"version": "1.7.1",
"version": "1.8.0",
"type": "magento2-module",
"license": "proprietary",
"authors": [
Expand Down
32 changes: 10 additions & 22 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,9 @@
<span class="blm-range-slider__values--min">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[0] * 100) : config.format_money(priceRangeFacet.start * 100) %>
</span>
<% if (checkedFacets.price) { %>
<span class="blm-range-slider__values--max">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[1] * 100) : config.format_money(priceRangeFacet.start * 100) %>
</span>
<% } else { %>
<span class="blm-range-slider__values--max">
<%= config.format_money(priceRangeFacet.end * 100) %>
</span>
<% } %>
<span class="blm-range-slider__values--max">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[1] * 100) : config.format_money(priceRangeFacet.end * 100) %>
</span>
</div>
<% if (checkedFacets.price) { %>
<div class="blm-range-slider__clear-values">
Expand All @@ -231,8 +225,8 @@
<input
type="checkbox"
<% if (facet.original_title in checkedFacets && checkedFacets[facet.original_title].includes(escapeSpecialCharacters(item.id))) { %>checked<% } %>
name="<%- facet.original_title %>"
value="<%- escapeSpecialCharacters(item.id) %>"
name="<%= facet.original_title %>"
value="<%= escapeSpecialCharacters(item.id) %>"
id="<%- facet.original_title + '[' + escapeSpecialCharacters(item.name) + ']' %>"
class="blm-product-search-filter-item__checkbox"
/>
Expand Down Expand Up @@ -576,15 +570,9 @@
<span class="blm-range-slider__values--min">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[0] * 100) : config.format_money(priceRangeFacet.start * 100) %>
</span>
<% if (checkedFacets.price) { %>
<span class="blm-range-slider__values--max">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[1] * 100) : config.format_money(priceRangeFacet.start * 100) %>
</span>
<% } else { %>
<span class="blm-range-slider__values--max">
<%= config.format_money(priceRangeFacet.end * 100) %>
</span>
<% } %>
<span class="blm-range-slider__values--max">
<%= checkedFacets.price ? config.format_money(checkedFacets.price[1] * 100) : config.format_money(priceRangeFacet.end * 100) %>
</span>
</div>
<% if (checkedFacets.price) { %>
<div class="blm-range-slider__clear-values">
Expand All @@ -604,8 +592,8 @@
<input
type="checkbox"
<% if (facet.original_title in checkedFacets && checkedFacets[facet.original_title].includes(escapeSpecialCharacters(item.id))) { %>checked<% } %>
name="<%- facet.original_title %>"
value="<%- escapeSpecialCharacters(item.id) %>"
name="<%= facet.original_title %>"
value="<%= escapeSpecialCharacters(item.id) %>"
id="<%- facet.original_title + '[' + escapeSpecialCharacters(item.name) + ']' %>"
class="blm-product-search-filter-item__checkbox"
/>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magento-connector",
"version": "1.7.1",
"version": "1.8.0",
"description": "NPM tools to aid in developing this connector application",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -29,6 +29,7 @@
"change-case": "4.1.2",
"colors": "1.4.0",
"commander": "10.0.0",
"dotenv": "16.4.5",
"enquirer": "2.3.6",
"fs-extra": "11.1.0",
"hostile": "1.3.3",
Expand Down
Loading

0 comments on commit 5deab7e

Please sign in to comment.