Jump to content

How to remove delivery shipping step during checkout?


ariom
 Share

Recommended Posts

Hi all,

i'm on PS 1.6.1.4 and i'm trying to remove delivery shipping step during checkout.

this is what i have done until now:

I made an override for AdminOrderPreferencesController adding a boolean configuration field to toggle this functionnality in this way:

$this->fields_options = array(
    [...]
    'PS_ORDER_PROCESS_BYPASS_SHIPPING' => array(
        'title' => $this->l('Bypass shipping step'),
        'hint' => $this->l('Do not show shipping step in order process.'),
        'validation' => 'isBool',
        'cast' => 'intval',
        'type' => 'bool'
    )

so now i have this toogle button in Backoffice under Preferences > Orders set to YES to bypass shipping step (working fine!)

I also checked to NO the options to ask to costumer to accept CGV during checkout process

I override OrderController and add an if in init() method to set the current stepto payment step if the controller inits itself on delivery step in this way:

public function init()
{
    global $orderTotal;

    parent::init();

    $this->step = (int)Tools::getValue('step');

    // HERE IT IS
    if((bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING') && $this->step == self::STEP_DELIVERY){
        $this->step = self::STEP_PAYMENT;
    }

    if (!$this->nbProducts) {
        $this->step = -1;
    }

and at the end of init() method i passed the configuration parameter to smarty to modify the checkout display :

$this->context->smarty->assign('bypass_shipping_step', (bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING'));

and also in order-step.tpl i did a small modification adding an {if not $bypass_shipping_step}...{/if} around the fourth li to hide the step,

the shipping step is gone but something is wrong and i get an infinite loop redirection when i try to pass from address step to payment step.

As far as i understand, the problem is in orderController.php, but i can't find it

Someone can help me to solve it pointing me in the right direction?

i attach the full orderController.php i use for override if can be usefull to inspect where is the problem ... i feel very close to the solution but .... no way

Hope someone more expert can help!

thanks in advance.....!

OrderController.php

 

Share this post


Link to post
Share on other sites

  • 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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More