public static function getInstance(Product $product, Currency $currency) { $filter = new ARSelectFilter(); $cond = new EqualsCond(new ARFieldHandle('ProductPrice', 'productID'), $product->getID()); $cond->addAND(new EqualsCond(new ARFieldHandle('ProductPrice', 'currencyID'), $currency->getID())); $filter->setCondition($cond); $set = parent::getRecordSet('ProductPrice', $filter); if ($set->size() > 0) { $instance = $set->get(0); } else { $instance = self::getNewInstance($product, $currency); } return $instance; }
public function getSubTotalByCurrency(Currency $currency) { if ($this->getCurrency()->getID() != $currency->getID()) { $current = $this->getCurrency(); $this->changeCurrency($currency); $subtotal = $this->getSubTotal(false); $this->changeCurrency($current); } else { return $this->getSubTotal(false); } }
public function isPriceSet(Currency $currency) { return isset($this->prices[$currency->getID()]); }