Questions tagged [join]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Why does filtering on a grid based on a joined collections lead to integrity constraint violation due to ambiguous column even after aliasing?

I am trying to render an additional 'Role' column on an existing grid based on the admin/user table. I need to join with with admin/role table twice to get the role owing to the hierarchical design w....
0
votes
0answers
11 views

Collection join to diffrent databases table

My Magento project has 2 connetions: default,whmanager. $joinConditions = 'main_table.product_id = catalog_product_entity.entity_id'; $collection->getSelect()->join( ['...
0
votes
0answers
19 views

Filter and sorting not working in custom culumn in upsell_product_listing.xml

I have joined column qty to Magento\Catalog\Model\ResourceModel\Product\Collection But Sorting filter by qty not working and sorting too in upsell_product_listing /app/code/Vendor/UpsellProducts/etc/...
1
vote
0answers
18 views

How to use “CASE WHEN” on select join magento 2

I try to get shipping postcode, shipping city, billing postcode, billing city of order, join to table sales_order_address, but i can't use "CASE WHEN" on Join. Can someone help me, please. ...
0
votes
1answer
61 views

How to compare value inside array in magento 2 join query?

$this->getSelect()->join( ["address" => "sales_order_address"], 'main_table.entity_id = address.parent_id AND address.address_type = "shipping"', array('region') )->joinLeft( ["so" => "...
2
votes
2answers
531 views

Magento 2 - the grid columns are empty after joining table

I have two tables: A & B . I want to display two columns from table B in my grid. The column names are: Price (See img) and Status(which is missing from the img, but it's there :) ). In my ...
1
vote
0answers
35 views

Join attribute lable in product collection

I'm creating one grid which will have to below columns like SKU,Name and Color (Attribute) So to achieve this We've to join color data to collection for that I've added _initSelect to collection ...
1
vote
2answers
117 views

magento2 join query

I want to join the main table code with the product_options value giftcard_created_codes My query till now $this->getSelect()->joinLeft(['secondTable' => $this->getTable('...
3
votes
2answers
1k views

Magento 2 - How use join between sales_order and sales_order_item table

How to use Join in Magento2. i want to get customer_firstname from sales_order table and price , qty_ordered columns from sales_order_item table where sales_order.entity_id=sales_order_item.order_id ...
0
votes
1answer
2k views

How to join Sales order collection and order item collection

I want to join the sales order collection and sales order item collection How to join the two collection I have collections like order collection > $ordercollection=$this->orderCollection-...
3
votes
0answers
52 views

How to join multiple repositories

Suppose if I want to join product repository and orderItem repository, then how can do that? There is way to join multiple collections (methods like join, joinRight, joinLeft, ...), how to do same ...
1
vote
1answer
489 views

How to get collection from two tables and show in Admin grid using Union query Magento2.2.5?

I want to show two table values in Admin grid using UI Component (which has no relation) so using union query it can be achieved. How to get the collection from two tables? Table structure 1 Table ...
0
votes
1answer
506 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 ...
1
vote
0answers
149 views

get join table's all rows with collection magento2

I am fetching a collection (of user table), that is retrieving correctly. Now I have one more table (ex.- address) that has multiple row related collection table primary key. I want to fetch them all ...
0
votes
1answer
2k views

Magento 2 Join table customer entity and customer address entity

I am trying to join customer entity table and customer address entity table. I am getting error in below code. What could be the issue $agency_name=$customerData->getDefaultShippingAddress(...
0
votes
2answers
638 views

Magento 1.9 : How to combine two collection data?

I have two different collection one is of order payment transaction and other one is of sales order as show below: $transactionData=Mage::getModel('sales/order_payment_transaction')->getCollection(...
0
votes
1answer
133 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 ...
0
votes
1answer
668 views

Left join order grid collection using observer method. Magento 1.9

I'm trying to add a grid to order listing table following this awesome blog which works if all code copied but I'm unable to customize it. And I want to show the data from my custom table. I've ...
0
votes
1answer
793 views

Left join on custom collection, to get product name by product ID

There's a collection which contains product ids. I'd like to join it with the magento table that stores paroduct names, in order to add product name to collection. $collection = Mage::getModel("...
0
votes
1answer
411 views

After join, use the result join again in Magento2

For example, I create a table which has product sku, I use the table LEFT JOIN `catalog_product_entity` table to get the entity_id, then want to use the entity_id result to LEFT JOIN `...
7
votes
1answer
3k views

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

I have added a new column in customer grid using the following: app/code/Company/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1answer
1k views

Join eav attributes

Im trying to join attributes in my collection on my grid view of "supply needs" from my ERP (Erp boost my shop) The collection is loaded like this: $collection = Mage::getModel('Purchase/SupplyNeeds'...
2
votes
0answers
637 views

SQL UPDATE with JOIN

Knowing I want Magento assemble and execute the following query : UPDATE `catalog_product_entity_media_gallery_value` AS `tGV` INNER JOIN `catalog_product_entity_media_gallery` AS `tG` ON `tG`...
3
votes
1answer
833 views

How to sort products by bestsellers (e.g. by sales) in Magento 2

these days I've faced a problem: I needed to to sort products by sales. So, first of all I decided to add this field to collection of products and the order it using method $collection->setOrder(). ...
1
vote
1answer
3k views

Need help with collection joinField() - Magento 2

Can anyone describe how to use joinField() method of collection (Magento\Eav\Model\Entity\Collection\AbstractCollection). I actually don't know what means each argument: public function joinField($...
1
vote
0answers
262 views

Magento 2 Join two table and dispaly value in grid

public function addCustomerData($filter = null) { $customersSelect = $this->customerResource->getConnection()->select(); $customersSelect->from( ['customer' ...
0
votes
0answers
422 views

Magento 2; joinLeft() not working

I have this code to join status to the order item collection: $orderItems = $this->orderItemCollection->addFieldToSelect( array('item_id','order_id', 'created_at', 'updated_at','...
0
votes
1answer
517 views

Remove the single quotes from join

I have this magento code : $subquery = new \Zend_Db_Expr('SELECT DISTINCT value from catalog_product_entity_int where row_id in (select row_id from catalog_product_entity_int where attribute_id = 97 ...
2
votes
2answers
4k views

Nested/subquery select in a join query

I have this working SQL query : select prd_brand.* from prd_brand inner join ( select distinct value from catalog_product_entity_int where rowid in (select rowid from ...
3
votes
1answer
494 views

How to convert raw PHP Join Query into Magento Join Query

How to convert raw php LEFT JOIN query in to magento query? What is Magentos syntax for? Here is my query: SELECT fieldsmanager_orders.value,sales_flat_order_address.entity_id FROM ...
1
vote
1answer
24 views

I’m looking for a way to find all orders that the “bill to” and “ship to” are different states and the dollar amounts associated with those orders

I know that I could check in the sales flat tables. I would probably have to look into sales_flat_order and sales_flat_order_address and do a SQL join. Additionally, the entity_id would be the ...
0
votes
1answer
926 views

How i can join eav_attribute_option_value table into my collection and get from him “frontend_label” of colors?

I have a products collections. But in "color" i see option_id number. Mage::getModel('catalog/product') ->getCollection() ->addStoreFilter(Mage::app()->...
0
votes
1answer
409 views

Sorting Collection after joinField not working

I have a collection of products which I filter and show out of stock items only and it works fine. This is what I have: $collection = Mage::getResourceModel('reports/product_collection') ->...
1
vote
1answer
209 views

Fatal error on `prepareColumns` method

Getting fatal error on Item (Mage_Catalog_Model_Product) with the same id "223" already exist Here 223 is my product Id My _prepareCollection() Method protected function _prepareCollection() { ...
1
vote
1answer
107 views

How to use collections or joins in Magento 2

I'm trying to filter by order_item to get a list of orders. Get all orders where an order item has a price greater than 5. How would this be done? Collections? Joins?
5
votes
2answers
2k views

Join 3 tables in Magento 2

I am new to magento 2, And want to join 4 tables. TABLE 1) market_p_userdata (columns -> seller_id, image) TABLE 2) market_product (columns -> seller_id, magepro_id) TABLE 3) ...
1
vote
0answers
487 views

How to get parent product collection from child product collection

I have a simple product collection and I want to get a collection of parent products from the child product collection. $child_collection = Mage::getResourceModel('catalog/product_collection') -&...
2
votes
1answer
1k views

How to use a subquery while performing left join in magento

I want my query to filter only distinct product_id from the table catalog_category_product . The raw sql query goes like this : SELECT * FROM catalog_category_entity AS catalog_category_table LEFT ...
0
votes
2answers
576 views

JoinField Show error same id is already exists

We want to change below line: ->joinField('store_credit','kartparadigm_storecredit_creditinfo','total_credits', 'c_id=entity_id', null, 'left'); with this one: ->joinField('store_credit','...
2
votes
1answer
687 views

Foreach loop taking long time in magento product collection with limit

I have following code in which I have join product collection with sales order item table. this query takes fraction of a seconds to execute but foreach loop after that takes around half minute while ...
3
votes
1answer
3k views

Custom admin grid filter - error when searching joined column

I have a custom grid with columns created by joining a flat table to the customer collection. Everything works fine except when i try to filter the list using any of the column added from the flat ...
0
votes
1answer
467 views

How to convert mysql query in magento collection

this is my mysql query . I want to convert in magento collection. reference link https://stackoverflow.com/questions/34253461/repeat-a-result-row-multiple-times-by-value-in-row select Item , ...
0
votes
2answers
5k views

I am getting an error General error: 1111 Invalid use of group function. What am I doing wrong?

I have this code $orderModel = Mage::getModel('sales/order'); $ordercollection = $orderModel->getCollection() ->setPageSize(20) ->setCurPage(1) ->join(array('...
3
votes
2answers
5k views

How to join a table with a Magento 2 repository

I am trying to extend inventory stock items by joining my own table with added information. When the product page is loaded it gets the stock item via StockItemRepository::getList($criteria). So I ...
1
vote
1answer
1k views

Determine if collection has an attribute in the select

I want to join a custom field to a product collection, and the field I'm using to join it on is a custom attribute. My observer method is currently doing this: # Event: global/...
0
votes
1answer
444 views

How to LEFT-JOIN 'catalog/category' fields to 'sales/order_item' collection?

I'm trying to left-join some of the 'catalog/category' attributes to a 'sales/order_item' collection. For example: a satisfying result will let me add the category-name to the order-item data. *I ...
6
votes
1answer
1k views

Order by joined custom table

I've got a productcollection, which i joined a custom table to. I'd now like to order the collection on the custom joined table row "custom_row_value". I've tried the below method, but this does not ...
1
vote
1answer
164 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 ...
5
votes
1answer
6k views

Understanding setSelect()->join Need to join two custom collections

I am confused understanding the correct usage of $collection->getSelect()->join(... to bring two custom model resources together. I tried following other examples using the getSelect method. I ...
0
votes
1answer
754 views

Unrecognized method 'isLoaded()' in Magento 2

I'm trying to join product and my custom table but it's returning error Unrecognized method 'isLoaded()' my code is: /** * @param \Magento\Backend\Block\Template\Context $context * @param \...