Hot answers tagged

2

To add orders programmatically, you can do so by using the Commerce_OrderModel class. Like so: $order = new Commerce_OrderModel(); $order->email = 'test@example.com'; // Add your products here and other order info... // ................. $success = craft()->commerce_orders->saveOrder($order);


2

Stumbled upon this looking to answer similar problem. You should be able to do this now without a plugin, using the multisort filter where you iterate through your profiles, e.g.: {% for profile in profiles|multisort(['profileLastname'],[SORT_ASC],[SORT_REGULAR]) %}


1

Managed to solve this. First, I've added a categories field to the order form. On the checkout page I loop over all lineItems in the cart and collect the category id's like this. {% set categoryIds = [] %} {% for item in cart.lineItems %} {% set categories = item.purchasable.product.productGroup.leaves().all()%} {% for category in categories %} {% ...


1

Yeh there's few workarounds. Your entries field is close to what Nathanial from P&T mentioned on the issue tracker: If you create a global set and add a custom product field. Then select all the products. This gives you the ability to drag and drop the order of the products. You can use this in conjunction with the on save event and catch the save of ...


1

You can use the same technique to set the line item data like this: {% set order = craft.orders.id(123).one() %} {% for lineItem in order.lineItems %} {% do lineItem.setAttributes({lineItemStatusId: 2}, false) %} {% endfor %} {% do order.setAttributes({ orderStatusId: 4, lineItems: order.lineItems }, false) %} {% do craft.app.getElements()....


1

Fixed it! The problem was that somehow, with that product, there was an issue with setting the status of the order to 'Paid'. Once I got that working, I saw the lineitems in my order.


Only top voted, non community-wiki answers of a minimum length are eligible