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 .= '
' . $card->getCardCode() . ' | ' . Mage::helper('core')->currency($order->getDiscounted(),true,false) . ' |
' . $this->__('Total Gift Cards Amount') .': | ' . Mage::helper('core')->currency($total,true,false) . ' |