Skip to main content

Module with VAT Number?

More
11 years 5 months ago #200102 by blueagle1829
-- 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.

More
11 years 5 months ago #200114 by Jerome
Replied by Jerome on topic Module with VAT Number?
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.

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

More
11 years 5 months ago #200168 by blueagle1829
Could I pay for the support that would be necessary to implement this?

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

More
11 years 5 months ago - 11 years 5 months ago #200171 by blueagle1829
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?
Code:
<?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: 11 years 5 months ago by blueagle1829.

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

More
11 years 5 months ago #200201 by nicolas
Replied by nicolas on topic Module with VAT Number?
We would be happy that you would renew your subscription :)

With sourcerer it should be possible yes.
Such code should do the job:
Code:
{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.

More
11 years 5 months ago - 11 years 5 months ago #200442 by blueagle1829
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: 11 years 5 months ago by blueagle1829.

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

More
11 years 5 months ago #200473 by nicolas
Replied by nicolas on topic Module with VAT Number?
$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.

More
11 years 5 months ago #200490 by blueagle1829
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.

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

More
11 years 5 months ago #200501 by nicolas
Replied by nicolas on topic Module with VAT Number?
Ha, I know, there is a mistake in the code you gave. It should be like that:
Code:
{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.

More
11 years 5 months ago #200680 by blueagle1829
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.241 seconds
Powered by Kunena Forum