summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorg089h515r8062012-08-11 11:54:02 (GMT)
committerg089h515r8062012-08-11 11:54:02 (GMT)
commit795196000dc425e7cd30f06a4a2df96ffc10c38e (patch)
treeac89cb5edb1c76fe432e87355036eca2acf1ab36
parentd679b06564dffcc1e82181d0969103128c75a151 (diff)
add example for line item
-rw-r--r--uc_ctools_example/plugins/ubercart/line_item/test_line_item.inc34
1 files changed, 34 insertions, 0 deletions
diff --git a/uc_ctools_example/plugins/ubercart/line_item/test_line_item.inc b/uc_ctools_example/plugins/ubercart/line_item/test_line_item.inc
new file mode 100644
index 0000000..ad072b1
--- /dev/null
+++ b/uc_ctools_example/plugins/ubercart/line_item/test_line_item.inc
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * A line item plugin for Ubercart.
+ */
+
+/**
+ * Define this line item plugin.
+ */
+$plugin = array(
+ 'id' => 'test_line_item',
+ 'title' => t('Test line item'),
+ 'weight' => 2,
+ 'stored' => FALSE,
+ 'add_list' => FALSE,
+ 'calculated' => FALSE,
+ 'callback' => 'uc_ctools_example_line_item_test',
+);
+
+/**
+ * Callback function of line item plugin.
+ */
+function uc_ctools_example_line_item_test($op, $order) {
+ switch ($op) {
+ case 'load':
+ $lines[] = array(
+ 'id' => 'test_line_item',
+ 'title' => t('Test line item'),
+ 'amount' => uc_order_get_total($order, TRUE),
+ );
+ return $lines;
+ }
+} \ No newline at end of file