Questions tagged [collection]

Questions related to Magento collections

Filter by
Sorted by
Tagged with
0
votes
2answers
14 views

How to get the product type by SKU?

I have a bunch of SKUs in a DB table and I want to get the respective products in my for each logic. How to do it?
0
votes
1answer
28 views

Magento 2 : How can i get all category with all eav attributes in collection?

How can I get all categories with all EAV attributes in the collection? $categories = $objectManager->create('Magento\Catalog\Model\ResourceModel\Category\Collection'); $categories->...
0
votes
1answer
20 views

Magento 2: Get orders filtering customer email

Is there any way to get the orders by filtering by the client's email? I'm trying $ordersCollection = $this->_orderCollectionFactory->create(); $ordersCollection->addAttributeToSelect('*'...
1
vote
1answer
30 views

Use of sub query within collection in Magento

I am using a subquery in Magento collection, Here is my code. $websiteId = $this->storeManager->getStore()->getWebsiteId(); $collection = $this->_productCollectionFactory->create(); $...
1
vote
0answers
16 views

Magento 2 get Collection Data From Two different Third Party Module and Merge

I have Two Module "Module A" and "Module B" ,In Module A there is a listing page where data is fetching the table by collection and listing on frontend and same doing Module B. I want to customize ...
0
votes
2answers
46 views

In magento2,How to inject helper in collection

I have created a custom grid, in this grid collection I have to inject helper .while injecting helper in the collection it throws error like this Type Error occurred when creating object: My ...
0
votes
0answers
18 views

How to get product collection of products that has special price filtred by specific category id

I'm trying to get product collection of all products that has special_price and their special_to_date is less than today's date, and they belong to a specific category. I tried the bellow code but it ...
0
votes
0answers
10 views

How to add a step before payment with form and save data in magento 2

I have a virtual product and i am using PayPal Payment Method and all my customers are guests.and If we have enabled PayPal in checkout it does not need Billing Address. So Here i want to add a Step ...
0
votes
1answer
26 views

How to check if duplicate meta title present for category in Magento2

I am generating a report for the categories with duplicate Meta titles. I have loaded all the categories and checking conditions one by one like below with the direct MySQL queries. $connection = $...
4
votes
2answers
203 views

UI component Filter with category collection Magento2

I am implementing Grid for categories collection using UI component. I have used the following code Vendor/Module/view/adminhtml/layout/vendor_index_index.xml <body> <...
0
votes
1answer
31 views

Magento 2 - Collection getSize() returns zero

I have read about the difference between collection count() and collection getSize(), but I don't understand what's the reason that gives different numbers in each method. In a custom collection I ...
1
vote
0answers
25 views

Limiting the number of drop-down options

I have created an attribute which consists of two option. say A and B and on the front-end, I have another attribute which is a drop-down. Is it possible to limit the number of options in the front-...
0
votes
1answer
20 views

magento 1.9, how sort products by stock

i have this code $product_model = Mage::getModel('catalog/product')->getCollection() ->setPageSize(5) ->setOrder('entity_id', 'DESC') ->...
1
vote
1answer
29 views

Fatal error: Uncaught Error: Call to undefined method Training\Reviews\Model\ResourceModel\Reviews\Collection::addAttributeToFilter()

I want SELECT COUNT (*) FROM name_table WHERE result LIKE 'likes%' to be executed, and a numeric value is displayed on the page.How do I do it? I'm a beginner. I'll be very grateful for your help! /...
0
votes
1answer
20 views

Sort product collection by date in standart category view

I'm running Magento CE 2.3.3 with Porto theme. I want to sort the products in the category overview by the date they were added without using an extra extension. By default products in category view/...
0
votes
1answer
24 views

Extending Order Search Filter

I got the task to port some custom build stuff from magento 1 to magento 2. One function was the extension of the order api, now the OrderRepository. In theory I got it running, but my problem is, ...
3
votes
8answers
189 views

Magento2: I want to show featured product on top of the category and search result

I have yes/no type product attribute. If this featured attribute is yes for any products, those product will show top(first featured product showing in category page then rest of the products are ...
0
votes
0answers
18 views

Search / Filters - returning grouped/configurable/options results when their children match?

I am trying to understand why in the core Magento functionality search and layered navigation are fine returning parent products when children are a match, but why so many extensions fail to do so. ...
0
votes
0answers
14 views

How to add where clause or join condition to the shipment grid using ui component?

I managed to display the shipment core grid using ui component on another magento admin page. Right now I would like to filter it, to add more where clauses and join it MAYBE with other tables. This ...
1
vote
1answer
62 views

Magento2: How to get Cart items collection on Product view page?

I want to get Cart items collection on product page. customer-data.js define([ 'jquery', 'ko', 'uiComponent', 'Magento_Customer/js/customer-data' ], function ($, ko, Component, ...
0
votes
0answers
10 views

Filter Layer Collection

I rewrite getProductCollection in /vendor/magento/module-catalog/Model/Layer/Search.php. How could i filter collection there. In filter i need remove all products with attributeSetId = $id &&...
0
votes
0answers
14 views

Magento2: How to create custom module category page with filter?

I have category listing page and I want to display product on same page. I want to display same layout like category page with filter. Please help.
0
votes
1answer
54 views

Magento 2 Filter product collection by multiple attributes with OR

In Magento 2.3.3, How Can I Filter Product Collection by Multiple Attributes? First attribute SKU needs to check using "IN" second attribute is yes/no value. I need to filter collection by SKU array ...
2
votes
2answers
36 views

How to get rule id with respect to customer group id

class CouponCode extends \Magento\Framework\View\Element\Template { protected $_customerSession; protected $_customerGroupCollection; public function __construct( \Magento\Customer\Model\...
0
votes
0answers
16 views

How can i add a product per page dropdown in grouped product for child product list in admin

magento provides product per page feature for general products list in admin. and for gruped product list magento provides page switcher. but i want to add a dropdown in group product page like this....
1
vote
0answers
34 views

is there any way to display all my products in group product on one page in admin dashboard

Basically this is my group product and this is how we can see all of child products Now I dont want that previous and next button i just want all my products in list comes in one page or tab. help ...
0
votes
1answer
12 views

Generate a list in Magento Admin of customers that have a wishlist?

I need a way to get a list of customers that have a wishlist. Thanks in advanced.
1
vote
0answers
17 views

How to add several input fields per entry - admin form in Magento2? [closed]

I want to be able to edit one poll and it's answers in one admin form, and have one input field per answer. I already have my collections ready, how can I create a working admin form ? POLLS TABLE ...
1
vote
2answers
33 views

How to remove collection filter from Magento 1.9?

I want to add filter to grid. When I add filter to sales_billing_agreement, I got the following error. SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ...
3
votes
1answer
112 views

How to get in stock product collection by category id in Magento 2.3.3?

I'm using Magento 2.3.3 with multiple websites store that uses different multiple stock sources(multi inventory) and I tried to retrieve product collection by category id like this: public function ...
1
vote
0answers
30 views

Magento 2 - Category filter on custom search page

I have custom search page that is working perfectly and all the filters are applying properly except category filter. Following is the code: $indices = $this->searchResult->getIndices(); ...
0
votes
1answer
24 views

How to filter with custom field on customer grid Magento 2

I have created a custom field in the filter on the customer grid using customer_listing.xml. Now, the issue is How can I filter with the custom field? Where do I need to do the operation? Please ...
0
votes
1answer
50 views

Filter collection by config product attribute value in magento 2 programmatically

I would like to know. How can i filter collection by attributes value as I am making filter api for app. Please check below code where i am filter the collection this is working for simple products ...
1
vote
1answer
29 views

Magento2: What is difference between ProductFactory and CollectionFactory?

What is the difference between this below code? Class : \Magento\Catalog\Model\ProductFactory Code : $this->productFactory->create()->getCollection(); Class : \Magento\Catalog\...
1
vote
0answers
14 views

Magento 2 Collection path wrong but still module is working and saving the data,how possible?

I am developing a custom module to save data in custom table. I have created model and resourcemodel classes and also collection.php <?php namespace Vendorname\Modulename\Model\ResourceModel\test;...
0
votes
0answers
22 views

How to join directory_country_region and directory_country_region_name tables in magento2?

I have created an admin grid. In resource model using a table name, directory_country_region and data display in grid columns. I have a created column locale. Locale filed in another table ...
1
vote
0answers
24 views

Apply Magento\CatalogRule\Model\Rule\Condition\Combine to a collection FAST

I am using Karliuka m2.SmartCategory module for dynamic categories. This seems great to do what I need as was having issues with Smile modules virtual categories and this seemed to offer the same ...
2
votes
0answers
33 views

Magento 2 Join other tables using SearchCriteria JoinProcessor

Has anybody been able to join another table using SearchCriteria, JoinProcessor and virtual types. I have read the documentation (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/searching-...
2
votes
1answer
40 views

How to shown all the category on home page in magento2

public function getShopCategories() { $objectManagerr = \Magento\Framework\App\ObjectManager::getInstance(); $categoryFactory = $objectManagerr->create('Magento\Catalog\Model\ResourceModel\...
1
vote
0answers
20 views

Magento 2 collection filter need advies

We have grouped products - rims. Now we want to sell it with tires. Logical is to look up for needed tires and show them, although the problem is if we do that we get results for front and back. but ...
1
vote
2answers
56 views

How can I get my custom news collection on frontend in magento 1.9?

I had created a custom module for the news grid and form in Magento admin. I need to create custom pages with news collection on my custom news list page and a custom news detail page. How could I get ...
2
votes
0answers
82 views

Tree categories from products collection

If I have a collection like this: $collection = Mage::getResourceModel('catalog/product') ->getCollection() ->addAttributeToFilter('my_custom_attribbute','my custom value'); What is the ...
2
votes
2answers
135 views

Magento 2: How to setup layerd navigation in custom product collection?

I am trying to set a layered navigation filter on the custom cms page. for that, I have created a 1 cms page name test with two-column with left bar. and inside it, I have called one template file {...
2
votes
1answer
42 views

Cart page fatal error after creating a product collection plugin, Magento 2.3

We have a need to sometimes fetch product prices from an API for products loaded on the frontend. We figured it would be easiest to create a plugin for the collection: <?xml version="1.0"?> <...
1
vote
1answer
23 views

Is product repository in Magento the optimal way to read product url

I am reading a core function in Magento 2.3, the function is \Magento\Wishlist\Helper\Data::getProductUrl * Retrieve URL to item Product * * @param \Magento\Wishlist\...
1
vote
0answers
52 views

Magento2: How to set pagination for wishlist?

As my default wishlist collection which is coming from block is not working due to the applied theme in my magento2 site. So, I applied the collection on my list.phtml file. And the problem is I need ...
2
votes
1answer
55 views

Magento2 - Filter order grid by multiple order id's

I need to filter the order grid by multiple order id's. So the when i enter comma separated order ids in the id filter it should filter by these ids and give result.
1
vote
3answers
118 views

Magento 2 Add new column in Customer Page from data from database

I would like to ask if there is an effective way to add column in Customer's Page Grid in magento admin. I have viewed all tutorials and same problems in the web but no luck on displaying the data. I ...
0
votes
1answer
26 views

Magento 2 how to do a query on custom collection

SELECT time FROM my_timeslot_list WHERE date = "2019-11-12" GROUP BY time; How do I run this query on collection factory. This is the code $collection = $this->collectionFactory->create(); $...
0
votes
0answers
8 views

Filtering orders in certain state that are still in same state some time later?

Magento 1.7.0.2 This is my collection code: $collection = Mage::getResourceModel('sales/order_collection') ->join(array('a' => 'sales/order_address'), 'main_table.entity_id = a....

1 2 3 4 5 31