Product custom fields

  • Posts: 7
  • Thank you received: 1
9 years 8 months ago #214663

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3

Hi,
with product characteristics, is it possible to do the following?

For the sale of cabinets of custom sizes, I need the user to be able to enter desired width value.
Once the user enters the width he desires, this width needs to be checked against min and max possible width for this product. Then given the desired width, a weight for the product is passed to the cart checked against range of widths. For example:
A cabinet can have width min 300mm and max 600mm.
A customers enters the value for the width he wants in the product page, lets say 450mm.
Now hikashop should check that it is within the min-max width allowed, and then calculate the weight of the product based on: for width 300-400 weight is 28kg, from 401-600 weight is 38kg.

I hope this makes sense.

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

  • Posts: 83858
  • Thank you received: 13574
  • MODERATOR
9 years 8 months ago #214696

Hi,

Characteristics are displayed as radios or dropdowns on the product page. So the customer has to select among a set of defined values. It won't be practical to setup.
I suppose that what you're looking for is to create instead a custom field of the table "item" via the menu Display>Views so that the customer can enter the width value himself on the product page.
For the min-max width, you can use the "regular expression check" option of the custom item field.
Finally, with a custom hikashop shipping plugin to do the weight calculation instead of the standard one, that's not a problem to have the weight of the product depending on the value entered by the customer.

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

  • Posts: 7
  • Thank you received: 1
9 years 8 months ago #214714

Thanks for the reply,
so I create custom fields under Display->Custom Fields which will apply to a certain category. I will need to come up with the expression checks though. I mean, it will need to check against other product characteristics.
Is there any documentation on how to create these expressions?
Are there any examples on validation rules and writing expressions? This will help me as I have never done this before.
This is my first attempt at hikashop.
thanks

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

  • Posts: 83858
  • Thank you received: 13574
  • MODERATOR
9 years 8 months ago #214814

The regular expression check uses standard regex.
For example, to allow only a value between 300 and 600 you can write this regex:

/^([345][0-9][0-9]|600)$/
I you need something dynamic Then it's more complex and will require that you write your own hikashop plugin implementing the fields API : www.hikashop.com/support/support/documen...entation.html#fields
You can see an example of that with the advanced date picker type plugin in the folder plugins/hikashop/datepickerfield/ of your website.

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

  • Posts: 7
  • Thank you received: 1
9 years 7 months ago #215521

Thanks, this worked. Without the /
and I got an understanding of how these regex work.
Now I need to be able to get a price and weight value based on value entered in the custom field. So for example if the customer enters a value between 300-350 then the price will be "$300" and weight "28kg"
I created a new post in the forum for this.

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

  • Posts: 60
  • Thank you received: 0
9 years 4 months ago #227005

Hi,

I need validation code for telephone field, it just should get digits and not alphabetic character. (I want enter this in Regular expression check field)/


Thanks

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

  • Posts: 26240
  • Thank you received: 4036
  • MODERATOR
9 years 4 months ago #227008

Hi,

Please see the Nicolas' message for a sample of regex.

For more about regex
us3.php.net/manual/en/pcre.pattern.php
regex101.com/
regexr.com/

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.116 seconds
Powered by Kunena Forum