/** * returns the tax amount included in $this * * @return float */ public function getTaxAmount() { $showPricesGross = false; $member = SilvercartCustomer::currentUser(); if ($member) { if ($member->showPricesGross(true)) { $showPricesGross = true; } } else { $defaultPriceType = SilvercartConfig::DefaultPriceType(); if ($defaultPriceType == 'gross') { $showPricesGross = true; } } if ($showPricesGross) { $taxRate = $this->getPrice()->getAmount() - $this->getPrice()->getAmount() / (100 + $this->getTaxRate()) * 100; } else { $taxRate = $this->getPrice()->getAmount() * ($this->getTaxRate() / 100); } return $taxRate; }
/** * Returns the members price type * * @return string */ public function getPriceType() { $priceType = SilvercartConfig::DefaultPriceType(); foreach ($this->owner->Groups() as $group) { if (!empty($group->Pricetype) && $group->Pricetype != '---') { $priceType = $group->Pricetype; break; } } return $priceType; }