Welcome, Guest
Username: Password: Remember me

TOPIC: Notice: Undefined index: model not found

Notice: Undefined index: model not found 01 Apr 2015 13:33 #12901

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi, i am doing a component correctly, but then i try to add new views.
On those views i want to call a model via:
$model = $this->getModel( 'preordersitem' );
where preordersitem is a model correctly declared on /models
but this model is not found
i get a notice message that says:
Notice: Undefined index: preordersitem ... viewlegacy.php on line 421
i followed the error and i saw that somehow themodel is not found.

any idea ?
The administrator has disabled public write access.

Notice: Undefined index: model not found 02 Apr 2015 09:56 #12903

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi,
I solved by doing:

$model = CkJModel::getInstance('preordersitem', 'OrdersCkModel');
$model->setState( 'id', '5');
$model_id ='3';
$this->order = $order = $model->getItem($model_id);
print_r($order);

I get the data correctly but i obtain a warning that says
Error loading component: com_ordersck, Component not found
??
Whats that??
The administrator has disabled public write access.

Notice: Undefined index: model not found 03 Apr 2015 10:42 #12904

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
$model = CkJModel::getInstance('preordersitem', 'OrdersModel');


Remove 'Ck'.

Ck is a prefix used for the fork system. At the footer of each file you find the code wich extends Model from CkModel.

It should work.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.082 seconds

Get Started