Show tax category in products datagrid
First of all thanks for this e-commerce solution. It's working well and is easy to customize.
I now have a situation where in the admin zone I have to include the tax category in the products datatable.
I have successfully added other columns, but this one won't work.
The problem is I can't add the tax_category attribute to the
products_flattable since it's a non-user defined attribute.
Admin\src\Datagrids\ProductDataGridI can't do something like
Is there a way to make the query include the tax category?
Thanks in advance!
Are you trying to add tax for any product ?
Thanks for your reaction.
Adding tax for a product is not a problem.
What I want is, in the products table / datagrid under catalog -> products, to show the tax category.
By default it shows
I was able to add some columns like
But I also need to display the
tax categoryin that table. Do you know how I can achieve this?
I hope my explanation is clear. If not, let me know!
You need to change here
I still can't get this to work.
I added the following:
$this->addColumn([ 'index' => 'tax_category_id', 'label' => 'Tax category', 'type' => 'number', 'searchable' => false, 'sortable' => true, 'filterable' => true, ]);
The column shows, but is empty.
I made sure the products have a tax category assigned to them.
Please get the tax-category field from the database first then try to add into the data grid column, please take a reference from Here
Yorg last edited by Yorg
Thanks for your response!
That's kind of where I'm stuck. I added
'product_flat.tax_category_id'to the select, but I get an error
Column not found: 1054 Unknown column 'product_flat.tax_category_id' in 'field list'
Do I need to do some extra joins or something?
Which version of Bagisto are you using?
We are using a forked version of 1.3.2.
The tax_category_id filed is not in product_flat table. so you are getting this error.