Magento管理员 - 客户编辑页面不再有效

时间:2014-06-03 12:47:18

标签: magento magento-1.7

当我尝试使用Magento后端管理编辑客户时,我在console.log中收到以下错误,并且页面的后一部分从未加载。

屏幕截图说明了它的显示方式(注意标题正在加载,但此后没有任何内容) http://postimg.org/image/kewhh988l/

"NetworkError: 500 Internal Server Error - http://www.mydevsite.com.192.168.0.155.xip.io/index.php/admin/customer/edit/id/36067/key/24163240a85bbe65bb54b2f5b7fda0bf/

ReferenceError: _cp_integrate is not defined

if (!_cp_integrate) return;
f347ed...1554.js (line 22806)
TypeError: this.blockMsg is null

this.blockMsgError              = this.blockMsg.select('.error-msg')[0];

- 更新 - 这里要求的是我的customer.xml

<layout>
<adminhtml_customer_edit>
    <reference name="content">
        <block type="adminhtml/customer_edit" name="customer_edit"></block>
    </reference>
    <reference name="head">
        <block type="adminhtml/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" />
        <action method="addJs"><file>mage/adminhtml/product/composite/configure.js</file></action>
        <action method="addJs"><file>varien/configurable.js</file></action>
    </reference>
    <reference name="left">
        <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs">
            <block type="adminhtml/customer_edit_tab_view" name="customer_edit_tab_view" template="customer/tab/view.phtml">
                <block type="adminhtml/customer_edit_tab_view_sales" name="sales" template="customer/tab/view/sales.phtml" before="-" />
                <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" />
            </block>
            <action method="addTab"><name>customer_edit_tab_view</name><block>customer_edit_tab_view</block></action>
        </block>
    </reference>
    <reference name="js">
        <block type="adminhtml/template" template="customer/edit/js.phtml" name="customer.edit.js" as="customer_edit_js"></block>
    </reference>
</adminhtml_customer_edit>
<adminhtml_customer_group_index>
    <reference name="content">
        <block type="adminhtml/customer_group" name="customer_group"></block>
    </reference>
</adminhtml_customer_group_index>
<adminhtml_customer_wishlist>
    <block type="adminhtml/customer_edit_tab_wishlist" name="customer.wishlist.edit.tab" output="toHtml" />
</adminhtml_customer_wishlist>

<adminhtml_customer_orders>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_orders" name="adminhtml.customer.edit.tab.orders"/>
    </block>
</adminhtml_customer_orders>

<adminhtml_customer_carts>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_carts" name="admin.customer.carts"/>
    </block>
</adminhtml_customer_carts>

<adminhtml_customer_viewcart>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_view_cart" name="admin.customer.view.cart"/>
    </block>
</adminhtml_customer_viewcart>

<adminhtml_customer_viewwishlist>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_view_wishlist" name="admin.customer.view.wishlist"/>
    </block>
</adminhtml_customer_viewwishlist>

<adminhtml_customer_lastorders>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_view_orders" name="admin.customer.lastorders"/>
    </block>
</adminhtml_customer_lastorders>

<adminhtml_customer_productreviews>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_reviews" name="admin.customer.reviews"/>
    </block>
</adminhtml_customer_productreviews>

<adminhtml_customer_producttags>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_tag" name="admin.customer.tags"/>
    </block>
</adminhtml_customer_producttags>

<adminhtml_customer_taggrid>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_tag" name="admin.customer.tags"/>
    </block>
</adminhtml_customer_taggrid>

<adminhtml_customer_newsletter>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_newsletter_grid" name="admin.customer.newsletter.grid"/>
    </block>
</adminhtml_customer_newsletter>

<adminhtml_customer_grid>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_grid" name="admin.customer.grid"/>
    </block>
</adminhtml_customer_grid>

<adminhtml_customer_cart>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="adminhtml/customer_edit_tab_cart" name="admin.customer.view.edit.cart" />
    </block>
</adminhtml_customer_cart>

- 更新 - 当我从上面的布局文件中删除以下块时,我不再在console.log中获得所声明的错误消息 - 并且该页面将呈现更多页面。

现在我可以看到以下内容 - 用户名是可见的,右侧的其他按钮也是如此,例如客户编辑等...

所以,除非我完全没有这个......这与我刚评论出来的以下街区有关

<reference name="left">
    <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs">
        <block type="adminhtml/customer_edit_tab_view" name="customer_edit_tab_view" template="customer/tab/view.phtml">
            <block type="adminhtml/customer_edit_tab_view_sales" name="sales" template="customer/tab/view/sales.phtml" before="-" />
            <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" />
        </block>
            <action method="addTab"><name>customer_edit_tab_view</name><block>customer_edit_tab_view</block></action>
    </block>
</reference>

http://postimg.org/image/n8vyjpiwl/

- 更新 - 现在变得非常接近!我在其中一个核心文件中注释掉了以下代码:

\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php

第92-97行的代码

if (Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber')) {
    $this->addTab('newsletter', array(
       'label'     => Mage::helper('customer')->__('Newsletter'),
       'content'   => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()
    ));
}

一旦这个代码被注释掉 - 页面按预期呈现 - 所以它与这段代码中的某些内容有关。内容&#39;中包含的内容有问题。在上面的数组中。我很快就会发布这个观点。

- 更新 - 如上所述,问题是由上面的以下行引起的100%

'content'   => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()

以下是管理员阻止的代码:

/**
 * Customer account form block
 *
 * @category   Mage
 * @package    Mage_Adminhtml
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter extends Mage_Adminhtml_Block_Widget_Form
{

public function __construct()
{
    parent::__construct();
    $this->setTemplate('customer/tab/newsletter.phtml');
}

public function initForm()
{
    $form = new Varien_Data_Form();
    $form->setHtmlIdPrefix('_newsletter');
    $customer = Mage::registry('current_customer');
    $subscriber = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer);
    Mage::register('subscriber', $subscriber);

    if ($customer->getWebsiteId() == 0) {
        $this->setForm($form);
        return $this;
    }

    $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('customer')->__('Newsletter Information')));

    $fieldset->addField('subscription', 'checkbox',
         array(
                'label' => Mage::helper('customer')->__('Subscribed to Newsletter?'),
                'name'  => 'subscription'
         )
    );

    if ($customer->isReadonly()) {
        $form->getElement('subscription')->setReadonly(true, true);
    }

    $form->getElement('subscription')->setIsChecked($subscriber->isSubscribed());

    if($changedDate = $this->getStatusChangedDate()) {
         $fieldset->addField('change_status_date', 'label',
             array(
                    'label' => $subscriber->isSubscribed() ? Mage::helper('customer')->__('Last Date Subscribed') : Mage::helper('customer')->__('Last Date Unsubscribed'),
                    'value' => $changedDate,
                    'bold'  => true
             )
        );
    }

    $this->setForm($form);
    return $this;
}

public function getStatusChangedDate()
{
    $subscriber = Mage::registry('subscriber');
    if($subscriber->getChangeStatusAt()) {
        return $this->formatDate(
            $subscriber->getChangeStatusAt(),
            Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true
        );
    }

    return null;
}

protected function _prepareLayout()
{
    $this->setChild('grid',
        $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter_grid','newsletter.grid')
    );
    return parent::_prepareLayout();
}

}

2 个答案:

答案 0 :(得分:1)

您有500个内部服务器错误,因此有3个地方需要检查:

  1. 检查您的apache / nginx日志以查看错误消息
  2. 检查var / report文件夹
  3. 在浏览器中,查看页面源并滚动到底部。

答案 1 :(得分:1)

正如我已经说过的那样,我会尝试做什么..

  • 检查apache / nginx的错误日志并滚动到底部以查找最新的错误,此错误日志可能很大,具体取决于它的年龄。您可能希望删除它,然后让apache在触发错误时重新创建它并写入日志文件。
  • Magento可能会出现会话和缓存问题。在Magento中注销任何管理员/客户会话,清空管理中的所有缓存。
  • 清空所有浏览器会话/缓存等。我甚至可能使用其他浏览器
  • 查看console.log并使用堆栈跟踪选项,这将突出显示在查看正在调用的javascript等时有用的路由。
  • 在您提到的视图/文件中,一次注释掉一行或一个块,然后再次运行该页面,看看会发生什么。这可以帮助您缩小“问题代码”的范围。

希望有所帮助