Returns an item line for the coupon code discount on this order.

@return array
An item line array.
7243
protected function getCouponCodeDiscountLine()
    {
        $result = array(
            Tag::ItemNumber => $this->order['details']['BT']->coupon_code,
            Tag::Product => $this->t('discount'),
            Tag::Quantity => 1,
            Meta::UnitPriceInc => (float) $this->order['details']['BT']->coupon_discount,
            Tag::VatRate => null,
            Meta::VatRateSource => static::VatRateSource_Strategy,
            Meta::StrategySplit => true,
        );

        return $result;
    }
570735
protected function getDiscountLinesOrder()
    {
        $result = array();

        foreach ($this->order->getCartRules() as $line) {
            $result[] = $this->getDiscountLineOrder($line);
        }

        return $result;
    }
1185383
public function getVariables()
    {
        $variables = [];

        $order = $order = $this->checkoutSession->getLastRealOrder();

        if ($order) {
            $variables['order.subtotal']        = $order->getBaseSubtotalInclTax();
            $variables['order.discount_total']  = $order->getDiscountAmount();
            $variables['order.shipping_total']  = $order->getShippingAmount();
            $variables['order.grand_total']     = $order->getBaseGrandTotal();
            $variables['order.shipping_method'] = $order->getShippingMethod();
            $variables['order.payment_method']  = $order->getPayment()->getMethod();
            $variables['order.salesrules']      = $order->getAppliedRuleIds();

            $itemId = 0;
            foreach ($order->getAllItems() as $item) {
                $variables = array_merge($variables, $this->getOrderItemVariables($item, $itemId++));
            }
        }

        return $variables;
    }
346375
protected function getAvailableTotals()
    {
        $sign = $this->getSign();
        if ($this->getType() === Source::Order) {
            $amount = $this->source->getTotalProductsWithoutTaxes()
                      + $this->source->total_shipping_tax_excl
                      + $this->source->total_wrapping_tax_excl
                      - $this->source->total_discounts_tax_excl;
            $amountInc = $this->source->getTotalProductsWithTaxes()
                         + $this->source->total_shipping_tax_incl
                         + $this->source->total_wrapping_tax_incl
                         - $this->source->total_discounts_tax_incl;
        } else {
            // On credit notes, the amount ex VAT will not have been corrected
            // for discounts that are subtracted from the refund. This will be
            // corrected later in getDiscountLinesCreditNote().
            $amount = $this->source->total_products_tax_excl
                      + $this->source->total_shipping_tax_excl;
            $amountInc = $this->source->total_products_tax_incl
                         + $this->source->total_shipping_tax_incl;
        }

        return array(
            Meta::InvoiceAmountInc => $sign * $amountInc,
            Meta::InvoiceAmount => $sign * $amount,
        );
    }
821697
public function getDiscountAmount()
    {
        $total = 0;
        $discount = 0;
        
        foreach ($this->items as $item) {
            if ($item->Price) {
                $total += ($item->Price * $item->Quantity);
            }
            
            if ($item->Discount) {
                $discount += ($item->TotalDiscount);
            }
        }
        
        if ($discount > $total) {
            $discount = $total;
        }

        return $discount;
    }
1084752
public function returnItems($items, $discounts = null)
    {
        $data = array(
            'items' => array_map(function(ItemReturn $item) {
                return $item->serialize();
            }, $items)
        );

        if ($discounts !== null) {
            $data['discounts'] = array_map(function(ItemDiscountReturn $item) {
                return $item->serialize();
            }, $discounts);
        }

        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/', $data);
        $this->deserialize($data);
    }
656421
protected function getCouponId()
	{
		if( !isset( $this->couponId ) )
		{
			$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );

			$search = $manager->createSearch()->setSlice( 0, 1 );
			$search->setConditions( $search->compare( '=~', 'coupon.provider', 'Voucher' ) );

			$items = $manager->searchItems( $search );

			if( ( $item = reset( $items ) ) === false ) {
				throw new \Aimeos\Controller\Jobs\Exception( 'No coupon provider "Voucher" available' );
			}

			$this->couponId = $item->getId();
		}

		return $this->couponId;
	}
419225
public function getDisplayCodeLine()
    {
        if ($this->getPaymentSlipData()->getWithAccountNumber() !== true ||
            $this->getPaymentSlipData()->getWithReferenceNumber() !== true
        ) {
            return false;
        }
        return $this->displayCodeLine;
    }
750298
protected function getCustomSortingList() : array
    {
        $arEventResult = Event::fire('shopaholic.sorting.offer.get.list', [$this->sValue]);
        if (empty($arEventResult)) {
            return [];
        }

        $arElementIDList = [];
        foreach ($arEventResult as $arEventOfferIDList) {
            if (empty($arEventOfferIDList) || !is_array($arEventOfferIDList)) {
                continue;
            }

            $arElementIDList = $arEventOfferIDList;
            break;
        }

        return $arElementIDList;
    }
835703
protected function getRecentProduct()
    {
        $items = $this->product_view->set($this->data_product['product_id'], $this->cart_uid);

        $product_ids = array();

        foreach ((array) $items as $id => $item) {
            if ($item['product_id'] != $this->data_product['product_id']) {
                $product_ids[$id] = $item['product_id'];
            }
        }

        if (empty($product_ids)) {
            return array();
        }

        $products = $this->getProducts(array('product_id' => $product_ids));

        // Retain original order
        uksort($products, function ($key1, $key2) use ($product_ids) {
            return (array_search($key1, $product_ids) < array_search($key2, $product_ids));
        });

        return $products;
    }
951450
public function getLineCoverage()
    {
        if ($this->lineCoverage === null) {
            $this->lineCoverage = $this->calculateLineCoverage($this->statements, $this->coveredStatements);
        }

        return $this->lineCoverage;
    }
71946
public function getItemAlignOptions()
    {
        return [
            self::ITEM_ALIGN_START => _t(__CLASS__ . '.START', 'Start'),
            self::ITEM_ALIGN_CENTER => _t(__CLASS__ . '.CENTER', 'Center'),
            self::ITEM_ALIGN_END => _t(__CLASS__ . '.END', 'End'),
            self::ITEM_ALIGN_BETWEEN => _t(__CLASS__ . '.BETWEEN', 'Between'),
            self::ITEM_ALIGN_AROUND => _t(__CLASS__ . '.AROUND', 'Around')
        ];
    }
1047631
function credit_selection() {
    global $discount_coupon;
    // note the placement of the redeem code can be moved within the array on the instructions or the title
    $selection = array('id' => $this->code,
                       'module' => $this->title,
                       'redeem_instructions' => MODULE_ORDER_TOTAL_COUPON_REDEEM_INSTRUCTIONS . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_REMOVE_INSTRUCTIONS : '') . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_TEXT_CURRENT_CODE . '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $_SESSION['cc_id']) . '\')">' . $discount_coupon->fields['coupon_code'] . '</a><br /><br />' : ''),
                       'fields' => array(array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ENTER_CODE,
                                               'field' => zen_draw_input_field('dc_redeem_code', '', 'id="disc-' . $this->code . '" onkeyup="submitFunction(0,0)"'),
                                               'tag' => 'disc-'.$this->code
                       )));
    return $selection;
  }
1324699
protected function GetTopsellers()
    {
        $oLocal = &TCMSLocal::GetActive();
        $query = 'SELECT SUM(`shop_order_item`.`order_amount`) AS totalordered,
                       SUM(`shop_order_item`.`order_price_after_discounts`) AS totalorderedvalue,
                       `shop_category`.`url_path` AS categorypath, `shop_order_item`.*
                  FROM `shop_order_item`
             LEFT JOIN `shop_order` ON `shop_order_item`.`shop_order_id` = `shop_order`.`id`
             LEFT JOIN `shop_article_shop_category_mlt` ON `shop_order_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`
             LEFT JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`

               ';
        $aBaseCondition = array();
        if (!is_null($this->sStartDate)) {
            $aBaseCondition[] = "`shop_order`.`datecreated` >= '".\MySqlLegacySupport::getInstance()->real_escape_string($oLocal->StringToDate($this->sStartDate))."'";
        }
        if (!is_null($this->sEndDate)) {
            $aBaseCondition[] = "`shop_order`.`datecreated` <= '".\MySqlLegacySupport::getInstance()->real_escape_string($oLocal->StringToDate($this->sEndDate))." 23:59:59'";
        }
        if ('' != $this->selectedPortalId) {
            $aBaseCondition[] = "`shop_order`.`cms_portal_id` = '".\MySqlLegacySupport::getInstance()->real_escape_string($this->selectedPortalId)."'";
        }

        $query .= ' WHERE ('.implode(') AND (', $aBaseCondition).')';

        $query .= ' GROUP BY `shop_category`.`id`, `shop_order_item`.`shop_article_id`';
        $query .= ' ORDER BY totalordered DESC ';
        $query .= ' LIMIT 0,50';

        $oOrderItems = TdbShopOrderItemList::GetList($query);

        return $oOrderItems;
    }
109255
public function getLines()
    {
        $lines = explode(PHP_EOL, $this->comment);

        $wrapper = function($line)
        {
            return new Line($line);
        };

        return array_map($wrapper, $lines);
    }
925843
public function getDiscountSumPayPalBasket()
    {
        // collect discounts
        $discount = 0.0;

        $totalDiscount = $this->getTotalDiscount();

        if ($totalDiscount) {
            $discount += $totalDiscount->getBruttoPrice();
        }

        //if payment costs are negative, adding them to discount
        if (($costs = $this->getPaymentCosts()) < 0) {
            $discount += ($costs * -1);
        }

        // vouchers..
        $vouchers = (array) $this->getVouchers();
        foreach ($vouchers as $voucher) {
            $discount += round($voucher->dVoucherdiscount, 2);
        }

        return $discount;
    }
47868
public function getItemJustifyOptions()
    {
        return [
            self::ITEM_ALIGN_START => _t(__CLASS__ . '.START', 'Start'),
            self::ITEM_ALIGN_CENTER => _t(__CLASS__ . '.CENTER', 'Center'),
            self::ITEM_ALIGN_END => _t(__CLASS__ . '.END', 'End'),
            self::ITEM_ALIGN_BASELINE => _t(__CLASS__ . '.BASELINE', 'Baseline'),
            self::ITEM_ALIGN_STRETCH => _t(__CLASS__ . '.STRETCH', 'Stretch')
        ];
    }