Custom Control - CalculatePrice() Function

Posted By BORNXenon Wed 14 May 2014
Add to Favorites0
Author Message
BORNXenon
 Posted Wed 14 May 2014
Supreme Being

Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)

Group: Forum Members
Last Active: Mon 23 Apr 2018
Posts: 59, Visits: 291
Hi,

While creating my custom control for cut-to-size products, I have noticed that there is a Public Overrides Function at the top of the SampleCustomControl.ascx.vb page called 'CalculatePrice()' which is heavily commented as being required and 'Primarily used to check if stored price in the db/basket is correct, used before checkout code processes an order'.

The only reference to it that I can find (aside from within the Custom Control itself) is in KartrisClasses.vb where it is declared.

My question is, from where is this function called?

Am I supposed to use this function to calculate my custom price, or is it there to double check the price calculated from my own function? Either way, I can't see where it is called (even in the SampleCustomControl.ascx.vb) and it doesn't fire when adding an item to the basket, or at checkout.
Wed 14 May 2014 by BORNXenon
Tiggywiggler Marked As Answer
 Posted Mon 18 Aug 2014
Supreme Being

Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
Born,

I have had a look at this for you and it would appear that this was added and made part of the interface but has not been implemented. I have added these controls to a development site I have and ran all sorts of test and it is never fired.

Instead the method ComputeFromSelectedOptions() is fired so I would suggest that you put your logic into ComputeFromSelectedOptions() and then create an empty implementation of CalculatePrice() and throw an error from it, that way if it ever does get fired the user will get an error and you will be able to deal with it at the time.

Alternatively you could put the required calculations into CalculatePrice() and then use that method in your code for ComputeFromSelectedOptions() where you have to calculate _ItemPrice instead of doing the maths there just call the CalculatePrice() method.

e.g. Instead of:

_ItemPrice = ddlLength.SelectedValue * ddlWidth.SelectedValue

do this:

_ItemPrice = CalculatePrice()

But as said, this is not a requirement.


We are always willing to help out the community or pitch in to help you fix a problem. However, if you want a complete solution made such as a code module or new feature added you have two options. Either
1) Reach out to the Kartris internal development team at http://www.kartris.com/Contact.aspx.
2) Contact one of the Kartris approved partners at http://www.kartris.com/t-Worldwide-Developers.aspx.

Have fun and good luck coding.
Mon 18 Aug 2014 by Tiggywiggler
BORNXenon
 Posted Fri 22 Aug 2014
Supreme Being

Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)

Group: Forum Members
Last Active: Mon 23 Apr 2018
Posts: 59, Visits: 291
I thought as much, I also ran some tests of my own and never once did it fire.Just wanted to double check as the 'go live' date on my store looms ever closer!
Tiggywiggler
 Posted Sat 23 Aug 2014
Supreme Being

Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)Supreme Being - (105,366 reputation)

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
No worries Born, by the way if the reply is the correct answer would you mind clicking the little green tick to mark as answer please? It helps people who come to view it in future to know that the question was answered please.

Have fun coding!


We are always willing to help out the community or pitch in to help you fix a problem. However, if you want a complete solution made such as a code module or new feature added you have two options. Either
1) Reach out to the Kartris internal development team at http://www.kartris.com/Contact.aspx.
2) Contact one of the Kartris approved partners at http://www.kartris.com/t-Worldwide-Developers.aspx.

Have fun and good luck coding.

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top