1
我正在嘗試將自定義表加入到客戶集合中。 自定義表:Magento JoinLeft
+---------+--------------------+
| user_id | linked_customer_id |
+---------+--------------------+
| 4 | 12 |
+---------+--------------------+
我想將USER_ID添加到每個地方的customer_id匹配linked_customer_id項目。
我必須得下,但我收到:
柱未發現:1054未知列「main_table.entity_id」
$collection = Mage::getResourceModel('customer/customer_collection')
->addNameToSelect()
->addAttributeToSelect('entity_id')
->addAttributeToSelect('email')
->addAttributeToSelect('brand')
->addAttributeToSelect('group_id')
->joinAttribute('shipping_company', 'customer_address/company', 'default_shipping', null, 'left')
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
->joinAttribute('shipping_country_id', 'customer_address/country_id', 'default_shipping', null, 'left')
->joinAttribute('billing_vat_id', 'customer_address/vat_id', 'default_billing', null, 'left');
$collection->getSelect()->joinLeft(
array('salesrep' => 'custom_column'), 'main_table.entity_id=salesrep.user_id',
array('user_id' => 'salesrep.linked_customer_id')
);
$this->setCollection($collection);
你是完全正確的。情況就是如此。表別名的確是'e'。謝謝你明確的答案。 –