Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Adding Products to Nop_Commerce via VB.NET Program

Posted on 2009-12-29
1
Medium Priority
?
214 Views
Last Modified: 2013-11-13
I am reading files from a directory and uploading the files to my server via FTP and creating database entries by calling stored procedures and when the product is added, and the category is created, and I associate the product to the category, it shows the category as being assigned to the product under the administration part of Nop_Commerce, but the Category doesn't contain it in the store.

I think I must not be executing a necessary stored procedure?  Also, the search doesnt work when I create the product via this code.
Dim exec As New SqlCommand("Nop_CategoryInsert", cnn) 'Stored Procedure to call
                    exec.CommandType = CommandType.StoredProcedure
                    exec.Parameters.AddWithValue("@Name", _song.Artist.ToUpper)
                    exec.Parameters.AddWithValue("@Description", "")
                    exec.Parameters.AddWithValue("@TemplateID", 5)
                    exec.Parameters.AddWithValue("@MetaKeywords", "")
                    exec.Parameters.AddWithValue("@MetaDescription", "")
                    exec.Parameters.AddWithValue("@MetaTitle", "")
                    exec.Parameters.AddWithValue("@SEName", "")
                    exec.Parameters.AddWithValue("@ParentCategoryID", 0)
                    exec.Parameters.AddWithValue("@PictureID", 0)
                    exec.Parameters.AddWithValue("@PageSize", 10)
                    exec.Parameters.AddWithValue("@PriceRanges", "")
                    exec.Parameters.AddWithValue("@Published", "TRUE")
                    exec.Parameters.AddWithValue("@Deleted", "FALSE")
                    exec.Parameters.AddWithValue("@DisplayOrder", 1)
                    exec.Parameters.AddWithValue("@CreatedOn", "")
                    exec.Parameters.AddWithValue("@UpdatedOn", "")
                    exec.ExecuteNonQuery()
                End If


                Dim pVar As New SqlCommand("Nop_ProductVariantInsert", cnn)
                pVar.CommandType = CommandType.StoredProcedure
                pVar.Parameters.AddWithValue("@ProductId", PID)
                pVar.Parameters.AddWithValue("@Name", Name)
                pVar.Parameters.AddWithValue("@SKU", "")
                pVar.Parameters.AddWithValue("@Description", SD)
                pVar.Parameters.AddWithValue("@AdminComment", "")
                pVar.Parameters.AddWithValue("@ManufacturerPartNumber", "")
                pVar.Parameters.AddWithValue("@IsDownload", "")
                pVar.Parameters.AddWithValue("@DownloadID", 0)
                pVar.Parameters.AddWithValue("@IsShipEnabled", True)
                pVar.Parameters.AddWithValue("@IsFreeShipping", False)
                pVar.Parameters.AddWithValue("@IsTaxExempt", False)
                pVar.Parameters.AddWithValue("@TaxCategoryID", 0)
                pVar.Parameters.AddWithValue("@ManageInventory", True)
                pVar.Parameters.AddWithValue("@StockQuantity", 10000)
                pVar.Parameters.AddWithValue("@MinStockQuantity", 0)
                pVar.Parameters.AddWithValue("@LowStockActivityID", 0)
                pVar.Parameters.AddWithValue("@NotifyAdminForQuantityBelow", 1)
                pVar.Parameters.AddWithValue("@OrderMinimumQuantity", 1)
                pVar.Parameters.AddWithValue("@OrderMaximumQuantity", 1000)
                pVar.Parameters.AddWithValue("@WarehouseId", 0)
                pVar.Parameters.AddWithValue("@DisableBuyButton", 0)
                pVar.Parameters.AddWithValue("@RequiresTextOption", False)
                pVar.Parameters.AddWithValue("@TextOptionPrompt", "")
                pVar.Parameters.AddWithValue("@Price", "0.0000")
                pVar.Parameters.AddWithValue("@OldPrice", "0.0000")
                pVar.Parameters.AddWithValue("@Weight", 0)
                pVar.Parameters.AddWithValue("@Length", "0.0000")
                pVar.Parameters.AddWithValue("@Width", "0.0000")
                pVar.Parameters.AddWithValue("@Height", "0.0000")
                pVar.Parameters.AddWithValue("@PictureID", 0)
                pVar.Parameters.AddWithValue("@AvailableStartDateTime", "")
                pVar.Parameters.AddWithValue("@AvailableEndDateTime", "")
                pVar.Parameters.AddWithValue("@Published", True)
                pVar.Parameters.AddWithValue("@Deleted", True)
                pVar.Parameters.AddWithValue("@DisplayOrder", 1)
                pVar.Parameters.AddWithValue("@CreatedOn", "")
                pVar.Parameters.AddWithValue("@UpdatedOn", "")
                pVar.Parameters.AddWithValue("@AdditionalShippingCharge", "0.0000")
                    pVar.ExecuteNonQuery()

                Dim nProd As New SqlCommand("Nop_ProductInsert", cnn)
                nProd.CommandType = CommandType.StoredProcedure
                nProd.Parameters.AddWithValue("@Name", _song.ActualSongName)
                nProd.Parameters.AddWithValue("@ShortDescription", SongName.ToString)
                nProd.Parameters.AddWithValue("@FullDescription", "<p><a href=""http://Website/Music/Songs/" & _song.ActualSongName & """> " & _song.Song.ToUpper & "</a></p>")
                nProd.Parameters.AddWithValue("@AdminComment", "")
                nProd.Parameters.AddWithValue("@ProductTypeID", 1)
                nProd.Parameters.AddWithValue("@TemplateID", 4)
                nProd.Parameters.AddWithValue("@ShowOnHomePage", True)
                nProd.Parameters.AddWithValue("@MetaKeywords", "")
                nProd.Parameters.AddWithValue("@MetaDescription", "")
                nProd.Parameters.AddWithValue("@MetaTitle", "")
                nProd.Parameters.AddWithValue("@SEName", "")
                nProd.Parameters.AddWithValue("@AllowCustomerReviews", False)
                nProd.Parameters.AddWithValue("@AllowCustomerRatings", False)
                nProd.Parameters.AddWithValue("@RatingSum", 0)
                nProd.Parameters.AddWithValue("@TotalRatingVotes", 0)
                nProd.Parameters.AddWithValue("@Published", True)
                nProd.Parameters.AddWithValue("@Deleted", False)
                nProd.Parameters.AddWithValue("@CreatedOn", "")
                nProd.Parameters.AddWithValue("@UpdatedOn", "")
                Try

                    nProd.ExecuteNonQuery()



  Dim npcam As New SqlCommand("Nop_Product_Category_MappingInsert", cnn)
                    npcam.CommandType = CommandType.StoredProcedure
                    npcam.Parameters.AddWithValue("@ProductID", PID)
                    npcam.Parameters.AddWithValue("@CategoryID", CID)
                    npcam.Parameters.AddWithValue("@IsFeaturedProduct", False)
                    npcam.Parameters.AddWithValue("@DisplayOrder", 1)
                    npcam.ExecuteNonQuery()

Open in new window

0
Comment
Question by:joshbennett04
1 Comment
 
LVL 1

Accepted Solution

by:
joshbennett04 earned 0 total points
ID: 26150791
Easy fix, the products were "expiring" due to the dates set.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Progress
Starting up a Project

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question