Jump to content
JcMagpie

Support thread for featured products with Ribbon v2.3.4.1 CE

Recommended Posts

This is based on an existing addon so all credit goes to the original author. I have only made a very small change.

A simple addon to let you place a featured products carousel with “Wow!” Ribbons on the index page.

Simply install the files and install and turn on.

It requires owl_carousel so if you do not have that then just follow the instructions included to install that.

It has been tested on the v2.3.4.1 CE Only.

image.thumb.png.51c3a836ed9d3c14abb5c1f760d2399d.png

 


 

Share this post


Link to post
Share on other sites
On 6/24/2018 at 12:29 PM, JcMagpie said:

This is based on an existing addon so all credit goes to the original author. I have only made a very small change.

A simple addon to let you place a featured products carousel with “Wow!” Ribbons on the index page.

Simply install the files and install and turn on.

It requires owl_carousel so if you do not have that then just follow the instructions included to install that.

It has been tested on the v2.3.4.1 CE Only.

image.thumb.png.51c3a836ed9d3c14abb5c1f760d2399d.png

 

Seems awesome is it possible to use it with categories?? I use the same Frozen CE version..

Like I want featured categories on my index page.. Please help would be deeply appreciated..

Warm Regds./

radhavallabh

Share this post


Link to post
Share on other sites

I’m not sure I understand what your asking, If a category is to be a featured or special then its simpler just to change its image.


 

Share this post


Link to post
Share on other sites
1 hour ago, JcMagpie said:

I’m not sure I understand what your asking, If a category is to be a featured or special then its simpler just to change its image.

I meant use Categories in the Carousel rather than the products.. The image and link will be of the category specified..

Edited by radhavallabh

Share this post


Link to post
Share on other sites

No sorry no plans to do that, just don't see the point. If you want to display cats then ask @burt  as he has a Cat's on index add-on as part of the 28d thing.

Or post in the commercial section to get one coded.


 

Share this post


Link to post
Share on other sites
12 minutes ago, JcMagpie said:

No sorry no plans to do that, just don't see the point. If you want to display cats then ask @burt  as he has a Cat's on index add-on as part of the 28d thing.

Or post in the commercial section to get one coded.

Okay Thank you will do that...:smile:

Share this post


Link to post
Share on other sites

The Add-on has been updated to use owl carousel 2.3.4 and include the display issue fix.

It no longer requires the owl_carousel 2.3.4 script to be loaded locally. These are now loaded to the header and footer using Header_Tags and use CDN rather than local install.

Owl requires the owl style sheets and jQuery to be loaded in a specific order to work properly. See the recommendations here

https://owlcarousel2.github.io/OwlCarousel2/docs/started-installation.html

If you are using any other add-on using owl it may cause issues if it’s not installed correctly.

It is still a no core change add-on.

Install and turn on both Header_Tags then simply install the other files and install and turn on the new add-on.

It has been tested on the v2.3.4.1 CE Only.


 

Share this post


Link to post
Share on other sites

Just a fiddle with the addon, and noticed a few things

  • any reason for having two header modules instead of just the one? - one for the css the other for java script could you not just do something like the below - similar was done for the colourbox header tag as part of the product info page
	$oscTemplate->addBlock( '<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.js"></script>' . "\n", $this->group);
    $oscTemplate->addBlock( '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.css">' . "\n", 'header_tags');
    $oscTemplate->addBlock( '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.css">' . "\n", 'header_tags');
  • tried turning on showing the product descriptions, and got an error on featured_products_carousel.php line 37 should tep_i_featured_products_carousel_limit_text not be tep_fp_featured_products_carousel_limit_text
  • noticed it was possible to have a product shown, after being selected as a featured product been set to inactive 

I managed to fix that by adding product_status to the query that gets the information to be shown, then warping the array that outputs the product info in a if statement that checks the product status - not sure if that is the best way of achieving that, but it worked for me.

Share this post


Link to post
Share on other sites

For point one I just followed the recomendation by the Owl 2.3.4 documentation which requires script to be in the footer hence the 2 tags addons.

https://owlcarousel2.github.io/OwlCarousel2/docs/started-installation.html

As for the description I'll have a look, probably in the old version 🙄 as Its not something I have knowingly changed on this version.


 

Share this post


Link to post
Share on other sites

Has been updated to fix error as i loaded up old files, they will work but just with default Owl2 settings.

Bug fix to make speed controls work.

If you want to edit then in template file,

Find line autoPlay: and copy it and replace autoPlay: with autoplayTimeout:

Find paginationSpeed: and replace with autoplaySpeed:

Find slideSpeed: and replace with navSpeed:

Find navigationText and replace with navText

 

The issue with discription is still to be fixed. For now it's been disabled.

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

Bug fixed to make product description show properly. You can simply replace the template file, or uninstall and replace files and reinstall.

Sorry was just poor editing on my part. Full Pakage has been uploaded to apps.

image.thumb.png.d851141d955c08eae67ed469597fedc6.png

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

I installed this for someone with an older CE version and it stopped the list/grid view from working on the category listing pages. I changed the code in both header tags modules as below to fix it.  Even if it doesn't cause any problems, there's no reason to have the code work on any page other than the home page, at least at its current version, so making this change would be a good idea, in my opinion. 

    function execute() {
      global $oscTemplate, $category_depth;
 
      if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && (isset($category_depth) && $category_depth == 'top') && ! isset($_GET['manufacturers_id'])) {   

           original code here

      }
    }

 

Share this post


Link to post
Share on other sites
Posted (edited)

Thank's Jack it makes sence to me, I just did not think of that at the time. I have used your edit on my test site and it worked fine. However I was unable to update the add-on as when I add your code to it and submit it to the apps market it is rejected showing this error.

PHP Parse error: syntax error, unexpected 'global' (T_GLOBAL), expecting function (T_FUNCTION) or const (T_CONST) in Featured products with Ribbon v2.3.4.1CE V5.4/includes/modules/header_tags/ht_jcm_owl_carousel2_js.php on line 38
Errors parsing Featured products with Ribbon v2.3.4.1CE V5.4/includes/modules/header_tags/ht_jcm_owl_carousel2_js.php

line 38 is,

image.png.cdcc47a9eb2bd03578216800855a10b2.png

No idea why it's beeing flaged as an error as it worked on test site without logging any errors. :(

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

Has been updated to include Jack's fix. Was nothing wrong with Jacks code at all I tested on 2 live sites and in PHP Sandbox and no errors were reported. Not sure why the apps market kept regecting it as having errors.

on 3rd submision the very same code was accept go figure! 🙄

it was tested upto PHP 7.3.5 in sand box so you should be able to use without any issues.

image.png.bf07fb6ae4220a4f4ddd437707aae592.png


 

Share this post


Link to post
Share on other sites

The class constructor has a syntax error which is why the Apps Marketplace did not accept the upload. Here is the class constructor of includes/modules/header_tags/ht_jcm_owl_carousel2_js.php:

    function __construct() {
      $this->title = MODULE_HEADER_TAGS_JCM_OWL_CAROUSEL2_JS_TITLE;
      $this->description = MODULE_HEADER_TAGS_JCM_OWL_CAROUSEL2_JS_DESCRIPTION;

      if ( defined('MODULE_HEADER_TAGS_JCM_OWL_CAROUSEL2_JS_STATUS') ) {
        $this->sort_order = MODULE_HEADER_TAGS_JCM_OWL_CAROUSEL2_JS_SORT_ORDER;
        $this->enabled = (MODULE_HEADER_TAGS_JCM_OWL_CAROUSEL2_JS_STATUS == 'True');
      }
    }

    global $oscTemplate, $category_depth;

      if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && (isset($category_depth) && $category_depth == 'top') && ! isset($_GET['manufacturers_id'])) {



    $oscTemplate->addBlock( '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.css">' . "\n", $this->group);
    $oscTemplate->addBlock( '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.css">' . "\n", $this->group);



             }
          }

Either the constructor is closed early before the global statement, or a function name is missing.

Either way, it's good now that the Apps Marketplace can detect such issues 👍


:heart:, osCommerce

Share this post


Link to post
Share on other sites

Yes it's good that it's picking up issues but unless I can reproduce the error it's hard to debug :( , I have set sand box to strict error reporting and it's still shows no issues.

error log on server is also set to report all errors and is showing none. Will keep looking but as app market has now accepted same code? maybe one that's going to take a bit more effort to pin down.


 

Share this post


Link to post
Share on other sites
1 minute ago, JcMagpie said:

Yes it's good that it's picking up issues but unless I can reproduce the error it's hard to debug :( , I have set sand box to strict error reporting and it's still shows no issues.

error log on server is also set to report all errors and is showing none. Will keep looking but as app market has now accepted same code? maybe one that's going to take a bit more effort to pin down.

It looks like the function from Jack's code is missing...

  function execute() {

Dan

Share this post


Link to post
Share on other sites

😂 ok that's would explain why I can not debug as it's not missing in any of my file!

Just checked and it's in the zip file I uploaded which was accepted by apps market. No idea how it go lost in first 2 zips!! still now we know why I can stop looking for the bug.

Thanks Dan would not have spotted that  as I kept debuging my files. 🙄


 

Share this post


Link to post
Share on other sites

Looking to move this either into the header a full 12 columns wide

Or prefer to it act as the index_products and display inline with the left column.

Currently the beadcrumb trail, then the left column and then below is the featured products.

Have changed this value to numerous settings

<div id="i_featured_products_carousel" class="col-sm-8">

Have tried using css to achieve the display but to no avail.

Guessing I am not using the proper code to push it to where I want.

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

×