【问题标题】:Magento 1.9.x Edit Billing Address Form is EmptyMagento 1.9.x 编辑帐单地址表单为空
【发布时间】:2019-06-23 13:54:12
【问题描述】:

我是 magento 新手,我不知道为什么编辑帐单/送货地址在管理面板中显示为空表单。

销售 > 订单 > 编辑帐单地址/送货地址

我终于在后台找到了文件

app/design/adminhtml/default/default/template/sales/order/address/form.phtml

但是当我尝试添加该字段时,它只有这个 php 代码:

<?php echo $this->getForm()->toHtml() ?> 在第 41 行。

在哪里可以编辑 getForm()?

它是某个地方的文件,还是在数据库中,或者在某个地方的配置设置中?

【问题讨论】:

  • 您想在编辑顺序中添加您的字段并在管理员中添加顺序对吗?
  • 如何在后台添加送货地址和账单地址?
  • 销售订单中?

标签: magento magento-1.9


【解决方案1】:

致命错误:声明 Mage_Customer_Model_Resource_Address_Attribute_Source_Country::getAllOptions() 必须兼容 Mage_Eav_Model_Entity_Attribute_Source_Table::getAllOptions($withEmpty = true, $defaultValues = false) 在 /app/code/core/Mage/Customer/Model/Resource/Address/Attribute/Source/Country.php 在第 35 行`在此处输入代码

Mage_Eav_Model_Entity_Attribute_Source_Table::getAllOptions($withEmpty = true, $defaultValues = false) 函数定义改变了,所以这里添加了两个参数,所以我们需要在下面的 2 个文件中改变这个定义

/app/code/core/Mage/Customer/Model/Resource/Address/Attribute/Source/Country.php 在第 35 行 /app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php 第 59 行

代码改为

public function getAllOptions($withEmpty = true, $defaultValues = false)
{
    $storeId = $this->getAttribute()->getStoreId();
    if (!$this->_options) {
        $this->_options = Mage::getResourceModel('directory/country_collection')
            ->loadByStore($this->getAttribute()->getStoreId())->toOptionArray();
    }
    $options = ($defaultValues ? $this->_optionsDefault[$storeId] : $this->_options[$storeId]);
    if ($withEmpty) {
        array_unshift($options, array('label' => '', 'value' => ''));
    }
    return $this->_options;
}

【讨论】:

  • 请解释一下。你的代码到底在做什么。
  • 这里的函数定义在核心 getAllOptions 中发生了变化,因此我们必须在我们调用的函数(如 Mage_Customer_Model_Resource_Address_Attribute_Source_Country::getAllOptions() )中将参数传递给 getAllOptions($withEmpty = true, $defaultValues = false)来自第 59 行文件的 app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php 文件中的错误,因此我们根据 getAllOptions($withEmpty = true, $defaultValues = false) 进行了更改,现在我们可以检查它的工作。我希望这能帮到您。 !!:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-30
  • 2020-09-27
  • 2015-01-30
  • 1970-01-01
  • 2021-10-10
相关资源
最近更新 更多