Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

product listing problem


OUtlANDeR

Recommended Posts

It looks like you used one of the 'product listing in columns' contributions.

 

I'm pretty sure your results are normal. I think you lose the sorting capability by putting them in columns. Then at that point, there's not much use for the header with the sort titles. I don't see much problem with what you've got, maybe just try to push the 'lets see what we have here' down a bit as it is up very close to the header now.

 

I'm not sure what to say, I struggled with that file quite a bit this week myself.

 

Maybe try a different column contribution.

 

Or compare your old catalog/includes/modules/product_listing.php to the new one? The border comes from the stylesheet, but if the class (.productListing) isn't being called for, then you still won't have a border :(

 

product_listing.php is not a fun file to look at / edit.

 

Not a lot of answers, sorry.

Link to comment
Share on other sites

Thanks for the reply.

Ive also tried the contribution "product_listing_columns_2_2"

And it had the sorting at the top, except it was in weird text like SORT_PRICE_UP, and there were two drop down menus. The sorting seemed to work. I just didnt like how it was in some drop down menus. So i guess it is possible?

Link to comment
Share on other sites

Get an original copy of the product_listing.php file and do a comparison (e.g. Beyond Compare) between it and your file.

 

In the future, you should always make a copy of any file you edit just for cases such as this.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

I did make a copy. The thing is the code is varsly different, and since i dont know the code that way, i cant really tell which EXACTLY is the sorting. Thus is why im asking if anyone does know the code, so i can add it to the changed columns. Becuase i like how there in a 3 column setting, i just would like the header back

Link to comment
Share on other sites

Look for a group of code that with each value check sets the "order by" clause and that will be the sorting code.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Yeah i can see chunks of code, however there in different places, and im not sure exactly where to start and stop. Ontop of that, i really have no idea where to pop the code in the new php, since the lines look nothing similar/similar places.

Link to comment
Share on other sites

Well I'm not much of an authority on this stuff, but I stared at this for a few hours this week.

 

From what I see, this is where it decides how to split the page results for mutiple pages.

 

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 

And this is where it makes the title (sort) headings, based on the columns you've chosen to diplay in the admin settings

 

$list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
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';
	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 . ' ');
 }

 

And this is where it assigns odd/even style classes to the rows it made

if ($listing_split->number_of_rows > 0) {
$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
  $rows++;

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';

 

And the rest of it is where it builds the actual rows based on all of the other info above...not pasted here as that's where it becomes totally different that what you've got.

 

That's all I can muster with my remedial level php education :'(

 

Yeah i can see chunks of code, however there in different places, and im not sure exactly where to start and stop. Ontop of that, i really have no idea where to pop the code in the new php, since the lines look nothing similar/similar places.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...