Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error in front page


Guest

Recommended Posts

Hi, can anyone help my with this error, I have osCommerce Online Merchant v2.3.1

and I have this error in my front page when I click on catagory this line show up. many of them.

 

<br />

<b>Warning</b>: mb_substr() expects parameter 3 to be long, string given in <b>/home/styleqaw/public_html/includes/modules/product_listing.php</b> on line <b>174</b><br />

 

and line 174 in product listing are like this.

 

 

$p_desc = ''.mb_substr(strip_tags($product['products_description']), 0, MAX_DESCR_LISTING, 'UTF-8').' ...';

Link to comment
Share on other sites

Possibly the macro MAX_DESCR_LISTING has not been defined as it is supposed to be. I can't look at the source right now, but there should either be a "define" for it somewhere, or it is in the configuration table of the database (PHP code reads it and turns it into a define). If no one has solved this in the next 11-12 hours, I will try to remember to take a look tonight at the vanilla osC code (oscommerce.sql) and see if it's defined through the configuration table. If it is, you might check if you're missing other entries, and manually enter them through phpMyAdmin.

Link to comment
Share on other sites

Hi Olafur,

 

The product listing is not a standard osc page seen a fix for something similar here

 

Link But if MR Phil has time to takes a look likely a better solution

 

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

$p_desc is a variable often used by the "coders" at Template Monster.

 

So you have a template, the best place to get help for that template is from where-ever you bought it, as only they know the precise changes made. I know quite a lot about these tamplates, having worked on many of them and can tell you that MAX_DESCR_LISTING is a number that determines the amount of characters that should show in a mini-description.

Link to comment
Share on other sites

Thanks for your replay bud this is an Oscommerce versjon 2,3,1 with a change look, I belive that was someone her help my with that.

What happent if I update to versjon 2,3,3, will I lose the eksisting site or can I made partical upgrade.

Link to comment
Share on other sites

Hi Olafur,

 

The problem is only with the /includes/modules/product listing.php this file has been modified to show details and buy now buttons.

 

An original file does not have line 174 it stops at line 171 !!!

 

It is not an original 2.3 /includes/modules/product listing.php

 

Until you get it fixed you could replace with an original product listing.php file I think the error will then disappear.( but back up your site first before making any changes)

 

To upgrade from 2.31 to 2.33 takes a few hours

 

http://library.oscommerce.com/Online&en&oscom_2_3&release_notes&v2_3_3

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

As @@burt said, this is not a standard piece of osC, but evidently either an add-on or a template addition. Somewhere along the line, most likely you did not run some piece of installation script that adds that to your configuration table in the database. The alternative is that it's defined in a new or modified PHP file, but that piece is missing or damaged somehow. So, you need to tell what template you bought, (and probably receive support from its author), or what add-on(s) you added to stock osC.

Link to comment
Share on other sites

$p_desc = ''.mb_substr(strip_tags($product['products_description']), 0, (int)MAX_DESCR_LISTING, 'UTF-8').' ...'; 

 

Type casting parameter 3 as (int) should stop the error. Sounds like PHP is treating the DEFINE as a string.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

If it's a string containing a number (e.g., '35'), PHP should accept it as a number. If it's undefined or garbage, an (int) cast will simply turn it into a 0, which will get you past the immediate error, but will not solve the ultimate problem. You still have to go upstream and see why this constant/macro isn't being defined properly.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...