Hi there,
At the moment I am developing a plugin which acts as a sort of shopping cart for a site. All is working fine except for when I am logged into the control panel as a Super Admin user I get these errors at the top of the shopping cart page :
Notice: Undefined index: shop in /usr/local/psa/home/vhosts/mysite/httpdocs/admin/plugins/pi.shopping_cart_functions.php on line 68 Notice: Undefined index: shop in /usr/local/psa/home/vhosts/mysite/httpdocs/admin/plugins/pi.shopping_cart_functions.php on line 68
This only happens when there is nothing in the cart and I am logged in as a Super Admin user. If a normal member is logged in then no errors.
As the plugin is working fine, items can be added to it, taken away etc I know that there must be something that I am missing but I just don’t seem to be able to find what it is.
At this stage I would rather not post my plugin code as this is for a client site and something which they are paying for. I do want to release this in the end (for free of course 😉 ) as that’s what I always do with anything I make but was just wondering exactly what that phrase means. I did a search on the world-wide-thing-u-me-bobby and it came back with loads of people having problems with Undefined Index but nothing conclusive.
As a basic outline of what the plugin does it is something like this.
Weblog entries which have a corresponding Simple Commerce Module entry are shown in the usual way. Clicking my Add To Cart link adds the entry_id of the entry to a session variable stored in this manner :
1,2,3,1,3
So there is one of entry_id 2, two of entry_id 1 and entry_id 3.
All the plugin does is then show the information for the entry_id swapping out variables as it goes. The only problem I have is when the cart is empty ie no data stored in the session variable then it comes up with those errors.
Just wondered if anyone had any ideas as to what it all means?
Thanks for any help anyone can give on this and sorry that at the moment I can’t show the code, I know that doesn’t help much 😉
Best wishes,
Mark
Hi Victor,
Thanks for the explanation. Will go back on my code with a fine tooth-comb now. Pretty sure that I’m not actually doing that anywhere where the problem is occurring though but will definitely bear that in mind whilst trouble-shooting this one.
Thanks for the information.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.