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

#   Address id field doesn't appear in onAfterAddressCreate

##

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

8 years 6 months ago [\#292472](#292472) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  *[Address id field doesn't appear in onAfterAddressCreate](/forum/32-content-creation/894668-address-id-field-doesnt-appear-in-onafteraddresscreate#292472 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.3  Hi,  I'm developing a Hikashop plugin using two triggers from the Address Api:  1. onAfterAddressCreate  2. onAfterAddressUpdate  Case A:  onAfterAddressCreate the $element variable is not retrieving the new address&#95;id, but is returning a 0 instead.  In the address table (#&#95;&#95;hikashop&#95;address) the row it's saved with the correct id.  Case B:  onAfterAddressUpdate trigger works fine,  I'm proceeding the incorrect way?  Thanks in advance.  -- Victor")* was created by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")*

-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.3

Hi,

I'm developing a Hikashop plugin using two triggers from the Address Api:

1. onAfterAddressCreate

2. onAfterAddressUpdate

**Case A:**

onAfterAddressCreate the $element variable is not retrieving the new address_id, but is returning a 0 instead.

In the address table (#__hikashop_address) the row it's saved with the correct id.

**Case B:**

onAfterAddressUpdate trigger works fine,

I'm proceeding the incorrect way?

Thanks in advance.

--
Victor

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODk0NjY4LWFkZHJlc3MtaWQtZmllbGQtZG9lc250LWFwcGVhci1pbi1vbmFmdGVyYWRkcmVzc2NyZWF0ZT90bXBsPW1hcmtkb3du) 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: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

8 years 6 months ago [\#292480](#292480) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Address id field doesn't appear in onAfterAddressCreate](/forum/32-content-creation/894668-address-id-field-doesnt-appear-in-onafteraddresscreate#292480 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.3  Hi,  I'm developing a Hikashop plugin using two triggers from the Address Api:  1. onAfterAddressCreate  2. onAfterAddressUpdate  Case A:  onAfterAddressCreate the $element variable is not retrieving the new address&#95;id, but is returning a 0 instead.  In the address table (#&#95;&#95;hikashop&#95;address) the row it's saved with the correct id.  Case B:  onAfterAddressUpdate trigger works fine,  I'm proceeding the incorrect way?  Thanks in advance.  -- Victor")*

Hello,

Indeed, the "address_id" is not populate in the HikaShop address class.
You need to edit the file and replace Code:

$dispatcher-&gt;trigger( 'onAfterAddressCreate', array( &amp;$addressData ) );

By Code:

$addressData-&gt;address_id = (int)$status; $dispatcher-&gt;trigger( 'onAfterAddressCreate', array( &amp;$addressData ) );

Be sure that we will also include the patch in our end.

Regards,

---

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

The following user(s) said Thank You: [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")

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

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

8 years 6 months ago [\#292492](#292492) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  Replied by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")* on topic *[Address id field doesn't appear in onAfterAddressCreate](/forum/32-content-creation/894668-address-id-field-doesnt-appear-in-onafteraddresscreate#292492 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.8.3  Hi,  I'm developing a Hikashop plugin using two triggers from the Address Api:  1. onAfterAddressCreate  2. onAfterAddressUpdate  Case A:  onAfterAddressCreate the $element variable is not retrieving the new address&#95;id, but is returning a 0 instead.  In the address table (#&#95;&#95;hikashop&#95;address) the row it's saved with the correct id.  Case B:  onAfterAddressUpdate trigger works fine,  I'm proceeding the incorrect way?  Thanks in advance.  -- Victor")*

Thanks a lot for the answer!

Now it works!

--
Victor

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODk0NjY4LWFkZHJlc3MtaWQtZmllbGQtZG9lc250LWFwcGVhci1pbi1vbmFmdGVyYWRkcmVzc2NyZWF0ZT90bXBsPW1hcmtkb3du) 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.056 seconds

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