Skip to main content
13 votes
Accepted

Magento 2 : How to display swatches in related products?

In app/design/frontend/MyCompany/mytheme/Magento_Catalog/templates/product/list/items.phtml please add below code : <?php if($_item->getTypeId() == \Magento\ConfigurableProduct\Model\Product\...
Charvi Parikh's user avatar
11 votes
Accepted

set related/upsell products programatically only works for 1 product

This part caused your issue, if you created this object outsize the foreach loop, that means it is a "global" object. So, we need to create a new object inside the loop. $linkData = $productLinks //...
Khoa TruongDinh's user avatar
7 votes

CSV Import: How can I import related products in Magento 2?

We've experienced the same issue, it seems import module has some kind of bug with related products We've solved it by writing a new console command which expects a 2 columns (parent sku & ...
Raul Sanchez's user avatar
  • 3,145
7 votes
Accepted

How to move related products at very bottom of product page?

By default Related products show in content.aside container, which is render after content container. Both content.aside and content comes in main container, So you can move related product after ...
Pawan's user avatar
  • 5,906
6 votes
Accepted

Magento 2 How to add custom product relations?

Magento 2.0.x version: First of all, there are some notes: --Replaced event catalog_product_prepare_save with controller product initialization helper that can be customized via plugins - Vendor/...
Khoa TruongDinh's user avatar
6 votes

How to show related products in product view page in Magento 2?

Adding related product in Magento 2 is very easy. Here are steps Admin -> Product(left sidebar) -> Catalog Click on Edit link under Action tab. Go to Related Products, Up-Sells, and Cross-Sells ...
Jarnail S's user avatar
  • 4,707
6 votes

Magento 2 : How to display swatches in related products?

In 2.2.5 we're doing the following to achieve the swatches, essentially it replicates the code from the Mage_Catalog::product/list.phtml template where swatches are by default. Firstly you need to ...
Adam Johnson's user avatar
5 votes
Accepted

how to add default products to related products list

You can write an observer for catalog_product_collection_load_after, then add products to the loaded collection if the collection is the related products collection: use Mage_Catalog_Model_Product as ...
Fabian Schmengler's user avatar
5 votes

how to add default products to related products list

You can do this with the help of a custom observer method. To do so, call your observer's function at event catalog_product_save_after. By using this, whenever a product will be saved from admin ...
Mohit Kumar Arora's user avatar
5 votes
Accepted

Magento 2.3: Error Assigning Related Products

I was able to fix this: First check the following tables in your DB: catalog_product_link_attribute and catalog_product_link_type If those are empty, you need to run the following SQL queries: ...
AJK's user avatar
  • 751
4 votes

How to show related products in product view page in Magento 2?

I presume you are falling back to the blank or Luma theme? If this is the case you need to move the related products using the <move> XML. <move element="catalog.product.related" ...
Ben Crook's user avatar
  • 15.7k
4 votes

Magento 2 - Quantity Field on Related Products Listing

Replace the content of if ($showCart) ...... endif with below code. <?php if ($showCart): ?> <div class="product actions product-item-actions"> <form data-role="tocart-...
Jarnail S's user avatar
  • 4,707
4 votes
Accepted

How to get the thumbnail image with getAttributeRawValue

The attribute thumbnail will give you the filename of the image to use as a thumbnail for the product. There's no constraints on the size of that image though and you're trying to resize the image ...
Richard's user avatar
  • 1,724
4 votes

Magento 2 : How to display swatches in related products?

To display Swatches along with the product name, thumbnail, etc, just like on the Category product lists, I did this in my Theme: Create this file: app/design/frontend/MyCompany/mytheme/...
thaddeusmt's user avatar
  • 1,395
4 votes
Accepted

Need to show related products of simple product in configurable product

If you want to display related products of child items instead of the related products of the parent item in a configurable product structure, then Create a new module and override _prepareData ...
Hammad Khalid's user avatar
4 votes
Accepted

Magento 1.9.3.X: Get all related products of a product

You can get the related products of a product by using the below code in your script. try { $configProductIds = [1663]; foreach ($configProductIds as $product_id) { $...
Sumit's user avatar
  • 4,930
3 votes
Accepted

Where is related product place in Magento2?

Html file is called from Catalog module. magento2.1/vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml Related, Upsell and cross sell product display inside detail page ...
Rakesh Jesadiya's user avatar
3 votes
Accepted

Move related products to custom div in custom phtml template

Move the element in your layout xml: <move element="catalog.product.related" destination="configurator"/> <referenceContainer name="page.wrapper"> <block class="Magento\Catalog\...
steros's user avatar
  • 1,622
3 votes
Accepted

Magento 1.9 not able to save upsell/related/cross sell products

I am guessing that you are using Google Chrome so you might want to try firefox. The upsell, cross sell, and related products tabs are loaded via ajax and due to the way different browsers handle ...
Shawn Abramson's user avatar
3 votes
Accepted

Custom Block generating an error on template: Magento

After trying to execute the given SQL query in phpmyadmin for a default Magento database, I got the following error: #1054 - Unknown column 'e.name' in 'field list' What this means is that the ...
V.S's user avatar
  • 914
3 votes

How to move reivew block after related product in magento 2?

Go To you theme Directory app/design/frontend///Magento_Catalog/layout/catalog_product_view.xml <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
Vinit Kumar's user avatar
3 votes
Accepted

Magento : Add product qty box in related product

You need to first add qty field in related_product.phtml file then rewrite function public function addAction() in file app/code/core/Mage/Checkout/controllers/CartController.php in this method ...
Shashank Kumrawat's user avatar
3 votes

Magento 2 - How to show related products in a thumbnail slider?

I assume that you are using a custom theme name Vendor_customtheme You can follow the below steps to implement OwlCarousel Slider for Related Product in the product detail page. Note: Below example ...
Pritam Biswas's user avatar
3 votes
Accepted

Get Configurable Product options, Price And Add to cart Button On Related Product Section

You can create same controller as default addToCart controller. public function execute() { $currentStore = $this->storeManager->getStore(); $baseUrl = $currentStore->...
anonymous's user avatar
  • 3,752
3 votes
Accepted

Magento 2.3 - Get category of item related foreach

Create a module and override catalog_product_view.xml in your module. then create one block to set your business logic to the template. Vendor/Module/view/frontend/layout/catalog_product_view.xml &...
Devidas's user avatar
  • 3,358
3 votes

Magento 2 : which tables is used for Related Products, Up-Sells, and Cross-Sells?

Currently there is no table which saves the data to check if a products was added through cross-sell or up-sell property. But for related products, the information is stored in product_options column ...
Afreen Sheikh's user avatar
2 votes

Magento2 Extending Magento\Catalog\Block\Product\AbstractProduct Class

Yes, you can't override classes having "Abstract" keyword in Magento. Alternatively, you can override the class \Magento\Catalog\Block\Product\View as it is the child class of \Magento\Catalog\Block\...
Deeps's user avatar
  • 784
2 votes

Missing cross-selling and related products option in admin

Go to Catalog > Product and open any product. You can find "Related Products", "Up-Sells" and "Cross-Sells" options in left side tabs.
Jaimin Parikh's user avatar
2 votes

How to show related products in product view page in Magento 2?

Default Theme Default theme(Luma) will show related products in bottom part of product view page. If not show, it is possible the Visibility of your related products is Not Visible Individually. ...
Key Shang's user avatar
  • 3,425
2 votes

How to get the thumbnail image with getAttributeRawValue

Try this. echo Mage::getModel('catalog/product_media_config') ->getMediaUrl( $product->getThumbnail() );
Bill Murray's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible