Module with VAT Number?

  • Posts: 60
  • Thank you received: 3
8 years 11 months ago #200102

-- HikaShop version -- : 2.2.2
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.29

Is it possible to create a Custom HTML module that would show the address_vat value for the logged in user? That would be incredibly helpful for me.

Thanks!

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
8 years 11 months ago #200114

Hi,

A Custom HTML module no ; but a custom module (with some PHP), yes.
Because you will need to load the user if you want to display that value and to do that, you will need some custom PHP code.

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: 60
  • Thank you received: 3
8 years 11 months ago #200168

Could I pay for the support that would be necessary to implement this?

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

  • Posts: 60
  • Thank you received: 3
8 years 11 months ago #200171

I believe that I can use this plugin to execute the php code directly in the module. I'm using the below code but I don't get a result. Any ideas?

<?php $db->setQuery("SELECT ha.address_vat FROM #__hikashop_address ha LEFT JOIN #__hikashop_user hu ON ha.address_user_id=hu.user_cms_id WHERE hu.user_cms_id = '".$userId."' LIMIT 1"); ?>

Last edit: 8 years 11 months ago by blueagle1829.

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
8 years 11 months ago #200201

We would be happy that you would renew your subscription :)

With sourcerer it should be possible yes.
Such code should do the job:

{source}<?php
 $query = "SELECT ha.address_vat FROM #__hikashop_address ha LEFT JOIN #__hikashop_user hu ON ha.address_user_id=hu.user_cms_id WHERE hu.user_cms_id = '".$user->id."' LIMIT 1";
 $database->setQuery($query);
 echo $database->loadResult();
?>{/source}

The following user(s) said Thank You: blueagle1829

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

  • Posts: 60
  • Thank you received: 3
8 years 11 months ago #200442

That does produce a result, but it's not the VAT that is associated with my account... Any ideas why that would be?

EDIT:
Specifically, my hikashop ID is 1 and the ID for the user that it returned is 222.

Last edit: 8 years 11 months ago by blueagle1829.

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
8 years 11 months ago #200473

$user->id is the id of the user in Joomla, not HikaShop.
Sourcerer doesn't know of the id of the user in HikaShop, only in Joomla.
So it's normal that the ids do not correspond. Still, it should pick the correct address VAT number of one of the addresses of the current user.

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

  • Posts: 60
  • Thank you received: 3
8 years 11 months ago #200490

Please see the attached screen shots. It shows that the number which should be displayed with my account is 95175300, but the front end is actually displaying 10723406 (which is associated with a different account).

I really appreciate your help with this... Not sure what's going wrong here.

Attachments:

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
8 years 11 months ago #200501

Ha, I know, there is a mistake in the code you gave. It should be like that:

{source}<?php
 $query = "SELECT ha.address_vat FROM #__hikashop_address ha LEFT JOIN #__hikashop_user hu ON ha.address_user_id=hu.user_id WHERE hu.user_cms_id = '".$user->id."' LIMIT 1";
 $database->setQuery($query);
 echo $database->loadResult();
?>{/source}

The following user(s) said Thank You: blueagle1829

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

  • Posts: 60
  • Thank you received: 3
8 years 11 months ago #200680

That got it. You can lock this thread. Thank you!

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

Time to create page: 0.074 seconds
Powered by Kunena Forum