Jump to content

How to remove Shipping Address and skip Address step in Checkout?


Recommended Posts

Hi,

I have searched all related posts in this forum and tried all the code changes proposed, but can't find a successful solution.

I want to sell a virtual product WITHOUT using the virtual product option because the product takes a few days to prepare before the customer can download it.

I have set up a universal carrier for online download and that works fine.

However I want to skip the Address step in checkout since there is no need for billing or shipping address.

All the code offered on this forum result in either a 'There is no valid carrier' error, or doesn't work when the customer clicks on 'Cart' and logs in instead of checking out straightaway.

I am using 1.2.4.

Please can someone help? Thanks in advance.

Link to comment
Share on other sites

At your root directory file order.php.
At line 85, you'll see script written with switch blahblahblah.
Below it there is case 1 : displayAddress().
Block that line with // and write another line to be like this

case 1:
displayPayment();        
//displayAddress();
break;



This will make user go straight to payment choice.

At order-steps.tpl, inside your themes directory, line 22, add <!-- and end with --> at line 39

<!--    
       {if $current_step=='payment' || $current_step=='shipping'}

           {l s='Address'}

       {else}
       {l s='Address'}
       {/if}
-->
<!--    
       {if $current_step=='payment'}

           {l s='Shipping'}

       {else}
       {l s='Shipping'}
       {/if}
-->



Now other steps are disabled.
Lastly, order-payment.tpl also inside your themes directory.

Go to line 24, check this line :
{$base_dir_ssl}order.php?step=2

Change 2 to 0, this will make back button at payment choose screen revert to the cart list.

This probably work very good if you only have 1 carrier as set up... dunno with multiple carrier tough, since skipping carrier choice will automatically choose your default carrier.

On you problem for shipping problem :
Admin shipping tab --> countries, zones, carriers : Make sure a customer country available for the carrier.
Admin shipping tab --> price ranges : Make sure the max number price range is high enough. ( I think it is limited to 10,000,000 )
Admin shipping tab --> re-save both top handling and fees table. ( yes, re-save those.... )

Hope it help...

  • Like 1
Link to comment
Share on other sites

Thanks for your reply and code!

It works great when the user is logged in BEFORE adding anything to the shopping cart.

However, if I add items to my cart before logging in, after I log in during the checkout the error message is displayed 'There is no payment module installed.'

Any ideas?

Thanks so much for your help

Link to comment
Share on other sites

Thanks for your help.

My carrier works as it should, and I even tried installing your code and then saving my carrier again in the back office, but I still get the 'No payment modules installed' error. Is there no workaround for this?

Thanks

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...

I've found a way to make it work when user added something to cart and then log in.

The thing is that on Payment step there is a query that checks if payment is enabled for particular country (at least this work this way for 2checkout payment module). Since you have removed

displayAddress();

in step 1 - customer's country won't be set in $cart object. And you will see error 'no payment module is installed'.

What I did is set an invoice address in $cart manually on step 1 before displayPayment(). So now step 1 looks like this:

case 1:
   $customer = new Customer(intval($cookie->id_customer));
   if (Validate::isLoadedObject($customer)){
       // Getting customer addresses
   $customerAddresses = $customer->getAddresses(intval($cookie->id_lang));
   // Setting default addresses for cart
   if ((!isset($cart->id_address_invoice) OR empty($cart->id_address_invoice)) AND sizeof($customerAddresses)){
       $cart->id_address_invoice = intval($customerAddresses[0]['id_address']);
       $update = 1;
   }
       // Update cart addresses only if needed
       if (isset($update) AND $update)
           $cart->update();
   }

   //displayAddress();
   displayPayment();
   break;



I have a downloadable products, so I have set only invoice address. If you need to deliver your products you need to get and set a delivery address in $cart as well. Hope that will help.

Thanks, Eugene

Link to comment
Share on other sites

  • 3 months later...

This works very well, but, I have a new problem: I have free products and payment step is not activated automatically download (as before the code changes). Appears the paypal payment. Any idea?

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
At your root directory file order.php.
At line 85, you'll see script written with switch blahblahblah.
Below it there is case 1 : displayAddress().
Block that line with // and write another line to be like this

case 1:
displayPayment();        
//displayAddress();
break;



This will make user go straight to payment choice.

At order-steps.tpl, inside your themes directory, line 22, add <!-- and end with --> at line 39

<!--    
       {if $current_step=='payment' || $current_step=='shipping'}

           {l s='Address'}

       {else}
       {l s='Address'}
       {/if}
-->
<!--    
       {if $current_step=='payment'}

           {l s='Shipping'}

       {else}
       {l s='Shipping'}
       {/if}
-->



Now other steps are disabled.
Lastly, order-payment.tpl also inside your themes directory.

Go to line 24, check this line :
{$base_dir_ssl}order.php?step=2

Change 2 to 0, this will make back button at payment choose screen revert to the cart list.

This probably work very good if you only have 1 carrier as set up... dunno with multiple carrier tough, since skipping carrier choice will automatically choose your default carrier.

On you problem for shipping problem :
Admin shipping tab --> countries, zones, carriers : Make sure a customer country available for the carrier.
Admin shipping tab --> price ranges : Make sure the max number price range is high enough. ( I think it is limited to 10,000,000 )
Admin shipping tab --> re-save both top handling and fees table. ( yes, re-save those.... )

Hope it help...



tnx alot , it's working well :D
Link to comment
Share on other sites

  • 2 months later...

I couldn't get this to work unless i also added these lines for setting the delivery-address. It would trigger a 'hack attempt' somewhere else.

if ((!isset($cart->id_address_invoice) OR empty($cart->id_address_invoice)) AND sizeof($customerAddresses)) {                    
                   $cart->id_address_invoice = intval($customerAddresses[0]['id_address']);
                   $update = 1;
               }

// Add these lines below for setting the delivery address
if ((!isset($cart->id_address_delivery) OR empty($cart->id_address_delivery)) AND sizeof($customerAddresses)) {                    
   $cart->id_address_delivery = intval($customerAddresses[0]['id_address']);
   $update = 1;
}



Cheers for the initial code!

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
I've found a way to make it work when user added something to cart and then log in.

The thing is that on Payment step there is a query that checks if payment is enabled for particular country (at least this work this way for 2checkout payment module). Since you have removed
displayAddress();

in step 1 - customer's country won't be set in $cart object. And you will see error 'no payment module is installed'.

What I did is set an invoice address in $cart manually on step 1 before displayPayment(). So now step 1 looks like this:

case 1:
   $customer = new Customer(intval($cookie->id_customer));
   if (Validate::isLoadedObject($customer)){
       // Getting customer addresses
   $customerAddresses = $customer->getAddresses(intval($cookie->id_lang));
   // Setting default addresses for cart
   if ((!isset($cart->id_address_invoice) OR empty($cart->id_address_invoice)) AND sizeof($customerAddresses)){
       $cart->id_address_invoice = intval($customerAddresses[0]['id_address']);
       $update = 1;
   }
       // Update cart addresses only if needed
       if (isset($update) AND $update)
           $cart->update();
   }

   //displayAddress();
   displayPayment();
   break;



I have a downloadable products, so I have set only invoice address. If you need to deliver your products you need to get and set a delivery address in $cart as well. Hope that will help.

Thanks, Eugene



Been stuck with this for the last 3 hours. Eugene, you saved my life. Thanks a lot!
Link to comment
Share on other sites

  • 10 months later...
  • 5 months later...
  • 7 months later...
  • 2 months later...
  • 4 months later...

I found the file (order.php) but the script is not like u say. this what my file (order.php) contains:

<?php

/*

* 2007-2013 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Open Software License (OSL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.org/licenses/osl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2013 PrestaShop SA

* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*/

 

/**

* This file will be removed in 1.6

* You have to use index.php?controller=page_name instead of this page

*

* @deprecated 1.5.0

*/

 

require(dirname(__FILE__).'/config/config.inc.php');

Tools::displayFileAsDeprecated();

 

Tools::redirect('index.php?controller=order'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');

Link to comment
Share on other sites

  • 3 months later...

It is absolutely shocking that the PS developers haven't fixed this problem, when there were people back in 2010 complaining about this!!

 

So PS developers, what year you think you will think about fixing virtual carts, so if there are only virtual products the checkout funnel does not include the shipping step????

Link to comment
Share on other sites

  • 9 months later...
  • 4 weeks later...
  • 1 month later...
  • 7 months later...
  • 2 months later...
  • 9 months 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...