Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Custom Look to Product Listings


Guest

Recommended Posts

Hi,

I'm wondering if anyone can be of assistance.

I have my store all set up and ready to go. But the client wanted to add a short description to the product listing page.

So I used the Products_Short_Descriptions_V1 contribution and got it installed without a hitch.

Problem is, the product listing isn't too pretty.

I was hoping to make it look similar to the product listings on this page http://www.medicorp.net/products.asp?cat=10.

 

Is this possible and if so, what files do I need to start looking into for editing...I tried the product_listing.php as well as index.php, but can't seem to find what I'm looking for.

 

Here's a current view of what it looks like now.

 

screen.jpg

 

Thanks for your help,

DigitalOldschool

Link to comment
Share on other sites

Yes possible. product_listing.php is the right file.

 

Thanks for your reply. Any hints as to what I need to edit?

Link to comment
Share on other sites

We can't use standard way as it is column based.

The following just idea to try:

 

in product_listing.php, comment line 68, 69, 70 and 137, 138, 139

 

and add the following after line 139

 

$lc_text = 'Product Name<br>Products Description';

$list_box_contents[$cur_row] = array('params' => 'class="productListing-data"', 'text' => $lc_text);

Sugiartha

------------------------------------------

concept of life: enjoy aja!

Link to comment
Share on other sites

The code below will replace your product_listing.php code and give you a box with the picture to the left, Description on right, with prices below.

Tables can be edited to look like you want and the code

	if ($col > 1) {

can be adjusted (change 1 to 2,3, 4, etc) to give boxes per row.

Here is the code:

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $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
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 echo '<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td>';

 $listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {

 $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$listing['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 100);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';
 if (tep_not_null($listing['specials_new_products_price'])) {
		  $lc_text = '<br><strong>Regular Price: </strong><s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s><br><strong>Sale Price:        </strong><span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
		} else {
		  $lc_text = '<br><br><strong>Our Price: ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])). '</strong>';
		}

 $info_box_contents[$row][$col] = array('text' => 
'<!-- one TBL Product -->
	<table width="100%" class="infoBox" cellspacing="0" cellpadding="4" >
	  <tr>
		<td class="infoBoxHeadingNew" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>
		</td>
	  </tr>
	  <tr>
	   	<td class="infoBoxContents">
			<table width="100%"  border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td align="center" style="padding:3px;">
				<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>
				</td>
				<td class="productListing-data">'. strip_tags($description['products_description']) .'<br>'.
				 '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $listing["products_id"]). '">' . DESCR_READ_MORE . '</a>
				<br><font size="2px"' . $lc_text . 
				'</font></td>
			</tr>
			</table>
			  <table>
				<tr>
				 <td width="80%">'.tep_draw_separator().'</td>
				 <td height="35"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><img src="includes/languages/english/images/buttons/button_buy_now.gif" alt="'.$listing['products_name'].'"  border="0" align="middle"></a>
				 </td>
			   </tr>
			 </table>
		</td>
	  </tr>
	</table>
	<!-- one TBL Product -->');



$col ++;
if ($col > 1) {
  $col = 0;
  $row ++;
}}
  new contentBox($info_box_contents);
 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (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 } ?>

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...