Show fields name in address

  • Posts: 117
  • Thank you received: 3
10 years 1 month ago #176968

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6

Hi, I would show the name of the fields in address according to their state (empty or not). I mean if a user is a company for example I would show something like:

VAT: XXXXXXXXXXX

and if user is NOT a company then the VAT field and it's name should not be shown.

I've tryed this in the address_template view with no success:

<?php if(!empty($this->order->billing_address->address_vat)){
    echo JText::sprintf('VAT_NUMBER',': ','{address_vat}');
}?>

What's wrong?

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
10 years 1 month ago #176970

Hi,

There is no $this->order variable in the address_template view file so it's normal that this doesn't work.
In fact, it's not possible to do that unless you're using HikaShop 2.3.4 or a newer version.
So since you're using the 2.3.3, you'll first have to update.
Then, you can use such code:

<?php 
$address = $this->params->get('address');
if(!empty($address->address_vat)){
 echo 'VAT: {address_vat}';
}
?>

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

  • Posts: 117
  • Thank you received: 3
10 years 4 weeks ago #177040

I've just downloaded the 2.3.4 an installed it. The message after installation says that I already have the latest 2.3.3. Is it right? Also, the code seems not work.

ATTENTION: the .zip package seems to contain V. 2.3.3 meanwhile the .tar.gz file correctly installed the version 2.3.4

Anyway even after upgraded the code you suggested me, it seems not work.

What's wrong?

Last edit: 10 years 3 weeks ago by crealiagroup.

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

  • Posts: 117
  • Thank you received: 3
10 years 4 weeks ago #177412

UP to previous post. Any suggestion?

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

  • Posts: 117
  • Thank you received: 3
10 years 3 weeks ago #177799

Hi, can you confirm me the issue is still present?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 3 weeks ago #177836

Hi,

Which issue ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 117
  • Thank you received: 3
10 years 3 weeks ago #177906

As said before , I've upgraded to 2.3.4 (ATTENTION: the .zip package seems to contain V. 2.3.3 meanwhile the .tar.gz file correctly installed the version 2.3.4) but even after upgraded HikaShop to 2.3.4, the code you suggested me, seems not work.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 3 weeks ago #178203

Hi,

The zip is the right one in our server ; I suppose that you had some cache in your browser.
We generated the zip in the same time than the tar.gz and we upload them in the same time. So I don't know how such problem could happen.

About the Nicolas patch proposal ; it is working on several cases but it's possible than in some specific places ; it won't.
It will be more than useful to know your case ; in order to understand and tell you more.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 117
  • Thank you received: 3
10 years 3 weeks ago #178310

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 3 weeks ago #178316

Hi,

Thanks for the access ; but would it be possible to have the details about the context ?
In which case does the patch does not work ?
Somewhere in the backend ? In some emails (if so, which one) ? In the front-end ? During the checkout ?

Please provide some details in order to help us for the investigation.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 117
  • Thank you received: 3
10 years 2 weeks ago #178436

Hi, we need to show the name of those fields (example VAT: IT02367853727) in invoices, addresses, orders, etc... both backend and frontend.

Thanks

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 2 weeks ago #178564

Hi,

I edited the view "order | invoice" and "order | address_template" in order to make it work properly.
The view "order | invoice" had already an override for your website so it did not use the function:

$class = hikashop_get('class.address');
echo $class->displayAddress($this->element->fields,$this->element->billing_address,'order');
to display the address.
The old "invoice" view you were using loaded the address template without an address as parameter.
So the address template could not know that the address had a VAT.

With the code from HikaShop 2.3.4 ; it is working fine.
The invoice and shipping invoice are correct in the backend.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.053 seconds
Powered by Kunena Forum