On the backend product edit page, everything seems all right, all options are loaded from the custom source / database table


On the frontend, the configurable product drop-downs show the correct attribute name and the right amount of options for each attribute, but the


This error also appears on the product configuration modal (backend / new order).


Inspecting the code of the product view page, I've found this part where we see the wrong option labels being applied (the attribute labels are correect, only the options labels are wrong):
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"configurable": {
"spConfig": {"attributes":{"286":{"id":"286","code":"ticketsale_session","label":"Session","options":[{"id":"1","label":"Male","products":["72","73","74","75"]},{"id":"3","label":"Not Specified","products":["76","77","78","79"]}],"position":"0"},"287":{"id":"287","code":"ticketsale_sector","label":"Sector","options":[{"id":"1","label":"Male","products":["72","73","76","77"]},{"id":"4","label":null,"products":["74","75","78","79"]}],"position":"1"},"288":{"id":"288","code":"ticketsale_ticket_type","label":"Ticket Type","options":[{"id":"32","label":"Full price","products":["72","74","76","78"]},{"id":"33","label":"Half price","products":["73","75","77","79"]}],"position":"2"}},"template":"R$<%- data.price %>","optionPrices":{ /* removed for simplicity */ },"productId":"71","chooseText":"Choose an Option...","images":[],"index":{"/* removed for simplicity */},
"onlyMainImg": true }
}
}
</script>
@pguedesbr thank you for your feedback.
Magento 2.1.x no longer supports PHP 5.5. You can find Magento technology stack requirements here.
Can you confirm that the issue is reproduces when some of supported PHP versions is used?
Im sorry for the wrong info.
I'm not really running on php 5.5 (magento wouldnt even install).
I've just updated php and mysql versions in the original post with confirmed values.
Magento 2.1.1 (updated from 2.0.8)
PHP 5.6.25
MySQL 5.6.23
I confirm everything worked as expected in 2.0.8, and options started showing up with wrong labels (but correct values) after I've updated to 2.1.1.
I've just did a clean install of Magento 2.1.1 with composer. The problem persists.
The product has 3 drop-down configurable attributes, of which 2 have custom source and 1 has standard values set via backend interface.
I dont know if this is related but:
While the 2 attributes with custom source show wrong option labels when configuring the product (both in backend and frontend), if you proceed with the order anyway, they show up nicely on the order details page items grid, just bellow the configurable product name.
On the other hand, the 3rd attribute with standard options (no custom source), which show the correct option labels when configuring the product, doesnt print any value after the order is placed. Its attribute name shows up bellow the product name on the items grid of the order detail page, but with no values.

The order confirmation email also prints the correct attribute values for the attributes w/ custom source, and empty value for the standard attribute.
Any updates on this?
I've done some code inspection and realized one thing:
The custom attribute has a source model with its own table. The values of these tables go from ids 1 to 3.
When loading attribute options for the product configuration block (on the product view page and order create/product configuration modal), the system loads the options from the standard attribute options table (eav_attribute_option_value) for the corresponding ids (1 to 3), which result in options with the labels "Male", "Female" and "Not Specified".
Therefore, I think Magento is loading these options from the wrong table, when it should call getAllOptions() in my custom source model instead.
Please notice it only happens in the beforementioned blocks. The options show up correctly in other part of the system, like in the backend product edit page, in the cart and in the order details. page/email.
On the other hand, the issue with the Ticket Type attribute in the previous examples, which is a regular attribute with no custom source, is that, even though it has admin labels for the options, the values show up blank in the cart and order details page/email, unless I add labels for the default store view. Im using single store mode fyi.
I've pinned down the problem to this file:
\vendor\magento\module-configurable-product\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection.php
In 2.0.8 the loadOptions() function called the getIncludedOptions() which in turn called the getSource()->getSpecificOptions(). That means that attributes with custom sources would have its options loaded by their custom source models.
Now in 2.1.1 the loadOptions() uses the $configurableResource->getAttributeOptions() which in turn read the options directly from the eav_attribute_option_value table, assuming the configurable product attribute uses one attribute with standard source (drop-down) and ignoring attributes with custom source.
I'm having the same problem: I'm working on a sunglasses website where I need to use custom attributes to display different technical specs such as polarisation, frame material, anti-scratch and so on. Based on the each tech spec (yes/no) attribute value, I assign an icon to the product, and it actually worked all fine. I wrote my own module for this particular task.
However now I'm building a wholesale section which basically listing products with qty and add to cart, follow the product name I would like to display one particular tech spec icon which is very important for some wholesellers. I tried to use the same approach I did before but it didn't work, I didn't write a separate module for this task because my wholesale page was based on a custom template. Theoretically it's quite a simple task but somehow the same code I used produces different results:
$_product->getResource()->getAttribute('attribute-code')->getFrontend()->getValue($_product);
In my custom template when I print product details (name, sku, etc.) they all correct, same as when I examine attribute label. It's just the actuall attribute value is wrong. It returns No no matter what value you assign to it.
Hi @pguedesbr ,
Thanks for reporting this issue.
We've created internal ticket MAGETWO-61058 to address this issue.
Hello @oshmyheliuk
Any updates on this issue?
Same problem here on magento 2.1.4
Still having this problem on Magento 2.1.6 with custom source model and custom database table.
On frontend it just show "male" and "female" while in backend it shows the correct values according to the custom database table.
@codedge Do you mean the options now show correctly in the backend new order product configure modal window? Because that's where it was wrong in the backend. It has always showed correctly in the product edit/create form and the order details page.
@pguedesbr Well, in my case the options show up correctly in backend, but _not_ in frontend. Foe ex. on the product detail page (frontend) the options show "female" oder "male" instead of the values from the custom source model / custom database table.
In backend when creating a new product or editing one I get the correct values from the source model.
This is exactly what I meant in my previous reply, aswell as in the original post.
In the backend, the options show up correctly on the product edit/create page, but it doesnt mean the all is good in the backend, since the options are wrong in the product configuration modal window when creating a new order and configuring a product for it.
TL;DR = Nothing has changed ever since, and this is still breaking configurable products which use attributes with custom source model. =(
I find this a really severe bug! Using configurable products with own attribute values is a valid use case for Magento shops. That's one of a couple of reasons why I used Magento 1. Now finding out that this couldn't be fixed withing more than 6 months makes it really annoying.
But as important this problem is I cannot see others (people, developer, etc.) complaining about this. I couldn't find any other bug reports or hints about this problem execept this bug report here.
Really strange.
@codedge I fully understand your struggling as when I was 3 month into Magento2 I was on my edge of collapsing - for just about everything (health for being working min 18 hrs daily, confidence and moneywise as I work for myself). I wanted to give up magento altogether and just go back to MVC framework with third party shopping cart solution and start everything from scratch.
Now after working for min 3 days/wk for 10 month, I launched my first M2 store. For the first couple weeks, I get phone calls every day from clients reporting new issues and most of them are bugs. It's kinda weird feeling as I'm supposed to be proud because I made it to production but not at all, I'm just deeply disappointed and angry!
Anyway, I did get away with the custom attribute not returning the correct value issue (in my case is a yes/no attribute type) by using this:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($_product->getId());
$CustAttributeValue = $product->getData('custom_attribute_code');
The above works for me in theme templates, and if you read my first post, below works in custom module:
$_product->getResource()->getAttribute('attribute-code')->getFrontend()->getValue($_product);
You cannot always rely on Magento version update to fix a particular bug as there're couple thousands of issues on the awaiting list, to me Magento Stack Exchange is the best place to get some lights.
I've literally had a breakdown after months of working on my magento 2 project (a very challenging to develop ticket sale module). After struggling with reverse engineering and getting to understand Magento 2 inner workings, I ended up with heart problems due to stress, which caused me to undergo a pacemaker implant surgery last December.
In the end, nowadays I just have the confidence to debug issues and most of the times conclude that some things are just a brand new magento bug. Some of them, we fix with plugins of our own, never editing core files.
I second that:
You cannot always rely on Magento version update to fix a particular bug as there're couple thousands of issues on the awaiting list, to me Magento Stack Exchange is the best place to get some lights.
@pguedesbr, thank you for your report.
The issue is already fixed in 2.2.0
I am getting the same error for configurable product's selected option in cart and checkout. I am using Magento EE 2.3.1 and have imported configurable products using REST APIs.
On the product page, all the configurable options are shown properly and we can add product with different options to the cart but selected option values are blank in the cart items. How to fix this issue?
PS: When we manually add new configurable attributes to the same products and add it to cart with different options, those manually added attribute values are properly shown on the cart page.
I have replicated the same issue on magento 2.3.2.
Magento attributes like color do show correctly.
Custom attributes show correct on product pages but when you go on the cart page they show empty. Proceeding with the order when i get the email i still do not see the attribute values.
The Values are missing also on the order page on the admin area.
So the attribute values are missing on:
1) Cart page
2) Checkout page
3) Order confirmation pages
4) Admin order view
Default magento attributes work as expected
I repeated the problem like this @rafashkembi wrote
Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @VivekShingala , @rafashkembi . Only system attribute have predefined options, but they couldn't be used in configurable products as configurations.
If we want create custom attributes for configurable product those attribute should be user_defined and shouldn't have custom source. In this case configurable product woks as expected.
Are You able to reproduce issue without custom source on 2.3-develop?
Hi @engcom-Delta . I can confirm the issue was not on Magento but on how the attributes were created. I had some configurations wrong.
Most helpful comment
I've literally had a breakdown after months of working on my magento 2 project (a very challenging to develop ticket sale module). After struggling with reverse engineering and getting to understand Magento 2 inner workings, I ended up with heart problems due to stress, which caused me to undergo a pacemaker implant surgery last December.
In the end, nowadays I just have the confidence to debug issues and most of the times conclude that some things are just a brand new magento bug. Some of them, we fix with plugins of our own, never editing core files.
I second that: