Questions tagged [join-table]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8 votes
1 answer
15k views

How to join product collection of magento 2 to a custom table?

I have a custom table user_product_table with a field sku(this field join to product collection) and user. How can I join this table with product collection, so that I don't have to loop my custom ...
Prakash Thapa's user avatar
7 votes
2 answers
18k views

Join the two tables in Magento 2

I'm trying to join two tables but it's returning wrong result could you please suggest me how to write it. Data: From my custom table(product_id,email,id) have Product_id. Expecting Result : join ...
M_N's user avatar
  • 191
7 votes
1 answer
1k views

Join table for grid Magento 2 not working

I tried to create a join to select data for my grid table in Magento 2 but the problem I am always getting is an empty record for alias that I wanted to use in my grid. Please refer the below image: ...
simple guy's user avatar
  • 2,474
6 votes
5 answers
4k views

Magento Admin Order Grid Filter by "Status" giving error while joined with "sales_flat_order" table

I am working on a project where there is custom column already installed on sales_flat_order table. I know, in order grid magento uses sales_flat_order_grid table to fetch data. I have used join ...
Adarsh Khatri's user avatar
5 votes
4 answers
35k views

Magento 2: join custom table with product collection while sql query is running fine

I trying to join custom table with product collection but I am not getting result. But printed SQL query is running fine namespace Vendor\Module\Block\Product; use Magento\Catalog\Api\...
Abhishek's user avatar
  • 939
5 votes
2 answers
999 views

Joining table to collection doesn't work but getData shows joined fields

The problem I have joined the category product list collection (getLoadedProductCollection from Mage_Catalog_Block_Product_List) with a custom table. Because this collection is loaded from ...
philwinkle's user avatar
  • 35.8k
5 votes
1 answer
744 views

How do I make this custom expression column I have developed for the customer grid display sortable?

I'm trying to add an expression column to collection in customer grid. But it not sortable. I'm not sure that using addExpressionAttributeToSelect or addExpressionFieldToSelect function can solve this ...
HungDQ's user avatar
  • 792
4 votes
4 answers
9k views

How to Get Distinct Entries from Joined Tables Through Join()

This doubt aroused when I am answering one of the question that posted here. But this question is not a continuation of that question, rather a general doubt. Basically I need to get log-customer ...
Rajeev K Tomy's user avatar
4 votes
1 answer
7k views

Join table to product/catalog collection to display new custom column in catalog grid

I am trying to add a column to the catalog/product grid. So far I have been able to create the column but have been unable to populate it here is what it looks like now So far I've tried this $...
engineerKev's user avatar
3 votes
1 answer
2k views

Get Product name in grid

In custom module i m saving product id in my table using that i want to display product name in admin grid I m trying this code to join table $collection->getSelect() ->joinLeft( ...
Newbie's user avatar
  • 1,604
3 votes
2 answers
3k views

Error Filtering grid from joined table collection

I successfully create a custom customer grid which use select join, the problem is i concat customer first name and customer last name as a new column alias, and when i filter the column it shows ...
Idham Choudry's user avatar
3 votes
1 answer
2k views

Magento 2: Join EAV attribute from product attribute set on a custom flat table

Hi fellow programmers, I would like to know how to do a join on my custom flat table (i.e. discountrules), I've implemented a generic Repository based on the Pestle archive, which implements the ...
Merijn's user avatar
  • 152
2 votes
1 answer
8k views

how to join three tables on every time when model load

I want to join three tables on every time when model load (for example on edit from page, on grid page in admin and detail page in front-end etc... ) in my custom module. can you please let me know ...
Lalit Kaushik's user avatar
2 votes
1 answer
1k views

Magento 2.2 - custom product sorting issue

I have override toolbar.php for custom sorting attribute. <?php namespace Vendor\Module\Block\Product\ProductList; class Toolbar extends \Magento\Catalog\Block\Product\ProductList\Toolbar ...
Jigar Dhaduk's user avatar
2 votes
1 answer
3k views

How to do multiple join query in magento

I have to add Extra field like buyer name in Admin sales order create section Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid In collection Add code like $collection->getSelect()->join(...
GR Rajkumar's user avatar
2 votes
1 answer
2k views

join 2 collection in custom Grid Magento

join 2 collection in custom Grid Magento.I am using the below code. I want to join with sales_flat_order to get get Shipping address & Grand Total. how to do ? $customerId = $this->getRequest()...
Magento AJ's user avatar
2 votes
1 answer
2k views

Get product name and sku in grid using join

Here is my code $vendorTableName = Mage::getSingleton('core/resource')->getTableName('marketplace/vendor'); $vendorproductsTableName = Mage::getSingleton('core/resource')->getTableName('...
ND17's user avatar
  • 5,161
2 votes
2 answers
1k views

magento customer table join query group by make problem in pagination

I wrote the join query with customer table. the query is, when I execute this query they will return 5 records: $collection = $this->getCollection() ->addAttributeToSelect('userid') -&...
senthil's user avatar
  • 1,707
2 votes
1 answer
1k views

I'm having trouble joining the customer_entity_varchar table to the sales_flat_order_grid table

A client wants a specific piece of data from the customer_entity_varchar table to display in place of the customer's last name in the Sales Order Grid. I'm trying to join the customer_entity_varchar ...
Joshua Romero's user avatar
2 votes
1 answer
706 views

Join from custom table to customer_entity table and get all data customer in Magento 2

I used this code but it not working. Please help me! $customerEntity = $locationList->getTable('customer_entity'); $locationList = $this->mpSellerMapLocatorModel->getCollection(); $...
TN98's user avatar
  • 923
2 votes
3 answers
4k views

How to JOIN TABLES with WHERE clause in Magento 1.9?

I want to join two tables, the customer_entity, and customer_entity_varchar. but I have no idea how to do it. This is my current query: Let's assume I the entity_id is 5 and attribute_id is 139. $...
larp's user avatar
  • 281
2 votes
2 answers
876 views

joinLeft escape string from ON condition

I am wondering if it is possible to escape string inside ON condition, something like binding params inside where condition. This is my code $this->getSelect()->joinLeft( array('...
JohnyFree's user avatar
  • 1,529
2 votes
1 answer
2k views

Add attribute filter 'manufacturer' to 'reports/product_collection'

I want to filter reports/product_collection by attribute manufacturer. I try with this: $_productCollection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('...
Bernhard Prange's user avatar
2 votes
0 answers
112 views

Join customer_entity snd catalog_product_entity by custom attribute

I use Magento 2 I need to display some data from customer and product in admin grid panel and I wonder how to join catalog_product_entity table with customer_entity. I added custom attribute to ...
Dominik Adamski's user avatar
2 votes
2 answers
2k views

Create Admin grid from join table collection

I'm new to magento 2, I have a query to join multiple table, only 1 custom table I've made and the rest is from Magento 2, the query looks like this: SELECT marketplace_orders.entity_id as id, ...
mileven's user avatar
  • 419
2 votes
1 answer
1k views

Relationship between catalog_product_entity and cataloginventory_stock_item

I am trying to join these 2 tables together to get all the attributes I need from the group of Product Entity tables and join them with the remaining quantity in stock from the Stock Item table. ...
13579246813579's user avatar
1 vote
2 answers
2k views

How to Join an EAV to a Flat Table & Import Flat Table and Update EAV

This will be two parts 1.) Join an EAV to a Flat Table the Magento way 2.) Import into Flat Table that will update the EAV Table. Basically be able to Export(Flat Table) and Import(with flat table) ...
Bill Murray's user avatar
1 vote
1 answer
667 views

Use of sub query within collection in Magento

I am using a subquery in Magento collection, Here is my code. $websiteId = $this->storeManager->getStore()->getWebsiteId(); $collection = $this->_productCollectionFactory->create(); $...
Jafar Pinjar's user avatar
  • 1,929
1 vote
1 answer
113 views

join() is not working

I am trying to show data of order/sales by country into admin grid, so I am joining two tables sales_order_grid and sales_order_address in my Collection.php Here is my code use Magento\Framework\...
Sagar Parikh's user avatar
1 vote
2 answers
3k views

join tables for get payment method of order id

I need to join 3 tables to get payment method of specific order id Let me explain my query. I have to load a custom_id and take saved order id from my table 'custom_data'. Now I want to find which ...
roine's user avatar
  • 11
1 vote
1 answer
773 views

Magento-2 : How to set admin form data by join tables

I have a custom admin module which store customer related data. My custom table created foreign key with customer_id. I displayed customer name, email in my module grid by join query, It's working ...
Suresh Chikani's user avatar
1 vote
1 answer
1k views

Magento 1.9.x - I want to join first name and last name in customer grid

I want to get fullname of customers in magento back-end server. I already brought the first name in index "NAME" and i want to join the lastname after first name. protected function ...
3CE's user avatar
  • 594
1 vote
1 answer
1k views

Joining two collection / tables

I have situation I want to join two tables having some data related to orders.One table contain order id as increment_id and other table contain order id as order_id.I am joining the tables through ...
Vivek Khandelwal's user avatar
1 vote
1 answer
659 views

How to add columns to customer address grid in admin?

I have to add two fields to the customer's address grid, for this I have to add a left join to the Magento collection. I have created the following custom module: Vendor/Module/registration.php <?...
Noty's user avatar
  • 76
1 vote
1 answer
69 views

How to join tables and retrive data

I want to join entity_id column from customer_entity table with customer_id from new_info table and want to get department column value of given customer.
Akash Killedar's user avatar
1 vote
1 answer
811 views

Magento 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

I am getting the Error: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous SELECT `main_table`.*, CONCAT(soa.firstname,' ', soa.lastname,'', soa.street,'', soa....
Mastafis's user avatar
  • 187
1 vote
2 answers
1k views

Joining Products Table with Custom Module Table (Adding Product Thumbnails to Custom Grid)

I created a custom module with a grid and needed to display product thumbnail images there. Tried codes from the answer below and the thumbnails were added, BUT ALL MY OTHER COLUMNS IN THE GRID ARE ...
bestwebdevs's user avatar
1 vote
1 answer
316 views

How to join three tables for filteration?

I am applying filter on order collection. I am stuck in a situation, I have added a custom attribute to "customer address". that is in table "customer_address_entity_varchar", now I have to join ...
Abdul Ghaffar's user avatar
1 vote
0 answers
425 views

Magento 2 Custom grid join with product table filter is not working

I've created a custom grid using Ui Component, In my custom table I have a product_id, So instead of showing the product_id, I like to show the product name in my grid so that I have added the below ...
senthil's user avatar
  • 1,707
1 vote
0 answers
273 views

Magento 2 : Join customer collection with custom collection

\Block\Account\Message\Message.php public function getAffiliateCustomerCollection() { $customerId = $this->customerSession->getCustomer()->getId(); $...
ashanr's user avatar
  • 115
1 vote
0 answers
100 views

Magento 2: join 2 table join issue

When 'm trying to join two tables in Magento 2, I get an empty result. This is the initial function that returns data from single table customer_entity without any error. \Block\Account\Message\...
ashanr's user avatar
  • 115
1 vote
1 answer
2k views

Magento 2: How to join product collection to custom table?

example: i have a table "table_1" i want to join product collection to get the product data? but I don't know how to join product collection? so everybody can help me pls? List item
NewBie's user avatar
  • 365
1 vote
1 answer
484 views

How to add product attribute value in custom collection?

I have a custom table which contains product id, I want to add an extra attribute column. so how can I get dropdown attribute value of the product in my custom table? if the dropdown attribute is not ...
user avatar
1 vote
1 answer
604 views

M2.1.9 - How to add company column from `sales_order_address` into Sales/Order grid when it comes to joining tables

I was trying to add company column from sales_order_address into Sales/Order grid when it comes to joining tables. But it doesn't work well. Could you review my code? And i referred to this post : How ...
3CE's user avatar
  • 594
1 vote
0 answers
419 views

how to join Query for particular customer group and custom customer_entity_varchar attribute?

Here in my collection -> Table structure is : 1,id, mydb,table_name,INT UNSIGNED,,10,3,0 2,userid, mydb,table_name,INT UNSIGNED,,10,5,0 3,transctionid, mydb,table_name,...
supriya mishra's user avatar
1 vote
0 answers
748 views

Magento 2 : Get Data From Two Tables or Model

I have created ui component and it works fine, I added data provider file and customized my getData function:- public function getData() { if (!$this->getCollection()->isLoaded()) { ...
arushi's user avatar
  • 790
1 vote
0 answers
353 views

Magento customer left join not returning all column from customer table [closed]

I wrote the join query with customer table, its only returning both table matched values only,instead of returning all the left table rows. The Query: $collection = Mage::getModel('customer/customer'...
senthil's user avatar
  • 1,707
0 votes
1 answer
280 views

Magento 2: What's best way to convert MySql to Magento

I've below MySql query, I would like to change use it in Magento format. How can i do that ? SELECT customer_entity_varchar.value, customer_entity_text.value from customer_entity INNER JOIN ...
anonymous's user avatar
  • 3,724
0 votes
1 answer
55 views

Magento 2.3.4 Custom uiComponent admin form joint table Add New gives ambiguous query

Collection: protected function _initSelect() { parent::_initSelect(); $this->getSelect()->joinLeft( ['secondTable' => $this->getTable('...
Juliano Vargas's user avatar
0 votes
1 answer
1k views

Magento2 use Multiple LIKE operator in Join Query

I have used Join query,in which i'm able to fetch only one row by below query where $productId = 10 $collection->getSelect()->where('paproduct.product_id = (?)', $productId); I want to use ...
Ketan Borada's user avatar
  • 2,593