html-order-fee.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Shows an order item fee
  4. *
  5. * @var object $item The item being displayed
  6. * @var int $item_id The id of the item being displayed
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. ?>
  12. <tr class="fee <?php echo ( ! empty( $class ) ) ? esc_attr( $class ) : ''; ?>" data-order_item_id="<?php echo esc_attr( $item_id ); ?>">
  13. <td class="thumb"><div></div></td>
  14. <td class="name">
  15. <div class="view">
  16. <?php echo esc_html( $item->get_name() ? $item->get_name() : __( 'Fee', 'woocommerce' ) ); ?>
  17. </div>
  18. <div class="edit" style="display: none;">
  19. <input type="text" placeholder="<?php esc_attr_e( 'Fee name', 'woocommerce' ); ?>" name="order_item_name[<?php echo absint( $item_id ); ?>]" value="<?php echo ( $item->get_name() ) ? esc_attr( $item->get_name() ) : ''; ?>" />
  20. <input type="hidden" class="order_item_id" name="order_item_id[]" value="<?php echo esc_attr( $item_id ); ?>" />
  21. <input type="hidden" name="order_item_tax_class[<?php echo absint( $item_id ); ?>]" value="<?php echo esc_attr( $item->get_tax_class() ); ?>" />
  22. </div>
  23. <?php do_action( 'woocommerce_after_order_fee_item_name', $item_id, $item, null ); ?>
  24. </td>
  25. <?php do_action( 'woocommerce_admin_order_item_values', null, $item, absint( $item_id ) ); ?>
  26. <td class="item_cost" width="1%">&nbsp;</td>
  27. <td class="quantity" width="1%">&nbsp;</td>
  28. <td class="line_cost" width="1%">
  29. <div class="view">
  30. <?php
  31. echo wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
  32. if ( $refunded = $order->get_total_refunded_for_item( $item_id, 'fee' ) ) {
  33. echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
  34. }
  35. ?>
  36. </div>
  37. <div class="edit" style="display: none;">
  38. <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo esc_attr( wc_format_localized_price( 0 ) ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $item->get_total() ) ); ?>" class="line_total wc_input_price" />
  39. </div>
  40. <div class="refund" style="display: none;">
  41. <input type="text" name="refund_line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo esc_attr( wc_format_localized_price( 0 ) ); ?>" class="refund_line_total wc_input_price" />
  42. </div>
  43. </td>
  44. <?php
  45. if ( ( $tax_data = $item->get_taxes() ) && wc_tax_enabled() ) {
  46. foreach ( $order_taxes as $tax_item ) {
  47. $tax_item_id = $tax_item->get_rate_id();
  48. $tax_item_total = isset( $tax_data['total'][ $tax_item_id ] ) ? $tax_data['total'][ $tax_item_id ] : '';
  49. ?>
  50. <td class="line_tax" width="1%">
  51. <div class="view">
  52. <?php
  53. echo ( '' !== $tax_item_total ) ? wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) ) : '&ndash;';
  54. if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'fee' ) ) {
  55. echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
  56. }
  57. ?>
  58. </div>
  59. <div class="edit" style="display: none;">
  60. <input type="text" name="line_tax[<?php echo absint( $item_id ); ?>][<?php echo esc_attr( $tax_item_id ); ?>]" placeholder="<?php echo esc_attr( wc_format_localized_price( 0 ) ); ?>" value="<?php echo ( isset( $tax_item_total ) ) ? esc_attr( wc_format_localized_price( $tax_item_total ) ) : ''; ?>" class="line_tax wc_input_price" />
  61. </div>
  62. <div class="refund" style="display: none;">
  63. <input type="text" name="refund_line_tax[<?php echo absint( $item_id ); ?>][<?php echo esc_attr( $tax_item_id ); ?>]" placeholder="<?php echo esc_attr( wc_format_localized_price( 0 ) ); ?>" class="refund_line_tax wc_input_price" data-tax_id="<?php echo esc_attr( $tax_item_id ); ?>" />
  64. </div>
  65. </td>
  66. <?php
  67. }
  68. }
  69. ?>
  70. <td class="wc-order-edit-line-item">
  71. <?php if ( $order->is_editable() ) : ?>
  72. <div class="wc-order-edit-line-item-actions">
  73. <a class="edit-order-item" href="#"></a><a class="delete-order-item" href="#"></a>
  74. </div>
  75. <?php endif; ?>
  76. </td>
  77. </tr>