Forums / All Other Contributions/Addons / Error after trying to install Set Number of products displayed

Error after trying to install Set Number of products displayed

Views: 773

Results 1 to 3 of 3
8 Feb 2013, 5:12 AM
#1
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Error after trying to install Set Number of products displayed

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 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 :frusty:

Hoping someone can help:wacko:

8 Feb 2013, 5:54 AM
#2
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Error after trying to install Set Number of products displayed

Don't worry. I found the support thread for the mod.

8 Feb 2013, 6:08 AM
#3
deel avatar

deel

New Zenner

Join Date:
Jan 2013
Location:
Eustis, Florida, United States
Posts:
84
Plugin Contributions:
0

Re: Error after trying to install Set Number of products displayed

I got rid of one of the last two files as the last poster suggested and it works now. After performing two restores which obviously didn't help as it wasn't deleting the files I put in. On that note I am off to bed!