[Skip to main content](#vessel-content)

#   Plugin onAfterUserCreate, Extrenal Invoice API

##

- **[Stejk](/forum/user/32810-stejk "View Stejk's Profile")**
- [![Stejk's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/32810-stejk "View Stejk's Profile") Topic Author
- [ Offline](/forum/user/32810-stejk)

Less More

- Posts: 2
- Thank you received: 0
-
-

12 years 4 months ago [\#157720](#157720) by [Stejk](/forum/user/32810-stejk "View Stejk's Profile")  *[Plugin onAfterUserCreate, Extrenal Invoice API](/forum/31-development/868559-plugin-onafterusercreate-extrenal-invoice-api#157720 "-- HikaShop version -- : 2.3.1 Business -- Joomla version -- : 3.2.1  Hello,  I have a problem with plugin developing. I want this:  &#42; User fill registration  &#42; Data from form will be send to some server  My code: Fapi.php  Fapi.xml  But if i complete registration nothing. :(  If i make this ready, next task is send order details (address and items) to invoice application (FAPI.CZ).")* was created by *[Stejk](/forum/user/32810-stejk "View Stejk's Profile")*

-- HikaShop version -- : 2.3.1 Business
-- Joomla version -- : 3.2.1

Hello,

I have a problem with plugin developing.
I want this:

1. User fill registration
2. Data from form will be send to some server

My code: Fapi.php Code:

&lt;?php /** *@author Jakub Stejskal &lt;Cajme1273@gmail.com&gt; *@copyright Copyright (c) 2014, Jakub Stejskal */ defined( '_JEXEC' ) or die( 'Restricted access' ); jimport('joomla.plugin.plugin'); if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; } class plgHikashopFapi extends JPlugin { function plgHikashopFapi(&amp;$subject, $config){ parent::__construct($subject, $config); } /* function onAfterOrderCreate(&amp;$order) { }*/ function onAfterUserCreate(&amp;$element) { /** * Login informace do FAPI * @todo Udělat napojení na administraci a udělat úpravu v ní */ $username = 'login'; $password = 'pass'; $data = array( 'email' =&gt; $element-&gt;email, 'first_name'=&gt; $element-&gt;first_name, 'last_name'=&gt; $element-&gt;last_name, 'phone'=&gt; $element-&gt;telephone, 'address'=&gt; array( 'street'=&gt; $element-&gt;street, 'city'=&gt; $element-&gt;city, 'zip'=&gt; $element-&gt;post_code, 'country'=&gt; $element-&gt;country, ), ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://api.fapi.cz/clients"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Basic ' . base64_encode("$username:$password"), 'Accept: application/json', 'Content-Type: application/json' )); $response = curl_exec($ch); curl_close($ch); echo var_dump($element); // For check data } }

Fapi.xml Code:

&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;extension version="2.5" type="plugin" group="hikashop"&gt; &lt;name&gt;Hikashop Fapi connector&lt;/name&gt; &lt;author&gt;Jakub Stejskal&lt;/author&gt; &lt;creationDate&gt;24/05/2014&lt;/creationDate&gt; &lt;copyright&gt;Copyright (C) 2014 Jakub Stejskal. All rights reserved.&lt;/copyright&gt; &lt;license&gt;GNU General Public License&lt;/license&gt; &lt;authorEmail&gt;Cajme1273@gmail.com&lt;/authorEmail&gt; &lt;authorUrl&gt;www.stejk.eu&lt;/authorUrl&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;description&gt;Connect HikaShop and Fapi API&lt;/description&gt; &lt;files&gt; &lt;filename plugin="Fapi"&gt;Fapi.php&lt;/filename&gt; &lt;filename&gt;index.html&lt;/filename&gt; &lt;/files&gt; &lt;/extension&gt;

But if i complete registration nothing. ![:(](/media/kunena/emoticons/5.png ":(")

If i make this ready, next task is send order details (address and items) to invoice application (FAPI.CZ).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2ODU1OS1wbHVnaW4tb25hZnRlcnVzZXJjcmVhdGUtZXh0cmVuYWwtaW52b2ljZS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

12 years 4 months ago [\#157723](#157723) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Plugin onAfterUserCreate, Extrenal Invoice API](/forum/31-development/868559-plugin-onafterusercreate-extrenal-invoice-api#157723 "-- HikaShop version -- : 2.3.1 Business -- Joomla version -- : 3.2.1  Hello,  I have a problem with plugin developing. I want this:  &#42; User fill registration  &#42; Data from form will be send to some server  My code: Fapi.php  Fapi.xml  But if i complete registration nothing. :(  If i make this ready, next task is send order details (address and items) to invoice application (FAPI.CZ).")*

Hello,
1. Can you test it by registering through the Hikashop registration form ?

2. Can you check if your plugin is called or not after a registration by adding some "debug" code ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2ODU1OS1wbHVnaW4tb25hZnRlcnVzZXJjcmVhdGUtZXh0cmVuYWwtaW52b2ljZS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Stejk](/forum/user/32810-stejk "View Stejk's Profile")**
- [![Stejk's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/32810-stejk "View Stejk's Profile") Topic Author
- [ Offline](/forum/user/32810-stejk)

Less More

- Posts: 2
- Thank you received: 0
-
-

12 years 4 months ago [\#158205](#158205) by [Stejk](/forum/user/32810-stejk "View Stejk's Profile")  Replied by *[Stejk](/forum/user/32810-stejk "View Stejk's Profile")* on topic *[Plugin onAfterUserCreate, Extrenal Invoice API](/forum/31-development/868559-plugin-onafterusercreate-extrenal-invoice-api#158205 "-- HikaShop version -- : 2.3.1 Business -- Joomla version -- : 3.2.1  Hello,  I have a problem with plugin developing. I want this:  &#42; User fill registration  &#42; Data from form will be send to some server  My code: Fapi.php  Fapi.xml  But if i complete registration nothing. :(  If i make this ready, next task is send order details (address and items) to invoice application (FAPI.CZ).")*

Hello,
I think this code is debug Code:

echo var_dump($element);

If i send some product and process to checkout, i register but nothing happend.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2ODU1OS1wbHVnaW4tb25hZnRlcnVzZXJjcmVhdGUtZXh0cmVuYWwtaW52b2ljZS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

12 years 4 months ago [\#158246](#158246) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Plugin onAfterUserCreate, Extrenal Invoice API](/forum/31-development/868559-plugin-onafterusercreate-extrenal-invoice-api#158246 "-- HikaShop version -- : 2.3.1 Business -- Joomla version -- : 3.2.1  Hello,  I have a problem with plugin developing. I want this:  &#42; User fill registration  &#42; Data from form will be send to some server  My code: Fapi.php  Fapi.xml  But if i complete registration nothing. :(  If i make this ready, next task is send order details (address and items) to invoice application (FAPI.CZ).")*

Hi,

Because it's an HikaShop plugin, HikaShop will be loaded.
You don't have to put the inclusion of HikaShop in the beginning of your file.

Please be careful with filenames while developing plugins, use filenames in lowercase will be better for Linux.

You can put a " die('fapi plugin'); " just before your class to be sure that your plugin is right loaded (maybe unpublished, file not found depending the case (check the database too or re-install the plugin)).

The trigger "onAfterUserCreate" is called when HikaShop create a new user. You can put a trace in the HikaShop core itself to be sure that the trigger is right called (class user in HikaShop).

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2ODU1OS1wbHVnaW4tb25hZnRlcnVzZXJjcmVhdGUtZXh0cmVuYWwtaW52b2ljZS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.241 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
