开发者

combining price and government taxes

I have several files that are provided. I can convert and put them in an array, however, i cant figure out how to compare the 2 arrays:

1 is the pr开发者_高级运维oduct information and pricing eg:

Array ( 
   [0] => Array ( 
      [Description] => description 
      [ArtID] => 1111 
      [PartID] => 1111 
      [Price] => 8.59 
      [Stock] => 24 [ 
   ) 
   [1] => Array ( 
      [Description] => ....

the other contains all items that contain a certain type of government tax.

what i need to do is have array2, with the government tax, looped to match partid in array1, then have array1's price updated with old price + tax ..

the values in array2 don't contain all items (not all items are subject to the tax), and it does not contain the same amount of fields (less info required)

any suggestions?


$ccnt = count($product_arr);
for($c=0;$c<$ccnt;$c++){
  $price_original = $product_arr['price'];
  $price = $product_arr['price'];
  if(isset($gov_arr['tax'])){ $price = $price + ($price * $gov_arr['tax']); } // if percent
  $product_arr[$c]['price'] = $price;
  $product_arr[$c]['price_orig'] = $price_original;
}

Basically loop through the products and see if gov_arr['tax'] exist. If does then do math to get new value and then replace. I also saved the original price so if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜