/** * Compares the properties of the given price item with its own one. * * This method compare only the essential price properties: * * Value * * Costs * * Rebate * * Tax rate * * Tax flag * * Quantity * * Currency ID * * All other item properties are not compared. * * @param \Aimeos\MShop\Price\Item\Iface $price Price item to compare with * @return boolean True if equal, false if not * @since 2014.09 */ public function compare(\Aimeos\MShop\Price\Item\Iface $price) { if ($this->getValue() === $price->getValue() && $this->getCosts() === $price->getCosts() && $this->getRebate() === $price->getRebate() && $this->getTaxRate() === $price->getTaxRate() && $this->getTaxFlag() === $price->getTaxFlag() && $this->getQuantity() === $price->getQuantity() && $this->getCurrencyId() === $price->getCurrencyId()) { return true; } return false; }
/** * Returns the calculated amount of the price item * * @param \Aimeos\MShop\Price\Item\Iface $price Price item * @param boolean $costs Include costs per item * @param boolean $tax Include tax * @return string Formatted money amount */ protected function getAmount(\Aimeos\MShop\Price\Item\Iface $price, $costs = true, $tax = true) { $amount = $price->getValue(); if ($costs === true) { $amount += $price->getCosts(); } if ($tax === true && $price->getTaxFlag() === false) { $tmp = clone $price; if ($costs === false) { $tmp->clear(); $tmp->setValue($price->getValue()); $tmp->setTaxRate($price->getTaxRate()); $tmp->setQuantity($price->getQuantity()); } $amount += $tmp->getTaxValue(); } return number_format($amount, 2, '.', ''); }