Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: Generating RSS Feeds from AspDotNetStorefront

  1. #1
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default Generating RSS Feeds from AspDotNetStorefront

    We get this question quite a bit:

    Question: Can I add a RSS product feed to spit out products by a category in AspDotNetStorefront. Or generally, does AspDotNetStorefront support “RSS feeds”.

    Answer: Yes, the storefront knows how to send out RSS feeds, of almost any arbitrary data contents, via this page: rssfeed.aspx

    The way the page works, is it invokes an XmlPackage specified on the query string invocation, like in:

    Http://www.yourdomain.com/rssfeed.aspx?channel=ABC

    And then it invokes the XmlPackage: /xmlpackages/rss.ABC.xml.config to build a data set, and transform it into any valid RSS feed output Xml based on your consumer. Of course "ABC" name is arbitrary, just has to match your package name.

    The XmlPackage then can query anything (just like any XmlPackage) and can also even work off of other QueryString input as well!

    E.g.

    Rssfeed.aspx?channel=getproductsbycat&categoryid=3

    The rss.getproductsbycat.xml.config (you write it) XmlPackage now can query the db for these products (for cat 3) and spit out any product data you wanted. The XmlPackage would pick off the querystring param, build the db query using it, retrieve the product records, and xform into output any product fields you want.

    This works for lots of other types of RSS notifications also.

    This is a very powerful feature, and not well documented, or even know. We literally have 100 features like this that we should explain/document better, so we’re going to make an effort to do this.
    AspDotNetStorefront
    Shopping Cart

  2. #2
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    We get followup question:

    Question: if I've added custom fields, or extensiondata fields, to the db or product tables (or wherever), can I return them out to RSS also?

    Answer: Sure...your RSS XmlPackage can simply pull those fields, and xform them into the output RSS Xml.
    AspDotNetStorefront
    Shopping Cart

  3. #3
    RBrun is offline Member
    Join Date
    Nov 2008
    Posts
    45

    Default Example Available

    This is perfect timing, I came to the forum specifically to see if this was available.

    Is there a simple example available? Even the most rudimentary will get me off in the right direction.

    Thanks,
    Rob

  4. #4
    RBrun is offline Member
    Join Date
    Nov 2008
    Posts
    45

    Default Quick and Dirty Example

    As I am pretty much an XSLT neophyte I fought with this for days trying to make a feed that would work. In the mean time I was also messing with the Google Base feed...

    It finally dawned on me this morning that the feed generated for Google Base was RSS.

    So for a quick start example... copy feed.googlebase.xml.config from your Admin/XMLPackages directory to your /XMLPackages directory as rss.<insertfeednamehere>.xml.config

    In my case this was rss.filteredproducts.xml.config as I intend to modify the query a bit.

    Change the following lines in the xml package

    Code:
    <!-- queryparam paramname="@LowerBound" paramtype="runtime" requestparamname="LowerBound" sqlDataType="int" defvalue="0"  validationpattern="" / -->
    <!-- queryparam paramname="@UpperBound" paramtype="runtime" requestparamname="UpperBound" sqlDataType="int" defvalue="0"  validationpattern="" / -->
    <querystringreplace replaceTag="@LowerBound" replacetype="request" replaceparamname="LowerBound" defvalue="0" validationpattern="^\d{1,10}$" />
    <querystringreplace replaceTag="@UpperBound" replacetype="request" replaceparamname="UpperBound" defvalue="5" validationpattern="^\d{1,10}$" />
    and feed it through rssfeed.aspx as such

    Code:
    http://www.yourdomain.com/rssfeed.aspx?channel=filteredproducts&LowerBound=0&UpperBound=50
    Tah-dah - an RSS feed that is valid. The feed also uses the google base name space so if you are consuming it somewhere else, in my case another of our websites, you will have access to attributes not available in a regular RSS feed.

    The W3C validator at http://validator.w3.org/feed/ will claim the feed is invalid due to one of the google elements, but other validators will give it a thumbs up.

    It is worthwhile validating your results on http://validator.w3.org/feed/ since it will point out a few "recommendations".

    It's not a perfect fit feed by any means, and needs more query options, but the google base xml package is a pretty robust starting point.

    Hope this helps someone!
    Rob

  5. #5
    3DUInc is offline Junior Member
    Join Date
    Sep 2009
    Location
    Seattle
    Posts
    19

    Default

    This helps a lot RBrun, thank you for sharing it. I had earlier set up a feed myself but now after a reinstall and updater it is deleted and was a lot of work to keep up so I thought I would try this, however I cannot figure out where exactly to put the feed link in the config file. I sent you a msg.
    3D Unforgettables, Inc.
    http://www.3dunforgettables.com/
    ...texturing with lasting memories


    Be Good, Be Happy, Be Kind, and Be Positive...Donate to those that are less fortunate then you.

  6. #6
    RBrun is offline Member
    Join Date
    Nov 2008
    Posts
    45

    Default

    Hi 3D, I'm glad this may be helpful to you.

    You've confused me a bit with your question though regarding the feedname in the config file. Could you elaborate?

    The example above should work out of the box giving you an RSS feed that has all of the data contained in a googlebase feed export.

    Rob

  7. #7
    3DUInc is offline Junior Member
    Join Date
    Sep 2009
    Location
    Seattle
    Posts
    19

    Default

    Hi

    Well I was wanting it to not go through google etc, just a feed for my store that has a feed page and gets all products as they are added.

    I was following your instructions:
    ------------------------------
    Change the following lines in the xml package

    Code:

    <!-- queryparam paramname="@LowerBound" paramtype="runtime" requestparamname="LowerBound" sqlDataType="int" defvalue="0" validationpattern="" / -->
    <!-- queryparam paramname="@UpperBound" paramtype="runtime" requestparamname="UpperBound" sqlDataType="int" defvalue="0" validationpattern="" / -->
    <querystringreplace replaceTag="@LowerBound" replacetype="request" replaceparamname="LowerBound" defvalue="0" validationpattern="^\d{1,10}$" />
    <querystringreplace replaceTag="@UpperBound" replacetype="request" replaceparamname="UpperBound" defvalue="5" validationpattern="^\d{1,10}$" />

    and feed it through rssfeed.aspx as such

    Code:

    http://www.yourdomain.com/rssfeed.as...&UpperBound=50

    Tah-dah - an RSS feed that is valid....

    -----------

    However in the xml.config Im not exactly sure what to change and what to change it to. I see the code you are showing, but it is not clear what to change and what to change it to. Hope that makes sense. Sorry, Im still learning these XML's and I get nervous changing things if I dont know exactly what to change, even though I backup etc.

    Sorry for late reply, I think I didnt get notifications enabled.

    Tamela
    3D Unforgettables, Inc.
    http://www.3dunforgettables.com/
    ...texturing with lasting memories


    Be Good, Be Happy, Be Kind, and Be Positive...Donate to those that are less fortunate then you.

  8. #8
    RBrun is offline Member
    Join Date
    Nov 2008
    Posts
    45

    Default

    The example may be a little unclear in that the first two lines are the original lines in the file, but I have commented them out. The second two lines are mean to replace those lines.

    Essentially, this changes the code to run using the url request parameters rather than runtime parameters passed by ASPDNSF when you execute a feed from the admin menu.

    If you make a copy of the orginal googlebase feed file as I specify in the example, then copy the 4 lines in the message above over the top of the original @Lowerbound and @Upperbound lines, this will comment out the old code and insert the replacement code.

    Once that is done, use the example URL, modified for your domain and the name you used when you made a copy of the xml.config file.

    I've attached a zip file containing an rss file modified as I described. Extract it to your /XMLPackages directory and browse to

    <storefronturl>/rssfeed.aspx?channel=gbconversion&LowerBound=0&Upp erBound=50

    Hope this helps,
    Rob
    Attached Files Attached Files

  9. #9
    3DUInc is offline Junior Member
    Join Date
    Sep 2009
    Location
    Seattle
    Posts
    19

    Default

    Hi Rob

    Firstly, thank you so very much for the respond and most definitely the the XML. I cant thank you enough for that, but Im gonna study it and see what I was not understanding before now that you explained it for my head to understand.

    XML's are still a bit tricky for me but I am learning them thanks to ASPDNSF. I think it is their coding that is so confusing for me even though I do CSS and hand code html and am learning JS.

    WOW Thank you again. This I hope is going to make my life easier to feed my products through my site and update the feed. As before I had to do it all with a feed program.

    Thank you again. I will be letting you know after I check it all out.

    Tamela
    3D Unforgettables, Inc.
    http://www.3dunforgettables.com/
    ...texturing with lasting memories


    Be Good, Be Happy, Be Kind, and Be Positive...Donate to those that are less fortunate then you.

  10. #10
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    Additional modifications:

    If you want to show products, newest to oldest, add "DESC" as follows:
    C#/VB.NET Code:
    ROW_NUMBER() OVER (ORDER BY p.productid DESC) AS ROW 
    If you want to add images to your descriptions, add the following in the <xsl:template match="Product"> section:
    C#/VB.NET Code:
    <xsl:param name="ThumbImage" select="aspdnsf:LookupProductImage(productid, ImageFileNameOverride, SKU, 'icon', 0)"></xsl:param
    AND, under the <description> tag add this as follows:
    C#/VB.NET Code:
    <xsl:if test="not(contains($ThumbImage, 'nopicture'))">
                  <
    xsl:value-of select="$ThumbImage/>
                </
    xsl:if>