Skip Navigation

[Resuelto] Problem with the loop to see the product rows in an order

This support ticket is created hace 5 años, 1 mes. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Etiquetado: 

Este tema contiene 18 respuestas, tiene 4 mensajes.

Última actualización por Francisco Ramón Molina Busquiel hace 5 años.

Asistido por: Nigel.

Autor
Mensajes
#1363527
sc_001.png

Hi,

The standard way of get the rows of an order (https://toolset.com/learn/create-an-ecommerce-wordpress-site/displaying-more-information-from-woocommerce/how-to-display-woocommerce-orders-on-the-front-end/) does not work when several rows of the order are from the same product. I use Formidable Forms, with this plugin the same product can have different characteristics, so in an order there can be several lines with the purchase of the same product but which has been purchased with different characteristics. Your loop is not well done, it does not loop through the different lines of a product, it loops through the different products, so if an order has 10 lines of the same product, only the first one is shown.

I think the problem is that for the "view" the type "Products" is chosen, there should be a type for row items, but this type does not exist.

Look at the screenshot.

Regards,
Jose A.

#1363777

Yes from what I understand WooCommerce does not store product variations as a public post type, and this products-in-order View works best for simple products. I'm not aware of a way to show variable products in our View of Products in an Order. That would require custom programming that falls outside the scope of our support, as Minesh points out here: https://toolset.com/forums/topic/trying-to-get-product-variant-selections-to-display-with-list-of-ordered-items/

#1363787

But Toolset is supposed to be used to do this kind of views, if Toolset is not prepared for this then I don't understand anything. It is a very serious limitation that you should have taken into account. You give an example to visualize the orders and the lines of the orders and it turns out that it does not work correctly. That is to deceive the user. 🙁

#1363799

I'm sorry, variable products are not supported. If you want this feature included in the software you can ask to have it added here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

#1363803

Hi Christian Cox,
What I am using are not variable products, they are simple products, what happens is that Formidable Forms adds new selection fields, but the products are still simple products, they are not variable products.
The problem with Toolset is that it is not looping on the true rows of the order, since if it were doing so it would work perfectly. This is a Toolset problem. Toolset not doing the loop correctly. 🙁
This is not a problem of variable products.
Regards,

#1363833

Okay I misunderstood, sorry. May I make a copy of your site, since I'm not really familiar with how Formidable Forms modifies the simple product?

#1364563

Hi Christian,
Something new? Can I reconnect IThemes Security?
Regards,
Jose A.

#1365071

Sorry for the delay, I do not work Fridays or Saturdays so I wasn't able to get back to you sooner. I have downloaded the site clone and I am finished with the User account now. You can reconnect the security system. I will take a look at how the FF plugin stores information about each line item of the order, and ask my 2nd tier team if there is a way we can adjust a View to loop over those line items individually instead of iterating per product.

#1365251

Hi Christian,
Formidable Forms saves the fields added to the product regardless of the product, in each row of the order it simply indicates the entry number in which these fields are located, so it does not produce changes in the product.
There are many interesting things in Formidable Forms that you should include in Toolset Forms, auto-calculate fields, visual design of fields, styles and much more ...
Formidable Forms is a great product.
When you know how to loop through the rows of an order with Toolset please let me know.
Thank you very much for your help.
Regards,

#1367367

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Christian asked me to take a closer look at this.

What you want to do is not possible with Toolset without adding a custom solution, I'm afraid.

Views is built upon the WordPress class WP_Query and is used for querying WordPress content types (posts, users, taxonomies).

WooCommerce orders are a type of post, and so are amenable to querying using Views.

But the content of orders are stored in custom database tables and are not accessible to WP_Query.

It's not the case that Toolset is not looping over the Orders correctly, the issue is that Order line items are not a post type and so the WordPress query loop is not relevant here, you are asking it to do something which it is not designed to.

That's why a custom solution is required.

With the wpv-ordered-product-ids shortcode we created a glue-shortcode to help bridge the gap between standard WordPress loops and the custom storage used by WooCommerce. It has one intended use, which is to retrieve the products belonging to an order, and that works. It can then be used to create a second query which loops over the products of the order.

Your use-case is different. You want to be able to iterate over the line items of an order (I'm being careful not to use the word 'loop', because in WordPress that has a specific meaning). Because line items are not a WordPress content type (posts, users, taxonomies), it is simply not possibly to "loop" over them using Views.

This needs a custom solution. I'm not even sure how we would implement it if you were to request it as a feature. We might possibly create something like the wpv-for-each syntax that for an order determined by the context would repeat content for each line item, I'm not sure.

You are welcome to submit a request for that: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

You could try the contractors to find someone to implement it for you (https://toolset.com/contractors), but in this case WooCommerce expertise would be more important than Toolset expertise.

But I'm afraid implementing such a solution is outside the scope of support.

#1367439

Hi Nigel,

Yes. What you say is logical, however, your implementation to "loop" for the lines of an order using the products is not a valid approach to the problem, in fact, it is completely wrong, since an order can have the same product in several lines.
As you say, the lines are not a content type, but Toolset has been developed, if I'm not mistaken, to exploit WordPress data, and WooCommerce is one of the most important WordPress plugins, so the correct thing is that you include some special functions (features) to cover the "loop" for the lines of an order, since not having these functions means that Toolset's capabilities to work with orders are very limited, if not completely reduced. Even the examples you have are completely invalidated. This is a serious limitation of the functionalities that Toolset can provide, and, in my modest opinion, you should solve immediately, but you will see what you do.

Regards,

#1367537

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

I don't think it is correct to say that the implementation for looping the items of an order is wrong, because the feature does not exist in Toolset.

I see that you submitted a feature request as suggested.

The request will be received by the product manager and the lead developer, and they will evaluate it and decide on implementation.

I hope you appreciate there is not much else we can do here in support in this case.

#1367675

In that case you should remove the part of the article that talks about the products (https://toolset.com/learn/create-an-ecommerce-wordpress-site/displaying-more-information-from-woocommerce/how-to-display-woocommerce-orders-on-the-front-end/) or at least put a note on it indicating that only products are shown, it is not useful to show products and quantities or other information related to the order line, only It has the utility of displaying the image of the product, but nothing more. If you do not indicate this, it can lead to a lot of confusion on the part of the users.
Thanks Nigel.
Regards,

#1368415

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

I have created an internal ticket for the documentation team asking them to clarify this on that page about displaying orders. We also have your feature request, which hopefully the developers will adopt.

Sorry to not be able to do more for you this time.

#1368509

Okay. Thanks Nigel.
If the developers tell you something, tell me.
Regards.