Is there a way of deleting product option groups?


https://forum.kartris.com/Topic629.aspx
Print Topic | Close Window

By thedrumdoctor - Mon 6 Jun 2011
I can't seem to find a 'delete' option in the edit area to do this.

The reason I need to is because I created an options product and made an options group. However, I edited the options group to add extra options and upon saving got the following error message:

Error occurred while processing the operation

The easy thing would be for me to delete the option group and start again and get it right this time, but I can't see how to delete it.
By Mohammad - Mon 6 Jun 2011
Kartris didn't have that option in the back-end for the time being, although you can do it manually by running your own SQL script, but you need 1st to delete the links between the versions that linked to the options under the specified group, then delete the options under that group at that time you can remove the groups themselves.

Regarding the error you get "Error occurred while processing the operation" is general one, could you please check the error log details about that process in the back-end, and post it here and will get back to you as soon as possible.

We may have the "delete" option in the future versions.
By thedrumdoctor - Tue 7 Jun 2011
Ok, I don't fancy messing with SQL scripts. I'll just rename the option group to something else so it's obvious not to use.

Here's the error log anyway.  Seems to be a CHECK constraint error. Obviously didn't like my edit for some reason...


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:22:31
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:22:31
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:23:21
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:23:21
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:23:39
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:23:39
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:24:57
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:24:57
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:26:27
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:26:27
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 14:26:44
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 14:26:44
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    86.160.20.219
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL.
-----------------------------------------------------------------------------
>>    System.Data.SqlClient.SqlException
>>    06/06/2011 17:43:18
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    212.159.76.170
>>    CUSTOM MESSAGE:
Database Error: reference-key violation.
>>    NUMBER:547
>>    MESSAGE:
The INSERT statement conflicted with the CHECK constraint "CK_ProductOptionLink_PriceChange". The conflict occurred in database "db360978420", table "dbo.tblKartrisProductOptionLink", column 'P_OPT_PriceChange'.
The statement has been terminated.
>>    STACK:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at OptionsBLL.(DataTable , SqlConnection , SqlTransaction )
==================================================


-----------------------------------------------------------------------------
>>    OptionsBLL._CreateProductOptions
-----------------------------------------------------------------------------
>>    System.ApplicationException
>>    06/06/2011 17:43:18
>>     URL:http://mydomainhiddenfromforumview/Admin/_ModifyProduct.aspx?ProductID=13&CategoryID=17&strParent=8,13&strTab=options
>>    212.159.76.170
>>    CUSTOM MESSAGE:
Error occurred while processing the operation.
>>    MESSAGE:
Error occurred while processing the operation.
>>    STACK:
   at OptionsBLL._CreateProductOptions(Int32 pProductID, DataTable ptblOptionGroupList, DataTable ptblOptionsList, String& strMsg)
==================================================
By thedrumdoctor - Tue 7 Jun 2011
ADDENDUM

I tried recreating the option group again and the same error occurred, but there was a way to get the option group 'accepted', though it's not a fix.

I'm experimenting with an options product with a base price of £539.00.

I created an options group for different sizes (I'll call it options group A for example).

I then created an options group for different configurations of the product (I'll call it options group B for example).

There was a requirement to offer an option of the product without certain features at a cheaper price. The obvious place to add these options was within options group B. This product would be £140 cheaper so I entered -140.00 in the Price setting in the option values. It was after I tried to save options group B that the error occurred.

However, going back to options group B and removing the -140.00 so every Price value was set to zero allowed me to save it successfully. Unfortunately, this isn't the answer as the cheaper option will not be reflected by price.

Is the Price option value attribute supposed to be able to take + / - figures to reflect different options within a single option group or do I have to create a separate option group to set up + / - price differences?
By Mohammad - Tue 7 Jun 2011
Hi,

Options in Kartris designed to accept only positive prices.

To make it accept cheaper prices (negative), run the below script to your db:
ALTER TABLE [dbo].[tblKartrisProductOptionLink] DROP CONSTRAINT [CK_ProductOptionLink_PriceChange]

Will discuss this with the team, and see if we will have the options to accept cheaper prices in the future releases.
By Mohammad - Wed 8 Jun 2011
Negative prices for options will be supported in Kartris hopefully by next release.
By thedrumdoctor - Wed 8 Jun 2011
Ok, thanks for that.

So, just before I run this can I confirm that after backing up my database I go to the backend, Database Admin\Run Query and past this command in in the box and execute it?

I've had a look on the web and found the CONSTRAINT clause in SQL and what it does so I understand what this command in removing. I see it also appears in Access but it was never covered that on the Access courses I went on.

Many thanks again for your help.
By thedrumdoctor - Wed 8 Jun 2011
Will I have to disable any triggers to run this?
By Mohammad - Wed 8 Jun 2011
No need to disable triggers, if the execution fails from the "Database Admin\Run Query", then you need to run it directly to the db instead of using Kartris' back-end.
By thedrumdoctor - Wed 8 Jun 2011
Ok, it failed anyway:

The query you tried to execute failed:
Error: command not allowed.

Looks like I'll have to find a tool to connect to my SQL database on shared hosting...

If anyone else needs to do this I believe that
Microsoft® SQL Server® 2008 Management Studio Express will do this, at least if your host is running MS SQL 2008
By thedrumdoctor - Mon 20 Jun 2011
I ran the query in MS SQL 2008 server management studio and the problem is solved.