Exemplo n.º 1
0
function getCorrectedPriceForQueryFilter($price)
{
    $jshopConfig = JSFactory::getConfig();
    $taxes = JSFactory::getAllTaxes();
    $taxlist = array_values($taxes);
    $tax = $taxlist[0];
    if ($jshopConfig->display_price_admin == 1 && $jshopConfig->display_price_front_current == 0) {
        $price = $price / (1 + $tax / 100);
    }
    if ($jshopConfig->display_price_admin == 0 && $jshopConfig->display_price_front_current == 1) {
        $price = $price * (1 + $tax / 100);
    }
    $price = $price / $jshopConfig->currency_value;
    return $price;
}
Exemplo n.º 2
0
 function getTax()
 {
     $taxes = JSFactory::getAllTaxes();
     return $taxes[$this->tax_id];
 }
Exemplo n.º 3
0
 function getTax()
 {
     $taxes = JSFactory::getAllTaxes();
     $this->product_tax = $taxes[$this->product_tax_id];
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeGetTaxProduct', array(&$this));
     return $this->product_tax;
 }
Exemplo n.º 4
0
 function updateTaxForProducts()
 {
     if (count($this->products)) {
         $taxes = JSFactory::getAllTaxes();
         foreach ($this->products as $k => $prod) {
             $this->products[$k]['tax'] = $taxes[$prod['tax_id']];
         }
     }
 }
 function getTaxPackage()
 {
     $taxes = JSFactory::getAllTaxes();
     return $taxes[$this->package_tax_id];
 }
Exemplo n.º 6
0
 function loadpaymentprice($data_order, $products)
 {
     JModelLegacy::addIncludePath(JPATH_COMPONENT_SITE . '/models');
     $jshopConfig = JSFactory::getConfig();
     $jshopConfig->display_price_front_current = $data_order['display_price'];
     $all_currency = JSFactory::getAllCurrency();
     $currency_id = $data_order['currency_id'];
     if ($currency_id) {
         $jshopConfig->currency_value = $all_currency[$currency_id]->currency_value;
     }
     $id_country = $data_order['d_country'];
     if (!$id_country) {
         $id_country = $data_order['country'];
     }
     $AllTaxes = JSFactory::getAllTaxes();
     $paym_method = JSFactory::getTable('paymentmethod', 'jshop');
     $paym_method->load($data_order['payment_method_id']);
     if ($paym_method->price_type == 2) {
         $total = 0;
         foreach ($products as $key => $product) {
             $tax = floatval($product['product_tax']);
             $product_price = $product['product_item_price'] * $product['product_quantity'];
             if ($data_order['display_price']) {
                 $product_price = $product_price + $product_price * $tax / 100;
             }
             $total += $product_price;
         }
         $cproducts = $this->getCartProductsFromOrderProducts($products);
         $cart = JSFactory::getModel('cart', 'jshop');
         $cart->products = array();
         $cart->loadProductsFromArray($cproducts);
         $cart->loadPriceAndCountProducts();
         $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 = floatval($AllTaxes[$shipping_method_price->shipping_tax_id]);
         $shipping_price = $data_order['order_shipping'];
         if ($data_order['display_price']) {
             $shipping_taxes = $shipping_method_price->calculateShippingTaxList($shipping_price, $cart);
             foreach ($shipping_taxes as $k => $v) {
                 $shipping_price = $shipping_price + $v;
             }
         }
         $total += $shipping_price;
         $tax = floatval($AllTaxes[$shipping_method_price->package_tax_id]);
         $package_price = $data_order['order_package'];
         if ($data_order['display_price']) {
             $shipping_taxes = $shipping_method_price->calculatePackageTaxList($package_price, $cart);
             foreach ($shipping_taxes as $k => $v) {
                 $package_price = $package_price + $v;
             }
         }
         $total += $package_price;
         $price = $total * $paym_method->price / 100;
         if ($data_order['display_price']) {
             $price = getPriceCalcParamsTax($price, $paym_method->tax_id, $cart->products);
         }
     } else {
         $price = $paym_method->price * $jshopConfig->currency_value;
         $price = getPriceCalcParamsTax($price, $paym_method->tax_id, $cart->products);
     }
     extract(js_add_trigger(get_defined_vars(), "before"));
     return $price;
 }
Exemplo n.º 7
0
 function getTax()
 {
     $taxes = JSFactory::getAllTaxes();
     $this->product_tax = $taxes[$this->product_tax_id];
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeGetTaxProduct', array(&$this));
     return $this->product_tax;
 }