Skip to content

Commit ccddef7

Browse files
committed
lookingSimilar styling issue resolved
1 parent 52ec0bb commit ccddef7

File tree

8 files changed

+36
-59
lines changed

8 files changed

+36
-59
lines changed

Block/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public function getConfiguration()
225225
'limitFBTProducts' => $config->getNumberOfFrequentlyBoughtTogetherProducts(),
226226
'limitRelatedProducts' => $config->getNumberOfRelatedProducts(),
227227
'limitTrendingItems' => $config->getNumberOfTrendingItems(),
228+
'limitLookingSimilar' => $config->getNumberOfLookingSimilar(),
228229
'enabledTrendItems' => $config->isRecommendTrendingItemsEnabled(),
229230
'trendItemFacetName' => $config->getTrendingItemsFacetName(),
230231
'trendItemFacetValue' => $config->getTrendingItemsFacetValue(),

Helper/ConfigHelper.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class ConfigHelper
127127
protected const IS_REMOVE_RELATED_PRODUCTS_BLOCK = 'algoliasearch_recommend/recommend/related_product/is_remove_core_related_products_block';
128128
protected const IS_REMOVE_UPSELL_PRODUCTS_BLOCK = 'algoliasearch_recommend/recommend/frequently_bought_together/is_remove_core_upsell_products_block';
129129
protected const IS_RECOMMEND_TRENDING_ITEMS_ENABLED = 'algoliasearch_recommend/recommend/trends_item/is_trending_items_enabled';
130+
protected const NUM_OF_LOOKING_SIMILAR = 'algoliasearch_recommend/recommend/looking_similar/num_of_products';
130131
protected const NUM_OF_TRENDING_ITEMS = 'algoliasearch_recommend/recommend/trends_item/num_of_trending_items';
131132
protected const TREND_ITEMS_FACET_NAME = 'algoliasearch_recommend/recommend/trends_item/facet_name';
132133
protected const TREND_ITEMS_FACET_VALUE = 'algoliasearch_recommend/recommend/trends_item/facet_value';
@@ -809,6 +810,21 @@ public function getNumberOfTrendingItems($storeId = null)
809810
);
810811
}
811812

813+
/**
814+
* Returns number of looking similar products to display
815+
*
816+
* @param $storeId
817+
* @return int
818+
*/
819+
public function getNumberOfLookingSimilar($storeId = null)
820+
{
821+
return (int)$this->configInterface->getValue(
822+
self::NUM_OF_LOOKING_SIMILAR,
823+
ScopeInterface::SCOPE_STORE,
824+
$storeId
825+
);
826+
}
827+
812828
/**
813829
* @param $storeId
814830
* @return mixed

view/frontend/templates/recommend/products.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (!empty($recommendConfig['enabledFBT'])
1717
<div id="frequentlyBoughtTogether" class="recommend-component"></div>
1818
<div id="relatedProducts" class="recommend-component"></div>
1919
<div id="trendItems" class="trendsItem recommend-component"></div>
20-
<div id="looking-similar" class="looking-similar recommend-component"></div>
20+
<div id="lookingSimilar" class="lookingSimilar recommend-component"></div>
2121
<script type="text/x-magento-init">
2222
{
2323
"*": {

view/frontend/templates/recommend/products/frequently-bought-together.phtml

Lines changed: 0 additions & 13 deletions
This file was deleted.

view/frontend/templates/recommend/products/related-products.phtml

Lines changed: 0 additions & 13 deletions
This file was deleted.

view/frontend/templates/recommend/products/trending-items.phtml

Lines changed: 0 additions & 22 deletions
This file was deleted.

view/frontend/web/internals/recommend.css

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,29 @@
1414
.recommend-component {
1515
margin-bottom: 80px;
1616
}
17-
#relatedProducts .auc-Recommend-list, #frequentlyBoughtTogether .auc-Recommend-list, .trendsItem .auc-Recommend-list{
17+
18+
#relatedProducts .auc-Recommend-list,
19+
#frequentlyBoughtTogether .auc-Recommend-list,
20+
#lookingSimilar .auc-Recommend-list,
21+
.trendsItem .auc-Recommend-list {
1822
flex-wrap: wrap;
1923
justify-content: flex-start;
2024
}
21-
#relatedProducts li, #frequentlyBoughtTogether li, .trendsItem li {
25+
#relatedProducts li, #frequentlyBoughtTogether li, #lookingSimilar li, .trendsItem li {
2226
display: flex;
2327
justify-content: center;
2428
width: 16.66666667%;
2529
}
26-
#relatedProducts li a, #frequentlyBoughtTogether li a, .trendsItem li a {
30+
#relatedProducts li a, #frequentlyBoughtTogether li a, #lookingSimilar li a, .trendsItem li a {
2731
color: inherit;
2832
display: block;
2933
}
30-
#relatedProducts .product-name, #frequentlyBoughtTogether .product-name, #trendItems .product-name, .trendsItem .product-name{
34+
35+
#relatedProducts .product-name,
36+
#frequentlyBoughtTogether .product-name,
37+
#trendItems .product-name,
38+
#lookingSimilar .product-name,
39+
.trendsItem .product-name {
3140
text-align: center;
3241
width: 150px;
3342
text-overflow: ellipsis;
@@ -61,12 +70,12 @@
6170
color: #FFFFFF;
6271
}
6372
@media (min-width: 768px) and (max-width: 1023px) {
64-
#relatedProducts li, #frequentlyBoughtTogether li, #trendItems li {
73+
#relatedProducts li, #frequentlyBoughtTogether li, #trendItems li, #lookingSimilar li {
6574
width: 33.33333333%;
6675
}
6776
}
6877
@media (max-width: 767px) {
69-
#relatedProducts li, #frequentlyBoughtTogether li, #trendItems li {
78+
#relatedProducts li, #frequentlyBoughtTogether li, #trendItems li, #lookingSimilar li {
7079
width: 50%;
7180
}
7281
}

view/frontend/web/recommend.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,12 @@ define([
171171
(algoliaConfig.recommend.isLookingSimilarEnabledOnCartPage &&
172172
$('body').hasClass('checkout-cart-index'))
173173
) {
174-
console.log(recommendClient);
175-
console.log(indexName);
176174
recommendJs.lookingSimilar({
177-
container: '#looking-similar',
175+
container: '#lookingSimilar',
178176
recommendClient,
179177
indexName,
180-
maxRecommendations: 6,
178+
objectIDs: config.algoliObjectId,
179+
maxRecommendations: algoliaConfig.recommend.limitLookingSimilar,
181180
transformItems: function (items) {
182181
return items.map((item, index) => ({
183182
...item,

0 commit comments

Comments
 (0)