Вопрос

Im setting up a drupal commerce website and i would like the functionality to let an admin handle an order and change the order status, then the user recieves an email link which redirects him to the payment page. Is such a thing possible with eighter drupal commerce or ubercart?

Note: uc_payafter does not work in 7.x

Это было полезно?

Решение

I think you can do this with a combination of Drupal Commerce and Rules and perhaps some tweaking.

As I understand it, your scenario goes like this:

  1. User places an order but doesn't pay.
  2. Admin overviews the order and approves it for payment.
  3. User is sent an email prompting him to pay.
  4. Paid order is marked as complete.

Commerce already the admin edit the order's status. You can then catch that event in a Rule that sends out the payment email. The greatest challenge will be intervening in the checkout process, to stop the user from paying right after placing his order.

For this, you'll have to create two new Order Statuses. See http://www.drupalcommerce.org/faq/order-states for information on how to do that. Let's call these statuses "Awaiting Approval" and "Approved".

The rest should be easier, with no coding involved:

  1. Create a page informing the user that his order will be reviewed and approved soon.

  2. Create a Rule to inject our new status:

    • Event: Before Order is being saved
    • Condition: Compare data, unchanged order status is Shopping Cart
    • Condition: Compare data, updated order status is Checkout
    • Action: Set the order status to Awaiting Approval

  3. Create a Rule to prevent the user going to checkout:

    • Event: Drupal is initializing
    • Condition: Compare data, page path contains "checkout"
    • Condition: Compare data, current order status is Awaiting Approval
    • Action: Redirect user to the information page you created in step 1

      Now when the user tries to check out, the order gets marked as Awaiting Approval, and the user gets shunted to the information page. The admin is now free to edit the order and change its status to Approved. I would recommend:

  4. Create a view of all orders in Awaiting Approval status, including "edit" links.

    Then, to complete the process:

  5. Create a Rule informing the user his order was approved for payment:

    • Event: Order was updated
    • Condition: Order status is Approved
    • Action: Email user

  6. Create a Rule allowing the user to pay:

    • Event: Drupal is initializing
    • Condition: Compare data, page path contains "checkout"
    • Condition: Compare data, current order status is Approved
    • Action: Change order status to Checkout

From here, the checkout process will proceed as usual until it's done.

Note that if at any point, the user hits "Cancel" on the checkout process, the order will revert to Shopping Cart status and will need to be approved again by the admin. If you don't want this happening, you can theme the "cancel" link to elegantly "disappear".

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top