News:

Support the VirtueMart project and become a member

Main Menu

Want to populate SKU field with ascending data...PHP or SQL?

Started by phil147, January 26, 2020, 12:26:56 PM

Previous topic - Next topic

phil147

running VM 3.2.12 and Joomla 3.9.12

I'm using ro csvi extension to export my VM data to use in another website.

I have over 1000 products that unfortunately none have SKU data. ro csvi needs SKU to export/import correctly ( uses it in at least 2 database tables, vm_products, vm_product_media

I've searched for solutions to add data using SQL and PHP but cant get solution so far.

Eg I could make SKU = "xxx" and example use the virtuemart product id to create unique SKU.

I can access product data from VM with $product_model = VmModel::getModel('product');   and $myproduct = $product_model->getProduct($x);

Are there commands in VM to write back to the database with PHP? I was thinking to look in admin product view, and set SKU from there ?

Anyone know how to do this please?

GJC Web Design

why not export your csv, open in Excel or Open office, add your skus there
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

phil147

yes you are right, i did add the sku's in excel but the extension ro csvi is throwing up conflicts when i import the file.....

I think its partly down to me missing out on some detail and the extension itself not as user friendly as it appears....

Originally i was just using Phymyadmin to migrate VM,main issues I was having was conflicts with the menu tables (i'm importing all menu items > 120)  so I was using ro csvi to export/import menu's and keep parity with menu tables...

ready to throw towel at it!!



Studio 42

phil147, my tool vm Be Pro can import without SKU.
You can choose alias or name.
Of course the field need to be unique else you can have conflict too.
See https://shop.st42.fr/en/products/vm-be-pro-batch-product-edit.htm

PRO

why not use php my admin to set the sku field to the product id?


update _virtuemart_products
set product_sku = virtuemart_product_id