Пример #1
0
 /**
  * Method provides item tax details. pass the product price and the product price and get the tax,
  * nternally gets the taxprofile id and get the tax
  *
  * @param   float    $product_price  product price.
  * @param   integer  $item_id        item id.
  * @param   array    $address        Adress detail object
  * @param   integer  $taxprofile_id  Tax profile id.
  *
  * @since   2.2
  * @return   null
  */
 public function getItemTax($product_price, $item_id, $address, $taxprofile_id = '')
 {
     $taxHelper = new taxHelper();
     $amount = 0;
     $ret['taxdetails'] = array();
     if (empty($taxprofile_id)) {
         // Get tax profile id
         $taxprofile_id = $taxHelper->getProductProfileId($item_id);
     }
     // Get Application tax rate details
     $ItemTaxes = $taxHelper->getApplicableTaxRates($taxprofile_id, $address);
     // Get tax rate wise commulative total
     $taxRateWiseTotal = $taxHelper->getTaxRateWiseTotal($product_price, $ItemTaxes);
     foreach ($taxRateWiseTotal as $tax_rate) {
         $amount += $tax_rate['amount'];
     }
     $ret['taxAmount'] = $amount;
     $ret['taxdetails'] = $taxRateWiseTotal;
     return $ret;
 }