no element type exists with getCriteria and custom element type I am working on a plugin using the getCriteria function, but for every Element Type I put, I always get an error:


  No element type exists by the type “Comerce_Group”.


$criteria = craft()-&gt;elements-&gt;getCriteria("Comerce_Group");
$criteria-&gt;number = $number;
return $criteria-&gt;first();


And here is the Comerce_Group code:

class Comerce_GroupModel extends BaseModel
{  
    protected function defineAttributes()
    {
        return array (
            'id' =&gt; AttributeType::Number,
            'number' =&gt; AttributeType::String,
            'itemTotal' =&gt; AttributeType::Number,
        );
    }    
}
As Stephen pointed out, you're getting that error because your Commerce_GroupModel class is a Model that extends BaseModel, not an Element Type, which is what ElementsService-&gt;getCriteria() is looking for.

Are you sure you actually need a custom element type here?  Depending on what you're going for, Models might be enough.