glenda Posted June 4, 2003 Posted June 4, 2003 Hello :!: Does anyone know how I can put "Sort By:" infront on the product listing headers like this: Sort By: Manufacturer P/N Product Name Price Stock Thank you! Mary
Ajeh Posted June 4, 2003 Posted June 4, 2003 One way to do it is to edit the /includes/modules/product_listing.php and change this section of code: // BOF: WebMakers.com Added: Add Sort by to title for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { if ($col==0) { $lc_text='Sort by: '; } else { $lc_text=''; } switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text .= TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text .= TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text .= TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text .= TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text .= TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text .= TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text .= TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text .= TABLE_HEADING_BUY_NOW; $lc_align = 'center" width="100'; break; } // EOF: WebMakers.com Added: Add Sort by to title
Guest Posted June 4, 2003 Posted June 4, 2003 Hi Glenda! Open the catalog/includes/modules/product_listing.php and find the following section. if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); You should be able to modify the line 'text' => ' ' . $lc_text . ' '); to: 'text' => 'Sort by:'. ' ' . $lc_text . ' '); I haven't tested this and it may add the "sort by" to each of the column titles...but it should get you started.
Ajeh Posted June 4, 2003 Posted June 4, 2003 That was my first try, Kim ... hits every title ... :shock:
Guest Posted June 4, 2003 Posted June 4, 2003 Well at least I was right that it would hit every title.... :D Your solution looks better.
Ajeh Posted June 4, 2003 Posted June 4, 2003 Had to think about it for a few ... make it happen once and not every loop. Then later ... go re-write it for all language files ... etc. etc. etc. At least the way I intend to use this, just define it as '' and it will work the standard way without the prompt.
glenda Posted June 4, 2003 Author Posted June 4, 2003 Linda I tried it your way and it works. I've only got 2 problems: 1. The "Sort By:" becomes part of the link to sort by the first column. 2. I changed Sort By: to this image and when using the image I get the P/N"> before it which is also part of the sorting link. This does not appear when using text only. The image below shows this. // BOF: WebMakers.com Added: Add Sort by to title for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { if ($col==0) { $lc_text='<img src="images/sort.gif" border="0"> '; } else { $lc_text=''; } switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text .= TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_APPLICATION': $lc_text = TABLE_HEADING_APPLICATION; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text .= TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text .= TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text .= TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text .= TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text .= TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text .= TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text .= TABLE_HEADING_BUY_NOW; $lc_align = 'center" width="100'; break; } // EOF: WebMakers.com Added: Add Sort by to title Any ideas? Thanks a bunch!!! Mary
Ajeh Posted June 4, 2003 Posted June 4, 2003 This will add either the image or text depending on which line you comment out. I have the define in this section. Put that in a language file. $list_box_contents = array(); define('PRODUCT_LISTING_SORT_BY_TEXT','Sort by'); // BOF: WebMakers.com Added: Add Sort by to title for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { if ($col==0) { // for text: // $lc_text=PRODUCT_LISTING_SORT_BY_TEXT . ' '; // for image: $lc_text= tep_image(DIR_WS_IMAGES . 'button_blank.gif'); } else { $lc_text=' '; } switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text .= TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text .= TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text .= TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text .= TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text .= TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text .= TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text .= TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text .= TABLE_HEADING_BUY_NOW; $lc_align = 'center" width="100'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => $lc_text . ' '); } // EOF: WebMakers.com Added: Add Sort by to title
Recommended Posts
Archived
This topic is now archived and is closed to further replies.