Jump to content

Recommended Posts

Hello,

 

I use Prestashop 1.6.0.9. I try to use a carrier by a product, but I have a problem on the Shipping step in my shopping-cart: I can't pass to the next step (because of several carriers and one radio button I suppose). 

 

Is it any possibility to resoudre my problem?

 

Here is my screenshot:

 

post-513419-0-71340100-1414429892_thumb.jpg

Link to comment
Share on other sites

For those in search of solution:

 

You need to make the override of OrderController.php.

 

public function autoStep()
    {
            if ($this->step >= 2 && (!$this->context->cart->id_address_delivery || !$this->context->cart->id_address_invoice))
                    Tools::redirect('index.php?controller=order&step=1');


            if ($this->step > 2 && !$this->context->cart->isVirtualCart())
            {
                    $redirect = false;
                    if (count($this->context->cart->getDeliveryOptionList()) == 0)
                            $redirect = true;


                    $delivery_option = $this->context->cart->getDeliveryOption();
                    if (is_array($delivery_option))
                            $carrier = explode(',', $delivery_option[(int)$this->context->cart->id_address_delivery]);


                    if (!$redirect && !$this->context->cart->isMultiAddressDelivery())
                            foreach ($this->context->cart->getProducts() as $product)
                            {
                                    $carrier_list = Carrier::getAvailableCarrierList(new Product($product['id_product']), null, $this->context->cart->id_address_delivery);
                                    foreach ($carrier as $id_carrier)
                                    {
                                                    if (!in_array($id_carrier, $carrier_list))
                                                            $redirect = true;
                                                    else
                                                    {
                                                            $redirect = false;
                                                            break;
                                                    }
                                    }
                                    if ($redirect)
                                            break;
                            }


                    if ($redirect)
                            Tools::redirect('index.php?controller=order&step=2');
            }


            $delivery = new Address((int)$this->context->cart->id_address_delivery);
            $invoice = new Address((int)$this->context->cart->id_address_invoice);


            if ($delivery->deleted || $invoice->deleted)
            {
                    if ($delivery->deleted)
                            unset($this->context->cart->id_address_delivery);
                    if ($invoice->deleted)
                            unset($this->context->cart->id_address_invoice);
                    Tools::redirect('index.php?controller=order&step=1');
            }
    }
  • Like 1
Link to comment
Share on other sites

  • 6 months later...
  • 4 months later...

You have to place your OrderController.php here:

 

override/controllers/front

 

Be careful, first line in the OrderController.php is:

 

<?php


class OrderController extends OrderControllerCore{

If it doesn't work, try to delete your class_index.php from the cache folder. 

Edited by ileriya (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...