Just updated from U2RC1 to U2RC2

Now when I click on a product I get this error:
Fatal error: Call to undefined function uc_price() in modules/ubercart/uc_product/uc_product.module on line 1419

http://playtownmats.com

Comments

pirofun’s picture

also getting this error.

commented out line 1419 and that seems to restore functionality, however, there needs to be a correct fix applied.

pirofun’s picture

Island Usurper’s picture

Status: Active » Closed (duplicate)

Reopen, please, if this isn't the same issue.

mkalkbrenner’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new556 bytes

We have the same problem but don't use product kit.
So here's a quick fix. But it seems to me that the module design should be reviewed ...

Island Usurper’s picture

Status: Needs review » Closed (duplicate)

That issue is less about the product kit module and more about Meta tags rendering the node bodies before the bootstrap is complete. Both uc_product and uc_product_kit are doing the same thing, so having Meta tags set to using the teaser when the description is empty will break both of them.

swill’s picture

Version: 6.x-2.0-rc2 » 6.x-2.0-rc3

I can confirm this bug still exists in RC3...

For me it only happens on products that have restricted access using ACL.

swill’s picture

i can also confirm that adding this to the top of the function theme_uc_product_price solved my problem...

	$dir = drupal_get_path('module', 'uc_store');
	require_once($dir .'/includes/uc_price.inc');
Island Usurper’s picture

Title: Fatal error: Call to undefined function uc_price() in modules/ubercart/uc_product/uc_product.module on line 1419 » Fatal error: Call to undefined function uc_price() on access restricted products
Status: Closed (duplicate) » Postponed (maintainer needs more info)

Yes, that would work, but it should be totally unnecessary. That exact code is being run in uc_store_init(), and I would expect that nodes shouldn't be viewed until after that happens.

I can't duplicate the error with ACL. How exactly are you restricting access to those products? Like I said in the other thread, I don't see how they can be the problem, but it doesn't hurt to be thorough.

gosvald’s picture

I'm sorry swill but which file/function did you add this code to?

    $dir = drupal_get_path('module', 'uc_store');
    require_once($dir .'/includes/uc_price.inc');
matt v.’s picture

I was getting the following error running Ubercart 6.x-2.0-rc3 and Meta Tags 6.x-1.0:

Fatal error: Call to undefined function uc_price() in /var/www/html/sites/all/modules/ubercart/uc_product/uc_product.module on line 1421

Applying the patch from Comment #4 above fixed the issue. For what it's worth, we aren't doing anything special in terms of restricting access to products.

Anonymous’s picture

I have the same problem.
For the first product I've created for my first UC store !
Bad luck !

I can't show this product : this is a big problem !

Here is the current configuration (thanks to Configuration Documentation module)

DRUPAL CORE
Version: 6.12
Recommended version: 6.12

DRUPAL MODULES
Package: Access control
Module: Content Access (Status: enabled; Installed version: 6.x-1.1; Available (recommended) version: 6.x-1.1; Minimum PHP version required: 4.3.5)
Package: Administration
Module: Administration menu (Status: enabled; Installed version: 6.x-1.4; Available (recommended) version: 6.x-1.4; Minimum PHP version required: 4.3.5)
Package: Autre
Module: Administration theme (Status: enabled; Installed version: 6.x-1.1; Available (recommended) version: 6.x-1.1; Minimum PHP version required: 4.3.5)
Module: Administrator Warning (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Advanced help (Status: disabled; Installed version: 6.x-1.1; Minimum PHP version required: 4.3.5)
Module: Backup and Migrate (Status: enabled; Installed version: 6.x-2.x-dev; Available (recommended) version: 6.x-2.x-dev; Minimum PHP version required: 4.3.5)
Module: Global Redirect (Status: enabled; Installed version: 6.x-1.2; Available (recommended) version: 6.x-1.2; Minimum PHP version required: 4.3.5)
Module: Advanced help example (Status: disabled; Installed version: 6.x-1.1; Minimum PHP version required: 4.3.5)
Module: Login destination (Status: enabled; Installed version: 6.x-2.3; Available (recommended) version: 6.x-2.3; Minimum PHP version required: 4.3.5)
Module: Node Export (Status: disabled; Installed version: 6.x-2.6; Minimum PHP version required: 4.3.5)
Module: Node Export FileField (Status: disabled; Installed version: 6.x-2.6; Minimum PHP version required: 4.3.5)
Module: Meta tags (Status: enabled; Installed version: 6.x-1.0; Available (recommended) version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Token (Status: enabled; Installed version: 6.x-1.11; Available (recommended) version: 6.x-1.11; Minimum PHP version required: 4.3.5)
Module: Token actions (Status: disabled; Installed version: 6.x-1.11; Minimum PHP version required: 4.3.5)
Module: Webform (Status: enabled; Installed version: 6.x-2.6; Available (recommended) version: 6.x-2.6; Minimum PHP version required: 4.3.5)
Module: WYMeditor (Status: enabled; Installed version: 6.x-2.x-dev; Available (recommended) version: 6.x-2.x-dev; Minimum PHP version required: 4.3.5)
Package: CCK
Module: Content (Status: enabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Content Copy (Status: enabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Content Permissions (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Fieldgroup (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: FileField (Status: enabled; Installed version: 6.x-3.0; Available (recommended) version: 6.x-3.0; Minimum PHP version required: 5.0)
Module: FileField Meta (Status: disabled; Installed version: 6.x-3.0; Minimum PHP version required: 5.0)
Module: ImageField (Status: enabled; Installed version: 6.x-3.0; Available (recommended) version: 6.x-3.0; Minimum PHP version required: 4.3.5)
Module: Link (Status: enabled; Installed version: 6.x-2.5; Available (recommended) version: 6.x-2.5; Minimum PHP version required: 4.3.5)
Module: Node Reference (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Number (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Option Widgets (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Text (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: User Reference (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Package: Core - optional
Module: Aggregator (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Blog (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Blog API (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Book (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Color (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Comment (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Contact (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Database logging (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Forum (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Help (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Locale (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Menu (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: OpenID (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Path (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: PHP filter (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Ping (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Poll (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Profile (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Search (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Statistics (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Syslog (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Taxonomy (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Throttle (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Tracker (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Content translation (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Trigger (Status: disabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Update status (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Upload (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Package: Core - required
Module: Block (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Filter (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: Node (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: System (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Module: User (Status: enabled; Installed version: 6.12; Minimum PHP version required: 4.3.5)
Package: Date/Time
Module: Date (Status: enabled; Installed version: 6.x-2.2; Available (recommended) version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date API (Status: enabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date Locale (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date PHP4 (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date Popup (Status: enabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date Repeat API (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date Timezone (Status: enabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Module: Date Tools (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Package: Development
Module: Configuration State (Status: enabled; Installed version: 6.x-1.0; Available (recommended) version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Devel (Status: disabled; Installed version: 6.x-1.12; Minimum PHP version required: 4.3.5)
Module: Devel generate (Status: disabled; Installed version: 6.x-1.12; Minimum PHP version required: 4.3.5)
Module: Devel node access (Status: disabled; Installed version: 6.x-1.12; Minimum PHP version required: 4.3.5)
Module: Theme developer (Status: disabled; Installed version: 6.x-1.12; Minimum PHP version required: 4.3.5)
Module: Macro (Status: disabled; Installed version: 6.x-1.12; Minimum PHP version required: 4.3.5)
Package: ImageCache
Module: ImageAPI (Status: enabled; Installed version: 6.x-1.6; Available (recommended) version: 6.x-1.6; Minimum PHP version required: 5.1)
Module: ImageAPI GD2 (Status: enabled; Installed version: 6.x-1.6; Minimum PHP version required: 4.3.5)
Module: ImageAPI ImageMagick (Status: disabled; Installed version: 6.x-1.6; Minimum PHP version required: 4.3.5)
Module: ImageCache (Status: enabled; Installed version: 6.x-2.0-beta9; Available (recommended) version: 6.x-2.0-beta9; Minimum PHP version required: 4.3.5)
Module: ImageCache UI (Status: disabled; Installed version: 6.x-2.0-beta9; Minimum PHP version required: 4.3.5)
Package: Multilanguage
Module: Internationalization (Status: enabled; Installed version: 6.x-1.0; Available (recommended) version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Block translation (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Content type translation (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Menu translation (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Poll aggregate (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Profile translation (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: String translation (Status: enabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Synchronize translations (Status: enabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Taxonomy translation (Status: disabled; Installed version: 6.x-1.0; Minimum PHP version required: 4.3.5)
Module: Language Icons (Status: enabled; Installed version: 6.x-2.x-dev; Available (recommended) version: 6.x-2.x-dev; Minimum PHP version required: 4.3.5)
Module: Consistent Language Interface (Status: enabled; Installed version: 6.x-2.1; Available (recommended) version: 6.x-2.1; Minimum PHP version required: 4.3.5)
Package: Other
Module: File Force (Status: enabled; Installed version: 6.x-1.1; Available (recommended) version: 6.x-1.1; Minimum PHP version required: 4.4)
Package: Statistics
Module: Google Analytics (Status: disabled; Installed version: 6.x-2.2; Minimum PHP version required: 4.3.5)
Package: Ubercart - core
Module: Conditional Actions (Status: enabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Cart (Status: enabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Order (Status: enabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Product (Status: enabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Store (Status: enabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Package: Ubercart - core (optional)
Module: Attribute (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Catalog (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: File Downloads (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Payment (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Shipping Quotes (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Reports (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Roles (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Shipping (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Tax Report (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Taxes (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Package: Ubercart - extra
Module: Cart Links (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Google Analytics for Ubercart (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Product Kit (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Stock (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Package: Ubercart - fulfillment
Module: Flatrate (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: UPS (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: U.S. Postal Service (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Weight quote (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Package: Ubercart - payment
Module: Test Gateway (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: 2Checkout (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Authorize.net (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Credit Card (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 4.3.5)
Module: CyberSource (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Google Checkout (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: Payment Method Pack (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Module: PayPal (Status: disabled; Installed version: 6.x-2.0-rc3; Minimum PHP version required: 5.0)
Package: Views
Module: Views (Status: enabled; Installed version: 6.x-2.5; Available (recommended) version: 6.x-2.5; Minimum PHP version required: 4.3.5)
Module: Views exporter (Status: enabled; Installed version: 6.x-2.5; Minimum PHP version required: 4.3.5)
Module: Views UI (Status: enabled; Installed version: 6.x-2.5; Minimum PHP version required: 4.3.5)

WEB SERVER: Apache

PHP VERSION: 5.2.6

DRUPAL MINIMUM SUPPORTED PHP VERSION: 4.3.5

PHP EXTENSIONS
zip
libxml
xmlwriter
xmlreader
xml
tokenizer
tidy
session
SimpleXML
soap
SPL
standard
Reflection
PDO
pdo_mysql
pdo_sqlite
mysqli
mysql
mbstring
json
iconv
hash
gettext
gd
ftp
filter
exif
dom
date
curl
ctype
zlib
pcre
openssl
xsl
cgi

USER BROWSER: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; fr-fr) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3

CLEAN URLS: enabled

DATABASE TYPE: mysql; VERSION: 5.0.67

CRON LAST RUN: 1 jour 20h ago

Island Usurper’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

You also have the Meta Tags module enabled, and the default configuration causes a known issue as described in the link in #2 above.

No one's allowed to mention this problem if they are using Meta Tags, at least until my patch at #439234-22: Replace nodewords_init() with nodewords_preprocess_page() (or later) gets committed.

bramface’s picture

I'm noticing that the includes file referenced in this patch, ./includes/uc_price.inc , is not actually (on my system) in that referenced location. Relative to /ubercart/uc_product/uc_product.module, it is in ../uc_store/includes/uc_price.inc .

So - I've rewritten that reference and it seems to solve the first problem - but I'm wondering if maybe somehow uc_price.inc ended up in the wrong place some earlier time...now I need to chase down the reference in uc_product_kit.....

-Bram

tr’s picture

bmoreinis: What are you talking about? Do you mean the code in #7 (which is not a patch?). If so, that code is written correctly. However I would recommend Island Ursurper's fix at http://drupal.org/node/439234#comment-1588868 as the proper way to go about dealing with this problem.

dave_______1’s picture

Hi everyone,

The code above posted by swill seems to work for me.
Here is what I did:

  1. Go to the folder for the Ubercart module (mine is sites/all/modules/ubercart/)
  2. Open the folder "uc_product"
  3. Open the file "uc_product.module"
  4. At line 1419 there is the line "function theme_uc_product_price($price, $context, $options = array()) {"
    Under it type the lines
    $dir = drupal_get_path('module', 'uc_store');
    require_once($dir .'/includes/uc_price.inc');
  5. Your whole function now reads:
    (take out the this is only so you can read the code)

    function theme_uc_product_price($price, $context, $options = array()) {
    
        $dir = drupal_get_path('module', 'uc_store');
        require_once($dir .'/includes/uc_price.inc');
    	
      $output = '<div class="product-info '. implode(' ', (array)$context['class']) .'">';
      $output .= uc_price($price, $context, $options);
      $output .= '</div>';
    
      return $output;
    }
    
  6. Save the file and upload it

Hope this helps someone.
Dave.

Island Usurper’s picture

This is redundant and unhelpful. A fix for the Meta Tags module has been made in the 6.x-1.x-dev version, so any hacking of Ubercart is not needed to deal with this error.

KAP10’s picture

Thank you so much mkalkbrenner. I used the fix quoted in comment 4 and the problem just vanished. After I inserted the code that mkalkbrenner quoted in to uc_product.module, our site, VolidayGreetings.com is working just fine again.

kenorb’s picture

Solution:
Download the latest version of nodewords module:
http://drupal.org/node/222124

joachim’s picture

Except the 6-2 branch is, as written in the release notes, unstable.
The fix has been applied by the maintainer to the 6-1 branch too but there's no point release or dev release of that yet.

John Tolhurst’s picture

I need metatags, or my google ranking slides.

http://drupal.org/node/222124 cannot be used on a production site.

So am I right therefore to conclude that I must indeed patch uc_product.module according to the procedure in post #15? by dave_______1 ?

Thanks for the assistance here.

joachim’s picture

Solution: get the maintainer of NW to support his users by making a 6-1 release.

Fohsap’s picture

What are we supposed to do with this? Where does it go?

Fohsap’s picture

Swill... where do you add that?

Fohsap’s picture

Dave's fix doesn't work.

skydesigner’s picture

Dave's fix is work !!!! Thanks Dave...

dave_______1’s picture

Hi Everyone,

This fix is from swill, not myself, so all credit to him (or her).

I've just had the same problem again after upgrading some of the modules on a new site I'm building, but after aplying the fix by swill, it's all fine.
The line number has shifted though (to 1523), so please search for the function theme_uc_product_price to apply.

Great modules, great fixes, great community, Drupal is just great (try osCommerce or Joomla then you'll agree too).
Thanks everyone for making Drupal so good!

Dave.

alexmoreno’s picture

i solved the problem simply upgrading nodewords (seems the cause)