Of course I'll be giving you full credit the ancient. This is exactly why I prefer to work with open source software. :)
My little changes turned into some big changes. I'll list what I've done, and what I need to do next before releasing this, but I had one question first -- hopefully someone (including the_ancient) can help me understand this. As it stands, check/money orders are sent to QB as a sales order while other payments are sent as sales receipts. I'd never heard of a sales order before, so I had to look it up. Apparently they are a way to store purchases from a customer that can later be combined into an invoice. This makes sense if you have customers who make tons of purchases regularly, as you don't have to bill them individually all the time.
Here's my issue: for the average Zen Cart store, wouldn't it make more sense to import Check/Money Orders into QB as an invoice? Two reasons: 1) Quickbooks Pro, the most popular version of QB, does not support Sales Orders. You need the more expensive Premier version for this. Hence, this isn't going to work for many people. 2) Most Zen Cart stores (although obviously not all) are not going to have customers visiting frequently that need to be invoiced together for multiple orders.
I suppose the best solution would be to have invoices, sales receipts, and sales orders available as an option that you can choose. However, its going to take a lot of work, as invoices are currently not coded and sales orders are no longer functioning properly as I have significantly changed the way Sales Receipts work. Is it worth the effort? Updating the sales orders code would be easier than adding invoices, but it seems to me that invoices would be more useful for the average user. All in all, sales receipts are obviously the most important. What do people think? My inclination is to just comment out the sales order code and send all orders as sales receipts. I hate to reduce the functionality as I update this mod, but I question whether its worth the effort to implement these features. Any input would be appreciated.
OK, so here's the changes I've made so far:
-Updated tables definitions with DB_PREFIX so that you don't have to anymore.
-Fixed issues that could cause errors including: truncating all QBXML fields to maximum values, replacing all characters with accents, ^, ~, etc... above them with their standard ASCII character without the accent, ^, ~, etc..., automatically removing all other characters above and beyond the 128 standard ASCII characters and replacing them with a ? (QB Web Connector doesn't like these characters!)
-Implemented Payment Methods
-Created a matching system that allows multiple shipping types, sales taxes, payment methods, and discounts/fees. These are now stored in the database, and I've created an Admin page that allows you to do your matching. Default is to pass through the Zen Cart values to Quickbooks. All other values need to be matched.
-Implemented 2 advanced matching features: 1) * in Zen Cart value will indicated that all values NOT yet matched should follow this rule. 2) * in Quickbooks value will indicate that this should be passed through from Zen Cart.
-Setup matching such that values need only CONTAIN the Zen Cart value to match. They do not need to match exactly. This will make it easier to match things, as many values are not static. For example, if your shipping is "UPS Ground (xxx pounds)", the xxx will change everytime. But, using "UPS Ground" in your Zen Cart matching value will always work for this because it contains "UPS Ground". This also will fix many problems with html codes appearing in matching values.
-Changed so that products will be taxable or nontaxable on sales receipt based on whether or not they were taxed on this particular order. Previously, they just took the defaults in Quickbooks, which caused problems in some cases.
The major work is done. Here are a couple things I'd still like to implement:
-sales orders and invoices...is it worth it? see above
-ability to add products as non-inventory part
-move configuration values other than matching to zen cart table so you can configure from admin
-ability to choose whether or not to add products from zen cart after the first time you run QB Web Connector.
-create an option for QB Sync to use a standard tax name for items that weren't taxed in Zen Cart
-add option to override whether or not products were taxed or not and simply tax or not tax all items
(the reason I want to add the last two is that this will help people that have assigned a 0% tax so that they can track their taxable vs. non-taxable orders -- very helpful when sales tax is due -- I highly recommend it!)
-create files that will make links to qbAdmin.php and the new qbMatch.php accessible from the admin menu -- no more typing the url!
-Create ability to limit log entries to a certain number. Oldest get deleted first.
Here are a few things that would be great additions to this, but I don't plan to do:
-inventory tracking sync
-handle products with attributes more accurately