Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

horizontal line under each product


Guest

Recommended Posts

Hi

 

I am using oscommerce 2.3.1

 

I was just wondering how do I put a horizontal line in under each product in product listings

 

I have tried other ways people have said and has not worked

 

Thanks in advance

 

Ian

Link to comment
Share on other sites

Hi

 

Sorry for the late reply

 

Yeah I mean the <hr> and the </hr> code

 

I would like it after each product in the product listings pages

 

I tried the normal html way but didnt work

 

Regards

 

Ian

Link to comment
Share on other sites

What do you mean "normal way"? What did you do? BTW, "hr" is a self-closing tag (<hr> or, preferably, <hr />). There is no such thing as </hr>. Just stick a <hr /> anywhere you want a horizontal rule (it forces the end of a paragraph).

Link to comment
Share on other sites

Hi sorry thats what I meant, I put a <hr> tag in and it worked but it was in the wrong place

 

I will paste the code in from my product_listing_multi.php page

 

<?php    echo  tep_draw_form('cart_multi', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_multi'));?>
<script language=javascript> function changeValue(textObject,delta){  var myVal = parseInt(textObject.value);  if (myVal == NaN) {   myVal = 0;   } else {  myVal = myVal + delta;  }  /* check that it is not negetive */  if (myVal < 0) {  myVal = 0;  }  textObject.value = myVal;  return; } </script>
<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
?>

 <div class="contentText">
<?php
 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="0">
 <tr>
   <span id="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
 </tr>
</table>
<br>
   <div>
  <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span>
  <span><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></span>
   </div>
   <br />
<?php
 }
 $prod_list_contents = '<div class="ui-widget infoBoxContainer">' .
				    '  <div class="ui-widget-header ui-corner-top infoBoxHeading">' .
				    '    <table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListingHeader">' .
				    '	  <tr>';
 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   $lc_align = '';
   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_MIN_ORDER_QTY':
    $lc_align = 'center';
    $lc_text = ' ' . TABLE_HEADING_MIN_ORDER_QTY . ' ';
    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);
   }
   $prod_list_contents .= '	    <td' . (tep_not_null($lc_align) ? ' align="' . $lc_align . '"' : '') . '>' . $lc_text . '</td>';
 }
 $prod_list_contents .= '	  </tr>' .
					 '    </table>' .
					 '  </div>';
 if ($listing_split->number_of_rows > 0) {
   $rows = 0;
   $listing_query = tep_db_query($listing_split->sql_query);
   $prod_list_contents .= '  <div class="ui-widget-content ui-corner-bottom productListTable">' .
					   '    <table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListingData">';
while ($listing = tep_db_fetch_array($listing_query)) {
  $rows++;
  $prod_list_contents .= '	  <tr>';
  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
    switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_MODEL':
	    $prod_list_contents .= '	    <td>' . $listing['products_model'] . '</td>';
	    break;
	  case 'PRODUCT_LIST_NAME':
	    if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
		  $prod_list_contents .= '	    <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>';
	    } else {
		  $prod_list_contents .= '	    <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>';
	    }
	    break;
	  case 'PRODUCT_LIST_MANUFACTURER':
	    $prod_list_contents .= '	    <td><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a></td>';
	    break;
	  case 'PRODUCT_LIST_PRICE':
	    if (tep_not_null($listing['specials_new_products_price'])) {
		  $prod_list_contents .= '	    <td align="right"><del>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="right">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>';
	    }
	    break;
	  case 'PRODUCT_LIST_QUANTITY':
	    $prod_list_contents .= '	    <td align="right">' . $listing['products_quantity'] . '</td>';
	    break;		   
	  case 'PRODUCT_LIST_MIN_ORDER_QTY':
	    $prod_list_contents .= '	    <td align="right">' . $lc_text = ' ' . $listing['products_min_order_qty'] . ' ';
	    break;
	  case 'PRODUCT_LIST_WEIGHT':
	    $prod_list_contents .= '	    <td align="right">' . $listing['products_weight'] . '</td>';
	    break;
	  case 'PRODUCT_LIST_IMAGE':
	    if (isset($HTTP_GET_VARS['manufacturers_id'])  && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
		  $prod_list_contents .= '	    <td align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>';
	    }
	    break;
	  case 'PRODUCT_LIST_BUY_NOW':
 //		  $prod_list_contents .= '	    <td align="center">' . $lc_text = '<input type=button value="  -1" onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),-1);return  false;"><input type="text" name="add_id['.$number_of_products.']"  id="add_id_'.$listing['products_id'].'" value="0" size="3"><input  type=button value="+1" onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),1);return  false;">';
 //	    $lc_text .= '<input type="hidden"  name="products_id['.$number_of_products.']"  value="'.$listing['products_id'].'">';
	    $prod_list_contents .= '					    <td align="center"><input type=button value="  -1" onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),-1);return  false;"><input type="text" name="add_id['.$number_of_products.']"  id="add_id_'.$listing['products_id'].'" value="0" size="3"><input  type=button value="+1" onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),1);return  false;">';	
	    $prod_list_contents .= '					    <input type="hidden"  name="products_id[' . $number_of_products . ']"  value="' . $listing['products_id'] . '"></td>';		  

	 break; 

    }
  }
  $prod_list_contents .= '	  </tr>';
   }
   $prod_list_contents .= '    </table>' .
					   '  </div>' .
					   '</div>';
   echo $prod_list_contents;
 } else {
?>
   <p><?php echo TEXT_NO_PRODUCTS; ?></p>
<?php
 }
 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
   <br />
   <div>
  <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span>
  <span><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></span>
   </div>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td align="right" class="main"><?php echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></td>
 </tr>
</table>
</form>
<?php
 }
?>
 </div>

 

Where would I put the <hr> tag within that code to be shown under each product

Link to comment
Share on other sites

I'm not familiar with this code (is it from some add-on?), but if I had to guess where the end of a product is and put a horizontal rule there, I'd do it:

	  $prod_list_contents .= '		</tr>';
	  $prod_list_contents .= '<hr />';  // <================= here
}
$prod_list_contents .= '	</table>' .
											   '  </div>' .
											   '</div>';
echo $prod_list_contents;

Link to comment
Share on other sites

If that doesn't work "outside a row", try this:

	  $prod_list_contents .= '		</tr>';
	  $prod_list_contents .= '<tr><td><hr /></td></tr>';  // <================= here
}
$prod_list_contents .= '	</table>' .
											   '  </div>' .
											   '</div>';
echo $prod_list_contents;

It's a bit of a kludge to put a horizontal rule within a table, but it's worth a try.

Link to comment
Share on other sites

Hi Mr Phile

 

I tried both of your ways you mentioned and the first one didnt work and the seconday way just put a line under the product name and not all the way across

 

It is a add on, its the multi product add for 2.3

 

And multimixer I pasted the css styles in you mentioned above but didnt work, I might not have done it correctly

 

Thank you both for the help

 

Regards

 

Ian

Link to comment
Share on other sites

As MM suggested, CSS might be better, especially if you're on osC 2.3.1 (its layout is more CSS-controlled). You might want to apply the border to the entire row, rather than on a per-cell (<td>) basis:

.productListTable tr {border-top:1px solid #f00}  
.productListTable tr:first-child {border-top:none}

Now, as to why you're not seeing it, did you put these two lines at the end of the CSS file used on the page in question? Did you force a reload of the updated CSS file by pressing Ctrl-F5? Note that this border will be a thin solid red line... adjust thickness and color to suit.

Link to comment
Share on other sites

Hi Mr Phil

 

I added the two lines to the stylesheet

 

How do I call on the two lines for the horizontal line to appear

 

Would it be <div class="productListTable">

 

Regards

 

Ian

Link to comment
Share on other sites

Try changing the CSS entries from

.productListTable tr {border-top: 1px solid #f00} 
.productListTable tr:first-child {border-top: none}

to

div.productListTable table tr {border-top: 1px solid #f00} 
div.productListTable table:first-child tr {border-top: none}

All I can think of is that the old selector was not matching for some reason, possibly because tr was not a direct descendant of the div?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...