Files
nextcloud-nodered-woocommerce/nodes/woocommerce-product.html
T

55 lines
2.1 KiB
HTML
Raw Normal View History

2026-10-14 23:18:22 +02:00
<script type="text/javascript">
RED.nodes.registerType("woocommerce-product", {
category: "WooCommerce",
color: "#7f54b3",
defaults: {
name: { value: "" },
config: { type: "woocommerce-config", required: true },
operation: { value: "list" }
},
inputs: 1,
outputs: 1,
icon: "font-awesome/fa-cube",
label: function () {
return this.name || ("WC Product " + 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-product">
<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 Product">
</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="list">List Products</option>
<option value="get">Get Product by ID</option>
</select>
</div>
<div class="form-tips" style="color:#888; font-size:11px; margin-top:10px;">
<b>List</b>: msg.limit, msg.page, msg.category (ID), msg.search<br>
<b>Get</b>: msg.productId – WooCommerce product ID<br>
Useful for enriching order data with product details.
</div>
</script>
<script type="text/x-red" data-help-name="woocommerce-product">
<p>WooCommerce product operations: list, get.</p>
<p>Useful for enriching order line_items with product details (name, SKU, image).</p>
</script>