The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

FoxyCart Checkout Only, with single Product added

ahsodesignsahsodesigns Member
in Help edited September 2013
here's the store's domain :
integritysol.wpengine.com
integritysolutions.foxycart.com

we're working on a site where they're just selling one product, an online quiz,
we'd like to use just the foxycart checkout template, and bypass the shopping cart process,
and we're wondering if there's a way to have the shopping cart set with just one product in it by default.

They're only selling one product, so we'd like to skip the add-to-cart & shopping cart phase and just proceed to the cached foxycart checkout template with the single product in it all ready to go.
How would we go about this ?
tyty again,

Comments
  • fc_adamfc_adam FoxyCart Team
    @ahsodesigns,

    You'd simply set up the add to cart link or form and make it go straight to the checkout. For example:

    http://yourstore.foxycart.com/cart?name=Widget&price=20&cart=checkout

    That would add a $20 product called Widget to the cart, but the customer would be sent straight to the checkout. So using that approach, you could set up a link or form on your page for the customer to purchase the quiz, and it would send them straight to the checkout with the product added to their cart.
  • brilliant fc underscore adam! thanx!

    we're having another issue now, the foxycart admin won't keep the templates we're cacheing.
    we'll cache the template URL and it will say "success"
    then we click 'update template'
    more success,
    but when we come back to the template cacheing page for the cart, checkout and receipt,
    the fields are all empty again.

    we've configured a default product category,
    but the URL to the checkout :
    https://integritysolutions.foxycart.com/cart?name=Full Assessment&price=20&cart=checkout
    tells us the templates aren't cached and / or there's no default category.
    ty again,
  • lukeluke FoxyCart Team
    @ahsodesigns Looking through the data, it looks like your templates may have been removed. I went ahead and cleaned it up, though our backup data showed empty template records as well. If you re-save the templates now, it should work. Please let us know.
  • no worries. tyty.

    It's working now. all is well.

    p.s. my daughter RLY hearts those unicorn rainbow stickers btw...
  • it's going really well,
    you can check our progress here :

    https://integritysolutions.foxycart.com/checkout.php?ThisAction=customer_info&fcsid=m6blfrdp3f37e0qs642oj9f5t1

    we've modified the cart on the checkout page to be an input field, so if, for whatever reason they quit the cart and try to get back in, they can adjust the quantity in the form field.
    we're then making a getJSON call to out cart, and it's returning , and updating the info as it should,
    we're verifying this in the console.

    we're having trouble finding the function to run to update / recalculate the information on the checkout template tho, based on the new cart data. could you pls point us in the right direction?
    tyty & have a good one.

    p.s. here's our code, let us know if you see any room for improvement.
    jQuery(document).ready(function($){
    
        //#todo - if there's ever more than one product, this will have to be scoped tighter $(this)
        // get product id, it's the id of the element prefixed w/ "product_" and the actual number is all we need, so it gets stripped.
        var productID = $("[id^=product_]").attr("id").replace(/[^\d\.]/g, '');
    
        // get values from existing cart
        var itemQuantity = $(".fc_cart_item_quantity").text().replace(/ /g,'');
        $(".fc_cart_item_quantity").empty(); // dump what's there.
    
        console.log("itemQuantity : " + itemQuantity);
    
        var itemQuantitiyInput = '<input class="ahso_fc_cart_item_qty" type="text" name="fc_cart_item_quantity" value="'+itemQuantity+'" maxlength="1" size="1"><a href="" class="fc_cart_item_delete_quantity">  X</a><a href="" class="fc_cart_item_update_quantity">  update quantity  </a>';
        // swap in input field prepopulated w/ value from existing cart
        console.log("itemQuantitiyInput : " + itemQuantitiyInput);
        $(".fc_cart_item_quantity").prepend(itemQuantitiyInput);
    
        // attach listeners to input field and 'x' next to field
        $(".fc_cart_item_delete_quantity").click(function(){
            event.preventDefault();
            var currentQtyValue = $(".ahso_fc_cart_item_qty").val();
            if ( currentQtyValue !== '0') $(".ahso_fc_cart_item_qty").val( currentQtyValue - 1 );
        });
    
        // update cart when changes are made
        $(".fc_cart_item_update_quantity").click(function(){
    
            event.preventDefault();
    
            var currentQtyValue = $(".ahso_fc_cart_item_qty").val();
            console.log("currentQtyValue : " + currentQtyValue);
            console.log(FC);
    
            // #todo - you left off here, trying to get the cart to update.
            jQuery.getJSON('https://integritysolutions.foxycart.com/cart?fcsid='+FC.session_id+'&cart=update&quantity='+currentQtyValue+'&id='+productID+'&output=json&callback=?', function(cart) {
                console.log("i'm back");
                console.info(cart.product_count);
                console.info(cart.total_price);
                console.log(cart);
                console.log("time to update the cart...");
            });
    
    //        jQuery.getJSON('https://integritysolutions.foxycart.com/cart?'+fcc.session_get()+'&output=json&callback=?', function(cart) {
    //            console.info(cart.product_count);
    //            console.info(cart.total_price);
    //            console.info(cart.total_discount);
    //            var total_price = cart.total_price - cart.total_discount;
    //            console.log('You have '+cart.product_count+' products in your cart, totalling $'+total_price+' (which is after a $'+cart.total_discount+' discount).');
    //        });
    
        });
    
    });
    
  • fc_adamfc_adam FoxyCart Team
    @ahsodesigns,

    I believe you should be able to just do this:
    jQuery("#subtotal").val(cart.total_price)
    FC.checkout.updateShipping(-1);
    FC.checkout.updateTaxes(-1);
    
Sign In or Register to comment.