1 reply [Last post]
tj99ay's picture
Offline
Joined: 07/08/2011
Juice: 12
Was this information Helpful?

Hi Everyone,

Been searching for hours and I think I am searching on the wrong thing, but all I am trying to do is insert the Sell Price of a product within the BODY text of the product page. The idea is to insert some text code like this:

For only

<?php
print uc_currency_format($node->sell_price);
?>

you get an amazing product. Order Today!

Choose "PHP Code" as the Input Type and have it work.

In addition to that, I am also trying to make the "Order Today" text a link that does the same thing as the "Add To Cart" button.

Am I off track here, can this actually be done? I assume it can, but I'm using the wrong code ..... help!!!

UPDATE!!!

I did something silly by putting the following in the BODY field just to see what would happen:

========

<?php
function theme_uc_product_price($price, $context, $options = array())
{
 
$output = '<div id="price">';
  if (
$node->list_price <= $node->sell_price) { // this wont work as the $node variables not set anywhere?    
   
$output .= '<p>List Price: '. uc_currency_format($node->list_price) .'</p>';
  }
  else {
   
$output .= '<p>List Price: '. uc_currency_format($node->list_price) .'</p>';
   
$output .= '<p>Sell Price: '. uc_currency_format($node->sell_price) .'</p>';
  }
 
$output = '</div>';
  return
$output;
}
?>

==============

Now I am getting this error:

Fatal error: Cannot redeclare theme_uc_product_price() (previously declared in /etc/drupal/6/sites/all/modules/ubercart/uc_product/uc_product.module:1540) in /usr/share/drupal6/includes/common.inc(1696) : eval()'d code on line 31

If I try to go back to the page in Drupal to edit it it won't let me, it just keeps displaying this error?

Help!!! .. Again

Ta

Tim

Thanks

Tim

grobot's picture
Offline
Joined: 04/12/2008
Juice: 289
Re: Put sell price in product body text?

You may need to fix this in the db.edit the node body in the node and node_revision tables.

(or disable php input filter module to edit the node. Then leave it disabled!)

Giant Robot - for campaign, charity, ngo & online store solutions - www.giantrobot.co.nz