Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter
#11

[eluser]haseydesign[/eluser]
@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

[eluser]koichirose[/eluser]
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:
Code:
//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
#13

[eluser]haseydesign[/eluser]
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/standa..._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_g...data_admin details the functions required for this feature.

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

[eluser]koichirose[/eluser]
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:
Code:
$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:
Code:
$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

[eluser]Patrick Spence[/eluser]
[quote author="haseydesign" date="1333504591"]@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.
[/quote]

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
#16

[eluser]haseydesign[/eluser]
@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
Code:
$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.
Code:
$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.
#17

[eluser]Patrick Spence[/eluser]
Quote:@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.

I threw up the code I am using to talk to stripe here: https://github.com/ariven/stripe-integration-as-models

They really were easy to work with, only took me a couple days to type it all in. I have it active on one ecommerce site now, and am in the middle of integrating in another. Its taking me longer to create the forms and do program logic on the site rewrite than it does to integrate the charging.

One advantage to stripe is that you can use their javascript method to grab a card token, so the customers credit card doesn't have to hit your server... so less issues with PCI-DSS and hacked sites.

Though you CAN grab the card and get a token via php.
#18

[eluser]koichirose[/eluser]
Sure, here it is: http://pastie.org/3943648

I'm not a professional translator though.
We're planning to translate this to russian, too. I'll send you that one when it's ready Smile

The language tip is working. I thought that once loaded in the model I couldn't overwrite the language setting.

Thank you once again!
#19

[eluser]haseydesign[/eluser]
I have just released an update to the flexi cart library, which is available to download from the Github repo at https://github.com/haseydesign/flexi-cart.

The update includes some improvements to how status and error messages are returned by some of the internal functions within the library.
As well as specifying whether a message should only be displayed to either public or admin users, there is now a config option to prevent specific messages from being set at all.

Additionally, there are now additional language files that the libraries status and error messages can be displayed as.
The languages are Italian (Thanks @koichirose for this), French, German and Spanish.

For further information on these changes, please refer to the change log and user guide.
#20

[eluser]koichirose[/eluser]
Hey, thanks for the credit.

I just saw that the save_order function saves on two db tables (order_summary and order_details).
I need to introduce a third table in between, ex.:
order_summary has an order_id (autoincrement) = 23
order_store has an order_summary_id = 23 and an order_store_id (autoincrement) = 54
order_details has an order_store_id = 54 and an order_details_id (autoincrement) = 187

This is necessary for a multi-store e-commerce site.

Can it be done somehow with flexi-cart?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB