if ($product['tax'] > 0) {
$query1 = $this->db->query("SELECT tax_class_id FROM " . DB_PREFIX . "product WHERE product_id = '".$product['product_id']."'");
$query2 = $this->db->query("SELECT tax_rate_id FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '".$query1->row['tax_class_id']."'");
$query3 = $this->db->query("SELECT rate FROM " . DB_PREFIX . "tax_rate WHERE tax_rate_id = '".$query2->row['tax_rate_id']."'");
$price_inc = $product['price'] + (($product['price'] / 100) * $query3->row['rate']);
$prod_tax = (float) $query3->row['rate']."%";
and } else {
if ($product['tax'] > 0) {
$price_inc = $product['price'] + (($product['price'] / 100) * $product['tax']);
$prod_tax = (float) $product['tax']."%";
} else {
$price_inc = $product['price'];
$prod_tax = "";
}
$total_inc = $price_inc * $product['quantity'];
$product_data[] = array(
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']),
'tax' => $prod_tax,
'price_inc' => $this->currency->format($price_inc, $order_info['currency_code'], $order_info['currency_value']),
'total_inc' => $this->currency->format($total_inc, $order_info['currency_code'], $order_info['currency_value'])
);
}
if ($product['tax'] > 0) {
$query1 = $this->db->query("SELECT tax_class_id FROM " . DB_PREFIX . "product WHERE product_id = '".$product['product_id']."'");
$query2 = $this->db->query("SELECT tax_rate_id FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '".$query1->row['tax_class_id']."'");
$query3 = $this->db->query("SELECT rate FROM " . DB_PREFIX . "tax_rate WHERE tax_rate_id = '".$query2->row['tax_rate_id']."'");
$price_inc = $product['price'] + (($product['price'] / 100) * $query3->row['rate']);
$prod_tax = (float) $query3->row['rate']."%";
} else {
$price_inc = $product['price'];
$prod_tax = "";
}
$total_inc = $price_inc * $product['quantity'];
$product_data[] = array(
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']),
'tax' => $prod_tax,
'price_inc' => $this->currency->format($price_inc, $order_info['currency_code'], $order_info['currency_value']),
'total_inc' => $this->currency->format($total_inc, $order_info['currency_code'], $order_info['currency_value'])
);
}
Powrót do Pomoc przy modułach Opencart
Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 2 gości