Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

update inventory automatically Rate Topic   - - - - -

 
  • ehenderichs
  • Advanced Member
  • Members
  • Join Date: 08-Oct 12
  • 104 posts

Posted 24 March 2013 - 05:13 PM #1

I want to create a script to automatically update the inventory of all products. The suppliers has a CSV file with product numbers and stock information. Not all products are located in webshop yet.

Althought the programming logic is not that difficult I am not sure what the best way is.
  • update the stock values directly in DB?
  • convert supplier CSV to CS-Cart CSV and call CS-Cart product import functionality?
Hope the developers here can inform me about the these options (or others) and there consequences.

Thanks in advance.
The first cs-cart project for our new dutch company Sooned was a dutch erotic webshop called eely.nl.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 25 March 2013 - 05:38 AM #2

Depends on whether you are using option combinations or not. If not, then just update the 'amount' column for the product_id in the cscart_products table. If you are using option combinations, the find the product_id/product_code row in the cscart_product_options_inventory table and update the 'amount' column in that table.

You could just use the product_code and amount columns in a product import but do note if the product_code does not exist, it will be created.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 25 March 2013 - 01:20 PM #3

Doing direct update to the database would not cause any issues. Only program logic based on product amount will be skipped. For example "back in stock" notification to customers.
Cs-cart tips at shikhar.me

 
  • ehenderichs
  • Advanced Member
  • Members
  • Join Date: 08-Oct 12
  • 104 posts

Posted 07 April 2013 - 06:18 PM #4

Thx for the advice. The update of the inventory is working correctly. I did notice CS-Cart has wrapper function for DB management. The script I wrote has direct calls to the mysqli library. Is it wise to use the CS-Cart wrapper functions instead?
The first cs-cart project for our new dutch company Sooned was a dutch erotic webshop called eely.nl.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 07 April 2013 - 06:51 PM #5

Technically it's not required. But their wrapper makes many things a lot easier. I.e. it will apply sub-sets of data to INSERT or UPDATE requests, provides for IN clauses, etc.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 07 April 2013 - 06:53 PM #6

Yes technically no difference wrapper just makes things easier.
Cs-cart tips at shikhar.me

 
  • ehenderichs
  • Advanced Member
  • Members
  • Join Date: 08-Oct 12
  • 104 posts

Posted 07 April 2013 - 08:04 PM #7

Oke thx, will look into it in some more detail than
The first cs-cart project for our new dutch company Sooned was a dutch erotic webshop called eely.nl.