Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6539751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:53:47+00:00 2026-05-25T10:53:47+00:00

I was doing some debugging, trying to see how a condition for a promotion

  • 0

I was doing some debugging, trying to see how a condition for a promotion on the shopping cart was validating attributes when using the product attributes combination. I didn’t understand how Magento was getting custom attribute values from a product, if that custom attribute isn’t added to the quote item product in a config.xml.

So as I was debugging down into the the validation logic, I did a test where I created an attribute called package_price and assigned it to a product and gave it a value of 20. I then setup a condition:

If an item is FOUND in the cart with ALL of these conditions true:
Package Price greater than 1

As it got down into the logic you eventually get here /app/code/core/Mage/Rule/Model/Condition/Abstract.php

and in the method validateAttribute. It gets here after attempting to get the attribute value out of the quote item product. In my case the parameter $validatedValue was null since it couldn’t get it off of the data array.

The code works right getting down to here

            case '<=': case '>':
            if (is_array($validatedValue) || is_null($validatedValue)) {
                $result = false;
            } else {
                $result = $validatedValue<=$value;
            }
            break;

And it obviously gets set to false. What I don’t understand after the switch statement you have this little piec of code

if ('!='==$op || '>'==$op || '<'==$op || '!{}'==$op || '!()'==$op) {
            $result = !$result;
}

Which sets certain operators $result variable to be the opposite, so in my case it made it true and then made my condition pass even though it shouldn’t have. I am thinking that any time someone makes a shopping cart promotion with custom attributes that are not added to the quote item, which would happen a lot if you just have admin users running the interface trying add new attributes to products and create promotions with them.The the promotion would always pass if they used one of these operators. I can’t for the life of me figure out what would need this or why > would be any different than >=.

Not to mention, don’t you think any attribute that is marked as used for promo conditions should be added to the quote item product?

Can someone help me understand this as to why it needs to work this way. I wanted to post this here before contacting Magento.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:53:47+00:00Added an answer on May 25, 2026 at 10:53 am

    This is a bug for at least Enterprise Edition and there is a patch available now if you contact Varien Support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some error debugging trying to get the errors on our website down
I've been doing some HTML scraping in PHP using regular expressions. This works, but
Doing some debugging in windbg, and I'd like to be able to go through
I am doing some heavy calculations with Python (using OpenCV and Numpy) and in
After doing some work with Ruby, Rails, and RSpec last summer and I learned
I'm doing some PHP stuff on an Ubuntu server. The path I'm working in
I'm doing some funky authentication work (and yes, I know, open-id is awesome, but
Currently I'm doing some unit tests which are executed from bash. Unit tests are
I am doing some research on Unicode for a white-paper I am writing. Does
I've been doing some mocking with RhinoMocks and it requires that mocked methods be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.