Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
6 votes
4 answers
44k views

Magento 2 Get product collection in a custom template block

I have defined a featured product template in a cms static page as below: {{block class="Magento\Catalog\Block\Product\ListProduct" template="Magento_Catalog::product/featured.phtml"}} Now I want to ...
Vicky Dev's user avatar
  • 1,992
3 votes
1 answer
3k views

Filtering error when using custom Varien object collection in admin grid

I have created a custom Varien object collection for my admin module (because the data is not from a db) and have got it successfully to show in an admin grid. I built the collection by using the ...
Adam Moss's user avatar
  • 1,329
16 votes
2 answers
7k views

Why magento use resource and mysql4 model collection?

What is the purpose of using these two models collection. Resource Mysql4 why can't we use resource model for all collections. Why we are using MySql4 collection for simple module Some one explain....
VijayS91's user avatar
  • 1,788
5 votes
2 answers
5k views

Get a Magento product collection without sub-products of configurable products

I want to get a list of all products available in my Magento installation. Currently I am using the following call to filter out enabled products and limit the result set to those products which are ...
Christian Spoo's user avatar
5 votes
5 answers
28k views

Get quote item collection by using quote item id in Magento 2

I get the quote_item_id like this: $orderItems = $order->getAllItems(); foreach($orderItems as $orderItem){ $qouteItemId = $orderItem->getQuoteItemId(); } I need to load quote item ...
Tiny Dancer's user avatar
3 votes
1 answer
2k views

Workaround for Mage::getModel('catalog/product') and foreach loop

Currently used code for retrieving filtered product collection: $products = Mage::getModel('catalog/product') ->setStoreId($storeId) ->getCollection() ->...
Aivis Zvezdovs's user avatar
2 votes
1 answer
1k views

Mysql query to Model, Resource Model, Collection - Magento 2

I can easily get or set value using ORM. I felt difficult to convert mysql query logic to Model, Resource Model, Collection(ORM). for example I am getting last one hour data using the below query ...
Bilal Usean's user avatar
  • 10.1k
1 vote
5 answers
1k views

Product Collection won't get all products

I am using a pretty basic product collection but it isn't returning all products in my store. Please find the code below: $collection = Mage::getModel('catalog/product')->getCollection()->...
Scott Bowers's user avatar
1 vote
1 answer
4k views

Magento 2 - Collection on custom table problem

I created my custom table on magento, with the InstallSchema and InstallData and It works fine, then I created my Model class, initially it seemed to work, because I used the collection in one Block ...
3tech - Alessandro Staffolani's user avatar
1 vote
1 answer
1k views

Magento 2: How to get shipment collection on phtml?

I'm trying to get the shippment collection on popup.pthml, but not able to get. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $shipmentCollection = $objectManager->get('...
Ram Pratap Singh Gour's user avatar