25 votes

Getting simple products from configurable

The answers to this question are wrong. Although their implementations might work, it's not the proper way to handle this. The correct way to do this is by using Magentos' service contracts and data ...
user avatar
  • 11.6k
19 votes
Accepted

Magento Configurable Product Price Overriding Simple Product Price

When you create a configurable product it doesn't matter what's the price of simple products -- these prices are ignored completely. So if you want to sell a simple product A which has price $29.99 ...
user avatar
  • 3,405
17 votes

Magento Configurable Product Price Overriding Simple Product Price

So, I use the code below in combination with an extension like organic internet simple configurable products. The code below is meant for the cart/checkout process, essentially, it's an update to ...
user avatar
  • 321
15 votes
Accepted

Magento2 get variants of configurable products

Try with $product->getTypeInstance()->getUsedProducts($product).
user avatar
  • 195k
14 votes
Accepted

how to get product thumbnail and product url in order confirmation email

you have to load product to get thumbnail and url . <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('Magento\Catalog\Model\...
user avatar
13 votes
Accepted

Getting attribute from simple products of configurable products

I have preferred to add groupByAttribute for single list of color $ids=Mage::getResourceSingleton('catalog/product_type_configurable') ->getChildrenIds($parentId); $...
user avatar
  • 75.7k
12 votes
Accepted

How to get all simple product which does not have configurable product

This is just an adaptation of what Amit Bera answered. I just took the code and transformed it into one single query instead of 2. The idea is to join left the products table with the table that keeps ...
user avatar
  • 195k
9 votes
Accepted

Magento2 Create simple Product programmatically only works once

Injecting Magento\Catalog\Model\Product in the constructor means, you get the same instance every time (like a singleton). That does not make sense for models. Instead you should inject Magento\...
user avatar
8 votes
Accepted

Magento 2 - Set simple product Color when creating product programmatically

$attr = $_product->getResource()->getAttribute('color'); $avid = $attr->getSource()->getOptionId('Blue'); //name in Default Store View $_product->setData('color', $avid); I found the answer from here ...
user avatar
8 votes
Accepted

Disadvantages for virtual product?

There is no major disadvantage of that. But main concept is if product has a weight then you need to deliver it physically. If product has no weight that means its virtual product (Something which ...
user avatar
  • 9,580
8 votes
Accepted

Stop simple product images overriding main product gallery after clicking swatches

By adding the following code to the theme's view.xml the image from the simple product is now added to the product gallery rather than replacing the one associated with the configurable product. <...
user avatar
  • 172
7 votes

Programmatically duplicated product not getting displayed in frontend

I believe the simplest way to do this is to use the product's "duplicate" method. You'll have to reload the duplicated product, should you need then to change any of it's properties and save again: //...
user avatar
7 votes
Accepted

Get list of simple products which don't belong to a configurable

Thomas,Magento did not provide this type on function,So without any coding or MySQL Query,you can not get the solution. Mysql: Magento save the relation between configurable product and it child ...
user avatar
  • 75.7k
7 votes
Accepted

Magento2 - How to see if configurable products has simple products attached

Try below script from magento2 root: <?php error_reporting(E_ALL); ini_set('display_errors', 1); use Magento\Framework\App\Bootstrap; try{ require __DIR__ . '/app/bootstrap.php'; $...
user avatar
  • 3,754
7 votes
Accepted

Magento 2.3 Saleable stock qty does not equal Global Attribute Qty

Check inventory_reservation: https://github.com/magento-engcom/msi/wiki/Salable-Quantity-Calculation-and-Mechanism-of-Reservations If you don't wan't to use MSI (and stick to CatalogInventory_* from 2....
user avatar
  • 562
6 votes

how to check if a product is a simple product and not a child of a configurable product

Simply I did: (Magento 1.8) if($_product->isConfigurable()) { echo 'config'; }
user avatar
6 votes

Convert simple product to configurable

You don't need to start from scratch. The configurable products in Magento work like this: for each configurable option there is a simple product. Example. You want to configure a product by color ...
user avatar
  • 195k
6 votes
Accepted

How to add simple product to cart instead of configurable product in Magento2

So, this is my solution: class Cart { protected $quote; protected $request; protected $configurableproduct; protected $urlinterface; protected $productrepository; public function __construct( \...
user avatar
  • 160
6 votes
Accepted

Get collection of simple simple products in Magento2

This should do the trick public function getProducts() { /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */ $collection = $this->_productCollectionFactory->...
user avatar
5 votes

Quick Simple Product Creation: Add new Custom Attribute of MultiSelect each time When I Want to Add New Simple Product

So the quick create form can be found at Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Simple and it has a nice and simple check for adding attributes. Firstly what it does is loads all ...
user avatar
5 votes

Magento Configurable Product Price Overriding Simple Product Price

Using Magento Version 1.9.2.2 May be slightly better solution, use 'Observer' approach instead of hacking the core or even overriding the default Model Price class i.e. app/code/core/Mage/Catalog/...
user avatar
  • 51
5 votes
Accepted

How can I stop other attributes changing my swatch image?

Facing with the same problem, today I wrote the following fix, it works both with attribute selectors and configurable swatches. $j(document).ready(function() { if (typeof ConfigurableMediaImages ...
user avatar
5 votes

Get Custom Option Values of a product magento 2

Try this: $_product = $block->getProduct(); foreach ($_product->getOptions() as $o) { if ($o->getTitle() != 'Color') { // or another title of option continue; } foreach ($...
user avatar
5 votes

Disallow sell of a simple product but allow that product to be sell in bundled product

Just simple solution for that Just Set that simple Product visibility to Not Visible Individually Hope this will help you and let me know if its not working
user avatar
4 votes

how to check if a product is a simple product and not a child of a configurable product

What you can do is use the function getParentIdsByChild on the class Mage_Catalog_Model_Product_Type_Configurable. This function takes in a possible child product id and will return an array of parent ...
user avatar
4 votes

Configurable Products Not Showing in Search or Catalog

In your configurable product, there is an attribute with name Visibility. You need to set it to Catalog, Search. This would make your product visible in search. You may probably forgot to do it. So ...
user avatar
4 votes
Accepted

Unable to get inventory status of configurable products

The issue I was running into was that loadByAttribute() does not act in the same way that load() does and therefore I would need to fetch the id of the simple product then once again load the simple ...
user avatar
4 votes
Accepted

wishlist simple product of configured deleting / replacing one another

Did some testing on a Magento 1.9 installation and figured out how to swap the products. The trick lies in the $buyRequest $buyRequest = new Varien_Object($requestParams); // this is the original ...
user avatar
  • 37.4k
4 votes
Accepted

how to set base image in coding while adding image programmatically

To save product base image use this, if(//baseimage only one time) { $mediaAttribute = array ( 'image', 'thumbnail', 'small_image' ...
user avatar

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