Questions tagged [database]

Questions related to Magento's MySQL database, for example, the table schema, plain SQL queries or database configuration. For questions about the Magento database access layer, use other tags, like: eav, model, resource-model, collections, install-script. For questions about SQL queries in particular, the SQL tag is appropriate too.

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

Magento : How to Implement Automatic Related Products and Category Based Upsell Products

We have 5000 products at our webstore. We can not use magento default feature related products & upsell, cross-sell products. Is there any customize code or modules which can implement to display ...
25
votes
4answers
26k views

Why and when to use “ Flat Catalog”?

While doing bit research for speed issue of magento website i got some links where people says enable "Flat Catalog" to increase performance and speed . Issue is that why it is not enabled by default ...
1
vote
0answers
17 views

How to add several input fields per entry - admin form in Magento2? [closed]

I want to be able to edit one poll and it's answers in one admin form, and have one input field per answer. I already have my collections ready, how can I create a working admin form ? POLLS TABLE ...
5
votes
2answers
791 views

Magento MySQL Engine choice

Some of the tables in the Magento 2.1 DB have "MEMORY" as their engine. This is a problem for the DB cluster we are using (Percona-XtraDB-Cluster with pxc_strict_mode = ENFORCING). Can I change the ...
0
votes
1answer
26 views

how to switch between mariadb and mysql

my magento2 is reading mariadb server and database is connected to that, I am trying o use mysql instead but I had no luck, it does not recognize the database at all although I have added the ...
0
votes
0answers
27 views

Missing group price after migration M2

After migration From Magento1 to Magento2 Group Product Price Missing I have followed below step Not solve this issue plz help me Step 1 Run query in M1 DB and download resule csv file (without ...
1
vote
0answers
23 views

Joined tables in admin form

I have two tables, one for a list of poll questions and another for the answers to a specific poll. I want to be able to display the list of questions in a grid, then save the question and the answers ...
1
vote
3answers
62 views

Migration in live server

here I am again seeking for help. I've been stuck for 2 days working about this. when I'm working on localhost my website is working. Well, after migration from localhost to my web server it gives ...
0
votes
1answer
20 views

When trying to upgrade I encounter the error “Cannot process definition to array for type time”

I'm getting the following error on Magento 2.3.2 when executing command: php bin/magento setup:upgrade Cannot process definition to array for type time I'm aware that this is usually caused by a ...
1
vote
1answer
39 views

What tables contain customers + products information?

after a data migration problem (please check language translation and migration if interested on issue) I thought on alternatives. a) Export csv with products + clients and reimport on clean install. ...
1
vote
1answer
16 views

how to change default sort by price to custom attribute like gtin in magento 2

i have already tried to make the chanage of sort by price to custom attribute in admin store configuration but still the products are sorting by price in magento 2
0
votes
0answers
17 views

Wrong with processing the default view and we have restored the filter to its original state

Anyone can help me regarding this issue? why this error is occurring in Magento 2.3.0. I transferred my website from localhost to live server, On the live server, I'm facing this issue in under ...
0
votes
1answer
25 views

How to get the values from different rows and same table in mageno2

I want to get filter_options(804) value based on the condition filter_ids=13 and filter_ids=7 and filter_options=575 for the same sku. How to do that. Thanks.
0
votes
2answers
680 views

Parse error: syntax error, unexpected '$servername' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST) php

I am trying to connect to a MySQL database usign PHP but am currently facing this error : Parse error: syntax error, unexpected '$servername' (T_VARIABLE), expecting function (T_FUNCTION) or const (...
0
votes
0answers
22 views

Database import Error in Migration Magento 1.9 Store

I am migrating a Magento 1.9 store to another hosting. While I am importing previous database to new phpmyadmin I am getting below error.
0
votes
0answers
17 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
17 views

Magento 1.9.2.2: Restore newsletter subscribers only from db backup

I managed to delete all my newsletter subscribers, but I have a magento db backup. Is it possible to restore the newsletter subscribers only (incl. all their info - password, registration date,...) ...
15
votes
4answers
23k views

How to list all disabled products with sql?

I need to list all disabled products by using a MySQL query. I have too many products in my database to be using something like this (creating a collection, loading it and looping over it): http://...
1
vote
2answers
1k views

Upgrade to 1.9.2.2 - Base table or view already exists: 1050 Table 'mage_permission_variable' already exists

I am trying to upgrade to 1.9.2.2 from 1.9.2.1 through Magento Downloader. On the little screen at the bottom I am getting the error message below: Exception during cache and session cleaning: ...
0
votes
0answers
24 views

Add Import Export functionality to my custom grid in Magento 1

I want to add Import and Export functionality for my custom grid records of my custom module. I had created a custom table in the database. I want to add Import and Export functionality using PHP code....
0
votes
0answers
27 views

Rebuild Customer grid index not working - Getting Error

anyone can help me about this issues, i'm getting this error. I'm trying to fix it, But i could not found any solution. {"0":"Notice: Undefined index: PK_CUSTOMER_ENTITY in /vendor/magento/module-...
0
votes
1answer
1k views

facing this issue contains 1 abstract method and must therefore be declared abstract or implement the remaining method

Facing fatal error given as below. Fatal error: Class Sugarcode\Test\Model\Total\Fee contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (...
2
votes
2answers
695 views

How do i insert line breaks in product description with a SQL query

How can I replace (\n) in SQL with a Line Breaks? i want to do it with a SQL query, I want in table: catalog_product_entity_text replace the value with Line Breaks instead of (\n)
0
votes
1answer
41 views

After migration from magento 1 to magento 2 customers giving eror

After migrating data from Magento 1 to Magento 2 When I click on customers in admin area it gives this error {"0":"Type Error occurred when creating object: Magento\Eav\Model\Entity\Attribute\...
0
votes
1answer
27 views

How to export orders by date via SQL?

I'm using a Magento 2.3 instance, how could I export my orders in a CSV file by date range via SQL? I want to have the shippingId, orderId and paymentId included in it.
3
votes
3answers
393 views

Magento 2 - Docker - Data not persisting

I'm currently running Magento 2 on Docker using docker-compose.yml here is the file: version: '3.0' services: web: image: alexcheng/magento2 container_name: magento2 ports: - "80:...
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
1answer
29 views

SQLSTATE[42000]: 1142 TRIGGER command denied for table 'catalog_product_index_price_replica',

Good Day I am very much a novice when it comes to this. I upgraded my store from Magento 2.2.8 to 2.3.3. All seemed initially to go without issues. However on reindexing i get the below error. ...
0
votes
2answers
742 views

Magento 1 custom Model, Can't get data from table

I created my own module, the table is created in the database and in a phtml I can call: $res = $model->getExample(); and effectively it function is called. In Model: protected function ...
0
votes
2answers
2k views

SQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in Magento

My website was running perfectly and then I started to receive this error continuously. I tried to find solution almost everywhere I could, but found nothing that could help. I even talked to the ...
4
votes
3answers
702 views

try to get all products by category id but get only enable products in magento2

How can i get all the products(including disable) programmatically? in Magento2. try to get all products by category id but got only enable status products. My code is : $category = $objectManager-&...
23
votes
4answers
48k views

How to add new column to existing table in Magento programmatically?

How can I add a new column to existing Magento core table via install script? (without using pure SQL) I want to use the Magento way which is using alias methods to create install script. So far I ...
11
votes
3answers
8k views

Magento2 InstallSchema add new column to existing table

I'm trying to add new column to existing table in magento2 <?php namespace Vendor\Module\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\...
1
vote
1answer
748 views

Magento 2 Migration : SQLSTATE[23000]: Integrity constraint violation: 1062

I followed http://devdocs.magento.com/guides/v2.0/migration/bk-migration-guide.html for migration. I am facing issue - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'customer-...
8
votes
2answers
1k views

enterprise_refresh_index Sleeping MySQL Connection

There are times that the indexer that is ran by cron seems to get stuck at the MySQL as Sleeping connections can be seen. Indexer runs for several hours and this actually not running at all. I've ...
1
vote
2answers
34 views

Magento 2:- Updating table value

I want to update the value of amount column in custom database table where customer_id with value of $total. $total = $array['amount'] - $arr['base_grand_total']; $sortedData = $prepaidModel->...
0
votes
1answer
25 views

I want to enable free shipping

I want to enable free shipping if some condition satisfies(programmatically). Which event should I use and how should my observer look like..? Kindly guide.
1
vote
0answers
18 views

Adding image and video file path to the custom table from the review frontend product view page

I have created a custom table for storing review_id (as foreign key),file_path and file_type(boolean 1 for image and 2 for video) as columns. i have to add the post values from the product review page ...
2
votes
1answer
2k views

Magento 2 Add extra data to an order

I'm brand new to Magento 2 programming, although I have a number of years of PHP behind me. I need to store an id from an external system alongside an order that that system creates. I've got the ...
0
votes
2answers
729 views

How to find and replace product title using sql query

I am having a magento store with English and Arabic language store view. I am having more than 5000 products(both simple & configuable products). All the products starts from Style now i want to ...
1
vote
1answer
620 views

Magento 2 Admin Front controller reached 100 router match iterations

Magento is relentless and notorious for error like this one I got on admin and with not an accurate fix for it. Is there anyone here came across this issue and why this happen out of the blue.
1
vote
5answers
1k views

How Many Tables Does Magento 2 Have?

Can You Please Tell Me How Many Tables Does Magento 2 Have? In MY Database Its Only showing 250. I was installing Magento 2. Its been stucked at 73% since last 20min! Module '...
0
votes
0answers
18 views

Magento 2 How to get all active shipping methods via mysql?

I need to be able to query from mysql these fields shipping_method_code shipping_carrier_code for a custom shipping method (ShipperHQ) I am trying to use from the REST Api. Thanks
0
votes
2answers
38 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
2answers
44 views

Magento 2 :- How to add product on CMS page

I want to add product url as button for product programmatically. After clicking it should process for purchasing process. I want to add it on CMS or any custom page.(exactly how we can add it through ...
3
votes
1answer
1k views

Magento 2 call table stock_item from database

I working to Magento 2.0.2 and i trying to call the table stock_item of the product. When i worked in Magento 1.9 i used this code: loadByProduct($_product)->getQty();?> But now the class Mage is ...
0
votes
1answer
671 views

Custom InstallSchema script for updated_at default column: as_defined

How to write the below using Install Scheme script . I want initially the updated_at to be 0000-00-00 00:00:00 CREATE TABLE IF NOT EXISTS `tgs_queue` ( `id` int(10) unsigned NOT NULL COMMENT 'ID', `...
6
votes
3answers
14k views

Order item custom options

In which table I can see ordered item's custom options and its chosen value. I can see a product_options column in table sales_flat_order_item, but not sure is it same as product's or item's custom ...
2
votes
2answers
1k views

Column not found: 1054 Unknown column 'at_status_default.value'

I'm actually kind of desperate.I tried many times to update my Community Edition from 2.2.1 to 2.2.5, always failing due to what I guess is a database inconsistency.After the update procedure - done ...
0
votes
1answer
29 views

Magento 2 Delete All Categories from Database

I want to delete all categories from the database so I can import new ones. I need to also delete the rewrites. I tried this code: SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE ...