I am new in Craft CMS and this is my first plugin. Below is my code to get products.
{% craft.entries.section('products').limit(9) %}
This code is working fine but can I use this code in my controller for getting products?
Thanks
If you want to use ElementCriteria in your controller, this is how to go about it:
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section('products');
$criteria->limit = 9;
$products = $criteria->find();
Read this page for more info on the subject.