• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Spree on Rails 3: Part One

    Steph Skardal

    By Steph Skardal
    October 25, 2010

    A couple of weeks ago, I jumped into development on Spree on Rails 3. Spree is an open source Ruby on Rails ecommerce platform. End Point has been involved in Spree since its inception in 2008, and we continue to develop on Spree with a growing number of clients. Spree began to transition to Rails 3 several months ago. The most recent stable version of Spree (0.11.2) runs on Rails 2.*, but the edge code runs on Rails 3. My personal involvement of Rails 3 based Spree began recently; I waited to look at edge Spree until Rails 3 had a bit of momentum and until Rails 3 based Spree had more documentation and stability. My motivation for looking at it now was to determine whether End Point can recommend Rails 3 based Spree to clients and to share insight to my coworkers and other members of the Spree community.

    First, I looked at the messy list of gems that have built up on my local machine throughout development of various Rails and Spree projects. I found this simple little script to remove all my old gems:

    #!/bin/bash
    
    GEMS=`gem list --no-versions`
    for x in $GEMS; do sudo gem uninstall $x --ignore-dependencies -a; done

    Then, I ran gem install rails to install Rails 3 and …


    ecommerce rails spree

    Spree on Rails 3: Part Two

    Steph Skardal

    By Steph Skardal
    October 25, 2010

    Yesterday, I discussed my experiences on getting Rails 3 based Spree up and running. I’ve explained in several blog articles (here and here) that customizing Spree through extensions will produce the most maintainable code – it is not recommended to work directly with source code and make changes to core classes or views. Working through extension development was one of my primary goals after getting Spree up and running.

    To create an extension named “foo”, I ran rails g spree:extension foo. Similar to pre-Rails 3.0 Spree, a foo directory is created (albeit inside the sandbox/) directory as a Rails Engine. The generator appends the foo directory details to the sandbox/ Gemfile. Without the Gemfile update, the rails project won’t include the new foo extension directory (and encompassed functionality). I reviewed the extension directory structure and files and found that foo/lib/foo.rb was similar to the the *_extension.rb file.

    New
    require 'spree_core'
    

    module Foo class Engine < Rails::Engine

    config.autoload_paths += %W(#{config.root}/lib)
    
    def self.activate
      # Activation logic goes here.
      # A good use for this is performing
      # class_eval on classes that are defined
      # …

    ecommerce rails spree

    check_postgres meets pgbouncer

    Josh Tolley

    By Josh Tolley
    October 22, 2010

    Recently the already well-known PostgreSQL monitoring tool check_postgres gained an ability to monitor pgbouncer, the PostgreSQL connection pooling daemon more closely. Previously check_postgres could verify pgbouncer was correctly proxying connections, and make sure its settings hadn’t been modified. The pgbouncer administrative console, reports many useful pgbouncer statistics and metrics; now check_postgres can monitor some of those as well.

    pgbouncer’s description of its pools consists of “client” elements and “server” elements. “Client” refers to connections coming from clients, and “server” to connections to the PostgreSQL server. The new check_postgres actions pay attention only to the pgbouncer “SHOW POOLS” command, which provides the following metrics:

    • cl_active: Connections from clients which are associated with a PostgreSQL connection. Use the pgb_pool_cl_active action.
    • cl_waiting: Connections from clients that are waiting for a PostgreSQL connection to service them. Use the pgb_pool_cl_waiting action.
    • sv_active: Connections to PostgreSQL that are in use by a client connection. Use the pgb_pool_sv_active action.
    • sv_idle: Connections to PostgreSQL that are idle, ready to …

    nagios postgres

    Cross Browser Development: A Few CSS and JS Issues

    Steph Skardal

    By Steph Skardal
    October 20, 2010

    Coding cross browser friendly JavaScript and CSS got you down? In a recent project, Ron, David, and I worked through some painful cross browser issues. Ron noted that he even banged his head against the wall over a couple of them :) Three of these issues come up frequently in my other projects full of CSS and JS development, so I wanted to share.

    Variable Declaration in JS

    In several cases, I noticed that excluding variable declaration (“var”) resulted in broken JavaScript-based functionality in IE only. I typically include variable declaration when I’m writing JavaScript. In our project, we were working with legacy code and conflicting variable names may have be introduced, resulting in broken functionality. Examples of before and after:

    Bad Better
    var display_cart_popup = function() {
        popup_id = '#addNewCartbox';
        left = (parseInt($(window).width()) - 772) / 2;
        ...
    };
    
    var display_cart_popup = function() {
        var popup_id = '#addNewCartbox';
        var left = (parseInt($(window).width()) - 772) / 2;
        ...
    };
    
    ...
    address_display = '';
    

    country = $(type+’_country’).value; address = $(type+’_address’).value; address2 = …


    browsers css javascript

    Simple audio playback with Yahoo Mediaplayer

    Jeff Boes

    By Jeff Boes
    October 20, 2010

    Recently I had need to show a list of MP3 files with a click-to-play interface.

    I came upon a very simple self-contained audio player:

    <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script>

    The code to set up my links for playing was dirt-simple:

    <script type="text/javascript">
    var player = document.getElementById('player');
    function add_to_player() {
        var link = this;
        player.src.replace(/audioUrl=.*/,'audioUrl=' + link.src);
        return false;
    }
    var links = document.getElementsByTagName('A');
    for (var i = 0; i < links.length; i++) {
        if (links[i].src.match(/\.mp3$/)) {
            links.onclick = add_to_player;
        }
    }
    </script>

    You could use various ways to identify the links to be player-ized, but I chose to just associate the links with a class, “mp3”:

    <a class="mp3" href="/path/to/file.mp3">Audio File 1</a>

    Obviously, if jQuery is in use for your page, you can reduce the code to an even smaller snippet.


    javascript audio

    Youth Debate and other client news

    Jon Jensen

    By Jon Jensen
    October 20, 2010

    I want to draw attention to several of our clients who have been in the news lately:

    The Youth Debate 2010 site is live and currently accepting question submissions from youth interested in hearing video responses from the DNC & RNC chairmen before the November midterm elections. It’s a simple site, developed and deployed quickly with an eye toward handling a very high amount traffic over a short period of time. We’re excited to see what questions and answers come out of the project.

    Jared Loftus, entrepreneur and owner of The College District, was profiled in a recent BusinessReport.com article about his business. We’ve written about Jared’s business and some of the technical details underpinning his sites in past blog posts, including one upon launch of 4 additional sites and one comparing College District multi-site architecture to Spree.

    Our client FLOR.com is a well-known retail modular carpet seller and a division of the public company Interface, Inc. We’ve been pleased to work with them to add new features to and support the operations of their ecommerce system for the past 3 years. Interface’s founder, Ray Anderson, has been on a mission to reduce negative …


    clients

    Git branches and rebasing

    Jeff Boes

    By Jeff Boes
    October 19, 2010

    Around here I have a reputation for finding the tiniest pothole on the path to Git happiness, and falling headlong into it while strapped to a bomb …

    But at least I’m dedicated to learning something each time. This time it involved branches, and how Git knows whether you have merged that branch into your current HEAD.

    My initial workflow looked like this:

    $ git checkout -b MY_BRANCH
      (some editing)
    $ git commit
    $ git push origin MY_BRANCH
      (later)
    $ git checkout origin/master
    $ git merge --no-commit origin/MY_BRANCH
      (some testing and inspection)
    $ git commit
    $ git rebase -i origin/master

    This last step was the trip-and-fall, although it didn’t hurt me so much as launch me off my path into the weeds for a while. Once I did the “git rebase”, Git no longer knows that MY_BRANCH has been successfully merged into HEAD. So later, when I did this:

    $ git branch -d MY_BRANCH
    error: the branch 'MY_BRANCH' is not fully merged.

    As I now understand it, the history is no longer a subset of the history associated with MY_BRANCH, so Git can’t tell the two are related and refuses to delete the branch unless you supply it with -D. A relatively harmless situation, but it set off …


    git

    Implementing Per Item Discounts in Spree

    Sonny Cook

    By Sonny Cook
    October 19, 2010

    Discounts in Spree

    For a good overview of discounts in Spree, the documentation is a good place to start. The section on Adjustments is particularly apropos.

    In general, the way to implement a discount in Spree is to subclass the Credit class and attach or allow for attaching of one or more Calculators to your new discount class. The Adjustment class file has some good information on how this is supposed to work, and the CouponCredit class can be used as a template of how to do such an implementation.

    What we Needed

    For my purposes, I needed to apply discounts on a per Item basis and not to the entire order.

    The issue with using adjustments as-is is that they are applied to the entire order and not to particular line items, so creating per line item discounts using this mechanism is not obviously straight forward. The good news it that there is nothing actually keeping us from using adjustments in this manner. We just need to modify a few assumptions.

    Implementation Details

    This is going to be a high-level description of what I did with (hopefully) enough hints about what are probably the important parts to point someone who wants to do something similar in the same direction. …


    ecommerce ruby rails spree
    Previous page • Page 176 of 223 • Next page