need a popup

  • Posts: 54
  • Thank you received: 3
5 hours 30 minutes ago #368239

-- HikaShop version -- : 6.1.0
-- Joomla version -- : 5.3.3
-- PHP version -- : 8.2

Hi
please see the attachment
is there any wau that i can put a confirm popup on that green confirm button ? i mean on clicking on this button, a popup promt apear and ask "are you sure you want to edit order? "
something like that

Attachments:

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

  • Posts: 84233
  • Thank you received: 13677
  • MODERATOR
2 minutes ago #368240

Hi,

Yes, it's possible.

1. First, when you want to change the interface in HikaShop and that CSS is not enough and there is no easy option to toggle for it, you likely will have to do a view override via the menu Display>Views of HikaShop's backend.

2. So, you need to find which view file to edit. For that, you can use the "Display view files" setting of the HikaShop configuration page:
www.hikashop.com/support/documentation/5...g.html#advanced_main
Here, it should give you the view order / edit_products in the popup.

3. So, edit this view file via the Display>Views menu and you'll see the HTML / PHP / JS code of the view.
Since you want to edit the "Save" button, you can search for it in the code with your browser's search, and you'll find this line:

<a class="btn btn-success" href="#save" onclick="return window.hikashop.submitform('save','hikashop_order_product_form');"><i class="fa fa-save"></i> <?php echo JText::_('HIKA_SAVE'); ?></a>

4. So, that's the line you want to change. You can see there's already an "onclick" attribute which triggers the saving process.
And in HTML / JS, you have a simple method to add a confirm mechanism like you're talking about with the "confirm" function:
developer.mozilla.org/en-US/docs/Web/API/Window/confirm
So, basically, you want to add the confirm function to that onclick attribute. The result should be something like that:
<a class="btn btn-success" href="#save" onclick="if(window.confirm('Are you sure you want to edit order?')) { return window.hikashop.submitform('save','hikashop_order_product_form'); } else { return false; }"><i class="fa fa-save"></i> <?php echo JText::_('HIKA_SAVE'); ?></a>
The "else{ return false; }" will cancel the click event after the user clicks on the cancel button of the confirm popup. This way, the brower won't do anything.

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

Time to create page: 0.053 seconds
Powered by Kunena Forum