Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

joinAttribute, eav and nested join
 
dragouf
Jr. Member
 
Total Posts:  3
Joined:  2009-04-16
 

Hi everyone,

I’m lost,

I try since a long time now to join two table like this :

I created an eav attribute link to “customer_entity” table (this eav is named “myinfo_id")

I want to filter on this field when I display invoice grid in admin.

but for this I need to join first table on “sales_order” to then join “customer_entity” table and then join eav table to get “myinfo_id” value.

and I fail to make a second joinAttribute on the previous join table because joinAttribute try to join on main table.

The code I editing is in :

app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php

$collection Mage::getResourceModel('sales/order_invoice_collection')
            ->
addAttributeToSelect('order_id')
            ->
addAttributeToSelect('increment_id')
            ->
addAttributeToSelect('created_at')
            ->
addAttributeToSelect('state')
            ->
addAttributeToSelect('grand_total')
            ->
addAttributeToSelect('order_currency_code')            
            ->
joinAttribute('billing_firstname''order_address/firstname''billing_address_id'null'left')
            ->
joinAttribute('billing_lastname''order_address/lastname''billing_address_id'null'left')
            ->
joinAttribute('order_increment_id''order/increment_id''order_id'null'left')
            ->
joinAttribute('order_created_at''order/created_at''order_id'null'left')
            
            ->
joinAttribute('entity_customer_id''order/customer_id''order_id'null'left')  
          
            ->
joinAttribute('myinfoid''customer/myinfo_id''entity_customer_id'null'inner')

but last line don’t work.

Any one know how to do ?

(sorry for my english)

 
Magento Community Magento Community
Magento Community
Magento Community
 
5erTag
Member
 
Total Posts:  46
Joined:  2008-04-08
 

this also can´t work, maybe you get something displayed, but not the customer id:

->joinAttribute(’entity_customer_id’, ‘order/customer_id’, ‘order_id’, null, ‘left’)

(Synthax von JoinAttribute: auf englisch:
joinAttribute($alias,$attribute,$bind, ...)

$alias:  is whatever you want the field selected as

$attribute: is the joined entity = <entity_type_code>/<attribute_code>
see eav_entity_type table for entity_type_code
attribute code is attribute of the corresponding entity you want to select out

$bind is the attribute code of the main entity to link to the joined entity

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top