SambaPOS4 Bulk Product Importer

Major modifications… tested with SambaPOS 4.1.82 and SQL Express 2014.

dbops.zip (8.1 KB)

// v3.2 (2015-05-13) QMcKay
//  - adding setting for default_charset using UTF-8
// v3.1 (2015-04-13) QMcKay
//  - changed PHP filename to dbops.php
//  - added auto-create WorkPeriod
//  - added auto-create Menu
//  - added more error checking
//  - added ExecQuery function to encapsulate Query Execution and error handling
//  - added separate functions (ops) and split into separate files:
//     - dbops_deleteproducts.php
//     - dbops_deletetransactions.php
//     - dbops_importproducts.php
//     - dbops_readproducts.php
//     - dbops_functions.php

Set your configuration options in file: dbops.php
No other files need edits.

Open Web Browser and go to address http://localhost/dbops.php
Select desired operation from the links at the top of the page…

4 Likes

@QMcKay

Hi! Does your latest post regarding SambaPOS4 Bulk Produt Importer work on SambaPOS4 version 4.1.82 and SQL Server 2014 Express?

Thank you.

Looking at this he posted above i would say yes, he has then developed it a bit more after this post so it should be fine on .82 and sql2014

Yes. SambaPOS 4.1.82 and SQL Server 2014 Express were used in testing.

2 Likes

HOW COULD I IMPORT USING UTF-8(CHINESE) ENCODING import.csv?

Honestly, I don’t know how to do that since I never use UTF-8. However, I could probably figure it out.

Can you attach your CSV file here with a few rows of data - say 10 to 50 rows?

2 Likes

Hmm… seems to work for me …


So this indicates a PHP setting problem. You can change this setting in php.ini

; PHP's default character set is set to empty.
; http://php.net/default-charset
default_charset = "UTF-8"

There are 2 things we can do:

  1. Locate php.ini and make sure it contains the setting above, and/or

  2. Modify dbops.php and put this line of code near the top of the file:

    ini_set(“default_charset”,“UTF-8”);

This is where I placed the code in dbops.php


The ZIP file above has been refreshed to include this change …

2 Likes

WOW! This is charming! THANKS!!!

Would the bulk importer script work with v3 ? If not, is there any similar script which would work for v3 to bulk import products?

Doing an install on a system running POSReady 2009 (i.e. Windows XP) and can’t update the OS.

Not sure anyone will be able to confidently answer that,
This is the V4 forum and many people have had minimal use of V3.
Easiest way to find out would be a test install and try it :stuck_out_tongue:

It will probably work for v3 but I cannot (don’t want to) confirm this. I don’t think there were many, if any, changes to the affected tables between v3 and v4.

The script was initially developed using v3. See here:

http://forum2.sambapos.org/index.php/topic,1591.msg7273.html#msg7273

1 Like

Yeah I also found that link on v3 forum after posting here. However, the download link is gone for the v1 importer file. Or I am guessing it is only visible for registered users, and registration is now closed.

Anyone have the v1 importer file referenced in that post?

I would assume this bulk product importer is included with V5 or a similar settings with similar options are integrated within v5

Nope i dont think it is so youll still need to use the setup talked about in this thread

Just try the importer in this topic, the latest of which is 3.2

I restored a v3 DB backup and tried the import. A few things are broken because of changes in some of the DB Tables. I made some changes to 1 file to make it work on v3.

  • Use the v3.2 importer package from above.
  • Download and extract the following file and replace the existing file of the same name:
    dbops_importproducts_for_SambaPOS3.zip (3.1 KB)
  • run the import operation as usual.

Thanks, will give it a try :smile:

I encounter missing menu item selection after first product selected, this issue happen randomly, to avoid this i have to cancel the item & close the ticket the menu selection appeal again, how to fix this issue?

anyone have same problem? this issue occurred after i import products & Inventory using CSV

[quote=“QMcKay, post:32, topic:1504”]
It will probably work for v3 but I cannot (don’t want to) confirm this. I don’t think there were many, if any, changes to the affected tables between v3 and v4.

The script was initially developed using v3.

emreApr 6
That script needs to be updated for latest version but unfortunately @JohnS is away for a while. If it is a new install you can try importing products to 4.1.37 version and install 4.1.82 on it to migrate database to latest version.

Hi,

does this work after the POS has been doing sales for 2 weeks, and TODAY only I managed to enter the inventory items, recipe, then lastly transactions invoice document, will this still tele with the warehouse of how many items I’ve left in my shop after what I sold during the last 2 weeks?

No, only once you have setup your inventory items, recipe, then it will deduct.
So in this case check inventory and adjust stock accordingly.