1

I have a store which has a slightly modified checkout.

I can't find the exact link right now on the original example, but I ditched the address drop-down and added an address grid where it lists the addresses in a grid layout with a button below to add a new one (you click it and a form opens)

EDIT: http://hkpatel201.blogspot.co.uk/2013/04/change-shipping-address-dropdown-at.html Might be the tutorial.

This works fine, but it can be a bit confusing for some customers.

Is there way of adding a "delete address" link within the checkout? There's one in the account panel:

<a href="#" onclick="return deleteAddress(this.id);" class="red-link"><?php echo $this->__('Delete Address') ?></a>

And

<script type="text/javascript">
//<![CDATA[
function deleteAddress(addressId) {
    if(confirm('<?php echo Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you want to delete this address?')) ?>')) {
        window.location='<?php echo $this->getDeleteUrl() ?>id/'+addressId;
    }
    return false;
}
//]]>
</script>

Which I naively thought would work within the checkout, but it didn't.

Deleting an address via the customer model is straightforward, so surely as long as the page refreshes I should have no problem?

Plus, the administrator can just as easily remove addresses as well, so it can't have any consequences on relationships with old orders etc.

Any help would be awesome :)

Tom

1 Answer 1

0

What about taking a look into: Mage_Customer_AddressController::deleteAction you can always call this action by ajax passing the proper address id.

Also in file: app/design/frontend/base/default/template/customer/address.phtml

at the end, the function: deleteAddress should show another example on how to delete the address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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