Jump to content

In back end need to replace tax price with product weight


Recommended Posts

V1.7.8.5

I want to see the product weight in the product list back-end. The price including tax is completely irrelevant so I was thinking the easiest thing to do is replace that with weight.

I tried editing list.html.twig but as I understand it weight is not an available variable for that file.

I looked for "price_final" to see if I could locate and change the files that populate that variable and change it to weight but so far I am not having luck. I found it in AdminProductDataProvider.php but I don't know how to change that to weight. 

Any help here?

Link to comment
Share on other sites

Well I finally figured it out... this is what I did if anyone else wants to do something like this.

in file: /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig

I changed 

<a href="{{ product.url|default('') }}#tab-step2">{{ product.price_final|default('N/A'|trans({}, 'Admin.Global')) }}</a>

   to         

 <a href="{{ product.url|default('') }}#tab-step4">{{ product.weight|round(2) }} oz</a>

You can put whatever weight identifier you use (change "oz" to whatever)

 

in file: /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/products_table.html.twig

I changed

{{ "Price (tax incl.)"|trans({}, 'Admin.Catalog.Feature') }}

To

{{ "Weight"|trans({}, 'Admin.Catalog.Feature') }}

 

in file: \src\Adapter\Product\AdminProductDataProvider.php 

in line 233 I added the "weight" line between reference and price

'reference' => ['table' => 'p', 'field' => 'reference', 'filtering' => self::FILTERING_LIKE_BOTH],
            'weight' => ['table' => 'p', 'field' => 'weight', 'filtering' => self::FILTERING_LIKE_BOTH],
            'price' => ['table' => 'sa', 'field' => 'price', 'filtering' => ' %s '],

 

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...