Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help change sortorder of name, image and


Zuncan

Recommended Posts

Hi!

 

Im trying to change the sortorder of the name, image and price in the productlisting. Im using a contribution to display the products in 4 columns. See this picture and you will understand:

 

columns.gif

 

I want to display the productname above the productimage instead of below.

 

I tried to alter the code in productlisting.php by just switching place of them in the code resulting in that the productname didn't display at all.

 

Would be more than greatful for help.

 

Here is the code that needs to be modified:

 

  } elseif (PRODUCT_LISTING_DISPLAY_STYLE == 'columns') {

   $info_box_contents = array();
   if ($listing_split->number_of_rows > 0) {
     $row = 0;
     $col = 0;
     $listing_query = tep_db_query($listing_split->sql_query);
     while ($listing = tep_db_fetch_array($listing_query)) {
       $listing['products_name'] = tep_get_products_name($listing['products_id']);
       
       if (PRODUCT_LIST_IMAGE > 0) {
      $lc_text = '<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, 'class="pinkborder"') . '</a><br>';
       }
         
       if (PRODUCT_LIST_NAME > 0) {
      $lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br><img src="images/pixel_trans.gif" width="1" Height="1" Vspace="1"><br>';
       }

       if (PRODUCT_LIST_MODEL > 0) {
      $lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_model'] . '</a><br>';
       }

       if (PRODUCT_LIST_MANUFACTURER > 0) {
      $lc_text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><br>';
       }

       if (PRODUCT_LIST_PRICE > 0) {
         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'])) . ' ';
         }
       }

       if (PRODUCT_LIST_BUY_NOW) {
         $lc_text .= '<br><img src="images/pixel_trans.gif" width="1" Height="1" Vspace="2"><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><IMG SRC="images/moreinfo.gif" ALT="L?s mer om produkten" BORDER="0"></a><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a><BR><BR>';      
       }

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

does this help? I defined lc_text extra, and have all calls with .= now after that ...

 

} elseif (PRODUCT_LISTING_DISPLAY_STYLE == 'columns') {

  $info_box_contents = array();
  if ($listing_split->number_of_rows > 0) {
    $row = 0;
    $col = 0;
    $lc_text = '';
    $listing_query = tep_db_query($listing_split->sql_query);
    while ($listing = tep_db_fetch_array($listing_query)) {
      $listing['products_name'] = tep_get_products_name($listing['products_id']);
      
        
      if (PRODUCT_LIST_NAME > 0) {
     $lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br><img src="images/pixel_trans.gif" width="1" Height="1" Vspace="1"><br>';
      }

      if (PRODUCT_LIST_IMAGE > 0) {
     $lc_text .= '<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, 'class="pinkborder"') . '</a><br>';
      }

      if (PRODUCT_LIST_MODEL > 0) {
     $lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_model'] . '</a><br>';
      }

      if (PRODUCT_LIST_MANUFACTURER > 0) {
     $lc_text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><br>';
      }

      if (PRODUCT_LIST_PRICE > 0) {
        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'])) . ' ';
        }
      }

      if (PRODUCT_LIST_BUY_NOW) {
        $lc_text .= '<br><img src="images/pixel_trans.gif" width="1" Height="1" Vspace="2"><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><IMG SRC="images/moreinfo.gif" ALT="L?s mer om produkten" BORDER="0"></a><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a><BR><BR>';      
      }

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

It worked.. almost! The name showed up above the image BUT the listings became totally screwed up instead. Must be a simple way to just swich place between them.

 

You dont happen to see whats wrong Monica?

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...