Hi David
Trying to think of a way of getting info for merchant on the top of a page when it is just for that merchant, both on the search and merchant search page. Another way would be a link in the results that link to merchant info. Is this possible.
Brent
Hi
That works great, could this also be extended to the filter pages ie
search.php?q=shoe&merchantFilter[]=Barratts
Thanks
Brent
Hi David
That worked great, could this be extended to the filter system you wrote recently ie
search.php?q=shoe&merchantFilter[]=Barratts
Brent
Hi Brent,
Sure - to show the merchantinfo/ text for both merchant: queries or any merchant in merchantFilter, use the following in place of the above replacement:
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
elseif(count($merchantFilter))
{
foreach($merchantFilter as $merchant)
{
$merchantinfoFilename = "merchantinfo/".$merchant.".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
}
require("html/searchresults.php");
Cheers,
David.
--
PriceTapestry.com
Greetings,
How would merchant info be shown under the merchant name and before the "Displaying 1 of xxxx" and not after the "Sort by..."?
Thanks!
Hi,
Rather than inserting the modification:
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
elseif(count($merchantFilter))
{
foreach($merchantFilter as $merchant)
{
$merchantinfoFilename = "merchantinfo/".$merchant.".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
}
...before:
require("html/searchresults.php");
..instead, insert the code immediately before:
require("html/banner.php");
...and that will move the included content above the search results header...
Cheers,
David.
--
PriceTapestry.com
Hi David,
That places the merchant info text ABOVE the merchant name. Any chance of putting it just below the merchant name?
Thanks!
Hi there,
Ah yes - html/banner.php displays both the H2 and H3 areas, so to display the merchant info inbetween the two, the mod needs to go in that file - with a slight change since banner.php is included on other pages also!
In that file, look for the following code at line 5:
<?php if (isset($banner["h3"])) : ?>
...and REPLACE with:
<?php
if (strpos($_SERVER["PHP_SELF"],"search.php")!==FALSE)
{
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
elseif(count($merchantFilter))
{
foreach($merchantFilter as $merchant)
{
$merchantinfoFilename = "merchantinfo/".$merchant.".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
}
}
?>
<?php if (isset($banner["h3"])) : ?>
Cheers,
David.
--
PriceTapestry.com
Hi David,
I just found a new Notice, When using this code:
---------------------------------------------------
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
elseif(count($merchantFilter))
{
foreach($merchantFilter as $merchant)
{
$merchantinfoFilename = "merchantinfo/".$merchant.".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
}
---------------------------------------------------
I got everything working fine with that code on the first page of results of any merchant, but if I click next, or any number of the navigation links, or do any other search, I get this Notice.
Notice: Undefined variable: merchantFilter in F:\xampp\htdocs\store\search.php on line 504
Line 504 on my search.php have this code:
elseif(count($merchantFilter))
Remember that I only get Notice when I remove the "// error_reporting(E_ERROR);"
Otherwise I don't see no Notice errors and the code works as it's.
I was thinking that maybe it's some "isset" mising somewhere?
Thanks.
Hi,
That will be this line:
elseif(count($merchantFilter))
...replace with:
elseif(isset($merchantFilter) && count($merchantFilter))
Cheers!
David.
--
PriceTapestry.com
Hi David,
Apologies for the delay in responding to your assistance.
Unfortunately, this adds the merchant info directly after "(Displaying 1 to xx of xxx)" and not directly after the merchant name itself [in between the merchant name and (Displaying 1 to xx of xxx)].
Thanks!
Hi,
It can be combined with the H2 banner, no problem! Instead of making the change in html/banner.php, back in search.php look for where the first part of that line is generated by this code around line 277:
$banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong> ";
...and REPLACE with:
$banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong> ";
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
$banner["h2"] .= file_get_contents($merchantinfoFilename);
}
}
elseif(count($merchantFilter))
{
foreach($merchantFilter as $merchant)
{
$merchantinfoFilename = "merchantinfo/".$merchant.".html";
if (file_exists($merchantinfoFilename))
{
$banner["h2"] .= file_get_contents($merchantinfoFilename);
}
}
}
Hope i've understood correctly, let me know if still not quite right of course!
Cheers,
David.
--
PriceTapestry.com
Hi Brent,
Very easy to do using some merchant info .html files, and then to call them in above the search results for merchant: queries.
First, create a folder on your site:
merchantinfo/
And inside that folder, create files with the exact merchant name (including spaces) as it appears on your site, plus .html, for example
merchantinfo/Merchant Name.html
Then, in search.php, look for where the search results are included towards the end of the file with the following code:
require("html/searchresults.php");
...and REPLACE that with:
if (($parts[0]=="merchant") && ($page==1))
{
$merchantinfoFilename = "merchantinfo/".$parts[1].".html";
if (file_exists($merchantinfoFilename))
{
require($merchantinfoFilename);
}
}
require("html/searchresults.php");
Hope this helps!
Cheers,
David.
--
PriceTapestry.com