CodeIgniter Forums
Maximum 8 products in the shopping cart? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Maximum 8 products in the shopping cart? (/showthread.php?tid=54702)



Maximum 8 products in the shopping cart? - El Forum - 09-20-2012

[eluser]Unknown[/eluser]
Hello world!

I have one question about the shopping cart, it works normally, but the maximum number of products stored product to cart is only 8, it is too little for my application

So I want to ask how to configure to my shopping cart can store more than eight product?

Thank you


Maximum 8 products in the shopping cart? - El Forum - 09-20-2012

[eluser]skunkbad[/eluser]
Store your session in the database or change the session encryption to something like blowfish so the encrypted session data isnt so big.


Maximum 8 products in the shopping cart? - El Forum - 09-24-2012

[eluser]Unknown[/eluser]
thank you, but you can tell more details?I still do not know what you mean


Maximum 8 products in the shopping cart? - El Forum - 09-24-2012

[eluser]TWP Marketing[/eluser]
What Brian is saying is that the shopping cart uses the Sessions library to store cart data and there is a limit on the size of cookies (4Kb) which can be stored locally. So, change to using database sessions (see the User Guide) which gives you virtually unlimited data space. It still uses a cookie, but the data itself is stored in a file on your server. The User Guide is your friend, sleep with it under your pillow and consult with it frequently.


Maximum 8 products in the shopping cart? - El Forum - 09-24-2012

[eluser]skunkbad[/eluser]
[quote author="TWP Marketing" date="1348501414"]What Brian is saying is that the shopping cart uses the Sessions library to store cart data and there is a limit on the size of cookies (4Kb) which can be stored locally. So, change to using database sessions (see the User Guide) which gives you virtually unlimited data space. It still uses a cookie, but the data itself is stored in a file on your server. The User Guide is your friend, sleep with it under your pillow and consult with it frequently.[/quote]

And the other side of what I suggested is that the session encryption be changed to something that doesn't produce strings that are 10 times the size of the original data. By default CodeIgniter uses MCRYPT_RIJNDAEL_256, but if you change it to MCRYPT_BLOWFISH the size of the data becomes way smaller. I do this in MY_Encrypt.php

Code:
<?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');
/**
* Community Auth - MY_Encrypt Library
*
* Community Auth is an open source authentication application for CodeIgniter 2.1.2
*
* @package     Community Auth
* @author      Robert B Gottier
* @copyright   Copyright (c) 2011 - 2012, Robert B Gottier. (http://brianswebdesign.com/)
* @license     BSD - http://http://www.opensource.org/licenses/BSD-3-Clause
* @link        http://community-auth.com
*/

class MY_Encrypt extends CI_Encrypt {

/**
  * Constructor
  *
  * Simply determines whether the mcrypt library exists.
  *
  */
public function __construct()
{
  parent::__construct();
}

/**
  * Get Mcrypt cipher Value
  *
  * This method is extended only to set the default encryption to blowfish.
  * This has only been chosen to cut down on the encrypted string length, as
  * the default, which is MCRYPT_RIJNDAEL_256 creates strings that are roughly
  * 10 times the length of the original string.
  *
  * @access private
  * @return string
  */
function _get_cipher()
{
  if ($this->_mcrypt_cipher == '')
  {
   $this->_mcrypt_cipher = MCRYPT_BLOWFISH;
  }

  return $this->_mcrypt_cipher;
}

// --------------------------------------------------------------------

}

// END MY_Encrypt class

/* End of file MY_Encrypt.php */
/* Location: ./application/libraries/MY_Encrypt.php */



Maximum 8 products in the shopping cart? - El Forum - 09-24-2012

[eluser]CroNiX[/eluser]
Seems like a good thing to be added into the core for the main config settings (encryption algorithm)


Maximum 8 products in the shopping cart? - El Forum - 09-24-2012

[eluser]skunkbad[/eluser]
[quote author="CroNiX" date="1348515217"]Seems like a good thing to be added into the core for the main config settings (encryption algorithm)[/quote]

Yeah, it does seem kinda ridiculous to have to extend the Encrypt class just for this.