Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

CKJModel get instance not working from the plugin 07 Sep 2014 05:21 #12613

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Hi,
I had followed the below article to access a model from the plugin.

www.j-cook.pro/index.php/m/module

It gives non object error on this line.

@include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_cskpro'.DS.'helpers'.DS.'loader.php');
$model = CkJModel::getInstance('User', 'CskPro');
$item = $model->getItem();

However, the same code works fine on the component which was generated by cook an year back.Did something change recently?

Regards
Vivek

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

CKJModel get instance not working from the plugin 09 Sep 2014 16:22 #12615

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Any replies ?? Got stuck with this for few days now..

Regards
Vivek

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

CKJModel get instance not working from the plugin 09 Sep 2014 16:23 #12616

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Sorry for late answer.
I am gonna check this soon.

Did you tried on fresh install ?
Coding is now a piece of cake

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

CKJModel get instance not working from the plugin 09 Sep 2014 16:40 #12617

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Solved it by myself..

Here are the lines I had added to the loader.php

// Set the models directory
if ($app->isSite())
CkJController::addModelPath(JPATH_SITE_CHOLALMS .DS.'models');
else
CkJController::addModelPath(JPATH_ADMIN_CHOLALMS .DS.'models');

// Set the table directory
JTable::addIncludePath(JPATH_ADMIN_CHOLALMS . DS . 'tables');
The following user(s) said Thank You: admin

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

CKJModel get instance not working from the plugin 10 Sep 2014 12:56 #12618

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
It seems to be a random problem from the JLoader.

To be sure the models are loaded correctly, I have place your code in the end of the loader file, so now it can work. In fact it is the right place.

K++
Coding is now a piece of cake

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

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.085 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started