Beispiel #1
0
 function calculateTax()
 {
     $jshopConfig = JSFactory::getConfig();
     $price = $this->getPrice();
     $pricetax = getPriceTaxValue($price, $this->getTax(), $jshopConfig->display_price_front_current);
     return $pricetax;
 }
Beispiel #2
0
 function getTaxExt($incShiping = 0, $incRabatt = 0, $incPayment = 0)
 {
     $jshopConfig = JSFactory::getConfig();
     $tax_summ = array();
     foreach ($this->products as $key => $value) {
         if ($value['tax'] != 0) {
             $tax_summ[$value['tax']] += $value['quantity'] * getPriceTaxValue($value['price'], $value['tax'], $jshopConfig->display_price_front_current);
         }
     }
     if ($incShiping) {
         $lst = $this->getShippingTaxList();
         foreach ($lst as $tax => $value) {
             if ($tax != 0 && $value != 0) {
                 $tax_summ[$tax] += $value;
             }
         }
         $lst = $this->getPackageTaxList();
         foreach ($lst as $tax => $value) {
             if ($tax != 0 && $value != 0) {
                 $tax_summ[$tax] += $value;
             }
         }
     }
     if ($incPayment) {
         $lpt = $this->getPaymentTaxList();
         foreach ($lpt as $tax => $value) {
             if ($tax != 0 && $value != 0) {
                 $tax_summ[$tax] += $value;
             }
         }
     }
     if ($incRabatt && $jshopConfig->calcule_tax_after_discount && $this->rabatt_summ > 0) {
         $tax_summ = $this->getTaxExtCalcAfterDiscount($incShiping, $incPayment);
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onAfterCartGetTaxExt', array(&$this, &$tax_summ, &$incShiping, &$incRabatt, $incPayment));
     return $tax_summ;
 }
Beispiel #3
0
 function loadtaxorder($data_order, $products)
 {
     JModelLegacy::addIncludePath(JPATH_COMPONENT_SITE . '/models');
     $jshopConfig = JSFactory::getConfig();
     $jshopConfig->display_price_front_current = $data_order['display_price'];
     $display_price_front_current = $data_order['display_price'];
     $taxes = array();
     $AllTaxes = JSFactory::getAllTaxes();
     $id_country = $data_order['d_country'];
     if (!$id_country) {
         $id_country = $data_order['country'];
     }
     // tax product
     foreach ($products as $key => $product) {
         $tax = floatval($product['product_tax']);
         $price = $product['product_item_price'] * $product['product_quantity'];
         $SumTax = isset($taxes[$tax]) ? $taxes[$tax] : 0;
         $taxes[$tax] = $SumTax + getPriceTaxValue($price, $tax, $display_price_front_current);
     }
     $cproducts = $this->getCartProductsFromOrderProducts($products);
     $cart = JSFactory::getModel('cart', 'jshop');
     $cart->products = array();
     $cart->loadProductsFromArray($cproducts);
     $cart->loadPriceAndCountProducts();
     // payment
     if ($data_order['order_payment'] > 0) {
         $price = $data_order['order_payment'];
         $payment_method_id = $data_order['payment_method_id'];
         $paym_method = JSFactory::getTable('paymentmethod', 'jshop');
         $paym_method->load($payment_method_id);
         $paym_method->setCart($cart);
         $payment_taxes = $paym_method->calculateTaxList($price);
         foreach ($payment_taxes as $k => $v) {
             $k = floatval($k);
             $SumTax = isset($taxes[$k]) ? $taxes[$k] : 0;
             $taxes[$k] = $SumTax + $v;
         }
     }
     //shipping
     $shipping_method = JSFactory::getTable('shippingMethod', 'jshop');
     $sh_pr_method_id = $shipping_method->getShippingPriceId($data_order['shipping_method_id'], $id_country);
     $shipping_method_price = JSFactory::getTable('shippingMethodPrice', 'jshop');
     $shipping_method_price->load($sh_pr_method_id);
     // tax shipping
     if ($data_order['order_shipping'] > 0) {
         $price = $data_order['order_shipping'];
         $shipping_taxes = $shipping_method_price->calculateShippingTaxList($price, $cart);
         foreach ($shipping_taxes as $k => $v) {
             $k = floatval($k);
             $SumTax = isset($taxes[$k]) ? $taxes[$k] : 0;
             $taxes[$k] = $SumTax + $v;
         }
     }
     // tax package
     if ($data_order['order_package'] > 0) {
         $price = $data_order['order_package'];
         $shipping_taxes = $shipping_method_price->calculatePackageTaxList($price, $cart);
         foreach ($shipping_taxes as $k => $v) {
             $k = floatval($k);
             $SumTax = isset($taxes[$k]) ? $taxes[$k] : 0;
             $taxes[$k] = $SumTax + $v;
         }
     }
     $taxes_array = array();
     foreach ($taxes as $tax => $value) {
         if ($tax > 0) {
             $taxes_array[] = array('tax' => $tax, 'value' => $value);
         }
     }
     extract(js_add_trigger(get_defined_vars(), "before"));
     return $taxes_array;
 }