Custom shipping method

  • Posts: 171
  • Thank you received: 4
9 years 7 months ago #199306

Hi nicolas,

thanx for the info..

in my onShippingDisplay i fetches the delivery places from their feed and does

foreach ($servicePoints as $shop) {
					$usable = new stdClass();
					$usable->code = $shop->servicePointId;
					$usable->shipping_currency_id = hikashop_getCurrency();
					$usable->countries = $shop->visitingAddress->countryCode;
					//$usable->email = $method['email'];
					$usable->postal_code = $shop->visitingAddress->postalCode;
					$usable->shipping_name = $shop->name;
					$usable->shipping_type = "postdk shipping";
					$usable->shipping_id = $shop->servicePointId;
					$usable->shipping_price = $usable_methods[$key]->shipping_price;
					$usable->shipping_ordering = $usable_methods[$key]->shipping_ordering;
					$usable->shipping_description = $shop->name .' '. $shop->visitingAddress->streetName .' '. $shop->visitingAddress->streetNumber .', '. $shop->visitingAddress->postalCode .' '. $shop->visitingAddress->city;
					$rates[$method->shipping_type ."-".$shop->servicePointId] = $usable;
				}
				unset($usable_methods[$key]);
				$usable_methods = array_merge($usable_methods,$rates);

now i just added that the shipping-type in the names in $rates and now they have a name like postdk-7391

but its still not working and i still get same error as before.

I will gladly send you the whole plugin if you give me your email so you can look at it and maybe tell me what i'm doing wrong.

Last edit: 9 years 7 months ago by jesper.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 7 months ago #199332

Hi,

You say that you have postdk-7391 in the id of your shipping methods but that's not what I see in your code:
$usable->shipping_id = $shop->servicePointId;
It should be:
$usable->shipping_id = 'postdk-'.$shop->servicePointId;

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

  • Posts: 171
  • Thank you received: 4
9 years 7 months ago #199420

changed that, but still get
Fatal error: Call to a member function onShippingSave() on a non-object in components/com_hikashop/controllers/checkout.php on line 979

foreach ($servicePoints as $shop) {
					$usable = new stdClass();
					$usable->code = $shop->servicePointId;
					$usable->shipping_currency_id = hikashop_getCurrency();
					$usable->countries = $shop->visitingAddress->countryCode;
					//$usable->email = $method['email'];
					$usable->postal_code = $shop->visitingAddress->postalCode;
					$usable->shipping_name = $shop->name;
					$usable->shipping_type = "postdk shipping";
					$usable->shipping_id = $method->shipping_type ."-".$shop->servicePointId;
					$usable->shipping_price = $usable_methods[$key]->shipping_price;
					$usable->shipping_ordering = $usable_methods[$key]->shipping_ordering;
					$usable->shipping_description = $shop->name .' '. $shop->visitingAddress->streetName .' '. $shop->visitingAddress->streetNumber .', '. $shop->visitingAddress->postalCode .' '. $shop->visitingAddress->city;
					$rates[$method->shipping_type ."-".$shop->servicePointId] = $usable;
				}
				unset($usable_methods[$key]);
				JFactory::getApplication()->enqueueMessage(var_export($rates,true));
				$usable_methods = array_merge($usable_methods,$rates);

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 7 months ago #199446

Hi,

Then I don't know what else could be the problem.
We would need to look at the whole plugin to be able to say anything else.
you can send it to contact at hikashop dot com with a link to this thread and we'll have a look.

The following user(s) said Thank You: jesper

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

  • Posts: 171
  • Thank you received: 4
9 years 7 months ago #199563

Hi nicolas,

i have sendt you the plugin and hope you are able to help me get this done :)

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

  • Posts: 171
  • Thank you received: 4
9 years 6 months ago #200076

Hi Nicolas,

just wanna say thanx for all the help... i now have it working :)

now i only have one challenge left with is some urlencoding that isn't working as it should, be i will get there.

It would be really nice, if there was alot better documentation for the shipping plugins.

The following user(s) said Thank You: nicolas

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #200117

Hi,

On which part exactly do you want some improvements ?

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 171
  • Thank you received: 4
9 years 6 months ago #200135

Hey Jerome,

as i wrote to nicolas it would be nice with some complete documentation on the shipping interface to make custom shipping plugins, cause this has been a struckle to get though this.

Also about getShippingAddress it would be nice, if you could just assing the "fields" in array, that then writes it into the default structure instead of a freetext return field.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.077 seconds
Powered by Kunena Forum