Page 1 of 1

Using SQL Server to Append New Products to AbleCommerce

Posted: Mon Jan 05, 2009 8:33 pm
by euroluxantiques
I have created some queries to append new products into dbo_ac_Products from my SQL Server products database. When I append new products, it seems to crash the database, although it seems as if I am not violating any keys when I do the append.

Once the products are appended, I also append this product info to dbo_ac_CatalogNodes, using the product id generated in dbo_ac_Products.

Is there some sort of rebuild routine that should be run after appending these products so that the database does not crash after appending? I always back the database up before appending so I can restore it, but it seems to me this must be possible to append records successfully.

I know that there is the DataPort to append info, but I don't really want to use that selection because it requires me to produce an XML file with all the new products, export that to a flat file and then open DataPort to transfer the information. I am really looking for a seemless operation that can be handled via SQL Server Agent, as much of my other web marketing is automated. It seems that if it can be done via DataPort, it should be able to be done via append queries, as long as I follow the same protocol in DataPort. Any help you can give would be appreciated. Thanks!

Re: Using SQL Server to Append New Products to AbleCommerce

Posted: Tue Jan 06, 2009 10:34 am
by nickc
Safer and easier to use code/CommerceBuilder objects to add products:

Code: Select all

Product myProduct = new Product();
myProduct.Name = importedName;
... etc
myProduct.Save()
Also better for automation, as you can expose your code as a web method.

Re: Using SQL Server to Append New Products to AbleCommerce

Posted: Tue Jan 06, 2009 12:33 pm
by jmestep
The dataport doesn't require you to use an xml file if you are wanting to add products without options, etc. You can use a csv and put in the categories you want, then everything is added to the database where it should be.

Re: Using SQL Server to Append New Products to AbleCommerce

Posted: Wed Jan 07, 2009 8:11 am
by euroluxantiques
How do we access Code Builder? I just installed AbleCommerce and am still learning how the various modules are set up.

Re: Using SQL Server to Append New Products to AbleCommerce

Posted: Wed Jan 07, 2009 8:15 am
by mazhar
You just need to import the appropriate namespace into your code and classes in that namespace will be made available to you. For example if you want to use the Product object then first you will need to add an import statement for CommerceBuilder.Products namespace. Have a look at some conlib control for sample, for example check the ConLib/Basket.ascx.cs control code file.

Also please have a look at this, it may help you
http://wiki.ablecommerce.com/index.php/ ... uilder_API