Skip to content

Instantly share code, notes, and snippets.

@sthamann
Created May 8, 2013 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sthamann/5538405 to your computer and use it in GitHub Desktop.
Save sthamann/5538405 to your computer and use it in GitHub Desktop.
Modify cart to determine tax depends on the basket value
<?php
// Replace Hook auf engine/core/class/sBasket::getMaxTax
public function getMaxTax(){
$sql = "
SELECT
SUM(price * quantity) as amount_per_tax, tax
FROM s_order_basket b
WHERE b.sessionID=? AND b.modus=0
GROUP BY tax_rate
ORDER BY amount_per_tax DESC
";
$taxRate = Shopware()->Db()->fetchRow($sql,array(empty(Shopware()->System()->sSESSION_ID) ? session_id() : Shopware()->System()->sSESSION_ID));
return $taxRate["tax"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment