Shipping Value Fro External Source

  • Posts: 57
  • Thank you received: 1
8 years 4 months ago #245543

-- HikaShop version -- : HikaShop Business 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 7.07
-- Browser(s) name and version -- : Firefox 46

Hey

I have an API that returns the value of shipping based on a matrix/calculation.

I have set up a manual shipping method and set it to 0.

How can I set the value of shipping to the value I'm getting from the external API?

That's the response I get and Charge is the value of shipping :

client : MCR
product : Flyer_A5_120gsm_Un_1pp_Ld_Col_T
quantity : 2000
price : 9000
vat : N
supplier : Trilogy
email : t@t.com
boxqty : 500
charge : 2000
checksum : 2ca56d3d4c3cfb54b21ea4477d824f32
error : 0
reply :
stamp : 2016-07-12T13:43:56+01:00

Thanks

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 4 months ago #245546

Hi,

So do you know the matrix of fees and the ranges on which it bases it's calculations ? weight ? dimensions ? quantity ? price of the products ? etc).
You can either create many manual shipping methods, one for each cell of your matrix with the corresponding ranges setup and the system will filter the available shipping methods based on these ranges, or you can also develop a small shipping plugin to connect to that external API, provide it the necessary information and use the returned fee as price of the shipping method, like we did with the UPS, USPS, FedEx, etc plugins.

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

  • Posts: 57
  • Thank you received: 1
8 years 4 months ago #246165

Thanks for your reply.

It all makes sense but I think there is a more simple solution.

See in image attached - the costs are already being passed from the API to the custom field I created called Shipping.

I have created a shipping method with the value of zero and didn't assign it to any vendor. All I am trying to do is pass this value to the actual shipping method. So Shipping Costs = value from shipping custom field.

Hope that makes more sese ;)

Thanks

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 4 months ago #246175

Hi,

In that case, you can create a small plugin which will loop through the products array in the cart, sum the shipping fee in each, and add the total as an "additional" fee.
You can base your plugin off of this one which do something quite similar :
www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511
It's indeed much simpler if you handle it that way.

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

  • Posts: 57
  • Thank you received: 1
8 years 3 months ago #246658

Thanks that worked.

Although, is there a way to now pass this value to the real shipping field?

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
8 years 3 months ago #246662

Hello,
To do that the solution can be to directly edit the code of the "Show_additionnal" file of the "Order" view of your back-end template via "Hikashop->Display->Views".

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

  • Posts: 57
  • Thank you received: 1
8 years 3 months ago #246753

Hey Mohamed

Thanks for your reply.

However I am confused with your advice. To clarify I want the 'Standard Shipping' Value to pass to the 'Shipping' value.

Can you please give some more details on how to edit the view file in order to acheive the above.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 3 months ago #246763

Hi,

What Mohamed suggested is that you edit the view from your screenshot to not display the shipping row, only your standard shipping row.
You can even do it by just adding such CSS to your backend HikaShop CSS file in the HikaShop configuration:
.hikashop_order_additional_shipping{ display:none; }

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

Time to create page: 0.077 seconds
Powered by Kunena Forum