-
Notifications
You must be signed in to change notification settings - Fork 2
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
How can i group/bundle products of order.lineItems ? #3
Comments
@craftcmscoder If I follow the question correctly you can use the So Hope this helps! |
Sorry, it doesn't works. It return the items in the cart only instead of order. Please Help !! |
@craftcmscoder hmm interesting I have this exact code working on a couple of sites so this sounds a little strange. Is there any chance that you could setup a debug template using the code below and send me the output? In this code please replace Debug template {% set order = craft.commerce.orders.first( { id: REPLACE_ME } ) %}
{% set lineItems = order.lineItems %}
<h3>NOT BUNDLED ROWS: {{ lineItems|length }}</h3>
{% for line in lineItems %}
<pre>
===
<ul>
<li>Desc: {{ line.description }}</li>
<li>options: {{ dump(line.options) }}</li>
</ul>
===
</pre>
{% endfor %}
{% set lineItems = order.lineItems|cartBundle %}
<h3>BUNDLED ROWS: {{ lineItems|length }}</h3>
{% for line in lineItems %}
<pre>
===
<ul>
<li>Desc: {{ line.description }}</li>
<li>options: {{ dump(line.options) }}</li>
</ul>
===
</pre>
{% endfor %} Hopefully this output will help decipher what is going on |
Well Something strange happened. The dump twig of line.option inside {% set lineItems = order.lineItems|cartBundle %} outputs 15000 lines of code.But i managed to cut out the option part. Here it is `
NOTE: The items under Bundled row are still coming from the cart |
@craftcmscoder I really don't think I follow what is going on here. From this side it looks like things are getting bundled as non-bundled rows are 5 and bundled rows are 2. So the plugin is bundling up some of the products together. I don't quite understand what you mean by "bundled rows are still coming from the cart" if you used the template in the previous post then they will be coming from an order as you explicitly got the data from an order. As mentioned before I have this working on a couple of sites in the Cart, Order Summary, Order email etc. Not sure entirely the best way to proceed with this, one option being allowing me access to the setup (code, db etc) so I could have a look and see what is going on |
Is there a way to group products on Order.lineitems. If not please provide a way of doing that.
The text was updated successfully, but these errors were encountered: