diff --git a/imports/plugins/included/product-variant/containers/productsContainer.js b/imports/plugins/included/product-variant/containers/productsContainer.js index 93448b4f7cf..c6a5613e676 100644 --- a/imports/plugins/included/product-variant/containers/productsContainer.js +++ b/imports/plugins/included/product-variant/containers/productsContainer.js @@ -115,24 +115,24 @@ function composer(props, onData) { if (!tag && slug) { return; } + const currentTag = ReactionProduct.getTag(); + + const sort = { + [`positions.${currentTag}.position`]: 1, + [`positions.${currentTag}.createdAt`]: 1, + createdAt: 1 + }; const queryParams = Object.assign({}, tags, Reaction.Router.current().queryParams); - const productsSubscription = Meteor.subscribe("Products", scrollLimit, queryParams); + const productsSubscription = Meteor.subscribe("Products", scrollLimit, queryParams, sort); if (productsSubscription.ready()) { window.prerenderReady = true; } - const currentTag = ReactionProduct.getTag(); const productCursor = Products.find({ ancestors: [], type: { $in: ["simple"] } - }, { - sort: { - [`positions.${currentTag}.position`]: 1, - [`positions.${currentTag}.createdAt`]: 1, - createdAt: 1 - } }); const products = productCursor.map((product) => {