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 8 of 8

Thread: enhancing the ShowCategory.aspx page

  1. #1
    GoodFella is offline Member
    Join Date
    Mar 2009
    Posts
    99

    Default enhancing the ShowCategory.aspx page

    I am making a custom page most likely off of the Category and/or Manufacturer pages that will display the corresponding products. The category XML package I have in place is the entity.simpleproductlist.xml.config file.

    When the page loads, the "Show Buy Button" should be disabled.

    On the top of this page, there will be an AJAX Cascading Drop Down form that allows the selection of vehicle Make, Model, and Year. Once submitted, a query will run on a new table and all the products shown should be updated showing the appropriate variant and enabling the product to be added to the shopping cart.

    Any ideas of how to get this done? I would think that I would be able to alter the "ShowCategory.aspx" page and re-set the variables the XML package uses.

    Any thoughts?

    Thanks,
    Marc

  2. #2
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    If you're doing this purely on xml package, you can have the submit logic do a redirect to the current page using javascript and specify the filter parameters as querystring.
    Then, on your xml package, you can expect the filter parameters from the querystring by specifying the paramtype as "request". Pass it over your stored procedures so you can filter the product display accordingly.

    Sample Url
    domainname.com?make=xxx&model=yyy

    XmlPackage
    HTML Code:
    <query name="Products" rowElementName="Product">
        <sql>
            <![CDATA[
                exec dbo.GetProductsFiltered(@make, @model, ... other params .... )
            ]]>
        </sql>
    <queryparam paramname="@make" paramtype="request" requestparamname="make" sqlDataType="nvarchar" defvalue="" validationpattern="" />
    <queryparam paramname="@model" paramtype="request" requestparamname="model" sqlDataType="nvarchar" defvalue="" validationpattern="" />
    ... other required parameters .....
    </query>

  3. #3
    GoodFella is offline Member
    Join Date
    Mar 2009
    Posts
    99

    Default

    I want the URL end result to be consistent with what ASPDNSF already does.

    http://www.MyDomain.com/ShowCategory...yID=3&Make=BMW

    which would translate to:

    www.MyDomain.com/C-3-BMW-Product-Name.aspx

    and would have the Make dropdown box already pre-populated accordingly.

  4. #4
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    Yes, you can do this via javascript, compose a url appending the querstring parameters from the values selected on the make and model dropdown upon clicking submit.

    here's a good resource:
    http://davidwalsh.name/javascript-window-location

  5. #5
    GoodFella is offline Member
    Join Date
    Mar 2009
    Posts
    99

    Default

    Thanks. One last question.

    Would you suggest building this as a new/modified XML package

    or

    Building a new aspx page from scratch with out the xml packages?

  6. #6
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    If you're used to working with xml packages, this should be fairly easy enough.
    I would suggest building this off a modified version of the simple product xml package, that way you can still switch to the original as you would prefer.

    If you opt to have a new aspx pages, you can do this via a regular postback of the submit button and fetch the filter data coming from the dropdownlists, although in this case and you won't be using xml packages, you'll have to manually implement the addtocart logic.
    You can't use an xml package with addtocart inside an asp.net form tag since the addtocart extension generates separate <form> for each product on a given page and posts back to a different processing page to add items to the cart.
    One thing you can do to programmatically add items to the cart via url:
    http://forums.aspdotnetstorefront.co...ead.php?t=5771

  7. #7
    GoodFella is offline Member
    Join Date
    Mar 2009
    Posts
    99

    Default

    How hard would it be to make the custom page to do the following:

    1. Display all products (either in a category or by a manufacturer)
    2. Do not show prices or add to cart button initially
    3. Display an AJAX Cascading Drop Down for Make ,Model, Year (already developed)
    4. Apply the variant level to all products and include the price and addtocart button when the Make, Model, and Year combination have been entered. (All products have the same variants. The Make, Model, Year derives this.)

    IE: 2008 BMW 3-Series = Variant #3
    He can choose Product 1 with Variant 3
    or any other product with variant 3.

    5. The URL should be dynamic as well. IE: NewPage.aspx?Make=BMW
    6. I should be able to rename this to NewPage-BMW.aspx

  8. #8
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    1. Display all products (either in a category or by a manufacturer)
    2. Do not show prices or add to cart button initially
    3. Display an AJAX Cascading Drop Down for Make ,Model, Year (already developed)
    4. Apply the variant level to all products and include the price and addtocart button when the Make, Model, and Year combination have been entered. (All products have the same variants. The Make, Model, Year derives this.)
    That shouldn't be too hard, can be achieved by regular asp.net postback and filtering via a custom stored procedure.
    The display would depend on whatever type of UI control you want to use instead be it either gridview, datalist or whatever.


    5. The URL should be dynamic as well. IE: NewPage.aspx?Make=BMW
    6. I should be able to rename this to NewPage-BMW.aspx
    For this, you will need to add custom entries on the urlrewrites section which can be found on the web.config, which is used to evaluate the actual landing page+query strings in place of the dynamic page name.

    You will also need to provide redirection to this page as well since the links from the menu(top and left nav) all point to the default entity pages (showcategory.aspx, showmanufacturer, showsection)

    If you had went through customizing the xml package, most of the work would only be for the page reload upon submit and checking if all the required parameters from the querystring, which is available on the xml package data.

    I assume you're using some kind of ajax enabled asp.net control for the dropdown like the toolkit's cascading dropdown. If that's the case, then having custom aspx page is the way to go. As i've stated earlier, you can't use the addtocart extensions from within inside an asp.net form tag. For the next major release of ML, this won't be the case anymore as we have masterpages and asp.net ajax support baked in.