New answers tagged

0

A says that the attribute must exist in the database. C says that the attribute must be part of the product's attribute set.


2

To set the description, you just simply add below code: $childProduct->setDescription('your description here');


1

Collections will assemble the complete SQL query in _beforeLoad() method. This means you will get a partial query (or even an empty string) if you try to output the SQL query before loading the collection. To get the complete SQL query like the one executed in database, you will have to load the collection first (the load() method will execute the ...


0

Try following code: error_log($collection->getSelectSql(true));


0

Below are some main Magento2 MySQL Recommeded Configurations. Magento2 requires Above MySQL 5.6.x. Magento2 version 2.1.x and later are compatible with MySQL 5.7.x. Magento2 uses MySQL database triggers to improve database access during reindexing. If you expect to import large numbers of products into Magento, you can increase the value for ...


0

problem solve by my self may thanks :)


0

The product options are saved as JSON. With the MySQL version required by Magento 2, there seems to be no nice solution for this: You can filter using LIKE "%2010%" or some more sophisticated expression to emulate JSON processing As a second step you should json_decode the column within PHP to really check for the product_option in the JSON. That means 1. ...


0

I can give you an example SQL query to get the product data on basis of attribute_id. You can use this as per your requirement. //Product entity type ID SET @etype = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'); //Product ...


0

Please use Magmi to Bulk updating product prices in Magento 2. Magmi is import product data fast and direct on database. Download from URL:https://github.com/macopedia/magmi-m2/tree/82ae373630c5291fc72ce948935916a811dc4f8b Please referee sample CSV file for product price update. sku price PR-MB01 31 PR-MX02 32 PR-UG04 94 PR-UG05 100


1

You can use execute below script on your website to remove the attribute sets programmatically. <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; //require __DIR__ . '/../app/bootstrap.php'; $bootstrap = \Magento\Framework\App\...


1

You are getting this error because "data type" of any third party extension's table column is enum. So you need to find out column name using debug in following file. See below file /vendor/magento/framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php and check this fromDefinition() and add debug code to find column name. public function ...


0

In a Block PHP file, constructor adds one argument (Dependency Injection) like below and store it in a class member variable. Block Method public function __construct( Context $context, \Namespace\Modulename\Model\ModelNameFactory $modelNameFactory, array $data = array() ) { $this->_modelFactory = $modelFactory; parent::...


0

you can use the below statement for getting first item or last item $firstItem = $collections->getFirstItem(); $lastItem = $collections->getLastItem(); $collection is the variable that contains the collection


1

Make your field look like this: <field name="status" formElement="select"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="sortOrder" xsi:type="string">10</item> </item> </argument> <settings> ...


0

Write Like this $columns = [ 'cartcheck' => [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => true, ['default' => '0'], 'comment' => 'Cart Checkbox', ], ]; I Hope You Get The Correct Answer


0

First You Need To Change the Mode Default to Developer Mode. After This InstallSchema.php That shown Below <?php namespace vendor\module_name\Setup; use Magento\Framework\Setup\SchemaSetupInterface ; use Magento\Framework\Setup\ModuleContextInterface; class InstallSchema implements \Magento\Framework\Setup\InstallSchemaInterface { public ...


0

Change cron_tab and cron_groups file path :- vendor\module_name\etc\crontab.xml vendor\module_name\etc\cron_groups.xml


1

Using Database :- Query :- SELECT * FROM `sales_order_item` WHERE `product_options` LIKE '%2010%' Replace 2010 with Your Option Id In sales_order_item this table saved option id in product_options coumn with json Format. You can decode this product_options And Apply Filter json decode :- json_decode($product_options)


0

Magento 2.2 onward introduced replica tables to temporary store indexed data and then switch to the original table once indexing is completed to avoid errors due to table locking.


0

The reason behind this error you are passing the array to the column that is causing the issue. You can use the following code to avoid this error. if (isset($data['logo'][0]['name']) && isset($data['logo'][0]['tmp_name'])) { $data['image'] =$data['logo'][0]['name']; $this->imageUploader = \Magento\Framework\App\...


1

Create a new module Add etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\DB\Adapter\Pdo\Mysql" type="Vendo\Module\DB\Adapter\Pdo\Mysql" /> </...


1

you can try to run it non-interactive, request for command prompt, then enter your query: #!/usr/bin/expect -f # Get a shell spawn n98-magerun db:query # Wait for a prompt expect "SQL Query:" # Type something send "SELECT * FROM cms_page\r" #interact or if you can try to use singles, not double quotes: n98-magerun db:query 'SELECT * FROM cms_page' or ...


2

#!/bin/bash TABLES="log_customer log_visitor log_visitor_info log_url log_url_info" for table in ${TABLES} do mysql dbname -e "TRUNCATE TABLE ${table};" done


1

Why not just truncate the table via mysql cli directly? mysql -u root -p'' magento -e 'truncate table `magento`.`table_to_truncate`'


1

Please try with below steps to do easily.. Step1 : to create one file truncate.php in root, create array with all tables, than array load via foreach with truncateTable(). Step2 : run file via command line php -f truncate.php also try with this below url : mysql -Nse 'show tables' db_name | while read table; do mysql -e "truncate table $table" db_name;...


2

Static attributes are attributes stored in the main table of an entity - for catalog products, catalog_product_entity. For example, the attribute sku of catalog products is defined as static. Static attributes are always loaded by Magento, and are useful especially if you want to retrieve information quickly or to optimize lookup of data. A drawback of this ...


1

you should create the table following these instructions bellow: CREATE TABLE magento_bulk ( id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Bulk Internal ID (must not be exposed)', uuid varbinary(39) DEFAULT NULL COMMENT 'Bulk UUID (can be exposed to reference bulk entity)', user_id int(10) unsigned DEFAULT NULL COMMENT 'ID of the WebAPI user ...


1

You need to modify 2 tables salesrule and salesrule_coupon. You can use following sql query: UPDATE `salesrule_coupon` SET `expiration_date` = '2024-08-30'; UPDATE `salesrule` SET `to_date` = '2024-08-30' where `coupon_type` = 2;


2

Yes it is possible,the below query will update all your coupon codes expiry date since we did not use WHERE clause in the query: UPDATE salesrule_coupon SET expiration_date = '2024-08-30' After running the above query in the database, run the cache clean and flush commands as below: php bin/magento cache:clean && php bin/magento cache:flush ...


0

It's possible, you have to change your cart rules settings. You should have fields called "from" and "to". Just set the date that you want in these fields. It will update all the coupon code generated. Hope it helps.


0

Order save time in database is depends on set timezone on mysql server. Magento setting is only use for display purpose. I recommend that set server timezone UTC and set mangeto timezon as your local timezone. I hope this information will help you. Please let me know still if you have any question.


0

In order to resolve this issue,you need to create flat table catalog_category_flat_store_1. disable magento Catalog Flat for Category from Admin>Store>Catalog>Catalog>Use Flat Catalog Category make it NO Then Flush Magento Cache by php bin/magento cache:flush Then you should drop table catalog_category_flat_store_1, if it is exists in db by ...


Top 50 recent answers are included