Jump to content

[SOLVED] User cannot update or delete address, redirects to add new address form


Recommended Posts

Hello,

I am currently building a new site.

I created a customer account as a test.

 

I go to My Account --> My Addresses

 

From here, I cannot update or delete an address.

 

When I click "update" it redirects to an Add a New Address form page.

When I click "delete", it first prompts, "Are you sure?" and when you hit OK, it then redirects to an Add New Address form page.

 

Any help is appreciated... thanks!!

Link to comment
Share on other sites

I think the problem may be related to the theme.

 

When using the theme " prestashop_new " the update and delete address links do not work.

 

When I switched to the theme "prestashop" the links work.

 

I guess I will start trying to troubleshoot this by comparing the addresses.tpl files of the two different themes..

Link to comment
Share on other sites

Seems to be fixed.

 

For some reason the addresses.tpl file in "prestashop_new" theme was not generating the correct links for updating or deleting addresses as a customer.

 

For example it was generating "https://site.com/prestashop/address"

 

instead of - "https://site.com/prestashop/address?id_address=3"

 

 

In address.tpl replaced the lines:

 

 

<li class="address_update"><a href="{$link->getPageLink('address', true, NULL, "id_address={$address.object.id|intval}")}" title="{l s='Update'}">{l s='Update'}</a></li>

<li class="address_delete"><a href="{$link->getPageLink('address', true, NULL, "id_address={$address.object.id|intval}&delete")}" onclick="return confirm('{l s='Are you sure?'}');" title="{l s='Delete'}">{l s='Delete'}</a></li>

 

 

with this (taken from "prestashop" theme)

 

<li class="address_update"><a href="{$link->getPageLink('address.php', true)}?id_address={$address.object.id|intval}" title="{l s='Update'}">{l s='Update'}</a></li>

<li class="address_delete"><a href="{$link->getPageLink('address.php', true)}?id_address={$address.object.id|intval}&delete" onclick="return confirm('{l s='Are you sure?'}');" title="{l s='Delete'}">{l s='Delete'}</a></li>

 

Hopefully this was correct.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

For those of you having no luck with jadess's solution in 1.4.3:

 

Starting at line 115 in your template's addresses.tpl file, replace the code with the following:

 

 

<li class="address_update"><a href="{$link->getPageLink('address.php', true)}?id_address={$address.object.id_address}" title="{l s='Update'}">{l s='Update'}</a></li>

<li class="address_delete"><a href="{$link->getPageLink('address.php', true)}?id_address={$address.object.id_address}&delete" onclick="return confirm('{l s='Are you sure?'}');" title="{l s='Delete'}">{l s='Delete'}</a></li>

 

The original code makes reference to $address.object.id which, according to my {debug}, doesn't exist. The correct variable is $address.object.id_address. For some reason the intval pipe after the variable was causing only zeroes to show up, so I removed it and it worked.

 

Good luck, hope this helps

Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...
  • 1 year later...

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