Show header on search results if value is true

8 posts by 2 authors in: Forums > CMS Builder
Last Post: January 27, 2016   (RSS)

I have a customized search page:

http://www.axislighting.com/CMS/search_products-test.php

If quickship is selected above the results I would like to show some content. How can I write an if then statement that if 'quick_ship=quick_ship' then show this content?

This page shows all the results of quickship. On this page, I want to show some content above the search results. I want it to show only if the quick ship are selected.

http://www.axislighting.com/CMS/search_products-test.php?quick_ship=quick_ship

I am attaching both pages. The first is the search products which shows the options to select to refine your search. The results page is where the results refresh as you select.

By Damon - January 21, 2016

Hi,

Here is some code that will grab the variable, compare it and then output content if it matches: 

<?php if(@$_GET["quick_ship"] == "quick_ship") : ?>
   <p><strong>Display Quick Ship content</strong></p>
<?php endif; ?>

Let me know if this works for you.

Cheers,
Damon Edis - interactivetools.com

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

I got this to work like this

<?php if(@$_GET["quickship"]) : ?>

<p> text area here</p>

<?php endif; ?>

Now they only want this to show when you click on this page: http://www.axislighting.com/CMS/search_products-qs.php and hit the radio button QuickShip

They want me to add to the menu dropdowns these results which are filtered by a field called mounting. see this page the dropdowns (http://www.axislighting.com/CMS/header_footer.php - under the quickship, there are options 'all products' THIS SHOULD SHOW HEADER, then there is recessed, pendant, surface, THESE SHOULD NOT SHOW HEADER)

So on these pages:

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=recessed

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=pendant

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=surface

They dont want the header. How do I write

<?php if(@$_GET["quick_ship"] & ['mounting' ]?> mounting not selected...then show the header.

By Damon - January 27, 2016

Hi,

Here is the code you are after:

<?php if((@$_REQUEST["quick_ship"]) && (@!$_GET["mounting"])); ?>
  ....show the header
<?php endif; ?>

If there IS a quick_ship value and the ISN't a mounting value, the if statement will run.

Let me know if this works for you.

Cheers,
Damon Edis - interactivetools.com

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

By Damon - January 27, 2016

Use this code:

<?php if((@$_REQUEST["quick_ship"]) && (@!$_REQUEST["mounting"])) : ?>

I changed semi-colon to colon.

Cheers,
Damon Edis - interactivetools.com

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

By Damon - January 27, 2016

Hi again,

Ok, I updated the code run the IF statement (show header bar) in either of these queries:
?quick_ship=quickship
?quick_ship=quickship&mounting=

<?php if((@$_REQUEST["quick_ship"]) && (@$_REQUEST["mounting"] == "")): ?>

Cheers,
Damon Edis - interactivetools.com

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