Php 在一个页面中从两个模型获取数据-Magento
有人能帮我回答以下两个问题吗Php 在一个页面中从两个模型获取数据-Magento,php,magento,Php,Magento,有人能帮我回答以下两个问题吗 如何在下面的查询中筛选Websiteid 是否可以在一个文件中从两个集合中获取数据?最后一个值“company”应该来自客户地址模型,它现在被注释掉了 这里,也许试试这个?同样,我不确定这是否有效,但我认为它的方向是正确的 <?php $collection1 = Mage::getModel('customer/customer')->getCollection(); $collection2 = Mage::getModel('customer/
这里,也许试试这个?同样,我不确定这是否有效,但我认为它的方向是正确的
<?php
$collection1 = Mage::getModel('customer/customer')->getCollection();
$collection2 = Mage::getModel('customer/address')->getCollection();
$merged_ids = array_merge($collection1->getAllIds(), $collection2->getAllIds());
$merged_collection = Mage::getResourceModel('customer/customer_collection')
->addFieldToFilter('customer_id', $merged_ids)
->addAttributeToSelect('*')
->addStoreFilter();
?>
<?php
$collection1 = Mage::getModel('customer/customer')->getCollection();
$collection2 = Mage::getModel('customer/address')->getCollection();
$merged_ids = array_merge($collection1->getAllIds(), $collection2->getAllIds());
$merged_collection = Mage::getResourceModel('customer/customer_collection')
->addFieldToFilter('customer_id', $merged_ids)
->addAttributeToSelect('*')
->addStoreFilter();
?>