Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

move product-listing name


Guest

Recommended Posts

Posted

Hi all I know this topic has been aproached before but i just want to move the product name in the product_listing.php

 

Please see my site My link

 

As you can see i've styled the name, all i want is just to move it to above the picture.

 

Thanks

 

below is the file:

 

<?php
/*
 $Id: product_listing.php 1739 2007-12-20 00:52:16Z hpdl $

 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
 }

 $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;
     //product+name
       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 . ' ');
 }

 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 = '';

       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']) . '"><b>' . $listing['products_name'] . '</a></b><br>' . $listing['short_desc'] . '</b>';
               } else {
              $lc_text = '<href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '"><span class="productListing-name">' . $listing['products_name'] . '</span><br>' . $listing['short_desc'] . '</b>';} 
          break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
           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 = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
// Start "Hide Price if $0" edit 1 of 2 (uncomment above line if removing this contribution)
$lc_text = ' ' . (($listing['products_price'] > 0) ? $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : '') . ' ';
// End "Hide Price if $0" edit 1 of 2
           }
           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 = ' <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) . ' ';
           }
           break;
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           //$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
// Start "Hide Price if $0" edit 2 of 2 (uncomment above line if removing this contribution)
$lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' : ' ');
// End "Hide Price if $0" edit 2 of 2
           break;
       }

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

   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')) ) {
?>

<?php
 }
?>

Posted

The tricky part about doing this is that the html you need access to is not in product_info.php. It is in includes/classes/boxes.php.

first note two things:

 

1)

in product_info.php find:

 

new productListingBox($list_box_contents);

 

That is the call to includes/classes/boxes.php for the relevant html you seek to change.

 

2)

In includes/classes/boxes.php right near the top you will see:

var $table_border = '0';

 

Change that '0' to '1' and go back to your product listings and you will see a border around the table you are trying to change. Unfortunately there will be a border around lots of other things in your website as well. But you will have an insight into the table structure you need to change.

 

There are a number of options, and probably some contributions that will assist you in this.

 

 

 

However, one thing you could do is to duplicate (simply copy and paste) two classes in boxes.php,

class tableBox

and

class productListingBox

, renaming them

class tableBox_custom

and

class productListingBox_custom

 

Then in product_info.php change code]new productListingBox($list_box_contents);[/code] to code]new productListingBox_custom($list_box_contents);[/code].

 

Everything will look the same. But now you can go into includes/classes/boxes.php and experiment with your new classes, without worrying about screwing up much else, and with an easy way to switch everything back if you need.

 

You can see a modified product listing with the image aligned vertically like you are working toward on my site here: http://www.niora.com/anti-aging-acne-care

 

 

I'm sure I don't need to say this but make back up copies of these two files product_info.php and includes/classes/boxes.php first.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

Err I think u getting confused!! u set the relavent position of all fields in the listing in admin!!, no code changes needed wink.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Microchef2 wants to move the product name over the product image. I know how to move things left and right within each listing using the admin panel, but if you know how to use the admin panel to stack stuff vertically, please explain how.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

Microchef2 wants to move the product name over the product image. I know how to move things left and right within each listing using the admin panel, but if you know how to use the admin panel to stack stuff vertically, please explain how.

 

 

With the relavent code in the listing file, the admin control will dictate horizontal or vertical positioning, or both, if using the basic file, just modify the image case. wink.gif

 

Product_info has nothing to do with the product_listing.php file!! huh.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

With the relavent code in the listing file, the admin control will dictate horizontal or vertical positioning, or both, if using the basic file, just modify the image case. wink.gif

 

Product_info has nothing to do with the product_listing.php file!! huh.gif

 

Open includes/modules/product_listing.php. On a fresh install you'll see this about line 155:

new productListingBox($list_box_contents);

 

That is the call to the class productListingBox in includes/classes/boxes.php. Once you learn how to manipulate html in that, and it's parent class tablebox in the same file, you can do anything you can dream up with the layout of the product listings.

 

I am fascinated, however, that you know how to use the admin panel, or the 'image case' to arrange items in the product listing in vertical order. Please explain it step by step, I'd love to know how it's done.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

I am fascinated, however, that you know how to use the admin panel, or the 'image case' to arrange items in the product listing in vertical order. Please explain it step by step, I'd love to know how it's done.

 

 

Its sounds like u think it can't be done, I would point out that what can & cant be done in programming is only limited by the coders ability. cool.gif

 

I would not avocate modifiying the box class to achieve this result, very restrictive, means you have to alter the code any time u want a change, did you not notice the lack of admin control there? ohmy.gif

 

It seems u don't understand the methodology of the product_listing !! The product_listing file creates arrays for output by the box class, therefore the format of the output depends on the structure of those arrays, by modifying that structure (through admin controls) you can alter the display to create what u want, for maximum flexibility it is mearly neccessary to alter the listing code to provide all the options u want through admin. There is no need to touch the box class unless unless you wish to modify its style. wink.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Well

As you can see from the link on first post, i have managed to figure it out.

 

 

Thanks for the help!!

Archived

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

×
×
  • Create New...