Kee CI2.0 3 Pits of the shopping cart class

Source: Internet
Author: User
CI Framework, full name CodeIgniter, I believe everyone is not unfamiliar, she is a small PHP framework, CI China official website document is also very comprehensive, now ci4.0 also came out, joined the namespace.

But I personally prefer the 2.0 version.

Later version has abandoned the shopping cart function, but for the use of ci2.0 students, I summed up the shopping cart category of several bugs,

The code is as follows:

1. The rules for judging product names are not friendly to Chinese. Often causes the add to fail.

Log_message (' Error ', ' An invalid name ' is 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 number is constant, the shopping cart information cannot be modified

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



3. Can only modify the quantity, cannot modify the additional option options
Modify options Add-ons

$this->_cart_contents[$items [' rowID ']][' qty '] = $items [' qty ']; $this->_cart_contents[$items [' rowID ']][' Options '] = $items [' Options '];//here new?

This article is provided by the PHP Chinese web,

Original address: http://www.php.cn/php-weizijiaocheng-374137.html

Please do not reprint ~ ~ ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.