Advertisement:

Author Topic: [SOLVED] Why nothing happens with my own plugin.. ?  (Read 762 times)

naingood

  • Newbie
  • *
  • Posts: 16
[SOLVED] Why nothing happens with my own plugin.. ?
« on: May 12, 2015, 04:04:41 pm »
Hi, i'm newbie here ..

 i tried to make my own plugin..
 this is my code ..

Code: [Select]
function at_test(){
    $conn = getConnection() ;
    $conn->osc_dbExec("INSERT INTO oc_t_item_atribut_tanggal (`fk_i_item_id`,`s_tgl_mulai`,`s_tgl_usai`)
                        VALUES (11,'2015-05-01','2015-05-10')");
       
}
osc_add_hook('post_item', 'at_test');
i can install n configure it
but why nothing happens..

osclass version 3.3.2
thanks.. :)

 
« Last Edit: May 13, 2015, 04:15:59 am by naingood »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Why nothing happens with my own plugin.. ?
« Reply #1 on: May 12, 2015, 06:19:06 pm »
Hi,

You put the wrong hook there:

Quote
osc_add_hook('posted_item', 'at_test');

Regards

naingood

  • Newbie
  • *
  • Posts: 16
Re: Why nothing happens with my own plugin.. ?
« Reply #2 on: May 12, 2015, 08:19:01 pm »
Hi,

You put the wrong hook there:

Quote
osc_add_hook('posted_item', 'at_test');

Regards

Thanks a lot ..
i've changed post to posted but nothing happens in my database
any wrong syntax with my osc_dbExec()

Thanks ..

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Why nothing happens with my own plugin.. ?
« Reply #3 on: May 12, 2015, 08:38:50 pm »
Syntax of what I can see here seems correct, but then again it seems quite generic.

Enable the queries debug log as explained here:

http://forums.osclass.org/3-3-x/item-post-location-not-setting/msg117277/#msg117277

An check what happens with that query, first see if it throws some error, if not so, recheck its values and make sure they are what the table structure is expecting...

Regards

naingood

  • Newbie
  • *
  • Posts: 16
Re: [SOLVED] Why nothing happens with my own plugin.. ?
« Reply #4 on: May 13, 2015, 04:17:28 am »
Thanks teseo .. you're the hero :)