Questions tagged [query]
Denotes the question related to database SQL query( in context of magento ).
299
questions
0
votes
1
answer
29
views
How to get products results even its visibility is search in magento graphql
Based on visibility,filter the product in magento 2.
The SKU 111324 having the visibility value is "Search".
Using below graphQL query
Query
query {
products(
filter: {
sku: { eq:...
0
votes
0
answers
86
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 ...
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 ...
0
votes
1
answer
304
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,''), ...
1
vote
1
answer
364
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 ...
0
votes
1
answer
90
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.
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?
0
votes
2
answers
238
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
*
*...
1
vote
0
answers
102
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?
0
votes
1
answer
272
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()-&...
0
votes
1
answer
85
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 ...
2
votes
2
answers
164
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 ...
2
votes
1
answer
1k
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\...
2
votes
1
answer
457
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 ...
1
vote
0
answers
159
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 ...
1
vote
1
answer
877
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
...
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 ...
0
votes
1
answer
1k
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/%";
=============...
0
votes
1
answer
121
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 ...
0
votes
1
answer
66
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
$...
0
votes
1
answer
174
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? ...
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 ?
1
vote
2
answers
5k
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.
3
votes
2
answers
8k
views
Magento 2 How to create graphql query
How to create custom graphql query in custom module in magento 2.
THANKS.
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
$...
0
votes
1
answer
324
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 ...
1
vote
0
answers
57
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 ...
0
votes
2
answers
322
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?
0
votes
1
answer
652
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/...
0
votes
2
answers
158
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?
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 &...
0
votes
1
answer
86
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 ...
0
votes
1
answer
206
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 ...
0
votes
1
answer
435
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 ...
0
votes
2
answers
316
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 `...
1
vote
1
answer
128
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()->...
0
votes
1
answer
459
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()
{
...
0
votes
1
answer
188
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 ...
0
votes
3
answers
311
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 = \...
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-...
0
votes
1
answer
136
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="...
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>/<...
0
votes
1
answer
78
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 ...
0
votes
2
answers
206
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 ...
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 ...
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")...
0
votes
0
answers
772
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 ...
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 ...
0
votes
0
answers
121
views
Make last image in galary Base, Small and Thumbnail query - Magento 2.3.5
The following sql query changes the Base, Small and Thumbnail to the first image.
We want to use something like this query, but then select the last image in position and make that Base, Small and ...
1
vote
1
answer
26
views
How to Wirte OR/and Query in magento2.?
SELECT main_table.sku, main_table.order_id, main_table.parent_item_id, main_table.name, main_table.product_id FROM sales_order_item AS main_table
WHERE (order_id = '3')
AND (parent_item_id IS NULL)
...