Product Variations

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 11 months ago #3288

I am trying to create the following product display:

  Product Name
  Product Description - Product Image

  Variant1a Tick Box (*)
  Variant1b Tick Box (*)
  Variant2a Tick Box (*)
  Variant2b Tick Box (*)
  Variant3a Tick Box (*)
  Variant3b Tick Box (*)

  Add to Cart (tick items)
(*) = maybe optional variant description / image.
My guess is that if I understand the characteristic drop-down and get it working then I can change the template to use tick boxes or whatever.

However, I have following problems.
(1) The product description / image does not display.
Except under some odd conditions where I have an invalid combination of drop-downs.
(2) At the category level it is displaying price and add to cart button - but the product has no price.


This is only a stepping stone to the display layout I have in mind for a product family:
  Product Name
  Product Description - Product Image

  Tab 1 | Tab 2 | Tab 3 | Tab 4 | Tab 5 | Tab 6 

Each tab will contain:
  Check box for Variant 1a - if necessary additional description, image.
  Check box for Variant 1b - if necessary additional description, image.
  Add to Basket
The product description may be complete in itself with no need for additional descriptions at the variant level.

Tabs implemented using CSS / JQuery in template.

You may not want to build this into core hikashop, and maybe its something left for template designers to setup for themselves.

How could the variants feature be used to implement this?
Is this the best way - product parameters might be another route.
I started creating a category and having the variants as different products in that category - that again shows promise as a possible route, but I have not completed it.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #3293

I see what you want to do. If I were you I would :
First, rewrite the whole show file of the product view to display the main product information ( in $this->element ) and each variant information ( a foreach on $this->element->variants ). Then, add standard joomla panes around the variants.
Then, around all this, add the form like on the current show with a standard input button for the add to cart button.
And for each variant's checkbox, use data[<?php echo $row->product_id;?>] as name of the input checkboxes so that the system will handle adding several variants at a time in the basket (like we do on the cart file).

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

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 11 months ago #3316

Added the following to product show.php to use the test template for a particular product.
I would guess could use a custom product field for the template name and not hard-code the ID.

<?php if(empty($this->element)){
	$app =& JFactory::getApplication();
	$app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'));
/* START CUSTOM */
}else if ($this->element->product_parent_id == 13){
  echo $this->loadTemplate('test');
/* END CUSTOM */
}else{

Last edit: 13 years 11 months ago by brainforge.

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

  • Posts: 30
  • Thank you received: 0
13 years 9 months ago #9158

Hi, I'm just jumping in because what i'm trying to do is quite similar but with 1 more level of "Variant". for example selling clothing, i'm wanting the design to be the main product and have t-shirt, cap, jacket to be a the first level of variant and then the sizes to be a variant of that first variant.
not sure if it makes sens.
like this:
www.threadless.com/product/2740/Cooling_Off/

I have just discovered HikaShop and It seams that there is only one level possibility for the variants. so I was thinking using categories like this:

Category Name (the design would be a category)
Image Gallery with thumbnails of each products within the category
Products Names

  Tab 1 | Tab 2 | Tab 3 | Tab 4 | Tab 5 | Tab 6    (tabs being the products names)

Each tab will contain: 
Product Name 
  Product Description - Product Image 
  Check box for Variant 1a
  Check box for Variant 1b
  Add to Basket 

how would you advise I go about this?
thanks.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #9161

The easiest would be to use normal products and just define a custom function to handle the output of the characteristics with tabs for the first characteristic and radio for the other ones which will be in the tabs.

We will add the code below on our end in the file administrator/components/com_hikashop/types/characteristic.php :
$app =& JFactory::getApplication();
$chromePath = JPATH_THEMES.DS.$app->getTemplate().DS.'html'.DS.'hikashop_characteristics.php';
if (file_exists($chromePath)){
require_once ($chromePath);
if(function_exists('hikashop_characteristics_html')){
$html = hikashop_characteristics_html($element,$params);
}
}
if(empty($html)){


before:
switch($params->get('characteristic_display')){

and add a bracket at the end of the switch.

You should make the same modification and then create the file templates/YOUR_TEMPLATE/html/hikashop_characteristics.php where you can define the function hikashop_characteristics_html(&$element,&$params) which will return the html of the tabs. You can use the other cases in the function displayFE as examples of how to parse the characteristic data in order to build your HTML.

Last edit: 13 years 9 months ago by nicolas. Reason: corrected code

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

  • Posts: 30
  • Thank you received: 0
13 years 9 months ago #9169

thank you for the quick reply.
I just realized that I didn't understand how characteristics and variations worked.
thank you for your input I will try what you suggested. the more I look at this component the more amazing i find it!
ultimately I want to use JQuery UI for the tabs and radio buttons. specifically using: tushev.org/products/jqueryintegrator
Where would I put the Jquery code?

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

  • Posts: 30
  • Thank you received: 0
13 years 9 months ago #9170

thank you for the quick reply.
I just realized that I didn't understand how characteristics and variations worked.
thank you for your input I will try what you suggested. the more I look at this component the more amazing i find it!
ultimately I want to use JQuery UI for the tabs and radio buttons. specifically using: tushev.org/products/jqueryintegrator
Where would I put the Jquery code?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #9171

I'm not familiar with this extension but you should put your code in the function hikashop_characteristics_html since that's where you want to use it.

PS: I've updated the override code with a working version.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum