Is it possible to create a plugin for insurance?

  • Posts: 97
  • Thank you received: 1
13 years 2 months ago #8961

I would like to know if there is any possibility to add a plugin with insurance option. My customer wants to have insurance for the sending products.


Life is nice but is with somebody else

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #8965

Mmmm, I don't think that you really need a plugin for that. You would just have to edit one of the view files of the checkout view to add the insurance automatically to the cart based on the products in the cart.

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

  • Posts: 97
  • Thank you received: 1
13 years 2 months ago #9016

I don't think that is possible since insurance is charged according to the amount bought. for example for each 100 is 0.30 and has a base of charge 2,20


Life is nice but is with somebody else

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

  • Posts: 97
  • Thank you received: 1
13 years 2 months ago #9020

Also something i've forgot. Insurance is not applied to all products


Life is nice but is with somebody else

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #9023

Why wouldn't that be possible ?

You could create a custom product field to set for each product if it can be insured or not and then have such code:

$bases = 0;
$already = false;
foreach($this->rows as $i => $row){
 if($row->product_code =='insurance') $already = true;
 if(empty($row->cart_product_quantity) || empty($row->product_insured)) continue;
 $price = $row->price_value_with_tax*$row->cart_product_quantity;
 $bases += (int)$price/100;
 if( $price%100) $bases++;
}
if(!$already){
 $app =& JFactory::getApplication();
 $app->redirect(hikashop::completeLink('product&task=updatecart&product_id=XX&quantity='.$bases.'&add=0&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
Then, you will want to change a bit the code to remove the link to the insurance product and hide the quantity of the insurance and update the insurance quantity if the number of products, etc changes...

Last edit: 13 years 1 month ago by nicolas.

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

  • Posts: 97
  • Thank you received: 1
13 years 2 months ago #9031

Sorry don't have a clue about programming :(


Life is nice but is with somebody else

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

  • Posts: 14
  • Thank you received: 0
13 years 2 months ago #10256

Hi Nicolas,

I want to add a insurance cost for my products. I see your code, but I have no idea where should I put that? Curently, I'm using a free version of HikaShop. This is my first project with online store... If you will be so kind, please help me :o)

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #10257

That code is to be set in the file step of the view checkout via the menu Display->Views. But as I said, that's just a small example and you will have to adapt it to your case. Also, I mention that you need to create a custom product field to select whether a product could be insured or not. custom product fields are only in our commercial editions...

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

  • Posts: 14
  • Thank you received: 0
13 years 2 months ago #10258

Thanks for a quick respond... Do I need to create a custom product field if all my products should be insured?

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #10259

No. That custom field is needed if you want to be able to select whether a product can be insured or not, but if the are all insured, you don't need it.

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

  • Posts: 14
  • Thank you received: 0
13 years 2 months ago #10267

Nicolas, I would like to add insurance cost to the total amout during the check out process.
Like I said before, I don't have any experience with any type of project like that. I would like to learn more about Hika Shop for potencial future projects. So if you can... please advice what do I need to do, and what version of your shop will be appropriate for my project?

Insurance cost that I would like to add to total amout during check out process:
$0.00 to $50.00 - $1.75
$50.01 to $100.00 - $2.25
$100.01 to $200.00 - $2.75
$200.01 to $300.00 - $4.70
$300.01 to $400.00 - $5.70
$400.01 to $500.00 - $6.70
$500.01 to $600.00 - $7.70
$600.01 to $5,000.00 - $7.70 & $1.00 per $100
(maximum liability is $5,000.00)

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #10269

I'm not sure if that would work for you but one solution would be to have the cost of the insurance included in your shipping methods rate.
If you need both with and without insurance rates, you could just duplicate them and offer the choice to the user.

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

  • Posts: 14
  • Thank you received: 0
13 years 2 months ago #10270

Insurance cost has to be add to the total amount during check out process. It will be one shipping rate for all products. Something like that: $4.75 + the insurance cost (which depends of the total amount of sell).
Do you think you will be able to do that for me? and for how much?

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #10271

So why not create shipping methods for your insurance ?

Suppose that you have only one unique shipping method, you could just transform it into 7 shipping methods, like this:

from 0 to $50 => 4.75+1.75 -> $6.50
from 50 to $100 => 4.75+2.25 -> $7.00
etc...

And then you have the shipping which includes the insurance...

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

  • Posts: 14
  • Thank you received: 0
13 years 2 months ago #10278

It's a good idea but I don't want to people to choose shipping methods. The shopping cart should choose the shopping options (including insurance cost) by itself based on the total amount of sell.

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

  • Posts: 81605
  • Thank you received: 13084
  • MODERATOR
13 years 2 months ago #10279

Yes, the shipping methods are filtered automatically based on the options you set in them. So if you set a minimum price of 0 and a maximum price of 50 for your shipping method, is will only be displayed when the price of the goods in the order is within that range.

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

  • Posts: 14
  • Thank you received: 0
13 years 1 month ago #10285

Nicolas, thank you for everything!!! It works perfectly for me!!! It was my first experince with HikaShop and first experience with online store too. I learned a lot from you today.
Well what can I say? Thanks for very good extension & master support...

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

Time to create page: 0.098 seconds
Powered by Kunena Forum