Skip to main content

Confirmation before address delete?

More
11 years 8 months ago #188026 by Llarian
-- HikaShop version -- : 2.3.5
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.4.36

I realize you can only do so much to protect your users from themselves, but I can see this causing problems.

In the address management (and shipping/billing address checkout workflow pages), there is a delete icon next to the address. If the user clicks that, their address is immediately deleted without any confirmation.

Is there any easy way to add a confirmation step to the address delete button?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago - 11 years 8 months ago #188057 by nicolas
Hi,

Try to change the line:
Code:
<a title="<?php echo JText::_('HIKA_DELETE'); ?>" class="hikashop_checkout_<?php echo $this->type;?>_address_delete" href="<?php echo hikashop_completeLink('checkout&step='.$this->step.'&redirect=checkout&task=deleteaddress&address_id='.$address->address_id.'&'.hikashop_getFormToken().'=1'.$this->url_itemid);?>"><img alt="<?php echo JText::_('HIKA_DELETE'); ?>" src="<?php echo HIKASHOP_IMAGES; ?>delete.png" border="0" /></a>
to:
Code:
<a onclick="if(!confirm('<?php echo JText::_('HIKASHOP_CONFIRM_DELETE_ADDRESS', true); ?>')){return false;}else{return true;}" title="<?php echo JText::_('HIKA_DELETE'); ?>" class="hikashop_checkout_<?php echo $this->type;?>_address_delete" href="<?php echo hikashop_completeLink('checkout&step='.$this->step.'&redirect=checkout&task=deleteaddress&address_id='.$address->address_id.'&'.hikashop_getFormToken().'=1'.$this->url_itemid);?>"><img alt="<?php echo JText::_('HIKA_DELETE'); ?>" src="<?php echo HIKASHOP_IMAGES; ?>delete.png" border="0" /></a>
in the file "address_view" of the view "checkout" via the menu Display>Views and that should add it on the checkout.
For the address manager area, change the code:
Code:
<a href="<?php echo hikashop_completeLink('address&task=delete&address_id='.$address->address_id.'&'.$token.'=1&Itemid='.$Itemid);?>" title="<?php echo JText::_('HIKA_DELETE'); ?>"><img src="<?php echo HIKASHOP_IMAGES; ?>delete.png" alt="<?php echo JText::_('HIKA_DELETE'); ?>" /></a>
to:
Code:
<a onclick="if(!confirm('<?php echo JText::_('HIKASHOP_CONFIRM_DELETE_ADDRESS', true); ?>')){return false;}else{return true;}" href="<?php echo hikashop_completeLink('address&task=delete&address_id='.$address->address_id.'&'.$token.'=1&Itemid='.$Itemid);?>" title="<?php echo JText::_('HIKA_DELETE'); ?>"><img src="<?php echo HIKASHOP_IMAGES; ?>delete.png" alt="<?php echo JText::_('HIKA_DELETE'); ?>" /></a>
in the file "listing" of the view "address" via the menu Display>Views and that should do it.
Last edit: 11 years 8 months ago by nicolas.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #188059 by Llarian
replace "eturn false;" with "return false;" and this works perfectly. :)

Thank you!

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #188065 by nicolas
Thanks, I've updated the code ;)

Please Log in or Create an account to join the conversation.

Time to create page: 0.175 seconds
Powered by Kunena Forum