protected function calculatePriceRules(&$total, array &$data, array &$components)
    {
        $options = array(
            'status' => 1,
            'store_id' => $data['order']['store_id']
        );

        $code = null;

        if (isset($data['order']['data']['pricerule_code'])) {
            $code = $data['order']['data']['pricerule_code'];
        }

        foreach ($this->price_rule->getTriggered($data, $options) as $price_rule) {

            if ($price_rule['code'] !== '' && !isset($code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            if (isset($code) && !$this->priceRuleCodeMatches($price_rule['price_rule_id'], $code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            $this->price_rule->calculate($total, $data, $components, $price_rule);
        }
    }
protected function calculatePriceRules(&$total, array &$data, array &$components)
    {
        $options = array(
            'status' => 1,
            'store_id' => $data['order']['store_id']
        );

        $code = null;

        if (isset($data['order']['data']['pricerule_code'])) {
            $code = $data['order']['data']['pricerule_code'];
        }

        foreach ($this->price_rule->getTriggered($data, $options) as $price_rule) {

            if ($price_rule['code'] !== '' && !isset($code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            if (isset($code) && !$this->priceRuleCodeMatches($price_rule['price_rule_id'], $code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            $this->price_rule->calculate($total, $data, $components, $price_rule);
        }
    }
protected function calculatePriceRules ( & $ total , array & $ data , array & $ components ) { $ options = array ( 'status' => 1 , 'store_id' => $ data [ 'order' ] [ 'store_id' ] ) ; $ code = null ; if ( isset ( $ data [ 'order' ] [ 'data' ] [ 'pricerule_code' ] ) ) { $ code = $ data [ 'order' ] [ 'data' ] [ 'pricerule_code' ] ; } foreach ( $ this -> price_rule -> getTriggered ( $ data , $ options ) as $ price_rule ) { if ( $ price_rule [ 'code' ] !== '' && ! isset ( $ code ) ) { $ components [ $ price_rule [ 'price_rule_id' ] ] = array ( 'rule' => $ price_rule , 'price' => 0 ) ; continue ; } if ( isset ( $ code ) && ! $ this -> priceRuleCodeMatches ( $ price_rule [ 'price_rule_id' ] , $ code ) ) { $ components [ $ price_rule [ 'price_rule_id' ] ] = array ( 'rule' => $ price_rule , 'price' => 0 ) ; continue ; } $ this -> price_rule -> calculate ( $ total , $ data , $ components , $ price_rule ) ; } }
Calculate order price rules
@param int $total
@param array $data
@param array $components
Calculate order price rules