Is there a way to add some text before the "Size" dropdown without modifying the source code?
Is there a way to add some text before the "Size" dropdown without modifying the source code?
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.
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
What are you wanting to change it to? and again will you be wanting this to apply to all products or just this one?
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.
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