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: AddToCart Form

  1. #1
    jdudley is offline Member
    Join Date
    Oct 2007
    Posts
    54

    Default AddToCart Form

    Is there a way to add some text before the "Size" dropdown without modifying the source code?
    Attached Images Attached Images  

  2. #2
    John Reasons is offline Senior Member
    Join Date
    Oct 2009
    Posts
    119

    Default

    Are you wanting the change to show up on all products, meaning use the same text for all products with a size option? can change the string resources

    AppConfig.SizeOptionPrompt

    Or if you want only for the specific product on the base product use the following.

    Size Option Prompt:
    Last edited by John Reasons; 03-05-2010 at 08:49 AM.

  3. #3
    jdudley is offline Member
    Join Date
    Oct 2007
    Posts
    54

    Default

    That changes whats in the drop down. I want to add text to the left side of the dropdown like the picture shows the "Select:" text

  4. #4
    John Reasons is offline Senior Member
    Join Date
    Oct 2009
    Posts
    119

    Default

    What are you wanting to change it to? and again will you be wanting this to apply to all products or just this one?

  5. #5
    Mike The Last Boyscout is offline User
    Join Date
    Nov 2008
    Posts
    254

    Default

    The content within that box is generated by the AddToCard form, as you mentioned. Anything beyond the styling of it that you wished to edit would require source code modification to accomplish.

  6. #6
    joe.loutzenhiser is offline Junior Member
    Join Date
    Jan 2008
    Location
    Ashland, OR
    Posts
    18

    Default Not exactly easy, but it might work

    There's a bit of voodoo you can do with encoding and string replacement that might get you what you want. It already appears you've made some changes to the AddToCartForm, or at least the CSS the styles it, so your mileage may vary.

    We're going to find the HTML for the select drop down in the AddToCartForm and replace it with the exact same text but with your "Select: " concatenated onto the front.

    Something like this:

    <xsl:variable name="findToken" select="'<select size="1" name="Size"'" />
    <xsl:variable name="replaceToken" select="concat('Select: ', $findToken)" />
    <xsl:value-of select="aspdnsf:StrReplace(aspdnsf:AddtoCartForm(P roductID, VariantID, 1), $findToken, $replaceToken)" disable-output-escaping="yes"/>

    The first variable findToken is the text string we're going to use to identify the HTML select drop down (I didn't use the whole select text, and in your case it might be different, but you can view the source in the browser to find what your HTML looks like and modify what's here). It's all encoded to make it through the XSLT parser.

    Same goes for replaceToken, but now its got the "Select :" on the front.

    Now we use the ExtensionBase function StringReplace to the HTML select string with your new one that has "Select :" on the front.

    Hope this proves useful. It's not easy, but otherwise you're off into Core source modifying the AddtoCartForm.

    P.S.: I just noticed that the code above is having a space inserted that I can't seem to remove by editing. It's in the call to the AddtoCartForm, putting a space into the ProductID. You don't need that.
    Last edited by joe.loutzenhiser; 03-05-2010 at 05:36 PM. Reason: Added note about code formatting.
    Vortx - DevNet partner
    http://www.vortx.com