Jump to content

Recommended Posts

Posted (edited)

I have this Jssor Slide module installed in my OSC Frozen for a couple of months now. It has been displaying the banners very well. Just a few days back, I realized that some banners which were due to expire on June 30 are still being displayed. I checked with the Banner Manager, the expiry dates for these banners are still set correctly. Somehow, the banners continue to be displayed. Has anyone encountered this situation? What is the solution? Thank you in advance!

Additional note:  I have a second look at the banner manager. It appears only those banners with Displays/Clicks Counts = 0/0 are not expired automatically. Why 0/0?

Edited by kgtee

Share this post


Link to post
Share on other sites
21 minutes ago, kgtee said:

I have this Jssor Slide module installed in my OSC Frozen for a couple of months now. It has been displaying the banners very well. Just a few days back, I realized that some banners which were due to expire on June 30 are still being displayed. I checked with the Banner Manager, the expiry dates for these banners are still set correctly. Somehow, the banners continue to be displayed. Has anyone encountered this situation? What is the solution? Thank you in advance!

Additional note:  I have a second look at the banner manager. It appears only those banners with Displays/Clicks Counts = 0/0 are not expired automatically. Why 0/0?

Just discovered with phpmyadmin, these problematic slides are not recorded in the banners_history database. ??

Share this post


Link to post
Share on other sites
Posted (edited)

It seems JSlider module has no association with banner.php and has totally ignored the displays and clicks update functions in there.

Edited by kgtee

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, kgtee said:

Just discovered with phpmyadmin, these problematic slides are not recorded in the banners_history database. ??

I added the record for new slides and this solves the expiry problem. I edited catalog/admin.banner_manager.php:

Quote

          if ($action == 'insert') {
            $insert_sql_data = array('date_added' => 'now()',
                                     'status' => '1');

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

            tep_db_perform(TABLE_BANNERS, $sql_data_array);

            $banners_id = tep_db_insert_id();

// add history record for new banner
        $sql_data_array_h = array('banners_id' => $banners_id,
                                                      'banners_shown' => 0,
                                                      'banners_clicked' => 0,
                                                      'banners_history_date' => 'now()');
        tep_db_perform(TABLE_BANNERS_HISTORY, $sql_data_array_h);

// end add history record

 

I also added the one line in the template tpl_cm_i_jssor.php:

Quote

if (($cnt = tep_db_num_rows($banner_query)) > 0) {
    while ($banner = tep_db_fetch_array($banner_query)) {
        if (tep_not_null($banner['banners_html_text'])) {
            $imgArray[] = $banner['banners_html_text'];     
        } else  {
        $imgArray[] = tep_image('images/' . $banner['banners_image'], $banner['banners_html_text'], '','','u="image"');
        }
        if (tep_not_null($banner['banners_url'])) {
        $urlArray[] = tep_href_link($banner['banners_url']);
        } else {
            $urlArray[] = '#';
        }

// added by KGT
    tep_update_banner_display_count($banner['banners_id']);
// end by KGT

Now, my display counts are ticking. 😂

Edited by kgtee

Share this post


Link to post
Share on other sites

I believe I have installed this Jssor Slider module in OSC Phoenix successfully. The HTML page source suggests the code is running normally. However I am not seeing any slides nor the navigation bullets and arrows being shown. The slides seem to be covered by an opaque layer on top. What may be the cause?

Share this post


Link to post
Share on other sites

I haven't tried it in Phoenix but my guess is that it is because the main javascript include is loaded in the footer in Phoenix, where it was loaded in the header in BS3. That means the javascript in this addon doesn't have the defines it needs.

Share this post


Link to post
Share on other sites
2 hours ago, Jack_mcs said:

I haven't tried it in Phoenix but my guess is that it is because the main javascript include is loaded in the footer in Phoenix, where it was loaded in the header in BS3. That means the javascript in this addon doesn't have the defines it needs.

@Jack_mcs Many thanks! You are right indeed. I moved the following 3 lines from template_bottom.php to template_top.php:

Quote

echo $OSCOM_Hooks->call('siteWide', 'injectAfterFooter');
echo $OSCOM_Hooks->call('siteWide', 'injectSiteEnd');
echo $oscTemplate->getBlocks('footer_scripts');

The Jssor Slider now works beautifully.

I now wonder whether moving these lines will have any other impact on the site design or not? Kind of worried. 😨

Share this post


Link to post
Share on other sites

It shouldn't cause a problem with other code, that I can think of. But it is not the correct change since it will break should you ever update the core files. See my Message Box addon for the code change to allow it to work without changing the core files.

Share this post


Link to post
Share on other sites
6 hours ago, Jack_mcs said:

I haven't tried it in Phoenix but my guess is that it is because the main javascript include is loaded in the footer in Phoenix, where it was loaded in the header in BS3. That means the javascript in this addon doesn't have the defines it needs.

I do not know the details of this addon, but if you Inject the scripts into "footer_scripts" it should work without core changes:

          $oscTemplate->addBlock($variable_ containing_the_script . PHP_EOL, 'footer_scripts');

See example in ht_grid_list_view.php

 

Share this post


Link to post
Share on other sites
18 hours ago, raiwa said:

I do not know the details of this addon, but if you Inject the scripts into "footer_scripts" it should work without core changes:

Thanks for mentioning this. The way I did it was place my javascript within code to wait for the script to load. It's in the module so there's not any changes to the core files.

window.addEventListener('DOMContentLoaded', function() { 

//script goes here

});

 

Share this post


Link to post
Share on other sites
23 hours ago, kgtee said:

@Jack_mcs Many thanks! You are right indeed. I moved the following 3 lines from template_bottom.php to template_top.php:

Sorry for probably messing up. I referred to this message.

Share this post


Link to post
Share on other sites
Posted (edited)

I have been trying to figure out how to get the banner click count working. I just found the solution.

In the template file tpl_cm_i_jssor.php:

Quote

// Find this line and disable it
//         $urlArray[] = tep_href_link($banner['banners_url']);
// Replace it with the one below
            $urlArray[] = tep_href_link('redirect.php', 'action=banner&goto=' . $banner['banners_id']);

Now, the URL click counts are ticking too. 😄😂😊

Edited by kgtee

Share this post


Link to post
Share on other sites

Jack or anyone else reading this for that matter.  I'm looking to add this to a new Phoenix install and was wondering if the package/add-on has been updated recently.   Reading the thread it looks like there are several changes that should be incorporated.

Dan

 

Share this post


Link to post
Share on other sites

I have a new version here that I plan on releasing but the current version will work as long as the following changes are made. In the includes/modules/content/header/templates/cm_header_jssor.php and the includes/modules/content/index/templates/tpl_cm_i_jssor.php files (or just the one you want to use), find

       jQuery(document).ready(function ($) {

and add this above it

 window.addEventListener('DOMContentLoaded', function() { //wait for jquery to load

Then farther down, find

        });
    </script>

and change it to

        });
      });
    </script>

It should work fine then but please let me know if it doesn't.

Share this post


Link to post
Share on other sites

Thanks Jack...I thought there were several changes based on the feedback in this thread but perhaps they were for some specific/unique setups.   I'll download it and give it a go.

Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×