18

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 and a simple product B ($39.99) then you must create a configurable product, set its price to $29.99 and open Associated product tab. Add products you want to ...


17

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 models. In this case, it's the Magento\ConfigurableProduct\Api\LinkManagementInterface Service contract you need. A small example of code I'm using in a ...


16

I don't know if recommending an extension counts as a valid answer (for a question with a bounty) but someone claims here that he wrote an extension that does exactly what you need. Extension can be downloaded from here. I haven't tested it but, as soon as I do, I will post and update. I only looked through the code and there is a lot of it. I lost interest ...


16

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 the configurable price model that passes price calculation to a simple product in the event the product has been added to the cart --- this solution DOES NOT ...


13

I have preferred to add groupByAttribute for single list of color $ids=Mage::getResourceSingleton('catalog/product_type_configurable') ->getChildrenIds($parentId); $_subproducts = Mage::getModel('catalog/product')->getCollection() ->addIdFilter ($ids) ->addAttributeToSelect('color')-> groupByAttribute('color');


12

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 the relation between simple and configurable, and filter only the products that don't have such a relation: $collection = Mage::getResourceModel('catalog/...


12

Try with $product->getTypeInstance()->getUsedProducts($product).


8

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 we don't need to deliver it but we can download it or get the details of it from the website only) Suppose you have T-Shirt (Configurable Product) - Now all ...


8

you have to load product to get thumbnail and url . <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('Magento\Catalog\Model\Product')->load($_item->getProduct()->getId()); echo $product->getThumbnail(); echo $product->getProductUrl(); ?> //get image url $imagewidth=...


6

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


6

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: // assume $product is a loaded product to duplicate $duplicated = $product->duplicate(); // re-load the duplicated product to set it's SKU $duplicated = $...


6

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 products at catalog_product_super_link and save it product basic data at catalog_product_entity Table. Write select query with select type_id=simple simple ...


6

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\Catalog\Model\ProductFactory and then instantiate the product like this: $product = this->productFactory->create();


6

$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 for a simple product. I post here the code because the post I am referring to does not point out which Product Attribute value should be used.


6

So, this is my solution: class Cart { protected $quote; protected $request; protected $configurableproduct; protected $urlinterface; protected $productrepository; public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Request\Http $request, \Magento\ConfigurableProduct\Model\Product\Type\...


6

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'; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $resource = $obj->get('Magento\Framework\App\ResourceConnection')...


5

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/Model/Product/Type/Configurable/Price.php All you have to do is to use Alan's code within your newly created Observer the only difference is instead of returning ...


5

If you add a custom options to a product you can add, for example for dropdown options, a product sku suffix as shown below. On choosing an option when adding the product to cart and retrieving the SKU in the cart var_dump($_item->getSku()); you can see the products SKU has been changed Now for dynamically updating the SKU on the product page. For this ...


5

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 attributes that are for the product type simple and are attached to the attribute set chosen for your configurable product. $attributes = Mage::getModel('...


5

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 and size. You need simple products with every combination of size and color you want to sell a configurable product is just a wrapper over the simple products ...


5

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 === 'undefined' || typeof optionsPrice === 'undefined' || typeof Product === 'undefined') return; /** * Returns true, if there is a label-matching ...


5

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


4

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 ids if there are any. $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId); If there are no parent ids then ...


4

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 go to Catalog > Manage Products. Select the configurable product. Under General tab, set Visibility to Catalog, Search. Make sure product is assigned with ...


4

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 product. Below is the corrected code: $productId = $_item->getProductId(); $product = Mage::getModel('catalog/product')->load($productId); if($product->...


4

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 code [...] $productId = (int)$this->getRequest()->getParam('product'); $product = Mage::getModel('catalog/product')->load($productId); if($product->...


4

To save product base image use this, if(//baseimage only one time) { $mediaAttribute = array ( 'image', 'thumbnail', 'small_image' ); } else { $mediaAttribute = null; } $product->addImageToMediaGallery($filepath_to_image, $mediaAttribute, true, false); Edited //3rd ...


4

To associate them not needed: visibilty = not show inidividually stock = in stock price = also set status = enable needed: attribute set = the same as configurable product to create a config Beside this you need to make sure, that the attributes you want to be configurable are NOT system, "Global", input type "Dropdown" and "allowed for configurables" ...


4

Make sure that you associated the simple products with the configurable product. Therefore, go to the configurable product, open the "Associated Products" tab, select the appropriate simple products and save. If you do not see your simple products there, make sure to click on "Reset Filter" (and that your simple products have the same attribute set as your ...


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