Hello David,
How can i create links
1.) from the footer to merchant, category and brand pages. I try using direct link example http://www.url.com/merchants.php on the footer but when i click to a particular merchant, it display no products.
2.) create image/logo of a merchant linking from index.php directly to product search result page of that merchant.
3.) how can i display the logo, list of categories and brands of a particular merchant on the products search result page. Instances include with limited or non limited categories and brands.
thanks
jack
Hello David,
Thanks for your reply. Regarding no. 3.
I understand that when you do search from the search box it will appears multiple merchants showing variety of products, prices etc on the search result pages. That part is ok.
But what i intended to do is when i click to a particular merchant from the merchants.php page, it will show the search result page of that particular merchant with all its products. From there right above the "products search results merchant:abc:(showing 1 to 10 of 300)", i would like to display that merchant image, its list of categories and brands, address, email and the like( brief description). Something brief info of that merchant.
Btw, is it possible to have a full description of each merchant. Merchant information page showing address, email, operating hours, location, map, company info etc.
Hello Jack,
Let's look at the merchant's list of categories and brands because that is easy to add to the search results page when it is showing the results for merchant:abc:, based on the the code I recently posted in this thread.
To insert content above the point where "product search results....." is shown, look for the following towards the end of search.php:
require("html/searchform.php");
require("html/banner.php");
Inserting code between these two lines will output the content between the search box and the banner (the point at which "product search results...." is displayed).
Now, at this point within search.php, you can tell that you are displaying merchant results because the variable $parts[0] will be "merchant". The merchant name will be in $parts[1]. Therefore, combining this knowlege with the category and brand drop down code from the other thread (except not showing a drop-down), have a go with the following code. This can easily be converted into a list if you would rather display a list than have a drop down:
if ($parts[0] == "merchant")
{
print "<h3>".htmlentities($parts[1],ENT_QUOTES,$config_charset)."</h3>";
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` where merchant='".database_safe($parts[1])."' ORDER BY category";
if (database_querySelect($sql,$rows))
{
print "<form method='GET' action='".$config_baseHREF."search.php' />";
print "Categories available from this merchant: ";
print "<select name='q'>";
foreach($rows as $row)
{
$value = "category:".$row["category"].":";
print "<option value='".$value."'>".$row["category"]."</option>";
}
print "</select>";
print "<input type='submit' value='Go' />";
print "</form>";
}
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` WHERE merchant='".database_safe($parts[1])."' ORDER BY brand";
if (database_querySelect($sql,$rows))
{
print "<form method='GET' action='".$config_baseHREF."search.php' />";
print "Brands available from this merchant: ";
print "<select name='q'>";
foreach($rows as $row)
{
$value = "brand:".$row["brand"].":";
print "<option value='".$value."'>".$row["brand"]."</option>";
}
print "</select>";
print "<input type='submit' value='Go' />";
print "</form>";
}
}
Cheers,
David.
Hello Jack,
For the links to merchant, category and brand pages; if the merchants.php page works as normal there's no reason why the links shouldn't work; however if you are using mod_rewrite to make the search engine friendly URLs then you will need to link to rewritten versions, for example:
http://www.url.com/merchant/
http://www.url.com/category/
http://www.url.com/brand/
For the images linking to a merchant's products, that's no problem. If you upload the logos into your /images/ directory, you could simply add code as follows to your home page:
<a href='/search.php?q=merchant:Some Merchant'><img border='0' src='/images/Some Merchant.jpg' /></a>
Regarding 3), as the product page is not merchant specific; how do you want to do this? Of course if there is only one merchant then not problem; otherwise I assume you're looking to do this for the cheapest merchant? (it would be undefined if there are more than one at the same price)? Also how are you looking to have this layout relative to the product info and prices table etc...
Cheers,
David.