I made this to show new banner position on Homepage between Featured products and New products.
Open: language/en/admin/banners.ini
Add:
Code: Select all
MiddleOfPage = "Middle of Page"
BannerMiddleOfPage = "Middle of Page"
Open: admin/includes/classes/class.banners.php
Find:
Code: Select all
if ($banner['location'] == "top") {
$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerTopOfPage'));
}
else {
$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerBottomOfPage'));
}
Code: Select all
switch ($banner['location']) {
case "top": {
$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerTopOfPage'));
break;
}
case "middle": {
$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerMiddleOfPage'));
break;
}
case "bottom": {
$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerBottomOfPage'));
break;
}
}
Code: Select all
if ($banner['location'] == "top") {
$GLOBALS['IsLocationTop'] = "selected=\"selected\"";
}
Code: Select all
else if ($banner['location'] == "middle") {
$GLOBALS['IsLocationMiddle'] = "selected=\"selected\"";
}
Open: includes/classes/class.banner.php
Find:
Code: Select all
case "home_page":
case "search_page": {
if($banner['location'] == "top" && !isset($GLOBALS['Banners']['top'])) {
$GLOBALS['Banners']['top'] = $banner;
}
Code: Select all
else if($banner['location'] == "middle" && !isset($GLOBALS['Banners']['middle'])) {
$GLOBALS['Banners']['middle'] = $banner;
}
Code: Select all
case "brand_page":
case "category_page": {
if($banner['location'] == "top" && !isset($GLOBALS['Banners'][$banner['catorbrandid']]['top'])) {
$GLOBALS['Banners'][$banner['catorbrandid']]['top'] = $banner;
}
Code: Select all
else if($banner['location'] == "middle" && !isset($GLOBALS['Banners'][$banner['catorbrandid']]['middle'])) {
$GLOBALS['Banners'][$banner['catorbrandid']]['middle'] = $banner;
}
Open: lib/templates/template.php
Find:
Code: Select all
case "home_page":
case "search_page": {
// Is there a top template?
if(isset($GLOBALS["Banners"]["top"])) {
// Replace it out
$tplData = str_replace("%%Banner.TopBanner%%", $GLOBALS["Banners"]["top"]["content"], $tplData);
}
else {
// Replace it with nothing
$tplData = str_replace("%%Banner.TopBanner%%", "", $tplData);
}
Code: Select all
// Is there a middle template?
if(isset($GLOBALS["Banners"]["middle"])) {
// Replace it out
$tplData = str_replace("%%Banner.MiddleBanner%%", $GLOBALS["Banners"]["middle"]["content"], $tplData);
}
else {
// Replace it with nothing
$tplData = str_replace("%%Banner.MiddleBanner%%", "", $tplData);
}
Code: Select all
if(isset($GLOBALS["Banners"][$id])) {
// Is there a top template?
if(isset($GLOBALS["Banners"][$id]["top"])) {
// Replace it out
$tplData = str_replace("%%Banner.TopBanner%%", $GLOBALS["Banners"][$id]["top"]["content"], $tplData);
}
else {
// Replace it with nothing
$tplData = str_replace("%%Banner.TopBanner%%", "", $tplData);
}
Code: Select all
// Is there a middle template?
if(isset($GLOBALS["Banners"]["middle"])) {
// Replace it out
$tplData = str_replace("%%Banner.MiddleBanner%%", $GLOBALS["Banners"]["middle"]["content"], $tplData);
}
else {
// Replace it with nothing
$tplData = str_replace("%%Banner.MiddleBanner%%", "", $tplData);
}
Code: Select all
// Replace the banners with nothing
$tplData = str_replace("%%Banner.TopBanner%%", "", $tplData);
Code: Select all
$tplData = str_replace("%%Banner.MiddleBanner%%", "", $tplData);
Open: admin/templates/banner.form.tpl
Find:
Code: Select all
<select name="bannerloc" id="bannerloc" class="Field150">
<option value="">%%LNG_ChooseALocation%%</option>
<option value="top" %%GLOBAL_IsLocationTop%%>%%LNG_TopOfPage%%</option>
Code: Select all
<option value="middle" %%GLOBAL_IsLocationMiddle%%>%%LNG_MiddleOfPage%%</option>
Open: templates/[YOUR_TEMPLATE_NAME]/default.html
Find:
Code: Select all
<div class="Content" id="LayoutColumn2">
%%Banner.TopBanner%%
%%Panel.HomeFeaturedProducts%%
Code: Select all
%%Banner.MiddleBanner%%
All code is set now, just one more modification in database.
You can make SQL query:
Code: Select all
ALTER TABLE `isc_banners` CHANGE `location` `location` ENUM( 'top', 'middle', 'bottom' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'top'
You allready have a value there
Code: Select all
'top', 'bottom'
Code: Select all
'top', 'middle', 'bottom'
Note: This Middle poisition will work only on homepage as we set it in default.html. In order to work on other pages (category, brand & search results pages) you need to add %%Banner.MiddleBanner%% in your template html files (category.html, brands.html & search.html)