Automating the 'From' Label

Posted By Tiggywiggler Mon 11 Aug 2014
Add to Favorites0
Author Message
Tiggywiggler
 Posted Mon 11 Aug 2014
Supreme Being

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

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
I have posted in the technical issues section that there is a problem with the calculation of minimum price for products, the proposal here uses that updated code but is unrelated to that problem.

I saw that you can put the text 'From' before the price of products. This is great if a product has multiple versions or options but if it only has one price (or the options or versions are all the same price) I wanted the 'From' to not display in these cases. To this end I have written new code which I would like to submit.

Now the configuration option [frontend.products.display.fromprice] has a new option 'a' which stands for 'Automatic'. To make this work I have had to modify some SQL Scripts (some were just to fix the 'From' problem mentioned before), create three new scripts, make a change to kartrisproductsdata.xsd and modified some VB blocks.

My question is how do I share the code I have written so that the community can use it as I cannot attach source code or zip files to the post please?

Code & modules I have written or modified are:
ProductTemplateShortened.ascx
ProductTemplateNormal.ascx
ProductTemplateTabular.ascx
CategoryProductsView.ascx
FeaturedProducts.ascx

kartrisproductsdata.xsd

ProductsBLL.vb

fnKartrisProduct_GetMinPrice.sql
fnKartrisProduct_GetMinPriceWithCG.sql
fnKartrisProduct_GetMaxPrice.sql
fnKartrisProduct_GetMaxPriceWithCG.sql
spKartrisProducts_GetFeaturedProducts.sql
spKartrisProducts_GetMaxPriceWithCG.sql
spKartrisProducts_GetRowsBetweenByCatID.sql


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 11 Aug 2014 by Tiggywiggler
Paul
 Posted Mon 11 Aug 2014
große Käse

große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)große Käse - (450,028 reputation)

Group: Administrators
Last Active: Fri 15 Sep 2023
Posts: 806, Visits: 2,737
It should be possible to upload a zip to posts. If you click the 'attach' button on the HTML editor toolbar, you might find you need to escape and then click again for the upload dialog to be visible (not sure why this is, but certainly does this in firefox).

--
If my post solves your issue, can you 'Mark as Answer' so it's easier for other users to find in future.

If you would like to be informed of new features, new releases, developments and occasional special bonuses, please sign up to our mailing list: http://bit.ly/19sKMZb
Tiggywiggler Marked As Answer
 Posted Mon 11 Aug 2014
Supreme Being

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

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
You are quite right. Sorry for the error on my part.

I have attached the file containing all of the changes I have made. Below is a list of the changes so that if the people at Kartris decided to make it permanent they can see what changes are required.

To allow the 'From' label to be automatic we need to know if there is only one price or a range of prices. To this end the database, which currently delivers the minimum item price also needs to deliver the maximum item price. There is a problem with the minimum price SQL scripts though in that they do not allow for options and as options can have negative adjustments the price can be below the standard price. To this end I have editted the minimum price scripts.

So these two scripts have been changed to add the Options costs as well:
fnKartrisProduct_GetMinPrice.sql
fnKartrisProduct_GetMinPriceWithCG.sql

These scripts have been added to give us a maximum price (including options prices):
fnKartrisProduct_GetMaxPrice.sql
fnKartrisProduct_GetMaxPriceWithCG.sql
spKartrisProducts_GetMaxPriceWithCG.sql

These script have had to be editted to deliver the results from the new functions that calculate the maximum price so that we have the minimum price and maximum price in the same table:
spKartrisProducts_GetRowsBetweenByCatID.sql
spKartrisProducts_GetFeaturedProducts.sql

Now that the database is sorted we need to read this data into the tables in the data access layer. The required changes are (1) Add column [MaxPrice] and (2) add call to stored procedure for GetMaxPricewithCG_s. To do this we need to add the new field and call to the XML Schema:
kartrisproductsdata.xsd

To allow us to access this new field from the code behind in our user controls and pages we have the change the business logic layer too so we add GetMaxPriceByCG to:
ProductsBLL.vb

Now we have to request this new column in the pages that request the data from the business logic layer, hence MaxPrice column and currency conversion calls are made in:
CategoryProductsView.ascx
FeaturedProducts.ascx

Then the controls that actually display the data need to have new code added to their code behind to read the MaxPrice and either show or display the 'From' label. They are:
ProductTemplateShortened.ascx
ProductTemplateNormal.ascx
ProductTemplateTabular.ascx

Lastly we need to add the new configuration choice to the database so that users can select 'a' for Automatic on the price label. We make a change in the configuration table (dbo.tblKartrisConfig) in the database for the row:
[frontend.products.display.fromprice]
and change the field [CFG_DisplayInfo] to 'y|p|n|a' and then add something into [CFG_Description] to explain this to the customer admin. In my case it reads 'Whether to show a 'From' price on product display: y = From $X.XX, p = $X.XX (i.e. price only), n = No display, a = automatic'.

I do not have the power pack (although I would like it so I may buy it soon) so I cannot tell you what changes may need to be made in that as well, and I may have missed some modules out which I will update as I find errors but I am sure this is enough for anyone to get started with.

Files attached.

Editted to add image of it working.


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.
 Kartris.zip (0 views, 30.98 KB)
 11-08-2014 18-52-55.jpg (2 views, 123.62 KB)
Mon 11 Aug 2014 by Tiggywiggler

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top