Hey GManiac,
Sorry for the late reply. Lets see if I can help out here.
How To Insert Code Directly Into XSLTExtensionBase.cs In The Core
First open up XSLTExtensionBase.cs in Visual Studio or whatever you like to use.
Word of warning - my lines maybe different so look for the code I reference around over line numbers.
Now you can put ChrisMartz's code anywhere after line 122 (within reason) this is because this is when the class really starts.
Code:
public class XSLTExtensionBase
However you want the customer information so we want to place this new code after the customer has been assigned.
Now I like to keep the code tidy so we will find another item along the same lines.
In my code line 3716 seems to have a nice space and around the correct area for this code.
I suggest pasting the code before
Code:
public virtual string GetCustomerLevelPrice(String sVariantID, string sPrice, String sPoints)
Now once that is done rebuild the Core and you can start to use the price to - from as ChrisMartz's said
Code:
<xsl:value-of select="aspdnsf:GetProductPrice(ProductID)" disable-output-escaping="yes"/>
How To Insert Code As App_Code Outside The Core
Why would you do this? Because you do not need to do a rebuild, you also can upgrade your version of ASPDNSF with less problems (because all your mods are outside the Core!)
Now because we like to be tidy first create a folder inside App_Code called "custom". Just makes it easier to find in the future.
Now create a new C# Class and lets call it pricing.cs, the reason for this name is so you know it is your custom code and it is to do with prices, now in the future you can extend your custom pricing features/abilities.
First thing, set up your page.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using AspDotNetStorefrontCore;
using System.Text;
/// <summary>
/// Code for custom pricing and price extensions
/// App_Code help by DotNetDevelopments
/// </summary>
public class pricing
{
}
Now this code is not correct, you need to add one more thing inside the code (by inside the code I mean inside public class pricing curly brackets.)
Add this
Code:
#region Basic Setup
public pricing() { }
#endregion
I like to use the regions to keep it tidy, you don't need to worry about this so just leave it and hide it away.
Now if you just pasted the code after the endregion it would not work, this is because ThisCustomer is no where to be found.
The problem is anywhere that says
The real simple fix is to do a find and replace on ThisCustomer for:
Problem solved!
This code is now all ready to go!
All you need to do now is reference it in the web.config.
Go to the web.config file and do a search for
Code:
<xsltobjects defaultExtension="">
There should be one already there
Code:
<add name="receipt" namespace="urn:receipt" type="ReceiptXsltExtension, app_code">
</add>
Under this add
Code:
<add name="Pricing" namespace="urn:Pricing" type="pricing, app_code">
</add>
Now save your web.config.
Almost there now!
Open up the XML package you wish to use this new code in, as we have not put this in the core we can not access it via aspdnsf:
After your first PackageTransform you will have the next line that looks like this
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
Change this line to
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" xmlns:p="urn:Pricing" exclude-result-prefixes="aspdnsf">
All we are adding is
Code:
xmlns:p="urn:Pricing"
now we can use anything inside pricing.cs by using p:
So now to use this code all you need to do is:
Code:
<xsl:value-of select="p:GetProductPrice(ProductID)" disable-output-escaping="yes"/>
All done!
Need anything just ask!