コード例 #1
0
 /**
  * Constructor
  */
 function __construct()
 {
     global $order;
     $this->code = 'ot_klarna_fee';
     $this->_country = $order->delivery['country']['iso_code_2'];
     $this->_utils = new KlarnaUtils($this->_country);
     $this->_lang = KlarnaUtils::getLanguageCode();
     $this->_klarnaDB = new XtcKlarnaDB();
     // Configure KiTT
     $this->_utils->configureKiTT();
     $invFee = $this->_utils->translate('ot_klarna_title', $this->_lang);
     //~ ENT_NOQUOTES,
     //~ 'ISO-8859-1'
     //~ );
     if (KlarnaConstant::isAdmin() && (!array_key_exists('action', $_GET) || !in_array($_GET['action'], array('install', 'remove')))) {
         echo "<link href='" . KlarnaUtils::getStaticPath() . "images.css' type='text/css' rel='stylesheet'/>";
         $this->title = "<span class='klarna_icon'></span> Klarna - {$invFee}";
     } else {
         $this->title = $invFee;
     }
     $this->description .= $this->_utils->translate('ot_klarna_title', $this->_lang);
     $this->description .= "<br />All invoice fees should be set in that countries currency";
     $this->enabled = MODULE_KLARNA_FEE_STATUS;
     $this->sort_order = MODULE_KLARNA_FEE_SORT_ORDER;
     $this->tax_class = MODULE_KLARNA_FEE_TAX_CLASS;
     $this->output = array();
 }
コード例 #2
0
 /**
  * Get the value of the cart
  *
  * @return float
  */
 public function getCartSum()
 {
     global $order;
     $currency = $_SESSION['currency'];
     if (KlarnaConstant::isAdmin()) {
         return 0;
     }
     $shippingCost = $this->_getShippingCost();
     if ($order == null) {
         return $shippingCost + $_SESSION['cart']->total;
     }
     $totalSum = 0;
     foreach ($order->products as $product) {
         $totalSum += $product['price'] * (1 + $product['tax'] / 100) * $product['qty'];
     }
     return $shippingCost + $totalSum;
 }
コード例 #3
0
 /**
  * Build the apropriate description for the admin page.
  *
  * @return string
  */
 private function _buildDescription()
 {
     $data = array();
     if ($this->_isInvoice()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('INVOICE_TEXT_DESCRIPTION');
     } elseif ($this->_isPart()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('PARTPAY_TEXT_DESCRIPTION');
     } elseif ($this->_isSpec()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('SPEC_TEXT_DESCRIPTION');
     } else {
         return '';
     }
     $data['version'] = KlarnaCore::getCurrentVersion();
     if (KlarnaConstant::isAdmin() && KlarnaConstant::isEnabled($this->_option, $this->_country) && ($this->_isPart() || $this->_isSpec())) {
         $data['code'] = $this->code;
         $data['pclasses'] = true;
     }
     $templateLoader = KiTT::templateLoader($this->_locale);
     return $templateLoader->load('description.mustache')->render($data);
 }