I am trying to understand difference between getCrossSellProductCollection and getCrossSellProducts in layout module for cross sells.

As in my admin panel HTML


 * Retrieve crosssell products
 * @return array
public function getSelectedCrossSellProducts()
    $products = [];
    foreach ($this->_coreRegistry->registry('current_product')->getCrossSellProducts() as $product) {
        $products[$product->getId()] = ['position' => $product->getPosition()];
    return $products;

and what I use in frontend in my phtml to show is this

    $collection =  $currentProduct->getCrossSellProductCollection();
    $this->_crossSellProducts =  $collection->load();
    return $this->_crossSellProducts;

I am getting somehow less data for getCrossSellProducts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.