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 - 02-22-2013

[eluser]haseydesign[/eluser]
@lalocespedes

There are multiple examples within the demo on how to insert items to the cart and they all work.

Via a link : http://haseydesign.com/flexi-cart/lite_library/item_link_examples
Via a form: http://haseydesign.com/flexi-cart/lite_library/item_form_examples
Via Ajax: http://haseydesign.com/flexi-cart/lite_library/item_ajax_examples
Via a database: http://haseydesign.com/flexi-cart/lite_library/item_database_examples

You need to dig into the included demo code examples starting with controller/standard_library.php and models/demo_cart_model.php.


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

[eluser]ben_co[/eluser]
Hi,

Your library looks really interesting (well documented too !) and I plan to integrate it into an existing CI-based website.

I have a question related to "zones". I installed the demo and took a look how it's working but I can't figure out how I can assign a freshly-created zone to a location and how I can qualify it as "tax" or "shipping" related.

It seems your method location_zones() only returns zones that are "already" assigned to locations as tax or shipping zone when the parameter $zone_type is specified.

As the sql query is "inner join"-based, orphan zones are never selected and thus never appear in the selectboxes "tax zones" and "shipping zones".

I don't know if it's a bug or if I simply misunderstood how it works globally...

Could you help me please ?

Thanks in advance,

Benco.


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 03-05-2013

[eluser]haseydesign[/eluser]
@ben_co

You ask a good question as I appreciate it probably isn't the best implementation of how this works, but here goes.

With the location_zones() function, if you do not pass an argument to the function, then all zones will be returned.

Once the zone has been related with a location as either a shipping or tax zone, it will then be able to be filtered and returned via the location_zones() function by passing the argument of either 'shipping' or 'tax'.

As I say, not the most elegant feature I coded into the library, but once related to a location, it does work.

HTH


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 03-05-2013

[eluser]ben_co[/eluser]
Hello,

Thanks for your reply.

Quote:Once the zone has been related with a location as either a shipping or tax zone, it will then be able to be filtered and returned via the location_zones() function by passing the argument of either ‘shipping’ or ‘tax’.

That's what I guessed but thanks for your clarifications.

My problem is actually related to the demo than to the way the method location_zones() works.

If you goes to Zones Management: http://haseydesign.com/flexi-cart/admin_library/zones and then add a new zone, it's not possible to use it directly in the Locations Management.
For instance, going to: http://haseydesign.com/flexi-cart/admin_library/insert_location/3 (after adding a new zone) won't allow you to select the new zone in the Shipping/Tax Zone selectboxes because location_zones() filters the zones that are linked at least once when the parameter $zone_type is specified....

Don't know if it makes all clear now to you...


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

[eluser]haseydesign[/eluser]
@ben_co

I see the problem you are pointing out with the example, but I see it as more of a problem with how the demo implements the feature, rather than an outright fault with the library.

A way to get around this problem within the demo, would be to NOT pass the argument 'shipping' or 'tax' to the location_zones() function for both select menus. This would mean that all zones would be returned for both select menus.

Remember that the demo is simply an example of how you can use the library, not necessarily how you have to use the library.

If you have an alternative suggestion to the demo implementation, I'm willing to listen.


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

[eluser]zgames[/eluser]
Hello,

Is it possible to set max item buys per session with this library?


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

[eluser]haseydesign[/eluser]
@zgames

There is no single function within the library to do this for you, but I'm sure you could use a combination of the functions available to write your own.

When you say session, can you elaborate exactly what you mean?
What happens when the user completes an order? Can they start another cart?
What if the user clears their browsers cookies?
What if the user uses another browser?

There are many scenarios that would affect how this functions.


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

[eluser]zgames[/eluser]
Session would work just for that particular time of order,
so user or a guest orders x orders (x orders are defined by maxOrders), next time they want to order something, same rules apply again.
what I'll be trying to do is to create car rental shop, I guess flexi cart is a good base for it, I could add maxOrders to 1, I just need to figure out the logic, also few new functions will be needed e.g rent car start and end dates

I'll be looking through the code for couple of days, it's my first time building a rental website, so it is going to be fun and challenging time Smile



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

[eluser]haseydesign[/eluser]
@zgames

Just to clarify whether I understand, you want to limit the number of items a user can order per shopping cart.
So if there is a limit of 3 items, they can add a maximum of 3 items and that is all they will be allowed to purchase from that order.
However, if they complete their cart order, there would be nothing to stop the user buying another 3 different items using a different cart session. Is that correct?

If so, then you are probably best off just doing a quick check for the number of item rows in the cart before an item is inserted to the cart.
You can do this using total_rows().

An example would be something like the following:
Code:
if ($this->flexi_cart->total_rows() <= 3)
{
  $item_data = array(...);
  $this->flexi_cart->insert_items($item_data);
}

You can see a huge list of functions that are available relating to the contents of your cart via the user guides cart item and summary functions.


flexi cart - A comprehensive shopping cart library for CodeIgniter - El Forum - 03-12-2013

[eluser]haseydesign[/eluser]
Quote:I am trying to achieve the effect of applying unlimited number of vouchers that is based off a custom table. I have a function that calls flexi cart to put that in as a manual discount. That's when I realized it is not cumulative.

Also, on top of custom vouchers, I want to have discounts (as part of flexi cart) that can be applied to the cart summary. Currently, as I understand, it's taking the largest discount possible from the manual discounts (my custom vouchers) and the code discounts. I was hoping to achieve the effect of stacking.

@Khang via email

Since you're going the custom route, you could possibly create the summary discounts 'live' as the user is entering the custom voucher codes.

I don't know exactly how your custom voucher table is going to work, but let's say it's as follows.
The customer voucher table contains a set of voucher codes, with their own discount conditions.

When the customer adds a code to the cart, you check your custom table whether it is valid, if so, you then manually create a new discount within flexi-cart that matches the discount of the single voucher.
Then for every other valid voucher code added, delete the flexi-cart discount you just created, and create a new one that matches the discount total for your two custom vouchers.
Repeat as necessary.
To create the discounts within flexi-cart, you’re probably best off using the ‘set_discount()’ function rather than using the database discount tables.

---

P.S. I ‘think’ I remember why only one discount can be applied per summary column.
Allowing multiple discounts could lead to potential unintended discounts depending upon the order of how the discounts were applied.
For example, a $10 discount and a 10% discounts applied to a cart total of $100.

Example #1 – discount $10 first, then 10%
$100 - $10 = $90
$90 – 10% = $81

Example #2 – discount 10% first, then $10
$100 – 10% = $90
$90 - $10 = $80

This may then have caused further complications with what the correct legal implementation of tax should be under certain laws and circumstances.

Good luck