Possibly a 'sortby' error?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 29, 2011   (RSS)

By Wolf-E - July 22, 2011 - edited: July 22, 2011

Hi. I have a real estate site i'm building with CMS, mostly okay (detail pages/fulllist page show fine). I have 3 columns; left is for displaying 'new properties', the right column for displaying 'latest price movers'. (the main center column is for text and such like)

But, when i add a new (test) listing to the 'price movers' category, it shows up in both columns, instead of just the 'price movers' column alone. I've gone through the forums and experimented a bit with the code, but so far no luck. Here's the code:

(above <header> as per usual)

// load latest movers records
list($moverspropertyRecords, $moverspropertyMetaData) = getRecords(array(
'tableName' => 'property',
'perPage' => '6',
'orderBy' => 'updatedDate DESC, new_price',
'allowSearch' => '0',
));


// load records
list($propertyRecords, $propertyMetaData) = getRecords(array(
'tableName' => 'property',
'perPage' => '6',
'orderBy' => 'date DESC',
'allowSearch' => '0',
));


and in the <body>

<!--left hand column listings new-->

<?php foreach ($propertyRecords as $record): ?>
<div align="center">
<?php foreach ($record['property_images'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="140px" height="80px alt="" />
<?php break ?>
<?php endforeach ?></div>
<h2>&pound;<?php echo number_format($record['price']); ?></h2>
<h3> <?php echo $record['address'] ?></h3> <br/>
Listed: <?php echo date("D, M jS, Y ", strtotime($record['date'])) ?><br/>
Read Full Details: <a href="<?php echo $record['_link'] ?>"><?php echo $record['address'] ?> -> -></a><br/>
<hr style="color:#840000; background-color:#840000;height:1px;border:none;" />
<?php endforeach ?>



<?php if ($propertyMetaData['invalidPageNum']): ?>
Results page '<?php echo $propertyMetaData['page']?>' not found, <a href="<?php echo $propertyMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$propertyRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /end left hand column listings new -->


<!--right side content price movers-->


<?php foreach ($moverspropertyRecords as $record): ?>
<h2>&pound;<?php echo number_format($record['price']); ?></h2>
<?php if($record['new_price']) : ?>
<h4> New Price! &pound;<?php echo number_format($record['new_price']) ?></h4>
<?php endif; ?>
<?php echo $record['address'] ?>
<p>&nbsp</p>
<div align="center">
<?php foreach ($record['property_images'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="140px" height="80px alt="" />
<?php break ?>
<?php endforeach ?>

Any ideas or thoughts to make this work welcome!

Re: [Jason] Possibly a 'sortby' error?

By Wolf-E - July 29, 2011

Thanks Jason.

That worked well and the sort now looks a lot tidier. Appreciate the advice.

Cheers ~ Wolf-E

[:)]