TransWikia.com

How to Add Html Link Additional Options in Magento 2.3.3

Magento Asked by Kanchi_1695 on November 30, 2020

I’ve applied following solution, its working up to magento 2.3.2 version but its not working in magento 2.3.3

$printableDesignImagesLinks .= '<a href="' . $this->helperData->getMediaUrl() . $this->helperData->getPrintableDesignsPath() . '/' . $printableDesignImages[$i] . '" target="_blank">' . $printableDesignImages[$i] . '</a>';

$additionalOptions[] = [
    'label' => "Printable Design Images",
    'value' => $printableDesignImagesLinks
];

$item->addOption(array(
    'product_id' => $item->getProductId(),
    'code' => 'additional_options',
    'value' => $this->jsonSerializer->serialize($additionalOptions)
));

Output :

enter image description here

Is there any solution for this issue? Just let me know
Thank you in advance!

One Answer

Try adding additional options like below in your observer.

_cart is MagentoCheckoutModelCart
_request is MagentoFrameworkAppRequestHttp

$quote = $this->_cart->getQuote();
$quote_item = $quote->getItemByProduct($observer->getEvent()->getProduct());
$postedData = $this->_request->getPost();

$additionalOptions[] = array(
    'label' => "My Custom Artwork",
    'value' => __('<a target="_blank" href="%1">My Custom Artwork</a>','YOUR DATA HERE')
);
$quote_item->addOption([
    'product' => $postedData['product'],
    'code'  => 'additional_options',
    'value' => json_encode($additionalOptions)
]);
$quote_item->saveItemOptions();

Answered by Rizwan Khan on November 30, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP