- Posts: 171
- Thank you received: 4
Custom shipping method
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.10
-- Browser(s) name and version -- : -
Hi,
i created a custom shipping method for some stuff i'm working on... and its fine in the backend of J3 but it doesn't show up in the front end...
Now i tried many things and read what you wrote on the page for custom plugins, but can't seem to get it to work.
Any help/idea would be greatly accepted to get it to work, so that i can implement the rest of the code in it.
Please Log in or Create an account to join the conversation.
The issue comes from the end of your shipping plugin class where you have these lines:
If you redefine them without any code and without calling the parent class's method then the code handling the shipping plugin in the parent class won't work and the plugin won't add itself to the list of available shipping methods.
If you don't need them, remove them and you'll see that it will be much better.
If you do, then add the necessary code in them.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
i'm not having much luck doing anything at al... as soon as i start to use the function onShippingDisplay(&$order,&$methods,&$usable_methods,&$messages){
i can't get my shipping plugin to show up.... and as far as i have been able to see and deduct from the other shipping plugins, this i s what i need to do it with...
I like your cart alot, but this was so much easier to get to work on virtuemart than it is on here...
more documentation or help is really needed on making custom payment and shipping plugins
or at least an example shipping plugin with some advanced functions like there is for payment.
Please Log in or Create an account to join the conversation.
Do like this:
I suppose that what you want to do is just to force that shipping_price value to whatever is necessary for postDK based on the user address and the product information and all that can be found in $order.
An example shipping plugin is indeed a good idea. We however didn't had the time to do that yet.
If you have more questions, just ask us and we'll answer you. When we get tired of it, we'll do the example plugin
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
The displaying of your shipping methods won't be controlled by your plugin code, can you give me more details about what you exactly want to do through some screenshots for example ?but i need to output a dropdown and some javacript and on choose of the dropdown set it as shipping address of the order
Please Log in or Create an account to join the conversation.
if you understand what i mean
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
I didn't totally understood what your issue is and you want to do, can you give me more details through some screenshots for example please ?how can i make this my shipping address for the item when i click on, so that is sets the items shipping adress to be the address i get of this item.
Thanks.
Please Log in or Create an account to join the conversation.
Now i have gotten hika to get me a list of them out (seen screenshot)
Now when i click one of them and move on, i need to shop to put in the address info from that, as the shipping address of the order in order for the postal service to know, to where to delivere the package.
Please Log in or Create an account to join the conversation.
When you configure a shipping method, you have an option called "override shipping address".
www.hikashop.com/support/documentation/i...al-form.html#generic
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.
Please Log in or Create an account to join the conversation.
I need to be able to dynamicly set a shipping address for the order.
Please Log in or Create an account to join the conversation.
Fatal error: Call to a member function onShippingSave() on a non-object in components/com_hikashop/controllers/checkout.php on line 979
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
1.
You should then check how we saved the pickup points on the order through the envoimoinscher shipping plugin.Now when i click one of them and move on, i need to shop to put in the address info from that, as the shipping address of the order in order for the postal service to know, to where to delivere the package.
2.
Your issue is probably coming from of your shipping plugin, here is more information about the onShippingSave function : www.hikashop.com/forum/2-general-talk-ab...-shipping-costs.html
Calculating shipping amounts on the fly shouldn't be complicated. All happens in the onShippingDisplay function. There you can just put your method in the $usableMethods array and in your method object, set the shipping_price based on whatever algorithm you need.
The onShippingSave method is called when the shipping method is selected by user on the checkout.
If the shipping method is auto selected by default and that the user does not select another shipping method, that method will indeed not be called at all during the checkout, and that's normal.
Please Log in or Create an account to join the conversation.
2: i have created a function like this
But it still gives the error posted before.
Please Log in or Create an account to join the conversation.
but can this be used from other plugins, as i get this info dynamicly from a rss feed from my postal service
Please Log in or Create an account to join the conversation.
The shipping plugin envoimoinscher actually generate its own extra view on the checkout in order for the customer to select his pickup points and then add that extra data to the order.
While that is a possibility, it is much more complex than just generating several virtual shipping methods out of your main shipping method. Nevertheless, you can look at the plugin in the folder plugins/hikashopshipping/envoimoinscher if you want to check that out.
What I would recommend instead is to keep the solution you're using and just figure out a solution to that error.
Based on it, I can say that the problem comes from the way you initialize the virtual shipping methods in the onShippingDisplay method of your plugin, and more specifically the id of the shipping methods. The shipping id of each one should be unique, and should start with the name of the shipping plugin "postdk" in your case, followed by a - and then a unique identifier for the pickup point.
If the format you use for the shipping_id of your virtual shipping methods, the system won't be able to load the shipping plugin for the selected shipping method and the onShippingSave method call will fail during the checkout.
Please Log in or Create an account to join the conversation.