How to add the custom shipping method restrictions

  • Posts: 548
  • Thank you received: 11
  • Hikamarket Multivendor Hikashop Business
1 year 4 weeks ago #350469

-- 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

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
1 year 4 weeks ago #350470

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.

  • Posts: 548
  • Thank you received: 11
  • Hikamarket Multivendor Hikashop Business
1 year 3 weeks ago #350499

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.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
1 year 3 weeks ago #350504

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:

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.

  • Posts: 548
  • Thank you received: 11
  • Hikamarket Multivendor Hikashop Business
1 year 3 weeks ago #350523

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?

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
1 year 3 weeks ago #350527

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.062 seconds
Powered by Kunena Forum