Re: Set number of products displayed per page (support thread)
Quote:
and of course the modifications to modules/template/product_listing and templates/mytemplate/template/tple_modules_product_listing.
So the Set Number mod wants manual modifications to these files? And you are modifying the Column Grid versions of the files? Please show exactly where you are doing these modifications and what they are, as they might cause problems with the Column Grid version as opposed to the stock version.
Re: Set number of products displayed per page (support thread)
and of course the modifications to modules/template/product_listing and templates/mytemplate/template/tple_modules_product_listing.
So the Set Number mod wants manual modifications to these files? And you are modifying the Column Grid versions of the files? Please show exactly where you are doing these modifications and what they are, as they might cause problems with the Column Grid version as opposed to the stock version.
The modifications are the ones noted in your read me file.
Modules/template/product_listing:
<?php
/**
* product_listing module
*
* @package modules
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: product_listing.php 6787 2007-08-24 14:06:33Z drbyte $
* UPDATED TO WORK WITH COLUMNAR PRODUCT LISTING For Zen Cart v1.3.6 - 10/25/2006
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
// BOF Number of Items Per Page
if(isset($_POST['max_display']) || isset($_GET['max_display'])) {
$_SESSION['product_listing_max_display'] = (int)$_REQUEST['max_display'];
} elseif (!isset($_SESSION['product_listing_max_display'])) {
$_SESSION['product_listing_max_display'] = (int)MAX_DISPLAY_PRODUCTS_LISTING;
}
// EOF Number of Items Per Page
// Column Layout Support originally added for Zen Cart v 1.1.4 by Eric Stamper - 02/14/2004
// Upgraded to be compatible with Zen-cart v 1.2.0d by Rajeev Tandon - Aug 3, 2004
// Column Layout Support (Grid Layout) upgraded for v1.3.0 compatibility DrByte 04/04/2006
// Column Layout Support (Grid Layout) upgraded for v1.5.0 compatibility and changed to customer control asarfraz July 26 2012
// Modified for admin control of customer option by Glenn Herbert (gjh42) 2012-09-20 test 20120929 grid sorter
//
if (!defined('PRODUCT_LISTING_LAYOUT_STYLE')) define('PRODUCT_LISTING_LAYOUT_STYLE',(isset($_GET['view']) ? $_GET['view'] : 'rows'));
if (!defined('PRODUCT_LISTING_COLUMNS_PER_ROW')) define('PRODUCT_LISTING_COLUMNS_PER_ROW',3);
if (!defined('PRODUCT_LISTING_GRID_SORT')) define('PRODUCT_LISTING_GRID_SORT',0);
$product_listing_layout_style = isset($_GET['view'])? $_GET['view']: PRODUCT_LISTING_LAYOUT_STYLE;
$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';
Templates/mytemplate/templates/tpl_modules_product_listing:Top: * Module Template
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_modules_product_listing.php 3241 2006-03-22 04:27:27Z ajeh $
* UPDATED TO WORK WITH COLUMNAR PRODUCT LISTING 04/04/2006
* Modified for admin control of customer option by Glenn Herbert (gjh42) 2012-09-21 2012-11-17 grid sorter
*/
include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING));
?>
<div id="productListing">
<?php
// only show when there is something to submit and enabled
if ($show_top_submit_button == true) {
?>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_ADD_PRODUCTS_TO_CART, BUTTON_ADD_PRODUCTS_TO_CART_ALT, 'id="submit1" name="submit1"'); ?></div>
<br class="clearBoth" />
<?php
} // show top submit
?>
<?php if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<div id="productsListingTopNumber" class="navSplitPagesResult back"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
<!--bof set num products -->
<?php
if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<div id="maxProductsListingTop" class="navSplitPagesResult forward"><?php echo TEXT_DISPLAY_STEPS_NUMBER_OF_PRODUCTS;
echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows);
?>
</div>
<?php } ?>
<!--eof set num products -->
<!--bof set num products ( dropdown ) -->
<?php if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<form>
<select onchange="if (this.value) window.location.href=this.value">
<option value="[Select One]">Products per Page
<?php echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows); ?>
</select>
</form>
<?php } ?>
<!--eof set num products ( dropdown ) -->
<div id="productsListingListingTopLinks" class="navSplitPagesLinks forward"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y', 'main_page'))); ?></div>
<br class="clearBoth" />
<?php
Bottom: * load the list_box_content template to display the products
*/
if ($product_listing_layout_style == 'columns') {
if (PRODUCT_LISTING_GRID_SORT) {
echo "\n" . '<div id="gridSorter">' . PRODUCT_LISTING_GRID_SORT_TEXT . '<ul>';
for ($col=0;$col<sizeof($grid_sort);$col++) {
if ($grid_sort[$col]['text']) echo '<li class="item">' . $grid_sort[$col]['text'] . '</li>';
}
echo '</ul></div>' . "\n";
}
require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php');
} else {// (PRODUCT_LISTING_LAYOUT_STYLE == 'rows')
require($template->get_template_dir('tpl_tabular_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_tabular_display.php');
}
?>
<?php if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<div id="productsListingBottomNumber" class="navSplitPagesResult back"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
<!--bof set num products -->
<?php
if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<div id="maxProductsListingBottom" class="navSplitPagesResult forward"><?php echo TEXT_DISPLAY_STEPS_NUMBER_OF_PRODUCTS;
echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows);
?>
</div>
<?php } ?>
<!--eof set num products -->
<div id="productsListingListingBottomLinks" class="navSplitPagesLinks forward"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></div>
<br class="clearBoth" />
<?php
Re: Set number of products displayed per page (support thread)
Quote:
The modifications are the ones noted in your read me file.
I don't know much about the "Set Number" mod code, and have not seen its readme.
However, the additions you show are discrete units which don't appear to affect standard product listing function or the column grid functions. MAX_DISPLAY_PRODUCTS_LISTING seems to be the connection point for Set Number intervention.
Hopefully someone who knows this mod well will be able to advise.
Re: Set number of products displayed per page (support thread)
After disabling the functions/extra functions/set_num_products.php file and dropping the 1st and last paste items in template/tpl_modules_product_listing the addon is working great.
Re: Set number of products displayed per page (support thread)
Quote:
Originally Posted by
mhawkins
These are the files I added:
2 files in extra functions(set_num_products & set_num_product_dd) and lang/english/template/set_num_products, and of course the modifications to modules/template/product_listing and templates/mytemplate/template/tple_modules_product_listing.
you need to choose 1 or the other in the extra functions folder:
set_num_products is standard file
set_num_product_dd is my addition (as a drop down)
this mod only works with column grid installed as far as I know.
in /includes/modules/your_template_name/product_listing.php
find:
PHP Code:
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
add right below it:
PHP Code:
// BOF Number of Items Per Page
if(isset($_POST['max_display']) || isset($_GET['max_display'])) {
$_SESSION['product_listing_max_display'] = (int)$_REQUEST['max_display'];
} elseif (!isset($_SESSION['product_listing_max_display'])) {
$_SESSION['product_listing_max_display'] = (int)MAX_DISPLAY_PRODUCTS_LISTING;
}
// EOF Number of Items Per Page
then find:
PHP Code:
$max_results = (PRODUCT_LISTING_LAYOUT_STYLE=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)(MAX_DISPLAY_PRODUCTS_LISTING/PRODUCT_LISTING_COLUMNS_PER_ROW)) : MAX_DISPLAY_PRODUCTS_LISTING;
change to:
PHP Code:
$max_results = (PRODUCT_LISTING_LAYOUT_STYLE=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)($_SESSION['product_listing_max_display']/PRODUCT_LISTING_COLUMNS_PER_ROW)) : $_SESSION['product_listing_max_display'];
then in /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_product_listing.php
find:
<?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?>
add right below it:
if using standard
PHP Code:
<!--bof set num products -->
<?php
if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<div id="maxProductsListingTop" class="navSplitPagesResult forward"><?php echo TEXT_DISPLAY_STEPS_NUMBER_OF_PRODUCTS;
echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows);
?>
</div>
<?php } ?>
<!--eof set num products -->
or if using my addition to add a dropdown
PHP Code:
<!--bof set num products ( dropdown ) -->
<?php if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<form>
<select onchange="if (this.value) window.location.href=this.value">
<option value="[Select One]">Products per Page
<?php echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows); ?>
</select>
</form>
<?php } ?>
<!--eof set num products ( dropdown ) -->
but not both
Re: Set number of products displayed per page (support thread)
May I suggest editing your installation guide to specify that we must choose between set_num_products.php and set_num_products_dd.php.
I just spent an hour debugging because your installation guide says in Step 3. "Upload all the folders and files".
Instead of saying upload all files, you really should specify we need to pick on or the other. This can save people some headaches.
Re: Set number of products displayed per page (support thread)
Oh I have screwed this right up!
Tried to install "Set number of products displayed" and then white screen, Arghhhhhhhh!
I copied files over then did this. I think I screwed up after adding the code to the files.
Installation
Run the sql patch included. You can copy the file content, go to "Admin->Tools->Install SQL Patches" and paste the query there.
This will add an additional option into Admin->Configuration->Product Listing
Simply RENAME all the folders named "YOUR_TEMPLATE" inside "includes" to your current template name.
Upload all the folders and files
Edit /includes/modules/YOUR_TEMPLATE/product_listing.php
If you don't already have a modified product_listing.php in /includes/modules/YOUR_TEMPLATE/, then create one there first.
If you already have one, merge these changes into it.
Find:
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
Add below:
// BOF Number of Items Per Page
if(isset($_POST['max_display']) || isset($_GET['max_display'])) {
$_SESSION['product_listing_max_display'] = (int)$_REQUEST['max_display'];
} elseif (!isset($_SESSION['product_listing_max_display'])) {
$_SESSION['product_listing_max_display'] = (int)MAX_DISPLAY_PRODUCTS_LISTING;
}
// EOF Number of Items Per Page
Find:
$max_results = (PRODUCT_LISTING_LAYOUT_STYLE=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)(MAX_DISPLAY_PRODUCTS_LISTING/PRODUCT_LISTING_COLUMNS_PER_ROW)) : MAX_DISPLAY_PRODUCTS_LISTING;
Replace by:
$max_results = (PRODUCT_LISTING_LAYOUT_STYLE=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)($_SESSION['product_listing_max_display']/PRODUCT_LISTING_COLUMNS_PER_ROW)) : $_SESSION['product_listing_max_display'];
Edit /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_product_listing.php
Find (this fragment occurs twice, at the top and bottom of the displayed page):
<?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?>
and paste the following code segments under the fragments.
For the first paste, at the top of the page add:
<!--bof set num products -->
<?php
if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<div id="maxProductsListingTop" class="navSplitPagesResult forward"><?php echo TEXT_DISPLAY_STEPS_NUMBER_OF_PRODUCTS;
echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows);
?>
</div>
<?php } ?>
<!--eof set num products -->
<!--bof set num products ( dropdown ) -->
<?php if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<form>
<select onchange="if (this.value) window.location.href=this.value">
<option value="[Select One]">Products per Page
<?php echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows); ?>
</select>
</form>
<?php } ?>
<!--eof set num products ( dropdown ) -->
For the second paste, for the bottom of the page add:
<!--bof set num products -->
<?php
if (PRODUCT_LISTING_MAX_DISPLAY_STEPS !='') { ?>
<div id="maxProductsListingBottom" class="navSplitPagesResult forward"><?php echo TEXT_DISPLAY_STEPS_NUMBER_OF_PRODUCTS;
echo draw_max_display($_GET['main_page'], $listing_split->page_name, (int)PRODUCT_LISTING_COLUMNS_PER_ROW, $listing_split->number_of_rows);
?>
</div>
<?php } ?>
<!--eof set num products -->
The log file says this.
[08-Feb-2013 05:06:16 UTC] PHP Fatal error: Cannot redeclare draw_max_display() (previously declared in /home/content/78/10039978/html/coopstore/includes/functions/extra_functions/set_num_products.php:5) in /home/content/78/10039978/html/coopstore/includes/functions/extra_functions/set_num_products_dd.php on line 28
My code knowledge is poor (on virtually non existent) to say the least and that file wasn't even edited. I have tried restoring to a earlier time today but I get the same thing. Of course I just sent an email out telling everyone about the new store
Hoping someone can help
Re: Set number of products displayed per page (support thread)
See post #86 above. You need to upload either set_num_products.php or set_num_products_dd.php, not both. There is more discussion of this in previous posts.
Re: Set number of products displayed per page (support thread)
Thanks
This was working for a few weeks on my site www.livingtowers.com/coopstore. Now it doesn't I don't even know where to start to troubleshoot this. Can anyone help me please? I have checked the logs folder and there is an unrelated error in there
Re: Set number of products displayed per page (support thread)
I updated this mod and submitted it today!
http://www.zen-cart.com/downloads.php?do=file&id=496
What does it do?
This mod puts link(s) or a dropdown on the product listing page (only) to allow your customers to choose the maximum number of products to be displayed per page.
Additions to v1.2
1.) Added Admin Control
The new admin control gives you a Display Option (Display Dropdown) = true, simply set to false to use as Number List
2.) Removed optional functions file (for Dropdown)
Merged function files to include an if statement based on ADMIN > PRODUCT LISTING > Display Option
3.) Added an additional Upgrade sql file to add the new ADMIN switch
4.) Updated and hopefully simplified the readme.html file
Requirement
You need this mod installed first:
Column Layout Grid for Product Listing http://www.zen-cart.com/downloads.php?do=file&id=3