【发布时间】:2011-12-16 15:21:37
【问题描述】:
我有以下代码需要检查相关属性是客户属性还是客户地址属性。如何检查?
private $custom_columns = array();
public function __construct()
{
parent::__construct();
$this->setId('customerGrid');
$this->setUseAjax(true);
$this->setDefaultSort('email');
$this->setDefaultLimit('200');
$this->setSaveParametersInSession(true);
$attributeIds = Mage::getStoreConfig('sectionname/group/field');
$this->custom_columns = array($attributeIds);
}
$attributeIds 如果我选择街道地址,则返回属性代码,如 street,如果我选择性别,则返回 gender 等等。现在应该设置什么条件才能知道给定属性是客户属性还是地址属性。
// 准备集合添加到存储自定义字段
foreach ($this->custom_columns as $col)
{
//如果它是客户属性的一些条件
集合->addAttributeToSelect($col);
//如果它是客户地址属性,则为其他条件
$collection->joinAttribute($col, "customer_address/$col", 'default_billing', null, 'left');
}
$this->setCollection($collection);
返回父级::_prepareCollection();
}
我只想知道那些条件会是什么。希望这更清楚一点
【问题讨论】:
-
很难理解你在问什么。请尽量说明您的问题是什么,并发布您已经尝试过的代码,以及您收到的任何错误消息。
标签: php zend-framework magento