Jump to content

kipst

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by kipst

  1. I have found this free module at:

    http://www.modulebazaar.com/en/prestashop-order-management-module.html

     

    But in spite of the declared support for prestashop 1.6.X, it's not true. To fix this, open the file egrOrderManagement.php and replace:

    global $cookie,$cart;
    $custid = Tools::getValue('odrmgmt');
    $customer = new Customer($custid);
    $cookie->id_customer = (int)($customer->id);
    $cookie->customer_lastname = $customer->lastname;
    $cookie->customer_firstname = $customer->firstname;
    $cookie->logged = 1;
    $cookie->is_guest = $customer->isGuest();
    $cookie->passwd = $customer->passwd;
    $cookie->email = $customer->email;
    $cookie->id_cart = (int)(Cart::lastNoneOrderedCart((int)($customer->id)));
    $cart->id_carrier = 0;
    $cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id));
    $cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
    $cart->update();
    Tools::redirect('my-account.php');
    

    to:

    // from origin egrOrderManagement.php
    $custid = Tools::getValue('odrmgmt');
    $customer = new Customer($custid);
    // from controllers/front/AuthController.php, function processSubmitLogin
    $this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare: CompareProduct::getIdCompareByIdCustomer($customer->id);
    $this->context->cookie->id_customer = (int)($customer->id);
    $this->context->cookie->customer_lastname = $customer->lastname;
    $this->context->cookie->customer_firstname = $customer->firstname;
    $this->context->cookie->logged = 1;
    $customer->logged = 1;
    $this->context->cookie->is_guest = $customer->isGuest();
    $this->context->cookie->passwd = $customer->passwd;
    $this->context->cookie->email = $customer->email;
    
    // Add customer to the context
    $this->context->customer = $customer;
    
    if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0) && $id_cart = (int)Cart::lastNoneOrderedCart($this->context->customer->id))
    	$this->context->cart = new Cart($id_cart);
    else
    {
    	$id_carrier = (int)$this->context->cart->id_carrier;
    	$this->context->cart->id_carrier = 0;
    	$this->context->cart->setDeliveryOption(null);
    	$this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)($customer->id));
    	$this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)($customer->id));
    }
    $this->context->cart->id_customer = (int)$customer->id;
    $this->context->cart->secure_key = $customer->secure_key;
    
    if ($this->ajax && isset($id_carrier) && $id_carrier && Configuration::get('PS_ORDER_PROCESS_TYPE'))
    {
    	$delivery_option = array($this->context->cart->id_address_delivery => $id_carrier.',');
    	$this->context->cart->setDeliveryOption($delivery_option);
    }
    
    $this->context->cart->save();
    $this->context->cookie->id_cart = (int)$this->context->cart->id;
    $this->context->cookie->write();
    $this->context->cart->autosetProductAddress();
    
    Hook::exec('actionAuthentication');
    
    // Login information have changed, so we check if the cart rules still apply
    CartRule::autoRemoveFromCart($this->context);
    CartRule::autoAddToCart($this->context);
    
    Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
    

    For prestashop 1.6.0.9 it's worked ok.

     

×
×
  • Create New...

Important Information

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