Community Forums 

Main Content

return to anchor while using nocart

    Dec 23 2011 17:33:21

    #1

    Steve Brown

    Join date : 2008-09-18      Posts : 11

    I am using input type="hidden" name="nocart" to stay on the shop page whilst the product is added to the cart.The only problem is that the browser jumps to the top of the page after the 'add to cart' button is pressed.

    i have added an anchor tag to the page and 'page.htm#anchor' to the return link but this doesn't seem to work. (I am using a form.) I have also tried%23 instead of # as for a link but this doesn't work either.

    The 'continue shopping' button in the cart returns to the anchor as intended, so there is no problem there.

    Anyone with any ideas cos i'm scuppered :-)



    Dec 23 2011 17:38:41

    #2

    Steve Brown

    Join date : 2008-09-18      Posts : 11

    I forgot to mention that the shop page is .php but I am not passing any variables back and so am not using the "&" symbol

    cheers
    steve



    Dec 24 2011 04:09:17

    #3

    GT

    Join date : 2008-09-18      Posts : 3207

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.




    Dec 29 2011 19:09:56

    #4

    Geoff

    Join date : 2008-09-18      Posts : 415

    Steve,

    Everything after the # is interpreted as a fragment identifier (named anchor), It follows therefore that a named anchor should be appended at the end of a URL after any query string.

    The problem is that if you have "Append cart content vars" enabled in cart setup, the cart will tack the query string onto the end of your return URL named anchor thereby rendering it ineffective.

    The solution is to deselect "Append cart content vars" in cart setup, but only if you have no use for this feature (for example, to populate a minicart on your pages).



    Jan 24 2012 10:56:55

    #5

    Steve Brown

    Join date : 2008-09-18      Posts : 11

    Cheers Geoff
    "Append cart content vars" was indeed the problem. I decided to ditch that function as the benefits gained were far outwieghed by the irritation of the page being sent back up to the top on refresh.

    thanks again
    steve