phpmonkey
|
| Posted: 09/14/2002, 6:28 PM |
|
i have a price field being return from the db. i have a custom function will evaluate the price and for $0.00 return "Call For Details".
how do i, in ccs, get price to my function and back?
what i *think* i would do is this:
1) add a Before Show Event->Custome Code to my price label
2) in the custom code simply add "return PriceEval($price)".
but that ain't doing it.
help?
|
|
|
 |
Gary P
|
| Posted: 09/15/2002, 7:13 AM |
|
I had to figure out something similiar. Instead of modifying values before show, I wanted to modify values before an insert. I haven't look specifically at your issue, but hopefully what I found will help you.
In my case I wanted to make sure the databaes field had default information in it. I added the following code.
function Patterns_ds_BeforeBuildInsert() {
//Custom Code @21-2A29BDB7
// -------------------------
global $Patterns;
//Be sure we don't try to pass any null values
if (!$Patterns->ds->ShortDescription->GetDBValue())
$Patterns->ds->ShortDescription->SetDBValue(" ");
}
The name of the form I put the code in was Patterns. I had to use the global declairation to gain access to it. ShortDescription was the name of the field I was using. GetDBValue() and SetDBValue() are the function calls to read and write to there. What my code does is checks if the value has been set and if it hasn't, sets it to " ".
|
|
|
 |
phpmonkey
|
| Posted: 09/15/2002, 12:35 PM |
|
thanks. you got me on the right track. here's what i did...
function item_price_BeforeShow() {
global $item;
// send the original price to my function to evaluate/alter it
$value = CallForDetails($item->price->GetValue());
// reset the price to the new value
$item->price->SetValue($value);
}
works like a champ!
|
|
|
 |
|