Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8225365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:23:33+00:00 2026-06-07T15:23:33+00:00

By default Codeigniter shopping cart class uses its built-in session functions. Session class in

  • 0

By default Codeigniter shopping cart class uses its built-in session functions. Session class in CI can be configured to use cookie or database, which means the shopping cart will EITHER use database or cookie to store session variables.

However for my site I want to implement this: when the user is not logged in, the cart uses cookie data; when the user is logged in, the cart uses data stored in database. This means the cart class should be able to switch between cookie and database.

How can I achieve that while not making changes to the built-in cart class? If that’s not possible I may have to rewrite the cart class which takes some work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:23:34+00:00Added an answer on June 7, 2026 at 3:23 pm

    There are two methods possible.

    1. Inherit your inbuilt card class and override the product_insert, product_update and product_delete methods. This is cleaner and provides you with better customizability. The feature you need is pretty trivial and you can do it with something like this.

      function product_insert() {   
        checkUserSignedIn();   
        if(true) {
          parent::product_insert();   
        } else {
          doYourthingHere();   
        } 
      }
      

    override all the crud methods like this and you can achieve what you want.

    1. Use the customized library

    http://codeigniter.com/forums/viewthread/212926/P10/#1006680

    it has some features that you need but still you will have to tweak it to suite your requirements exactly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the codeigniter session class (autoload). How can I set initialize values? I
I'm using CodeIgniter's Session class to manage my sessions for a cart/checkout system. The
I use codeigniter's session class with the option to store session data in a
I'm trying to use Codeigniter OpenID library and everything work fine with default configuration
So I have a framework we've built on codeigniter. It uses regular codeigniter sessions
I am using the Cart class of CodeIgniter, basically that's just sessions. Now, Safari
I'm trying to use Phil Sturgeon's CodeIgniter Template library , but I can't get
I would like to access the $db['default']['dbprefix'] variable from /application/config/database.php ( CodeIgniter configuration file)
I am trying to use the sqlite database with codeigniter. I created a table
I am getting a Unable to load the requested file: default.php error in codeigniter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.