First of all, I am familiar with the module Commerce Custom Product, allowing one to add a custom line item field to a product. This works great for a single product - allowing you to do things with Rules etc.

What about when you have a bunch of products? Imagine a fertilizer business. They sell Nitrogen, and phosphorus (which contains nitrogen). A farmer will tell the business that he wants a certain blend. say 10N - 5P, and he wants 10 ton of it. At this point you need to use Rules to determine how much contributing Nitrogen comes from the phosphorus so that you can make the proper blend - which is in this case, 6691 kg of N, and 3309 kg of P - so you need to use a line item field.

What I am looking to do is create a view displaying these products and utilizing the module editablefields for the line item field 'Blend'. The only way to do this is to make something that looks like this, however views now shows each product having its own editable line item AND the add to cart button. views with all products having its own add to cart button next to the custom line item.

I imagine one could 'hide' that button under the line item with CSS, but the add to cart button that the 'Quantity' field adds (in the footer) only triggers 1 product id to fire. If you remove the 'add to cart form' from each line then then it will fire all items in the view - and give the quantity requested - but then you cannot have your custom line item show up. Its a catch 22.

Basically, I need to pull the custom line item out of the 'add to cart form' and still be able to use an editable field with Rules OR have the add to cart button on the footer work for all items where the field Blend is > 0. I dont mind getting dirty with custom code either.

  • I am also having kind of same problem.I want to show line item field blend and add to cart button in separate columns.Did you find any solution for this? please let me know. – Tejas Vaidya Jun 7 '16 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.