protected function getItemDataNonXML()
    {
        $result = '';
        $items = $this->getItems();
        $count = 0;

        foreach ($items as $basketItem) {
            $description = $this->filterNonXmlItemName($basketItem->getName());
            $vat = '0.00';

            if ($basketItem instanceof ExtendItem) {
                $vat = $basketItem->getVat();

                /**
                 * Product Code is used for the Product Sage 50 Accounts Software Integration
                 * It allows reconcile the transactions on your account within the financial software
                 * by linking the product record to a specific transaction.
                 * This is not available for BasketXML and only Basket Integration. See docs for more info.
                 */
                if (!is_null($basketItem->getProductCode())) {
                    $description = '[' . $basketItem->getProductCode() . ']' . $description;
                }
            }

            $lineTotal = ($basketItem->getQuantity() * ($basketItem->getPrice() + $vat));

            $result .= ':' . $description .    // Item name
                ':' . $basketItem->getQuantity() . // Quantity
                ':' . number_format($basketItem->getPrice(), 2, '.', '') . // Unit cost (without tax)
                ':' . $vat . // Item tax
                ':' . number_format($basketItem->getPrice() + $vat, 2, '.', '') . // Item total
                // As the getItemData() puts 0.00 into tax, same was done here
                ':' . number_format($lineTotal, 2, '.', '');  // Line total

            $count++;
        }

        // Prepend number of lines to the result string
        $result = $count . $result;

        return $result;
    }
protected function getItemDataNonXML()
    {
        $result = '';
        $items = $this->getItems();
        $count = 0;

        foreach ($items as $basketItem) {
            $description = $this->filterNonXmlItemName($basketItem->getName());
            $vat = '0.00';

            if ($basketItem instanceof ExtendItem) {
                $vat = $basketItem->getVat();

                /**
                 * Product Code is used for the Product Sage 50 Accounts Software Integration
                 * It allows reconcile the transactions on your account within the financial software
                 * by linking the product record to a specific transaction.
                 * This is not available for BasketXML and only Basket Integration. See docs for more info.
                 */
                if (!is_null($basketItem->getProductCode())) {
                    $description = '[' . $basketItem->getProductCode() . ']' . $description;
                }
            }

            $lineTotal = ($basketItem->getQuantity() * ($basketItem->getPrice() + $vat));

            $result .= ':' . $description .    // Item name
                ':' . $basketItem->getQuantity() . // Quantity
                ':' . number_format($basketItem->getPrice(), 2, '.', '') . // Unit cost (without tax)
                ':' . $vat . // Item tax
                ':' . number_format($basketItem->getPrice() + $vat, 2, '.', '') . // Item total
                // As the getItemData() puts 0.00 into tax, same was done here
                ':' . number_format($lineTotal, 2, '.', '');  // Line total

            $count++;
        }

        // Prepend number of lines to the result string
        $result = $count . $result;

        return $result;
    }
protected function getItemDataNonXML ( ) { $ result = '' ; $ items = $ this -> getItems ( ) ; $ count = 0 ; foreach ( $ items as $ basketItem ) { $ description = $ this -> filterNonXmlItemName ( $ basketItem -> getName ( ) ) ; $ vat = '0.00' ; if ( $ basketItem instanceof ExtendItem ) { $ vat = $ basketItem -> getVat ( ) ; /**
                 * Product Code is used for the Product Sage 50 Accounts Software Integration
                 * It allows reconcile the transactions on your account within the financial software
                 * by linking the product record to a specific transaction.
                 * This is not available for BasketXML and only Basket Integration. See docs for more info.
                 */ if ( ! is_null ( $ basketItem -> getProductCode ( ) ) ) { $ description = '[' . $ basketItem -> getProductCode ( ) . ']' . $ description ; } } $ lineTotal = ( $ basketItem -> getQuantity ( ) * ( $ basketItem -> getPrice ( ) + $ vat ) ) ; $ result .= ':' . $ description . // Item name ':' . $ basketItem -> getQuantity ( ) . // Quantity ':' . number_format ( $ basketItem -> getPrice ( ) , 2 , '.' , '' ) . // Unit cost (without tax) ':' . $ vat . // Item tax ':' . number_format ( $ basketItem -> getPrice ( ) + $ vat , 2 , '.' , '' ) . // Item total // As the getItemData() puts 0.00 into tax, same was done here ':' . number_format ( $ lineTotal , 2 , '.' , '' ) ; // Line total $ count ++ ; } // Prepend number of lines to the result string $ result = $ count . $ result ; return $ result ; }
Generate Basket string in the older non-XML format
This is called if "useOldBasketFormat" is set to true in the gateway config

@return string Basket field in format of:
1:Item:2:10.00:0.00:10.00:20.00
[number of lines]:[item name]:[quantity]:[unit cost]:[item tax]:[item total]:[line total]
Generate Basket string in the older non - XML format This is called if useOldBasketFormat is set to true in the gateway config