Jump to content

[SOLVED] How to disable asking for physical address in PrestaShop 1.5?


Recommended Posts

Trying to figure out how to stop PrestaShop from asking for a physical address when customers register for an account to our website. We sell only digital products and don't need to ask for a physical address as there's no shipping involved. I've tried several methods I've read on the internet but either I'm not doing it right (which isn't entirely out of the question), or 1.5 is different from the versions I've been reading.

 

I still don't understand why this isn't in the back office settings <_<

 

Any help would be greatly appreciated!

 

 

Thanks ahead of time,

Lisa

Edited by Lisa C. (see edit history)
Link to comment
Share on other sites

Thank you dearly for trying to help. I followed the steps to the letter, but once I had the new OrderController up on the server I got one Syntax error after another :-/ I'd go in and try to fix whatever the error was complaining about, only to have another one pop up.

Edited by Lisa C. (see edit history)
Link to comment
Share on other sites

hello

you can say something more about your syntax errors that appear ?

 

Oh, of course! I'm so sorry about that, I should have thought of it. And I apologize for taking so long to reply, off-computer life has been real fun lately :rolleyes:

 

What happens is I can access the market just fine, however, when I try to click on the cart, wether full or empty, logged in or not, I come up with a white page reading the following error:

 

Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web197/b1972/ipw.digiarti/public_html/market/controllers/front/OrderController.php on line 49

 

If I go in and try to change the offending line back to what had been there before hacking I'll start getting errors concerning an unexpected ',' or '{' all in different lines. I finally gave up and reverted it back to the way it was. I'm not sure what I did wrong, went over it several times, but...Yeah :(

Link to comment
Share on other sites

I had an idea over night, but I have no way to go about doing it. Is it possible to simply hide certain parts of the registration template and fill it in with a predetermined address? And if so, how? I know nothing about this kind of coding I'm afraid :-/

Link to comment
Share on other sites

Hi Lisa,

If I see it correctly, the link to the solution PrestCoder mentioned does something like that. The add a 'fake' address called "Virtual Product", and link that to all addresses for new customers.

 

(there was some minor mistake in the tutorial. The writer forgot to mention there were actually four, not two, places to change the address-ID manually (from '6' to your own address ID in your own database). (All a few lines from each other).

 

What version do you use exactly? 1.5.x.x?? Maybe we can change the code for you.

 

pascal

Link to comment
Share on other sites

That's what I did. I noted that the prefacing tutorial forgot to mention the other two lines and so after creating the address and noting the ID PrestaShop gave it (the ID in this case was twelve) I replaced all four instances of the six instead of just the two lines they had said.

 

The ID /is/ the number that appears to the left of the address' first name in Customers>Addresses, right?

 

I downloaded the newest version that was avaliable back in June, so I believe t'would be 1.5.1.4?

 

Thank you guys for your patience with this daft newbie ^^'

Link to comment
Share on other sites

Still no luck :unsure:

 

I have noticed that the hack code is almost completely different from the standard OrderController.php. And even when playing with the original code, if I so much as change/add one number I get the "Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web197/b1972/ipw.digiarti/public_html/market/controllers/front/OrderController.php on line 230" error, or one complaining about an unexpected =. Is there some kind of jail breaking I need to do to PrestaShop before I start playing with the controllers that I don't know about?

Edited by Lisa C. (see edit history)
Link to comment
Share on other sites

I tried to make the changes in 1.5.4.1. (Saw that the source file had changed quite a lot, so just copying the file gave indeed all kind of errors. Needed to really cut and paste the changes.)

 

Seems to work a little, but with a NEW customer (that had no previous address) it gets stuck on step 4. An old customer (with previous complete address already attached does the work.

 

Needs some other good look, hopefully tonight...

pascal

 

 

P.S. I will also have a look at possible other solutions, that may work 'out of the box' :-) Anyone other suggestions than the link above? thx

Edited by PascalVG (see edit history)
Link to comment
Share on other sites

Hmm, I will post the modified OrderController.php

(place the file into controllers/Front/OrderController.php (N.B. Backup your old/original one!)

Original OrderController File taken from 1.5.4.1. and modified.

 

Changes are like given in link above. File was changed considerably, so needed to make adjustments in original 1.5.4.1 file, instead of just copying the file as given in the link above, as it gave many errors.

 

As said above. It only seems to work if Customer already had an old address linked to it. With a new customer, I can't figure out why it complains as yet. Maybe I miss something...

Please check it out and see if it works for you. If you see anything obvious which can be creating problems, let us know.

 

pascal

OrderController.php.zip

  • Like 2
Link to comment
Share on other sites

Okay so I've been at this about 24 hours and have pretty much broken the back of this thing. I've taken a different tactic than trying to stuff a fake address into the appropriate fields during registration. Instead I chose to disable the addresses altogether. Here's what I did.

 

1) Following the instructions on this thread, I disabled all the countries under "Localization | Countries" in the Back Office but one (Canada, since that's where I am). I then edited the country and set it to only require first and last name.

http://www.prestasho...-prestashop-15/

 

2) As per instructions on the same thread, I edited the /classes/address.php file to remove param "'required' ==> true" for address fields I didn't want to capture.

 

3) At this point, registration threw a "Invalid token error". I solved this by following the instructions on this thread; under "Preferences | General" in the Back Office, turned off Increased Front Office Security.

http://www.prestasho...-invalid-token/

 

4) I then edited /$theme_dir/address.tpl and /$theme_dir/authentication.tpl, removing "class='required'" from any address input boxes I didn't want to capture data for.

 

5) At this point, creating a new account with the "Register" option worked fine. I could check out and get all the way to PayPal. However, if I used OPC and tried to register from the shopping cart page, I got this error: "Country cannot be loaded with address->id_country". I screwed around with this forever and finally found the source of the error in /controllers/AuthController.php and /controllers/AddressController.php. I simply commented out the exception in both files.

 

6) Now I could get all the way to PayPal without incident. However, now when I created an account, the order page showed me an empty address dropdown box which I didn't want. I replaced that whole section in /$theme_dir/order-address.tpl and spent about another hour styling that /$theme_dir/order-address.tpl, /$theme_dir/order-carrier.tpl and /$theme_dir/order-payment.tpl (the three templates called by /$theme_dir/order-opc.tpl).

 

I'm still working through a couple things and haven't done a full browser compatibility check, but so far all the above seems to work. I'll post the results of my deep tests a bit later on.

 

Hope that's helpful for folks!!!

 

Geoff.

 

Edit: Forgot to mention a couple things:

 

a ) With all of these changes, the request for an address is still there. But all the fields are either hidden or disabled. I've left an "additional information" textbox there so the area doesn't look out of place and renamed the section "Optional Information" so it looks like I'm being user friendly instead of writing kluges all over the place.

 

b ) If you want to see the results, you can visit http://cranetraxmusic.com

 

/hugs

Edited by swaggerbear (see edit history)
  • Like 2
Link to comment
Share on other sites

Hi Lisa, Did Geoff's (or my?) solution work for you?

 

Hi there! Sorry I haven't replied sooner, I was running as many tests as possible before I came back with a reply.

 

I DO think that the issue's been solved! I actually combined both your code and Geoff's solution together, and now new customers (myself with umpteen test email addresses) and those without a physical address priorly linked to their account are not asked for a physical address. I haven't ran into any errors or snags yet so I think it's solved!

 

Honesty, both of you, thank you so much! I could kiss you for all the help you've been! :D :D :D

 

I'll add [sOLVED] to my subject header now!

Link to comment
Share on other sites

×
×
  • Create New...