Jump to content

[SOLVED] Invalid Token on address modify


Recommended Posts

Oops sorry Mike, I didn't subscribe to this thread so only just noticed your reply.

 

No problem - please see attached.

 

I think I have a rough idea what the problem could be. On the page load.. the Identification Number appears at first... and then when the Ajax kicks in, this gets hidden and the State/County box appears (as in the screenshot). The Identification Number does have a * against it also - even though for the United Kingom (as seen in the screenshot) has the settings for "Need Idenfitictation Number" as "No".

 

Any help on this would be greatly appreciated.

 

Cheers,

 

Lee

post-51367-0-28445100-1315950615_thumb.jpg

Link to comment
Share on other sites

Hi, have you modify the registration or address forms before?

 

I've had this error recently. I modified the forms on a earlier prestashop version to delete some fields and this error appeared after upgrading to 1.4.4.1. I fixed it replaicing my current authentification.tpl, address.tpl and addreses.tpl for my original theme files, of course I had to modify these again, but at least I fixed it :3

 

Good luck.

Link to comment
Share on other sites

Hi nahlin, thanks for the suggestion.

 

I did actually - and unfortunatley that's what's actually caused the problem - as with my old custom files it seemed to work just fine (but sadly I needed the new versions of the files otherwise I'd quite easily just revert back!)

Link to comment
Share on other sites

Uhm, so now that you dont have the newer files, have you tried copying the old Address.php (classes folder)? I would say the problem is there or in one of the controllers (addresscontroller, addressescontroller...).

 

If the identification number appears and then vanish but still being required, probably is on the $fieldsrequired line on Address.php

 

 

EDIT:

Check your themes address.tpl. In my case is about the line 92, between the address title and the first name field. In yours, judging by the picture you posted before it's probably not there (lol).

 

<p class="text">
		<input type="hidden" name="token" value="{$token}" />
		<label for="company">{l s='Company'}</label>
		<input type="text" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{else}{if isset($address->company)}{$address->company|escape:'htmlall':'UTF-8'}{/if}{/if}" />
	</p>
{if $vat_display == 2}
	<div id="vat_area">
{elseif $vat_display == 1}
	<div id="vat_area" style="display: none;">
{else}
	<div style="display: none;">
{/if}
	<div id="vat_number">
		<p class="text">
			<label for="vat_number">{l s='VAT number'}</label>
			<input type="text" class="text" name="vat_number" value="{if isset($smarty.post.vat_number)}{$smarty.post.vat_number}{else}{if isset($address->vat_number)}{$address->vat_number|escape:'htmlall':'UTF-8'}{/if}{/if}" />
		</p>
	</div>
	</div>

 

Deleting or commenting the company part cause the error. The simple solution I can think about is just hidden it, since it's not a required field.

 

Edit 2: It worked. Just replace the first <p class="text"> for <p class="hidden">. No more freakin' invalid tokens or whatever.

  • Like 2
Link to comment
Share on other sites

Hi nahlin,

 

I replaced the old Address.php controller file with the new AddressController.php file and sadly a blank page, so presuming the old version isn't entirely compatible with the latest version.

 

I haven't actually commented any of the code in address.tpl - it's all done through the back office for which fields I want to display for the UK. I've also tried changing the <p class="text"> for <p class="hidden"> on DNI / NIF / NIE, VAT number and Company (fields I'm not using anyway) but yet I'm still getting the "Invalid token" error sadly! :(

 

Appreciate your efforts though!

 

Cheers,

 

Lee

Link to comment
Share on other sites

Hi everyone,

 

Thanks a lot for your feedback and your fix.

 

We have fixed this issue, the fix will be integrated on SVN today and available in the upcoming release (v1.4.5).

 

@babyewok: Can you try to apply the fix and confirm that everything sounds good?

 

@leelee23: I'm happy to know that this has worked for you

 

@nahlin: Congrats for your fix ;-)

 

Best regards,

Link to comment
Share on other sites

Hi - I have this same problem and I am relieved to find a solution! Just to make sure I understand what should be done...

 

In the zip file (posted by nahlin) are the following files:

 

Address.tpl

Address.php

and

AddressController.php

 

 

Address.tpl in located at: themes/[myTheme]/address.tpl

Address.php is in the top directory

and

AddressController.php is in controllers/AddressController.php

 

- is this correct?

 

Thanks!

Lynnette

Link to comment
Share on other sites

Hi - I have this same problem and I am relieved to find a solution! Just to make sure I understand what should be done...

 

In the zip file (posted by nahlin) are the following files:

 

Address.tpl

Address.php

and

AddressController.php

 

 

Address.tpl in located at: themes/[myTheme]/address.tpl

Address.php is in the top directory

and

AddressController.php is in controllers/AddressController.php

 

- is this correct?

 

Thanks!

Lynnette

 

 

 

Address.php is in CLASSES not the top folder....my bad

 

also I had to copy and paste the Address.tpl file out of the SVN - either I miss copied the one from the zip file or there was a slight error.

 

 

Thank you guys so much!

Lynnette

Link to comment
Share on other sites

  • 11 months later...
  • 5 months later...
  • 3 months later...
  • 2 months later...
  • 3 months later...

1.5.3.1 fix:
 

address.tpl; 268. row:

{if $field_name eq 'company'}

			<p class="text">

			<input type="hidden" name="token" value="{$token}" />

change:

{if $field_name eq 'company'}

			<p class="text">

			{*<input type="hidden" name="token" value="{$token}" />*}

and:

<input type="hidden" name="token" value="{$token}" />

move to 335. row:

{if $field_name eq 'address1'}

		<p class="required text">
		<input type="hidden" name="token" value="{$token}" />
Edited by pattila01 (see edit history)
  • Like 2
Link to comment
Share on other sites

×
×
  • Create New...