0

I want to create a way for customers to log in and edit their completed orders (the orders are registrations to classes). Compared to the standard order-edit page I want to remove all options except 'change order status to cancelled'. Preferably a simple page stating the content of the order, then some cancellation 'rules', and then a button saying 'cancel this order'.

Cancellation should then also check whether date/time of the booked class is less than 24 hours away from the moment of cancellation. If <24 hours, it should either refuse cancellation, or allow cancellation (nice for those on the waiting list), but not refund the cost of the class (paid for using a voucher - using the giftcard module)

Background: the site sells two products: one is a set of vouchers. These vouchers can then be used to buy product 2, which is a registration to a class at a specific date and time. When customers have booked a class, they now get an email with link to their order page. Their they find a button 'edit order', click that and you go to the standard order edit page which shows line-items, billing and shipping etc, and allows all existing changes to the order status. As this page is not made trough either a template or a view, I have no clue how to change what customers get to see and do with their completed order.

Also rules does not allow me to compare the time of the status change with the time/date field of the booked class, so I can't control the 24 hour limit either..

Suggestions are to build a custom module doing the above, but I have no idea how to kick that off..

All/any help massively appreciated

1

I haven't tested any of this, but you might some of the following useful:

Entity Operations allows you to take a Rule and turn it into a menu tab. This would be one way of getting that onto the order view page.

Something I've really been wanting to try is the Entity action links sandbox:

Allows actions and rules components to be executed via AJAX links on entity view.

Just note the patches discuss in the Sandbox README.

If you wanted to do the Rules route, these would be probably your best option, because you can use conditions and components to provide some sort of response or action system based on the order status and time.

Otherwise, you'd need to create a custom module with a custom access callback that does the appropriate checks and then executes the action if allowed. (For a developer, I think this would actually be an easier route.) But the rules stuff is intriguing.

  • Hello Nick, first of all many thanks for giving me some suggestions on how to tackle this. However, I am now victim to the wonderful feeling of being a complete novice and am back here begging you (or anyone else knowledgeable) for more help.. What goes wrong for me (I fully accept the likelihood it is my stupidity and nothing else that prevents success) – xax Oct 19 '15 at 15:09
  • - Entity Operations: Installed this module and its subs, and then basically nothing much happens. I now have a new content type called 'Entity Operations Test Node Type' which has one non-standard field only, called 'Test entities'. Under admin/structure/example_entity I can create a test entity (but it has no fields whatsoever) that I can then select when creating the content type.. and nothing else happens. – xax Oct 19 '15 at 15:10
  • I also have a new View called 'Entity Operations Views Tab', which has a master display and one called 'entity tab', where the last on selection gives an empty page. In the read-me texts that come with the module there is a part about implementation that says "Operations are declared with hook_entity_operation_info()." Now that is where I am lost, where do I find that hook, or where do I create it (and how)? Then it says: "You also need the following Entity API properties in your hook_entity_info():" 'module' => 'my module', 'entity class' => 'Entity', // or a subclass of Entity". Help.. – xax Oct 19 '15 at 15:10
  • - Entity action links sandbox: I can see the page, but nothing I can install or use, under version control I find”Setting up this repository locally for the first time git clone --branch 7.x-1.x git.drupal.org/sandbox/davereid/1883906.git entity_action_links cd entity_action_links” I’m pretty much a github virgin (shame on me), been there to get module tweaks for drupal modules, but this address gives me ‘The requested URL /sandbox/davereid/1883906.git was not found on this server’. Again: help! (please..) – xax Oct 19 '15 at 15:11
  • @xax Look carefully and copy&paste the exact command: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/davereid/1883906.git. This one which you posted doesn't make sense and has some mistakes. If you've other question, you need to post another one (comments are not for resolving different issues). If it's git one, ask at SU. – kenorb Oct 20 '15 at 19:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.