-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Magento EE 2.1.0 'Configurable product "%1" does not have sub-products' #5762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@etessari correct me if I'm wrong, but configurable products are meant to have sub-products (aka Child). So what you are describing is not a bug, just the program letting you know that a configurable product must have sub-products. |
Hello @etessari ! I cannot reproduce your issue. If I create configurable product without sub-product, it is saved successfully as simple without exception. It is normal behavior. Configurable product without sub-product becomes a simple product. Could you clarify steps to reproduce or add some details? |
I get this error all of a sudden when I try to update from 2.0.8 to 2.1.0 |
My configurable products have sub-products (simple products) assigned but still get this error in 2.1.1. |
Hi @etessari , Thanks, |
I'm also seeing this issue with Magento 2.1.1, will report if I have extra information available how to fix the issue. |
I am using Magento 2.1.1 version and facing the same issue. |
I am having this issue in 2.1.1. It is happening when the first configuration simple product is 0 qty OR set as 'out of stock'. The exception is not occurring for other configurations that are not the FIRST simple product. To replicate, create configurable product, with more than one associated simple product. Set qty for the first simple product to zero or out of stock. |
Hi @oserediuk , |
Got the same issue as well, we've upgrade from 2.0.7 to 2.1.1, on 2.1.0 it was working. In vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsProvider.php:
The collection has a size when using
The collection isn't loading the products so the iterator isn't working thus the price is not getting set, I can't work out what is wrong if I do will update. |
If any one found the solution to above problem than please let me know. |
I am experiencing the same issue as @staffrob, CE 2.1.1 . Disabling the simple products that are out of stock in the configurable product's "Configurations" area resolves this, but this is obviously not a sustainable solution long-term. Screenshot below for where that option is. |
Can confirm the same problem as @staffrob in 2.1.1 |
I don't know why @magento-admin is not replying to this problem. Thanks |
Updating catalog_product_relation table from catalog_product_super_link resolved this issue. |
Hi guys, try this: |
Hi TienYiChi, |
@staffrob good point, I did what you said and it crashed again... |
tl;dr The array of subproducts is being limited to the first enabled product by the SQL generated in the LinkedProductSelectBuilders.I've been experimenting with debugging this, because it's a bit of a priority to have low or no stock products within my configurables. The sizeof() $this->getConfigurableOptionsProvider()->getProducts($product) in vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsProvider.php is returning 1 when my first simple product is quantity 0 but disabled. Hence, it returns only the first enabled sub-product, not all sub-products as it should. Diving deeper, Magento\ConfigurableProduct\Pricing\Price\ConfigurableOptionsProvider->getProducts() line 79
creates SQL that looks like this: 'SELECT This giant SQL statement returns an array like below when the first simple product in my configurable has a quantity of 0 but is disabled. It does not represent all simple products in my configurable, or even just the ones with quantity, what it shows is the entity_ids of the first two simple products in the configurable product. This is incorrect.
When the first simple product is enabled with a quantity of 0, the system crashes with the error in question and the $productIds array looks like this. I.e. it shows only the first simple product entity_id in the configurable product even though it's out of stock:
The error is thrown because
is null. It's filtering everything by the faulty $productIds array, which isn't representative of the configurable products options. Removing ->limit(1) or setting it to PHP_INT_MAX from LinkedProductSelectBuilderBySpecialPrice, LinkedProductSelectBuilderByBasePrice and LinkedProductSelectBuilderByTierPrice generates the correct full array of $productIds. I have no idea what ramifications this might have for other parts of Magento. |
@nissablagojevic seconding what @rsetht and @danny3388 said. Where did you find limit(1)? Is it in the SQL tables and if so which 1? |
@rsetht @danny3388 @Ctucker9233 you can find the limit() statements on these lines:
as @nissablagojevic mentioned, you can remove the limit or set it to some especially large value. this is a band-aid solution though, so be sure to test your install well. |
I've submitted a Pull Request for this issue, hopefully it's accepted and incorporated into the next version. For now, you can see the #7030 pull request and incorporate the changes into your own magento version. If you do, test thoroughly, and know that it's entirely at your own risk. My concern is that this will create performance issues on stores with large numbers of configurable products and options. |
I'm having this issue as well on magento 2.1.2 |
The error is no longer showing up on category or product page. Indexer set to Update on Save won't work either as described above. |
Just experienced this issue. I have a custom cronjob. The cronjob is responsible for looping through all the products and generate a feed. This issue |
i also have same problem . let me know if any one find solution. |
Hello. |
Quick fix with observing /**
* Local/Catalog/etc/frontend/events.xml
*
* <?xml version="1.0"?>
* <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" *xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
* <event name="catalog_block_product_list_collection">
* <observer name="local_catalog_block_product_list_collection" instance="Local\Catalog\Observer\Collection" />
* </event>
* </config>
**/
namespace Local\Catalog\Observer;
class Collection implements \Magento\Framework\Event\ObserverInterface
{
/**
* Collection constructor.
*/
public function __construct()
{
}
/**
* @param \Magento\Framework\Event\Observer $observer
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
$collection = $observer->getData('collection');
$parts = $collection->getSelect()->getPart(\Zend_Db_Select::FROM);
if (isset($parts['superlink'])) {
return $this;
}
$superlinkExpr = new \Zend_Db_Expr("
(
SELECT `parent_id`, COUNT(*) AS `child_cnt`
FROM `{$collection->getTable('catalog_product_super_link')}` AS `superlink`
GROUP BY `parent_id`
)
");
$collection->getSelect()->joinLeft(
['superlink' => $superlinkExpr],
'e.entity_id = superlink.parent_id',
[]
);
$collection->getSelect()->where("e.type_id != 'configurable' OR superlink.child_cnt > 0");
return $this;
}
} |
Hi @etessari We already have related ticket MAGETWO-60483 and the fix will be delivered soon. |
Same problem in 2.1.2. This happens when a configurable product has out of stock sub-products. As @nissablagojevic said, I had to disable out of stock product to do working. |
@shiftedreality Any ETA on an official fix? |
Have same problem, please fix |
have same problem |
Same Problem here. (2.1.2) |
@SKovbel I couldn't find where to put your temporary fix. Can you explain further what files should we modify? |
@shiftedreality Is this fix safe as is for a 2.1.2 production environment with a live website or do some modifications need to be made? |
We tested with 2.1.2 CE in production environment and it worked perfectly.
From: Ctucker9233 <[email protected]>
Reply-To: magento/magento2 <[email protected]>
Date: Thursday, December 8, 2016 at 1:34 PM
To: magento/magento2 <[email protected]>
Cc: Ali Ahmed <[email protected]>, Comment <[email protected]>
Subject: Re: [magento/magento2] Magento EE 2.1.0 'Configurable product "%1" does not have sub-products' (#5762)
@shiftedreality<https://github.com/shiftedreality> Is this fix safe as is for a 2.1.2 production environment with a live website or do some modifications need to be made?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#5762 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AUEf3de2Q0ncizanMYcDNU0VfBB2WQtiks5rGE22gaJpZM4JSu05>.
|
I installed Magento CE 2.1.2 with composer and I can't use this commit. I tried manually modifying the patched files and it completely broke my installation. Can you guys publish the next release with this patch or at least a patch for v2.1.2 because the whole CMS is unusable with this bug. |
Does 2.1.3 solved this? |
Yes, solved in 2.1.3
…Sent from my iPhone
On 18 Jan 2017, at 3:11 pm, PY Yick ***@***.***> wrote:
Does 2.1.3 solved this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
2.1.3 solved for me as well the problem |
Solved in 2.1.3. Thanks.
2017-01-18 7:48 GMT+01:00 PhiIipp <[email protected]>:
… 2.1.3 solved for me as well the problem
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5762 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAzWKeaQXwU6iwYPqAXeDxD_93aRbwAFks5rTbXNgaJpZM4JSu05>
.
|
Closed. |
[TSG-Commerce] Tests for 2.4 (pr12)
Steps to reproduce
Actual result
The problem is with the method, cause the configurable product has no child:
The text was updated successfully, but these errors were encountered: