Hi I have some cross sells that appear after adding to basket, when setting the "position" attribute in the backend for each cross sell it does not affect their actual order frontend!

The code is

<?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?>

What can I add to this to get $_product->getCrossSellProducts() in order of their position?

I tried the following but get a blank popup so obviously errors.

<?php if($_crossSellProducts = $_product->getCrossSellProducts()->addAttributeToSort('position')): ?>


1 Answer 1


It's because the method getCrossSellProducts returns an array an not a collection.

Try the following :

$_crossSellProducts = $_product->getCrossSellProductCollection()

If you have many calls to this method in your page, I recommend you to use an observer on the before load for this collection.

  • Hi its just the one call, however I still get them showing not in position order :( <?php if($_crossSellProducts = $_product->getCrossSellProductCollection()->addAttributeToSort('position')): ?> Commented Dec 15, 2015 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.