Plugin

Developer
Supported

MB Shopping Cart Plugin

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Mark Bowen Design

     

You must be logged in to post.

fatal error Unsupported Operand

Support Request

AlanG
AlanG

Hi Mark,

Things were good on a fresh install then as soon as I add an Item to the cart all goes wrong I receive the following error on every cart page:

Fatal error: Unsupported operand types in /home/betascri/public_html/system/expressionengine/third_party/shopping_cart_functions/pi.shopping_cart_functions.php on line 256

I have tried removing all items in the back but still no joy

I am running EE 2.5.3

Any idea what could be causing this

Regards

Alan

AlanG
# 1
AlanG

Can I assume that there is no solution to this I have yet to get this to work properly

Mark Bowen Design
# 2
Developer
Mark Bowen Design

Hi Alan,

I hope you can accept my sincerest apologies for not having been back to you sooner on this one. Unfortunately I got something in one of my eyes just before you posted this and was out of action for over a week unable to see anything as opening my other eye caused me so much pain too. Just didn’t want you to think that I’m not here though.

When you say that things were good on a fresh install do you mean that the cart was originally working and now it isn’t?

I’ve tested the cart on 2.5.3 just now and can confirm that I don’t get any errors here on a localhost or online. I’m also not really sure what that error means as I’ve never come across that one in all the installs I’ve ever done of this plugin and also no-one else has ever mentioned it as a problem before.

Are you running any odd sort of server or anything like that? Is your version of PHP on the server possibly too new? I know that sounds a bit odd but really new versions of PHP can sometimes have things in them that I may not have come across yet so I’m just trying to think of anything here that might be at fault.

Other things that I’m thinking are did you try this on a totally blank install of ExpressionEngine or are there perhaps any other add-ons running on the site that might be affecting this?

Best wishes,

Mark

AlanG
# 3
AlanG

Hi Mark,
Sorry if I sounded a bit off in my previous post I sometimes type before I think.

Everything was working until I added my first item to the cart: I am also getting this error at the same time I have got around the first issue by just using sale price.

A PHP Error was encountered

Severity: Notice

Message: Undefined index: 1

Filename: shopping_cart_functions/pi.shopping_cart_functions.php

Line Number: 412


I have a standard CentOS 6 server setup nothing special PHP is 5.2

I have also tried this on a complete clean install of both EE and cart.

Alan

Mark Bowen Design
# 4
Developer
Mark Bowen Design

Hi Alan,

AlanG - 18 October 2012 06:35 PM

Hi Mark,
Sorry if I sounded a bit off in my previous post I sometimes type before I think.

No worries at all it didn’t come across that way at all.

AlanG - 18 October 2012 06:35 PM

Everything was working until I added my first item to the cart: I am also getting this error at the same time I have got around the first issue by just using sale price.

A PHP Error was encountered

Severity: Notice

Message: Undefined index: 1

Filename: shopping_cart_functions/pi.shopping_cart_functions.php

Line Number: 412

So using sale price gets rid of the first problem but then this second problem arises? That is definitely a strange one you have going on there :-(

The only things I can think of here would be to double check and triple check that all your channel shortnames are the same (spelt correct and correct case) in all places in the templates.

If you used the templates provided then you can just literally place them into the templates folder and then have them appear in the control panel directly. You would need to make sure that you have a channel called Default Site (default_site = shortname) in order for them to work though.

One other question would be are these errors appearing in the control panel when you add the products or are they happening on the front-end of the site?

Best wishes,

Mark

 

AlanG
# 5
AlanG

Hi Mark,

Hope you are feeling beeter now.

All the errors are only happening on the front end, I can put up with only using a sale price for regular price as there not going to change.

before I go ahead and put things live I just need to check the fields that I should change in the checkout page to ensure everything goes through to paypal correctly.

Alan

dvl
# 6
dvl

Hi Mark, I’m getting these same errors too. I’d really like to use your plugin because it’s just what I need (since I’m just fulfilling requests and not charging for products). Can you let us know if you’ve had a chance to look into it further?

thanks

Mark Bowen Design
# 7
Developer
Mark Bowen Design

If anyone is getting this error then please check that you have added the item to the Simple Commerce Module as without adding the item / giving it a price then this will cause the error above. It’s not actually a problem with the plugin but a problem if you don’t add a price to the Simple Commerce Module.

Best wishes,

Mark

PinkCactus
# 8
PinkCactus

Hi Mark, Same problem again is there no fix yet

.carolinecblaker.
# 9
.carolinecblaker.

Try replacing line 256 with this:

$total_cost = ( (string)$query->row('item_regular_price') * $qty) + $total_cost

This variable was being set with a string (what you want) and an empty array. The above code strips out the empty array and along it goes.

giri
# 10
giri

Hi,

I just bough this plugin. After installtion, i get this same error. SCM has all items listed with regular price and sale price. What do i do?

giri
# 11
giri

Sorry, just figured out what went wrong. I’m posting for all those people who get this error, we need to make sure we pass the enrty id to the cart/add,

for example:

<a href="{site_url}cart/add/{segment_2}" class="buttonBoxed">Add to Cart</a

{segment_2} being the entry id value. Previuosly i had {url_title_path} and by reading the query in MB shopping car plugin, WHERE has entry id to pull data.

Please use the above anchor tag href to make it work correctly.