Hi David,
How and where I can put content which is visible on the homepage only?
Can I add content in categories and single product pages?
David, where I have to place this code to show the content below the pagination ?
Cheers!
Hi,
The code would need to go directly in search.php - look for the following code at line 586;
require("html/footer.php");
...and REPLACE with:
if (isset($searchresults) && ($parts[0] == "category") && ($page == 1))
{
$filename = "info_category/".$parts[1].".html";
if (file_exists($filename))
{
require($filename);
}
}
require("html/footer.php");
Cheers,
David.
--
PriceTapestry.com
Hi David,
This doesn't work on a subcategory ?
{link saved}
Hi,
Easiest thing to do (to keep .html files in single info_category/ sub-directory would be to create the files with underscore in place of any forward slash separators (except leading / trailing slash) so for example
example.com/category/Electronics/Home-Cinema/Projectors/
...create the file:
info_category/Electronics_Home Cinema_Projectors.html
...and then use the following alternative replacement to the above;
if (isset($searchresults) && ($parts[0] == "category") && ($page == 1))
{
$filename = "info_category/".str_replace("/","_",$parts[1]).".html";
if (file_exists($filename))
{
require($filename);
}
}
require("html/footer.php");
Cheers,
David.
--
PriceTapestry.com
Hi,
thanks this works only point is that I can't write content to a main category now ;)
Hi,
Higher level category pages (showing the A-Z of sub-categories) is generated by categories.php and requires a slightly different modification; look for the following code at line 105:
require("html/footer.php");
...and REPLACE with:
$filename = "info_category/".str_replace(array("-","/"),array(" ","_"),$path).".html";
if (file_exists($filename))
{
require($filename);
}
require("html/footer.php");
(and then the same format of info_category/ filename as for the bottom level...)
Cheers,
David.
--
PriceTapestry.com
Hi David,
here it works:
{link saved}
maincategory not
{link saved}
I tried several higher level pages on the same way.
Ah sorry about that I left in part of the code only required for the search.php mod. I've corrected the mod for categories.php above...
Cheers,
David.
--
PriceTapestry.com
Hi David,
I changed but I think it is not possible with the dropdown menu.
Hi,
You could have the menu simply link to /category/ as it would if not using Category Hierarchy, to do this edit html/menu.php and look for the following code at line 21:
<?php if (isset($config_useCategoryHierarchy) && $config_useCategoryHierarchy): ?>
...and REPLACE with:
<?php if (FALSE): ?>
Cheers,
David.
--
PriceTapestry.com
Hi,
To add content to the home page; for example above Featured Products; edit index.php and look for the following code at line 47:
if (isset($featured)) require("html/featured.php");
...and REPLACE with:
?>
<div class='row'>
<div class='small-12 columns'>
...home page content here...
</div>
</div>
<?php
if (isset($featured)) require("html/featured.php");
To add content to category pages, for example at the top of the search results for page 1 only (to avoid duplicate content issues), an easy way is to create a directory info_category containing .html files with a base name exactly matching the category names including spaces e.g.
info_category/Blue Widgets.html
info_category/Red Widgets.html
Containing, for example:
<div class='row'>
<div class='small-12 columns'>
...Blue Widgets category info here...
</div>
</div>
And then to pull the content in, edit html/searchresults.php and add the following new PHP section at the very top of the script:
<?php
if (($parts[0] == "category") && ($page == 1))
{
$filename = "info_category/".$parts[1].".html";
if (file_exists($filename))
{
require($filename);
}
}
?>
Exactly the same approach can be used for product pages using a directory e.g.info_product again containing .html files with a base name exactly matching the product name e.g.
info_product/Product Name.html
And then in html/product.php, at the point you wish to pull in the custom content use:
<?php
$filename = "info_product/".$product["name"].".html";
if (file_exists($filename))
{
require($filename);
}
?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com