hi ecartz
only to be sure you see my problem:
the modul itself works normal an great (in the index_nested modules, in the normal category pages where the module is located modules/index_nested/...) my only problem is that i cannot include the same module in a external script outside of the index.php ( i need / whant to include it in a sepearate / other script, so it shows the same banners at the top)
And with the include you wrote me, the template itself is there ( ican see the empty template) but it seems the execute of the script is not done, only included the empty template...
here is the cm_in_swiper_carouse_banner.php i try to include:
Code: Select all
<?php
/*
Copyright (c) 2020, G Burton
This work is licensed under a
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
You should have received a copy of the license along with this work.
If not, see <http://creativecommons.org/licenses/by-nc-nd/4.0/>.
*/
class cm_in_swiper_carousel_banner extends abstract_module {
const CONFIG_KEY_BASE = 'MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_';
public function __construct() {
parent::__construct(__FILE__);
$this->content_width = MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_CONTENT_WIDTH;
$this->group = basename(dirname(__FILE__));
}
public function execute() {
global $currencies, $currency, $PHP_SELF;
$content_width = $this->content_width;
$card_layout = IS_PRODUCT_PRODUCTS_DISPLAY_ROW;
$swiper_carousel_banner_linkage = adverts::get_grouped_adverts(array(2),$GLOBALS['current_category_id']);
if (sizeof($swiper_carousel_banner_linkage) > 0) {
$swiper_div="";
foreach ($swiper_carousel_banner_linkage as $o => $c) {
$advert_link = adverts::getLink($c['advert_url'], $c['advert_id']);
$swiper_div .= '<div class="swiper-slide" id="slide_'.$c['advert_id'].'">';
$swiper_div .= '<div class="swiper-banner-item swiper-banner-item-div-img" style="cursor: pointer; background-image: url(\''.image_thumbor::get_image('images/'.$c['advert_image'],'900','200').'\');">' . PHP_EOL;
if(!empty($c['advert_image_logo'])){
$swiper_div .= '<div class="swiper-banner-logo">';
$swiper_div .= "<img src='".image_thumbor::get_image('images/'.$c['advert_image_logo'],'','30')."'>";
$swiper_div .= '</div>' . PHP_EOL;
}
if(!empty($c['advert_image_badge'])){
$swiper_div .= '<div class="swiper-banner-badge">';
$swiper_div .= "<img src='/images/".$c['advert_image_badge']."'>";
$swiper_div .= '</div>' . PHP_EOL;
}
if (tep_not_null($c['advert_html_text'])) {
$swiper_div .= '<div class="swiper-banner-title-container"><div class="swiper-banner-title">';
$swiper_div .= $c['advert_html_text'];
$swiper_div .= '</div>' . PHP_EOL;
$swiper_div .= '<div class="swiper-banner-subtitle pt-1">';
$swiper_div .= $c['advert_html_text_2'];
$swiper_div .= '</div></div>' . PHP_EOL;
$swiper_div .= '<div class="swiper-banner-button">';
$swiper_div .= $c['advert_button_text'];
$swiper_div .= '</div>' . PHP_EOL;
}
if($c['advert_url_type'] != "NoLink"){
$swiper_div .= '<a class="image_darken_hover_overlay" href="' . $advert_link['href'] . '"'.$advert_link['target'].'></a>'. PHP_EOL;
}
$swiper_div .= '</div>' . PHP_EOL;
$swiper_div .= '</div>';
}
$swiper_key = "swiper-banner";
$advert_titel = $c['advert_html_text'];
$swiper_advert_wrapper_div = <<<swiperHtml
<div class="swiper swiper-banner advert_{$swiper_key}" id="advert_{$swiper_key}">
<div class="swiper-wrapper">
{$swiper_div}
</div>
<div class="swiper-pagination swiper-pagination-{$swiper_key}"></div>
<div class="swiper-button-next swiper-button-next-{$swiper_key} swiper-button-inactive"></div>
<div class="swiper-button-prev swiper-button-prev-{$swiper_key} swiper-button-inactive"></div>
</div>
swiperHtml;
$tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
include 'includes/modules/content/cm_template.php';
}
}
protected function get_parameters() {
return [
'MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_STATUS' => [
'title' => 'Enable Best Sellers Module',
'value' => 'True',
'desc' => 'Should this module be shown on the index page?',
'set_func' => "tep_cfg_select_option(['True', 'False'], ",
],
'MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_CONTENT_WIDTH' => [
'title' => 'Content Width',
'value' => 'col-sm-12',
'desc' => 'What width container should the content be shown in?',
],
'MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_MAX_DISPLAY' => [
'title' => 'Maximum Display',
'value' => '4',
'desc' => 'Maximum number of products that should show in this module?'
],
'MODULE_CONTENT_IN_SWIPER_CAROUSEL_BANNER_SORT_ORDER' => [
'title' => 'Sort Order',
'value' => '50',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
}
}
and here the template:
Code: Select all
<div class="<?php echo $content_width; ?> i-swiper-carousel">
<?= $swiper_advert_wrapper_div ?>
</div>
<?php
/*
$Id$
CE Phoenix, E-Commerce made Easy
https://phoenixcart.org
Copyright (c) 2021 Phoenix Cart
Released under the GNU General Public License
*/
?>