Example #1
0
 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;
 }
Example #2
0
 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);
     }
 }
Example #3
0
 public function isPriceSet(Currency $currency)
 {
     return isset($this->prices[$currency->getID()]);
 }