Лучший Ответ CB9TOIIIA , 25 September 2018 - 20:46
Пошли другим путем, на сайте используются (скрытно) промокоды, поэтому написал небольшой wrapper (хак) для Доставки.
/media/zoo/applications/jbuniversal/cart-elements/shipping/manual

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'));
}
}
Перейти к сообщению














