Variable Product Options With Different Prices

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 2 weeks ago #358009

-- HikaShop version -- : 5.0.2

Hi there,

I'm trying to add the option where customers can choose a bracelet and a charm.

1) I would like when they select a bracelet they see the price of that bracelet (the price varies), and when they click on a charm they see the price of that charm (the price varies). Then the bracelet and the charm price will be displayed for them.

2) Also, I would like to be able to add a photo of all the bracelets and all the charms so the customer see what they are choosing.

I'm trying to do this but with no luck so far.

Thanks!

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 month 2 weeks ago #358010

Hi,

So, from what I understand, you want that on one page, the customer can select among the different colors of the
Faux Leather Snap Button Charm Bracelet product you have at /categories/product/snap-button-charm-bracelet.html AND select among the different countries of the Country Snap Button Charms you have at categories/product/country-snap-button-charms.html

I can see that at categories/product/custom-snap-button-bracelet-with-snap-button-charm.html your product has two characteristics, one for the color selection, and one for the country selection.

What I would recommend is that instead of using characteristics, you add both Faux Leather Snap Button Charm Bracelet and Country Snap Button Charms products in the "options" setting of your Custom Snap Button Bracelet with Snap Button Charm product.
That way, the customer will see the prices of the options, and he can select between them and the price will update based on what is selected.
And you can add an image with all the bracelets and one with the different country snap buttons to that product so that the customer can visualize what they are.
How does that sounds ?

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 2 weeks ago #358034

I had no idea that this option was available. It's much better so far for what I am trying to do - thank you.

1) How do I remove the plus (+) that is in front of the price
2) Why is the Add to Cart button not showing?
3) Also, is there a way to add "Select an Option" as the default

Thanks!

Last edit: 1 month 2 weeks ago by MyWorld.

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 month 2 weeks ago #358035

Hi,

1. You need to edit the file product / option via the menu Display>Views and in the code:

				foreach($variant->prices as $k => $price) {
					$js_product_data[(int)$variant->product_id][(int)$price->price_min_quantity] = (float)str_replace(',','.',$price->$price_name);
					$js_product_prices[(int)$variant->product_id][(int)$price->price_min_quantity] = ($price->$price_name>0?'+ ':'').$this->currencyHelper->format($price->$price_name, $price->price_currency_id);
					if($unit_price)
						continue;
					if($price->price_min_quantity <= 1)
						$unit_price = true;
					if($price->price_value < 0) $positive=false;
					if(!$unit_price && (!$ok || ($positive && $price->price_value > $ok->price_value) || (!$positive && $price->price_value < $ok->price_value)))
						continue;
					$ok = $price;
				}

				$price = $ok->$price_name;
				$text .= ' ( '.($positive?'+ ':'').$this->currencyHelper->format($price, $ok->price_currency_id).' )';

				$js_product_data[(int)$variant->product_id][-1] = (float)str_replace(',','.',$price);
				$js_product_prices[(int)$variant->product_id][-1] = ($price>0?'+ ':'').$this->currencyHelper->format($price, $ok->price_currency_id);
remove the + sign at the 3 places in there.

2. You must have a base price of 0 for the main product, and you must have turned off the "display add to cart button for free products" setting of the HikaShop configuration. I would recommend to add a price of 0.0001 in the main product if you need to keep the "display add to cart button for free products" setting turned off for some other situation on your website.

3. Yes. You can do as explained here:
www.hikashop.com/support/forum/product-c...t-picked.html#344346

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 4 days ago #358292

Hi nicolas,

Regarding #3:

Some merchants want to be able to not have a "no" to force the options with variants to be mandatory.

If you want the system to automatically add a "No" choice for all the options with variants, you can go in your PHPMyAdmin and open the hikashop_config table. There, add an entry with the namekey add_no_to_options and the value 1
And if you want the "No" to be selected instead of the default variant, you can add an entry with the namekey select_option_default_value and the value 0 at the same place.


I'm a little scared to try this in case I mess things up - but I'm gonna try.

1) I'm assuming this change to the table will not be overwritten when there is an update?

2) Will all my products have/use this default or just options with variants?

3) Can you tell me if where I've indicated on the attached photo is where I should add the info you indicated?

4) Also, it appears that the rows are repeated. Do I put the content only in the first section?

Thanks!

Attachments:

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 month 3 days ago #358294

Hi,

1. That's correct.

2. Just options with variants.

3. Yes, that's correct. Just make sure you don't have extra spaces before or after the texts.

4. This allows you to add several entries at once. So you can do like on your screenshot to add both at the same time.

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 3 days ago #358319

Hi Nicolas,

What do I do next?
Where do I put the "Select an Option" text?
How do I get it to display in the dropdown?

Thanks!

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 month 2 days ago #358322

Hi,

If you added an entry with the namekey add_no_to_options and the value 1, as explained in the other thread, then there is nothing else to do. The extra option will appear automatically in the option dropdowns.

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 2 days ago #358334

I reentered the entry and I see it now.

1) How can I change it to "Select an Option" instead of "No", it not very intuitive when it just says "No".

2) Also, I did the below but I am still able to add the item to cart for $0. I set the price in the main product to 0.0001 and Display 'add to cart' Button for Free Products = "No". I don't want the "Add to Cart" button to show until they make a selection. What did I miss?

You must have a base price of 0 for the main product, and you must have turned off the "display add to cart button for free products" setting of the HikaShop configuration. I would recommend to add a price of 0.0001 in the main product if you need to keep the "display add to cart button for free products" setting turned off for some other situation on your website.


3) I would love to be able to do something similar for products that uses Variants? If possible, can you please explain the steps?

Thanks!

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 month 2 days ago #358352

Hi,

1. Edit the file product / option via the menu Display>Views and change the line:

$option_values[] = JHTML::_('select.option', 0,JText::_('HIKASHOP_NO'));
There, you can replace HIKASHOP_NO by whatever text you want.

2.

I don't want the "Add to Cart" button to show until they make a selection

There is no option for that.
What I was talking about, in the text you quoted, is how to have the add to cart button on the page if the price of the main product is 0.

3. If you set the option "Characteristics dynamic display" to "always" in the Hikashop configuration it should automatically work like you want.

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 month 1 day ago #358394

Thank you!!

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

  • Posts: 952
  • Thank you received: 11
  • Hikashop Business
1 week 1 day ago #359019

Hi Nicolas,

Is there a way for a product that have options with variants to add the variant image to the cart instead of the main image?

Thanks!

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

  • Posts: 81090
  • Thank you received: 12976
  • MODERATOR
1 week 20 hours ago #359024

Hi,

If you turn off the "group options with product" setting, then the options of the product will be added as separate products in the cart. In that case, the image of the variant selected in each option will be displayed for them in the cart, but the main product will still have its main image displayed regardless. Also, this means that you loose the information of which option is for which product in the cart.

To get exactly what you would would require customization of each view displaying the image of the product (for the cart module, the cart view in the checkout, the order details on the frontend, the invoice, each email, etc) and the code changes for this are non trivial as the data is not loaded for the images of options by default as they are not needed usually. So it would first require going through the options of each product, running a MySQL query to load the image data, generating the thumbnail, and then replacing the main product image with the one from the option you want to target.
It's not impossible, but it requires a skilled PHP developer to work on this.

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

Time to create page: 0.079 seconds
Powered by Kunena Forum