Calculate price based on size (Square Inches)

  • Posts: 2
  • Thank you received: 0
13 years 11 months ago #2617

Hi,

Is it possible with HikaShop to calculate a price based on an item size? I am building a shop for PCB manufacturing. I have a custom Joomla component that allows someone to upload their design. I run some processing against it and eventually come out with a Square Inches size. I need to be able to pass that size to HikaShop and have the price calculated when it is added to the cart.

Possible?

Thanks,
Curtis

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 11 months ago #2619

Hi,

What could be possible is to have several products (or one product with several variants) each one with a different price and then based on the size adding one product or the other to the cart.
You can easily add a product to the cart like that:

include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
$cart = hikashop::get('class.cart');
$cart->update($product_id,$quantity,0);

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

  • Posts: 2
  • Thank you received: 0
13 years 11 months ago #2623

Thank you for the response. This won't work for me because the quantity is actually calculated from a dynamic size. a design might be 1.24 x 3.11 = 3.86 square inches while another might be 1 x 2 = 2 square inches. Those would have different costs associated with them.

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 11 months ago #2625

You can always create a new value of the characteristic, then a new variant of the product and then add a price for that variant and add that variant to the cart, all that doing few SQL queries. But you can't just add a price to a product in the cart as the system needs the price to be linked to the product in the database.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum