Home / نمونه کد computed field در دروپال

نمونه کد computed field در دروپال


فیلد خودکار محاسبه تخفیف

$originvalue=array_pop(field_get_items($entity_type, $entity, 'field_price'));
if(gettype($originvalue)=="array")
{
 $originvalue=intval(reset($originvalue));
 }
$discount=array_pop(field_get_items($entity_type, $entity, 'field_takhfif'));
if(gettype($discount)=="array")
{
 $discount=intval(reset($discount));
}
if ($discount<=0) {
    $discount=0;
}

$entity_field[0]['value'] =$originvalue-intval(($originvalue)*($discount/100));




     RSS of this page