CodeIgniter Forums
flexi cart - A comprehensive shopping cart library for CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: flexi cart - A comprehensive shopping cart library for CodeIgniter (/showthread.php?tid=50013)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 12-20-2012

[eluser]xuma[/eluser]
Hey haseydesign

I cant deeply analyze your code so my question is a bit simple.

Where can i change price and currency symbol order ? ( like 45 £ )


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 12-20-2012

[eluser]haseydesign[/eluser]
Hey xuma,

There are two methods of how to define currency within flexi cart, either manually via the config file, or via using the currency database table. The currency table is only needed if converting prices between multiple currencies.

To set via the config file, take a look at http://haseydesign.com/flexi-cart/user_guide/currency_config#config_defaults
Code:
$config['defaults']['currency']['name'] = 'GBP';
$config['defaults']['currency']['symbol'] = '£';
$config['defaults']['currency']['symbol_suffix'] = FALSE;
$config['defaults']['currency']['thousand_separator'] = ',';
$config['defaults']['currency']['decimal_separator'] = '.';

There are then some currency functions within the library that can format values for you.
http://haseydesign.com/flexi-cart/user_guide/currency_index



flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 01-07-2013

[eluser]GhostPepper[/eluser]
Hello again Haseydesign

My little tax situation is all cleared up. I just needed to unset the "prices include tax" property in Cart Configuration.

I'm now setting up the Checkout sequence and I'm not understanding how "$this->flexi" works. Is it saving information to a cookie? I ask because I'd like to separate the shipping/billing information to its own page in the Checkout sequence. In the final Checkout page, I'd like the customer to view their shipping/billing information and all the relevant cost calculations. To transfer the shipping/billing information to this page, I was thinking of creating the array "$this->flexi->shipping_information" and using it as the data vehicle, but if it's saving data to a cookie, I'm concerned about customer privacy... don't want their personal data being accessible to anyone that can look at the cookie.

Thanks!


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 01-08-2013

[eluser]koichirose[/eluser]
Hi haseydesign,

First of all happy new year!

I'm back with a new issue Smile

I'm trying to use custom statuses for discounts.
I set '1' as custom_status_1 in my discount table:
Code:
INSERT INTO `discount` (`discount_id`, `discount_type_id_fk`, `discount_method_id_fk`, `discount_tax_method_id_fk`, `user_id_fk`, `TEMP_product_version_id_fk`, `discount_group_id_fk`, `country_id_fk`, `zone_id_fk`, `discount_code`, `description`, `quantity_required`, `quantity_discounted`, `value_required`, `value_discounted`, `is_recursive`, `is_non_combinable_discount`, `void_reward_points`, `force_ship_discount`, `custom_status_1`, `custom_status_2`, `custom_status_3`, `usage_limit`, `insert_time`, `update_time`, `start_date`, `end_date`, `status`, `order_by`)
VALUES
(3, 2, 7, 1, NULL, NULL, 0, 0, 0, 'TESTUSER', NULL, 0, 0, 0.00, 10.00, NULL, NULL, NULL, NULL, '1', '0', '0', 16777215, '2013-01-08 14:44:21', '2013-01-08 14:44:21', '2013-01-08 14:43:57', '2013-01-15 14:43:57', 1, 100);

Trying to apply the 'TESTUSER' discount, it is correctly not applied, since the custom status does not match, but the status message says 'Discount code has been set'.

Using 'set_custom_status_1(1)' correctly applies the discount.

This is a minor bug anyway Smile

I also noticed that discount messages are all set in english, even if the set language is another one.
I tried emptying my cart, for example, and the returned status messages are in Italian (correct).
It seems all discount functions have this issue.

I also wanted to share the Russian language file with you. I told you I would have done it but then completely forgot.
Here it is: http://pastie.org/5648272

Thank you!


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 01-10-2013

[eluser]haseydesign[/eluser]
@GhostPepper

The variable '$this->flexi' is used by the library as a global variable that CodeIgniters libraries, models and controllers can all access.
The inclusion of the variable was never intended in my initial design of the library and ideally still wouldn't be included, but was added to fix a warning that would occur for users using PHP 5.4.
The variable has nothing to do directly with cookies or session data and is soley intended for internal use by the flexi cart library and so you shouldn't use it to store you own data.

If you want to preserve custom user data (i.e. Data not available from the cart), then you would typically use session data.
By using sessions, you will perserve the data between page loads and it will be secured and inaccessible to other users.

Hope that helps!


@koichirose

Welcome back Wink
Thanks for the pointers on the discount bugs you've noted, I'll try and look into these when I get a spare moment.

Also many thanks for the translated language file.
When I fix the above bugs I'll be sure to add the file to the repo with full credit listed to yourself.

Thanks Rob.


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 02-01-2013

[eluser]haseydesign[/eluser]
Quote:Hi, Rob, great work i must say on the flexi-cart framwork. It has made my work easy and professional. "Thumbs Up" . Is there a way to implement the wish list using the flexi cart?

@Ademola (via Email)

The flexi cart library does not include a 'wish list' feature, however, they are very easy to implement yourself.

All you would need to do is create a new database table with a column for item ids and another for customer ids. These columns would act as foreign keys to the related item and customer tables.

When a customer wishes to add an item to their wishlist, simply insert the item id and customers id (They would need to be a registered user) to the table.

Whenever they wish to view items on that list, you would do an SQL SELECT query to return all items that belong to the users id.

Hope that helps!


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 02-04-2013

[eluser]koichirose[/eluser]
Hi haseydesign,

I'm still trying to fix the rounding problem when adding tax data to a cart item.

I set this in the config:
Code:
$config['defaults']['configuration']['price_inc_tax'] = false;

And here's the array I'm passing to your insert_items() function:
Code:
$updated_item_data = array(
  'id' => $product->product_version_option_id,
  'name' => $product->model,
  'price' => $product->rrp_eur_ex_tax,
}

'price' there is 24.785 (I'm trying to save three decimals to see if I can fix it).
Tax rate is 21%, so the price including tax should be 29.98985 => 29.99

This is what I'd like.
For some reason, flexi_cart saves 30.00 internally.

I could change the config and do the calculations myself, but I'd like to understand where this is coming from.

Could you point me to the line where the calculation is made?

I guess it's in flexi_cart_lite_model:545, but I see that there (and in calculate_tax(), above) $value is already 24.79, with just two decimals, so I'm kind of lost and can't find where this rounding is done.

Thank you again!


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 02-06-2013

[eluser]demolala[/eluser]
[quote author="haseydesign" date="1359779620"]
Quote:Hi, Rob, great work i must say on the flexi-cart framwork. It has made my work easy and professional. "Thumbs Up" . Is there a way to implement the wish list using the flexi cart?

@Ademola (via Email)

The flexi cart library does not include a 'wish list' feature, however, they are very easy to implement yourself.

All you would need to do is create a new database table with a column for item ids and another for customer ids. These columns would act as foreign keys to the related item and customer tables.

When a customer wishes to add an item to their wishlist, simply insert the item id and customers id (They would need to be a registered user) to the table.

Whenever they wish to view items on that list, you would do an SQL SELECT query to return all items that belong to the users id.

Hope that helps![/quote]

Yeah thnks Rob, it helps


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 02-06-2013

[eluser]haseydesign[/eluser]
@koichirose

The line you are probably after is @ flexi_cart_model.php:259.
This line changes the item price to a 2 decimal number, however, you can change this to 3 decimals simply by changing the code as shown below.

Code:
$item_price = $this->format_calculation($item_data[$this->flexi->cart_columns['item_price']], 3, TRUE);

From my quick testing of your example, this does result in a total of 29.99 - so maybe this will help you out?


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 02-07-2013

[eluser]koichirose[/eluser]
Hi,

This has been very helpful.
I'm wondering if you could include that change in the repository.
It won't hurt programmers that use two decimals I think, but it'll be of great help for those that need it.

I think there's the same issue with coupon codes - I created a 10% off product summary coupon code, here's the result:
Products Total € 101.99
Shipping Total € 26.62
Coupon Code - € 10.20
Order Total € 118.41

As you can see, the discount should be 10.19, but some rounding is happening somewhere.

This is not a big issue, but since we're talking about it...

Thank you again Smile