Questions tagged [join]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
17 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
0answers
22 views

Magento 2 joinField custom $bind?

Summary I joined a field with the joinField function like this: $_productCollection->joinField('qty_new', 'cataloginventory_stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', '...
0
votes
0answers
23 views

Join stock to product list collection

How and where i can join stock information (Qty) to product collection in product list. In catalog layer or somewere else? I try to <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
0
votes
1answer
37 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" => "...
0
votes
0answers
35 views

How to join directory_country_region and directory_country_region_name tables in magento2?

I have created an admin grid. In resource model using a table name, directory_country_region and data display in grid columns. I have a created column locale. Locale filed in another table ...
2
votes
2answers
343 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
29 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
93 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
737 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
976 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
50 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
372 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
360 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
139 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
1k 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
590 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
108 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
619 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
694 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
368 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 `...
6
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
546 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`...
2
votes
0answers
749 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
2k 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
403 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
477 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
3k 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
471 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
22 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
848 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
397 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
208 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
102 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
484 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
570 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
675 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
458 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
4k 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
422 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
148 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
673 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 \...