Jump to content

Recommended Posts

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

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
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.


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

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.


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

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

});

 


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

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

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.


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

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

A new version has been uploaded with these changes:

  • Added code to delay javascript to make it compatible with Phoenix.
  • Changed code to be compatible with the new advert system (Phoenix only).
  • Changed code to allow text to be shown on the banners.
  • Moved the jssor images to the correct location to match the code.

 


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


Link to post
Share on other sites

Thank You Jack!

Installed the module on a test site, everything works SUPER!👍👌


Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.

Best regards,

Fredi

Share this post


Link to post
Share on other sites
On 11/16/2020 at 7:01 PM, Jack_mcs said:

A new version has been uploaded with these changes:

  • Added code to delay javascript to make it compatible with Phoenix.
  • Changed code to be compatible with the new advert system (Phoenix only).
  • Changed code to allow text to be shown on the banners.
  • Moved the jssor images to the correct location to match the code.

 

Are you going to update this module to the new Phoenix versions?
Installed it on Phoenix 1.0.8.0 with PHP 7.0 and got a odd "bug": each banner is displayed 3 times before going to the next one.

Any idea how to fix this?

Share this post


Link to post
Share on other sites

Probably. As for showing three times. I can't imagine what would cause that.The only thing I can guess at is if you have both the header and index modules installed since they are not made to run at the same time. If you only have one installed, remove it and try the other one to see if that makes a difference. 


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


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

Probably. As for showing three times. I can't imagine what would cause that.The only thing I can guess at is if you have both the header and index modules installed since they are not made to run at the same time. If you only have one installed, remove it and try the other one to see if that makes a difference. 

only used the header.
already tried that. Index does the same, one installed at a time.

Share this post


Link to post
Share on other sites

Then it must be due to compatibility with the version of your shop since the problem doesn't exist in others. I'll check that before uploading a new version.


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


Link to post
Share on other sites

Ok... had a few mins free and took a look at it and found the problem. Its with the number of installed languages you have on the shop. It will show the HTML Text for each language for the same slide generating (slide * languages) slides.

Since i wont use any HTML Text on the banner i simply did a "quick fix" for the header module as:

Edit file "tpl_cm_header_jssor.php" replacing from line 5 to 16 the following code:
"

$banner_query = tep_db_query("select a.advert_id, a.advert_url, a.advert_image, ai.advert_html_text
                   from advert a left join advert_info ai using(advert_id)
                     where advert_group = '" . MODULE_CONTENT_HEADER_JSSOR_SLIDER_GROUP . "' and status = 1");

if (($cnt = tep_db_num_rows($banner_query)) > 0) {
    while ($banner = tep_db_fetch_array($banner_query)) {
        if (tep_not_null($banner['advert_image'])) {
            $imgArray[] = tep_image('images/' . $banner['advert_image'], $banner['advert_html_text'], '','','u="image"');
            $txtArray[] = $banner['advert_html_text'];
        } else  {
            $imgArray[] = $banner['advert_html_text'];
        }

"

with:

"

$banner_query = tep_db_query("select advert_id, advert_url, advert_image from advert where advert_group = '" . MODULE_CONTENT_HEADER_JSSOR_SLIDER_GROUP . "' and status = 1");

if (($cnt = tep_db_num_rows($banner_query)) > 0) {
    while ($banner = tep_db_fetch_array($banner_query)) {
        if (tep_not_null($banner['advert_image'])) {
            $imgArray[] = tep_image('images/' . $banner['advert_image'], '', '','','u="image"');
        }

"

its just an headsup so you dont waste time looking for the bug and can fix the problem when you update the module but might be handy for someone else in the meanwhile.

 

Tested on Phoenix 1.0.8.0

PHP 7.0

Share this post


Link to post
Share on other sites

Actually... please ignore my last fix. Its even easier and you can make use of the HTML Text feature:
 

Edit file "tpl_cm_header_jssor.php" and replace:

"

$banner_query = tep_db_query("select a.advert_id, a.advert_url, a.advert_image, ai.advert_html_text
                   from advert a left join advert_info ai using(advert_id)
                     where advert_group = '" . MODULE_CONTENT_HEADER_JSSOR_SLIDER_GROUP . "' and status = 1");

"

with:

"

$banner_query = tep_db_query("select a.advert_id, a.advert_url, a.advert_image, ai.advert_html_text, ai.languages_id
                   from advert a left join advert_info ai using(advert_id)
                     where advert_group = '" . MODULE_CONTENT_HEADER_JSSOR_SLIDER_GROUP . "' and status = '1' AND ai.languages_id = " . (int)$_SESSION['languages_id'] . " ");

"

 

and the file "tpl_cm_i_jssor.php" replace with:

"

$banner_query = tep_db_query("select a.advert_id, a.advert_url, a.advert_image, ai.advert_html_text, ai.languages_id
                   from advert a left join advert_info ai using(advert_id)
                     where advert_group = '" . MODULE_CONTENT_INDEX_JSSOR_SLIDER_GROUP . "' and status = '1' AND ai.languages_id = " . (int)$_SESSION['languages_id'] . " ");


"

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

×