45 Posts
Casper
10 years ago
6
Topic

Hello!

Sorry for my google translate.
There are two Content Types: CT Articles and CT Comments (comments to the article).
At CT Articles available extra field-a sign of having an answer. We call it Answermark.
By default, when you create a CT Articles, the field Answermark = 0.
It is necessary, that the creation of CT Comments (which is created under an article) changed field Answermark in answered Article from 0 to 1.
How to implement it?
Thank you.

Get a Book for SEBLOD
4229 Posts
Kadministrator
10 years ago
1
Level 1

Hi,

you would need to change this fields value directly in the database using beforStore or afterStore event from http://www.seblod.com/products/1854

45 Posts
Casper
10 years ago
0
Level 2

Thanks for the answer.

Please bring an example of code that I have to put in the plug in order to achieve my goal.

Thank you.

45 Posts
Casper
10 years ago
0
Level 1

This plug-in is worth 30 euros. Before I buy it. I would like to know exactly what he was going to help me. What's the code I need insert in this plug-in?

Please help me. 

Thank you.

4229 Posts
Kadministrator
10 years ago
2
Level 1

Hi,

We can give you some advice on how to use them on the public forum, but can't give you actual code as it is different for each case, there is no recipe.

You either need to write code yourself or use our professional support service http://www.seblod.com/enterprise/support

45 Posts
Casper
10 years ago
1
Level 2

Hi, Klas

I wrote this code:

$artid=$_GET;
$db = & JFactory::getDBO();
$db->setQuery("SELECT 'answermark' FROM '#__cck_store_item_content' WHERE `id` = $artid");
$result = $db->loadResult();
if ($result == 0) {
$db->setQuery("update '#__cck_store_item_content' set 'answermark' = 1 WHERE `id` = $artid");
$db->query();
}

it will work with beforStore or afterStore?

Thank you.

4229 Posts
Kadministrator
10 years ago
0
Level 3

In after or before store you can execute any php or joomla function, plus you have available some variables that you can alter (not important for your case), so generally this code should work if you sued the right database tables.

One thing that I would chage is

	$artid=$_GET;

this won't work as get is an array, also this is not safe practice, in Joomla you need to use JInput which filters input variables by type (third parameter, second one is default value), so yo need to do

	$artid = JFactory::getApplication()->input->get('id', 0, 'INT');
Get a Book for SEBLOD