Share » Forums » Install & configuration » is this possible with ezstarrating...

is this possible with ezstarrating extension in 4.2?

is this possible with ezstarrating extension in 4.2?

Saturday 10 October 2009 4:37:48 pm - 6 replies

Modified on Saturday 10 October 2009 4:39:07 pm by Stephane Persyn

Author Message

Piotrek Karaś

Saturday 10 October 2009 11:43:18 pm

Hello Stephane,

I haven't used the ezstarrating extension you mentioned so far, so cannot confirm its being useful here, but I don't expect it to be fit for your needs out of the box. As the matter of fact, I think it has a slightly different purpose.

If I understood correctly, you want to have a rating-review pairs for hotel objects and then aggregate the ratings from all those pairs. My solution would be a dedicated one, and quite easy (even though it may seem complicated).

I would simply create a simple review content class that would consist of at least the review textblock and rating selection (1-10 for example), but for the latter I would necessarily use a datatype that stores the selected number directly in data_int field of ezcontentobject_attribute table. I'm not sure if any built-in datatype does just that, so there might be a need for a very simple dedicated one. Having that, I would write a simple template operator that would actually wrap around an SQL query that would fetch and aggregate the ratings directly from the database. The SQL would like something like:

SELECT COUNT(coa.data_int) AS vote_count, SUM(coa.data_int) AS vote_sum
FROM ezcontentobject_attribute coa, ezcontentobject_tree cot, ezcontentobject co
WHERE co.id=cot.contentobject_id
AND co.id=coa.contentobject_id
AND co.status=1
AND cot.path_string LIKE '{$NODEPATH}%'
AND coa.contentclassattribute_id={$CCAID}
AND co.current_version=coa.version
...

where $NODEPATH would be a path of current hotel node for which reviews are aggregated, and $CCAID would be the ID of content class attribute that stores the actual rating.

This solution would be able to handle many more reviews than template based one and would avoid struggling with rating system adaptation. I hope this may be useful for you.

Cheers,
Piotrek

PS. The above SQL is just out of my head, it may have some problems to it, but that's definitely doable.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Stephane Persyn

Sunday 11 October 2009 8:51:00 am

Thanks, Piotrek.

I will follow what you advise, as it makes more sense than to customize ezstarrating.

My next step is then to learn about template operator and datatypes writing, which may not seem easy for a newbie to Ezpoublsh, I will have obviously to get through the learning curve.

I will start with the ez technical manual on templates, but do you have any additional advice about which tutorial, article from ez or from contributor I can go on with?

Thanks again for your time taken to answer my post.

Stéphane

Piotrek Karaś

Sunday 11 October 2009 11:51:15 am

What you need for that solution is:
- learn how to create eZ Publish extensions in general
- learn how to provide custom datatypes
- learn how to provide custom template operators

Before you go on, study the technical documentation as much as possible, all the details become handy sooner or later. Google/search for tutorials and forum topics. Also, go to http://projects.ez.no and study few datatype/operator providing extensions of other contributors. Don't forget to study how the built in datatypes work in /kernel/classes/datatypes/{datatype}/{datatype}type.php.

Good luck

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Stephane Persyn

Tuesday 13 October 2009 8:31:33 am

Hey Piotrek.

I am not so successful with my brand new datatype :)

in any case you cand find a specific post I made on the developer section of the forum:
http://ez.no/developer/forum/developer/help_needed_on_debugging_my_first_basic_datatype

If you can ever get an eye on it. Seems very basic, but if I think I figures out the general philosophy, seems there are still some fundamental concepts I didn't get yet apparently :)

Stéphane.

realistic p

Wednesday 14 October 2009 1:16:55 am

Hi,

I tried and really work perfectly.

Thank You Very Much.

http://www.dogfencediy.com/reviews/innotek-ultrasmart-iuc-4100/
http://www.nile-cruise.com/
http://www.mynextfloridavacation.com/

Stephane Persyn

Friday 16 October 2009 12:56:51 pm

realistic p: what did work perfectly my datatype, or what I was looking to do with ezstarrating?

Cheers,

Stéphane

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

36 542 Users on board!

Forums menu