Database Results Loaded AFTER Search Submitted?

grippatank 01 Dec, 2010
Hello....

I am new to chrono connectivity - but love the component!! I have spent an hour searching for the answer, but alias cannot find a clear answer on the forum. (Sorry for i am being blind!)

Please check out http://www.grippatank.co.uk/component/option,com_chronoconnectivity/Itemid,64/.

Everything works great = but i need help with the following:

I want the postcode results to appear ONLY after the search has been submitted. I DO NOT want all the results to load as soon as you navigate to the page. The user should type in his postcode: e.g SG19 3HH or SG19 & then the result/results would THEN show.

I have noticed suggestions of vague WHERE Clauses etc, but i cannot find any clearer information of where to/how to implement this.

PLEASE HELP!!

P.s suggestions for site are always welcome!!
GreyHead 01 Dec, 2010
Hi grippatank,

We talked about something like this a week or so ago. I think that the simplest answer is to check for a result in the WHERE box and if there isn't one then set a where clause that will show no results e.g.
WHERE `postcode` = 'BF01 0AA';


Bob
grippatank 02 Dec, 2010
Hi Greyhead,
Thanks for your reply.

In the ChronoConnectivity I have set up..
I have:
<?php
$Postcode = JRequest::getString('Postcode', '', 'post');
if ( $Postcode ) {
echo " WHERE `Postcode` LIKE '%$Postcode%' ";
}
?>

However if i change the WHERE to your suggestion, aall the postcodes still load... any suggestions?

Should i have a menu link to a chronoform with a search bar that then loads the chronoconnectivity tables relevant to the form search?
GreyHead 02 Dec, 2010
Hi grippatank,

It just needs something that is always false. Maybe the capital P is needed. Try:
<?php
$Postcode = JRequest::getString('Postcode', '', 'post');
if ( $Postcode ) {
  echo " WHERE `Postcode` LIKE '%$Postcode%' ";
} else {
  echo "WHERE `Postcode` = 'BF01 0AA' ";
}
?>

Bob
grippatank 02 Dec, 2010
Hi Bob,

Ok that works - thank you very much.

However - the error message for 'no postcodes found' is shown.

'Sorry, the UK postcode entered could not be found in our shipping database, please contact us for further assistance.'

However, i only want that to show the error mesaage if the user's postcode entered is incorrect.
GreyHead 02 Dec, 2010
Hi grippatank ,

Then I think you need to do something similar with the error message so that it is only shown if the 'Postcode' input is present.

Bob
This topic is locked and no more replies can be posted.