Is it safe to update products from a SQL script?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hello!

We are running nopCommerce 4.0.

Someone from our Marketing department needs to update titles and URLs on 389 products.  Of course, she doesn't want to update them through the admin area.  No one would.

So, she's asked if IT can help her out.  

I know I could write some SQL script that does something like this:


UPDATE Product SET Name = 'something new' WHERE Id = 123
UPDATE UrlRecord SET Slug = 'new-name-for-product' WHERE EntityId = 123


Is this safe?  Will we be missing anything that is done behind the scenes when we hit save in the admin area?

Thanks!

Jeremy
3 years ago
You probably can if just the title/URL, but you should include AND EntityName = 'Product' on UrlRecord.

Have you considered using Excel Export/Import?  You products need a SKU for the match when you Import.  There is a field for SeName.
3 years ago
New York, thanks!  Actually, in my test for this on our dev database, I did include the EntityName, but I removed it when I pasted it in here for some reason.  

I didn't consider the Excel import.  Is there a template for the import file?  I would want to make it extremely simple for Marketing, so it would be awesome if there were just the needed fields: ID, SKU, Name, and SeName (I guess).  Otherwise, I'll probably go with the SQL route.

Thanks!

Jeremy
3 years ago
Export 1 product as an example so you can see the necessary excel columns.
3 years ago
As a test, I exported three products, edited the Excel file (just added my name to the Name and SeName), and the imported.  I saw a 404 on "/Admin/Product/ImportExcel". I clicked the back button and saw that I now have three new products with missing pictures and data.  I don't think I can hand that process off to Marketing.  Fortunately, this was in dev :)

I might go with the SQL script after all.  

Thanks, everyone!

Jeremy
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.