The Main Category - sub heading sort - is it possible? thread discusses this.
We got it working for the category/subcategory page, but I think the code as first given will work for the product listing page.
Try it and let me know.
The Main Category - sub heading sort - is it possible? thread discusses this.
We got it working for the category/subcategory page, but I think the code as first given will work for the product listing page.
Try it and let me know.
Hi Glenn,
I tried it, but it didn't work. Nothing changed on my site. Any ideas?
Here is my code:
// Following code will be executed only if Column Layout (Grid Layout) option is chosen
if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
$section_check = $listing->fields['products_name'];
$section_header = '';
if (in_array($section_check,explode(",",'Bracelets,Earrings,Necklaces'))) {
$column = -1;
$rows ++;
switch ($section_check) {
case "First Name":
$section_header = 'First Section';
break;
case "Second Name":
$section_header = 'Second Section';
break;
case "Third Name":
$section_header = 'Third Section';
break;
} //switch
$section_header = '<div class="sectionHeader">' . $section_header . '</div>';
} //if
$lc_text = $section_header . implode('<br />', $product_contents);
$list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => $lc_text);
$column ++;
if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
$column = 0;
$rows ++;
}
}
// End of Code fragment for Column Layout (Grid Layout) option in add on module
The cases given are generic:
case "First Name":
You need to customize them to match your installation:
case "Bracelets":
Thanks Glenn.
I changed the Case names. Still not working... Below is my updated code:
// Following code will be executed only if Column Layout (Grid Layout) option is chosen
if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
$section_check = $listing->fields['products_name'];
$section_header = '';
if (in_array($section_check,explode(",",'Bracelets,Earrings,Necklaces'))) {
$column = -1;
$rows ++;
switch ($section_check) {
case "Bracelets":
$section_header = 'First Section';
break;
case "Earrings":
$section_header = 'Second Section';
break;
case "Necklaces":
$section_header = 'Third Section';
break;
} //switch
$section_header = '<div class="sectionHeader">' . $section_header . '</div>';
} //if
$lc_text = $section_header . implode('<br />', $product_contents);
$list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => $lc_text);
$column ++;
if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
$column = 0;
$rows ++;
}
}
// End of Code fragment for Column Layout (Grid Layout) option in add on module
First, you need to use the product names in the explode, not the section names.
As your product names are long and may include commas, they will be cumbersome if not fatal to use. It will be better to use product ids, which are short and unique.
PHP Code:// Following code will be executed only if Column Layout (Grid Layout) option is chosen
if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
$section_check = $listing->fields['products_id']; // subheadings - gjh42 20080913
$section_header = '';
if (in_array($section_check,explode(",",'list_ids_to_start_new_lines_here,separated_by_commas,and_no_spaces'))) {
$column != 0?$rows ++:'';
$column = -1;
switch ($section_check) {
case "first id":
$section_header = 'First Section';
break;
case "second id": //repeat case/$section/break for other ids to start headings
$section_header = 'Second Section';
break;
} //switch
$section_header = '<div class="sectionHeader">' . $section_header . '</div>';
} //if
$lc_text = $section_header . implode('<br />', $product_contents); // /subheadings
$list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => $lc_text);
$column ++;
if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
$column = 0;
$rows ++;
}
}
// End of Code fragment for Column Layout (Grid Layout) option in add on module
Glenn,
I'm not sure I totally understand. Do I need to list out every single product ID? This site will have over 300 products. Each "gemstone" page would have a different set of product ids, will this script work for that?
Sorry, if these are dumb questions, but I'm new to all of this.
Thanks,
Cindy