Timeline for Programmatically alter custom checkout panes depending on cart quantity
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 28, 2014 at 13:57 | vote | accept | Kojo | ||
Aug 28, 2014 at 13:57 | vote | accept | Kojo | ||
Aug 28, 2014 at 13:57 | |||||
Aug 8, 2014 at 9:22 | comment | added | Andy | Glad it helped! | |
Aug 7, 2014 at 15:44 | history | bounty ended | Kojo | ||
Aug 5, 2014 at 11:48 | history | edited | Andy | CC BY-SA 3.0 |
added 642 characters in body
|
Aug 5, 2014 at 11:37 | comment | added | Andy | @Kojo Understood, but then really you have to write something yourself (AFAIK). The non-combined line item approach gives you a neat data model (you can use the Field API, Views, EFQ) and combined with editablefields and commerce views pane, a neat way to display the fields at checkout (if it works!). I'll update the Q with one last method based on your desire to have single line items with multiple customisations, but you'll need to write your own checkout pane and attach the line item fields to it. | |
Aug 5, 2014 at 10:07 | comment | added | Kojo | If I turn off combining like items in the cart, I'll have a line item with qty 3 when added to cart; there will be another line item only if added again to cart later. this doesn't solve anything, sorry. And I'm afraid this doesn't make sense from the customer logic : if if books 1 and then changes his mind, and books a 2nd one, he's expecting to see a single line in cart, with qty 2. | |
Aug 5, 2014 at 9:11 | comment | added | Andy | @Kojo IIUC the problem is that you're combining line items. You want to ensure customisable product line items can't be combined. For example if s.o. orders 4 Venice trips, there will be four separate venice trip line items with quantity 1. Then the view should automatically show the correct number of fields. | |
Aug 5, 2014 at 8:58 | comment | added | Kojo |
gonna try hook_views_default_views_alter(&$views) as per that answer
|
|
Aug 5, 2014 at 8:51 | comment | added | Kojo | So I need to define these fields only once (note that in case of line item fields, I'll have to add them once for each line item type...) and then make a loop to add x fields of each, depending on the qty ordered. Maybe in your FAPI solution, with a hook on the view to alter the view output and add editable fields on the fly ??? I'm desperate to explain further more, this is was I exposed the study case, I thought this would be clear enough? | |
Aug 5, 2014 at 8:51 | comment | added | Kojo |
Andy, filter line items types is not the pb, thanks. What you described works fine for any field added to line items. the main pb I'm facing: if the customer orders 4 products A or/and 3 products B, I'll need to display following editable fields: for product A, name2/firstname2/name3/firstname3/name4/firstname4 ; for product B, name2/firstname2/name3/firstname3 . I wish I don't have to add in the UI 15 fields name + 15 f. fname, and so on, for each line item ! And if so, I don't see how I would filter in the view to display only the necessary ones???
|
|
Aug 4, 2014 at 18:09 | history | edited | Andy | CC BY-SA 3.0 |
added detail to the clean Field API method
|
Aug 4, 2014 at 18:04 | comment | added | Andy | @Kojo Assuming you've added the fields to the line item and not the order entity it should work automatically. The View is passed the order ID and lists all the associated line items. (Oh yeah, so you should probably also put a filter in the view to ensure it's only the right kind of line items - I'll update the answer.) Before trying to get it working as a checkout pane, test it in Views preview. | |
Aug 4, 2014 at 17:44 | comment | added | Kojo | Really appreciate your efforts to help! Tried FAPI method. Could you explain how I will tell the view to display 2 fields 'name' & 2 '1rst name' if 2 participants(pax), 3 fields of each if 3 pax ? Because THIS is the main pb, whatever the solution I implement. same remark with checkoutpane example module, this was in the question from the beginning : I don't know how to make a loop there with the quantity... THanks Andy ! | |
Aug 4, 2014 at 14:37 | history | answered | Andy | CC BY-SA 3.0 |