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:
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:
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.