Skip to main content

Hikashop comment connect with Jomsocial's Karma?

More
12 years 6 months ago #148049 by veeco
hello, is there anyway to make that every time user vote/comment a product, he gains karma on the jomsocial's profile? thanks

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148079 by Xavier
Hi,

You can create a plugin based on the trigger "onBeforeVoteCreate()" or "onBeforeVoteUpdate()" and in this function you have to add code to change the karma value in jomsocial.

Here is some documentation:
hikashop.com/support/support/documentati...r-documentation.html
The following user(s) said Thank You: veeco

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148208 by veeco
hi, thanks for your reply

i tried to create a plugin by copying one of the plugins [i copied hikashop history and edited some data]

here is my code
Code:
<?php defined('_JEXEC') or die('Restricted access'); ?><?php class plgHikashopJomsocial extends JPlugin { function plgHikashopJomsocial(&$subject, $config){ parent::__construct($subject, $config); } function onAfterVoteCreate(&$element){ /* my Function */ } }

the php is loaded [i tried to die() and it worked]
however the onAfterVoteCreate isn't triggered after i voted
did i do something wrong?

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148262 by Xavier
Hi,

In the XML file, in which group have you put this plugin ?
That should be "hikashop" or "system".

<extension type="plugin" version="2.5" method="upgrade" group="hikashop">

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148482 by veeco
yes, i've set it to hikashop and it still isn't triggered
my function inside it is just a simple database query to update the user's table

could you provide me with a simple example plugin php and xml, maybe with simple query viewing some username or something

thanks

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148536 by Xavier
Hi,

My mistake, you have to use the function: "onAfterVoteUpdate($element)".
The other one is not triggered.

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148744 by veeco
hello, is this what you mean?
Code:
<?php defined('_JEXEC') or die('Restricted access'); ?><?php class plgHikashopJomsocial_Karma extends JPlugin { function plgHikashopJomsocial_Karma(&$subject, $config){ parent::__construct($subject, $config); } function onAfterVoteUpdate($element){ die(); } }

because it's not triggered when i review a product

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148790 by Xavier
Thanks to try with that plugin.
Tested and working.

The output can be seen thanks to your browser console in the network tab.
This will not be displayed on the page as it's a plugin.

Please Log in or Create an account to join the conversation.

Time to create page: 0.276 seconds
Powered by Kunena Forum