This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » How to use eZ Star Rating in new stack
expandshrink

How to use eZ Star Rating in new stack

How to use eZ Star Rating in new stack

Tuesday 20 May 2014 3:02:02 pm - 7 replies

Hello,

I'm looking for a way to use ezstarrating extension in new stack. I found great unofficial bundles for comments and tags, such as:

but I didnt' find a bundle or a way to integrate the star rating system. 

Has anyone run into the same problem? 

Modified on Tuesday 20 May 2014 3:02:38 pm by Simone D'Amico

Tuesday 20 May 2014 5:02:51 pm

Hi Simone

the solution may look a bit blunt, but maybe the DemoBundle helps. Have a look at star_rating.html.twig - it simply includes the legacy template, but possibly this is what you need.

Cheers,
Donat

Tuesday 20 May 2014 5:51:08 pm

Thank you Donat,

unfortunately I tried the example of DemoBundle but the controller returns an empty value. The dump of the response is an empty string:

 <span>["content":protected]=> string(0) ""</span>

Maybe I'm doing something wrong, I really don't know.

Tuesday 20 May 2014 6:07:09 pm

Are you trying to read the field (attribute) directly in TWIG? Be aware that currently not all old datatypes are directly available as fieldtypes in the new stack, see https://doc.ez.no/display/EZP52/FieldTypes. Including a legacy template may help in these cases.

Modified on Tuesday 20 May 2014 6:07:34 pm by Donat Fritschy

Tuesday 20 May 2014 6:21:55 pm

Yes Donat, I'm trying to read the field in TWIG.

Unfortunately I cannot use a legacy template, there are many customization needed in that page so I need a custom controller. 

UPDATE:

the file "design:parts/article/star_rating.tpl" does not exist even in legacy stack. Most probably I'm missing something else.

Modified on Tuesday 20 May 2014 6:30:53 pm by Simone D'Amico

Tuesday 20 May 2014 6:31:24 pm

Well, I did not test this very feature, but I am working mainly with custom controllers. As long as you provide a location object and make it available in your TWIG template, this code should work fine:

 {% include "design:parts/article/star_rating.tpl" with {"node": location } %}

... of course given you have the ezdemo legacy extension installed and activated. You find the template at https://github.com/ezsystems/ezde...plates/parts/article/star_rating.tpl

Modified on Tuesday 20 May 2014 6:35:29 pm by Donat Fritschy

Tuesday 20 May 2014 6:36:58 pm

The problem is that the file star_rating.tpl does not exist and I'm not able to find the file even over the web.

Standard templates load the star rating as attribute so the template is available as:

 ezpublish_legacy/extension/ezstarrating/design/standard/templates/content/datatype/view/ezsrrating.tpl

and of course it cannot be loaded in the way of the example.

 

EDIT:

Sorry I just read your update. I'm checking on it.

Modified on Tuesday 20 May 2014 6:38:49 pm by Simone D'Amico

Wednesday 21 May 2014 3:33:18 pm

UPDATE:

As Donat suggested, the code works fine. In order to make it works you need to include CSS and JS files provided within the legacy extension in your template.

You also need to load 'io-ez' module within the legacy stack as in the following:

 {ezscript_load(array( 'ezjsc::yui3', 'ezjsc::yui3io') )}

Modified on Wednesday 21 May 2014 3:52:56 pm by Simone D'Amico

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from