How can I update all products names via sql query in magento2?Get full list of categories using sqlHow do you set the special_price of product in magento via direct SQL query?Added a column, renamed it, and now getting SQLSTATE on sales back officeHow to optimize the query: the product qty bought with each of the productsUnknown column 'price_index.min_price' when i search for some productsql query to get Products price, sku, product_id, description and url to pictureSupplier,Brand,Category Name fetch of all products from sql ? magento2Magento2 - How to Export mysql database without products,orders and customers data?Modifying a query (get products using SQL only)Bulk adding & updating product attribute

Reducing contention in thread-safe LruCache

What does a comma signify in inorganic chemistry?

What's a good pattern to calculate a variable only when it is used the first time?

Vegetarian dishes on Russian trains (European part)

Tikz: The position of a label change step-wise and not in a continuous way

What's the point of writing that I know will never be used or read?

How do the Durable and Dwarven Fortitude feats interact?

Why was ramjet fuel used as hydraulic fluid during Saturn V checkout?

Can I submit a paper computer science conference using an alias if using my real name can cause legal trouble in my original country

From where do electrons gain kinetic energy through a circuit?

Are unaudited server logs admissible in a court of law?

What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?

What would cause a nuclear power plant to break down after 2000 years, but not sooner?

Why should P.I be willing to write strong LOR even if that means losing a undergraduate from his/her lab?

How do I answer an interview question about how to handle a hard deadline I won't be able to meet?

Has there ever been a truly bilingual country prior to the contemporary period?

Why can't I see 1861 / 1871 census entries on Freecen website when I can see them on Ancestry website?

Representing an indicator function: binary variables and "indicator constraints"

The Lucky House

Heyawacky: Ace of Cups

Is it alright to say good afternoon Sirs and Madams in a panel interview?

The anatomy of an organic infrared generator

Rotate List by K places

Ending a line of dialogue with "?!": Allowed or obnoxious?



How can I update all products names via sql query in magento2?


Get full list of categories using sqlHow do you set the special_price of product in magento via direct SQL query?Added a column, renamed it, and now getting SQLSTATE on sales back officeHow to optimize the query: the product qty bought with each of the productsUnknown column 'price_index.min_price' when i search for some productsql query to get Products price, sku, product_id, description and url to pictureSupplier,Brand,Category Name fetch of all products from sql ? magento2Magento2 - How to Export mysql database without products,orders and customers data?Modifying a query (get products using SQL only)Bulk adding & updating product attribute






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Hi I have a list of sku's of all products at my store , I want to update all the names of products I have on store via sql query with respect to it's sku .



There is a table name : catalog_product_flat_21 and catalog_product_flat_19 at my database



Just for checking I have updated the column of (name) in these both tables and refresh the caches but still name on site is not update !



Tell me if you have solution of this using sql query , Thanks!










share|improve this question





















  • 1





    product name is Stored in catalog_product_entity_varchar table

    – Rk Rathod
    Aug 6 at 8:11











  • yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

    – Hamza Mustafa
    Aug 6 at 8:19











  • using sql query ??? you can also create custom script for that

    – Rk Rathod
    Aug 6 at 8:21












  • yeah if possible

    – Hamza Mustafa
    Aug 6 at 8:21











  • can you provide me sample script for that! thanks

    – Hamza Mustafa
    Aug 6 at 8:22

















1















Hi I have a list of sku's of all products at my store , I want to update all the names of products I have on store via sql query with respect to it's sku .



There is a table name : catalog_product_flat_21 and catalog_product_flat_19 at my database



Just for checking I have updated the column of (name) in these both tables and refresh the caches but still name on site is not update !



Tell me if you have solution of this using sql query , Thanks!










share|improve this question





















  • 1





    product name is Stored in catalog_product_entity_varchar table

    – Rk Rathod
    Aug 6 at 8:11











  • yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

    – Hamza Mustafa
    Aug 6 at 8:19











  • using sql query ??? you can also create custom script for that

    – Rk Rathod
    Aug 6 at 8:21












  • yeah if possible

    – Hamza Mustafa
    Aug 6 at 8:21











  • can you provide me sample script for that! thanks

    – Hamza Mustafa
    Aug 6 at 8:22













1












1








1








Hi I have a list of sku's of all products at my store , I want to update all the names of products I have on store via sql query with respect to it's sku .



There is a table name : catalog_product_flat_21 and catalog_product_flat_19 at my database



Just for checking I have updated the column of (name) in these both tables and refresh the caches but still name on site is not update !



Tell me if you have solution of this using sql query , Thanks!










share|improve this question
















Hi I have a list of sku's of all products at my store , I want to update all the names of products I have on store via sql query with respect to it's sku .



There is a table name : catalog_product_flat_21 and catalog_product_flat_19 at my database



Just for checking I have updated the column of (name) in these both tables and refresh the caches but still name on site is not update !



Tell me if you have solution of this using sql query , Thanks!







magento2 database sql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 6 at 7:46









Faisal Sheikh

4211 silver badge12 bronze badges




4211 silver badge12 bronze badges










asked Aug 6 at 7:43









Hamza MustafaHamza Mustafa

1903 silver badges16 bronze badges




1903 silver badges16 bronze badges










  • 1





    product name is Stored in catalog_product_entity_varchar table

    – Rk Rathod
    Aug 6 at 8:11











  • yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

    – Hamza Mustafa
    Aug 6 at 8:19











  • using sql query ??? you can also create custom script for that

    – Rk Rathod
    Aug 6 at 8:21












  • yeah if possible

    – Hamza Mustafa
    Aug 6 at 8:21











  • can you provide me sample script for that! thanks

    – Hamza Mustafa
    Aug 6 at 8:22












  • 1





    product name is Stored in catalog_product_entity_varchar table

    – Rk Rathod
    Aug 6 at 8:11











  • yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

    – Hamza Mustafa
    Aug 6 at 8:19











  • using sql query ??? you can also create custom script for that

    – Rk Rathod
    Aug 6 at 8:21












  • yeah if possible

    – Hamza Mustafa
    Aug 6 at 8:21











  • can you provide me sample script for that! thanks

    – Hamza Mustafa
    Aug 6 at 8:22







1




1





product name is Stored in catalog_product_entity_varchar table

– Rk Rathod
Aug 6 at 8:11





product name is Stored in catalog_product_entity_varchar table

– Rk Rathod
Aug 6 at 8:11













yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

– Hamza Mustafa
Aug 6 at 8:19





yeah i figured it out , but i want to update product names with respect to sku's list i have , sku's are stored in catalog_product_flat_21 and catalog_product_flat_19 table , where in catalog_product_entity_varchar table i have the names and its enity_id , so if i want to update products names it should be wrt enitity id's possible , how its possible wrt to skus?

– Hamza Mustafa
Aug 6 at 8:19













using sql query ??? you can also create custom script for that

– Rk Rathod
Aug 6 at 8:21






using sql query ??? you can also create custom script for that

– Rk Rathod
Aug 6 at 8:21














yeah if possible

– Hamza Mustafa
Aug 6 at 8:21





yeah if possible

– Hamza Mustafa
Aug 6 at 8:21













can you provide me sample script for that! thanks

– Hamza Mustafa
Aug 6 at 8:22





can you provide me sample script for that! thanks

– Hamza Mustafa
Aug 6 at 8:22










1 Answer
1






active

oldest

votes


















2














Create Script In Magento Root Directory And Run Script :-




use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


Read CSV File in Script :-



<?php

use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";
$CSVfp = fopen("your_file.csv", "r"); //put CSV file on magento root and add your file name

if($CSVfp !== FALSE)


while(! feof($CSVfp))


$data = fgetcsv($CSVfp, 1000, ","); //here you can get sku in $data object

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


fclose($CSVfp);





share|improve this answer



























  • Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

    – Hamza Mustafa
    Aug 6 at 8:39











  • you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

    – Rk Rathod
    Aug 6 at 8:41











  • my question is that how to get sku in custom script ??

    – Rk Rathod
    Aug 6 at 8:43











  • i have list of all sku's in excel file , i would manually write it on script

    – Hamza Mustafa
    Aug 6 at 8:48






  • 1





    check updated answer

    – Rk Rathod
    Aug 6 at 10:39













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284531%2fhow-can-i-update-all-products-names-via-sql-query-in-magento2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Create Script In Magento Root Directory And Run Script :-




use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


Read CSV File in Script :-



<?php

use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";
$CSVfp = fopen("your_file.csv", "r"); //put CSV file on magento root and add your file name

if($CSVfp !== FALSE)


while(! feof($CSVfp))


$data = fgetcsv($CSVfp, 1000, ","); //here you can get sku in $data object

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


fclose($CSVfp);





share|improve this answer



























  • Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

    – Hamza Mustafa
    Aug 6 at 8:39











  • you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

    – Rk Rathod
    Aug 6 at 8:41











  • my question is that how to get sku in custom script ??

    – Rk Rathod
    Aug 6 at 8:43











  • i have list of all sku's in excel file , i would manually write it on script

    – Hamza Mustafa
    Aug 6 at 8:48






  • 1





    check updated answer

    – Rk Rathod
    Aug 6 at 10:39















2














Create Script In Magento Root Directory And Run Script :-




use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


Read CSV File in Script :-



<?php

use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";
$CSVfp = fopen("your_file.csv", "r"); //put CSV file on magento root and add your file name

if($CSVfp !== FALSE)


while(! feof($CSVfp))


$data = fgetcsv($CSVfp, 1000, ","); //here you can get sku in $data object

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


fclose($CSVfp);





share|improve this answer



























  • Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

    – Hamza Mustafa
    Aug 6 at 8:39











  • you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

    – Rk Rathod
    Aug 6 at 8:41











  • my question is that how to get sku in custom script ??

    – Rk Rathod
    Aug 6 at 8:43











  • i have list of all sku's in excel file , i would manually write it on script

    – Hamza Mustafa
    Aug 6 at 8:48






  • 1





    check updated answer

    – Rk Rathod
    Aug 6 at 10:39













2












2








2







Create Script In Magento Root Directory And Run Script :-




use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


Read CSV File in Script :-



<?php

use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";
$CSVfp = fopen("your_file.csv", "r"); //put CSV file on magento root and add your file name

if($CSVfp !== FALSE)


while(! feof($CSVfp))


$data = fgetcsv($CSVfp, 1000, ","); //here you can get sku in $data object

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


fclose($CSVfp);





share|improve this answer















Create Script In Magento Root Directory And Run Script :-




use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


Read CSV File in Script :-



<?php

use MagentoFrameworkAppBootstrap;

include 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$productRepository = $objectManager->create('MagentoCatalogModelProductRepository');

$sku = "This is Test Sku";
$CSVfp = fopen("your_file.csv", "r"); //put CSV file on magento root and add your file name

if($CSVfp !== FALSE)


while(! feof($CSVfp))


$data = fgetcsv($CSVfp, 1000, ","); //here you can get sku in $data object

$product = $productRepository->get($sku); // Pass Sku

$product->setName('Set Product Name');

$productRepository->save($product);


fclose($CSVfp);






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 6 at 10:39

























answered Aug 6 at 8:31









Rk RathodRk Rathod

3,0384 silver badges26 bronze badges




3,0384 silver badges26 bronze badges















  • Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

    – Hamza Mustafa
    Aug 6 at 8:39











  • you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

    – Rk Rathod
    Aug 6 at 8:41











  • my question is that how to get sku in custom script ??

    – Rk Rathod
    Aug 6 at 8:43











  • i have list of all sku's in excel file , i would manually write it on script

    – Hamza Mustafa
    Aug 6 at 8:48






  • 1





    check updated answer

    – Rk Rathod
    Aug 6 at 10:39

















  • Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

    – Hamza Mustafa
    Aug 6 at 8:39











  • you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

    – Rk Rathod
    Aug 6 at 8:41











  • my question is that how to get sku in custom script ??

    – Rk Rathod
    Aug 6 at 8:43











  • i have list of all sku's in excel file , i would manually write it on script

    – Hamza Mustafa
    Aug 6 at 8:48






  • 1





    check updated answer

    – Rk Rathod
    Aug 6 at 10:39
















Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

– Hamza Mustafa
Aug 6 at 8:39





Thank you so much bro , last question what if i want to update many product names with respect to its sku, like i have a list of almost 9k products sku's which i want to update its names , than?

– Hamza Mustafa
Aug 6 at 8:39













you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

– Rk Rathod
Aug 6 at 8:41





you can get product collection with addfieltofilter('sku',array('eq'=>'your_sku')) and change name of that product

– Rk Rathod
Aug 6 at 8:41













my question is that how to get sku in custom script ??

– Rk Rathod
Aug 6 at 8:43





my question is that how to get sku in custom script ??

– Rk Rathod
Aug 6 at 8:43













i have list of all sku's in excel file , i would manually write it on script

– Hamza Mustafa
Aug 6 at 8:48





i have list of all sku's in excel file , i would manually write it on script

– Hamza Mustafa
Aug 6 at 8:48




1




1





check updated answer

– Rk Rathod
Aug 6 at 10:39





check updated answer

– Rk Rathod
Aug 6 at 10:39

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284531%2fhow-can-i-update-all-products-names-via-sql-query-in-magento2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form