Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Show tax category in products datagrid

    Modules
    2
    10
    719
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      Yorg last edited by

      Hi,

      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_flat table since it's a non-user defined attribute.
      So in Admin\src\Datagrids\ProductDataGrid I can't do something like $q->select('product_flat.tax_category_id').

      Is there a way to make the query include the tax category?

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • sanjay-webkul
        sanjay-webkul last edited by

        Hi there,
        Are you trying to add tax for any product ?

        1 Reply Last reply Reply Quote 0
        • Y
          Yorg last edited by

          Hello Sanjay,

          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 ID, SKU, name, Attribute Family, Type, Status, Price and Quantity.

          I was able to add some columns like weight and featured.
          But I also need to display the tax category in that table. Do you know how I can achieve this?

          I hope my explanation is clear. If not, let me know!

          1 Reply Last reply Reply Quote 0
          • sanjay-webkul
            sanjay-webkul last edited by

            @Yorg said in Show tax category in products datagrid:

            tax category

            Hi there,
            You need to change here

            1 Reply Last reply Reply Quote 1
            • Y
              Yorg last edited by

              Hi Sanjay,

              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.

              1 Reply Last reply Reply Quote 0
              • sanjay-webkul
                sanjay-webkul last edited by

                Hi there,
                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

                Y 1 Reply Last reply Reply Quote 0
                • Y
                  Yorg @sanjay-webkul last edited by Yorg

                  @sanjay-webkul

                  Hi Sanjay,

                  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'
                  Also 'products.tax_category_id' won't work.

                  Do I need to do some extra joins or something?

                  1 Reply Last reply Reply Quote 0
                  • sanjay-webkul
                    sanjay-webkul last edited by

                    Hi there,
                    Which version of Bagisto are you using?

                    1 Reply Last reply Reply Quote 0
                    • Y
                      Yorg last edited by

                      We are using a forked version of 1.3.2.

                      1 Reply Last reply Reply Quote 0
                      • sanjay-webkul
                        sanjay-webkul last edited by

                        @Yorg said in Show tax category in products datagrid:

                        tax_category_id

                        Hi there,
                        The tax_category_id filed is not in product_flat table. so you are getting this error.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post