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

#   How to catch POST variable when shipping address id change

##

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

Less More

- Posts: 12
- Thank you received: 0
-
-

8 years 8 months ago -  8 years 8 months ago [\#288222](#288222) by [skorweb](/forum/user/35005-skorweb "View skorweb's Profile")  *[How to catch POST variable when shipping address id change](/forum/28-shipping-methods/893847-how-to-catch-post-variable-when-shipping-address-id-change#288222 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1.6 -- Browser(s) name and version -- : Firefox 58.0.2  This is not an issue but I need to know my possibilities.  In the checkout, on the billing and shipping addresse display choice, when we change the shipping address an array of post variables is sent dinamically (by ajax I guess). Is it possible to catch those variables in order to display dinamically something else like a list of pickup based on the address id without reload page needs ? Or should I check the cart table in the db with another ajax script to catch the current (whithout reloaded page) shipping id ?  cordially")* was created by *[skorweb](/forum/user/35005-skorweb "View skorweb's Profile")*

-- HikaShop version -- : 3.2.2
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.1.6
-- Browser(s) name and version -- : Firefox 58.0.2

[ ![Capturedecran2018-02-20a08.42.42.png](/forum/attachment/42700) ](/forum/attachment/42700 "...0a08.42.42.png")

This is not an issue but I need to know my possibilities.

In the checkout, on the billing and shipping addresse display choice, when we change the shipping address an array of post variables is sent dinamically (by ajax I guess).
Is it possible to catch those variables in order to display dinamically something else like a list of pickup based on the address id without reload page needs ? Or should I check the cart table in the db with another ajax script to catch the current (whithout reloaded page) shipping id ?

cordially

- [ ![Capturedecran2018-02-20a08.42.42.png](/forum/attachment/42700) ](/forum/attachment/42700 "...0a08.42.42.png") [ ](/forum/attachment/42700?download=1 "...0a08.42.42.png")

Last edit: 8 years 8 months ago by [skorweb](/forum/user/35005-skorweb "View skorweb's Profile").

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86556
- Thank you received: 14304
-
-

8 years 8 months ago [\#288225](#288225) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to catch POST variable when shipping address id change](/forum/28-shipping-methods/893847-how-to-catch-post-variable-when-shipping-address-id-change#288225 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1.6 -- Browser(s) name and version -- : Firefox 58.0.2  This is not an issue but I need to know my possibilities.  In the checkout, on the billing and shipping addresse display choice, when we change the shipping address an array of post variables is sent dinamically (by ajax I guess). Is it possible to catch those variables in order to display dinamically something else like a list of pickup based on the address id without reload page needs ? Or should I check the cart table in the db with another ajax script to catch the current (whithout reloaded page) shipping id ?  cordially")*

Hi,

In my opinion, if you want to display a list of pickup locations so that the customer can select one among them and that this list depends on the address entered by the user, the best is to add your own checkout block via a plugin.
For that you'll want to implement the "checkout API" of HikaShop in your plugin:
[ www.hikashop.com/support/documentation/6...tation.html#checkout](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#checkout)
In your plugin, you can easily load the current cart data with:
$cartClass = hikashop_get('class.cart');
$cart = $cartClass-&gt;getFullCart();
And you will have the information of the id of the selected shipping address in $cart-&gt;cart_shipping_address_ids
And you can use such code to load the details of that address:
$addressClass = hikashop_get('class.address');
$address = $addressClass-&gt;get($cart-&gt;cart_shipping_address_ids);

In your plugin, you'll want to implement onCheckoutStepList to add your new block to the list of available blocks so that you can add it to the checkout workflow in the HikaShop configuration.
You can potentially implement onBeforeCheckoutStep to check that the address has already been selected (but depending on how your checkout workflow, this might not be necessary).
You can implement onCheckoutStepDisplay to display the list based on the cart's shipping address
And you can implement onAfterCheckoutStep to save the selection of the pickup list in the cart.
What I also recommend is to configure a custom order field in order to store the selection of the pick up list.
That way, you won't have to handle the display of your selected pickup list in the order, in the email notifications, in the invoices, etc as it will be done by the custom order field system.

You can see an example of that with the plugins/hikashop/userpoints.php plugin which can add its own points usage block to the checkout in a similar way.

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

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