adding extra columns to product lists in back-end

  • Posts: 14
  • Thank you received: 1
5 years 3 months ago #302062

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

Attachments:
Last edit: 5 years 3 months ago by OA.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 3 months ago #302063

Hi,

You can use

echo $this->currencyHelper->displayPrices(@$row->prices, 'price_value');
to ge tthe price without taxes and :
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:
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.

  • Posts: 14
  • Thank you received: 1
5 years 3 months ago #302072

Thanks for fast respond Nicolas,

I've tried your solution. On someway te result for tax keeps €0,00. (see also screenshot).

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

Attachments:
Last edit: 5 years 3 months ago by OA.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 3 months ago #302073

Hi,

Try doing it like that then:

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

  • Posts: 14
  • Thank you received: 1
5 years 3 months ago #302086

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.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 3 months ago #302087

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.046 seconds
Powered by Kunena Forum