Is there any way to pass a string from php field to php filter?
on the PHP FIELD I can tell if a product has discount or not ( i think because the field formatter render the field_price in a way that triggers the discount rules) and if there is a discount I can set a variable on/off based on the output of this formatter.
This custom discount variable created with PHP FIELD I need to pass it to the PHP FILTER to control if a product must needs to be shown or not (sorry for my bad English)
PHP FIELD CODE
<?php
// $var1 will take value 0.00E or -94.99E (the last value is an example)
$var1 = strip_tags($data->field_commerce_price[0][rendered]);
// $var2 will take value 0 or -
$var2 = mb_substr($var1, 0, 1, 'utf-8');
// set $static = 0 or 1, if PHP FILTER can see this then can filter discount products
if ($var2=="-") { $static = "1"; echo "DISCOUNT!"; } else {$static = "0"; }
?>
PHP FILTER CODE
// all 4 variables gives output nothing
dpm($row->_field_data['nid']['entity']->field_commerce_price[0][rendered]);
dpm($data->_field_data['nid']['entity']->field_commerce_price[0][rendered]);
dpm($data->field_commerce_price[0][rendered]);
dpm($static);
if ($static=="1") { return FALSE; } else { return TRUE;}
So how PHP field send a string to PHP FILTER??? OR Is there any to create a filter function using the PHP FIELD?