0

When I click on item "edit link" modal popup is open but when i edit other product it will show previous product data.

Can anyone help to get dynamic popup with dynamic data in per different products?

Please refer screenshots below:

enter image description here

enter image description here

  • Update the code which you have tried to your question. – Sukumar Gorai Dec 19 '18 at 8:57
0

You need to customize edit.phtml file to achieve it. To customize the item renderer file, you can copy edit.phtml file from

vendor/magento/module-checkout/view/frontend/templates/cart/item/renderer/actions/edit.phtml

to your custom theme.

add dynamic id to edit link by using below code:

<?php $_item = $block->getItem(); ?>

<?php if ($block->isProductVisibleInSiteVisibility()): ?>
    <a id="your_id_<?php echo $_item->getItemId(); ?>" class="action action-edit"
       href="<?= /* @escapeNotVerified */ $block->getConfigureUrl() ?>"
       title="<?= $block->escapeHtml(__('Edit item parameters')) ?>">
        <span>
            <?= /* @escapeNotVerified */ __('Edit') ?>
        </span>
   </a>
<?php endif ?>

<script type="text/javascript">
require(['jquery'],
    function ($) {
        var quote_item_id = "<?php echo $_item->getItemId(); ?>";
        $(document).on('click', '#your_id_' + quote_item_id, function (e) {
            //code to open your modal popup
        }
    });
</script>

Now trigger popup modal on click of this id.

I hope it will help you out, let me know in case any doubt.

Your Answer

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

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