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 ...
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 ...
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 ...
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 ...
I have preferred to add groupByAttribute for single list of color
$_subproducts = Mage::getModel('catalog/product')->getCollection()
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/...
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 ...
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->getProductUrl(); ?>
//get image url
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 ...
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();
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 = $...
$attr = $_product->getResource()->getAttribute('color');
$avid = $attr->getSource()->getOptionId('Blue'); //name in Default Store View
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.
So, this is my solution:
public function __construct(
Using Magento Version 18.104.22.168
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 ...
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 ...
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('...
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 ...
Facing with the same problem, today I wrote the following fix, it works both with attribute selectors and configurable swatches.
if (typeof ConfigurableMediaImages === 'undefined' || typeof optionsPrice === 'undefined' || typeof Product === 'undefined') return;
* Returns true, if there is a label-matching ...
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 ...
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 ...
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);
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);
To associate them
visibilty = not show inidividually
stock = in stock
price = also set
status = enable
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 "...
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 ...