Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product_listing Layout


AndrewC

Recommended Posts

Does anytone know how i can break this info down into a table so i can chage the way its displayed? I want it to look like this page Link Hereand have the prices in the space to the right of the image.

 

HELP!

 

<?php

  if ($listing_numrows > 0) {

    $number_of_products = '0';

    $listing_query = tep_db_query($listing_sql);

    while ($listing = tep_db_fetch_array($listing_query)) {

      $number_of_products++;

 

      if (($number_of_products/2) == floor($number_of_products/2)) {

        $list_box_contents[] = array('params' => 'class="productListing-even"');

      } else {

        $list_box_contents[] = array('params' => 'class="productListing-even"');

      }

 

      $cur_row = sizeof($list_box_contents) - 1;

 

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

        $lc_align = 'center';

 

        switch ($column_list[$col]) {

          case 'PRODUCT_LIST_MODEL':

            $lc_align = 'center';

            $lc_text = ' ' . $listing['products_model'] . ' ';

            break;

          case 'PRODUCT_LIST_NAME':

            $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']) . '">' . $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_RRP':

            $lc_align = 'center';

          $lc_text = 'RRP: ' . $currencies->display_price($listing['products_price_rrp'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

            break;

          case 'PRODUCT_LIST_MANUFACTURER':

            $lc_align = 'center';

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

            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 = 'Price: ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

            }

            break;

          case 'PRODUCT_LIST_QUANTITY':

            $lc_align = 'center';

            $lc_text = ' ' . $listing['products_quantity'] . ' ';

            break;

          case 'PRODUCT_LIST_WEIGHT':

            $lc_align = 'center';

            $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'], PRODUCT_LISTING_IMAGE_WIDTH, PRODUCT_LISTING_IMAGE_HEIGHT) . '</a>';

            } else {

              $lc_text = ' <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'], PRODUCT_LISTING_IMAGE_WIDTH, PRODUCT_LISTING_IMAGE_HEIGHT) . '</a> ';

            }

            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', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> ';

            break;

        }

 

        $list_box_contents[$cur_row][] = array('align' => $lc_align,

                                              'params' => 'class="productListing-data"',

                                              'text'  => $lc_text);

      }

    }

 

    new tableBox2($list_box_contents, true);

 

    echo '    </td>' . "\n" .

        '  </tr>' . "\n";

  } else {

?>

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

there is a contribution that'll help you do this. I've used it on the site I'm building at the moment, but I can't remeber what it's called! Sorry. I did a quick contrib search & couldn't find it, but it's there somewhere...You can see what I've done with it here. If you cna't find the contrib, I'll give you my files if you want (though there's other customisations in there too, I'm afraid...)

Link to comment
Share on other sites

yup. that's the one!! After installing it, I dug around in the code and was able to build a nice little table for each item, which I'm quite chuffed with.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...