In the manage there is a screen showing all products on Sale.
Is there an page on the site that shows the same information ?
In the manage there is a screen showing all products on Sale.
Is there an page on the site that shows the same information ?
If you map all sales items to a sales category, there is
I have all the sales items mapped to a specific category. It's a very popular category
Yes you are right but I don't see the point of creating a new categories when the information is already there.
- If a product is on Sale then the sale price is not null
- Furthermore of each product we already have a flag to specify which sales it is included in (Sales Prompts)
I thought that a "on-sale.aspx" page whould exisit in the same way "bestsellers.aspx" or "recentadditions.aspx" are.
Last edited by major; 02-12-2008 at 08:55 AM. Reason: typo
I like that logic. I bet there is a way to make it happen, without all the 'leg work'.
However, I'm new at this storefront and am only beginning to climb the learning curve.
I would like this too as mapping is a bit of a PITB and if an item goes off sale, then the mapping would be out of place...
if saleprice != 0
it seems like this would be a resource heavy function. Each time the page is called, the conditions would have to be run against all items in the cart. If you have a lot of items, this could be very time/CPU consuming. Maybe a cron (or similar function) set to run at 3am or a slow time could accomplish this and save the function from being called each time...
just thinking out loud, but I do like the idea.
Hello everyone,
Here is a basic example of an On Sale page you can easily add to your website. It shows only products that are on sale including the regular price (with a slash through it - you can change that style in the XmlPackage) and the sale price in red.
It's simply a copy of the Recent Additions page and XmlPackage with some modifications including the ability to display thumbnails of the product images and it has two additional columns for Price and Sale Price.
Step 1: Unzip the Attachment
Unzip the attachment which contains the three files you need.
Step 2: The XML Package
Place the XML Package (page.onsale.xml.config) in your XmlPackages or Skin_n\XmlPackages folder.
Step 3: The On Sale Page
Place the On Sale page (onsale.aspx AND onsale.aspx.cs) in the root folder of your website.
There are plenty of other layouts you could easily create with modifications to the XmlPackage.
Test Your New On Sale Page
Just visit http://www.yourdomain.com/onsale.aspx (where yourdomain is the domain of your website) to see the results.
I hope you find it useful.
Anthony
Fast Internet Success
http://www.fastinternetsuccess.com
We work hard for your business, and even harder for your Internet success!
Last edited by FastInternetSuccess; 03-11-2008 at 12:58 PM. Reason: First post...Signature wasn't appearing.
Great post FastInternetSuccess. This can be further simplified buy just using the built in ability to execute a package directly using the page name e-xmlpackagefilename.aspx. So in your example you could call the page e-page.onsale.aspx. If you just named your package onsale.xml.config then you could use the url e-onsale.aspx. To call a package this way you must set the allowengine attribute on the <package> element to true.
I created my own On Sale package and page a few days ago, much like the method FastInternetSuccess has used.
What would be the benefit of calling the XMLpackage directly?
As far as I know:
Pros of using engine:
- You don't have to create an .aspx page on the root directory of you website. Everything is in your skin directory.
Cons of using engine:
- For SEO I think it is better onsale.aspx then e-onsale.aspx
The code is very nice! Thank you so much for this. It is really helpful for newbies like me!
way too cool Fast Internet Success
thats an excellent example!
something that the system need to have built-in or the support staff had to give us years ago!
thanks for your help!
I am running IS and tried to use your On Sale files however when I try to access the sale page I get the following error:
Exception=Procedure or function 'aspdnsf_GetProducts' expects parameter '@CategoryCode', which was not supplied.
Any suggestions? Thanks.
I modified the xml.config file with the following settings:
@CategoryCode = 1, @StatsFirst = 0, @DepartmentCode = 0, @ManufacturerCode = 0, @WebSiteCode = 0, @CurrentDate = 0
So now I get the message that there are "no items on sale at this time". I beleive that one or more of these settings must be incorrect as I have several items in stock that are flagged with promotional pricing. Does anyone happen to have any advice from here? Thanks.
Thanks for posting this method of creating a Sales Page. My client asked for this first up and I was highly surprised that there was not one as standard in the cart package, so this saved me.
My only problem now though is that my client has over 30 items that are 'on sale' in his shopping cart database and by using this Onsale page which was borrowed from the Recent Additions page code it does not have a paging control, so only one page worth of sale items is showing.
I am new to asp.net and have been learning VB, not C#, and not only that, XML content is a whole new ball game to me. I can see the SQL query but I do not know how it all links together. Could anybody modify the Onsale Page to include a Paging Control for me please?
I'm sure it's simple for somebody here and considering my client's website and cart was launched before I even realised, I am having my ear chewed to get it fixed!
Any help is highly appreciated.
Cheers guys.
Ok guys. After studying it for a few days I worked out what it needed.
Code:<?xml version="1.0" encoding="utf-8" ?> <package displayname="On Sale Items" version="2.1" debug="false" allowengine="true"> <!-- ###################################################################################################### --> <!-- Copyright AspDotNetStorefront.com, 1995-2007. All Rights Reserved. --> <!-- http://www.aspdotnetstorefront.com --> <!-- For details on this license please visit the product homepage at the URL above. --> <!-- THE ABOVE NOTICE MUST REMAIN INTACT. --> <!-- --> <!-- ###################################################################################################### --> <!-- ###################################################################################################### --> <!-- ENHANCEMENTS BY: Anthony Tanner of Fast Internet Success --> <!-- QUick and Easy On Sale XMLPackage for AspDotNetStorefront --> <!-- ###################################################################################################### --> <query name="Products" rowElementName="Product"> <sql> <![CDATA[ exec aspdnsf_GetProducts @OnSaleOnly = 1, @StatsFirst = 0, @pagenum = @pgnum ]]> </sql> <queryparam paramname="@pgnum" paramtype="request" requestparamname="pagenum" sqlDataType="int" defvalue="1" validationpattern="" /> </query> <PackageTransform> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf"> <xsl:output method="html" omit-xml-declaration="yes" /> <xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" /> <xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" /> <xsl:param name="ShowPicsHeight"><xsl:value-of select="aspdnsf:AppConfigBool('RecentAdditionsShowPicsHeight')"/></xsl:param> <xsl:param name="ShowPics"><xsl:value-of select="aspdnsf:AppConfigBool('RecentAdditionsShowPics')"/></xsl:param> <xsl:param name="ProductCount" select="count(/root/Products/Product)" /> <xsl:param name="BaseURL"> <xsl:choose> <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'category'"> c-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx </xsl:when> <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'section'"> s-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx </xsl:when> <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'manufacturer'"> m-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx </xsl:when> <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'library'"> l-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx </xsl:when> </xsl:choose> </xsl:param> <xsl:param name="CurrentPage"> <xsl:choose> <xsl:when test="/root/QueryString/pagenum"> <xsl:value-of select="/root/QueryString/pagenum" /> </xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:param> <xsl:template match="/"> <xsl:choose> <xsl:when test="$ProductCount > 0"> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <xsl:attribute name="style">border-style: solid; border-width: 0px; border-color: #<xsl:value-of select="aspdnsf:AppConfig('HeaderBGColor')" /></xsl:attribute> <tr> <td align="left" valign="top"> <xsl:choose> <xsl:when test="count(/root/Products2/Product/pages) = 0 and count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/Entity) = 0"> <xsl:value-of select="aspdnsf:Topic(concat('empty', /root/Runtime/EntityName, 'text'))" disable-output-escaping="yes" /> </xsl:when> <xsl:otherwise> <div style="text-align:right;"> <xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /> </div> </xsl:otherwise> </xsl:choose> <img src="{aspdnsf:LocateImageURL(concat('skins/Skin_', /root/System/SkinID, '/images/sale.gif'))}" border="0" /><br/> <table width="100%" cellpadding="4" cellspacing="0" border="0"> <xsl:attribute name="style"><xsl:value-of select="aspdnsf:AppConfig('BoxFrameStyle')" /></xsl:attribute> <tr> <td align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="1" width="100%"> <tr> <td align="left"><b><xsl:value-of select="aspdnsf:StringResource('recentadditions.aspx.2')" disable-output-escaping="yes" /></b></td> <td align="center"><b><xsl:value-of select="aspdnsf:StringResource('recentadditions.aspx.4')" disable-output-escaping="yes" /></b></td> <td align="center"><b><xsl:value-of select="aspdnsf:StringResource('AppConfig.CategoryPromptSingular')" disable-output-escaping="yes" /></b></td> <td align="Right"><b>Regular Price</b></td> <td align="Right"><b>Sale Price</b></td> </tr> <tr><td colspan="5" height="4" width="100%"><img src="images/spacer.gif" height="1" width="1" /></td></tr> <xsl:apply-templates select="/root/Products/Product"></xsl:apply-templates> </table> </td> </tr> <tr><td colspan="5">*</td></tr> </table> <xsl:choose> <xsl:when test="count(/root/Products2/Product/pages) = 0 and count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/Entity) = 0"> <xsl:value-of select="aspdnsf:Topic(concat('empty', /root/Runtime/EntityName, 'text'))" disable-output-escaping="yes" /> </xsl:when> <xsl:otherwise> <div style="text-align:right;"> <xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /> </div> </xsl:otherwise> </xsl:choose> </td> </tr> </table> </xsl:when> <xsl:otherwise> <p align="left"><b>There are no items on sale at this time, please check back soon.</b></p> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="Product"> <xsl:param name="pName"> <xsl:choose> <xsl:when test="count(ProductName/ml/locale[@name=$LocaleSetting])!=0"> <xsl:value-of select="Name/ml/locale[@name=$LocaleSetting]"/> </xsl:when> <xsl:when test="count(ProductName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 "> <xsl:value-of select="Name/ml/locale[@name=$WebConfigLocaleSetting]"/> </xsl:when> <xsl:when test="count(ProductName/ml)=0"> <xsl:value-of select="Name"/> </xsl:when> </xsl:choose> </xsl:param> <xsl:param name="vName"> <xsl:choose> <xsl:when test="count(VariantName/ml/locale[@name=$LocaleSetting])!=0"> <xsl:value-of select="VariantName/ml/locale[@name=$LocaleSetting]"/> </xsl:when> <xsl:when test="count(VariantName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 "> <xsl:value-of select="VariantName/ml/locale[@name=$WebConfigLocaleSetting]"/> </xsl:when> <xsl:when test="count(VariantName/ml)=0"> <xsl:value-of select="VariantName"/> </xsl:when> </xsl:choose> </xsl:param> <xsl:param name="ProductName"><xsl:value-of select="$pName" /><xsl:if test="$vName!=''"><xsl:value-of select="concat(' - ', $vName)" /></xsl:if></xsl:param> <xsl:param name="ProductSKU"><xsl:value-of select="SKU" /><xsl:if test="SKUSuffix!=''"><xsl:value-of select="concat(' - ', SKUSuffix)" /></xsl:if></xsl:param> <tr> <td align="left" valign="middle"> <xsl:if test="$ShowPics='true'"> <div style="float:left;padding-right:10px;"> <a href="{aspdnsf:ProductLink(ProductID, SEName, 0, '')}"> <img src="{aspdnsf:ProductImageUrl(ProductID, ImageFilenameOverride, SKU, 'icon', 1)}" border="0" align="absmiddle"> <xsl:if test="$ShowPicsHeight!='' and $ShowPicsHeight!=0"> <xsl:attribute name="height">85</xsl:attribute> </xsl:if> </img> </a>*</div> </xsl:if> <xsl:value-of select="aspdnsf:ProductLink(ProductID, SEName, 1, $ProductName)" disable-output-escaping="yes" /> </td> <td align="center" valign="middle"><xsl:value-of select="$ProductSKU" /></td> <td align="center" valign="middle"><xsl:value-of select="aspdnsf:ProductEntityList(ProductID, 'category')" disable-output-escaping="yes" /></td> <td align="right" valign="middle"><span style="text-decoration: line-through"><xsl:value-of select="aspdnsf:FormatCurrency(Price, LocaleSetting)" disable-output-escaping="yes" /></span></td> <td align="right" valign="middle"><span style="color:red"><xsl:value-of select="aspdnsf:FormatCurrency(SalePrice, LocaleSetting)" disable-output-escaping="yes" /></span></td> </tr> <tr><td colspan="5" height="1" width="100%" class="LightCell"><img src="images/spacer.gif" height="1" width="1" /></td></tr> </xsl:template> </xsl:stylesheet> </PackageTransform> </package>
I strongly suggest an on-sale.aspx page be added just as is a bestsellers.aspx page for multi-store. This is a serious need in this software. Absolutely necessary for any serious website.
First off I am running:
AspDotNetStorefront ML 8.0.1.2/8.0.1.2
I have uploaded;
onsale.aspx
onsale.aspx.cs
into my root folder and uploaded:
page.onsale.xml
into /XmlPackages/ (not in skins/Skin_1/XmlPackages/)
Here is what is in each doc:
onsale.aspx
onsale.aspx.csCode:<%@ Page language="c#" Inherits="AspDotNetStorefront.onsale" CodeFile="onsale.aspx.cs" %> <%@ Register TagPrefix="aspdnsf" TagName="XmlPackage" src="XmlPackageControl.ascx" %> <html> <head> </head> <body> <aspdnsf:XmlPackage ID="XmlPackage1" PackageName="page.onsale.xml.config" runat="server" EnforceDisclaimer="true" EnforcePassword="True" EnforceSubscription="true" AllowSEPropogation="True" /> </body> </html>
page.onsale.xml.configCode:using System; using System.Web; using AspDotNetStorefrontCommon; namespace AspDotNetStorefront { /// <summary> /// Summary description for onsale. /// </summary> public partial class onsale : SkinBase { protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } // this may be overwridden by the XmlPackage below! SectionTitle = "On Sale"; // set the Customer context, and set the SkinBase context, so meta tags to be set if they are not blank in the XmlPackage results XmlPackage1.SetContext = this; } } }
This was all provided nothing changed from the zip file given by Fast Internet Success. After uploading these I receive this error when I try and access the page via this url http://www.yourdomain.com/onsale.aspx (of course it is not yourdomain )Code:<?xml version="1.0" encoding="utf-8" ?> <package displayname="On Sale Items" version="2.1" debug="false" allowengine="true"> <query name="Products" rowElementName="Product"> <sql> <![CDATA[ exec aspdnsf_GetProducts @OnSaleOnly = 1, @StatsFirst = 0 ]]> </sql> </query> <PackageTransform> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf"> <xsl:output method="html" omit-xml-declaration="yes" /> <xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" /> <xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" /> <xsl:param name="ShowPicsHeight"><xsl:value-of select="aspdnsf:AppConfigBool('RecentAdditionsShowPicsHeight')"/></xsl:param> <xsl:param name="ShowPics"><xsl:value-of select="aspdnsf:AppConfigBool('RecentAdditionsShowPics')"/></xsl:param> <xsl:param name="ProductCount" select="count(/root/Products/Product)" /> <xsl:template match="/"> <xsl:choose> <xsl:when test="$ProductCount > 0"> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <xsl:attribute name="style">border-style: solid; border-width: 0px; border-color: #<xsl:value-of select="aspdnsf:AppConfig('HeaderBGColor')" /></xsl:attribute> <tr> <td align="left" valign="top"> <table width="100%" cellpadding="4" cellspacing="0" border="0"> <xsl:attribute name="style"><xsl:value-of select="aspdnsf:AppConfig('BoxFrameStyle')" /></xsl:attribute> <tr> <td align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="1" width="100%"> <tr> <td align="left"><b><xsl:value-of select="aspdnsf:StringResource('recentadditions.aspx.2')" disable-output-escaping="yes" /></b></td> <td align="center"><b><xsl:value-of select="aspdnsf:StringResource('recentadditions.aspx.4')" disable-output-escaping="yes" /></b></td> <td align="center"><b><xsl:value-of select="aspdnsf:StringResource('AppConfig.CategoryPromptSingular')" disable-output-escaping="yes" /></b></td> <td align="Right"><b>Regular Price</b></td> <td align="Right"><b>Sale Price</b></td> </tr> <tr><td colspan="5" height="4" width="100%"><img src="images/spacer.gif" height="1" width="1" /></td></tr> <xsl:apply-templates select="/root/Products/Product"></xsl:apply-templates> </table> </td> </tr> <tr><td colspan="5"> </td></tr> </table> </td> </tr> </table> </xsl:when> <xsl:otherwise> <p align="left"><b>There are no items on sale at this time, please check back soon.</b></p> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="Product"> <xsl:param name="pName"> <xsl:choose> <xsl:when test="count(ProductName/ml/locale[@name=$LocaleSetting])!=0"> <xsl:value-of select="Name/ml/locale[@name=$LocaleSetting]"/> </xsl:when> <xsl:when test="count(ProductName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 "> <xsl:value-of select="Name/ml/locale[@name=$WebConfigLocaleSetting]"/> </xsl:when> <xsl:when test="count(ProductName/ml)=0"> <xsl:value-of select="Name"/> </xsl:when> </xsl:choose> </xsl:param> <xsl:param name="vName"> <xsl:choose> <xsl:when test="count(VariantName/ml/locale[@name=$LocaleSetting])!=0"> <xsl:value-of select="VariantName/ml/locale[@name=$LocaleSetting]"/> </xsl:when> <xsl:when test="count(VariantName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 "> <xsl:value-of select="VariantName/ml/locale[@name=$WebConfigLocaleSetting]"/> </xsl:when> <xsl:when test="count(VariantName/ml)=0"> <xsl:value-of select="VariantName"/> </xsl:when> </xsl:choose> </xsl:param> <xsl:param name="ProductName"><xsl:value-of select="$pName" /><xsl:if test="$vName!=''"><xsl:value-of select="concat(' - ', $vName)" /></xsl:if></xsl:param> <xsl:param name="ProductSKU"><xsl:value-of select="SKU" /><xsl:if test="SKUSuffix!=''"><xsl:value-of select="concat(' - ', SKUSuffix)" /></xsl:if></xsl:param> <tr> <td align="left" valign="middle"> <xsl:if test="$ShowPics='true'"> <div style="float:left;padding-right:10px;"> <a href="{aspdnsf:ProductLink(ProductID, SEName, 0, '')}"> <img src="{aspdnsf:ProductImageUrl(ProductID, ImageFilenameOverride, SKU, 'icon', 1)}" border="0" align="absmiddle"> <xsl:if test="$ShowPicsHeight!='' and $ShowPicsHeight!=0"> <xsl:attribute name="height">85</xsl:attribute> </xsl:if> </img> </a> </div> </xsl:if> <xsl:value-of select="aspdnsf:ProductLink(ProductID, SEName, 1, $ProductName)" disable-output-escaping="yes" /> </td> <td align="center" valign="middle"><xsl:value-of select="$ProductSKU" /></td> <td align="center" valign="middle"><xsl:value-of select="aspdnsf:ProductEntityList(ProductID, 'category')" disable-output-escaping="yes" /></td> <td align="right" valign="middle"><span style="text-decoration: line-through"><xsl:value-of select="aspdnsf:FormatCurrency(Price, LocaleSetting)" disable-output-escaping="yes" /></span></td> <td align="right" valign="middle"><span style="color:red"><xsl:value-of select="aspdnsf:FormatCurrency(SalePrice, LocaleSetting)" disable-output-escaping="yes" /></span></td> </tr> <tr><td colspan="5" height="1" width="100%" class="LightCell"><img src="images/spacer.gif" height="1" width="1" /></td></tr> </xsl:template> </xsl:stylesheet> </PackageTransform> </package>
Here is the error I receive:
Any help will be useful! If I figure it out first I will post how I figured it out, thank you in advance!Compiler Error Message: CS0103: The name 'AppLogic' does not exist in the current context
Source Error:
Line 18: protected void Page_Load(object sender, System.EventArgs e)
Line 19: {
Line 20: if (AppLogic.AppConfigBool("GoNonSecureAgain"))
Line 21: {
Line 22: SkinBase.GoNonSecureAgain();
Source File: d:\Domains\archerycenter.com\wwwroot\onsale.aspx.c s Line: 20
Okay I found out what was going on.... it was real simple once I thought about it. I can't believe that I didn't realize it earlier.
If you run into the same problem, here is how I solved it.
Open onsale.aspx.cs
add this to the top:
That's it! I didn't have enough libraries being called, hope this helps someoneCode:using AspDotNetStorefrontCore;
I downloaded this and installed.
I get an error when accessing /onsale.aspx
Parser Error Message: The file '/XmlPackageControl.ascx' does not exist.
Source Error:
Line 1: <%@ Page language="c#" Inherits="AspDotNetStorefront.onsale" CodeFile="onsale.aspx.cs" %>
Line 2: <%@ Register TagPrefix="aspdnsf" TagName="XmlPackage" src="XmlPackageControl.ascx" %>
Line 3: <html>
Line 4: <head>
Is there any way to use this technique and display the sale items on the homepage?
Thanks,
JD