Viewer Search Engines: No records were found!
10 posts by 2 authors in: Forums > CMS Builder
Last Post: April 20, 2011 (RSS)
Any idea why this is, please?
======
Display code in plantsSubcategory.php:
<?php foreach ($product_subcategoriesRecords as $record): ?>
<p><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
Main Category: <?php echo $record['main_category'] ?><br/>
Light: <?php echo $record['light'] ?><br/>
Plant Care: <?php echo $record['content'] ?><br/>
Facts: <?php echo $record['facts'] ?><br/>
<!-- STEP 2a: Display Uploads for field 'main_image' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['main_image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php elseif ($upload['isImage']): ?>
<?php else: ?>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
<hr/>
<?php endforeach ?>
<?php if (!$product_subcategoriesRecords): ?>
<p>No records were found!</p>
<?php endif ?>
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
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!
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.
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
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!
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
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.
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
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!
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?
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
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!
http://thecoachesloft.com/plantsSubcategory.php?main_category=10
http://thecoachesloft.com/categoriesDetails.php?Clematis-2
Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net