Direct Cart URL with All products set to qty 0

How would I go about creating a direct CART URL LINK (not checkout) like the one below with multiple products/downloadables?

https://yourdomain.foxycart.com/cart?name=blah&price=10&cart=checkout

This is what I am trying to accomplish -
The site is membership driven with different levels of memberships.

Products/events/downloadables get different pricing schedules due to the level of membership the person/company has.

So instead of creating a bunch of buttons/links for the same product, we would like to have a single button open the cart up with all the options. All the options will need to be set to Qty 0

Cart =

Event 1 with download code for Member Type 1 Qty 0 Price $200
Event 1 with download code for Member Type 2 Qty 0 Price $175
Event 1 with download code for Member Type 3 Qty 0 Price $150
Event 1 with download coda for Member Type 4 Qty 0 Price $100

Then all we want for this particular event is one registration button and they will pick the appropriate member type and fill in the quantity.

I'm open to other options, but so far this one seems like the best solution for what is needed for this event. The event includes a download so I will need a downloadcoade in the URL too.

Just to note this is just for this event and no other products/events/downloadables will be for sale on the website at the same time - so this will not be in conflict with any other online sales.
Comments
  • so far I can get this far https://YOURDOMAIN.foxycart.com/cart?name=2012 Executive Forum&code=2012LVARIA&price=500.00 but then there is a fcsid# and I'm not sure how to add the other products/downloadables to the URL. Plus I still need a qty of 0.
  • I'm sorry I do have a quantity https://YOURDOMAIN.foxycart.com/cart?name=2012 Executive Forum&code=2012LVARIA&price=500.00&quantity=0

    Still need the fcsid#, the quantity does not reset to 0 and how to add another product (just start with name again? do I need any other special characters to separate them?)
  • fc_adamfc_adam FoxyCart Team
    @ckinteractivedesign,

    The fcsid will be automatically added to your link by the foxycart javascript includes on the page, so you don't have to worry about that for an add to cart link.

    To add multiple products, you simply prefix the product attributes with a number followed by ":". So for example, 1:name=test&1:price=20&1:code=prod1&2:name=rest&2price=15&2code=prod2&3:name=best...

    Worth noting though, if you set a quantity to 0 in an add to cart, it won't actually add that product to the cart. For what you've described, you could quite easily just have all the different options selectable in an add to cart form, and people simply set the quantity for the option they want. You could present it with each different option having it's own add to cart button, or in a single form (prefixing the form element names like I described above), and people set the quantity they want for each product in a text box and then hit add to cart once for the whole form. Does that make sense?
  • Thank you for responding and giving an alternative solution, which actually may work out better. I noticed I was having problems getting a product to show up in the cart with quantity=0.
    I like the form text boxes with one submit button the best. By any chance do you know of any examples I can look at rather than bother everyone here?

    Thanks again.
    CK
  • duh I see some examples on the cleverly named 'examples' page.
    I'll check those out first and see if I need any help from there.
    Thanks again.

    http://www.foxycart.com/examples-of-seo-xhtml-ecommerce.html#form_basic
  • After looking at the examples, I'm I supposed to be looking for code numbers like the one's in the foxycart examples like code||05382bf8bea9a81d414bc9eb04b80ec481242a823bada424a093ee160d68980f if so, where do I find those? All the of codes look like that for name, category, etc.

    Here is what I am working on so far.
    May I get help with the following form:

    <form method="post" action="https://YOURDOMAIN.foxycart.com/cart"; class="foxycart" accept-charset="utf-8">
    <!--first member type-->
    <div class="fc_row">
    <input type="hidden" value="member" name="1:name||2012%Executive%Forum">
    <input type="hidden" value="2010LVARIA" name="code||2012LVARIA">
    <input type="hidden" value="downloadable" name="category||what do I put here">
    <label class="label_left">Member Type 2</label>
    <input type="text" class="text text_short" value="0" name="price||500.00">
    </div>
    <!--put next member type here-->

    <div class="fc_row fc_row_buttons">
    <input type="submit" class="submit" value="Register Now">
    </div>
    </form>
  • I'm still plugging away.
    The foxycart example was for a donation price to be filled out not for a quantity, which I did not catch immediately.

    So I've scratched the code above and went a simpler route, but I still don't think this correct:

    <div class="fc_row">
    <input type="hidden" name="name" value="1:name||2012%Executive%Forum" />
    <input type="hidden" name="price" value="500.00" />
    <label class="label_left">Member Type 4</label>
    <input type="text" name="quantity" value="0" />
    </div>
  • btw - the donation cart on the example page does not work correctly.
    the donation amount was pre-filled out for 15 which works.
    but if the quantity is changed the cart gets an error message and does not add the donation to the cart.

    I'm getting closer:

    The second and third member types will go to the cart with the filled out quantity but not the first one.

    <div class="fc_row">
    <input type="hidden" name="name" value="1:name||2012 Executive Forum" />
    <input type="hidden" name="price" value="400.00" />
    <input type="hidden" value="download" name="category||downloadable">
    <input type="hidden" value="download" name="code||2012LVARIA">
    <label class="label_left">Member Type 1</label>
    <input type="text" name="quantity" value="0" />
    </div>

    <div class="fc_row">
    <input type="hidden" name="name" value="2:name||2012 Executive Forum" />
    <input type="hidden" name="price" value="300.00" />
    <input type="hidden" value="download" name="category||downloadable">
    <input type="hidden" value="download" name="code||2012LVARIA">
    <label class="label_left">Member Type 2</label>
    <input type="text" name="quantity" value="0" />
    </div>

    <div class="fc_row">
    <input type="hidden" name="name" value="3:name||2012 Executive Forum" />
    <input type="hidden" name="price" value="200.00" />
    <input type="hidden" value="download" name="category||downloadable">
    <input type="hidden" value="download" name="code||2012LVARIA">
    <label class="label_left">Member Type 3</label>
    <input type="text" name="quantity" value="0" />
    </div>
  • I've even tried it this way - and no dice.

    <div class="fc_row">
    <input type="hidden" name="name" value="1:name=2012 Executive Forum&1:price=400.00&1:category=downloadable&1:code=2012LVARIA" />
    <label class="label_left">Member Type 1</label>
    <input type="text" name="quantity" value="0" />
    </div>

    <div class="fc_row">
    <input type="hidden" name="name" value="2:name=2012 Executive Forum&2:price=300.00&2:category=downloadable&2:code=2012LVARIA" />
    <label class="label_left">Member Type 2</label>
    <input type="text" name="quantity" value="0" />
    </div>

    <div class="fc_row">
    <input type="hidden" name="name" value="3:name=2012 Executive Forum&3:price=200.00&3:category=downloadable&3:code=2012LVARIA" />
    <label class="label_left">Member Type 3</label>
    <input type="text" name="quantity" value="0" />
    </div>
  • brettbrett FoxyCart Team
    Hi CK.
    Sorry for not responding sooner before you posted all those, but a few answers.

    First, that huge string of seemingly random characters is related to the link/form HMAC signing.
    http://wiki.foxycart.com/static/redirect/price_validation
    While we do recommend using that if you can (and it's pretty easy if you're using PHP), it's by no means necessary, especially if you're not doing automatic fulfillment.

    As far as the the form you're doing, the issue is that you're mixing up the double-pipe (||) stuff. It should just be like this:
    <div class="fc_row">
    	<input type="hidden" name="1:name" value="2012 Executive Forum" />
    	<input type="hidden" name="1:price" value="400.00" />
    	<input type="hidden" name="1:category" value="downloadable" />
    	<input type="hidden" name="1:code" value="2012LVARIA" />
    	<label class="label_left">Member Type 1</label>
    	<input type="text" name="1:quantity" value="0" />
    </div>
    

    The things to note:
    * The name="quantity" also needs the per-product prefix, so name="1:quantity"
    * The "1:" prefixes go on the name piece, not the value piece.
    * Forget about the double-pipe. That's just confusing things. You'll never have to manually do that (generally). Just name="the name of the attribute" value="the value of the attribute".

    And for your last example, you're mixing link and form syntax. For a link you'd concatenate all the name/value pairs using the & and =, but for a form you'd use separate inputs like you had before, so you were good there.

    Does that help? Let us know. Sorry if it's confusing.
  • awesomeness. I knew it was something petty that I was doing wrong.
    timing is perfect. I just wanted to let people know what I was trying out and not sitting back waiting for someone to do it for me (although you did ;P).
    I just have not had to dig into forms this way in a while.

    I'll update the form tonight and post a (hopefully) finally out outcome.
  • Some extra time opened up and I was able to successfully implement the cart form - Yay.
    thank you for all your help.

    I've been having problems getting the discount codes to work on the downloads - but I'll start a new discussion on that later.
  • brettbrett FoxyCart Team
    timing is perfect. I just wanted to let people know what I was trying out and not sitting back waiting for someone to do it for me (although you did ;P).
    Ha, that's great ;) We certainly appreciate it when support is a two way street, as it helps us better understand where we might be communicating inadequately. We're just glad we were able to help you get it working.
  • NobleNoble Member
    How can i solve this pb in my hidden price class if i input 1 value then all the element count this value not real value for real id count input value......and other pb is it is not count in total amount...........:( plz anybody help me..... :(

    /*****==========================******************/

    <tr>
    <td class="img-area col-sm-3">
    <img src="<?php echo get_sub_field('upload_image', 'options') ;?>" alt="" >
    </td>
    <td class="item-1 col-sm-7"><?php echo get_sub_field('item_description', 'options') ;?></td>
    <td class="item-2 col-sm-3"><?php echo get_sub_field('item_id', 'options') ;?></td>
    <td class="item-3 col-sm-2"><?php echo get_sub_field('item_uom', 'options') ;?></td>
    <td class="item-4 col-sm-3">$<?php echo get_sub_field('item_price', 'options') ;?>
    <input class="hidden-price" type="hidden" name="price" value='1' />
    </td>
    <td class="item-5 col-sm-3"><input type="number" class="count" name="qty"></td>
    <td class="item-6 col-sm-3">$<span class="ext-price">0.00</span><input type="hidden" class="hidden-ext" value="2.75"></td>
    </tr>

    /*****==========================******************/

    And js file is......

    /*******==========================****************/
    jQuery(document).ready(function(){
    jQuery('.count').keyup(function(){
    var handler = jQuery(this);
    var item_qty = handler.val();
    var parent = handler.closest('tr');
    var item_price = jQuery('.hidden-price', parent).val();
    var ext_price = jQuery('.ext-price', parent);
    //var total_amount = jQuery('.total-amount', parent);
    item_price = parseFloat(item_price);
    item_qty = parseFloat(item_qty);

    var main_price = item_price * item_qty;

    ext_price.html(main_price);


    jQuery('.hidden-price').blur(function () {
    var sum = 0;
    jQuery('.hidden-price').each(function() {
    sum += Number(jQuery(this).val());
    });

    var main_price = item_price * item_qty;

    ext_price.html(main_price);
    });

    jQuery('.hidden-price').each(function() {
    sum += Number(jQuery(this).val());
    });

    });
    });
    /****************====================******************/
  • fc_adamfc_adam FoxyCart Team
    @Noble,

    Could you link us to the FoxyCart store you're working with on this? Some of your field names there don't match what they need to for a FoxyCart store.
Sign In or Register to comment.