Jump to content

Remove Address 1.6


Recommended Posts

Greetings to all! I apologize for my English. I have a problem. I'm doing a virtual goods store. The idea is if the goods are assigned as virtual, then the purchase step with the delivery address to be missed. But I have it does not disappear. I do not need it at all.

 

After registration, the person should immediately get to the methods of payment and receive your file. How can I solve this problem? Thanks to all who can help you in any way !!!

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

  • 6 months later...

I have the same case. Maybe desable the some "Requerid Fields" like address, fone, Zip Code, phone... I'm using "Paypal Express checkout" and the first CHECKOUT apear Proceed to Checkout button and bellow apear also the Checkout Express Paypal button. If the costumer click in the second button, go direct to Paypal paiment. So I think that if hide of Prestashop button it work normal. I do not know. You can active Express Paypal in Modules

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 3 weeks later...

same, only need email. also if you wish to make fields not mandatory i got this yesteray but havent tried it: 
 

go to /classes/Customer.php and .tpl file and you will see :  protected $fieldsValidate = array . remove any fields in the array you dont want mandatory
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I have the same question.  We only sell virtual products and so the delivery fields step that appears in checkout is completely irrelevant to our customers.  It will actually lead to cart abandonment.  I have my products setup as virtual so I would have thought that when checking out, delivery address fields would not be displayed.  Any help with how to remove those fields from checkout would be greatly appreciated!

Link to comment
Share on other sites

depends if its opc or 5 steps . either way, remove the addresses forms in the html code . if they say mandatory then do this as i said before:

 

go to /classes/Customer.php and .tpl file and you will see :  protected $fieldsValidate = array . remove any fields in the array you dont want mandatory

 

i would think that would sort it

 

Trev

Link to comment
Share on other sites

  • 1 year later...

Hi all,

 

It's my first post, however, I think I figured out the way, how you can set address fields as optional and hide the fields.
Btw, I'm using Prestashop v1.6.1.7.

NB! It will affect only the quest one-page checkout form!

NBNB! Please make copies of your original files (as backup)!

There are 3 main things to do:

  • Make changes in classes/address.php
  • Make changes in themes/default-bootstrap/order-opc-new-account.tpl
  • Make changes in themes/default-bootstrap/js/order-opc.js

1) So first of all, in address.php go to the constructor and change:

(This change is making those fields as optional)

'id_country' =>        array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),

to

'id_country' =>        array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => false),

===

'alias' =>                array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),

to

'alias' =>                array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 32),

===

'address1' =>            array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128),

to

'address1' =>            array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => false, 'size' => 128),

===

'city' =>                array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64),

to

'city' =>                array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => false, 'size' => 64),

2) Go to themes/default-bootstrap/order-opc-new-account.tpl and comment out related fields

{elseif $field_name eq "address1"}
                                         <div class="required text form-group">
                                                 <label for="address1">{l s='Address'} <sup>*</sup></label>
                                                 <input type="text" class="text form-control validate" name="address1" id="address1" data-vali    date="isAddress" value="{$default_address}" />
                                         </div>

to

{* elseif $field_name eq "address1"}
                                         <div class="required text form-group">
                                                 <label for="address1">{l s='Address'} <sup>*</sup></label>
                                                 <input type="text" class="text form-control validate" name="address1" id="address1" data-vali    date="isAddress" value="{$default_address}" />
                                         </div>
                                         *}

And so on for div wrappers for country, alias, city fields.

In addition, to hide the invoice_address wrapper, just change lines (around 210)

<input type="hidden" name="alias" id="alias" value="{l s='My address'}"/> 
                                         <div class="checkbox">
                                                 <label for="invoice_address">

to

<input type="hidden" name="alias" id="alias" value="{l s='My address'}"/> 
                                         <div class="hide checkbox">
                                                 <label for="invoice_address"> 

3) Go to themes/default-bootstrap/js/order-opc.js and change following:

var params = 'firstname=' + encodeURIComponent($('#firstname' + (type == 'invoice' ? '_invoice' : '')).val()) + '&lastname=     ' + encodeURIComponent($('#lastname' + (type == 'invoice' ? '_invoice' : '')).val()) + '&';

to

var params = 'firstname=' + encodeURIComponent($('#customer_firstname' + (type == 'invoice' ? '_invoice' : '')).val()) + '&lastname=     ' + encodeURIComponent($('#customer_lastname' + (type == 'invoice' ? '_invoice' : '')).val()) + '&';

This will basically use/ copy the inserted data from the existing first- and lastname fields.

How it will look like: http://imgur.com/a/hLUPd. I hope it works for you. Any questions, suggestions - just let me know.
Cheers!

Link to comment
Share on other sites

×
×
  • Create New...