Frage

Wie füge ich dieser Sammlung Firmen- und Gruppennamen hinzu?

$collection = Mage::getResourceModel('customer/customer_collection')               
               ->addAttributeToSelect('*')             
               ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
               ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
               ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
               ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
               ->joinAttribute('billing_fax', 'customer_address/fax', 'default_billing', null, 'left')
               ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
               ->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')               

               ->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_fax', 'customer_address/fax', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
               ->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left')
               ->joinAttribute('taxvat', 'customer/taxvat', 'entity_id', null, 'left');  
War es hilfreich?

Lösung

Das Unternehmen ist ein Customer_Address -Attribut. Daher müssen Sie entscheiden, ob es sich aus der Versand- oder Rechnungsadresse befinden oder sich sowohl wie den Rest anschließen sollte.

Und Gruppenname wie dieser:

$collection->joinTable('customer/customer_group', 'customer_group_id=group_id', array('customer_group_code'), null, 'left');

Habe es nicht getestet ;-)

Es ist wichtig, als Bedingung die Spalte der angeschlossenen Tabelle als Vorname festzulegen.

Ich habe einen Blog -Artikel darüber geschrieben: http://blog.fabian-blechsche

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top