Closed (fixed)
Project:
Commerce Customizable Products
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2012 at 21:42 UTC
Updated:
5 Jul 2012 at 21:21 UTC
Comments
Comment #1
gantenx commentedSame problem. Admin cannot edit
nor createitems using custom line items.Is there any approaches to get this work?
Comment #2
n8tronSubscribe
Comment #3
ressaAlso, is there a way for the customers to edit a product within their order? Or is deleting the product and starting over the only solution for now?
Comment #4
ressaI just saw a video by Randy Fay where he used the Editable Fields module to do this: http://drupal.org/project/editablefields
Around 10 minutes into the video: http://commerceguys.com/blog/commerce-module-tuesday-commerce-customizab...
I seem to have made it work for administrators and registered users, by selecting 'Edit own orders of any type' under 'Permissions', but so far, not for anonymous users.
Comment #5
iLLin commented@ressa, great find man. I will check it out this weekend. Thanks dood!
Comment #6
ressa@iLLin, you're welcome :-)
I realized that customers could edit custom fields after an order is submitted, which shouldn't be allowed, and perhaps only before the Checkout process begins, which means editablefields should only be activated for customers in the 'Shopping cart block (Commerce Order)' View and 'Shopping cart form (Commerce Order)'.
For example, the View 'Line items (Commerce Line Item)' is used to show the finalized order, which means that if editablefields is added to that View, without limiting access somehow, customers can update finalized orders at user/8/orders/12.
The View 'Shopping cart summary (Commerce Order)' is used for the Checkout process, where orders probably shouldn't be editable.
To allow only administrators to edit fields in submitted orders, but not have 'Edit this field'-links displayed on invoices, I tried different things, but then got the idea to see if there was something in the editablefields module which could help, and the following seems to do it:
To only allow editing of orders by admin on the Order View Page (arg(2) == "orders" && $user->uid != 1) and never on invoice pages (arg(4) == "invoice" || arg(2) == "invoices"), change linie 194 in editablefields.module from:
if (!entity_access('update', $entity_type, $entity) || !field_access('edit', $field, $entity_type, $entity)) {To:
I tried to copy the function 'editablefields_field_formatter_view' from editablefields.module to template.php, but it's not picking it up for some reason, so I will just have to hack the module, and remember when I update :-)
Comment #7
ressaA patch is being tested here, which might allow editing of existing order, I haven't tried it yet: Allow commerce_cart_add_to_cart_form() to edit line items
Comment #8
rszrama commentedIf I'm not mistaken, this is now fixed through http://drupal.org/project/inline_entity_form.
Comment #9
ressaSounds great, thanks!