Forum
Collection of products taking 27seconds to load
Hi there,
A bit of a strange one, I have a collection of products when a user visits the list page for the first time it can take up to 27 seconds to load all the products (29 products in total). I am struggling to figure out what the cause might be. I was wondering if you could help shed some light on this?
Here is my DEBUG message
Debug Message
[84]
SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched page: /en-eu/products, so not using routes.
Using master page: /templates/pages/products_eu/products.php
[1]
SELECT collectionID, collectionTemplate FROM perch2_collections WHERE collectionKey='products'
[nil]
SELECT * FROM ( SELECT idx.itemID, ci.collectionID, ci.itemJSON, idx2.indexValue as sortval FROM perch2_collection_index idx JOIN perch2_collection_items ci ON idx.itemID=ci.itemID AND idx.itemRev=ci.itemRev AND idx.collectionID=ci.collectionID JOIN perch2_collection_revisions cr ON idx.itemID=cr.itemID AND idx.itemRev=cr.itemRev AND idx.collectionID=ci.collectionID JOIN perch2_collection_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE (idx.collectionID=25) AND ((idx.indexKey='slug' AND idx.indexValue='')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, itemJSON, sortval ORDER BY sortval ASC
Using template: /templates/content/products/products.html
[1]
SELECT * FROM perch2_pages WHERE pagePath='/en-eu/products' LIMIT 1
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/language_code.html
Using template: /templates/pages/attributes/twitter_name.html
Using template: /templates/pages/attributes/twitter.html
Using template: /templates/pages/attributes/facebook.html
Using template: /templates/pages/attributes/seo.html
Using template: /templates/pages/attributes/body_attributes.html
[1]
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/en-eu' OR pageSortPath='/en-eu' LIMIT 1
[12]
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageTreePosition LIKE '000-004%' AND pageDepth >=1 AND pageDepth<=3 ORDER BY pageTreePosition ASC
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/en-eu/products' LIMIT 1
[2]
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004-001', '000-004', '000') ORDER BY pageTreePosition DESC
Using template: /templates/navigation/nav.html
[5]
Using template: /templates/navigation/subnav.html
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='europe' LIMIT 1
[10]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=2 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=2 AND p.pagePath='/en-eu/products' LIMIT 1
[10]
Using template: /templates/navigation/choose_region.html
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='north-america' LIMIT 1
[3]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=3 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=3 AND p.pagePath='/en-eu/products' LIMIT 1
[3]
Using template: /templates/navigation/choose_region.html
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='south-america' LIMIT 1
[1]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=4 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=4 AND p.pagePath='/en-eu/products' LIMIT 1
[1]
Using template: /templates/navigation/choose_region.html
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='asia' LIMIT 1
[1]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=5 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=5 AND p.pagePath='/en-eu/products' LIMIT 1
[1]
Using template: /templates/navigation/choose_region.html
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/en-eu/products' OR pageSortPath='/en-eu/products' LIMIT 1
[1]
SELECT * FROM perch2_pages WHERE pageHidden=0 AND pageNew=0 AND pageTreePosition IN ('000-004-001', '000-004', '000') ORDER BY pageTreePosition
[1]
Using template: /templates/navigation/breadcrumbs.html
[6]
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/en-eu/products' OR regionPage='*' ORDER BY regionPage DESC
[1]
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Page Heading' AND (regionPage='/en-eu/products' OR regionPage='*')
[1]
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=288 AND idx.itemRev=1)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[1]
Using template: /templates/content/_page_heading.html
[29]
SELECT * FROM ( SELECT idx.itemID, ci.collectionID, ci.itemJSON, idx2.indexValue as sortval FROM perch2_collection_index idx JOIN perch2_collection_items ci ON idx.itemID=ci.itemID AND idx.itemRev=ci.itemRev AND idx.collectionID=ci.collectionID JOIN perch2_collection_revisions cr ON idx.itemID=cr.itemID AND idx.itemRev=cr.itemRev AND idx.collectionID=ci.collectionID JOIN perch2_collection_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE (idx.collectionID=25) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, itemJSON, sortval ORDER BY sortval ASC
[29]
Using template: /templates/content/products/products_list.html
Using template: /templates/pages/attributes/twitter_name.html
[1]
SELECT * FROM perch2_twitter_tweets WHERE tweetType='mine' AND tweetAccount='chicopee_europe' ORDER BY tweetDate DESC LIMIT 1
[32]
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1]
Using template: /templates/twitter/tweet.html
[1]
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Telephone en-eu' AND (regionPage='/en-eu/products' OR regionPage='*')
[1]
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=173 AND idx.itemRev=7)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[1]
Using template: /templates/content/text.html
[1]
SELECT groupID FROM perch2_navigation WHERE groupSlug='footer-en-eu' LIMIT 1
[5]
SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=7 AND p.pageNew=0 ORDER BY np.pageTreePosition ASC
[0]
SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=7 AND p.pagePath='/en-eu/products' LIMIT 1
[5]
Using template: /templates/navigation/item.html
[1]
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/en-eu/segments' OR pageSortPath='/en-eu/segments' LIMIT 1
[7]
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageTreePosition LIKE '000-004-003%' AND pageDepth >=2 AND pageDepth<=3 ORDER BY pageTreePosition ASC
[1]
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/en-eu/products' LIMIT 1
[2]
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004-001', '000-004', '000') ORDER BY pageTreePosition DESC
[6]
Using template: /templates/navigation/item.html
[1]
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Social en-eu' AND (regionPage='/en-eu/products' OR regionPage='*')
[1]
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=170 AND idx.itemRev=5)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
[1]
Using template: /templates/content/footer/social.html
Request time: 27.1276
Process time: 27.1261
Memory: 5.1521
Here is my diagnostics report
PERCH INFORMATION
Perch Runway: 2.8.32
Production mode: Production (100)
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0), perch_forms (1.8.3), collection_25 (2.8.32), collection_27 (2.8.32), perch_twitter (3.5.1)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_blog_authors (7), perch2_blog_comments (0), perch2_blog_index (4191), perch2_blog_posts (135), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (3), perch2_categories (71), perch2_category_counts (14), perch2_category_sets (6), perch2_collection_index (732002), perch2_collection_items (1639), perch2_collection_revisions (303), perch2_collections (2), perch2_content_index (12535), perch2_content_items (1952), perch2_content_regions (171), perch2_forms (4), perch2_forms_responses (126), perch2_navigation (6), perch2_navigation_pages (28), perch2_page_routes (47), perch2_page_templates (43), perch2_pages (74), perch2_resource_log (16636), perch2_resource_tags (0), perch2_resources (1895), perch2_resources_to_tags (0), perch2_scheduled_tasks (30), perch2_settings (33), perch2_twitter_scheduled_tweets (0), perch2_twitter_settings (1), perch2_twitter_tweets (1772), perch2_user_passwords (1), perch2_user_privileges (42), perch2_user_role_privileges (53), perch2_user_roles (4), perch2_users (10)
Users: 10
App runtimes:
<?php
$apps_list = array(
'content',
'categories',
'perch_blog',
'perch_twitter',
'perch_forms',
);
Scheduled tasks for perch_twitter: post_tweets (1 mins), update_tweets (60 mins)
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup
H1: c0fe4e9645faca51fb440cc5acbe78ca
L1: 20240be7944a7944e62b3cd88072c3ae
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #e61e26
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.16: done
headerScheme: dark
update_runway_2.8.16: done
latest_version: 2.8.15
on_sale_version: 2.8.32
update_runway_2.8.19: done
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 0
perch_blog_update: 5.0.1
perch_blog_post_url: /{blogSlug}/news/{postSlug}
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 1
perch_blog_comment_notify: 0
update_runway_2.8.23: done
perch_blog_site_name: Chicopee Solutions
logoPath: /admin/resources/1453300953_chicopee-logo.png
perch_twitter_update: 3.5
update_runway_2.8.24: done
update_runway_2.8.25: done
update_runway_2.8.28: done
update_runway_2.8.29: done
update_runway_2.8.32: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /var/www/html/chicopee/staging/public_html
PERCH_SCHEDULE_SECRET: 8wJeeQvIgirzvJPg
PERCH_DB_USERNAME: teamfcuk_chicope
PERCH_DB_SERVER: 87.117.230.208
PERCH_DB_DATABASE: teamfcuk_chicopee
PERCH_DB_PREFIX: perch2_
PERCH_YOUTUBE_API_KEY: AIzaSyBeSDvZackLJIyG4btIaz8qppXIDf8I0mo
PERCH_EMAIL_FROM: barry@teamfc.co.uk
PERCH_EMAIL_FROM_NAME: Barry Corrigan
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/html/chicopee/staging/public_html/admin
PERCH_CORE: /var/www/html/chicopee/staging/public_html/admin/core
PERCH_RESFILEPATH: /var/www/html/chicopee/staging/public_html/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_CLEAN_RESOURCES:
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_DEBUG:
PERCH_PRODUCTION_MODE: 100
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/html/chicopee/staging/public_html/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS
PHP: 5.5.32
Zend: 2.5.0
OS: Linux
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $
MySQL server: 5.5.48-log
Free disk space: 53.74 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, apache2handler, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, json, exif, mcrypt, memcache, mysqlnd, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, wddx, xmlreader, xmlwriter, xsl, zip, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 256M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
HTTP_HOST: chicopee.com
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.21 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_REFERER: https://chicopee.com/admin/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,fr;q=0.6
HTTP_COOKIE: test_status=1; region=us; cmsa=1; _ga=GA1.2.1644893137.1477308010; PHPSESSID=g4nh03duudht0qanblk5pkj8k5
HTTP_X_FORWARDED_PORT: 80
HTTP_X_FORWARDED_FOR: 86.2.230.214
HTTP_CONNECTION: close
PATH: /sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE: <address>Apache/2.2.15 (CentOS) Server at chicopee.com Port 80</address>
SERVER_SOFTWARE: Apache/2.2.15 (CentOS)
SERVER_NAME: chicopee.com
SERVER_ADDR: 95.154.250.118
SERVER_PORT: 80
REMOTE_ADDR: 87.117.230.208
DOCUMENT_ROOT: /var/www/html/chicopee/staging/public_html/
SERVER_ADMIN: bwftechs@bwf.co
SCRIPT_FILENAME: /var/www/html/chicopee/staging/public_html/admin/core/settings/diagnostics/index.php
REMOTE_PORT: 32926
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /admin/core/settings/diagnostics/?extended
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1477319452.417
REQUEST_TIME: 1477319452
Here is my products.php master template
<?php
/**
* Instead of spiltting the header layout into separte areas within the list detail if
* statement. We have created a new if statement for the page title and passed it into the
* header layout.
*/
PerchSystem::set_var('home', REGION);
/**
* Get the post
*/
$product = perch_collection('products', array(
'filter' => 'slug',
'value' => perch_get('s'),
'skip-template' => 'true',
'return-html' => 'true',
));
/**
* Set up the variables
*/
if (isset($product[0]['title'])) {
$title = $product['0']['title'] . " - Chicopee Solutions";
} else {
$title = "Products - Chicopee Solutions";
}
if (isset($product[0]['sub-title'])) {
$description = strip_tags($product['0']['sub-title']);
} else {
$description = "Chicopee's foodservice towels help support your needs for back-of-house, front-of-house, and restrooms.";
}
if (isset($product[0]['mainimage'])) {
$fbimage = $product[0]['mainimage'];
} else {
$fbimage = '/assets/img/default_fb_image.jpg';
}
/**
* Use the variables in the array value
*/
perch_page_attributes_extend(array(
'description' => $description,
'og_description' => $description,
'og_title' => $title,
'og_type' => 'article',
'sharing_image' => $fbimage,
'og_author' => 'https://www.facebook.com/Chicopee.Europe',
));
/**
* Include the header & meta. You can find these in tempates/layouts/global
*/
perch_layout('global/meta', [
'title'=> $title,
'language' => true,
]);
perch_layout('global/header');
/**
* Below is the product detail page for Foodservice
* Anything wrapped in if (perch_get('s')) { is in the detail page
*/
if (perch_get('s')) {
/**
* We are using the code below to output the breadcrumbs, but becuase the collection is'nt
* a phyiscal page within the page tree we had to pass the product title into a new
* breadcrumbs template. We are passing the $producttitle varible to breadcrumbs template
*/
$producttitle = perch_collection('products', array(
'template' => 'products/_product_title.html',
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('s'),
'count' => 1
), true);
PerchSystem::set_var('title', $producttitle);
PerchSystem::set_var('home', REGION);
perch_pages_breadcrumbs(array(
'template'=>'product_breadcrumbs_new.html',
));
echo $product['html'];
?>
<div class="menu-slideshow">
<?php
perch_blog_custom(array(
'category' => array("en-eu/case-studies"),
'category-match' => 'all',
'count' => 3,
'template' => 'casestudy_image.html',
'sort' => 'postDateTime',
'sort-order' => 'DESC',
'blog' => 'en-eu',
));
?>
<div class="holder">
<div class="imageblock__overlay-nobg-mobile">
<div class="container">
<div class="holder__section">
<div class="caption background">
<h2 class="c500 beta">Case Studies</h2>
<?php
perch_blog_custom(array(
'category' => array("en-eu/case-studies"),
'category-match' => 'all',
'count' => 3,
'template' => 'casestudy_title.html',
'sort' => 'postDateTime',
'sort-order' => 'DESC',
'blog' => 'en-eu',
));
perch_blog_custom(array(
'category' => array("en-eu/case-studies"),
'category-match' => 'all',
'count' => 3,
'template' => 'casestudy_in_list.html',
'sort' => 'postDateTime',
'sort-order' => 'DESC',
'blog' => 'en-eu',
));
?>
<a href="<?php echo '/en-eu/news/category/case-studies'; ?>" class="btn btn__round">
More Case Studies <i class="icon icon-menu"></i>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
/**
* Include some related products.
* Similar to what we have done on Chicopee Americas but need to come back for languages
* Within this template is the title and sub title but language needs to change somehow
*/
echo '<div class="section foreground">';
echo '<div class="container">';
/**
* Show Related Heading Region
*/
perch_content_create('Related Heading', array(
'template' => '_page_heading.html',
'multiple' => false,
));
perch_content_custom('Related Heading', array(
'template' => '_page_heading.html',
));
/**
* Show Related Products Options
*/
perch_collection('products', [
'template' => 'products/_related_products_v2.html',
'filter' => 'slug',
'value' => perch_get('s'),
]);
/**
* Show download product sheet and order sample buttons
*/
perch_collection('products', [
'template' => 'products/_download_product_sheet.html',
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('s'),
'count' => 1,
]);
echo '</div>';
echo '</div>';
} else {
/**
* Below is the product listing page for Foodservice
* Anything wrapped in the else statement is within here
*/
PerchSystem::set_var('home', REGION);
perch_pages_breadcrumbs();
echo '<div class="section foreground">';
echo '<div class="container clear">';
/**
* Include the Page Heading section.
* To give you an example, Its the title and sub title at the top of products listing
*/
perch_content_create('Page Heading', array(
'template' => '_page_heading.html',
'multiple' => false,
));
perch_content_custom('Page Heading', array(
'template' => '_page_heading.html',
));
perch_layout('filters/applied-filters-eu');
/**
* Include the Filters Panel on the left side.
* Template is located global/filters_left
*/
echo '<div class="col-product__filter hide">';
//perch_layout('filters/eu_products');
echo '</div>';
$pagetitle = perch_pages_title(true);
$pagetitle = strtolower($pagetitle);
PerchSystem::set_var('pagetitle', $pagetitle);
// List of Yes/No filters
$filterYesNo = array(
'heatresistance_fs',
'fcc_fs',
'antibacterial_fs',
'biodegradable_fs',
'floor_cleaning_bc',
'microfibre_bc',
'biodegradable_bc',
'heatresistance_i',
'silicon_free_i',
'low_lint_i',
'low_lint_hc',
'bacterial_removal_hc',
'floor_cleaning_hc',
'impregnated_hc',
'low_lint_am',
'solvent_compatible_am',
'silicon_free_am',
'negligible_static_am',
'low_lint_as',
'solvent_compatible_as',
'silicon_free_as',
'negligible_static_as',
);
$filterCheckboxes = array(
'process_solvent-wiping_am',
'process_sealer-line_am',
'process_tack-wiping_am',
'process_general_am',
'process_polishing_am',
'process_solvent-wiping_as',
'process_sealer-line_as',
'process_tack-wiping_as',
'process_general_as',
'process_polishing_as',
);
// List of Slider filters
$filterSlider = array(
'tack_level_am',
'tack_level_as',
);
$filterAbsorbency = array(
'absorbency_fs',
'wipe_dry_fs',
'durability_fs',
'particle_pick_up_fs',
'durability_bc',
'dust_pick_up_bc',
'absorbency_i',
'wipe_dry_i',
'durability_i',
'particle_pick_up_i',
'absorbency_hc',
'durability_hc',
'wipe_dry_hc',
'particle_pick_up_hc',
'durability_am',
'particle_pick_up_am',
'durability_as',
'particle_pick_up_as',
);
// Create an empty array ready to add our filters to
$filters = array();
// Loop through checkboxes and see if it was passed in URL
foreach ($filterCheckboxes as $key) {
if (perch_get($key)) {
$filters[] = array(
'filter' => $key,
'match' => 'eq',
'value' => 1
);
}
}
// Loop through yes/no filters and see if it was passed in the URL
foreach ($filterYesNo as $key) {
if (perch_get($key)) {
$filters[] = array(
'filter' => $key,
'match' => 'eq',
'value' => ( (perch_get($key) == 'on') ? 'Yes' : 'No' )
);
}
}
// Loop through Slider filters
foreach ($filterSlider as $key) {
if (perch_get($key) && perch_get($key) > 1) {
$value = 'Good';
if (perch_get($key) == 3) {
$value = 'Better';
} elseif (perch_get($key) == 4) {
$value = 'Best';
}
$filters[] = array(
'filter' => $key,
'match' => 'eq',
'value' => $value
);
}
}
// Loop through Slider filters (different keys than generic ones above)
foreach ($filterAbsorbency as $key) {
if (perch_get($key) && perch_get($key) > 1) {
$value = 'off';
if (perch_get($key) == 2) {
$value = 'Better';
} if (perch_get($key) == 3) {
$value = 'Best';
}
$filters[] = array(
'filter' => $key,
'match' => 'eq',
'value' => $value
);
}
}
// Unique dropdown input
if (perch_get('machine_washable_select_fs')) {
$filters[] = array(
'filter' => 'machine_washable_select_fs',
'match' => 'eq',
'value' => perch_get('machine_washable_select_fs')
);
}
if (perch_get('machine_washable_select_bc')) {
$filters[] = array(
'filter' => 'machine_washable_select_bc',
'match' => 'eq',
'value' => perch_get('machine_washable_select_bc')
);
}
if (perch_get('machine_washable_select_i')) {
$filters[] = array(
'filter' => 'machine_washable_select_i',
'match' => 'eq',
'value' => perch_get('machine_washable_select_i')
);
}
if (perch_get('color_coded_cleaning_fs')) {
$filters[] = array(
'filter' => 'color_coded_cleaning_fs',
'match' => 'eq',
'value' => perch_get('color_coded_cleaning_fs')
);
}
if (perch_get('color_coded_cleaning_hc')) {
$filters[] = array(
'filter' => 'color_coded_cleaning_hc',
'match' => 'eq',
'value' => perch_get('color_coded_cleaning_hc')
);
}
// Unset the filters if none are used
if (!count($filters)) {
$filters = false;
}
//echo '<pre>';echo print_r($filters, true);echo '</pre>';
//echo '<pre>';echo print_r($_SERVER, true);echo '</pre>';
PerchSystem::set_var('home', REGION);
echo '<div class="col-product auto no-float">';
perch_collection('products', [
'template' => 'products/products_list.html',
'filter' => $filters,
]);
echo '</div>';
echo "</div>";
echo "</div>";
/**
* Include the social section for the US.
* You can find this in tempates/layouts/global/social
* If variable $reversed is set to TRUE
* it will set a white background with reversed input fields
*/
perch_layout('global/social', array(
'reversed' => true
));
}
/**
* Include the footer.
* You can find this in tempates/layouts/global
* If variable $reversed is set to TRUE
* it will set a grey background
*/
perch_layout('global/footer', array(
'reversed' => true,
'sharing' => true,
));
?>
Here is my products list template
<perch:before>
<!-- <div class="col-product"> -->
<ul class="product-list">
</perch:before>
<li class="product-list__item">
<a href="<perch:content id="pagetitle" type="hidden" />/<perch:content id="slug" type="slug" for="title" editable="true" indelible="true" label="Slug" />" class="product-list__thumb">
<img src="<perch:if exists="mainimage"><perch:content type="image" id="mainimage" width="305" height="223" crop="true" bucket="products" /><perch:else />/assets/img/no-image-available-314px.jpg</perch:if>" alt="<perch:content id="title" type="text" />">
</a>
<div class="product-list__group<perch:if not-exists="artno"> product-list__group--nomin</perch:if>">
<h3 class="c500 delta">
<a href="<perch:content id="pagetitle" type="hidden" />/<perch:content id="slug" type="slug" for="title" editable="true" indelible="true" label="Slug" />" class="primary product-list__group--link">
<perch:content id="title" type="text" />
</a>
</h3>
<perch:if exists="artno">
<span class="a350 zeta caps">
SKU #S: <perch:content type="text" id="artno" />
</span>
</perch:if>
</div>
<!-- <a href="/<perch:content id="home" type="hidden" />/product-sample?title=<perch:content id="title" />&segment=<perch:content id="segment" type="hidden" />" class="c700 zeta caps align-center graychateau product-list__btn">
<i class="icon icon-request-sample beta"></i>
Request a free sample
<i class="icon icon-chevron-right"></i>
</a> -->
</li>
<perch:after>
</ul>
<!-- </div> -->
</perch:after>
<perch:noresults>
<h2 class="primary c500 delta">There are no products matching your criteria</h2>
</perch:noresults>
Every other page is fine from what I can see
Thanks
Can you switch to development mode so that the debug output has timings?
Here we go
Looks like you're getting pretty bad performance out of your
perch2_collection_index
table. It looks like you've got quite a lot of rows in that table for the amount of content.Are you using relationships at all? Are any of those potentially circular?
Are you indexing all fields? It's useful to add
no-index="true"
to any fields that you don't need to sort or filter by.I have just looked at the table in the DB and there is over 82,000 rows.
I'm not sure what you mean when you say
Are you using relationships at all? Are any of those potentially circular?
But basically here is the live product page - https://chicopee.com/en-eu/products
In the template I can select which category each product belongs to i.e Foodservice, Building Care etc.
But each Category has their own filter settings which are listed in the template.
Do I need to add
no-index="true"
to all fields in the product.html template except for the title and filter settings?By "are you using relationships" I mean do you have any relationships configured in your template? It's a Runway feature: https://docs.grabaperch.com/runway/relationships/
Ahh ok, Yes we have some related products displaying on the detail page, In the product.html template it outputs a list of the products from the same collection.
The content editor can choose some products that relates to the current one in view. Would this be affecting the list page load time? If so how do I get around this?
Thanks Barry
So is the relationship back against itself? I think that would cause your problems.
When an item is indexed, the related items are indexed against it. By relating something to itself, you end up with a circular reference.
Can you add
no-index="true"
onto yourperch:related
tag? If you then click Save a few times you should see the number of rows in that index table drop dramatically. (I think!)Unfortunately, that didn't solve it.
How many rows do you have now?
Previously I mentioned 82,000 rows but this was meant to be 820,000 rows. Now its 847,029 rows (But we have added a few new products this week)
I must mention that we have two collections in place one that showcases European Products and One that showcases US products (all completely separate)
I think it's too soon to say that hasn't had an impact. Provided this isn't a live site, you should be able to truncate the
perch2_collection_index
table and then save content to rebuild it.This is a live site. So if I empty this table will it get rebuilt by logging into the CMS again? Or will it delete everything?
No, don't do that on your live site.
I'd suggest importing the database to your dev environment and testing there. The index is generated when content is saved, nothing to do with logging in.
Ok so have an update on this. I removed the related products section from the template (HTML above). Now the products are loading pretty fast.
The amount of rows on the
perch2_collection_index
table is still 834,000 rows though.I'd expect items to drop out of
perch2_collection_index
over time as they are removed from the undo history stack.