Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Listing Products in different style


lsutigers

Recommended Posts

Well I tried to change the way of products layed out. I changed the style of new products listed. I wanted to do the same thing on each product catagory but i could not find where to make changes.

 

Take a look at these screen shots.

 

This is the new products listing looks like

 

box_1.jpg

 

and now look at this one. This is how each catagory looks like

 

box_2.gif

 

I want list each of these products in a box same as i did in new products pages.

 

Please let me know where i can find the table information for the product listing for index.php

 

Thank You

Link to comment
Share on other sites

includes/boxes/categories.php

 

Vger

 

 

 

First of all thank you Vger for your reply but catagories.php only lists the name of the each catagory under catagories menu. Its a menu function with sub trees. This is not what I am looking for. There has to be someting that will let me do the changes in the product listing rows. Adding the items into the box i created. It was so easy to create someting like this for new products page (products_new.php). But i could not find the location i need to make changes for items listed under each catagories

 

Please correct me if i am wrong.

Link to comment
Share on other sites

First of all thank you Vger for your reply but catagories.php only lists the name of the each catagory under catagories menu.  Its a menu function with sub trees. This is not what I am looking for. There has to be someting that will let me do the changes in the product listing rows. Adding the items into the box i created. It was so easy to create someting like this for new products page (products_new.php). But i could not find the location i need to make changes for items listed under each catagories

 

Please correct me if i am wrong.

 

 

includes/product_listing.php

 

or

 

includes/product_listing_col.php

Link to comment
Share on other sites

Well, the problem here is that every product that appears in the centre of the homepage either comes under New Products or Categories and Sub-Categories - but either way they are contained within a pre-defined infoBox. This is called in from both includes/boxes/categories and defined in includes/classes/boxes.

 

It is possible to edit includes/classes/boxes to add alternate layouts, and then to call the new classes in includes/boxes/categories etc. You will also need to make some additions to stylesheet.css.

 

Vger

Link to comment
Share on other sites

includes/modules/product_listing.php?

 

Vger

 

changes in product_listing.php did not help too but i could changed the number of items to be listed by making some changes in this file.

 

I will try classes/boxes.php to see if this is the one i am looking for.

 

 

I hope changes i will make in boxes.php is the solution i need.

 

Thanks a lot guys.

Link to comment
Share on other sites

  • 1 month later...

Guys, I got several email asking if i have done what i wanted to do. Yes I did.

 

 

These are the changes i made in product_listing.php so as to get the each item to be placed in a box with different style.

  <?php

 $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="620" cellspacing="0" cellpadding="0">
 <tr>
   <td width="620" valign="top">
<?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
 }

 $list_box_contents = array();

 if ($listing_split->number_of_rows > 0) {
   $listing_query = tep_db_query($listing_split->sql_query);

   $row = 0;
   $column = 0;
   while ($listing = tep_db_fetch_array($listing_query)) {

     $product_contents = array();

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

       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = '';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
           }
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = '  ';
           break;
         case 'PRODUCT_LIST_PRICE':
           $lc_align = 'right';
           if (tep_not_null($listing['specials_new_products_price'])) {
            $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], 
    tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">'
    . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . 
    '</span> ';            } else {
             $lc_text = ' ';
           }
           break;
         case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_quantity'] . ' ';
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<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>';
           } else {
             $lc_text = ' <table border="0" cellpadding="0" align="center"cellspacing="0" width="150"><tr>
<td background="images/pbox_top.jpg" width="150" height="26" border="0" alt="">  '.'<small><font color="#f1f1f8">'. $listing['products_name']. '</b></small></font></td></tr></table> 
<table border="0" cellpadding="0" align="center"cellspacing="0" width="150">

 <tr>
  <td background="/images/pbox_left.jpg" width="6" height="100%" border="0" alt=""></td>
  <td background="/images/pbox_center.jpg" width="135" height="100%" border="0" alt=""><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> <br><font color="#ff6600"><b>' . $listing['manufacturers_name']. '</b></font>';
           }
           break;
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           $lc_text = '<td background="/images/pbox_right.jpg" width="8" height="100%" border="0" alt=""></td>
</tr></table>
 <table border="0" cellpadding="0" align="center"cellspacing="0" width="150">
<tr><td background="/images/mini_box_junk.gif" width="8" height="24" border="0" alt="">
  <td background="/images/mini_box_price2.jpg" width="55" height="24" border="0" alt="">'. '  <font color="#333333">' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td><td height="23">
'.'<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . '<img src="/images/pbox_buy.jpg" width="87" height="23" border="0"></a>
</td>
  
 </tr>
</table>'. '</a> ';
           break;
       }
       $product_contents[] = $lc_text;

     }
     $lc_text = implode('<br><b><font color="#ff6600">', $product_contents );
     $list_box_contents[$row][$column] = array('align' => 'center',
                                               'params' => 'class="productListing-data"',
                                               'text'  => $lc_text);
     $column ++;
     if ($column >= 4) {
       $row ++;
       $column = 0;
     }
   }

   new productListingBox($list_box_contents);
 } else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                  'text' => TEXT_NO_PRODUCTS);

   new productListingBox($list_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
 }
?>

Link to comment
Share on other sites

  • 3 months later...

This is what i use for new_products.php

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php


 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => '',
									   'text' => '<table border="0" cellpadding="0" cellspacing="0" width="192">
 <tr>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="31" height="1" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="130" height="1" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="31" height="1" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="1" height="1" border="0" alt=""></td>
 </tr>

 <tr>
  <td><img name="blocks_r1_c1" src="themes/DeepBlue/images/block/blocks_r1_c1.jpg" width="31" height="56" border="0" alt=""></td>
  <td background="themes/DeepBlue/images/block/blocks_r1_c2.jpg"><center><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></center></td>
  <td><img name="blocks_r1_c3" src="themes/DeepBlue/images/block/blocks_r1_c3.jpg" width="31" height="56" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="1" height="56" border="0" alt=""></td>
 </tr>
 <tr>
  <td><img name="blocks_r2_c1" src="themes/DeepBlue/images/block/blocks_r2_c1.jpg" width="31" height="100%" border="0" alt=""></td>
  <td background="blocks_r2_c2.jpg" width="130" height="100%" border="0" alt=""><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>'  . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>
  <td><img name="blocks_r2_c3" src="themes/DeepBlue/images/block/blocks_r2_c3.jpg" width="31" height="100%" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="1" height="80" border="0" alt=""></td>
 </tr>
 <tr>
  <td><img name="blocks_r3_c1" src="themes/DeepBlue/images/block/blocks_r3_c1.jpg" width="31" height="56" border="0" alt=""></td>
  <td><img name="blocks_r3_c2" src="themes/DeepBlue/images/block/blocks_r3_c2.jpg" width="130" height="56" border="0" alt=""></td>
  <td><img name="blocks_r3_c3" src="themes/DeepBlue/images/block/blocks_r3_c3.jpg" width="31" height="56" border="0" alt=""></td>
  <td><img src="themes/DeepBlue/images/block/spacer.gif" width="1" height="56" border="0" alt=""></td>
 </tr>
</table>');

$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}
 }

 new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...