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

#   Adding JavaScript to frontend of shipping method

##

- **[fengel](/forum/user/37465-fengel "View fengel's Profile")**
- [![fengel's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37465.jpg)](/forum/user/37465-fengel "View fengel's Profile") Topic Author
- [ Offline](/forum/user/37465-fengel)

Less More

- Posts: 27
- Thank you received: 4
-
-

11 years 3 months ago [\#209821](#209821) by [fengel](/forum/user/37465-fengel "View fengel's Profile")  *[Adding JavaScript to frontend of shipping method](/forum/28-shipping-methods/878431-adding-javascript-to-frontend-of-shipping-method#209821 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Firefox 38.0.5  I am currently developing a shipping method plugin. I wanted to know if it's possible to add some sort of control to the frontend, either via JavaScript or PHP.  I basically want this flow: 1. User logs in and is on checkout step Address 2. Billing Address and Shipping Address are showing 3. When user selects the custom shipping method, the Shipping Address div becomes hidden 4. The custom shipping method allows the user to select the nearest pickup location. This location becomes the order's shipping address  I've looked through the developer's documentation, but haven't found any mentions on the things listed above.")* was created by *[fengel](/forum/user/37465-fengel "View fengel's Profile")*

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.3.10
-- Browser(s) name and version -- : Firefox 38.0.5

I am currently developing a shipping method plugin. I wanted to know if it's possible to add some sort of control to the frontend, either via JavaScript or PHP.

I basically want this flow:
1. User logs in and is on checkout step Address
2. Billing Address and Shipping Address are showing
3. When user selects the custom shipping method, the Shipping Address div becomes hidden
4. The custom shipping method allows the user to select the nearest pickup location. This location becomes the order's shipping address

I've looked through the developer's documentation, but haven't found any mentions on the things listed above.

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

11 years 3 months ago [\#209835](#209835) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Adding JavaScript to frontend of shipping method](/forum/28-shipping-methods/878431-adding-javascript-to-frontend-of-shipping-method#209835 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Firefox 38.0.5  I am currently developing a shipping method plugin. I wanted to know if it's possible to add some sort of control to the frontend, either via JavaScript or PHP.  I basically want this flow: 1. User logs in and is on checkout step Address 2. Billing Address and Shipping Address are showing 3. When user selects the custom shipping method, the Shipping Address div becomes hidden 4. The custom shipping method allows the user to select the nearest pickup location. This location becomes the order's shipping address  I've looked through the developer's documentation, but haven't found any mentions on the things listed above.")*

Hi,

What you describe can be done using just PHP (for the checks).
And for the shipping address ; the shipping structure have a feature which allow to override the shipping address.
Thanks to that, you can simply put an empty shipping address or put the address you want.

Using PHP will be quite better than the javascript ; because the address will be stored in the database.

Regards,

---

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

The following user(s) said Thank You: [fengel](/forum/user/37465-fengel "View fengel's Profile")

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

- **[fengel](/forum/user/37465-fengel "View fengel's Profile")**
- [![fengel's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37465.jpg)](/forum/user/37465-fengel "View fengel's Profile") Topic Author
- [ Offline](/forum/user/37465-fengel)

Less More

- Posts: 27
- Thank you received: 4
-
-

11 years 3 months ago -  11 years 3 months ago [\#209982](#209982) by [fengel](/forum/user/37465-fengel "View fengel's Profile")  Replied by *[fengel](/forum/user/37465-fengel "View fengel's Profile")* on topic *[Adding JavaScript to frontend of shipping method](/forum/28-shipping-methods/878431-adding-javascript-to-frontend-of-shipping-method#209982 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Firefox 38.0.5  I am currently developing a shipping method plugin. I wanted to know if it's possible to add some sort of control to the frontend, either via JavaScript or PHP.  I basically want this flow: 1. User logs in and is on checkout step Address 2. Billing Address and Shipping Address are showing 3. When user selects the custom shipping method, the Shipping Address div becomes hidden 4. The custom shipping method allows the user to select the nearest pickup location. This location becomes the order's shipping address  I've looked through the developer's documentation, but haven't found any mentions on the things listed above.")*

Thank you for the response. I actually found a thread that is applicable: [ here](http://www.hikashop.com/forum/shipping-methods/876103-custom-shipping-method.html?limitstart=0).

I have to agree with the OP of that thread that documentation on shipping plugins is a bit lacking.

I'm looking through the envoimoinscher plugin and it seems that it adds an additional checkout step called "Pick Up Points". Some questions about this:

1. Should this step be on its own column, or can it exist in the same column as "Shipping"?
2. Is it possible to combine the "Shipping" and "Pick Up Points" views into one? I wanted to have a cleaner UI by having the "Shipping" selection trigger an AJAX call, which then transitions to the "Pick Up Points" view on the same page.
3. The displaying of the envoimoinscher\_view is done by **$this-&gt;showPage('view')**, inside the onCheckoutStepDisplay function. Can **$this-&gt;showPage** also be used in the onShippingDisplay function?

Last edit: 11 years 3 months ago by [fengel](/forum/user/37465-fengel "View fengel's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI4LXNoaXBwaW5nLW1ldGhvZHMvODc4NDMxLWFkZGluZy1qYXZhc2NyaXB0LXRvLWZyb250ZW5kLW9mLXNoaXBwaW5nLW1ldGhvZD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

11 years 3 months ago [\#209983](#209983) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Adding JavaScript to frontend of shipping method](/forum/28-shipping-methods/878431-adding-javascript-to-frontend-of-shipping-method#209983 "-- HikaShop version -- : 2.4.0 -- Joomla version -- : 3.4.1 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Firefox 38.0.5  I am currently developing a shipping method plugin. I wanted to know if it's possible to add some sort of control to the frontend, either via JavaScript or PHP.  I basically want this flow: 1. User logs in and is on checkout step Address 2. Billing Address and Shipping Address are showing 3. When user selects the custom shipping method, the Shipping Address div becomes hidden 4. The custom shipping method allows the user to select the nearest pickup location. This location becomes the order's shipping address  I've looked through the developer's documentation, but haven't found any mentions on the things listed above.")*

Hi,

1. Both are possible.

2. It's possible too. You can edit the file "shipping" of the view "checkout" via the menu Display&gt;Views if you want to add custom javascript on the selection of the shipping method in order to do the processing you want to display the pickup points view.

3. Yes, the $this-&gt;showPage() function will display its content in the current buffer. So if you call it in the onShippingDisplay function, you'll get it displayed at the top of the checkout.
That's probably something you don't want. You can start a new buffer before calling it and then retrieve the content of the buffer in order to add it to the display in the shipping view file or in the onCheckoutStepDisplay function (but then you could call it from there directly...)

The following user(s) said Thank You: [fengel](/forum/user/37465-fengel "View fengel's Profile")

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

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