Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //GET PROD TAX
- public static function getProdTax($pid, $shp)
- {
- $out = false;
- if (!(int) Configuration::get('PS_TAX')) {
- $out = 0;
- } else {
- $x = _DB_PREFIX_;
- $sql = "
- SELECT DISTINCT
- ".$x."tax.rate AS tax
- FROM ".$x."product
- LEFT JOIN ".$x."shop
- ON ".$x."shop.id_shop = $shp
- LEFT JOIN ".$x."product_shop
- ON ".$x."product_shop.id_product = ".$x."product.id_product
- AND ".$x."product_shop.id_shop = $shp
- LEFT JOIN ".$x."tax_rule
- ON ".$x."tax_rule.id_tax_rules_group = ".$x."product_shop.id_tax_rules_group
- LEFT JOIN ".$x."tax
- ON ".$x."tax.id_tax = ".$x."tax_rule.id_tax
- WHERE ".$x."product.id_product = $pid
- ";
- $res = Db::getInstance()->ExecuteS($sql);
- if ($res) {
- foreach ($res as $r) {
- $out = (float) $r['tax'];
- break;
- }
- }
- }
- return $out;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement