*/
class Mage_XmlConnect_Block_Customer_GiftcardCheck extends Enterprise_GiftCardAccount_Block_Check
{
/**
* Render gift card info xml
*
* @return string
*/
protected function _toHtml()
{
$card = $this->getCard();
if ($card->getId()) {
/** @var $xmlModel Mage_XmlConnect_Model_Simplexml_Element */
$xmlModel = Mage::getModel('xmlconnect/simplexml_element', '');
$balance = Mage::helper('core')->currency($card->getBalance(), true, false);
$result[] = $this->__("Gift Card: %s", $card->getCode());
$result[] = $this->__('Current Balance: %s', $balance);
if ($card->getDateExpires()) {
$result[] = $this->__('Expires: %s', $this->formatDate($card->getDateExpires(), 'short'));
}
$xmlModel->addCustomChild('info', implode(PHP_EOL, $result));
} else {
$xmlModel = Mage::getModel('xmlconnect/simplexml_element', '');
$xmlModel->addCustomChild('status', Mage_XmlConnect_Controller_Action::MESSAGE_STATUS_ERROR);
$xmlModel->addCustomChild('text', $this->__('Wrong or expired Gift Card Code.'));
}
return $xmlModel->asNiceXml();
}
}