Skip to main content

Questions tagged [category-products]

Questions related to Category Products Management and the relation between categories and products.

Filter by
Sorted by
Tagged with
12 votes
6 answers
20k views

Magento 2.x Elasticsearch Category Products Not Showing

I tried to upgrade my Magento 2.3.5 install to Magento 2.4.0, but am unable to get category pages to display products. Everything is in Docker, so I am using Elasticsearch 7.6 and have specified ...
doublesharp's user avatar
14 votes
6 answers
36k views

Magento 2: get product collection using category id

How to get all products of category using category id in magento 2?
Rakesh Jesadiya's user avatar
1 vote
3 answers
9k views

Magento 2: How to Override Abstract Class for Product Category Indexing Issue?

I have 2000 products which is assigned to multiple categories. When i run php bin/magento indexer:reindex catalog_category_product In catalog_category_product_index total record count is 1700. So ...
Jackson's user avatar
  • 9,939
7 votes
7 answers
15k views

Magento2: Could not save product "330664" with position 0 to category 3567

When I save a product after unassigning all categories from the product. I am getting the error Could not save product "330664" with position 0 to category 3567 I have checked the log and I ...
Kul's user avatar
  • 1,807
5 votes
1 answer
3k views

Assign all products in a category to all it's ancestor categories programmatically, in Magento 2

I am working on a Magento 2.1.7 shop and I have created a child-theme of Magento Blank The products are organized into categories and subcategories. In other words, they are organized into parent ...
Razvan Zamfir's user avatar
1 vote
1 answer
685 views

sql error while adding any products to category : M2

Something went wrong while saving the category.SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (mydb....
Jimit Bhavsar's user avatar
2 votes
1 answer
156 views

How can i show USPS Media Mail Only For Books not for other Products?

I have different kinds of products, USPS Media mail is good for books, but not for all products. How can i restrict Media Mail Not allowed for other products. Condition: 1) If cart consists both ...
zus's user avatar
  • 173
2 votes
4 answers
9k views

How to check if a collection has items?

What does a product that is not found return in terms of Object? I'm loading a product like the following: $man_collection = Mage::getModel('catalog/category') ->load($mProduct) ->...
Stefanos's user avatar
  • 231
3 votes
1 answer
1k views

Find MIN & MAX value of product attribute in a large category

How do I find the max weight and min weight of a category with 3000 products. I'm trying use: public function getProductCollectionFilter($_productCollection) { $_productCollection = $this->...
Namikaze Minato's user avatar
1 vote
1 answer
245 views

Meta Descriptions - Item Count Appearing on Search Engines

For category pages, when displayed on search engines, there is an "item count" that is displayed before the meta description. I fear this may be hurting our click through rates. Is there a way to ...
Michael's user avatar
  • 19
1 vote
5 answers
5k views

Magento Category Products reindex error - Integrity constraint violation

I recently upgraded a magento from 1.5 to 1.9 and everything is working except for reindexing of Category Products. On the admin backend, I just get a general error that the process has failed. so, ...
Latheesan's user avatar
  • 1,038
0 votes
1 answer
3k views

Magento 2.3 add custom block under each product in category page

I need to overwrite the product listing (category) page, a custom form needs to show after that product information. So I have found that already an extension is overwriting that page as below <...
Antony's user avatar
  • 73
13 votes
2 answers
4k views

In Magento 2.2.4 Tier price of a simple product does not appear on a configurable product page

In Magento 2.2.4, Tier price of a simple product does not appear on a configurable product page after editing the cart. Steps to reproduce: 1)Select all option of configurable product which has a ...
sky's user avatar
  • 1,397
8 votes
4 answers
45k views

Products are not showing in category Magento 2

I am facing an issue that categories are not showing products. Some categories are showing product but I assigned 3 products to a category and it's showing me only 1 and some categories are not ...
Thomas's user avatar
  • 417
6 votes
2 answers
5k views

Remove all products from one category programmatically

I just want to remove all products from given category, for that I have tried below code which works absolutely fine , But it takes to much time , So I just want some code which works faster than ...
Murtuza Zabuawala's user avatar
5 votes
5 answers
10k views

Magento 2 Load More Product Script

I am using this script for Load More in Magento 2 But it's not working <script src ="https://infiniteajaxscroll.com/vendor/jquery-ias/dist/jquery-ias.min.js"></script> <link src = "...
Magento 2's user avatar
  • 3,834
3 votes
0 answers
2k views

Notice: Array to string conversion on admin category products save [closed]

I want to assign products from admin category module. But I am facing following using on category save. Notice: Array to string conversion in /var/www/html/m202/vendor/magento/framework/Data/Form/...
Amit Maurya's user avatar
  • 2,871
3 votes
1 answer
12k views

Magento 2: get Custom Collection by Asc sort order with position 0 at end of list

How to get Category product collection with Product position 0 at end of list in collection. Get Product Collection with position greater than 0 comes first and at the end of collection All 0 ...
Rakesh Jesadiya's user avatar
3 votes
3 answers
457 views

Category products do not load - 'We can't find products matching the selection.' Error keeps coming up at least once a day. Elastic search is running

Magento ver. 2.4.2-p1 Amasty extensions We used to have Elastic Search crash every once in a while but this is no longer happening since we upgraded to the most powerful server. We had instances ...
Allysin's user avatar
  • 280
3 votes
2 answers
3k views

Adding a second product grid in category admin for "featured products"

I would like to add a new category products tab on the category admin page with a product grid same as the default category product grid. The only difference is, i need this grid to save selected ...
Loxzibit's user avatar
  • 351
3 votes
1 answer
3k views

Get product id of current category page [closed]

I listen to this event: catalog_product_load_after and I need to retrieve the products id, I know I can retrieve the products' id with: $collection = Mage::registry('current_category') ...
Razorphyn's user avatar
  • 465
3 votes
0 answers
1k views

Magento2: How to show Product Weight on Filter

Need to show Product Weight on Category Page Filter, so Customer can also filter via Weight. A user can also enter the weight in Text Box & Search, so it's vice versa between Slider & Textbox....
Jackson's user avatar
  • 9,939
2 votes
1 answer
2k views

Getting Products by category id! Magento 2.1 REST

How can I get products of a specific category? For Example If I hit https://www.example.com/index.php/rest/V1/categories/[category_id]/products it should return all products of the same Category [...
Shozib Rasool's user avatar
2 votes
1 answer
457 views

Remove products from all categories when price is zero

For SEO reasons I want to keep products which are not being produced anymore on my website, so I edited some stuff so when I change the price of the products to 0,-. It displays a text that the ...
Dahaan's user avatar
  • 41
2 votes
1 answer
794 views

Best seller items in category magento 2

I have used below code to filter products by category id. $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $catalog_ids = 4; $productCollection = $_objectManager- >create('...
Jafar Pinjar's user avatar
  • 1,951
2 votes
1 answer
489 views

Assign Products created in last 45 days to specific category

I have a category created in my store with name "New Arrivals" I want to add all products to this category which are created in last 45 days. This category products should be updated everyday with ...
Mesk's user avatar
  • 187
1 vote
1 answer
262 views

How can I show specific products on homepage in Magento 2?

How can I show specific products on homepage? It has to be client friendly to do in CMS. I tried displaying a category then changing the sort order on products in category.
Matthew McLennan's user avatar
1 vote
1 answer
105 views

Error when getBlock('category.products.list') in Observer

public function __construct( Config $pageConfig, Category $categoryHelper, UrlInterface $urlBuilder ){ $this->pageConfig = $pageConfig; $this->...
magentodevbegin's user avatar
1 vote
2 answers
2k views

Product tabs are not showing in product detail page

product tabs are not showing on the product detail page and reviews are coming down to Description. I had created a custom tab and this one also does not show http://18.169.225.50/calacatta-matt-...
somutesting's user avatar
1 vote
1 answer
713 views

Wrong number of products in category

I have a problem, one of our categories is showing a wrong number of products. When I go to categories in the backend the number stands on 164 products. When I look at the products tab, there are only ...
user15860's user avatar
1 vote
1 answer
2k views

Add products to another category programatically

I have pulled the product set I need in with my collection, how do I add these products to another category whilst also being in the ones they are? Here is my code so far: //Getting products ...
Tom's user avatar
  • 181
1 vote
1 answer
730 views

Magento1.9 - get product with specific set of categoryIds (filter by category arrays)

In my website there are N categories, let's say 1,2,3,4,5,6. Given $categoryIds = array(1,2,3) I need to get all the products that belong to ALL and EXACTLY the categories listed in $categoryIds (...
davideghz's user avatar
  • 693
1 vote
1 answer
2k views

Magento2: Unassigned category from product

I am trying to make script to unassign category from product while save or update product. but its not working properly. ini_set('display_errors', '1'); ini_set('error_reporting', E_ALL); // ...
Kul's user avatar
  • 1,807
1 vote
0 answers
261 views

Push an array of all sku's on a category page into my $data = array();

I want to list all sku's on a category page in a data array. Currently if i'm on a product detail page i can push the sku into my data array like this: if ($module === 'catalog' && $...
Head's user avatar
  • 187
0 votes
1 answer
1k views

Categories not showing products in frontend after migration from Magento 1.7.2 to 2.3.5

Just want to preface this by saying this is my first time using Magento 2 so I apologize if I'm missing something easy here; I always try all I can before reaching out as the last thing I want to do ...
kczer's user avatar
  • 11
0 votes
0 answers
275 views

How to add new category button in Custom Module edit form in Magento2 [duplicate]

Want to add New Category Button like product edit Category selection.
Bhavin Gehlot's user avatar
0 votes
2 answers
2k views

Get Product Collecton by category with filters in magento 2

I need to filter category product collection with Instock items and only simple products. I have used below code to implement it.But the out of stock products also fetching with the collection. ...
Jafar Pinjar's user avatar
  • 1,951
0 votes
1 answer
284 views

How to show specific category products in cart page?

I would like to show specific category products in a cart page when one of its product from that category is added to the cart and also would like to show all those products in carousel. Can anyone ...
Kumar's user avatar
  • 333
0 votes
1 answer
1k views

Get product IDs of current category page

I would like to get all the product IDs from the current category page. I don't want to load the whole collection, I just need to get the product IDs from the products currently displayed. E.g.: ...
juhanix's user avatar
  • 671