Jump to content

Add column in AdminProductsController with margin percentage


Recommended Posts

Hello,

As the title indicated, I would like to add a column on my back office product list, that indicates the percentage of the margin I have in my products
Example:
Price = 100, Wholesale Price=20 --> Percentage Margin=80%

 

I have already created the AdminProductsController override file, and I have already added some columns that are related to database values, but I do not know how to add static values. From my research I am pretty sure I have to use a fallback function, but I have not figured out how to do so

 

$this->fields_list['profit_percentage'] = array(
            'title' => $this->l('%'),
            'type' => 'int',
            'align' => 'text-right',
            'callback' => 'percentageCallback'
        );

public function percentageCallback(){
             ;
        }

 

Any ideas?

TIA

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...