Skip to main content

How to add the custom shipping method restrictions

More
3 years 5 months ago #350469 by ler@singmuiheng.com
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.9.21
-- PHP version -- : 7.2.34
-- Browser(s) name and version -- : Google Chrome

hi, we have create own shipping plugin but we found that the plugin not in the shipping method restrictions on the payment options, can know where should we add the value options on it? can see the attachment for the payment method restrictions

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #350470 by nicolas
Hi,

Once you install a shipping plugin on your Joomla website, you need to go in the menu System>Shipping methods of HikaShop, click on the "new" button, select your shipping plugin and configure a shipping method for it.
Once done, you'll see the shipping method you created selectable in this option.
Did you do all this first ?

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #350499 by ler@singmuiheng.com
yes we did it but when do the restriction at payment method the shipping created is not showing

This message contains confidential information

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #350504 by nicolas
Hi,

For the "shipping methods" option in the payment methods and custom order fields, you need to implement the shippingMethods method in your shipping plugin class.
For example, in the Australia Post v2 plugin we have:
Code:
function shippingMethods(&$main) { $methods = array(); foreach($this->shipping_types as $value => $key){ if(!empty($main->shipping_params->$value)) $methods[$main->shipping_id.'-'.$key] = $this->shipping_names[$value]; } return $methods; }

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #350523 by ler@singmuiheng.com
yes the options is showing now at the restrictions, but it not showing at payment page since it cannot capture the shipping options, do you have any suggestions for this?

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #350527 by nicolas
Hi,

Well, for the checkout, you need to implement the onShippingDisplay(&$order,&$dbrates,&$usable_rates,&$messages) method in your plugin and have it request the available shipping services / costs for the shipping address of the user and then duplicate the shipping method object of the shipping plugin from the $dbrates array to the $usable_rates array (one per service / cost you want to offer).

Please Log in or Create an account to join the conversation.

Time to create page: 0.243 seconds
Powered by Kunena Forum