same adress as billing opens "new address" modal

  • Posts: 154
  • Thank you received: 4
12 years 1 month ago #67089

hello, i would like to accomplish the following:
if someone unclicks the check-box "use same address as billing", then it should also open the modal-popup for adding a new address. we think this is more straightforward, than editing the appearing one (which is the billing address) in order to add a new one, or clicking on the "add new" button. it could be kind of irritating (especially for old or not internet-savvy folks) that when you unclick "use same as billing" the same address as in billing appears first... could that with the modal be accomplished? i guess i have to add another JS inside checkout/address.php line50, someting like "return hikashopEditAddress(this,0,true);" where "this" should be something different??? please correct me / help me on this. thanks!

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #67162

Hi olivnewton,

In the "checkout / address" view, you can replace the line:

			<input class="hikashop_checkout_shipping_same_address inputbox" <?php echo $checked; ?>type="checkbox" id="same_address" name="same_address" value="yes" alt="Same address" onclick="return hikashopSameAddress(this.checked);" />
By:
			<input class="hikashop_checkout_shipping_same_address inputbox" <?php echo $checked; ?>type="checkbox" id="same_address" name="same_address" value="yes" alt="Same address" onclick="var link = document.getElementById('hikashop_checkout_shipping_address_new_link'); if(link)return hikashopEditAddress(link,true,true);" /><!-- hikashopSameAddress(this.checked); -->

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

  • Posts: 154
  • Thank you received: 4
12 years 1 month ago #67166

that works great! thanks!
but: now, if its unchecked and someone checks back, it opens the "new address" modal again. of course this should not happen!
could you please help on this as well?

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #67248

Maybe you can add a if / else condition.
For example, if(this.value == "yes"){ return hikashopEditAddress(link,true,true);} else{hikashopSameAddress(this.checked);}

Not sure of this value.

The following user(s) said Thank You: olivnewton

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

  • Posts: 154
  • Thank you received: 4
12 years 1 month ago #67270

thanks for this. we used a different solution: hiding the "same address" checkbox + label, after first click on it, as well as checking if checkbox is checked with js and hiding it for after the reload or visiting the page again

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

Time to create page: 0.071 seconds
Powered by Kunena Forum