-
Notifications
You must be signed in to change notification settings - Fork 11
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
The entity_plus_view() function returns incorrect result in certain conditions #143
Comments
@alanmels thank you for posting this comment. As a maintainer for both Entity Plus and Ubercart I'm very familiar with the functions you are using here. In a nutshell: you are trying to use I see several issues with your code above. You are using a few Ubercart functions as if they were a full API, but unfortunately those functions are used as part of a whole process. You are bypassing several steps in the process.
So, my suggestion to you is that you take a close look at the whole process. It's possible to do all this programmatically, without doing all the UI forms. You would first need to add a node product to the shopping cart, then get the cart into the order and save it, then pass those items to As a side note: I don't think it's a good idea to change an Entity Plus API function ( I can help further with this if you need feedback or a second opinion 😄 |
I want to clarify/expand my comment - the nodes you are passing to |
@argiepiano I do appreciate much your insights. I've got the whole process working in regular conditions, however I'm trying to change the product items on the |
First, let me paste just the relevant part of a long custom function:
At this stage, the
$new_items
array contains twoNode
type objects as dpm() shows:Further processing through the
uc_order_product_view_multiple()
function turns theNode
objects toUcOrderProduct
objects.The problem starts when the
entity_plus_view()
looses one of the array members and returns incomplete result. Unfortunately, the function was returning just one item:until I changed the entity_plus_view() which looks like:
to:
Turns out if
$entity->order_product_id
is not assigned yet, then theentity_plus_view()
returns just one item (probably the last one overwrites the first one).I'm now trying to figure out if there is a way for the newly formatted
Node
objects (order products) to already haveorder_product_id
before passing touc_order_product_view_multiple()
function, but I thought to report this anyway, so you, guys, could consider changing theentity_plus_view()
function slightly to make it foolproof against similar cases whenUcOrderProduct
entities with noorder_product_id
are served to it.The text was updated successfully, but these errors were encountered: