Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

Mort-lemur

Fatal Error on some Pages

9 posts in this topic

Hi,

 

I have started getting an error on some product pages in my development 2.3.1 site, but only on pages where the x-sell module is called up. The error is as follows:

 

Fatal error: Cannot use string offset as an array in /home/username/public_html/catalog/includes/functions/general.php on line 338

 

The offending line of code is:

if (!isset($tax_rates[$class_id][$country_id][$zone_id]['rate'])) {

 

Any ideas what is going on? I have googled the problem without much success.

 

Thanks

Share this post


Link to post
Share on other sites

Update - this error only occurs when I try to cross sell to an item that is zero Vat rated.

Share this post


Link to post
Share on other sites

Is your X-sell Addon designed for osC 2.2x? There is a difference in the way taxes are handled between 2.2 and 2.3 -- the 2.3 version expects an array, but the 2.2 version is a string. You'll have to find the value that Xsell is passing to that function in catalog/includes/functions/general.php and correct it.

 

Regards

Jim

Share this post


Link to post
Share on other sites

Is your X-sell Addon designed for osC 2.2x? There is a difference in the way taxes are handled between 2.2 and 2.3 -- the 2.3 version expects an array, but the 2.2 version is a string. You'll have to find the value that Xsell is passing to that function in catalog/includes/functions/general.php and correct it.

 

Regards

Jim

 

I posted an issue with what looks like an XSELL array problem here yesterday, not sure if that's related or not to this issue. As noted in that post, it only occurrs when I toggle the shop from 5.2* PHP to 5.3.

Share this post


Link to post
Share on other sites

Is your X-sell Addon designed for osC 2.2x? There is a difference in the way taxes are handled between 2.2 and 2.3 -- the 2.3 version expects an array, but the 2.2 version is a string. You'll have to find the value that Xsell is passing to that function in catalog/includes/functions/general.php and correct it.

 

Regards

Jim

 

Hi Jim,

 

No its a "Quick and Dirty" hack of the 2.2 version...

Share this post


Link to post
Share on other sites

Then you need to find where it's getting that string and convert it to the array that osCommerce 2.3.1 expects. Find where it's calling tep_get_tax_rate() and follow the code.

 

Regards

Jim

Share this post


Link to post
Share on other sites

@@kymation

 

I think that this may be the offending line of code in includes/xsell.php

 

   $xsell_price =  $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));

 

But why would that work ok for an item that has tax applied, but not for an item with no tax applied?

 

Thanks

Share this post


Link to post
Share on other sites

I have that exact line in my code. Then again, I don't have any items anywhere that are not taxable, so that may be the issue. Sorry, I don't have any more suggestions on this one.

 

Regards

Jim

Share this post


Link to post
Share on other sites

Heather, this may be off the mark totally, but in your original post I see the message was related to an array situation. Coincidentally or not, my problem related to an array issue (which only shows with version 5.3 php) has a solution syntax of code where an array was called. Again, this may not be even close to the solution for your issue,but if want to check it out PM me.

Share this post


Link to post
Share on other sites