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

Thread: display: none on add to cart

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default display: none on add to cart

    I would like to show set display: none; on a div when the add to cart button is pushed. Where in the code would I put this?

  2. #2
    valentim is offline Senior Member
    Join Date
    Apr 2006
    Posts
    192

    Default

    The button is part of the html that's constructed in the ShoppingCart.cs class GetAddToCartForm function.

    If you have source code you could modify this code to do what you want. However, we like to use other solutions instead of changing source.

    We like to use JQuery for this type of modification. You could use JQuery to attach a javascript event to the add to cart button click. There's no change to source or your XMLPackage using this technique.

    Another option is (in your product XMLPackage) to write the aspdnsf:AddtoCartForm to a variable and then do a aspdnsf:StrReplace to include a javascript onclick event. You could add a javascript function to your XMLPackage as required.
    Matthew
    Aydus Consulting
    Strategy+Development+Design=The Aydus Difference

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    Where would I put javascript in the shoppingcart.cs to make the div display?

  4. #4
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I tried putting onClick=\"alert('Added');return false\" on the actual button in shoppingcart.cs but when I click it, nothing happens. Is something else taking over the click event?

  5. #5
    valentim is offline Senior Member
    Join Date
    Apr 2006
    Posts
    192

    Default

    You're right - the code has changed since last time we implemented an event like this.

    Instead, look at the javascript file:
    \jscripts\product.js

    And this function:
    onButtonClick: function(cartType) {

    It looks like this function fires for add to cart, add to wishlist, add to registry so test for cartType if necessary.
    Matthew
    Aydus Consulting
    Strategy+Development+Design=The Aydus Difference

  6. #6
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    Thanks valentim! I was already working in that file and never looked for that function.