Перейти к содержимому


Фотография
- - - - -

Бесплатная Доставка


Лучший Ответ CB9TOIIIA , 25 September 2018 - 20:46

Пошли другим путем, на сайте используются (скрытно) промокоды, поэтому написал небольшой wrapper (хак) для Доставки.

/media/zoo/applications/jbuniversal/cart-elements/shipping/manual

VB54pBf.png

 

getRate

<?php
/**
 * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
 * @package     jbzoo
 * @version     2.x Pro
 * @author      JBZoo App http://jbzoo.com
 * @copyright   Copyright (C) JBZoo.com,  All rights reserved.
 * @license     http://jbzoo.com/license-pro.php JBZoo Licence
 * @coder       Denis Smetannikov <denis@jbzoo.com>
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
 * Class JBCartElementShippingManual
 */
class JBCartElementShippingManual extends JBCartElementShipping
{

    /**
     * @param array $params
     * @return bool
     */
    public function hasValue($params = array())
    {
        return true;
    }

    /**
     * @return JBCartValue
     */
    public function getRate()
    {

        $summaactivate = $this->config->get('summaactivate');
        $codeactivate = $this->config->get('codeactivate');
        $elmactivate = $this->config->get('elmactivate');
        $summacur = $this->config->get('summacur');
        $skidosctivate = $this->config->get('skidosctivate');
        $typeactivate = $this->config->get('typeactivate');

        $orderSum = $this->_order->getTotalForItems(); // сумма за все товары (без доставки и прочего)
                
        if (!empty($elmactivate) && $orderSum->compare($summaactivate.$summacur, '>=')) { // сравниваем c ценой 

            if ($element = $this->_order->getModifierOrderPriceElement($elmactivate)) {
                
                if ($element->data()->get('code') == $codeactivate) {
                    $discount = $skidosctivate; // скидка 
                    $discount = $this->_order->val($discount)->positive();
                    if ($typeactivate == 'positive') {
                        return $discount->positive();
                    }
                    else {
                        return $discount->negative();
                    }
                   
                }
               
            }

        }
        
        return $this->_order->val($this->config->get('rate')); 
    
    }
}

Перейти к сообщению


В теме одно сообщение

#1 mr.varhola

mr.varhola

Отправлено 14 September 2018 - 21:12

Здравствуйте!

Направьте пожалуйста или может поделитесь решением, как сделать бесплатную доставку в зависимости от выбранного способа оплаты + определенной суммы заказа?


  • 0

#2 CB9TOIIIA

CB9TOIIIA

Отправлено 25 September 2018 - 20:46   Лучший Ответ

Пошли другим путем, на сайте используются (скрытно) промокоды, поэтому написал небольшой wrapper (хак) для Доставки.

/media/zoo/applications/jbuniversal/cart-elements/shipping/manual

VB54pBf.png

 

getRate

<?php
/**
 * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
 * @package     jbzoo
 * @version     2.x Pro
 * @author      JBZoo App http://jbzoo.com
 * @copyright   Copyright (C) JBZoo.com,  All rights reserved.
 * @license     http://jbzoo.com/license-pro.php JBZoo Licence
 * @coder       Denis Smetannikov <denis@jbzoo.com>
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
 * Class JBCartElementShippingManual
 */
class JBCartElementShippingManual extends JBCartElementShipping
{

    /**
     * @param array $params
     * @return bool
     */
    public function hasValue($params = array())
    {
        return true;
    }

    /**
     * @return JBCartValue
     */
    public function getRate()
    {

        $summaactivate = $this->config->get('summaactivate');
        $codeactivate = $this->config->get('codeactivate');
        $elmactivate = $this->config->get('elmactivate');
        $summacur = $this->config->get('summacur');
        $skidosctivate = $this->config->get('skidosctivate');
        $typeactivate = $this->config->get('typeactivate');

        $orderSum = $this->_order->getTotalForItems(); // сумма за все товары (без доставки и прочего)
                
        if (!empty($elmactivate) && $orderSum->compare($summaactivate.$summacur, '>=')) { // сравниваем c ценой 

            if ($element = $this->_order->getModifierOrderPriceElement($elmactivate)) {
                
                if ($element->data()->get('code') == $codeactivate) {
                    $discount = $skidosctivate; // скидка 
                    $discount = $this->_order->val($discount)->positive();
                    if ($typeactivate == 'positive') {
                        return $discount->positive();
                    }
                    else {
                        return $discount->negative();
                    }
                   
                }
               
            }

        }
        
        return $this->_order->val($this->config->get('rate')); 
    
    }
}

Прикрепленный файл  manual.zip   5.75К   55 Количество загрузок:


  • 1




Click to return to top of page in style!