Checkout Attribute conditions not working

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi all
Sorry if this has been answered elsewhere but i am unable to find a solution.
I have added 2 checkout attributes and i want the second one to be dependent on the first answer using the conditions tab. However when I try to add a condition, it says "No attribute exists that could be used as condition". Just wondering if I have missed something in my setup. I am on V4.1.
Thanks
4 years ago
You need to save the checkout attribute before you can edit conditional attributes.
4 years ago
The first attribute in which the second attribute is to be dependent must have the control type of either
1) dropdown
2) radio button
3) checkbox
4) color square

if there are no attributes with the above control type then you would get the message "No attribute exists that could be used as condition".
It is because other attribute types like textbox, multiline textbox are of free entry types and it would be difficult to put conditions on the free entry values and thus NopCommerce does not support it.
4 years ago
New York wrote:
You need to save the checkout attribute before you can edit conditional attributes.

The user will get the message like "Please save the checkout attribute before you can edit conditional attribute " in case the attribute has not been saved.
4 years ago
Hi Sanju
Thank you for the reply.
My first checkout attribute is a drop list with "Yes" and "No" as the possible values. However the second attribute still has "No attribute exists that could be used as condition." come up when I try to add a condition.
4 years ago
Ok, I just downloaded 4.1 and tested and I found a similar issue. When I debugged the solution I found a bug in the code which prevents the conditional attribute to be loaded. There is an unnecessary guard block implemented in the
PrepareConditionAttributesModel()
method of the
CheckoutAttributeModelFactory
class.
You need to remove the guard block which validates the enable condition.
if (!model.EnableCondition)
                return;

The enable condition value is determined on the basis of
conditionattributesxml
being null or not. It is always null when created so the code flow will never proceed forward where the condition model is prepared. So you need to remove the guard block from the code.
4 years ago
sanju.dahal741 wrote:
When I debugged the solution I found a bug in the code which prevents the conditional attribute to be loaded.


Hi.
You are right. This has already been fixed in 4.20. See details here.
4 years ago
Thank you all for the replies and solution. All sorted. Very much appreciated.
3 years ago
I Use 4.10 without source code. Is possible to fix it in 4.10 version?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.