Confirmation before address delete?

  • Posts: 48
  • Thank you received: 1
9 years 10 months ago #188026

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 10 months ago #188057

Hi,

Try to change the line:

<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:
<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:
<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:
<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: 9 years 10 months ago by nicolas.

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

  • Posts: 48
  • Thank you received: 1
9 years 10 months ago #188059

replace "eturn false;" with "return false;" and this works perfectly. :)

Thank you!

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 9 months ago #188065

Thanks, I've updated the code ;)

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

Time to create page: 0.062 seconds
Powered by Kunena Forum