- Posts: 60
- Thank you received: 3
Module with VAT Number?
- blueagle1829
-
Topic Author
- Offline
Less
More
11 years 5 months ago #200102
by blueagle1829
Module with VAT Number? was created 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!
-- 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.
11 years 5 months ago #200114
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
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,
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.
- blueagle1829
-
Topic Author
- Offline
Less
More
- Posts: 60
- Thank you received: 3
11 years 5 months ago #200168
by blueagle1829
Replied by blueagle1829 on topic Module with VAT Number?
Could I pay for the support that would be necessary to implement this?
Please Log in or Create an account to join the conversation.
- blueagle1829
-
Topic Author
- Offline
Less
More
- Posts: 60
- Thank you received: 3
11 years 5 months ago - 11 years 5 months ago #200171
by blueagle1829
Replied by blueagle1829 on topic Module with VAT Number?
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.
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:
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.
- blueagle1829
-
Topic Author
- Offline
Less
More
- Posts: 60
- Thank you received: 3
11 years 5 months ago - 11 years 5 months ago #200442
by blueagle1829
Replied by blueagle1829 on topic Module with VAT Number?
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.
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.
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.
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.
- blueagle1829
-
Topic Author
- Offline
Less
More
- Posts: 60
- Thank you received: 3
11 years 5 months ago #200490
by blueagle1829
Replied by blueagle1829 on topic Module with VAT Number?
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.
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.
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.
- blueagle1829
-
Topic Author
- Offline
Less
More
- Posts: 60
- Thank you received: 3
11 years 5 months ago #200680
by blueagle1829
Replied by blueagle1829 on topic Module with VAT Number?
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