Questions tagged [query]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

Magento 2 addFieldToFilter check for NULL not working

What i am doing ->addFieldToFilter('value', array(['eq' => '', array('isnull' => true)])) What i want in the query - '((value = '' )is NULL)` Can anyone help me on this Thanks.
0
votes
1answer
22 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
20 views

Most bough items block porto theme: addition of a stock check

A client is using Magento 2.1.3 with the Porto theme. The homepage of that site has a div which has tabs of different categories with the most bought items. Per category it loads a block in the ...
0
votes
0answers
20 views

How do I get the value of a property in my product on my phtml file?

Im looking at my theme/Magento_Catalog/templates/product/price/final_price.phtml and I am trying to set up a conditional so that when a custom field that another developer built in as a dropdown is ==...
0
votes
0answers
18 views

Magento 2 usage of UNION in a custom query?

I am working on a module to remove images of all deleted products, which is not the standard M2 behavior. My initial query to found images path still used by products was : $connection = $this->...
0
votes
0answers
21 views

Slow Query in Magento 1.9?

My Slow query log will print this query recursively: SELECT `e`.*, IF(at_name.value_id > 0, at_name.value, at_name_default.value) AS `name`, IF(at_is_active.value_id > 0, at_is_active.value, ...
1
vote
0answers
20 views

Single product page have slow loading

When I open the single product URL (open product). I wait 8 seconds or more for the page to load. Responsible for this behavior is the amount of queries that magento is performing. For this I enabled ...
0
votes
2answers
42 views

check visibilty of specific product

I want to select a value for status or visibility on a specific product for which I have only the sku. I have tried many ways but did not arrive a a solution to the problem. Anyone can help me, ...
0
votes
0answers
30 views

Get products within certain period with limit in sql query Magento 2

I am trying to SQL query (not Magento collection) to get at most 5 products day-wise which lie under my SQL date comparison check . $sql = "SELECT `*` FROM `sales_bestsellers_aggregated_daily` AS `...
0
votes
2answers
44 views

URL Query parameters are being lost

I am having a strange issue with my product filter (layered navigation) not working, I have narrowed this down to the URL paramaters being lost because of a 301 redirect. If I go to the URL... http://...
0
votes
0answers
25 views

Assoicated Products relation with Main Products, SQL Query

Our magento store products have three drop downs like color, size & weight. The price of main product changes when we select from size or weight etc. Stuck to run a query to get assoicated ...
1
vote
2answers
42 views

Magento 2: SQL get orders with specific option id

I'm trying to get all orders with a specific option id to see what percentage of orders are ordered with measurement of centimeters. Not very good with database queries and I can't seem to figure it ...
0
votes
1answer
85 views

Magento 2 Reset Modify FROM select query

How can one modify the FROM in select query without losing the left joins innerJoin etc... ? as I have tried: $collection->getSelect()->reset(\Zend_Db_Select::FROM)->from('table_2') but then ...
0
votes
0answers
61 views

Slow Query in Magento 1.9

I have continuously found below query in my slow query log, It seems the query is used for the site navigation. It has done the re-indexing and flush the cache but still the same. Here is the query: ...
0
votes
0answers
89 views

Magento 2 Query to get Product with SKU also

I'm using an extension called M-Connect Autocomplete Search, I'm facing a problem that when user tries to search product by SKU like 3-SC, 3-SC-10, 3-SC-BL, 3-SC-BL-C but can't get any result, maybe ...
1
vote
1answer
69 views

Explanation about getSelect() join() joinLeft()

I don't understand these functions of Magento 1: getSelect() join() joinLeft() Where can I find a complete doc with all functions documentation ? Thanks..
1
vote
0answers
32 views

Magento 2 : Which SQL query will be executed in attributes clean console command?

Does any one know which sql query will be executed while running below console command? $ php bin/magento catalog:product:attributes:cleanup
1
vote
2answers
66 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('...
2
votes
0answers
49 views

Magento 2.1.10: Sort by Special Price doesn't working

I'm working on category page, and try to sort the products collection by Special Price. I've override setCollection() of \Magento\Catalog\Block\Product\ProductList\Toolbar And the result is the only ...
2
votes
2answers
357 views

Magento 2: Allow empty query field in search

On the webshop that I'm working on, the user can find products by choosing filters (attributes like color/size/category) and/or entering a search query, the search results are then displayed on the ...
1
vote
1answer
36 views

How to solve warning “fetchAll can be memory inefficient for large data sets” in magento2

I am getting a warning as "fetch All can be memory inefficient for large data sets", When I did MEQP2. Please anyone can help me to resolve this warning. I am getting a warning in below line $...
0
votes
2answers
98 views

How to resolve the “Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento 2”?

I am getting warning as "Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento2" when I did MEQP2. Please anyone can help me to resolve this warning. I am getting ...
0
votes
1answer
31 views

Why magento2 outputs the query while showing data from ResourceModel collection Factory..?

protected $productCollectionFactory; public function __construct( ..... \Custom\MyModule\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, ... ) { ...
1
vote
1answer
29 views

Update sales order immediately after inserted

I want to update the sales order right after it is inserted. I want to reflect the change on the sales order conformation email also which is going to the customer. So i have prepared the below code ...
0
votes
0answers
26 views

Magento 2.2.3 order listing page too slow in admin

I am using Magento 2.2.3 it is in production mode. The order listing page in admin loads very slow. I have been facing this issue since long. To debug this I have also tried enabling query log ...
1
vote
1answer
40 views

Magento 2 Custom Filters

Dear Magento 2 developers, I am currently new in the Magento 2 development, now I struggle about how to make custom Product filter on the sidebar, like the picture below. My new brand column in ...
0
votes
0answers
188 views

Category page take too much time to load because of search_tmp_* table

my sites category page slows down because firing query for search_tmp_* table take more than 1 second and it runs saveral time on one page load here is the query : 7624 ## QUERY SQL: INSERT INTO ...
0
votes
0answers
32 views

Why product collection query not showing “color” attribute in select?

Case 1: $collection = $this->product->getCollection() ->addAttributeToSelect('color'); echo $collection->getSelect()->__toString(); Output: SELECT `e`.* FROM `...
0
votes
0answers
134 views

Magento 2.3: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

I'm very new to magento 2.3, I'm facing some error maybe from DB side.... Here is my code: /app/code/EC/Customimport/Controller/Adminhtml/Index/Import.php <?php namespace EC\Customimport\...
1
vote
3answers
598 views

Quote id is empty when inserting multiple records into cart in magento2

I am adding product to cart from ajax by passing product id Here is my controller code. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\...
1
vote
0answers
193 views

Magento 2 - Query Builder

I need to create a query with searchCriteriaBuilder with this condition: WHERE visibility = [value] AND status = [value] AND ((category_id = [value] AND designer = [value]) OR (category_id = [value]))...
1
vote
1answer
36 views

Magento 2 add query string to url when redirect to 404 page

Magento 2 custom module i am trying to add query param https://test.com/index?id=L_FRR3039-ODKLWG-GP4QPY if i give above format getting 404 page not found https://test.com/index?id=L_FRR3039 it ...
1
vote
1answer
1k views

SQL Query for custom attribute

I have create custom attribute in product upc I want custom query (sql) to get SKUs and UPCs Can anyone tell me the related tables from where I can get data, or if anyone can share query that would ...
1
vote
1answer
22 views

magento 1 query generated back tics are wrongly placed

I have an issue in Magento 1, where the SQL query that is getting generated has the back tics wrongly placed. This is a piece of the code that helps to provide the collection to the grid layout. ...
2
votes
2answers
338 views

Magento 2 query url rewrite

If I have URL like this - mainpage.com/products?test_category=99 and want it to be rewritten to this mainpage.com/testproducts Since magento2 URL rewrite won't take query how can this be ...
0
votes
2answers
78 views

Pulling credit memo from database using MySQL query

I'm trying to pull a credit memo from the directly from the database but i keep getting the below error ERROR: You have an error in your SQL syntax; check the manual that corresponds to your ...
0
votes
1answer
153 views

how to enable disabled products via query?

Hi I want to enable all products I have in my Magento 2 store, is there any query to enable all products we have using a single sql query ? Thanks
0
votes
0answers
93 views

Magento 2 Query in custom model file not working

I am working on the Magento 2 custom model file, my table name is custom_log, then I have created the following model file in my module directory. Test/Customlog/Model/Log.php namespace Test\...
0
votes
1answer
38 views

Fetch all the students on the basis of ascending marks

This query fetches all the student name and there ids on basis of topics but i want to get these result on basis of ascending marks ... i.e select student_name and ids where student_topic = topic but ...
1
vote
1answer
51 views

Calculating average price of specific products over time

I'm trying to create a graph that will show the average price of specific products on my site over a period of time. What I'm struggling with is coming up with the most efficient query to use, in ...
2
votes
1answer
100 views

How to get the orders above the order id and How to use the limit in magento 2

I need to write code to get next 10 orders above the given order id. <?php namespace Learning\GreetingMessage\Controller\Index; use Magento\Framework\Controller\ResultFactory; use Magento\...
6
votes
2answers
904 views

SQL query kills entire server

I caught the following query via mysql's SHOW FULL PROCESSLIST; which was eating the whole CPU / RAM on my server (32GB Ram, i7 hexacore CPU) rendering the entire server unusable for more than 3 hours....
-1
votes
2answers
291 views

Magento 1 Update/append product categories in database

I want mysql query for append or add new category ID to exsting product categories.
2
votes
1answer
361 views

Magento 2.2.5: how to query in observer best practice

I'm looking for best practice on how to query to database in observer. Ok so this is the idea, i use observer to catch event catalog_product_save_after (which will be fired after product is saved in ...
2
votes
2answers
551 views

Magento2 Query Param Binding

->having( 'COUNT(*) ' . '<= 3 ' ) Hardcoded value 3 need to come From: This is the query to return most viewed products biggest views number: SELECT COUNT(report_event.object_id)...
1
vote
1answer
141 views

The PurposeOfShipmentType is null, empty or invalid. please give me ans how to solve this?

2018-09-12T11:10:10+00:00 DEBUG (7): Array ( [request] => Array ( [WebAuthenticationDetail] => Array ( [UserCredential] => Array ...
0
votes
1answer
28 views

is reference block inside reference block is a good thing or bad?

Before anything, I already searched this online and didn't find anything satisfactory. I was working on a project where I had to add an extra column in order items section of every place. Everything ...
1
vote
2answers
284 views

How i can call SQL statement directly with magento 2

how to call SQL statements directly to database with Magento 2, This is not recommended, but in some situation we need to do this, for some very special tasks
1
vote
0answers
197 views

Magento 2 query builder conditional order by

I have this query builder, which works fine. $collection->getSelect()->joinLeft( 'sales_order_item', 'e.entity_id = sales_order_item.product_id', array('qty_ordered'=>'SUM(...
0
votes
3answers
385 views

Magento 2. What is the role of the search_query table

Magento 2. What is the role of the search_query table? Where is it used? Should I ever clear it? What would be the impact of clearing it?

1 2 3 4 5