Forum

Thread tagged as: Question, Problem, Field-Types

Region with multiple items not displaying on the site after update to 2.8.30

I have a region with about 1200 items in it. It was displaying until I upgraded. Now it's as though there are no items at all. I can view them and edit them in the dashboard. I've tried adding a new region, republishing all the pages, refreshing the page in the browser - none of it has had any effect. I'd love some help getting these regions displaying again.

Here's my Diagnostick Report

Perch: 2.8.30, PHP: 5.5.24, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.30), assets (2.8.30), categories (2.8.30), perch_blog (5.0), perch_forms (1.8.3), perch_backup (1.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_blog', );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/Natalie/Documents/Websites/satterberg.dev/admin
PERCH_CORE: /Users/Natalie/Documents/Websites/satterberg.dev/admin/core
PERCH_RESFILEPATH: /Users/Natalie/Documents/Websites/satterberg.dev/admin/resources
Image manipulation: GD
PHP limits: Max upload 512M, Max POST 512M, Memory: 512M, Total max file upload: 512M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: satterberg.dev
DOCUMENT_ROOT: /Users/Natalie/Documents/Websites/satterberg.dev
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Here's the page where I want the items to display:

<?php
    include( 'admin/runtime.php' );
    perch_layout( 'global.header' );
?>

<h1 class="page-title">Grantee Database</h1>

<div class="cms-content">
    <?php perch_content( 'Intro' ); ?>
</div>

<?php  perch_form( 'grantee_filter.html' );  ?>

<?php

$filters = array();

if ( perch_get( 'year' ) ) {
    $filters[] = array(
        'filter' => 'year',
        'match'  => 'eq',
        'value'  => perch_get( 'year' ),
    );
}

if ( perch_get( 'program' ) ) {
    $filters[] = array(
        'filter' => 'program',
        'match'  => 'eq',
        'value'  => perch_get( 'program' ),
    );
}

if ( perch_get( 'term' ) ) {
    $filters[] = array(
        'filter' => 'term',
        'match'  => 'eq',
        'value'  => perch_get( 'term' ),
    );
}

if ( !count( $filters ) ) $filters = false;
?>


<?php
    perch_content_create('Grantees', array(
        'multiple' => true,
        'template'  => 'grantee-listing.html',
        'edit-mode' => 'singlepage',
        'add-to-top' => true
    ) );

    perch_content_custom('Grantees', array(
        'filter'        => $filters,
    ) );
?>

<?php perch_layout('global.footer'); ?>

And then here's the template:

<perch:before>
<table class="grantee-listing">
    <thead>
        <tr>
            <th class="year">Year</th>
            <th class="org-name">Organization</th>
            <th class="details">Details</th>
        </tr>
    </thead>
    <tbody>
</perch:before>

    <tr>
        <td class="year">
            <perch:content id="year" type="text" label="Year" required="true" divider-before="Grant Information"/>
        </td>
        <td class="org-name">
            <div class="name">
                <perch:content id="org-name" type="text" label="Organization Name" required="true" title="true" order="1" />
                <perch:if exists="org-link">
                    <a href="<perch:content id="org-link" type="text" label="Organization Link" order="4" />">Website
                    </a>
                </perch:if>
            </div>
            <perch:if exists="location">
                <div class="location"><perch:content id="location" type="text" label="Location" order="2" /></div>
            </perch:if>
        </td>
        <td class="details">
            <div class="program"><perch:content id="program" type="select" label="Program" options="Core Support Grants, Community Partnership,  Invitational Grant, Family Award, Capacity Building Grant, Open Grant, Legacy Grant, Original" allowempty="true" required="true" title="true" /></div>
            <div class="term"><strong>Term: </strong><perch:content id="term" type="text" label="Grant Term" required="true" help="The term of the grant in years. Enter a number only." /> Year<perch:if id="term" value="1" match="gt" >s</perch:if></div>
            <div class="amount"><strong>Amount: </strong>$<perch:content id="amount" type="text" label="Grant Amount" required="true" format="#:0" help="Enter dollar amount without dollar signs, commas, or any other special characters. Just the number." /></div>
        </td>
    </tr>

    <perch:content id="intro" type="textarea" label="Introduction" editor="redactor" html="true" divider-before="Grantee Story" suppress="true" />

<perch:after>
    </tbody>
</table>
</perch:after>

<perch:noresults>
    <div class="no-results cms-content">
        <p>Sorry, no grantees match your search. Try adjusting your search terms.</p>
    </div>
</perch:noresults>

How can I get this fixed? All I can see on the page is the noresults message.

Natalie MacLees

Natalie MacLees 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Which version did you update from?

If you turn on Debug what can you see?

https://docs.grabaperch.com/docs/installing-perch/configuration/debug/

I am not sure which version I updated from. I think the last time I updated was in March. It's a dev site that's not launched yet. Launching this Wednesday fingers crossed! :-)

Here is the debug:

Debug Message
[1] SELECT * FROM perch2_pages WHERE pagePath='/grantees.php' LIMIT 1
Using template: /templates/pages/attributes/seo.html
Using template: /templates/pages/attributes/body_attributes.html
[15] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/grantees.php' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-003-005', '000-003', '000') ORDER BY pageTreePosition DESC
[4] Using template: /templates/navigation/item.html
[15] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/grantees.php' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-003-005', '000-003', '000') ORDER BY pageTreePosition DESC
[4] Using template: /templates/navigation/item.html
[4] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/grantees.php' OR regionPage='*' ORDER BY regionPage DESC
[26] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/forms/grantee_filter.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Grantees' AND (regionPage='/grantees.php' OR regionPage='*')
[nil] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=35 AND idx.itemRev=1399)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
Using template: /templates/content/grantee-listing.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks basically ok, although the query to get your items is returning no results. This obviously reflects what you're seeing on the page.

Regions are not designed for holding hundreds and certainly not thousands of items. That's pushing them way too far. I can't say for certain at which point that's failing (there are a few possibilities) but it's clearly failing somewhere.

I'm pretty sure the solution is going to be to import the region in a collection.

Ok. This project is my first time using Perch, so I'm not familiar with Collections or how to use them. The site is pretty small and simple - 12 basic pages, a blog and then this database of grantees.

I didn't realize regions weren't a fit for the database. It looks like Collections are only with Runway? Do I need to upgrade my license? I'm not sure what to do next, and I'm supposed to launch the site the day after tomorrow.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you see all of your items from within the control panel? If so, it's hopeful that you've not lost any data, but keep hold of your backups just in case.

Collections are indeed a Runway feature - they're designed for when you want more than a couple of dozen items, which sounds very much like your database of grantees.

Yes, I can see and edit all the items from within the control panel.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that sounds good. If you turn on debug and save and item, do you see any errors?

No, I don't see any errors when I save an item with debug on.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. In which case it should display fine on the site.

Oh my gosh! That's so weird. Somehow just turning on debug while editing one of the items fixed the display issue. It worked for my local and then I did the same thing on staging, and it fixed the display of the items there as well!

So I think we're all set to launch the site tomorrow, but longer term, do you think using regions for this database is unstable and that we should migrate it over to a Collection to keep the site happy and running longer? They'll be adding about 100 items to this database each year, so it will keep growing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you'd be better with a Collection.

With multiple item regions, when you edit an item the a new version of the entire region is created and saved - so every edit is really making 1200 edits. When you click undo, 1200 items are put back to the previous version. So they're not really suited for 100s of items.

With a collection, each item is versioned individually, so an edit just edits that one item. Undoing undoes the change to one item.

I was so nervous that it was going to be hard and mess up my site, but I upgraded to Runway and changed my region to a collection in about 30 minutes. :-) Even my filters still work. Yay! Thank you so much for your help.