ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

flexi cart - A comprehensive shopping cart library for CodeIgniter

March 11, 2012 3:30am

Subscribe [36]
  • #1 / Mar 11, 2012 3:30am

    haseydesign

    171 posts

    Hey all,

    I would like to announce the release of ‘flexi cart’, a comprehensive shopping cart library for CodeIgniter.

    Whilst CodeIgniter does indeed come with its own cart library, the library is quite basic in functionality and is only aimed at creating simple e-commerce stores.

    The flexi cart library includes the following features:

    Shipping
    + Base available shipping options and charges on a customers location.
    + Calculate shipping charges based on the weight and value of an order.
    + Include or exclude specific shipping options from discount offers.
    + Set shipping charges for specific items purchased from the store.
    Example: Item A ships free of charge, Item B ships for $10 on top of the carts standard shipping charge.
    + Ban specific items from being shipped to specific locations.

    Taxes
    + Base available tax rates on a customers ‘billing to’ or ‘shipping to’ location.
    + Define specific tax rates for specific items in the cart.
    + Customers can toggle whether to show cart prices include or excluding taxes.

    Localisation
    + Setup locations like countries, states, cities, post/zip codes to even specific streets and door numbers.
    + Locations can be grouped into zones, where rules can then be applied to all locations within a zone, rather than setting the rule for each location.

    Discounts and Reward Points/Vouchers
    + Setup complex rule conditions for specific items and groups of items that are added to the cart based on customer location, cart/item value, item quantities and whether other items are present within the cart.
    + Define how tax should be applied to specific discounts. E.g. Whether tax should be applied before or after the discount is applied.
    + Allow customers to earn reward points from purchasing items that they can then later exchange for a discount voucher.

    Plus many more features…
    + Multiple currencies
    + Item stock control
    + Surcharges
    + Save/load incomplete carts for later shopping
    + Multilingual custom status and error messages
    + Currency and weight conversion tools

    The purpose of the flexi cart library is to offer modularised shopping cart features, that allow a developer to pick and choose which features they require, without having to include features that are surplus to the clients requirements.

    flexi cart is flexible enough to be used to create simple 10 item ecommerce stores, up to creating huge online stores rivaling the functionality of ecommerce giants like Magento, Opencart and X-cart. The tools are provided, you just have to put them together.

    The library, documentation, and a comprehensive live online demo are available from the flexi cart site.
    http://haseydesign.com/flexi-cart

    The library has been a long time in the making and has been used for some of my own client sites.
    I would now like to release the code to the public so that others can also make use of it.

    Enjoy =)

    P.s. If anyone does particularly like the style of this library, I have also built a user authentication system that was originally based on Ben Edmunds popular Ion Auth library.
    The ‘flexi auth’ library is highly customisable like flexi cart including features like PHPASS password hashing, Google reCaptcha, user groups and privileges, plus much much more.

  • #2 / Mar 11, 2012 4:56am

    InsiteFX's avatar

    InsiteFX

    6819 posts

    Doe’s this have digital downloads?

  • #3 / Mar 11, 2012 5:11am

    haseydesign

    171 posts

    There are no particular examples I have created that would deal with digital downloads.
    However, it could probably be adapted to deal with them.

    What kinds of features and functionality would you see being required?

  • #4 / Mar 11, 2012 8:48am

    InsiteFX's avatar

    InsiteFX

    6819 posts

    Digital Downloads

    For downloading Software and PDF eBooks.

    Download area would need to be protected.
    This would be like changing the filename to a fake filename.

    Log the users IP address.

    Set max number of downloads.

  • #5 / Mar 12, 2012 7:52am

    haseydesign

    171 posts

    The features required to manage the digital downloads are a little too far out of the initial scope of the library.

    If the library does get some interest and digital downloads become a common request, it’s something i could look at adding at a later date.

     

  • #6 / Mar 14, 2012 1:56am

    somenet

    21 posts

    There is no user_guide in download file please provide the user_guide in download file.

  • #7 / Mar 14, 2012 3:39am

    haseydesign

    171 posts

    Hi somenet,
    If you install the demo on your local environment, you can access the user guide via the demo site.

    However I see how this could be a little annoying if you want to just browse the documentation.
    I’ll look into porting the existing demo user guide into some standalone html files.

  • #8 / Mar 14, 2012 5:22am

    InsiteFX's avatar

    InsiteFX

    6819 posts

  • #9 / Mar 14, 2012 9:22am

    somenet

    21 posts

    Hi haseydesign
        I can successfully configure the user_guide.Thanks for the code.

  • #10 / Apr 03, 2012 3:02pm

    Ryan Paddy

    3 posts

    Couple of questions:

    1) Does flexi cart have support for any payment mechanisms built in? CC gateway/PayPal?

    2)  I get the impression flexi cart doesn’t have a “user” concept, just cart sessions. You mention that you have a separate authorisation library. Does your authorisation library integrate easily with flexi cart? I see that flexi cart’s “order” table has a “user” field, which would be a start.

  • #11 / Apr 03, 2012 9:56pm

    haseydesign

    171 posts

    @Ryan

    1) flexi cart doesn’t currently have any payment gateways built into the library.
    I have personally integrated flexi cart with WorldPay and have had no problems.
    It’s just a case of reading through the payment gateways api documentation, and then using flexi carts functions to pass the required data.

    If and when I get the time, i’ll try and look into creating some demos for popular gateways like PayPal.
    If you end up implementing it with a gateway, i’d be interested if you were happy to share the code.

    2) As for user data, the only direct relationship that flexi cart needs with a user is a unique user id.
    This means that the library can integrate with pretty much any of the auth libraries that are available in CodeIgniter (Including my own ‘flexi auth’ library - I’ll put it up on GitHub if your interested in playing about with it).

    In the likely situation when you need to save a users billing/shipping details with an order, this data can be saved to the database by submitting an array of the custom data when saving the cart data to the database.
    How you collect this user billing/shipping data is up to you, it could be from a database query, or from a submitted form (Like with the online demo).

  • #12 / May 15, 2012 9:30am

    koichirose

    47 posts

    I don’t really understand how to offer a seamless experience for both logged users and guests.
    Examples:

    - A guest puts items in the cart. The guest logs in -> items are saved to the db in addition to the session. (I guess I could manage this in the login function, calling save_cart_data() right there, or is there something better?)
    - A guest wants to view his cart -> load items from the session. (this works great)
    - A logged-in user wants to view his cart -> load items from the db (this I don’t understand: saved cart data on the db doesn’t include some fields. This is the same product saved in the session and saved on db and unserialized:

    //session
    array
          'row_id' => string 'd3d9446802a44259755d38e6d163e820' (length=32)
          'id' => string '10' (length=2)
          'name' => string 'shoes' (length=5)
          'quantity' => string '1' (length=1)
          'price' => string '€99.99' (length=11)
          'stock_quantity' => string '10' (length=2)
          'internal_price' => float 99.99
          'weight' => string '0g' (length=2)
          'tax_rate' => string '20%' (length=3)
          'shipping_rate' => boolean false
          'separate_shipping' => boolean false
          'reward_points' => string '1,000' (length=5)
          'status_message' => 
            array
              empty
          'tax' => string '€16.67' (length=11)
          'non_discount_quantity' => string '1' (length=1)
          'discount_quantity' => string '0' (length=1)
          'price_total' => string '€99.99' (length=11)
          'discount_price' => string '€99.99' (length=11)
          'discount_price_total' => string '€99.99' (length=11)
          'discount_description' => boolean false
          'tax_total' => string '€16.67' (length=11)
          'weight_total' => string '0g' (length=2)
          'reward_points_total' => string '1,000' (length=5)
    
    //db
    array
          'd3d9446802a44259755d38e6d163e820' => 
            array
              'row_id' => string 'd3d9446802a44259755d38e6d163e820' (length=32)
              'id' => string '10' (length=2)
              'name' => string 'shoes' (length=5)
              'quantity' => float 1
              'price' => float 99.99
              'stock_quantity' => string '10' (length=2)
              'internal_price' => float 99.99
              'weight' => int 0
              'tax_rate' => boolean false
              'shipping_rate' => boolean false
              'separate_shipping' => boolean false
              'reward_points' => boolean false
              'status_message' => 
                array
                  empty
              'tax' => float 16.665

    So a bunch of fields are missing?

    Thanks 😊

  • #13 / May 15, 2012 10:05am

    haseydesign

    171 posts

    Hey koichirose,

    To give you some idea of whats happening there, session data and database data purposely contain different data.
    The session needs to contain much more data that is used internally by the library to help work out whats happening with the live data within the cart, whilst the database data is a primarily a readable summary of order data.

    It is possible to save an order to the database, then close your browser (so the session data is deleted) and then reload the saved database data back into the users session.
    When reloading the database data back into the session, the library internally repopulates all of the ‘missing’ fields - however, you must use the libraries functions to do this.

    To see an example of this feature in action, try out the following page : http://haseydesign.com/flexi-cart/standard_library/load_save_cart_data
    Note that currently, only the third date list in ‘‘Load Saved Cart Data’ is working (A cockup by me trying to fudge the serialized strings using SQL rather than the library - this error should not happen when using the library and affects this demo only).
    If you add some items to your cart, then save the cart via this page, then load another cart, you will be able to see the feature in action.

    The above page allows a user to save their cart session to the database and then reload it again from the database into their current browser session.
    This demo page and its functionality can be viewed via the ‘load_save_cart_data’, ‘save_cart_data’ and ‘load_cart_data’ methods in the ‘standard_library.php’ controller.
    The user guide page http://haseydesign.com/flexi-cart/user_guide/database_cart_data_admin details the functions required for this feature.

    If all is still not clear, let me know.
    Cheers,
    Rob

  • #14 / May 15, 2012 1:02pm

    koichirose

    47 posts

    Thank you, I’ll look into it tomorrow morning!

    For now I’m trying to set the language, so I created another folder (inside application/language), pasted flexi_cart_lang.php and translated everything.
    I’m having trouble loading the correct lang, since I’m setting a codeigniter variable in a hook - i.e. I do:

    $CI =& get_instance();
    $CI->settings->ci_language = 'italian';

    Then I tried editing flexi_cart_lite_model.php, since apparently that’s where the language is loaded:

    $this->lang->load('flexi_cart', $this->settings->ci_language);

    Inside __construct though I can’t use $this, nor get_instance, so I don’t know how to access that variable.
    I see there’s a &__get() function in that model, but I don’t understand if it could help me.

    Thank you again!

  • #15 / May 15, 2012 8:28pm

    Patrick Spence

    64 posts

    @Ryan

    1) flexi cart doesn’t currently have any payment gateways built into the library.
    I have personally integrated flexi cart with WorldPay and have had no problems.
    It’s just a case of reading through the payment gateways api documentation, and then using flexi carts functions to pass the required data.

    If and when I get the time, i’ll try and look into creating some demos for popular gateways like PayPal.
    If you end up implementing it with a gateway, i’d be interested if you were happy to share the code.

    I just finished a small shopping site (unfortunately without your cart) using Stripe as a payment processor.  it was very easy to integrate.  And you can get an account without giving them financial data to let you test things out with charging, customers, coupons, subscriptions, etc.

    / not an employee of Stripe
    // Not striped either.

    😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases