SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multi add - loop

    I want to perform a loop, by incrementing <number> till a certain <number>.. for instance from 150 to 200, it should access the required url 50 times and add it to cart, anyone any suggestions on how to do this?

    the url is say:
    /AddToCart.ASP?ID=<number>

    cheers

  2. #2
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by random
    I want to perform a loop, by incrementing <number> till a certain <number>.. for instance from 150 to 200, it should access the required url 50 times and add it to cart, anyone any suggestions on how to do this?
    a couple of methods you can use,

    for(n=number;n<maxnumber;n++) { /AddToCart.ASP?ID=<n> }

    or a timed method;

    n=number
    function addToCart() {
    if(n<maxnumber) { n++ ;
    setTimeout(addToCart(),t) }}

    t being time in milliseconds.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  3. #3
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something like this? that looks awful but im very new to this

    <A href="/AddToCart.ASP?ID=1"><IMG src="images/buy.gif"><script>for(n=10;n<20;n++) { /AddToCart.ASP?WPID=<n> }</script></A>

  4. #4
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump

  5. #5
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, wait....you want to bounce that URL 50 times? I don't get it. What are you really trying to accomplish here?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  6. #6
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    So, wait....you want to bounce that URL 50 times? I don't get it. What are you really trying to accomplish here?
    Not 50, 50 was just a figure.. more like 5 or something... there are bestbuys for a certain site and its far easier to list some items in cart (than going thro the whole adding, details and so on).. if you don't want to help thats fine, but try not to make it sound like im out to do harm.

    does anyone know if im on the right lines with the above code?

  7. #7
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    random,
    re-reading my own words, I see the connotation you picked up on, but that's totally not what I meant.

    Okay, I'm still not clear. Are you wanting to create links for the user to click, or are you hoping to ping that URL X-number of times so those items are automatically added?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  8. #8
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    random,
    re-reading my own words, I see the connotation you picked up on, but that's totally not what I meant.

    Okay, I'm still not clear. Are you wanting to create links for the user to click, or are you hoping to ping that URL X-number of times so those items are automatically added?
    sorry for the confusion.. im wanted to have them added to the cart just, a link that performs that loop i thought should automatically add them.. but im not sure which way is best (like have a 'buy all' link that adds everything on that page, itd be easily done as the values id are unique and always increments when a new product is listed)...

  9. #9
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay. To accomplish this with javascript, you'd have to have a different window to activate the links in, whether you use a new window or (i)frame.

    However, this is not something I recommend. Server/internet latency, browser compatibility, and other factors must make this a bad idea.

    This is something that should be accomplished with ASP.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •