예제 #1
0
 /**
  * Set data to block
  *
  * @return string
  */
 protected function _toHtml()
 {
     $this->_loadPaymentMethods();
     $this->setBackUrl($this->getUrl('*/billing_agreement/'));
     if ($this->_billingAgreementInstance) {
         $this->setReferenceId($this->_billingAgreementInstance->getReferenceId());
         $this->setCanCancel($this->_billingAgreementInstance->canCancel());
         $this->setCancelUrl($this->getUrl('*/billing_agreement/cancel', array('_current' => true, 'payment_method' => $this->_billingAgreementInstance->getMethodCode())));
         $paymentMethodTitle = $this->_billingAgreementInstance->getAgreementLabel();
         $this->setPaymentMethodTitle($paymentMethodTitle);
         $createdAt = $this->_billingAgreementInstance->getCreatedAt();
         $updatedAt = $this->_billingAgreementInstance->getUpdatedAt();
         $this->setAgreementCreatedAt($createdAt ? $this->helper('core')->formatDate($createdAt, 'short', true) : $this->__('N/A'));
         if ($updatedAt) {
             $this->setAgreementUpdatedAt($this->helper('core')->formatDate($updatedAt, 'short', true));
         }
         $this->setAgreementStatus($this->_billingAgreementInstance->getStatusLabel());
     }
     return parent::_toHtml();
 }
예제 #2
0
 /**
  * Retrieve item value by key
  *
  * @param Varien_Object $item
  * @param string $key
  * @return mixed
  */
 public function getItemValue(Mage_Sales_Model_Billing_Agreement $item, $key)
 {
     switch ($key) {
         case 'created_at':
         case 'updated_at':
             $value = $item->getData($key) ? $this->helper('core')->formatDate($item->getData($key), 'short', true) : $this->__('N/A');
             break;
         case 'edit_url':
             $value = $this->getUrl('*/billing_agreement/view', array('agreement' => $item->getAgreementId()));
             break;
         case 'payment_method_label':
             $label = $item->getAgreementLabel();
             $value = $label ? $label : $this->__('N/A');
             break;
         case 'status':
             $value = $item->getStatusLabel();
             break;
         default:
             $value = $item->getData($key) ? $item->getData($key) : $this->__('N/A');
     }
     return $this->escapeHtml($value);
 }