https://medium.com/@lmeyer./get-an-error-free-e-commerce-web-site-using-sentry-b6061264efc8...
Suppression de l'étape adresse dans le tunnel de commande - Prestashop 1.7
Suppression de l'étape adresse dans le tunnel de commande - Prestashop 1.7
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class Baba_deleteaddresstep extends Module
{
public function __construct()
{
$this->name = 'baba_deleteaddresstep';
$this->tab = 'administration';
$this->version = '1.0.0';
$this->author = 'presta.cafe';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('baba_deleteaddresstep');
$this->description = $this->l('Delete address step');
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
}
public function install()
{
return parent::install() &&
$this->registerHook('actionDispatcher');
}
public function uninstall()
{
return parent::uninstall();
}
public function getContent()
{
$this->context->smarty->assign('module_dir', $this->_path);
$output = $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl');
return $output;
}
public function hookActionDispatcher($params = [])
{
// every time we go to a payment controller, we update current cart id_addresses to 2
$payments_controllers = [
'ps_wirepaymentvalidationModuleFrontController',
'ps_checkpaymentvalidationModuleFrontController',
];
if ($params['controller_type'] == Dispatcher::FC_FRONT &&
in_array($params['controller_class'], $payments_controllers) &&
$params['is_module']) {
$cart = new Cart($this->context->cookie->id_cart);
if ($cart->id_address_delivery == 0 || $cart->id_address_invoice) {
$cart->id_address_delivery = 2;
$cart->id_address_invoice = 2;
$cart->update();
}
}
}
}
Ressource:
https://stackoverflow.com/questions/47228469/how-to-remove-delivery-shipping-step-on-prestashop-1-7
Publié dans:
Pimp Prestashop
Laissez un commentaire