CIFramework, the full name is CodeIgniter, I believe everyone is familiar with it, she is a small php framework, CI China official website documentation is also very comprehensive, and now ci4.0 also It's out and namespace has been added.
But I personally still prefer its 2.0 version.
The shopping cart function has been abandoned in later versions, but for students who are using ci2.0, I have summarized several bugs in the shopping cart class,
The code is as follows:
1. The judgment rules for product names are not friendly to Chinese. Often causing the addition to fail.
//log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); //return FALSE;
2. When the quantity remains unchanged, the shopping cart information cannot be modified
if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty']) { //return FALSE; }
3. Only the quantity can be modified , cannot modify additional options options
Modify options additional options
$this->_cart_contents[$items['rowid']]['qty'] = $items['qty']; $this->_cart_contents[$items['rowid']]['options'] = $items['options'];//here new?
This article is provided by php Chinese website,
Original address: http://www.php.cn/php -weizijiaocheng-374137.html
Please do not reprint~~~~
The above is the detailed content of Remember the 3 pitfalls of CI2.0 shopping cart category. For more information, please follow other related articles on the PHP Chinese website!