 |
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
 | This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

November 17th, 2008, 01:46 PM
|
Registered User
|
|
Join Date: Nov 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Php Error when calling the cart() control function
Hello,
If i understand everything  ,when it call the cart() function from the controller,
Code:
function cart($productid){
if ($productid > 0) {
If customer click on add to cart then the $productid will be pass but this function is also dispyaing the content of the cart and this time the $productid is NULL (echo " ".anchor("shopping/cart","view cart");)
so this is causing two notice php error, i think i can find a way to fix but maybe i miss something here?
Any idea?
thx, and great book so far :)
|

November 17th, 2008, 01:58 PM
|
Registered User
|
|
Join Date: Nov 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
also when i m connect to the home page with nothing in my cart yet i ve got this error message,
Quote:
Severity: Notice
Message: Undefined index: cart
Filename: views/header.php
Line Number: 11
|
this is the line:
if (count($_SESSION['cart']) == true){
i think both error message are related but cannot find my error...
thx!
|

January 10th, 2009, 12:28 PM
|
Registered User
|
|
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm having this same issue. Anyone know what the problem is. It's the books code so it would be great if the author could pitch in to renedy this otherwise I, and others can't finish building the app.
|

January 10th, 2009, 01:47 PM
|
Registered User
|
|
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Possible Solution
Not sure if this helps, I can't remember if this fixed it when I was going through the book but I made a note on page 111 that where it says:
Code:
$nav['navlist'] = $this->MCats->getCategoriesNav();
it should read
Code:
$data['navlist'] = $this->MCats->getCategoriesNav();
I remember that this was the source of an error message I was getting but not sure if it the same one you are getting.
|

January 11th, 2009, 05:47 AM
|
Registered User
|
|
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That's worked a treat. Thanks for that!!!!
|

February 3rd, 2009, 09:31 AM
|
Registered User
|
|
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
|
|
To remove the bug "Undefined Index : cart"
In \system\application\models\morders.php, after //pull in existing cart first!
just put this line :
Code:
$cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
It should look like this now :
Code:
function updateCart($productid,$fullproduct){
//pull in existing cart first!
$cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
And no more "Undefined Index : cart" anymore !!!!   
|
The Following User Says Thank You to wanadoobtdc For This Useful Post:
|
|

February 3rd, 2009, 03:31 PM
|
Registered User
|
|
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quick reply. Haven't tried it yet but a big thanks!
|

March 16th, 2009, 10:02 AM
|
Wrox Author
|
|
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
dangit, I've been answering questions in the wrong places
Guys, I am so sorry. I've been answering questions via email. Yes on both counts, the $nav array should be $data, and yes, the original code has an isset() for the shopping cart, but didn't get inserted back into the text of the book.
if anyone wants to see my copy of the code, simply send an email to tom AT tripledogs DOT com. I will send you an archive.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
|

November 14th, 2011, 06:59 AM
|
Registered User
|
|
Join Date: Jul 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by krifur
Hello,
If i understand everything  ,when it call the cart() function from the controller,
Code:
function cart($productid){
if ($productid > 0) {
If customer click on add to cart then the $productid will be pass but this function is also dispyaing the content of the cart and this time the $productid is NULL (echo " ".anchor("shopping/cart","view cart");)
so this is causing two notice php error, i think i can find a way to fix but maybe i miss something here?
Any idea?
thx, and great book so far :)
|
Hi
Can you or anyone else please tell me how did you solve this problem?
I am trying to get around it, but I am unable to solve it?
I am getting those two errors thrown at my face again and again:
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Welcome::cart()
Filename: controllers/welcome.php
Line Number: 68
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: productid
Filename: controllers/welcome.php
Line Number: 70
Regards, Zoreli
|

February 23rd, 2012, 08:02 AM
|
Registered User
|
|
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hey i am getting the same errors any update on it??
|
|
 |