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

#   Need to add permanent checkout checkbox

##

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

Less More

- Posts: 48
- Thank you received: 0
-
-

11 years 7 months ago -  11 years 7 months ago [\#198058](#198058) by [Saiah](/forum/user/34944-saiah "View Saiah's Profile")  *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198058 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")* was created by *[Saiah](/forum/user/34944-saiah "View Saiah's Profile")*

-- HikaShop version -- : 2.3.1
-- Joomla version -- : 3.3.1
-- PHP version -- : 5.4.43
-- Browser(s) name and version -- : MOZILLA FF 33.0.3

Hello there Hika experts:
I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.

I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical:
example
- Pay with Tranzila .
- Pay with Tranzila with extra handling (+20$) .
- Pay with PayPal ...................................................... &lt;=== This I can do but is not elegant !!
- Pay with PayPal with extra handling (+20$) .

So how do I go about this ,in an elegant way preferably ?

Last edit: 11 years 7 months ago by [Saiah](/forum/user/34944-saiah "View Saiah's Profile").

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

11 years 7 months ago [\#198066](#198066) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198066 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")*

Hi,

The more elegant way will be to use an order custom field and a little custom plugin.
Thanks to the order custom field (HikaShop Business is required), you can add extra content during the checkout, like checkbox, text field, date picker, etc.

Thanks to little custom plugin you can assign a price to a custom field.
[ www.hikashop.com/forum/checkout/872829-w...icles-as-a-gift.html](http://www.hikashop.com/forum/checkout/872829-wrap-the-articles-as-a-gift.html)
[ www.hikashop.com/forum/checkout/873239-g...ng-for-hikashop.html](http://www.hikashop.com/forum/checkout/873239-gift-wrapping-for-hikashop.html)
( It is also possible to use a view override in the checkout in order to do same kind of work )

Regards,

---

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

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

11 years 7 months ago [\#198170](#198170) by [Saiah](/forum/user/34944-saiah "View Saiah's Profile")  Replied by *[Saiah](/forum/user/34944-saiah "View Saiah's Profile")* on topic *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198170 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")*

Thanks for your reply,

I have added a custom field to the address table with the name express that can either have the value yes or no (single drop down list).
Now I want to create a plugin that goes something like this:
Code:

class plgHikashopExpress extends JPlugin { function onAfterCartShippingLoad(&amp;$cart) { $app = JFactory::getApplication(); $order_fields = $app-&gt;getUserState(HIKASHOP_COMPONENT.'.checkout_fields', null); if((int)$address_fields-&gt;express == 'no') return; if(!empty($cart-&gt;order_currency_id)) $currency_id = (int)$cart-&gt;order_currency_id; else $currency_id = (int)hikashop_getCurrency(); $express = new stdClass(); $express-&gt;name = 'Express Delivery'; $express-&gt;value = ''; $express-&gt;price_currency_id = $currency_id; $express-&gt;price_value = 20; $express-&gt;price_value_with_tax = 20; $express-&gt;additional['express'] = $express; } }

Would this work?
And how exactly do I install this plugin?
Thank you.

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

11 years 7 months ago [\#198193](#198193) by [Saiah](/forum/user/34944-saiah "View Saiah's Profile")  Replied by *[Saiah](/forum/user/34944-saiah "View Saiah's Profile")* on topic *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198193 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")*

I have managed to install the plugin ,but I now know that the code I tried won't work.
I am trying now to access the express field in the address object in my cart ,to see if express delivery is tecked or not so I can add extra 20 to the payment or not.

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

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

Less More

- Posts: 48
- Thank you received: 0
-
-

11 years 7 months ago [\#198197](#198197) by [Saiah](/forum/user/34944-saiah "View Saiah's Profile")  Replied by *[Saiah](/forum/user/34944-saiah "View Saiah's Profile")* on topic *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198197 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")*

Sorry for the hassle.
It all worked out just fine:
I added extra field to address named it 'express'
then I installed the plugin based on the function onAfterCartShippingLoad(&amp;$cart)
then I got the user id:
$hk_user_id = $app-&gt;getUserState(HIKASHOP_COMPONENT.'.user_id');
then I got the express state:
$db = JFactory::getDbO();
$db-&gt;setQuery('SELECT express FROM #__hikashop_address WHERE address_user_id =' . $hk_user_id);
$express_state = $db-&gt;loadObject();
And now it is all working the I want it to.

Thanks a lot for the help.

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

11 years 7 months ago [\#198199](#198199) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Need to add permanent checkout checkbox](/forum/27-checkout/876295-need-to-add-permanent-checkout-checkbox#198199 "-- HikaShop version -- : 2.3.1 -- Joomla version -- : 3.3.1 -- PHP version -- : 5.4.43 -- Browser(s) name and version -- : MOZILLA FF 33.0.3  Hello there Hika experts: I need to add a checkbox to my checkout page where client can choose to add extra payment for special package handling and delivery ,the extra service always costs the same regardless the package.  I thought of adding a payment method where I always add the extra sum ,but I have two payment methods so this make my checkout page have 4 payment methods which entirely not practical: example - Pay with Tranzila . - Pay with Tranzila with extra handling (+20$) . - Pay with PayPal ...................................................... ")*

Hi,

Because you're using a checkbox for the custom order field, you should check if the value is empty or not.
When you check the box, you will have the value of the custom field, otherwise, you have "nothing".
That's why in the code that you previously posted, you need to have a different check Code:

if(empty($order_fields -&gt;express)) return;

But for sure, if you're using address fields and not order field ; the code is different and your last code is quite better (to load the current user address)

Regards,

---

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

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

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