Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Printable Catalog - Page Numbers Problem


LCAngela

Recommended Posts

Hi, all!

 

I've finally installed and customized the heck out of thePrintable Catalog / Catalog Products with Images v3.4+ contrib, but I'm having an issue with the page numbers on the paginated version.

 

My problem is that, even though I specified in my store admin that I wanted it to show 10 page links, it's having a problem even showing those consistently!

 

For example, right now, my friend's store only has 31 products; at 10 products per page, that's 4 pages. The "PREV" and "NEXT" links are never a problem, and on pages 1, 2, and 3, all four page links show up just fine. On page 4, though, the link to page 1 has disappeared!

 

printablecataloglinks1.jpg

 

printablecataloglinks2.jpg

 

Here's my code:

<?php
if($page != 1)
{
$pageprev = $page - 1; 
echo('<a href="' . $PHP_SELF . '?listing=' . $sort . '&page='.$pageprev.'">« '.BOX_CATALOG_PREV.'</a> ');  
} else {
       echo('');
}
//PRODUCT_LIST_PAGEBREAK_NUMBERS_PERPAGE
$displaycount_number = (mysql_result(mysql_query("SELECT configuration_value from  " . TABLE_CONFIGURATION . " WHERE configuration_key = 'PRODUCT_LIST_PAGEBREAK_NUMBERS_PERPAGE'"), 0 , 0)) - 0;
$numofpages = $totalrows / $limit;
// setting both 10s will limit the list to ten page links 20s would set it to display 20 page breaks max.
$displaycount = $numofpages < $displaycount_number ? $numofpages : $displaycount_number; 

$startpage = $page > $displaycount / 2 ? floor($page - $displaycount / 2) : 1;

for($i = $startpage; $i <= $startpage + $displaycount; $i++)  
{  
   if($i > $numofpages) 
   { 
       break; 
   }else 
   if($i == $page)   
   {  
       if($i>0) echo(" <b>-".$i."-</b> ");  
   } else { 
 if($i>0) echo(' <a href="' . $PHP_SELF . '?listing=' . $sort . '&page='.$i.'">-'.$i.'-</a> ');  
}
}
if(($totalrows % $limit) != 0) 
{
if($i == $page)
{
 if($i>0) echo(' <b>-'.$i.'-</b> ');
} else {
 if($i>0) echo(' <a href="' . $PHP_SELF . '?listing=' . $sort . '&page='.$i.'">-'.$i.'-</a> ');
}
}
if(($totalrows - ($limit * $page)) > 0)
{ 
$pagenext = $page + 1;
echo(' <a href="' . $PHP_SELF . '?listing=' . $sort . '&page='.$pagenext.'">'.BOX_CATALOG_NEXT.' »</a>');  
} else {
echo('');  
}
mysql_free_result($result); 
?>

Any thoughts?

 

This isn't as important (or annoying), but I'm also trying to figure out a way to show the total number of products in the printable catalog page. Further up in the code, I see this:

// Number of products to display per page 
 $limit = mysql_result(mysql_query("SELECT configuration_value from  " . TABLE_CONFIGURATION . " WHERE configuration_key = 'PRODUCT_LIST_CATALOG_PERPAGE'"), 0 , 0);
 $totalrows = mysql_num_rows($products_query);
 if (empty($page)) { $page = 1; }
 $limitvalue = $page * $limit - ($limit);
 $query = $products_query_raw . " LIMIT $limitvalue, $limit";
 $result = tep_db_query($query);
 if(mysql_num_rows($result) == 0) 
       $item_row = '
 <td align="center">Nothing to Display!</td>';

I would think $totalrows would do the trick, but no...

 

Thanks in advance!! :D

"That's because it's fly soup, sir..."

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...