Hi,
I am creating a site using search_external.php showing on a wordpress site.I am trying to bring the merchant name as a variable, which comes from a custom field in wordpress.
Custom field = "Merchant Name", I would like to then show products using merchant:Merchant Name as the search term. I have also added a check to see if the store name exists otherwise nothing will show.
I do not believe I have got my variable correct - any ideas?
<?php if( get_field('store_name') ): ?>
<?php
$variable = "Merchant Name";
$external_baseHREF = "http://www.example.com/store/";
$external_path = "/home/example/public_html/store/";
$_GET["q"] = "merchant: $variable";
require($external_path."searchExternal.php");
?>
<?php endif; ?>
Thanks
Richard
Hi Richard,
You need to capture the return value of get_field("store_name") into your merchant name variable (e.g. $merchant) and then use this as the value for $_GET["q"] using merchant:Merchant Name (no spaces between merchant: and the name) - have a go with something like:
<?php if ($merchant = get_field('store_name')): ?>
<?php
$external_baseHREF = "http://www.example.com/store/";
$external_path = "/home/example/public_html/store/";
$_GET["q"] = "merchant:".$merchant;
require($external_path."searchExternal.php");
?>
<?php endif; ?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com