AnswerBun.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!

Related Questions

Admin grid save & continue edit button – ui components

1  Asked on January 6, 2022 by rihards-repels

 

Change Magento 2 website based on IP

1  Asked on January 6, 2022

         

Magento 2 : Problem Adding Validation Form With Mixin

2  Asked on January 4, 2022 by juris-toms-liepi

   

magento 2.3.4 installation issue in localhost

1  Asked on January 2, 2022 by ggc

 

Disable products per store

2  Asked on December 30, 2021

       

Catalog Search reindex not completing

2  Asked on December 30, 2021 by stuart-hoff

   

Moving content of custom header Magento 2

1  Asked on December 30, 2021 by aissa-mahdi

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir