Viewer Search Engines: No records were found!

10 posts by 2 authors in: Forums > CMS Builder
Last Post: April 20, 2011   (RSS)

Re: [NigelGordijk] Viewer Search Engines: No records were found!

By Jason - April 19, 2011

Hi Nigel,

I did some testing on your page and what I found is the issue is with your URL. This URL:
http://thecoachesloft.com/plantsSubcategory.php?title=Vines
Will only search for record where their title = "Vines".

I first changed it to look for records with "vines" in the title like this:
http://thecoachesloft.com/plantsSubcategory.php?title_keyword=Vines

This outputs a single record. It is showing a main_category field to be 10. So this is most likely the record number for Vines in your "categories" section. If you change your URL to this:
http://thecoachesloft.com/plantsSubcategory.php?main_category=10

You get the 2 records you'd expect.

So what you need to do is on plants.php, output your links like this:

<p><a href="plantsSubcategory.php?main_category=<?php echo $record['num'] ?>"><?php echo $record['title'] ?></a></p>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Viewer Search Engines: No records were found!

Thanks for your help, Jason. That works perfectly!

Is there a way to get the subcategory heading on the subcategory page? No matter which section I'm in it always shows "Annual" at the top: http://thecoachesloft.com/plantsSubcategory.php?main_category=10 and http://thecoachesloft.com/plantsSubcategory.php?main_category=1.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Viewer Search Engines: No records were found!

By Jason - April 19, 2011

Hi Nigel,

Try this code:

// load records
list($categoriesRecords, $categoriesMetaData) = getRecords(array(
'tableName' => 'categories',
));

$categoriesRecord = @$categoriesRecords[0]; // get first record

$title = "";
foreach ($categoriesRecords as $category) {
if($category['num'] == @$_REQUEST['main_category']) {
$title = $category['title'];
}
}


Then you just need to output title

<TD CLASS="tdLowerHeadlineCell"><H1><?php echo $title; ?></H1></TD>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Viewer Search Engines: No records were found!

Worked perfectly! Thank you.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [Jason] Viewer Search Engines: No records were found!

By NigelGordijk - April 19, 2011 - edited: April 19, 2011

Hi, Jason. Same project, different issue.

On the subcategory list page - e.g. http://thecoachesloft.com/plantsSubcategory.php?main_category=10 I'd like to list all of the products that belong in that subcategory. At the moment I can only get the whole list to show, but I need to filter it so, in this case, only Abundance and Belle of Woking appear, where appropriate.

Clicking on one of the subcategory headings - such as Clematis - will take you to a page about that subcategory: http://thecoachesloft.com/categoriesDetails.php?Clematis-2. That's all working fine, but I need to have the same filtering system on this page, too.

This is in the head:

list($product_detailsRecords, $product_detailsMetaData) = getRecords(array(
'tableName' => 'product_details',
));


This is the code to display the (unfiltered) list:

<ul><?php foreach ($product_detailsRecords as $record): ?>
<li>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a>
<?php endforeach ?>

<?php if (!$product_detailsRecords): ?>
</li>
<?php endif ?></ul>


Is there an easy solution, or should I sign up for priority consulting?

Thanks.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Viewer Search Engines: No records were found!

By Jason - April 20, 2011

Hi Nigel,

What's happening here is because your query for $product_detailsRecords occurs outside your foreach loop, your list is just getting repeated.

Assuming that 'product_details' has a field called 'sub_category' and it's value is the "num" from the 'product_subcategories' section, you could try something like this:

<?php
list($product_detailsRecords, $product_detailsMetaData) = getRecords(array(
'tableName' => 'product_details',
'allowSearch' => false,
'where' => "sub_category = '". intval($record['num'])."'",
));
?>
<ul><?php foreach ($product_detailsRecords as $detailRecord): ?>
<li>
<a href="<?php echo $detailRecord['_link'] ?>"><?php echo $detailRecord['title'] ?></a>
<?php endforeach ?>

<?php if (!$product_detailsRecords): ?>
</li>
<?php endif ?></ul>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Viewer Search Engines: No records were found!

Hi, Jason.

In product_details there is a field called subcategory (no underscore), so the code I've used is as follows:

list($product_detailsRecords, $product_detailsMetaData) = getRecords(array(
'tableName' => 'product_details',
'allowSearch' => false,
'where' => "subcategory = '". intval($record['num'])."'",
));


However, now I'm getting an error message on http://thecoachesloft.com/plantsSubcategory.php?main_category=10:

"Notice: Undefined variable: record in /home/colourp1/public_html/plantsSubcategory.php on line 39"

Line 39 is

'where' => "subcategory = '". intval($record['num'])."'",

Any idea why, please?
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Viewer Search Engines: No records were found!

By Jason - April 20, 2011

Hi Nigel,

You have to make sure that this code is inside the foreach loop for $product_subcategoriesRecords

check that. If you're still getting an error, please re attach your .php file.

thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Viewer Search Engines: No records were found!

Ah, my mistake. I thought the code that loads the table was supposed to go in the head of the document, so I split the code you provided. Everything is working perfectly now. Thanks for your help.

http://thecoachesloft.com/plantsSubcategory.php?main_category=10
http://thecoachesloft.com/categoriesDetails.php?Clematis-2
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net