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

Thread: How to Insert <br> in AddtoCartForm?

  1. #1
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default How to Insert <br> in AddtoCartForm?

    Probably very simple code placement, but this is elluding me.
    I would simply like to place a "<br>"break between the "Add to Cart" and "Add to Wishlist" buttons, so each are on seperate lines. I am using custom buttons, which display just fine, but having them side by side is not desired due to design considerations.
    I find the form constructor in the ShoppingCart.cs source file, but cannot seem to effect the desired change.
    Any suggestions?

  2. #2
    Skriver is offline Senior Member
    Join Date
    Apr 2012
    Posts
    188

    Default

    Is this on your product page?

  3. #3
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default How to Insert <br> in AddtoCartForm?

    Yes, the product page (such as "product.SimpleProduct.xml.config").

  4. #4
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    So you're modifying code in

    Code:
    Public Shared Function GetAddToCartForm(ByVal ThisCustomer As Customer, ByVal forPack As Boolean, ByVal forKit As Boolean, ByVal showWishListButton As Boolean, ByVal showGiftRegistryButton As Boolean, ByVal ProductID As Integer, ByVal VariantID As Integer, ByVal SkinID As Integer, ByVal DisplayFormat As Integer, ByVal LocaleSetting As String, ByVal ColorChangeProductImage As Boolean, ByVal VariantStyle As VariantStyleEnum, ByVal isKit2 As Boolean, ByVal packID As Integer) As String
    but are seeing no result? What exactly did you change?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  5. #5
    Skriver is offline Senior Member
    Join Date
    Apr 2012
    Posts
    188

    Default

    Would the break not be put in the xml package?

    For example the code from ours reads as

    <div class="add_to_cart">
    <table>
    <tr>
    <td>
    <p>Quantity</p>
    <input name="quantity" type="text" value="1" size="20" class="txt_box">
    <xsl:attribute name="id">Quantity_<xsl:value-of select="VariantID"/></xsl:attribute>
    </input>
    </td><td>
    <input id="add_to_wishlist" class="add_to_cart_btn" value="Add to wishlist" name="add_to_wishlist" type="button">
    <xsl:attribute name="id">AddToWish_<xsl:value-of select="VariantID"/></xsl:attribute>

    </input>
    </td>
    <td>
    <input id="add_to_cart" class="add_to_cart_btn" value="Add to Bag" name="add_to_cart" type="button">
    <xsl:attribute name="id">AddToCart_<xsl:value-of select="VariantID"/></xsl:attribute>
    </input>
    </td>
    </tr>
    <tr>
    <td></td>
    </tr>
    </table>

    </div>

    That is here I would insert the break to seperate the two. Within the xml package that the product page uses.

  6. #6
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default How to Insert <br> in AddtoCartForm

    I like this solution, since it makes for more flexible placement and XML customization going forward without editing the source code. I tried to implement your sample code on my test server, and while the placement works as desired, the buttons do not function. I am not as experienced in XML as many, so I am assuming there is a step I am missing in integrating your sample code into my page.

    I placed your code in my product page, replacing the code:
    "<xsl:value-of select="aspdnsf:AddtoCartForm(ProductID, VariantID, 1)" disable-output-escaping="yes"/>
    Should I have a a function to convey the Inputs of your code to the AddtoCartForm fuction in the shopping cart?
    Sorry if this basic stuff - this is how we learn!



    Quote Originally Posted by Skriver View Post
    Would the break not be put in the xml package?

    For example the code from ours reads as

    <div class="add_to_cart">
    <table>
    <tr>
    <td>
    <p>Quantity</p>
    <input name="quantity" type="text" value="1" size="20" class="txt_box">
    <xsl:attribute name="id">Quantity_<xsl:value-of select="VariantID"/></xsl:attribute>
    </input>
    </td><td>
    <input id="add_to_wishlist" class="add_to_cart_btn" value="Add to wishlist" name="add_to_wishlist" type="button">
    <xsl:attribute name="id">AddToWish_<xsl:value-of select="VariantID"/></xsl:attribute>

    </input>
    </td>
    <td>
    <input id="add_to_cart" class="add_to_cart_btn" value="Add to Bag" name="add_to_cart" type="button">
    <xsl:attribute name="id">AddToCart_<xsl:value-of select="VariantID"/></xsl:attribute>
    </input>
    </td>
    </tr>
    <tr>
    <td></td>
    </tr>
    </table>

    </div>

    That is here I would insert the break to seperate the two. Within the xml package that the product page uses.

  7. #7
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    I too wish that they would at least change it from a compiled library to a ASP.Net Control, but alas...that is just one of many changes I'd like to see. Right now, I would say your best bet is to actually change the source to get the control to render the way you want it. Rebuilding your own as you've done is asking for trouble.

    In case any ASPDNSF devs are listening...could you please set up all the places where you actually output HTML tags to instead be just a control and where you output CSS please output classes instead, and make them jQueryUI ThemeRoller compatible please Thanks!
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  8. #8
    GoVedia is offline Member
    Join Date
    Oct 2012
    Location
    Orange, CA
    Posts
    98

    Default

    Yes, you could modify source code to insert the line break.

    A simpler approach to achieve similar results, is through CSS. Modify your CSS file to include the following:
    Code:
    .AddToWishButton
    {
        display:block;
    }
    Give that a try, and let us know
    Last edited by GoVedia; 02-21-2013 at 01:12 PM.
    Robert Kanaan
    AspDotNetStorefront Development Partner
    robert@GoVedia.com
    408-758-8845

    GoVedia
    http://GoVedia.com
    Approved AspDotNetStorefront Development Partner
    AspDotNetStorefront Recommended Reseller

  9. #9
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default How to Insert <br> in AddtoCartForm?

    Regarding this,


    Quote Originally Posted by cjbarth View Post
    So you're modifying code in

    Code:
    Public Shared Function GetAddToCartForm(ByVal ThisCustomer As Customer, ByVal forPack As Boolean, ByVal forKit As Boolean, ByVal showWishListButton As Boolean, ByVal showGiftRegistryButton As Boolean, ByVal ProductID As Integer, ByVal VariantID As Integer, ByVal SkinID As Integer, ByVal DisplayFormat As Integer, ByVal LocaleSetting As String, ByVal ColorChangeProductImage As Boolean, ByVal VariantStyle As VariantStyleEnum, ByVal isKit2 As Boolean, ByVal packID As Integer) As String
    but are seeing no result? What exactly did you change?
    I am unable to locate the "Public Shared Function..." code you referenced in the files I have looked at that seem to relate to the AddtoCartForm (ShoppingCart.cs,XSLTExtensionBase.cs). I found what appears to the be AddtoCartForm constructor in ShoppingCart.cs, but my varied attempts at inserting a <br> into the string have resulted in negative effect - no changes good or bad. Either I am a)in the wrong place to effect the desired change, or b) just lacking enough experience to be placing the break in the wrong place.

  10. #10
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    One quick way to find stuff in VS2010 is to just hit Ctrl-, (comma) and type in your function name. It will search all files for the function and let you choose which overload you want.

    As for what to change when you get there, near the end of the (really long) function you'll find something like

    Code:
    tmpS.AppendFormat( ... AddToCartButton ... )
    and later in the file (in an overload of the same routine)...

    Code:
    tmpS.Append( ... AddToCartButton ... )
    That is the area you'll probably want to add in your <br /> tag.

    It should be easy to just search the ShoppingCart.vb/cs file for "AddToCartButton" to find the instances of the button around which you'll want to modify.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  11. #11
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default

    Ok, so it looks like I was in the right place and on the right track. Since I have a custom button, I was focusing on the code following and around:
    Code:
    tmpS.AppendFormat(<"input type=\"image\" id=\"AddToCartButton.......
    in ShoppingCart.cs.

    I have tried, at various in this code section, to insert the break tag. I have tried:
    Code:
     tmpS.AppendFormat("<br>")
    as a seperate line, and also
    Code:
     tmpS.AppendFormat("<br><input type=\"image\"id="AddToCartButton.....
    .

    I am sure it is just syntax problem at this point.

  12. #12
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    Did you ever get this working?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  13. #13
    linhoff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    27

    Default

    I wasn't able to implement precisely as desired, but ended up with :

    Code:
    <a href="addtocart.aspx?productid={aspdnsf:GetMLValue (ProductID)}&amp;variantid={aspdnsf:GetMLValue(VariantID)}&amp;addtocart=1" title="Wishlist">
                                    <img src="App_Themes/Skin_3/images/AddtoCartNew.png"/>
                                  </a>
    <br></br>
                                  <a href="addtocart.aspx?productid={aspdnsf:GetMLValue (ProductID)}&amp;variantid={aspdnsf:GetMLValue(VariantID)}&amp;iswishlist=1" title="Wishlist">
                                    <img src="App_Themes/Skin_3/images/AddtoWishlist.png"/>
                                  </a>
    This seemed to be the only method that I could get to function properly. My efforts in finding the proper place in the source code to effect the changes met with no success, and this method, while inelegant, does the job.
    Thank you for your suggestions though. I may revisit this at another junction. Just wish such a seemingly easy change didn't involve digging through layers of source code (beyond the simple XML package...).
    Linhoff

  14. #14
    ccoddington is offline Junior Member
    Join Date
    Aug 2010
    Posts
    23

    Default

    Linhoff your solution may break down if you don't account for sizes and colors (this may not be a requirement and if it isn't then by all means ignore this). You may want to take a look again at Robert's (GoVedia) answer if you do need to account for size/color variations.
    Chris Coddington
    Aydus Consulting
    Office: 800-419-0391 x303
    Direct: 213-785-8201
    Mobile: 818-675-1066
    Skype: Chris.Coddington
    chris@aydus.com
    www.aydus.com