Announcement

Collapse
No announcement yet.

javascript buy now links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    javascript buy now links

    is it possible to chain adding cart items using script?

    adding several items to the cart at once with a single link, that is.

    #2
    That's what the Single Add to Cart does, so yes.

    However that button only works if all the products are in the same section, so you'd have to make a section (a hidden one perhaps) that contain all such products.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      oh plums, thats not going to work, they are all over the catalog!

      Comment


        #4
        You could make duplicates of the ones in question and add them all to a hidden section.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          i had an idea.

          using a link, like this one:
          /cgi-bin/ca000001.pl?SID=1216&PAGE=PRODUCT&Q_452=0

          one can add a prpduct to the cart.

          and using javascript, and a tiny iframe, its possible to 'chain' them. you think?

          then redirect them to a real cart.

          you think?

          Comment


            #6
            Thats what I was going to suggest before Norman pointed out the Single Add To Cart. If you use <iframe style="display:none"></iframe> the frame remains hidden, and you can use JS to loop through your list of products and set the src property of the iframe to your cgi-bin url each time. You'd probably need to set a delay for each iteration of the loop to give the CGI script enough time to register the product.
            www.gbradley.co.uk
            Web Development, Actinic Patches, Scripts & more

            Comment


              #7
              Not if they're in different sections. The Perl looks for and requires a SID=1 type value so that it can locate the appropriate datafile (e.g. A0001.cat) containing product details.

              I posted recently regarding some Perl mods to allow adding to cart by product reference (without knowing the SID). This was intended to allow someone to enter a ref and add it straight to cart. That might possibly be extended to allow multiple adds from different sections. It was only a week or so ago so should be easy to locate.

              UPDATE

              The above was posted while Graham was writing his reply. It's to do with a single URL containing multiple cart items, not an IFRAME solution.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                If you do get the script working keep in mind the potential SEO outfall using display:none to hide page content


                Bikster
                SellerDeck Designs and Responsive Themes

                Comment


                  #9
                  hmm, not only that, but my iframe test code and javascript gives me an 'access denied'.

                  Comment


                    #10
                    If you do get the script working keep in mind the potential SEO outfall using display:none to hide page content
                    Thats true, setting a height/width of 1px and a 0 border might be a safer bet.

                    my iframe test code and javascript gives me an 'access denied'
                    Could you post the code you're using here?
                    www.gbradley.co.uk
                    Web Development, Actinic Patches, Scripts & more

                    Comment


                      #11
                      btw: this proof of concept code works.

                      1, iframes (small ones)
                      2, drop downs
                      3, the button passes the url, one box per frame, adding the items to the cart.
                      4, after 2 seconds waiting the cart is displayed (for viewing only)
                      5, all items are added
                      6, I get slapped on the wrist for clumsy kludge code.

                      ---------------------

                      <SCRIPT LANGUAGE="JavaScript">
                      function multiResults (form) {
                      var FirstVar = form.select1.value;
                      var SecondVar = form.select2.value;
                      var ThirdVar = form.select3.value;

                      frames['frame1'].location.href = 'http://www.domainremoved.co.uk/cgi-bin/ca000001.pl?SID=' + FirstVar +'=1'
                      frames['frame2'].location.href = 'http://www.domainremoved.co.uk/cgi-bin/ca000001.pl?SID=' + SecondVar +'=1'
                      frames['frame3'].location.href = 'http://www.domainremoved.co.uk/cgi-bin/ca000001.pl?SID=' + ThirdVar +'=1'
                      setTimeout("cartdirect()",2000);
                      }

                      function cartdirect()
                      {
                      frames['cartframe'].location.href = 'http://www.domainremoved.co.uk/cgi-bin/ca000001.pl?ACTION=SHOWCART'
                      }

                      </SCRIPT>
                      <!-- 1216&PAGE=PRODUCT&Q_452 -->
                      <FORM NAME="myform" ACTION="" METHOD="GET">
                      <select name="select1">
                      <option value="1216&PAGE=PRODUCT&Q_452">Item 1</option>
                      <option value="1217&PAGE=PRODUCT&Q_1369">Item 2</option>
                      <option value="180&PAGE=PRODUCT&Q_1100">Item 2</option>
                      </select>

                      <select name="select2">
                      <option value="1216&PAGE=PRODUCT&Q_452">Item 1</option>
                      <option value="1217&PAGE=PRODUCT&Q_1369">Item 2</option>
                      <option value="180&PAGE=PRODUCT&Q_1100">Item 2</option>
                      </select>

                      <select name="select3">
                      <option value="1216&PAGE=PRODUCT&Q_452">Item 1</option>
                      <option value="1217&PAGE=PRODUCT&Q_1369">Item 2</option>
                      <option value="180&PAGE=PRODUCT&Q_1100">Item 2</option>
                      </select>

                      <INPUT TYPE="button" NAME="button" Value="Click" onClick="multiResults(this.form)">
                      </FORM>

                      <iframe src="about:blank" width="1" height="1" id="frame1" name="frame1"></iframe>
                      <iframe src="about:blank" width="1" height="1" id="frame2" name="frame2"></iframe>
                      <iframe src="about:blank" width="1" height="1" id="frame3" name="frame3"></iframe><br>
                      <iframe src="about:blank" width="1024" height="400" id="cartframe" name="cartframe"></iframe>

                      ------------------------

                      Comment

                      Working...
                      X