Skip to content

Commit 89425b6

Browse files
committed
MAGE-897: unify objectIDs param
1 parent 78857c9 commit 89425b6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

view/frontend/templates/recommend/cart/recommend_items.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (!empty($recommendConfig['enabledRelatedInCart']) || !empty($recommendConfig[
1313
{
1414
"*": {
1515
"Algolia_AlgoliaSearch/recommend" : {
16-
"algoliObjectId" : <?= json_encode($cartItems) ?>
16+
"objectIDs" : <?= json_encode($cartItems) ?>
1717
}
1818
}
1919
}

view/frontend/templates/recommend/products.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (!empty($recommendConfig['enabledFBT'])
2222
{
2323
"*": {
2424
"Algolia_AlgoliaSearch/recommend" : {
25-
"algoliObjectId" : ["<?= $product->getId() ?>"]
25+
"objectIDs" : ["<?= $product->getId() ?>"]
2626
}
2727
}
2828
}

view/frontend/templates/recommend/widget/looking-similar.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if ($isEnabled):
1010
"Algolia_AlgoliaSearch/recommend" : {
1111
"recommendLSContainer" : "<?= $lsContainer ?>",
1212
"numOfLookingSimilarItem" : "<?= $block->getData('numOfLookingSimilarItem') ?>",
13-
"productIds" : <?= $block->getProductIds() ?>
13+
"objectIDs" : <?= $block->getProductIds() ?>
1414
}
1515
}
1616
}

view/frontend/web/recommend.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ define([
1919
const apiKey = algoliaConfig.apiKey;
2020
const recommendClient = recommend(appId, apiKey);
2121
const indexName = this.defaultIndexName;
22-
const objectIds = config.productIds ? config.productIds : config.algoliObjectId;
22+
const objectIDs = config.objectIDs;
2323
if (
2424
$('body').hasClass('catalog-product-view') ||
2525
$('body').hasClass('checkout-cart-index')
2626
) {
2727
// --- Add the current product objectID here ---
28-
if (
28+
if (
2929
(algoliaConfig.recommend.enabledFBT &&
3030
$('body').hasClass('catalog-product-view')) ||
3131
(algoliaConfig.recommend.enabledFBTInCart &&
@@ -35,7 +35,7 @@ define([
3535
container : '#frequentlyBoughtTogether',
3636
recommendClient,
3737
indexName,
38-
objectIDs : objectIds,
38+
objectIDs,
3939
maxRecommendations: algoliaConfig.recommend.limitFBTProducts,
4040
transformItems : function (items) {
4141
return items.map((item, index) => ({
@@ -68,7 +68,7 @@ define([
6868
container : '#relatedProducts',
6969
recommendClient,
7070
indexName,
71-
objectIDs : objectIds,
71+
objectIDs,
7272
maxRecommendations: algoliaConfig.recommend.limitRelatedProducts,
7373
transformItems : function (items) {
7474
return items.map((item, index) => ({
@@ -176,7 +176,7 @@ define([
176176
container: '#lookingSimilar',
177177
recommendClient,
178178
indexName,
179-
objectIDs: objectIds,
179+
objectIDs,
180180
maxRecommendations: algoliaConfig.recommend.limitLookingSimilar,
181181
transformItems: function (items) {
182182
return items.map((item, index) => ({
@@ -200,15 +200,15 @@ define([
200200
});
201201
} else if (
202202
algoliaConfig.recommend.enabledLookingSimilar &&
203-
objectIds &&
203+
objectIDs &&
204204
typeof config.recommendLSContainer !== 'undefined'
205205
){
206206
let containerValue = '#' + config.recommendLSContainer;
207207
recommendJs.lookingSimilar({
208208
container: containerValue,
209209
recommendClient,
210210
indexName,
211-
objectIDs: objectIds,
211+
objectIDs,
212212
maxRecommendations: config.numOfLookingSimilarItem
213213
? parseInt(config.numOfLookingSimilarItem)
214214
: algoliaConfig.recommend.limitLookingSimilar,

0 commit comments

Comments
 (0)