Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. //GET PROD TAX
  2. public static function getProdTax($pid, $shp)
  3. {
  4. $out = false;
  5. if (!(int) Configuration::get('PS_TAX')) {
  6. $out = 0;
  7. } else {
  8. $x = _DB_PREFIX_;
  9. $sql = "
  10. SELECT DISTINCT
  11. ".$x."tax.rate AS tax
  12. FROM ".$x."product
  13. LEFT JOIN ".$x."shop
  14. ON ".$x."shop.id_shop = $shp
  15. LEFT JOIN ".$x."product_shop
  16. ON ".$x."product_shop.id_product = ".$x."product.id_product
  17. AND ".$x."product_shop.id_shop = $shp
  18. LEFT JOIN ".$x."tax_rule
  19. ON ".$x."tax_rule.id_tax_rules_group = ".$x."product_shop.id_tax_rules_group
  20. LEFT JOIN ".$x."tax
  21. ON ".$x."tax.id_tax = ".$x."tax_rule.id_tax
  22. WHERE ".$x."product.id_product = $pid
  23. ";
  24. $res = Db::getInstance()->ExecuteS($sql);
  25. if ($res) {
  26. foreach ($res as $r) {
  27. $out = (float) $r['tax'];
  28. break;
  29. }
  30. }
  31. }
  32. return $out;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement