diff --git a/uc_ctools_example/plugins/ubercart/shipping_method/test_shipping_method.inc b/uc_ctools_example/plugins/ubercart/shipping_method/test_shipping_method.inc new file mode 100644 index 0000000000000000000000000000000000000000..d4c13f51f58e3dec8f8a95a371b28846469b2f77 --- /dev/null +++ b/uc_ctools_example/plugins/ubercart/shipping_method/test_shipping_method.inc @@ -0,0 +1,49 @@ + 'test_shipping_method', + 'module' => 'uc_ctools_example', + 'title' => 'test payment method', + 'description' => t('test payment method description'), + 'enabled' => TRUE, + 'operations' => array( + ), + 'quote' => array( + 'type' => 'order', + 'callback' => 'uc_ctools_example_quote_test_payment_method', + 'accessorials' => array( + 'test payment method', + ), + ), +); + +/** + * Standard callback to return a shipping rate via the weight quote method. + * + * @param $products + * The order's products. + * @param $details + * Other order details including a shipping address. + * @return + * A JSON object containing the shipping quote for the order. + */ +function uc_ctools_example_quote_test_payment_method($products, $details, $method) { + $sum_weight = 0; + foreach ($products as $product) { + $sum_weight += $product->weight * $product->qty; + } + $shipping_fee = $sum_weight; + $quotes[] = array( + 'rate' => $shipping_fee, + 'label' => check_plain('test payment method'), + 'option_label' => check_plain('test payment method') + ); + return $quotes; +} \ No newline at end of file