Web Development by Alistair Robinson

« Blog home

Posts Tagged ‘javascript’…

FoxyCart: Replacing A Cart Item


December 14th, 2009 1 Comment

function add_pre_process() {
  //Find the id of the existing registration in the cart, if it does exist
  $.each(fc_json.products, function(key, product) {
    if(product.name=="Registration") {
      // Do the remove request, with parameter quantity=0
      $.ajax({
        async: false,
        type: "GET",
        url: "https://mydomain.foxycart.com/cart?output=json&cart=update&id="+product.id+"&quantity=0&callback=?" + fc_AddSession(),
        dataType: ‘json’
      });
    }
  });

  // Add the new one
  add_item();
}

function add_item() {
  //Get the form data
  var submitted_data = $("#signup").serialize();

  //Do the add request
  $.ajax({
    type: "GET",
    url: "https://mydomain.foxycart.com/cart?"+submitted_data+"&callback=?" + fc_AddSession(),
    dataType: ‘json’
  });
}
This javascript/jQuery code gets the contents of your cart (which is in the variable fc_json, made available by foxycart_includes.js), removes any item whose … read on »

A Paradigmatic Project: Building a Flickr Gallery with PHP, jCarousel and Lytebox


August 11th, 2009 No Comments

Don’t re-invent the wheel. That’s a motto that every good programmer and web developer lives by. If we’re being creative or original it’s usually in knowing which components and scripts to combine, amongst all those that have been created by other people; and in knowing how each of those components can be tweaked and configured to produce a good solution.
In web development this amounts to a synergy of languages, APIs, engines and interfaces working in blissfully ignorant harmony to provide rich functionality. This is the beauty of web development in the age of its blooming youthfulness, following the awkward stumblings of its infancy.
Incidentally, I think this is the characteristic of this kind of work that conventional programmers, or software engineers … read on »


©2010 Alistair Robinson