Delivery charges on public holiday and deliver tim

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #215937

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.4.40

Hi, we added different zone charges for shipping method

And now we added two custom field , advance date picker and dropdown for time selection

All are working fine for different shipping cost on each zone, time and date are also shown in order

But we would like to have extra charges when the date is Sunday or public holiday

And another extra charges on timing ? Eg 6-8pm +$30, 8-11pm +$80, 12am +$120

Is it possible to do that on current version without much tweak ?

Or can we use jquery to change the zone chargea during date and time selection ?

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

  • Posts: 82909
  • Thank you received: 13379
  • MODERATOR
9 years 1 month ago #215941

Hi,

The best would be to develop a small plugin in order to add an additional fee entry based on what is entered in the custom field.
If you're a developer, you can look at this plugin for how to develop such additional fee plugin:
www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511
And to load the data from the custom field in your plugin, it's really easy:
$app = JFactory::getApplication();
$fields_data = $app->getUserState( HIKASHOP_COMPONENT.'.checkout_fields');

It will be easier and cleaner than using jquery to change the zone and adapt the zones using code hacks around HikaShop.

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #216541

$fields_data = $app->getUserState( HIKASHOP_COMPONENT.'.checkout_fields');

got some problem on this

we try to see if our custom field are in the output of $fields_data but it is empty

Last edit: 9 years 1 month ago by ler@singmuiheng.com.

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #216542

We found the problem, now we got the field data

but the when user filling up the custom field, the data are not refresh immediately, it only got the data after user select shipping method

any method to optimize this?

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #216575

Dear Nicolas

I think we are almost there, we have managed to update the additional charges by multiple custom field with correct charges and final price (we corrected the price_value_with_tax in the example plugin)

but we found that the tax amount shown in cart are missing the value of these custom field charges

May i check with you how can we update the checkout_fields , tax_amount ? is there a ready function for that?

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

  • Posts: 82909
  • Thank you received: 13379
  • MODERATOR
9 years 1 month ago #216581

Hi,

What code are you using ?
Based on the method you use, my answer will be different.

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #216686

Dear Nicolas

we are using the same code as in
www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511

but we do if else clause base on what is selected on custom field

and make calculation to price with tax

then change the $additional array

$additional->price_currency_id = hikashop_getCurrency();;
$additional->price_value = if custom field value 80 {80};
$additional->price_value_with_tax = if custom field value 80 {80*1.06};


$cart->additional = $additional;

however, all are updated well, except tax_amount, wonder if we could just add tax_amount in the additional array

and is it possible to archive currency conversion for these amount? any sample code to refer?

We will release this additional fee full plugin after complete and fully tested ^_^

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

  • Posts: 82909
  • Thank you received: 13379
  • MODERATOR
9 years 1 month ago #216687

Hi,

If you look at our change log, you can see this:

We added the support of the taxes in the order additionals system

as a new feature of HikaShop 2.6.0
And I can see that you're using HikaShop 2.5.0 and that you're using the additionals system in order to add your custom fee.
So it's normal that the taxes of your additionals aren't taken into account.
You'll have to update to HikaShop 2.6.0 for that to work.

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #216778

Hi nicolas

What about the currency exchange rate can the additional take care of this, or we have to do it by other function?

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

  • Posts: 82909
  • Thank you received: 13379
  • MODERATOR
9 years 1 month ago #216821

Hi,

You're supposed to enter the additional fees in the same currency as the current currency that you can get with echo hikashop_getCurrency();
If you want to convert a price, you can do like that:
$currencyClass = hikashop_get('class.currency');
echo $currencyClass->convertUniquePrice($price, $srcCurrency_id, $dstCurrency_id);

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

  • Posts: 567
  • Thank you received: 11
9 years 1 month ago #217212

Hi

We are pleased that the small plugin are now ready and we would like to share with alls

There are two version,
6 options version and 2 options version and can be use together

global_cart_fee2x_deliveryday_choose - custom field "deliveryday_choose" required but you can define your own options, prices, taxes, currency

global_cart_fees6x_spec_time - custom field "spec_time" required but you can define your own options, prices, taxes, currency


File Attachment:

File Name: global_car...time.zip
File Size:2 KB


File Attachment:

File Name: global_car...oose.zip
File Size:2 KB

Attachments:
Last edit: 9 years 1 month ago by ler@singmuiheng.com.
The following user(s) said Thank You: nicolas

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

Time to create page: 0.075 seconds
Powered by Kunena Forum