i want to remove item from minicart but using custom jquery ui popup. here is the default code
template/checkout/cart/minicart/default.phtml
<?php if (!$this->isOnCheckoutPage()): ?>
<a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>"
data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
class="remove">
<?php echo $this->__('Remove Item') ?>
</a>
<?php else: ?>
<span><?php echo $this->__('Remove Item') ?></span>
<?php endif; ?>
<?php endif ?>
This works fine.but i want custom popup instead of default alert. so i used jquery popup.
<div id="dialog123" title="Confirmation Required">
Are you sure you would like to remove this item from the shopping cart?
</div>
<a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>" class="remove-this-item">
<?php echo $this->__('Remove Item') ?>
</a>
<script type="text/javascript">
var $x=jQuery.noConflict();
$x(document).ready(function() {
$x("#dialog123").dialog({
autoOpen: false,
modal: true
});
});
$x(".remove-this-item").click(function(e) {
e.preventDefault();
var targetUrl = $x(this).attr("href");
$x("#dialog123").dialog({
buttons : {
"Confirm" : function() {
window.location.href = targetUrl;
},
"Cancel" : function() {
$x(this).dialog("close");
}
}
});
$x("#dialog123").dialog("open");
});
</script>
using this popup only i have to perform ajax delete operation. above code redirects to next page when confirmed YES.