【问题标题】:magento version > = 1.9 have reported a Fatal error while sending out Confirmation mailsmagento 版本 > = 1.9 在发送确认邮件时报告了致命错误
【发布时间】:2015-11-07 05:46:43
【问题描述】:

我正在获取 magento 版本 > = 1.9 中的问题。发送确认邮件时出现致命错误。 致命错误:在第 38 行的 /usr/share/iseeme-magento/app/design/frontend/base/default/template/shopsocially/items.phtml 中的非对象上调用成员函数 getAllItems() 只有在发送订单确认邮件时才会出现此问题。

我的模板文件是:-

    <?php $_order = $this->getOrder() ?>
       <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #bebcb7; background:#f8f7f5;">
         <thead>
           <tr>
              <th align="left" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Item') ?></th>
              <th align="left" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Sku') ?></th>
              <th align="center" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Qty') ?></th>
             <th align="right" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Subtotal') ?>
            </th>
        </tr>
       </thead>

      <?php $i=0; foreach ($_order->getAllItems() as $_item): ?>
      <?php if($_item->getParentItem()) continue; else $i++; ?>
      <tbody<?php echo $i%2 ? ' bgcolor="#eeeded"' : '' ?>>
      <?php echo $this->getItemHtml($_item) ?>
     </tbody>
     <?php endforeach; ?>

       <tbody>
         <?php echo $this->getChildHtml('order_totals') ?>
       </tbody>
    </table>

     <br />
      <p>
       <?php echo $this->getChildHtml('shopsocially_email') ?>
     </p>
   <br />
   <br />
   <table cellspacing="0" cellpadding="0" border="0" width="100%"       style="border:1px solid #bebcb7; background:#f8f7f5;">
   <thead>
    <tr>
        <th align="left" bgcolor="#d9e5ee" style="padding:3px  9px"><strong><?php echo $this->__('Gift Message for this Order') ?></strong>  </th>
   </tr>
  </thead>
  <tbody>
       <?php if($_order->getGiftMessageId() && $_giftMessage =  $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId())): ?>
      <tr>
         <td colspan="4" align="left" style="padding:3px 9px">
         <strong><?php echo $this->__('From:'); ?></strong> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?>
         <br /><strong><?php echo $this->__('To:'); ?></strong> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?>
        <br /><strong><?php echo $this->__('Message:'); ?></strong><br /> <?php echo $this->htmlEscape($_giftMessage->getMessage()) ?>
          </td>
        </tr>
       <?php endif; ?>
   </tbody>
   </table>

我的块文件是:-

 class ShopSocially_SocialLogin_Block_Email extends Mage_Core_Block_Template {


protected function _toHtml(){           
    $rez='';
    if(Mage::helper('sociallogin')->isActive()){
        $site=(Mage::helper('sociallogin')->isUseSandbox()?'go.shopsocially.com':'shopsocially.com');
        if(Mage::helper('sociallogin')->getEmail()==1){                                                                                                                                 
            $rez.='<a target="_blank" href="http://'.$site.'/merchant/claim_discount?pid='.Mage::helper('sociallogin')->getPartnerId().'"><span style="text-decoration: none;"><img border="0" src="http://'.$site.'/image/'.Mage::helper('sociallogin')->getPartnerId().'/email" />&nbsp;</span></a>';
        }else if(Mage::helper('sociallogin')->getEmail()==2){
            $rez.='<a target="_blank" href="http://'.$site.'/merchant/claim_discount?pid='.Mage::helper('sociallogin')->getPartnerId().'">'.Mage::helper('sociallogin')->__('Share your purchase with friends and make them smile').'</a>';     
        }
    }
    Mage::log($rez);
    return $rez;
  } 
}

【问题讨论】:

    标签: php email magento


    【解决方案1】:

    这个错误意味着 $_order 不是一个对象。换句话说,您在此模板中没有订单。

    【讨论】:

    • 也许您忘记为“ShopSocially_SocialLogin_Block_Email”块设置“订单”数据?
    猜你喜欢
    • 2014-03-12
    • 2011-12-14
    • 2015-03-29
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 2011-06-09
    • 2014-09-22
    相关资源
    最近更新 更多