EllisLab text mark
Advanced Search
4 of 9
4
   
flexi cart - A comprehensive shopping cart library for CodeIgniter
Posted: 24 September 2012 09:29 AM   [ Ignore ]   [ # 51 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@JoJo

You were so close dude, you just needed to set the usage limit (disc_usage_limit).

Here’s the revised code.

INSERT INTO `discountsVALUES (108000000'test1''test discount code'000.001.001100''''''99'2012-9-19 12:54:41''2012-9-29 00:00:00'11); 

The usage limit defines how many times the discount can be used, when set to 0, the cart thinks all the discount codes have been used up.

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

I understand looking at the discount tables is a little daunting with so many columns and options.
To help out in future, I would suggest you create a separate installation of the flexi cart demo so that you can do stuff like build discounts via the provided demo and see what kind of output it does.

If you want/need to create discounts via your site, copy the code from the discount builder in the demo.
http://haseydesign.com/flexi-cart/admin_library/summary_discounts

 Signature 

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

 
Posted: 24 September 2012 09:35 AM   [ Ignore ]   [ # 52 ]   [ Rating: 0 ]
Joined: 2012-09-04
7 posts

@haseydesign

Thank you for your help and patience - you are correct that was the problem though I was hoping to be able to have an unlimited use which is why I wasn’t setting it!

 
Posted: 01 October 2012 05:53 AM   [ Ignore ]   [ # 53 ]   [ Rating: 0 ]
Joined: 2012-08-08
5 posts

@haseydesign

Thanks for the fix. Hopefully I’ll have the time to give it a try in the next few days.

 
Posted: 01 October 2012 09:35 PM   [ Ignore ]   [ # 54 ]   [ Rating: 0 ]
Joined: 2012-03-27
17 posts

How exactly does the shipping work? Is there some sort of integration with any major carriers(ups, usps, or fedex)?

 
Posted: 02 October 2012 08:09 AM   [ Ignore ]   [ # 55 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@Procode

The shipping within flexi cart has to be manually defined - there is currently no integration with any shipping companies.

However, that said, there are still many options to allow you to customise shipping rates for many different circumstances.

Shipping rates can be based on:
+ Location / Zone.
+ Order values and weight.

Shipping options include:
+ Different pricing tiers can be defined within each shipping option.
+ Customised tax value - that can differ from the default cart value.
+ Inclusion/Exclusion from cart discounts - i.e. A 10% cart wide discount could be excluded from affecting the shipping value.

Examples of setting shipping rates via an admin backend can be seen at:
http://haseydesign.com/flexi-cart/admin_library/shipping
http://haseydesign.com/flexi-cart/admin_library/shipping_rates/1

If you, or anyone else does go down the road of trying to implement 3rd party shipping rates that can be integrated into the cart library, I’d be happy to lend a hand so the code could be included within the library for others to use. All contributors would be credited.

 Signature 

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

 
Posted: 20 October 2012 07:15 AM   [ Ignore ]   [ # 56 ]   [ Rating: 0 ]
Joined: 2011-11-25
5 posts

Flexi cart is a great library of shopping cart functions. I am trying to use it for an ecommerce project, but find it lacks adding new items. What I am going to do is to use the demo_items table itself to create new items and proceed from there. Please let me know the associated tables to be populated along with adding a new product item.

If possible can you please add sample code for adding a product item.

Thanks

 
Posted: 21 October 2012 11:42 PM   [ Ignore ]   [ # 57 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@georgegijo

The flexi-cart library deliberately doesn’t come with any product item management functions. The reason being is that e-commerce sites can have vastly different database
designs from one site to another.

So by omitting the functionality from the library, it allows the developer to plug the library into the setup they want, rather than forcing them to use a design that is potentially unsuitable to their needs.

To get a better understanding of some of the most common database designs for product tables on e-commerce sites, checkout this very good summary posted on Stackoverlow @ http://stackoverflow.com/a/695860/99106

As the most basic of examples, the flexi-cart demo includes a single table named ‘demo_items’. If you need an example of inserting records to this table it could be done as simply as:

$sql_insert = array(
    
'item_cat_fk' => 3,
    
'item_name' => 'My Example Item',
    
'item_price' => 29.99,
    
'item_weight' => 9
);
$this->db->insert('demo_items'$sql_insert); 

However, if you’re unfamiliar with the native functions within CI (As used above), then I suggest you spend a couple of hours reading through the CI documentation just to give yourself an idea of what CodeIgniter can do. Once you know what it can do, then you can hunt down how to actually do it when you need to apply it.

http://ellislab.com/codeigniter/user-guide/database/active_record.html

 

 Signature 

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

 
Posted: 25 October 2012 10:17 PM   [ Ignore ]   [ # 58 ]   [ Rating: 0 ]
Joined: 2012-10-25
3 posts

While I was looking forward to using your library I can’t make it work. I installed all the files correctly (demo files running fine as well) and just want to add an item to the cart and that’s where it goes wrong.
I’m using this code in my controller:

$cart_data = array(
                
'id' => $item_id,
                
'name' => $name,
                
'quantity' => $quantity,
                
'price' => $price
            
);

       
$this->flexi_cart->insert_items($cart_data); 

And this is the error:

Message: Undefined index: internal_price
Filename: models/flexi_cart_model.php
Line Number: 771

Which is a variable that according to the documentation is calculated automatically.
This is an exact copy of the code from the demo. What am I doing wrong?

 
Posted: 26 October 2012 05:08 AM   [ Ignore ]   [ # 59 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@AlwynW

I know this will be a frustrating answer for you, but from what I can see, this is (Most likely) going to be a configuration problem that you are having. A problem that is going to be very hard for me to pinpoint without seeing your library setup.

The insert_items() code you have posted is fine - this is not where your problem lies.

What I do when in your situation is to reverse engineer the demo (Which you suggest IS working for you).
Take one of the working examples from the demo, and piece by piece, start changing the code to match the codebase you’re aiming to create. Keep testing everytime you remove or add code until something causes the error you are seeing - then you will have found your problem.

If your still having trouble you could send me your current setup zipped and I’ll try and have a look at it when I get time.

Good luck.

 Signature 

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

 
Posted: 26 October 2012 11:49 AM   [ Ignore ]   [ # 60 ]   [ Rating: 0 ]
Joined: 2012-10-25
3 posts

@haseydesign thanks for the quick answer. There was a problem with the data I send to the cart which triggered an error in the calculation.
Another issue I’m facing is that the data doesn’t seem to be stored in between pages. So the item is added to the cart but after a redirect the cart is empty again.

Any idea?

 
Posted: 26 October 2012 10:22 PM   [ Ignore ]   [ # 61 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@AlwynW

This problem is usually caused if you are not saving session data to a database.

This is defined via a config setting in the CI config file.

$config['sess_use_database'TRUE

For the this to work, you have to also ensure the session database table has been created.
Read more at http://ellislab.com/codeigniter/user-guide/libraries/sessions.html under the subheading Saving Session Data to a Database

 Signature 

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

 
Posted: 28 October 2012 06:36 PM   [ Ignore ]   [ # 62 ]   [ Rating: 0 ]
Joined: 2012-10-25
3 posts

Again thanks for taking the time to look at my question. It seems to be a combination of things I did wrong (got the settings right after all). Note to self, make sure you only load the library once. I did a load on construct and another in the controller function which messed it all up. I figured it out and everything works as expected now!

Another question though, is it possible to configure the following system, either with points or vouchers and what would be the best way to go:

Each purchase grants the user a discount of 2% of the amount (of the current sale) for the next purchase. The user should be able to save these discounts until they want to use it (after each next purchase the discount adds to the existing one).
So it’s not mandatory they use it for a next purchase.
I think the point system is not really useful for this or I had to abuse it so each point is in fact 1 euro/dollar.

 
Posted: 30 October 2012 05:18 AM   [ Ignore ]   [ # 63 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

Hey again AlwynW,

The libraries reward point feature would not really be suitable for the functionality you have outlined as it is intended to be monetary based.

However, there would be nothing stopping you creating a new discount every time the user placed an order that was linked to the users id. The discount could then be defined with a voucher code so that the user can then redeem the voucher when they wish.
Upon creating the discount, you could check whether the user had an existing discount, and then just up the percentage as required.

Whilst this is possible, I will advise you that incrementing the discount as you have described without any other conditions would be a very bad idea. All I would need to do is place 50 separate orders for the cheapest item on the site. This would increment my discount to 100% (50 orders x 2%), I could then place another order for everything on your site with a 100% discount - free!
So just make sure you have some conditions capping the percentage at a maximum limit.

 Signature 

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

 
Posted: 06 November 2012 06:46 AM   [ Ignore ]   [ # 64 ]   [ Rating: 0 ]
Joined: 2012-11-06
2 posts

Hi when i add items to cart in the demo the cart is shown empty in view cart. plz help

 
Posted: 06 November 2012 07:06 AM   [ Ignore ]   [ # 65 ]   [ Rating: 0 ]
Joined: 2012-03-08
156 posts

@harpreets

Refer to my post above to AlwynW and the solution he came up with, that appears to be the most common cause.

 Signature 

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

 
4 of 9
4