Remember the 3 pitfalls of CI2.0 shopping cart category

PHP中文网
Release: 2023-03-13 21:44:01
Original
2474 people have browsed it

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;
Copy after login



2. When the quantity remains unchanged, the shopping cart information cannot be modified

if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty'])
{
    //return FALSE;
}
Copy after login



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?
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!