EllisLab text mark
Advanced Search
1 of 11
1
   
flexi cart - A comprehensive shopping cart library for CodeIgniter
Posted: 11 March 2012 03:30 AM
Joined: 2012-03-08
173 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.

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 11 March 2012 04:56 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6706 posts

Doe’s this have digital downloads?

 Signature 

Certified State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

Skype: insitfx

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 11 March 2012 05:11 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 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?

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 11 March 2012 08:48 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6706 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.

 Signature 

Certified State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

Skype: insitfx

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 12 March 2012 07:52 AM   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 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.

 

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 14 March 2012 01:56 AM   [ # 5 ]   [ Rating: 0 ]
Joined: 2011-05-30
31 posts

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

 
Posted: 14 March 2012 03:39 AM   [ # 6 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 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.

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 14 March 2012 05:22 AM   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6706 posts

Creating Documentation - Help Files

 Signature 

Certified State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

Skype: insitfx

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 14 March 2012 09:22 AM   [ # 8 ]   [ Rating: 0 ]
Joined: 2011-05-30
31 posts

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

 
Posted: 03 April 2012 03:02 PM   [ # 9 ]   [ Rating: 0 ]
Joined: 2012-04-02
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.

 
Posted: 03 April 2012 09:56 PM   [ # 10 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 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).

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 15 May 2012 09:30 AM   [ # 11 ]   [ Rating: 0 ]
Joined: 2009-05-11
55 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 smile

 
Posted: 15 May 2012 10:05 AM   [ # 12 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 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

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
Posted: 15 May 2012 01:02 PM   [ # 13 ]   [ Rating: 0 ]
Joined: 2009-05-11
55 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!

 
Posted: 15 May 2012 08:28 PM   [ # 14 ]   [ Rating: 0 ]
Joined: 2011-03-16
67 posts
haseydesign - 03 April 2012 09:56 PM

@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.

smile

 
Posted: 19 May 2012 02:39 AM   [ # 15 ]   [ Rating: 0 ]
Joined: 2012-03-08
173 posts

@koichirose

Sorry for the delay in reply - busy week.

Firstly, what you have done regarding copying the ‘english/flexi_cart_lang.php’ file to ‘italian/flexi_cart_lang.php’ and translating the file is correct.
As for the hook, I’m not too familiar with using hooks in CodeIgniter, and from a quick attempt myself, I see your problem.

However, do you really need to set the language via a hook?
Typically, if you want to set a specific language you can define the language via CodeIgniters config.php file, by setting

$config['language''italian'

If you need a more variable solution, so that for example the language could be changed by a user on the site, you can define the language to use via the __construct() of the controller,  just before the flexi cart library is loaded.

$this->lang->load('flexi_cart''italian');
  
$this->load->library('flexi_cart'); 

Would this be suitable?
Would you mind sharing the translated Italian language file with the library? I’ll be sure to credit your name to the file.

————————————————————————————————————————————————

@Patrick Spence
I’ve seen Stripe being mentioned about a fair bit.
As you say, the problem with developing for alot of payment processors is needing to create a financial account, but since you say Stripe doesn’t require this, i’ll have to give it a look when I get some time.

 Signature 

flexi-auth | A user authentication library for CodeIgniter.
flexi-cart | An e-commerce shopping cart library for CodeIgniter.

 
1 of 11
1