Jump to content

[SOLVED] hide the address modify button


Recommended Posts

Hello,

I would like to change something in the CMS: when we are in the process of ordering a product (in the address stape), I want the "Edit" button located below the block "Address Billing" is displayed only when the customer select two different addresses for billing and delivery.


Thus, by default, i want that only the "Edit" button situated below the block "Delivery Address" displayed. However, if the customer untick "Use the same address for billing purposes" and select another address, I want the "Edit" button located below the block "Billing Address" is displayed at this time.


I've hacked together for almost five hours files "address.js (themes / js)" and "order-file.tpl "making something with the "display: none" but nothing conclusive yet ..

Basically, to help you, if idAddress_delivery is != of idAddress_invoice, we display the button "Modify" , otherwise you mask it.


Thank you in advance

Link to comment
Share on other sites

Thanks for trying helping me.

But that doesn't run , I think that the modifications are to be in the ajax file (address.js (themes / js)) because when we tick "Use the same address for billing purposes" and that we chose 2 different adresses, everything is dynamic.

Link to comment
Share on other sites

You're right. It looks like need to add the following code to the updateAddresses() function in order-address.js after the var definitions:

if (idAddress_delivery == idAddress_invoice)
   $('ul#address_invoice li.address_update').hide();
else
   $('ul#address_invoice li.address_update').show();

Link to comment
Share on other sites

Nice ! It's running very well.

However, there is a problem.. when we chose 2 different address and that we go in the
next page (carrier) and after that we want go back on the address page, the ajax file
is ignored, consequently the "modifiy button" is still displayed even if we have chosen 2 different address.

I think that the solution to solve the problem is to execute the ajax file (order-address.js) immediatly when we are on the addres page, so that it knows that if we have chosen 2 different addresses, it display the address button immediatly, if not, it mask

Nevertheless, I don't know how doing it.. ^^

Bye

Link to comment
Share on other sites

I've had another look at this issue. I thought I could get it to work by adding class="hidden" or style="display:none" in order-address.tpl, but it didn't work. It looks like it is not possible to do what you want to do.

Link to comment
Share on other sites

Hello !

My problem is solved !

Here the solution :

To hide the address button under the invoice address when the customer have chosen both same address for invoice and delivery, you have to add in order-address.js in the function updateAdresses() after the var definitions:

    if (idAddress_delivery == idAddress_invoice)
   $('li#address_invoice li.address_update').hide();
else
   $('li#address_invoice li.address_update').show();



After that, you have to make the ajax file (order-address.js) running immediatly when you have on the address page by adding that code in header.tpl

<body{if $page_name == "order" && $address_step}>



Then, add in order.php in displayAddress()

$smarty->assign('address_step', true);



Thank you very much Rocky :)

Link to comment
Share on other sites

I'm glad you figured it out. I tried doing a similar thing, but it caused the Update button to be displayed initially, then disappear, which I thought looked weird.

By the way, you don't need to modify order.php to do this, you can just use the following code:

<body{if $page_name == "order" && $smarty.get.step|intval == 1}>



That way, you only need to modify theme files, which lets you leave order.php unmodified.

Link to comment
Share on other sites

  • 3 months later...

Hi guys,

the above is great, but i can't figure out the following problem:

- I would like to hide the adress1 button from the 'overview page' where you present all customer info before payment.
is it possible to set the 'address_delivery select' dropdown on 'hide'? If yes, would you be so kind to elaborate a bit on this?

- I would like to not only present the name and address to the customer, but also the emailadress. Is there a solution for this as well?

Thanks a million!

Link to comment
Share on other sites

  • 9 years later...

I have been trying to do what you posted here in v1.6.1.24 Prestashop for a good while with no success!

In the post linked to below you explained how to prevent the edit address buttons showing against addresses at checkout when there the invoice and delivery address were the same.

Like you explained there I only want the edit buttons when there are different invoice and delivery addresses - it's confusing when there is only one address!

Post was here:

Unfortunately it's not working in 1.6- I wonder if you could point out what should work here? I did try a bit of javasript to force refresh the whole page, which does hide the buttons when only one address, but also the add billing address button disappears when page fully refreshed doing it that way 

Thanks

Baz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...