55 lines
2.1 KiB
HTML
55 lines
2.1 KiB
HTML
|
|
<script type="text/javascript">
|
|||
|
|
RED.nodes.registerType("woocommerce-customer", {
|
|||
|
|
category: "WooCommerce",
|
|||
|
|
color: "#7f54b3",
|
|||
|
|
defaults: {
|
|||
|
|
name: { value: "" },
|
|||
|
|
config: { type: "woocommerce-config", required: true },
|
|||
|
|
operation: { value: "search" }
|
|||
|
|
},
|
|||
|
|
inputs: 1,
|
|||
|
|
outputs: 1,
|
|||
|
|
icon: "font-awesome/fa-users",
|
|||
|
|
label: function () {
|
|||
|
|
return this.name || ("WC Customer " + this.operation);
|
|||
|
|
},
|
|||
|
|
labelStyle: function () {
|
|||
|
|
return this.name ? "node_label_italic" : "";
|
|||
|
|
},
|
|||
|
|
oneditprepare: function () {
|
|||
|
|
$("#node-input-config").val(this.config ? this.config.id : "");
|
|||
|
|
},
|
|||
|
|
oneditsave: function () {
|
|||
|
|
this.operation = $("#node-select-operation").val();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<script type="text/x-red" data-template-name="woocommerce-customer">
|
|||
|
|
<div class="form-row">
|
|||
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|||
|
|
<input type="text" id="node-input-name" placeholder="WooCommerce Customer">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-row">
|
|||
|
|
<label for="node-input-config"><i class="fa fa-server"></i> Config</label>
|
|||
|
|
<input type="text" id="node-input-config">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-row">
|
|||
|
|
<label for="node-select-operation"><i class="fa fa-wrench"></i> Operation</label>
|
|||
|
|
<select id="node-select-operation">
|
|||
|
|
<option value="search">Search by Email</option>
|
|||
|
|
<option value="get">Get Customer by ID</option>
|
|||
|
|
<option value="create">Create Customer</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-tips" style="color:#888; font-size:11px; margin-top:10px;">
|
|||
|
|
<b>Search</b>: msg.email – exact match on customer email<br>
|
|||
|
|
<b>Get</b>: msg.customerId – WooCommerce user ID<br>
|
|||
|
|
<b>Create</b>: msg.email, msg.firstname, msg.lastname, msg.billing, msg.shipping
|
|||
|
|
</div>
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<script type="text/x-red" data-help-name="woocommerce-customer">
|
|||
|
|
<p>WooCommerce customer operations: search (by email), get, create.</p>
|
|||
|
|
</script>
|