<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
I'm working on a site requirement where products in Ubercart with a
0 price show a text message instead of an 'add to cart' form.<br>
<br>
The product list is being generated by views and presented in table
layout. Some of the products selected by the view have a price (view
is using 'sell price'), some do not.<br>
<br>
The current code works for the 'form_alter' for non-0 price. The
current code works for replacing the form with text. <b>It does not
work in determining which products (rows) in the table are 0
price.</b><br>
<br>
I have not been able to nail down whether the issue is the reference
to the 'price' field in the view record or if it is my comparison
value (is it already formatted for display at this point).<br>
<br>
Any suggestions welcomed an appreciated.<br>
<br>
Here is my current code:<br>
<blockquote type="cite">
<pre><font color="#3333ff"><?php
// $Id$
<font color="#000000">/**
* Implementation of hook_form_alter().
*/</font>
function clientname_cart_form_alter(&$form, $form_state, $form_id) {
<font color="#000000"> //only 'add to cart forms'</font>
if(substr($form_id, 0, 28) == 'uc_product_add_to_cart_form_') {
if($node->sell_price == 0) {
<font color="#000000"> // if 0.00 price, show 'call for quote' text</font>
$form['qty'] = array(
'#type' => 'markup',
'#value' => '<div>Call for Quote</div>',
);
$form['submit'] = array(
'#type' => 'markup',
'#value' => '',
);
}
else {
<font color="#000000"> // if >0.00 price alter the form</font>
$form['qty'] = array(
'#type' => 'textfield',
'#default_value' => '1',
'#description' => '',
'#size' => '1',
'#maxlength' => 4,
);
}
}
}
</font></pre>
</blockquote>
<pre></pre>
Ron D.<br>
</body>
</html>