Product Variants and Radio Buttons annoying issue

  • Posts: 3
  • Thank you received: 0
10 years 4 months ago #200424

-- url of the page with the problem -- : hammocks.ie/index.php/hammocks/product/4...s-setting-and-sleeve
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.33

My client wants to keep radio buttons as the way to select a product, he also wants to have the default option - called "Select from below" to display general product pictures. This causes problems because if the quantity for this variant is set to zero then the product is listed as out of stock. If I change the quantity to unlimited then customers buy the product but then have to be emailed asking which color they want.

Is there a way to keep the radio buttons, keep the first option as select from below, and have it so that users cannot add this option to cart - without it saying that the product is out of stock?

Last edit: 10 years 4 months ago by Sod1991.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 4 months ago #200428

Hi,

There is no option for that, so what you want to do is to edit your product page layout ( show_default normally, but in your case it's show_tabular) via the menu Display>Views and remove the lines:

$this->setLayout('quantity');
			echo $this->loadTemplate();
That will remove the add to cart and "no stock" message for the default variant of the products.
Note that this supposes that all the products are like that. If you have other products without variants, or without a default variant that you don't want to be purchasable, you want to add a condition on that piece of code instead of removing the code, so that you remove the display of that area only when necessary.

The following user(s) said Thank You: Sod1991

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

  • Posts: 3
  • Thank you received: 0
10 years 4 months ago #200484

Thanks for the quick reply,

There are some products that don't have variants, and some default variants need to be purchasable, what should the modified line look like?

-Sean.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 4 months ago #200493

Then you would have to create a custom product field via the menu Display>Custom fields to select in each product edition page if the area should be displayed or not by default.
For example, suppose that you call that field "not_display_area" with two values "yes" and "no", the code would then look like this:

if(!empty($this->element->main)) $this->element->not_display_area = $this->element->main->not_display_area;
if($this->element->not_display_area !='yes'){
$this->setLayout('quantity');
echo $this->loadTemplate();
}

The following user(s) said Thank You: Sod1991

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

  • Posts: 3
  • Thank you received: 0
10 years 4 months ago #200732

Perfect thank you.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum