Variant and options

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353023

-- HikaShop version -- : 4.7.2
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4.33
-- Browser(s) name and version -- : Firefox 114.0.2

I have tried a number of ways to set this up, but all have their drawbacks. I wondered if I am missing an option. The products are courses which can be accredited or unaccredited. The booker can book for different group sizes and can add on additional items per candidate which is impacted by group size.

Route 1
I used Options, with each option asking how many people attending. Each option adds to the price based on numbers. This is a bit confusing to the user as they have to keep setting how many are attending and they could set different numbers. Also, I cannot change information about the product for regulated and not regulated.
Places - 1, 2, 3, 4, 5, 6, ..., 12
Regulated Qualification - No, 1 certificate, 2 certificates, 3 certificates..... 12 certificates
Book - None, 1, 2, 3, 4, 5, 6, .... 12

Route 2
I used variants for Regulated Qualification and Places. Then used Option for the Book. This method allows setting different information for Regulated and Not Regulated, however, a 12-place course, leads to 24 variants. 12 variants have the same information other than price, this becomes a lot of work to edit. It gives the user the right interface and from - to price on the listing, but I have a lot of variants to create with the same information and there are a lot of custom fields on the products. The custom fields delay the load, so changing prices in the future would be slow while you wait for the load delay.
Variant - Regulated Qualification - Yes, No
Variant - Places - 1, 2, 3, 4,... 12
Option - Book - None, 1, 2, 3, 4, ... 12

Route 3
Create the Regulated Qualification as a variant, but set the Places and Books as an Option. The problem with this method is Places price is wrong as depends on whether it is regulated or not. e.g. a regulated place is £15 while a none regulated place is £5

Route 4
I noticed plugins for calculating prices based on custom fields, but I do not believe this can be done with options. Ideally, there would be options that multiply together. However, this route would not give the variant of regulated or not.
Places: 1, 2, 3, 4 ... 12
Regulated Qualification: Yes, No
Book: Yes, No
If you set the Book to yes with a price, the price would get multiplied by places.

I hope this makes sense. Have I missed a route for configuring this?

Thank you for any advice.

David

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

  • Posts: 83017
  • Thank you received: 13400
  • MODERATOR
1 year 5 months ago #353028

Hi,

While I roughly understand what you did, I'm afraid I don't understand enough of your situation to be able to recommend what would be best.

First, the URL you provided is the URL of a listing of products. I checked one of the products ( i.imgur.com/995KkF6.png ), but there is no book and no regulated qualification. So I don't see all the implications.
Second, I don't have the big picture of what is supposed to change the price, and what isn't, etc. Could you please expand with some user cases of someone purchasing a course from you and what you would want to happen to the calculation in different cases.
For example (I give a random example here, the prices and equation are not what they should be ):
User purchases a course with 5 places, regulated and book. The total price of the product needs to be ((5 places * {base price}) + book price + regulated) * {quantity ordered} so for a base price of £50, a book price of 10 and a regulated option costing 50 and a quantity of 2, that's ((5*50)+10+50)*2 = 620

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

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353062

I have republished the course I was trialing things on.

This message contains confidential information

The current courses display as either accredited or unaccredited, there is no option to choose, but then that causes confusion as there are two products of almost the same name. I think the variant would be a better option. I will update the current products once I have the best solution.

I used books in the previous example, as I thought this would be more understandable. I have now used key rings as per the example in the link.

Example 1
Course base price £300
Number of people attending 10
Regulated qualification yes
Certificate and resource price p/p £15
Keyrings required Yes £1.50
£300 + (10 * 15) + (10 * 1.50) = £465

Example 2
Course base price £300
Number of people attending 10
Regulated qualification no
Certificate and resource price p/p £5
Keyrings required No £1.50
£300 + (10 * 5) + (0 * 1.50) = £350

Alternative way
Example 1
Course base price £300
Number of people attending 10
Regulated qualification yes £10
Resource price p/p £5
Keyrings required Yes £1.50
£300 + (10 * 10) + (10 * 5) + (10 * 1.50) = £465

Example 2
Course base price £300
Number of people attending 10
Regulated qualification No £0
Resource price p/p £5
Keyrings required No £1.50
£300 + (10 * 5) + (10 * 0) + (0 * 1.50) = £350

Please note the regulated qualification price we are charged can vary per course.

When the user chooses regulated qualification or not, this should change some of the information displayed.

I hope this makes sense

Last edit: 1 year 5 months ago by dhusband.

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

  • Posts: 83017
  • Thank you received: 13400
  • MODERATOR
1 year 5 months ago #353065

Hi,

I think the best will be to only have custom fields of the table "item" and use the calculations plugin to add formulas to calculate the price based on the select values in the custom fields.

For example:
- The base price of the course could be entered as the price of the product. It can then be used with the tag {price} in the formula.
- The regulated qualification option can be a custom item field with two values 0 and 10 (you enter the price to be used as values and the text you want to be displayed in the dropdown of the custom field as title of each one). If the £10 price can vary for different products, then you would have to create different custom item fields and different formulas, one per field.
- The resource price seems to be fixed value. If it's always £5 then you can directly use the value 5 in the formula. Otherwise, if the resource price can be different for different products, you can create a custom field of the table "product" so that you can enter the price to use in each product.
- The keyring can be a custom item field with two values 0 for no, and 1.5 for yes.
- For the number of people attending, you could potentially use the quantity input field. In that case you can use the tag {quantity} in the formula. This can be interesting if you're planning on having different minimum and maximums for different products since you can use the quantity per order settings for that. Otherwise, hiding the quantity input field, and creating instead a custom field of the table "item" to select the number of people might be better.

Then, in the formula(s), you could write something like that:
{price}+{quantity}*({xxx}+{yyy}+{zzz})
where xxx would be the column name of the regulated qualification custom item field, yyy the column name of the resource price, and zzz the column name of the keyring custom field.

One thing I left out is the last sentence of your message:

When the user chooses regulated qualification or not, this should change some of the information displayed.

There are two ways to go about it:
- you could put that information in spans with specific classes, and then with a bit of javascript, you could plug yourself on the custom item field to display/hide the spans accordingly. It's just a few lines of code, so nothing difficult. stackoverflow.com/questions/58204885/use...change-display-style
www.hikashop.com/forum/install-update/90...r-custom-fields.html
- you could have the regulation qualification as a characteristic with two variants in your product so that you could have a different description for each variant and HikaShop would automatically swap between them for you based on what the customer selects in the characteristic selector. In that case, you could simply have a custom product field to enter the value of the regulated qualification (0 for the non regulated variant, and 10 for the regulated one) and then use the column of that custom field in the xxx tag of my example formula above. I think that's quite simple like this and doesn't require any code.

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

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353181

Sorry, strangely I didn't get notified about the update.

I will try out these ideas.

Thank you for your insight.
David

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

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353270

Evening
I have tried out implementing this with the calculation plugin, however, I hit a problem with the calculation plugin.

I have set it up as a test on one product, the page is listed below.
I have a variant accredited or unaccredited. I have set a custom product field with 'additional price' and a custom item field with 'places'.

This message contains confidential information


If I set the custom 'Places' field as a Text field, the calculation works on the Product page, Cart and Check Out.
If I set the custom 'Places' field as a Single Drop down, the calculation does not work on the Product page. It does work in the Cart and the Check Out.

The calculation plugin does not seem to work on the backend order screen. So if I change any details in the order or take a phone order the price does not update.

Kind regards
David

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

  • Posts: 83017
  • Thank you received: 13400
  • MODERATOR
1 year 5 months ago #353281

Hi,

If I set the custom 'Places' field as a Text field, the calculation works on the Product page, Cart and Check Out.
If I set the custom 'Places' field as a Single Drop down, the calculation does not work on the Product page. It does work in the Cart and the Check Out.

It comes from the chozen library on your page. It transforms the display of the dropdowns to create "fake dropdowns" while hiding the real dropdown. Turn off the "use chozen library" setting in the HikaShop configuration page if it's turned on and it should help.

The calculation plugin does not seem to work on the backend order screen. So if I change any details in the order or take a phone order the price does not update.

Indeed, the plugin is only for the frontend. It doesn't support order modifications in the backend. I must say we didn't thought about this. You're actually the first one to provide feedback on this point.

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

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353291

Morning

Changing the setting has currently got it working on my phone.

Would it be difficult to also get it working in the backend?

Thank you
David

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

  • Posts: 83017
  • Thank you received: 13400
  • MODERATOR
1 year 5 months ago #353293

Hi,

Well, it's not "difficult", but it does require 2 or 3 hours of work.

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

  • Posts: 52
  • Thank you received: 6
  • Hikashop Business
1 year 5 months ago #353348

I have finished testing this as a suitable way forward and have started moving my products to the new layout.

Could this be added to your development flow so it works in the backend as well?

Thank you
David

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

  • Posts: 83017
  • Thank you received: 13400
  • MODERATOR
1 year 5 months ago #353361

Hi,

Yes, I've added this on our TODO list.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum