getCollection() ->addFieldToFilter('customer_id', $customerId) ->addFieldToFilter('card_status', 1); foreach ($cards as $card) { $balance += $card->getCardBalance(); } } return $balance; } public function isShowEmailType() { return Mage::getStoreConfigFlag('giftcards/default/card_type_email'); } public function isShowPrintType() { return Mage::getStoreConfigFlag('giftcards/default/card_type_print'); } public function isShowOfflineType() { return Mage::getStoreConfigFlag('giftcards/default/card_type_offline'); } public function isUseDefaultPicture() { return Mage::getStoreConfigFlag('giftcards/email/card_picture'); } /* * Convert currency * (base=>allowed or allowed=>base) * * @param float $price * @param string $from * @param string $to * @return float */ public function currencyConvert($price, $from, $to) { $oCurrency = Mage::getModel('directory/currency')->load($from); $rate = $oCurrency->getAnyRate($to); $convertedPrice = $price*$rate; return $convertedPrice; } public function getUsedGiftCards($id) { $orderModel = Mage::getModel('giftcards/order')->getCollection()->addFieldToFilter('id_order',$id); $storeId = Mage::getModel('sales/order')->load($id)->getStoreId(); $usedGiftcards = array(); $html = ''; if($orderModel->getData()){ $html .= '
'.$this->__('Used Gift Cards').':
'; $total = 0; foreach($orderModel as $order){ $card = Mage::getModel('giftcards/giftcards')->load($order->getIdGiftcard()); $html .= ''; $total += $order->getDiscounted(); } $html .= '
' . $card->getCardCode() . '' . Mage::helper('core')->currency($order->getDiscounted(),true,false) . '
' . $this->__('Total Gift Cards Amount') .':' . Mage::helper('core')->currency($total,true,false) . '
'; } return $html; } }