Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discount code rule not working? #9

Open
bjarnef opened this issue Dec 8, 2014 · 6 comments
Open

Discount code rule not working? #9

bjarnef opened this issue Dec 8, 2014 · 6 comments
Labels

Comments

@bjarnef
Copy link
Contributor

bjarnef commented Dec 8, 2014

How is the "discount code rule" intended to work?

Both Manual and Generate doesn't seem to add content to "Discount codes:" and "Unused discount codes:" .. and the download link returns:

The specified argument value for the function is not valid. [ Argument # = 1,Name of function(if known) = isnull ]

.. maybe because the discount code is null?

I should mention i have tested with SQL CE.

@bjarnef
Copy link
Contributor Author

bjarnef commented Jan 9, 2015

I also think it's a bit confusing, when you had a manual code and how many times it can be used you see:

Discount codes: 1
Unused discount codes: 1

The text file contains 1 code, but you can't see how many times the code was set to be used.. and how many times left it can be used. The same when the codes are generated - they are added, but the "Max uses" needs to be more clear afterwards.
Furthermore when added manual codes it isn't clear how they should be separated.. with comma? with space?

@andersburla
Copy link
Contributor

Hi Bjarne
Your second comment is more an enhancement than a bug. Could you make a new issue. Thanks.

@andersburla
Copy link
Contributor

Have you tried to use MS SQL and see if that works. Just to be sure if it is the SQL CE that make problems.

@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 13, 2015

Hi Anders

I think it was a bit confusing because you can add discount codes, but you can't edit them (and see them without downloading the txt file). And I think I got the error, when adding an empty code and click on download (or just download before codes were added).

I think I got the error when using SQL CE - I'll check it later or in this weekend.

@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 15, 2015

When I SQL CE locally in Umbraco 7 and click generate for a discount code rule, I get this error:

POST http://localhost:34226/umbraco/backoffice/teacommerce/discountcodes/generate 500 (Internal Server Error)

Response from server:

{"Message":"An error has occurred.","ExceptionMessage":"The specified argument value for the function is not valid. [ Argument # = 1,Name of function(if known) = isnull ]","ExceptionType":"System.Data.SqlServerCe.SqlCeException","StackTrace":"   at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)\r\n   at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()\r\n   at TeaCommerce.Api.Persistence.Database.<Query>d__c`1.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at TeaCommerce.Api.Persistence.Marketing.Repositories.DiscountCodeRepository.GetInternal(String sql, Object[] args)\r\n   at TeaCommerce.Api.Persistence.Marketing.Repositories.DiscountCodeRepository.GetAll(Int64 storeId, Nullable`1 ruleId)\r\n   at TeaCommerce.Api.Marketing.Services.DiscountCodeService.Generate(Int64 storeId, Int64 ruleId, Int32 numberToGenerate, Nullable`1 maxUses, Int32 length, String prefix, String postfix)\r\n   at TeaCommerce.Umbraco.Application.Controllers.DiscountCodesController.Generate(GeneratePostData postData)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()\r\n   at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}

I think it a SQL CE thing, when generating the discount codes.

@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 15, 2015

It is a similar issue first time you add a discount code rule before you have added any discount codes.

2015-02-15_18-56-40
2015-02-15_18-57-24

Response from server:

{"Message":"An error has occurred.","ExceptionMessage":"The specified argument value for the function is not valid. [ Argument # = 1,Name of function(if known) = isnull ]","ExceptionType":"System.Data.SqlServerCe.SqlCeException","StackTrace":"   at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)\r\n   at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()\r\n   at TeaCommerce.Api.Persistence.Database.<Query>d__c`1.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at TeaCommerce.Api.Persistence.Marketing.Repositories.DiscountCodeRepository.GetInternal(String sql, Object[] args)\r\n   at TeaCommerce.Api.Persistence.Marketing.Repositories.DiscountCodeRepository.GetAll(Int64 storeId, Nullable`1 ruleId)\r\n   at TeaCommerce.Api.Marketing.Services.DiscountCodeService.GetAll(Int64 storeId, Nullable`1 ruleId)\r\n   at TeaCommerce.Umbraco.Application.Controllers.DiscountCodesController.GetCount(Int64 storeId, Int64 ruleId)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()\r\n   at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}

but I am not sure you want to support SQL CE? .. I mostly use it only for test purposes and easy setup, but in that case it seems to have some issues when using SQL CE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants