Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal Error: Call to a member function display_price() in also_purchased_products.php


AllThingsTrendy

Recommended Posts

Does anyone have an idea why the following error would start appearing?  It is only appearing at the bottom of the item details page for older items that have been ordered with the targeted item.  It does not appear on new products.  Here is an example item showing the error.

 

I have had our revised site launched for about three weeks (OSC V2.3.3.4) and just began seeing this error today.  Obviously, I have done something to cause it occur but for the life of me, I can not figure out what.  I have not modified anything within my product_info.php in weeks and I certainly have not touched the referenced module.  There must be some other setting that impacts this.  I am hoping someone else has encountered this and resolved.  Unfortunately, I didn't find any related posts.

 

Fatal error: Call to a member function display_price() on a non-object in /home/mysite/www/www/includes/modules/also_purchased_products.php on line 56

 

Anthony David

AllThingsTrendy.com

Link to comment
Share on other sites

The display_price function isn't a core function and line 56 doesn't exist in the file mentioned so it seems you are using altered code. That makes it very difficult for anyone here to help with since what that code is isn't known. If you installed an addon and then this started to fail, then you need to check that addons package for the missing code. But if you are using a template where the function was added by the template designer, then you would need to take it up with them.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@AllThingsTrendy

 

Correct @@Jack_mcs. Stock standard osCommerce doesn't have price and buy now button for "also purchased products". This has been modified.

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

Sure seems to be template related. I found these older threads where someone had same error. They figured out how to fix error issue, but it effected their template http://www.oscommerce.com/forums/topic/397818-error-on-products-page/ and this one http://www.oscommerce.com/forums/topic/391817-baffled-by-fatal-error/

Link to comment
Share on other sites

This error does not mean that code is missing. It means that you are trying to use a class member function on an object, that for some reason, is undefined or is a simple value (like 0) rather than a proper object. It indicates a coding error, in that certain error or boundary conditions were not adequately handled. The code did not instantiate an object for some reason

 

When you say "older products", by any chance, did you recently do a conversion from Latin-1 to UTF-8, and your product data contains accented characters or other non-ASCII text? If something went wrong with your conversion and the database is producing errors, than can cause objects to be malformed. Is there any other difference you can point to between "older" products and "newer" ones?

Link to comment
Share on other sites

Guys, thanks for the quick replies and I apologies for the delayed response.  It turns out that I have he same issue that others have seen with their Template Monster template.  Since launching the site, I have not enabled cache until last Monday evening.  I noticed this issue on Wednesday morning.

 

@@allaboutwicker, Thanks for pointing me to the older threads!  These are helpful.

 

@@Jack_mcs, after reading those older threads, I turned off the cache and the problem instantly went away.  I've got to figure this out as one of my primary goals of migrating to this new design and V2.3.3.4 was to improve the speed of our site.  Caching is an essential part of that plan.

 

@@MrPhil, In response to your questions...

  1. My reference to "older products" simply meant that the issue only appears for items that have been around long enough to have been ordered along with other items (a multi-item cart).  Item that have never been ordered along with others do not have anything to display within the "Also Purchased Section".
  2. Yes, before we launched our updated site, the database collation was set to Latin-1 and we changed this to UTF-8 prior to importing the data back.  However, the database being set to Latin-1 was a mistake that we had never corrected.  We have never utilized any language other than English and we certainly do not utilize non English characters and no double-byte.

It seems quite evident that this is related to caching.  I'm going to clear out the old cache files and rebuild to see if perhaps that helps.  I'm just not very confident this will resolve the issue.

Anthony David

AllThingsTrendy.com

Link to comment
Share on other sites

It should be possibile to rebuild the file using a standard also purchased model and comparing and changing  the html  to reflect your template not that difficult really.

 

Regards

Joli

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

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...