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

  • SEARCH
  • Home
  • 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 8172755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:53:18+00:00 2026-06-06T21:53:18+00:00

Using CI 2.1.1 and the native Cart library If I insert an item (with

  • 0

Using CI 2.1.1 and the native Cart library

If I insert an item (with same product id, same options) more than once, it replaces instead of increasing the qty.

Could this be a bug, am I missing something, or what would be the best way to add this functionality myself?

  • 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-06T21:53:20+00:00Added an answer on June 6, 2026 at 9:53 pm

    So this was my solution, a change to System/libraries/Cart.php on line no. 233 to 244

    There may be better ways to do this but it does the trick. I don’t understand why the functionality isn’t there already

        // EDIT:    added check if idential rowid/item already in cart, then just increase qty
        //          without this addition, it would not increase qty but simply replace the item
        if (array_key_exists($rowid, $this->_cart_contents)) 
        {  
           $this->_cart_contents[$rowid]['qty'] += $items['qty'];    
        } 
        else 
        {
            // let's unset this first, just to make sure our index contains only the data from this submission
            unset($this->_cart_contents[$rowid]);     
    
            // Create a new index with our new row ID
            $this->_cart_contents[$rowid]['rowid'] = $rowid;
    
            // And add the new items to the cart array
            foreach ($items as $key => $val)
            {
                $this->_cart_contents[$rowid][$key] = $val;
            }                       
        }      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does MongoDB supports comparing two fields in same collection by using native operators (not
I am currently using native Java XML processing library (Xerces). I can't use any
I have some codeigniter driven sub-domains and using native codeigniter session library. There is
I am using native C++ with VSTS 2008. A quick question about virtual function.
What is the best method of using native menus in C#? Edit: I want
An informative-sounding blog post from 2006 states these facts about using native prepared statements
Is there a way to communicate with cmd (using native process) in adobe air.
I want to run script file on android Shell using Native C program. I
I am working with Amazon In-app-purchases for Android on flash using native extentions. So,
I just upgraded from tomcat 6.0.29 to 7.0.25 using native apr. Tomcat has crashed

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.