Multi virtual/math column

QuestionsMulti virtual/math column
Michał Mewald asked 7 years ago

Hi,
it is possible to create more than one virtual/math column? I'm trying to do that, only the last one appears.

$col = array();
$col["title"] = "col1v";
$col["name"] = "col1-virtual";
$col["width"] = "40";
$col["editable"] = false;
$col["hidden"] = false;
$col["on_data_display"] = array("do_mathmm","");
$cols[] = $col;

$col = array();
$col["title"] = "col2v";
$col["name"] = "col2-virtual";
$col["width"] = "40";
$col["editable"] = false;
$col["hidden"] = false;
$col["on_data_display"] = array("do_mathss","");
$cols[] = $col;

function do_mathss($data){
return $data["wholesale_price"] * $data["diff_order_ps"] * 2;
}

function do_mathmm($data){
return $data["wholesale_price"] * $data["diff_order_ps"] * 1;
}

2 Answers
Abu Ghufran answered 7 years ago

Hello,

I tested your code and it works without any change.
Just make sure you have columns with name: $col["name"]

wholesale_price
diff_order_ps

to be used in on_data_display callback: return $data["wholesale_price"] * $data["diff_order_ps"] * 2;

Michał Mewald answered 7 years ago

Thank you for your time. I checked again my code and find mistake in parameters.

🙂

Your Answer

18 + 10 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?