Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 388 Vote(s) - 3.61 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove delivery shipping step on prestashop 1.6.1?

#1
I'm new to **prestashop** and I'm having major trouble removing the delivery shipping step because I only sell virtual products. I am using prestashop 1.6.1.

I know I have to modify `order-carrier.tpl` file and have followed several posts here and there but couldn't get it done right.

Does any of you have any actual idea on how to do this ?
Reply

#2
In shopping-cart.tpl, remove call to order-carrier.tpl. If you are not using one pagecheckout, in orderController.php, you have to change all redirection to step 2 (shipping method choosing), to redirection step 3 Tools::redirect('index.php?controller=order&step=2'); to Tools::redirect('index.php?controller=order&step=3');
Reply

#3
Bonjour, here is what i did
<br>
<br>
Override **AdminOrderPreferencesController** and add a boolean configuration field to toggle this functionnality

$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'
)
);
You can now find a toggle button in Backoffice under **Preferences > Orders**

<br>
Override **OrderController** and add an `if` in `init()` method to set the current step to *payment step* if the controller inits itself on *delivery step*

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;
}

Also bypass the CGV checking verification on payment step in `initContent()` method.
<br>
If you don't, CGV will never be checked, it will redirect you on *delivery step*, you will tell him that he is in fact on *payment step*, he will check for CGV again, he will do the same redirection ... and you are in an infinite loop

case OrderController::STEP_PAYMENT:
$cgv = Tools::getValue('cgv') || $this->context->cookie->check_cgv;

if (
!(bool)Configuration::get('PS_ORDER_PROCESS_BYPASS_SHIPPING') && // HERE IT IS
$is_advanced_payment_api === false && Configuration::get('PS_CONDITIONS')
&& (!Validate::isBool($cgv) || $cgv == false)
) {
Tools::redirect('index.php?controller=order&step=2');
}

Pass the configuration parameter to the view to modify display

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

And in your views, do you styling stuff with some `if`<br>
In **order-steps.tpl** you can add an `{if not $bypass_shipping_step}...{/if}` around the fourth `li` to hide it, and do something like :

{if $bypass_shipping_step}
<style>
ul.step li{
width:25%;
}
</style>
{/if}
or import a dedicated stylesheet which would be cleaner.
<br>
<br>
<br>
Hope it helped.
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through