1

I've been working on a module to change Magento Thumbnails in the Cart, Minicart and Checkout Order Summary. The only place I cannot get this to work is the Checkout Order Summary. There is a real lack of documentation on how to modify the image thumbnails there.

So far, I have:

<?php
namespace Configurable\Products\Plugin;
use Magento\Checkout\Model\Cart\ImageProvider;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Quote\Model\Quote\ItemFactory;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Checkout\CustomerData\DefaultItem;
class afterGetImages
{
 protected $itemFactory;
 public function __construct(
 \Magento\Sales\Model\Order\ItemFactory $itemFactory,
 ) {
 $this->itemFactory = $itemFactory;
 }
public function afterGetImages(ImageProvider $subject, array $result): array
 {
 
 foreach ($result as $itemId => $value) {
 /** @var \Magento\Quote\Model\Quote\Item $item **/
 $item = $this->itemFactory->create()->load($itemId);
 if ($item) {
 $productid = $item->getProduct();
 }
 }
 }
}

But this returns:

Return value must be of type array, none returned on line 31

It does not seem to be fetching the data correctly.

Secondly, I can find no information of what argument to modify to change the Order Summary Checkout Image. Looking at magento/module-checkout/Model/Cart/ImageProvider.php, it includes:

$imageData = [
 'src' => $imageHelper->getUrl(),
 'alt' => $imageHelper->getLabel(),
 'width' => $imageHelper->getWidth(),
 'height' => $imageHelper->getHeight(),
];
return $imageData;

But including this logic in my function:

$imageData = [
 'src' => "Image Url",
 ];
 return $imageData;

Does not change the image. I've spend many days on this but I keep hitting a brick wall. What needs to be changed here to modify the Checkout Order Summary Thumbnails? I found this thread but it didn't seem to change Order Summary Thumbnails for me.

Thank you.

asked Nov 7, 2023 at 15:23
3

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.