"HikaShopCustom Quantity plugin"

  • Posts: 61
  • Thank you received: 0
9 years 5 months ago #205231

-- url of the page with the problem -- : testpatiodrape.dependentmedia.com/produc...el-rod-straight-ends
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.13
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : no error message

I have a drape product configured successfully to multiply width and length for a total price per square foot but i also would like to have a rod product that multiplies the price per foot only for length. So length multiplied by price per foot.

$5 per foot x 10 feet = $50


A link to my unsuccessfully product configuration is here:

testpatiodrape.dependentmedia.com/produc...ting/product/132-rod

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #205248

Hi,

You have to use the Custom quantity plugin indeed, but to use it correctly, you have to create a custom item field with a column name equal to "ordered_length".
This way it will do the calculation based on the value set in that custom field.

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

  • Posts: 61
  • Thank you received: 0
9 years 5 months ago #205332

The "Custom quantity plugin" should already be installed successfully because I am using it to calculate the price per foot correctly, right? Here are screenshots of the configuration I have setup for the Display -> Custom Field -> New Item

and the resulting bad math in the cart

Attachments:
Last edit: 9 years 5 months ago by hsojhsoj.

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 5 months ago #205359

Hi,

There is a misunderstanding here.
There are several custom quantity plugins.
You have installed one which handle the width*length calculations.
If you want to handle length calculations, you would need another one.
However, two custom quantity plugins cannot work together. So that leaves you with having to modifying the one you have to handle the calculations in both cases.

It's not complex. Edit the plugin php file and you'll see this piece of code (twice in the file) normally:
if(!empty($product->length) && !empty($product->width)){
$quantity = $quantity*$product->length*$product->width;
}
You could just add after that (in both places) :
if(!empty($product->ordered_length) ){
$quantity = $quantity*$product->ordered_length;
}

and that should do it.

The following user(s) said Thank You: hsojhsoj, durtom

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

Time to create page: 0.069 seconds
Powered by Kunena Forum