Skip to main content

adding extra columns to product lists in back-end

More
7 years 8 months ago - 7 years 8 months ago #302062 by OA
-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6.36

Hello,

I want add some extra rows: ("Tax" and "Price inlcuding tax") in the back-end of my product-list (see also the screenshot)

An article about this has been wrote about 4 - 6 years ago:
- www.hikashop.com/forum/product-category-...-columns.html#181291
- www.hikashop.com/forum/2-general-talk-ab...axes-in-backend.html
Also the suggested topics in that article does not seem to work, probably through the use of old hikashop version.

which code do I need to add for displaying these extra information?
How do I get acces to the pricing of that product?

Thanks..

kindly regards,

p.s
- file: backend view --> product / listing.php
Last edit: 7 years 8 months ago by OA.

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #302063 by nicolas
Hi,

You can use
Code:
echo $this->currencyHelper->displayPrices(@$row->prices, 'price_value');
to ge tthe price without taxes and :
Code:
echo $this->currencyHelper->displayPrices(@$row->prices, 'price_value_with_tax');
to get the price with taxes.
But you can't use the displayPrices function to display the taxes. The displayPrices function is only meant to display the prices, not the taxes.
So you can do something like that:
Code:
echo $this->currencyHelper->format($row->prices[0]->price_value_with_tax - $row->prices[0]->price_value, $row->prices[0]->price_currency_id);
Note that the displayPrices function can display several prices (for example, if you set several unit prices, one for each currency, etc), but the code with the format function will only display one price.

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago - 7 years 8 months ago #302072 by OA
Thanks for fast respond Nicolas,

I've tried your solution. On someway te result for tax keeps €0,00. (see also screenshot).
Code:
// prints €0,00 echo $this->currencyHelper->format($row->prices[0]->price_value_with_tax - $row->prices[0]->price_value, $row->prices[0]->price_currency_id);

Also with "basic" writing it returns 0.
Code:
// prints also 0 or €0,00 $price_val = $this->currencyHelper->displayPrices(@$row->prices,'price_value'); $price_with_tax = $this->currencyHelper->displayPrices(@$row->prices, 'price_value_with_tax'); $price_cur_id = $this->currencyHelper->displayPrices(@$row->prices,'price_currency_id'); echo $price_with_tax - $price_val; // result 0 echo $this->currencyHelper->format($price_with_tax-$price_val, $price_cur_id); // result €0,00
Last edit: 7 years 8 months ago by OA.

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #302073 by nicolas
Hi,

Try doing it like that then:
Code:
$firstPrice = reset($row->prices); echo $this->currencyHelper->format($firstPrice->price_value_with_tax - $firstPrice->price_value, $firstPrice->price_currency_id);

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #302086 by OA
Thanks Nicolas,

I am not sure what "reset" does, but it helped :) it worked for me!.

greetings.

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #302087 by nicolas
Hi,

The reset function will give the first element of the array. the [0] will do that only if the array is numbered incrementally, which is not the case anymore apparently and that's why the previous old code didn't work.
The following user(s) said Thank You: OA

Please Log in or Create an account to join the conversation.

Time to create page: 0.204 seconds
Powered by Kunena Forum