I have set the category sort order to ‘position’ both in store catalog settings and categories settings.
It works fine on category view. However when on a product page the previous/next product link doesn’t have the same order as per the category page.
I’ve come across many post on this saying it comes from Mageplaza/LayeredNavigation but none of the solutions seems to work.
Product position that comes from this code doesn’t get the position stated in category backend :
public function getPrevProduct($product) {
$current_category = $product->getCategory();
if(!$current_category) {
foreach($product->getCategoryCollection() as $parent_cat) {
$current_category = $parent_cat;
}
}
if(!$current_category)
return false;
$cat_prod_ids = $this->getCategoryProductIds($current_category);
$_pos = array_search($product->getId(), $cat_prod_ids);
if (isset($cat_prod_ids[$_pos - 1])) {
$prev_product = $this->getModel('MagentoCatalogModelProduct')->load($cat_prod_ids[$_pos - 1]);
return $prev_product;
}
return false;
}
Does anyone has some insight to share?