Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [query]

Denotes the question related to database SQL query( in context of magento ).

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

magento 2.4 custom query bind values

on my magento I need to run a custom query to fix some data. I'm trying to write my queries using Magento standard way as much as possible. The code is pretty simple: first I check if there are any ...
Lou Nik's user avatar
  • 453
1 vote
0 answers
15 views

I have a custom search function that just started having a bit of an issue with caching (I'm assuming)

I'm not sure when it started not working or if it ever worked. Helping a friend out with their website. I'm going to assume it was working at some point. I looked in the logs while refreshing the page ...
Singleton's user avatar
0 votes
0 answers
38 views

How to sort products in Magento by new from date?

I wanted to sort products by new from date , please see the query but it is not working perfectly $collection->getSelect() ->joinLeft( ['catalog_product_entity_datetime' =>...
Mark's user avatar
  • 63
0 votes
0 answers
30 views

Getting this erorr You cannot define a correlation name 'news_from_date_table' more than once

When I am using above mentioned query then getting the error You cannot define a correlation name 'news_from_date_table' more than once $subquery = $collection->getConnection()->select() ...
Mark's user avatar
  • 63
0 votes
1 answer
209 views

Is it possible to get Country Name using Select Query in Magento 2 DB?

I am trying to get the list of customers from the database directly using Mysql Query. SELECT ce.email As Email, ce.firstname As Firstname, ce.lastname As Lastname, COALESCE(NULLIF(cae.country_id,''), ...
Chirag Prajapati's user avatar
1 vote
1 answer
302 views

magento 2 can anyone tell me how to get user permissions list from database . I need query for this .Please help me

Query to get user permissions list in magento2 Admin roles role_type table column I found related query in above link but permission column is missing . Permission column exists in authorization rule ...
sandhya S's user avatar
0 votes
1 answer
83 views

Magento 2 - Query to know the user who update the price of the product

I am very new to magento. What is the query to to know who was the user who updated the price of a product? I just want to know the query, not the code. Thanks in advance.
jsnewbie21's user avatar
0 votes
1 answer
39 views

What are the security risks associated with a Magento 2

What are the security risks associated with a Magento 2 website, and how can you mitigate them?
Noor Mohamed's user avatar
0 votes
2 answers
208 views

Magento 2 - Products in category page not showing

My problem is that : all products in category page not showing. And when i displayed the query of $_productColection in Magento_Catalog/templates/product/list.phtml : /** * Product list template * *...
Heri Rak's user avatar
1 vote
0 answers
89 views

Export products and additional attributes - SQL query for Magento 2

What would be the QUERY SQL to export the SKU columns and ADDITIONAL_ATTRIBUTES as shown in the product export module n Magento 2?
heroecall's user avatar
0 votes
1 answer
205 views

Add limit on collection of custom table and get one column value in Magento 2

I know there are solutions for getting one column as an array. $collection->getColumnValues('column_name'); And adding limit without setPageSize() and setCurPage() $collection->getSelect()-&...
Knight017's user avatar
  • 632
0 votes
1 answer
71 views

Display individual product video descriptions for multiple videos

I am trying to provide video transcripts for each product video in a magento 2 site. I want to pull the transcript from the "video description" field in the admin area, and I have been ...
kug3lblitz's user avatar
2 votes
2 answers
150 views

Slow Query on Magento 1.9 Front-End After Moving Site to a New Server

I've just moved a Magento 1.9 site using a tarball and a mysqldump of the old site to a new server having the same hardware specs as the old one, followed all instructions I could find online, saw ...
Reza Anwar's user avatar
2 votes
1 answer
902 views

Magento 2 - Best way to query data from tables (select with multiple joins)

I'm learning about Collections, Repositories and DTO, and I'm still trying to figure out what's the best way to query a table to fetch data. I also found that we can use \Magento\Framework\App\...
Douglas Vicentini's user avatar
2 votes
1 answer
357 views

Magento 2 Extremely high load on MySQL due to select query

I've seen similar questions asked on this site, but haven't seen a solution or fix to resolve the problem. Our site is spawning a large number of select queries to the point where mysql is overloaded ...
Mike C's user avatar
  • 21
1 vote
0 answers
147 views

Magento 2: How create ui grid filter for null values in specific column

I have a column "purchase_point" in my table. It has 3 values android, ios, and null. I need to display it in the ui grid. For the null value, I need to display 'web'. I am using the below ...
Alshihab's user avatar
  • 161
1 vote
1 answer
808 views

Magento 2 GraphQL Error: Undefined property: GraphQL\\Language\\AST\\FragmentSpreadNode::$selectionSet

I am working with magento 2.4.4-p1. I got an error on calling the below graphQL query on the site. query Route($url: String!) { route(url: $url) { redirect_code relative_url ...
Jancy Abraham's user avatar
1 vote
1 answer
1k views

Return custom db fields via graphql resolvers

I've added custom fields to sales_order Now I want to return them in customerOrders GraphQL query as a value from database. How can I do it without fetching the order from database again in Resolver ...
Herokiller's user avatar
0 votes
1 answer
908 views

How to find admin custom url in database core_config_data table using sql query in magento2

Run this command on SQLyog or other tools. Your Custom Url: http://localhost/magento2ProjectName/stage3fedex7id4w/ SELECT * FROM core_config_data WHERE PATH LIKE "%admin/url/%"; =============...
Vikram Dhande's user avatar
0 votes
1 answer
106 views

How to change filter "and" to "or"?

version : Magento 2.4 safira I want my website show every products related to filters I choose. If I choose multi filters, I only got products fulfilled all conditions. Is there any way I can edit ...
Ryung Kim's user avatar
0 votes
1 answer
63 views

how do I write a paremeterized delete query using json_extract?

I would like to write a query like delete from inventory_reservation where JSON_EXTRACT(metadata, '$.object_increment_id') = '<increment_id>' So I created my expression in my code like $...
gabtzi's user avatar
  • 666
0 votes
1 answer
159 views

How to log query for cart event?

I want to see the mysql query when adding a product to the cart. I have referred this link, How to log all Magento 2 SQL queries? but I need query only for cart. How to get the query for cart events? ...
MagentoDev's user avatar
0 votes
1 answer
2k views

MySQL query for list all the categories and its description from Magento 2 database?

How to get all the categories and its description from Magento 2 Database using MySQL Query ?
shankar boss's user avatar
  • 1,453
1 vote
2 answers
4k views

Magento 2 How to add custom product attribute into existing product graphql query

How to add custom product attribute into existing product graphql query in the custom module in Magento 2. THANKS.
Mohit Patel's user avatar
  • 3,833
3 votes
2 answers
7k views

Magento 2 How to create graphql query

How to create custom graphql query in custom module in magento 2. THANKS.
Mohit Patel's user avatar
  • 3,833
0 votes
3 answers
4k views

How to Print Raw SQL query of Magento 2 format?

I am trying to print the raw SQL query of the below statement in Magento2 but am not able to do it. please find the statement $connection = $this->getConnection(); // I am getting the connection $...
shankar boss's user avatar
  • 1,453
0 votes
1 answer
307 views

Does Magento execute a query to get the review count of each single product on the category listing page?

Let's say that your category page shows 36 products at a time and shows the rating/review count underneath each product title. Does Magento perform 36 queries to get each of the product's review ...
Timothy Fisher's user avatar
1 vote
0 answers
53 views

Executing direct query in Magento 2 issue

this is my code: $connection = $this->resourceConnection->getConnection(); $connection->query("SET @@group_concat_max_len = 1000000"); I have a query using a group concat. The ...
Attila Naghi's user avatar
  • 4,023
0 votes
2 answers
299 views

Strange search terms automatically added to Search Query table

Strange search terms appear in Last Search Terms and Top Search Terms which are from Search Query table. What can be the reason?
Reshad Zazai's user avatar
0 votes
1 answer
603 views

Get Latest Entry For Duplicate Rows In Collection

I currently have a logs table which has the following rows which use the same order_id: log_id order_id user action 2410 1001318004 test1 Declined 2409 1001318004 test1 Declined Inside my app/code/...
SNAFU's user avatar
  • 196
0 votes
2 answers
150 views

How to remove pending reviews directly in database

How can I remove all pending reviews in certain store view directly from database? What should I use as SQL query?
Webninja's user avatar
  • 1,593
0 votes
1 answer
1k views

Magento 2 : row id and entity id not same in catalog_product_entity table

Executed query - SELECT GROUP_CONCAT(parent_id SEPARATOR ',') AS parent_id FROM catalog_product_super_link AS super_link WHERE super_link.product_id = 914066 The issue is there are records where &...
devhs's user avatar
  • 507
0 votes
1 answer
83 views

MySQL Query of catalog_product_super_link filtered by attribute_set_id

I want to export all fields from the catalog_product_super_link table, but filtered to exclude any products that have have a certain attribute_set (31 in this case). This post (MySQL Query filtered by ...
JoeT's user avatar
  • 1
0 votes
1 answer
203 views

How to set the conditions for displaying of the related-products

Overriding related-product collection. My aim is to set limit for related product display. Related-products are not displayed if there are less than 10 products, the maximum number of products that ...
David's user avatar
  • 21
0 votes
1 answer
419 views

Cron job to delete catalog_product_entity_datetime table data, am I using the correct interface?

I have a query to select data from catalog_product_entity_datetime table. can I use below interface to grab the data from above table? If can't what should I do to grab data from this table? I don't ...
Paul Fan's user avatar
  • 658
0 votes
2 answers
308 views

how to optimize queries in magento 1.9 with lots of attributes (over 500)

I have a website running Magento 1.9 which is flooding mysql with slow queries like this SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS `e` INNER JOIN `...
gabtzi's user avatar
  • 666
1 vote
1 answer
125 views

Magento2 - How do I write below query function into non-deprecated? without using getCollection()

How do I write below function into non-deprecated? In Magento2. without using getCollection() public function getNewCustomer() { $customerData = $this->customerFactory->create()->...
Paul Fan's user avatar
  • 658
0 votes
1 answer
429 views

How do I change this sql query to Magento2 filter collection method?

I have below query SELECT * FROM newsletter_subscriber WHERE change_status_at >= (NOW() - INTERVAL 10 DAY); How do I make it works with below? public function getSubscriberStatus() { ...
Paul Fan's user avatar
  • 658
0 votes
1 answer
171 views

I have no idea why my Subscriber Collection Factory is not working

I have no idea why my Subscriber Collection Factory is not working. Below is my code. Wish someone can help me to fix my problem. I believe something wrong with my setup of CollectionFactory use ...
Paul Fan's user avatar
  • 658
0 votes
3 answers
297 views

I have below sql query, how do I turn this to Magento get data method to retrieve data?

I have below sql query, how do I turn this to Magento get data method (collection?) to retrieve data (not using ObjectManager)? Please help. public function getNewCustomer() { $objectManager = \...
Paul Fan's user avatar
  • 658
0 votes
4 answers
1k views

how to use date() in magento query?

I want to filter some orders based on the date range so in SQL i use this query SELECT * FROM `sales_order` WHERE date(created_at) >= '2020-12-02' AND (date( created_at) <= '2020-12-...
Friska Sianturi's user avatar
0 votes
1 answer
135 views

How to add media query for div alignment [closed]

My design, I need mobile view like, first block second block third block fourth block How to include media query? Script : <div class="container"> <div class="...
zus's user avatar
  • 165
1 vote
2 answers
2k views

Retrieve product url with category in the graphQL

I've enabled at backoffice the usage of the category inside the product url by setting this option: When I access the magento frontend, I can now access the product with the url <category>/<...
Pasquale's user avatar
  • 218
0 votes
1 answer
77 views

Change stock availability of products based on qty

I'm looking for a query to get all my products that have "qty > 2 and 'stock availability = 0'" and change the stock availability to 1. A crash on my inventory update routine did a mess ...
Ralf O's user avatar
  • 57
0 votes
2 answers
203 views

how do I change this sql query to magento get data method?

I have below sql query, how do I turn this to Magento get data method to retrieve data? Please help SELECT sales_order.increment_id, sales_order_payment.additional_information FROM sales_order LEFT ...
Paul Fan's user avatar
  • 658
0 votes
1 answer
1k views

How to change product status from sql using SKU

I need to disable and enable a huge quantity of products filtering by sku and the easiest solution seem to be through Sql query but i have some issues to find the right code For example i need to ...
Gianluca Giogli's user avatar
0 votes
1 answer
3k views

Using GraphQL query and filtering products by category_id, I get empty items array

I try to make a simple request using graphql and to get a response from my magento. I have a parent category named Products(id:"3"). In this one, there are 3 subcategories A(id:"5")...
Kostas Katsinaris's user avatar
0 votes
1 answer
332 views

How to get SQL query for product insert in Magento 2?

How to get SQL query for product insert in Magento 2 ? I have multiple products around 10 Lakhs so i want to insert it using SQL query. But how will i get the insert query of the product ? Any Help is ...
Prits's user avatar
  • 625
0 votes
0 answers
718 views

magento 2 change store id

I have a multi store Magento 2 site and I need to change the ID of one of the stores. Is there any easy way to do this? I tried to run an update query on the store table but I get and error because ...
Trevor Orr's user avatar
2 votes
1 answer
1k views

Base images as first image, change positions in bulk - Magento 2.3.5

We have a large catalog (125K products), with a lot of products where the base image is positioned somewhere in the middle of the gallery. The selection of base image itself is fine, this should be ...
JGeer's user avatar
  • 1,418

1
2 3 4 5
7