kolmapäev, 24. aprill 2013

OPC


This is normal view - smartpost as drop-down
This is with OPC

For normal PrestaShop OPC we changed fallowing files:
Directions to Merchants who would like to allow One page checkout and at the same time enable customer checkout. Without fulfilling the directions the select menu is not displayed and list of terminals is displayed by PrestaShop own tools instead, which makes the list too long.
Reason for that occurance is that, the HOOK_EXTRACARRIER is not called, when there is no address in the cart.
Fix attempts to call the HOOK_EXTRACARRIER with address, where ID=0 and thus HOOK_EXTRACARRIER gets called.

You need to change two files:
First:
<prestashop folder>/controllers/front/OrderOpcController.php, line 398

Before:
    protected function _assignCarrier()
    {
        if (!$this->isLogged)
        {
            $carriers = $this->context->cart->simulateCarriersOutput();
            $this->context->smarty->assign(array(
                'HOOK_EXTRACARRIER' => null,
                'HOOK_EXTRACARRIER_ADDR' => null,
                'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
                    'carriers' => $carriers,
                    'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
                    'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),


After:

    protected function _assignCarrier()
    {
        if (!$this->isLogged)
        {
            $extraInfo = array();
            Cart::addExtraCarriers($extraInfo);
            $carriers = $this->context->cart->simulateCarriersOutput();
            $this->context->smarty->assign(array(
                'HOOK_EXTRACARRIER' => $extraInfo['HOOK_EXTRACARRIER'],
                'HOOK_EXTRACARRIER_ADDR' => $extraInfo['HOOK_EXTRACARRIER_ADDR'],
                'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
                    'carriers' => $carriers,
                    'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
                    'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),


Second:
<prestashop folder>/classes/Cart.php, rida 3499
Before:
    public static function addExtraCarriers(&$array)
    {
        $first = true;
        $hook_extracarrier_addr = array();
        //here goes extra code....


        foreach (Context::getContext()->cart->getAddressCollection() as $address)
        {
            $hook = Hook::exec('displayCarrierList', array('address' => $address));
            $hook_extracarrier_addr[$address->id] = $hook;
           
            if ($first)
            {


After:
    public static function addExtraCarriers(&$array)
    {
        $first = true;
        $hook_extracarrier_addr = array();
        //start of extra code
        if (count(Context::getContext()->cart->getAddressCollection()) == 0) {
            $hook = Hook::exec('displayCarrierList', array('address' => null));
            $hook_extracarrier_addr[0] = $hook;

            if ($first)
            {
                $array = array_merge(
                    $array,
                    array('HOOK_EXTRACARRIER' => $hook)
                );
                $first = false;
            }
            $array = array_merge(
                $array,
                array('HOOK_EXTRACARRIER_ADDR' => $hook_extracarrier_addr)
            );

        }
        //end of extra code


        foreach (Context::getContext()->cart->getAddressCollection() as $address)
        {
            $hook = Hook::exec('displayCarrierList', array('address' => $address));
            $hook_extracarrier_addr[$address->id] = $hook;
           
            if ($first)
            {

pühapäev, 7. aprill 2013

Kust leida selliseid kruvikeerajaid?

Oskab keegi soovitada, kust leida Eestis selliseid kaheharulisi kruvikeerajaid?
Pildil siis sinine ring ümber tõmmatud.