So hatte ich das mal sehr dreckig gelöst...
Du müsstest es im Grunde nur gedanklich erweitern, dass du das Produkt auf Attribute o. ä. prüfst...
Bedenke aber das jede jQuery Berechnung vom Nutzer manipuliert werden kann.
PHP-Code:
<?php
namespace Isotope;
class IsotopeGrossPrice extends Frontend
{
/**
* adds the german tax to all product prices
*
* @param $fltPrice
* @param $objSource
* @param $strField
* @param $intTaxClass
* @return mixed
*/
public function calculateTax($fltPrice, $objSource, $strField, $intTaxClass)
{
return ( $this->isProductPrice($objSource) ? $fltPrice*1.19 : $fltPrice );
}
/**
* validates if a price is a product price
*
* @param $objSource
* @return bool
*/
protected function isProductPrice($objSource)
{
return is_a($objSource, 'Isotope\Model\ProductPrice');
}
}
Lesezeichen