Deleting (Removing) Prodcucts Via Csv Import

HI;



We have a large inventory (about 4000 items ) that change very quickly due to inventory changes. I would like to know if it is possible to remove/delete/disable products via csv import. this way our backend system can generate the csv file with updated info to be imported into cs-cart.



thanks

Not that I'm aware of. Imports should be considered “update” so you can import a sub-set of products.

[quote name='rolex' timestamp='1400726145' post='184029']

HI;



We have a large inventory (about 4000 items ) that change very quickly due to inventory changes. I would like to know if it is possible to remove/delete/disable products via csv import. this way our backend system can generate the csv file with updated info to be imported into cs-cart.



thanks

[/quote]



There is the “fn_exim_send_product_notifications” function in the “app/schemas/exim/products.functions.php” file. It is called after the import is finished and used to send notifications about products which are back in stock. If products with 0 amount in stock should be deleted, you can replace the following part of code of this function:



if ($product_amount > 0) {
fn_send_product_notifications($v['product_id']);
}




with this one:



if ($product_amount > 0) {
fn_send_product_notifications($v['product_id']);
} else {
fn_delete_product($v['product_id']);
}




Thanks

[quote name='tbirnseth' timestamp='1400737723' post='184041']

Not that I'm aware of. Imports should be considered “update” so you can import a sub-set of products.

[/quote]



can you please explain. thanks

[quote name='eComLabs' timestamp='1400744797' post='184054']

There is the “fn_exim_send_product_notifications” function in the “app/schemas/exim/products.functions.php” file. It is called after the import is finished and used to send notifications about products which are back in stock. If products with 0 amount in stock should be deleted, you can replace the following part of code of this function:



if ($product_amount > 0) {
fn_send_product_notifications($v['product_id']);
}




with this one:



if ($product_amount > 0) {
fn_send_product_notifications($v['product_id']);
} else {
fn_delete_product($v['product_id']);
}




Thanks

[/quote]thanks eComLab for the reply !



that would work for items with 0 inventory .



My issue is a bit different. at any given time we could have about 4000-5000 items in the store that may not be available from our supplier. so in reality every other day or so we have to delete all products and import a fresh csv file from our supplier. The other way would be to make export from cs-cart , make a new csv file and set the status ( to non active or disable ) of all products import it and that import a fresh scv .



would appreciate your advise

tks

You can import your .csv with any products not avaialble to be set as “D” disabled.

Then in admin or via phpmyadmin, when you want to delete them you can sort by status and delete all disabled



John

[quote name='johnbol1' timestamp='1400782562' post='184091']

You can import your .csv with any products not avaialble to be set as “D” disabled.

Then in admin or via phpmyadmin, when you want to delete them you can sort by status and delete all disabled



John

[/quote]



We strongly recommend to use the “fn_delete_product” php function to delete products. Too many tables in the DB are linked with the “cscart_products” one. Also add-ons can be affected.

I import in my products as disabled and then go into the admin and search for the disabled products and delete them from there. That way you are sure to get everything. Pretty easy.



Thanks,



Brandon

[quote name='brandonvd' timestamp='1400854471' post='184134']

I import in my products as disabled and then go into the admin and search for the disabled products and delete them from there. That way you are sure to get everything. Pretty easy.



Thanks,



Brandon

[/quote]



Me too, I think what post 7 means about addons could be affected by deleting products is via the phpmyadmin method.

[quote name='johnbol1' timestamp='1400863297' post='184142']

Me too, I think what post 7 means about addons could be affected by deleting products is via the phpmyadmin method.

[/quote]



Exactly. If you delete products from the admin panel, they will be deleted correctly. Removing products from the phpmyadmin is not good solution.