Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento 1.8-隐藏字段-我的方法可以接受吗?_Php_Magento - Fatal编程技术网

Php Magento 1.8-隐藏字段-我的方法可以接受吗?

Php Magento 1.8-隐藏字段-我的方法可以接受吗?,php,magento,Php,Magento,我想在客户帐户仪表板中隐藏“公司”字段(不要问为什么) 我发现地址是在这里生成的: /app/code/core/Mage/Customer/Model/Customer.php 我创建了一个本地版本来覆盖核心文件,然后将公共函数getAddressCollection()更改为以下内容: public function getAddressesCollection() { if ($this->_addressesCollection === null) { $

我想在客户帐户仪表板中隐藏“公司”字段(不要问为什么)

我发现地址是在这里生成的:

/app/code/core/Mage/Customer/Model/Customer.php
我创建了一个本地版本来覆盖核心文件,然后将
公共函数getAddressCollection()
更改为以下内容:

public function getAddressesCollection()
{
    if ($this->_addressesCollection === null) {
        $this->_addressesCollection = $this->getAddressCollection()
            ->setCustomerFilter($this)
            //->addAttributeToSelect('*')

            ->addAttributeToSelect('prefix')
            ->addAttributeToSelect('firstname')
            ->addAttributeToSelect('middlename')
            ->addAttributeToSelect('lastname')
            ->addAttributeToSelect('suffix')
            ->addAttributeToSelect('street')
            ->addAttributeToSelect('city')
            ->addAttributeToSelect('country_id')
            ->addAttributeToSelect('region')
            ->addAttributeToSelect('region_id')
            ->addAttributeToSelect('postcode')
            ->addAttributeToSelect('telephone')
            ->addAttributeToSelect('fax')
            ->addAttributeToSelect('vat_id')
            ->addAttributeToSelect('vat_is_valid')
            ->addAttributeToSelect('vat_request_id')
            ->addAttributeToSelect('vat_request_date')
            ->addAttributeToSelect('vat_request_success');



        foreach ($this->_addressesCollection as $address) {
            $address->setCustomer($this);
        }
    }

    return $this->_addressesCollection;
}
我注释掉了
addAttributeToSelect('*')
,并将其替换为除公司之外的所有客户地址属性

这可以接受吗?它是有效的,但我想知道它是否会有任何明显的负面影响


谢谢

为什么要隐藏该字段?;-)为什么要隐藏该字段?;-)