Skip to content

Commit

Permalink
Filter related products by position (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbclaudio authored Dec 14, 2021
1 parent 46e6fe5 commit 1f21dff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Models/Scopes/RelatedProductsScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ public function apply(Builder $builder, Model $model)
->leftJoin('amasty_mostviewed_product_index as mainrule', function ($join) use ($builder) {
$join->on('mainrule.entity_id', '=', $builder->getQuery()->from.'.entity_id')
->where('mainrule.relation', 'where_show')
->whereIn('mainrule.position', ['product_into_related', 'product_into_upsell'])
->where('mainrule.store_id', config('rapidez.store'));
})
->leftJoin('amasty_mostviewed_product_index as related', function ($join) {
$join->on('related.rule_id', '=', 'mainrule.rule_id')
->where('related.relation', 'what_show')
->whereIn('related.position', ['product_into_related', 'product_into_upsell'])
->where('related.store_id', config('rapidez.store'));
});
}
Expand Down

0 comments on commit 1f21dff

Please sign in to comment.