Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how can i add " View All " function?


minglou

Recommended Posts

Hi Guys,

 

I don't know if anybody already got this ideas, since i used

 

Product Listing in Columns

 

How can i add " view all" function at the top of catagories page, for better understand what i said, please check the below link:

 

link

 

I know i can't do some work on index.php page, so i assume it should be this file:

 

product_listing_col.php under /includes/module

 

Here is the code for product_listing_col.php

 

<?php
/*
 -- Changed 11/10/03 for v 2.2 MS2 - Randy Pertiet

 $Id: product_listing_col.php,v 1.00 2002/05/06 20:28:07 icw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2002 osCommerce

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

 DEFINE('PRODUCT_LIST_COL_NUM',3);

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

 $info_box_contents = array();

 if ($listing_split->number_of_rows > 0) {

$row = 0;
$col = 0;

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

     $listing_values['products_name'] = tep_get_products_name($listing_values['products_id']);

     $lc_text= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a><br>';

     if ($listing_values['specials_new_products_price']) {
       $lc_text .= ' <s>' .  $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span> ';
  } else {
       $lc_text .= ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';
     }

     if (PRODUCT_LIST_BUY_NOW) {
       $lc_text .= '';      
     }

     $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => $lc_text);

     $col ++;
     if ($col > PRODUCT_LIST_COL_NUM-1) {
       $col = 0;
       $row ++;
     }
   }

   new contentBox($info_box_contents);

 } else {

   $info_box_contents = array();

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

   new contentBox($info_box_contents);

 }

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
 ?>
 <table width="100%">
  <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
 }
?>

 

 

I know how to do this in static page, but i need somebody help this on dynamic page, so each catagories has view all button or text.

 

Thank you so much, if you did't get what i mean, please post here!!!

 

Thanks

 

sean

Link to comment
Share on other sites

add the link to view all to go to the same page, but with a parameter for you to get

 

check if that parameter exists in the url, when going to the page, if it's not there/empty then display the lists as it is. If it's there, create an else clause where you omit the part with the page links etc, and have the query not split like here

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

instead, use the original $listings_sql to procede, it will show all records. If you want a new design like on the site you posted, it will be a bit more work ... but absolutely doable!

:-)

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

add the link to view all to go to the same page, but with a parameter for you to get

 

check if that parameter exists in the url, when going to the page, if it's not there/empty then display the lists as it is. If it's there, create an else clause where you omit the part with the page links etc, and have the query not split like here

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

instead, use the original $listings_sql to procede, it will show all records. If you want a new design like on the site you posted, it will be a bit more work ... but absolutely doable!

 

 

Thank you so much for your help, since i am kind of new to php, and how to use the original $listings_sql to procede to show all records in the same page? i don't need to create a new design, i just want have a view all text link or button for customers who don't want to check every page for the same catagories.

 

Would you please give me some details about the code?

 

 

and also i seached this forum, and i got some kind of code like this to use to show all customers in admin side:

 

// this should display all customers at once.
// _very_ nasty way of doing this, but it appears to work
// for now....
  if ($display_all == "on")
{
    $display_amount = "99";
}
  else
{
    $display_amount = MAX_DISPLAY_SEARCH_RESULTS;
}


<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('cID')) . 'display_all=on') . '">(Show All)</a> '; ?>

 

i tried to use on product listing in column module, but actually, it doesn't work, just refresh the same page.

 

Thanks!!

 

Sean

Link to comment
Share on other sites

  • 4 weeks later...

This is a standard feature in any professional grade shopping cart. I've been using OSC for over a year now and I love it, but this is just one of those little things that set me back. I can't believe know one knows how to do this? If I knew how to program I would fix all the little things that OSC needed to compete in the commercial market. I just wish CRE Loaded was designed better and didn't have so much advertising in the Admin Section.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...