Forum

Thread tagged as: Problem, Shop

No search results found

I'm trying to create a search for products and the results are coming back with no results found. Can someone let me know what I'm doing wrong? Thanks! search-results.php

<?php
  $query = perch_get('q');
  perch_content_search($query, array(

    'template'=>'search-result.html'
  ));
?>

search result.html

<perch:before>
    <h1>Search results for “<perch:search id="search_key" />”</h1>

    <perch:if exists="paging">
        <p><perch:search id="total" /> results</p>
    </perch:if>
        <ul>
</perch:before>

        <li class="<perch:search id="perch_item_odd" />">
            <h2><a href="<perch:search id="result_url" />"><perch:search id="result_title" /></a></h2>
            <perch:if exists="result_excerpt"><p class="excerpt">…<perch:search id="result_excerpt" encode="false" />…</p></perch:if>
            <p><a href="<perch:search id="result_url" />">
                <perch:if exists="result_pageNavText">
                    <perch:search id="result_pageNavText" />
                <perch:else />
                    <perch:search id="result_url" />
                </perch:if>
                </a></p>
        </li>

<perch:after>
    </ul>

    <perch:if exists="paging">
        <div class="paging">
            Page <perch:search id="current_page" /> of <perch:search id="number_of_pages" />
            <perch:if exists="not_first_page">
                <a href="<perch:search id="prev_url" encode="false" />">Previous</a>
            </perch:if>
            <perch:if exists="not_last_page">
                <a href="<perch:search id="next_url" encode="false" />">Next</a>
            </perch:if>
        </div>
    </perch:if>
</perch:after>


<perch:noresults>
    <perch:if exists="search_key">
        <h1>Search results for “<perch:search id="search_key" />”</h1>
    <perch:else />
        <h1>Search</h1>
    </perch:if>
    <perch:if exists="search_key">
        <p>Sorry, there are no results for “<perch:search id="search_key" />”.</p>
    </perch:if>
</perch:noresults>

search-bar.php

<?php perch_search_form(); ?>

search-form.html

<div class="exp-search"><perch:form id="search" method="get" action="search-results.php">
    <div>
        <perch:input type="search" id="q"  class="exp-search-input" placeholder="Search"/>
        <perch:input type="submit" value="Go"  class="exp-search-submit"/>
    </div>
</perch:form>
</div>


Jade Marling

Jade Marling 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How many products are you searching?

I want to be able to search throughout the whole library of products. At the moment I've only got about ten products outputted but there will be a few hundred

Drew McLellan

Drew McLellan 2638 points
Perch Support

It could be that you've not got enough content in there yet to make the search effective.

So if I try adding more products it should work? Thanks, I'll try that!

Okay, so I've added more products on there, so there are about 100 product on there and it's still not working

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug, what does it output?

Debug Message - Perch 3.0
[1] SELECT * FROM perch3_members_sessions WHERE sessionID='b0cb41a098f6dff6059f5a8db124571c45729780' AND sessionHttpFootprint='7bdb365d81642107691e0c0a79e3ec12a878a96b' AND sessionExpires>'2017-05-05 07:52:48' LIMIT 1
User is logged in
[1] SELECT * FROM perch3_pages WHERE pagePath='/search-results.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=35
[1] SELECT * FROM perch3_shop_cart WHERE cartID=35
Using template: /templates/search/search-form.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Using cart from cache.
[26] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Using template: /addons/apps/perch_shop/templates/shop/cart/mini-cart.html
[65] SELECT DISTINCT idx.itemID FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' AND ((idx.indexKey='status' AND idx.indexValue='1')) GROUP BY idx.itemID HAVING COUNT(idx.itemID)=1
[10] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='brandID' AND idx2.indexKey='title' AND idx.itemID IN ('1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '3', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '4', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '5', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '6', '60', '61', '62', '63', '64', '65', '7', '8', '9') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, brandID ) as tbl WHERE (brandDeleted IS NULL) GROUP BY itemID, sortval ORDER BY RAND() LIMIT 0, 10
[10] Using template: /addons/apps/perch_shop/templates/shop/brands/list2.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Search term: mob
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('mob') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('mob') OR MATCH(ci.itemSearch) AGAINST('mob') ) AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, MATCH(s.searchBody) AGAINST('mob') AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND MATCH(s.searchBody) AGAINST('mob') AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score DESC LIMIT 0, 10
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, 0-(LENGTH(r.regionPage)-LENGTH(REPLACE(r.regionPage, '/', ''))) AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND ci.itemSearch REGEXP '[[:<:]]mob[[:>:]]' AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, p.stock_level AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, p.productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND ( concat(" ", s.searchBody, " ") REGEXP '[[:<:]]mob[[:>:]]' ) AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score ASC LIMIT 0, 10
[0] SELECT FOUND_ROWS() AS `count`
Using template: /templates/search/search-result.html

Array
(
    [type] => 8
    [message] => Use of undefined constant RAND - assumed 'RAND'
    [file] => /home/linweb42/d/dryhome.web-design.wales/user/htdocs/includes/navigation.php
    [line] => 72
)

this is from the search of 'mob' (there's a product called mob cap)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have products that include the word 'mob' ?

It's too short a search string for the more advanced algorithm, and the basic search will only match if that's a word that is used.

Yes, there is a product called Mob Cap. I have tried Mob Cap and still nothing

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you fixed the error you're getting about the use of RAND ?

I have yes

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, what does the debug say now?

Debug Message - Perch 3.0
[1] SELECT * FROM perch3_members_sessions WHERE sessionID='b0cb41a098f6dff6059f5a8db124571c45729780' AND sessionHttpFootprint='7bdb365d81642107691e0c0a79e3ec12a878a96b' AND sessionExpires>'2017-05-05 15:58:54' LIMIT 1
User is logged in
[1] SELECT * FROM perch3_pages WHERE pagePath='/search-results.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=35
[1] SELECT * FROM perch3_shop_cart WHERE cartID=35
Using template: /templates/search/search-form.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Using cart from cache.
[3] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=18 AND productDeleted IS NULL ORDER BY productOrder ASC
[2] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=18 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=2 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[1] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='18' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='2' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[17] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='18' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[26] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] Using template: /addons/apps/perch_shop/templates/shop/cart/mini-cart.html
[65] SELECT DISTINCT idx.itemID FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' AND ((idx.indexKey='status' AND idx.indexValue='1')) GROUP BY idx.itemID HAVING COUNT(idx.itemID)=1
[10] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='brandID' AND idx2.indexKey='title' AND idx.itemID IN ('1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '3', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '4', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '5', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '6', '60', '61', '62', '63', '64', '65', '7', '8', '9') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, brandID ) as tbl WHERE (brandDeleted IS NULL) GROUP BY itemID, sortval ORDER BY RAND() LIMIT 0, 10
[10] Using template: /addons/apps/perch_shop/templates/shop/brands/list2.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Search term: mob
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('mob') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('mob') OR MATCH(ci.itemSearch) AGAINST('mob') ) AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, MATCH(s.searchBody) AGAINST('mob') AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND MATCH(s.searchBody) AGAINST('mob') AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score DESC LIMIT 0, 10
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, 0-(LENGTH(r.regionPage)-LENGTH(REPLACE(r.regionPage, '/', ''))) AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND ci.itemSearch REGEXP '[[:<:]]mob[[:>:]]' AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, p.stock_level AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, p.productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND ( concat(" ", s.searchBody, " ") REGEXP '[[:<:]]mob[[:>:]]' ) AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score ASC LIMIT 0, 10
[0] SELECT FOUND_ROWS() AS `count`
Using template: /templates/search/search-result.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's certainly finding no matches. Have you tried other search terms?

Yes, here is the debug for another search

Debug Message - Perch 3.0
[1] SELECT * FROM perch3_pages WHERE pagePath='/search-results.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=37
[1] SELECT * FROM perch3_shop_cart WHERE cartID=37
Using template: /templates/search/search-form.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Using cart from cache.
[26] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Using template: /addons/apps/perch_shop/templates/shop/cart/mini-cart.html
Using template: /addons/apps/perch_members/templates/members/login/mini-login.html
[65] SELECT DISTINCT idx.itemID FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' AND ((idx.indexKey='status' AND idx.indexValue='1')) GROUP BY idx.itemID HAVING COUNT(idx.itemID)=1
[10] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='brandID' AND idx2.indexKey='title' AND idx.itemID IN ('1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '3', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '4', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '5', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '6', '60', '61', '62', '63', '64', '65', '7', '8', '9') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, brandID ) as tbl WHERE (brandDeleted IS NULL) GROUP BY itemID, sortval ORDER BY RAND() LIMIT 0, 10
[10] Using template: /addons/apps/perch_shop/templates/shop/brands/list2.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Search term: Alphachem
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('Alphachem') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('Alphachem') OR MATCH(ci.itemSearch) AGAINST('Alphachem') ) AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, MATCH(s.searchBody) AGAINST('Alphachem') AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND MATCH(s.searchBody) AGAINST('Alphachem') AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score DESC LIMIT 0, 10
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, 0-(LENGTH(r.regionPage)-LENGTH(REPLACE(r.regionPage, '/', ''))) AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND ci.itemSearch REGEXP '[[:<:]]Alphachem[[:>:]]' AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, p.stock_level AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, p.productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND ( concat(" ", s.searchBody, " ") REGEXP '[[:<:]]Alphachem[[:>:]]' ) AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score ASC LIMIT 0, 10
[0] SELECT FOUND_ROWS() AS `count`
Using template: /templates/search/search-result.html

Array
(
    [type] => 8
    [message] => Use of undefined constant template - assumed 'template'
    [file] => /home/linweb42/d/dryhome.web-design.wales/user/htdocs/includes/navigation.php
    [line] => 48
)
Drew McLellan

Drew McLellan 2638 points
Perch Support

You're still getting errors there, and you're still a few versions behind. You'll want to address those to make sure you're in the best position to troubleshoot.

What are the errors?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Array
(
    [type] => 8
    [message] => Use of undefined constant template - assumed 'template'
    [file] => /home/linweb42/d/dryhome.web-design.wales/user/htdocs/includes/navigation.php
    [line] => 48
)

Now that's fixed,

Debug Message - Perch 3.0
[1] SELECT * FROM perch3_pages WHERE pagePath='/search-results.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=37
[1] SELECT * FROM perch3_shop_cart WHERE cartID=37
Using template: /templates/search/search-form.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Using cart from cache.
[26] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Using template: /addons/apps/perch_shop/templates/shop/cart/mini-cart.html
Using template: /addons/apps/perch_members/templates/members/login/mini-login.html
[65] SELECT DISTINCT idx.itemID FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' AND ((idx.indexKey='status' AND idx.indexValue='1')) GROUP BY idx.itemID HAVING COUNT(idx.itemID)=1
[10] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='brandID' AND idx2.indexKey='title' AND idx.itemID IN ('1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '3', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '4', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '5', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '6', '60', '61', '62', '63', '64', '65', '7', '8', '9') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, brandID ) as tbl WHERE (brandDeleted IS NULL) GROUP BY itemID, sortval ORDER BY RAND() LIMIT 0, 10
[10] Using template: /addons/apps/perch_shop/templates/shop/brands/list2.html
[0] SELECT setID FROM perch3_category_sets WHERE setSlug='' LIMIT 1
[12] SELECT main.* FROM perch3_categories main WHERE 1=1 AND (catPath REGEXP '[[:<:]]products\/?[[:>:]]' AND LENGTH(catTreePosition) - LENGTH(REPLACE(catTreePosition, "-", ""))=1) ORDER BY catTreePosition ASC
[12] Using template: /templates/categories/side-nav.html
Search term: Alphachem
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('Alphachem') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('Alphachem') OR MATCH(ci.itemSearch) AGAINST('Alphachem') ) AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, MATCH(s.searchBody) AGAINST('Alphachem') AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND MATCH(s.searchBody) AGAINST('Alphachem') AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score DESC LIMIT 0, 10
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, 0-(LENGTH(r.regionPage)-LENGTH(REPLACE(r.regionPage, '/', ''))) AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND ci.itemSearch REGEXP '[[:<:]]Alphachem[[:>:]]' AND r.regionPage LIKE '/%' UNION SELECT 'PerchShop_SearchHandler' AS source, p.stock_level AS score, p.title, p.productSlug, p.productDynamicFields, p.productTemplate, p.productID, "", "", "" FROM perch3_shop_search s, perch3_shop_products p WHERE p.productDeleted IS NULL AND p.productID=s.itemKey AND s.itemType='product' AND ( concat(" ", s.searchBody, " ") REGEXP '[[:<:]]Alphachem[[:>:]]' ) AND p.productID IN ( SELECT itemID FROM perch3_shop_index WHERE itemKey='productID' AND itemID=p.productID AND indexKey='status' AND indexValue=1 ) ORDER BY score ASC LIMIT 0, 10
[0] SELECT FOUND_ROWS() AS `count`
Using template: /templates/search/search-result.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great. Let me know how things are looking once you're on the current version.