本文整理汇总了PHP中Lookup::txnstatus_labels方法的典型用法代码示例。如果您正苦于以下问题:PHP Lookup::txnstatus_labels方法的具体用法?PHP Lookup::txnstatus_labels怎么用?PHP Lookup::txnstatus_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup::txnstatus_labels方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: screen
public function screen()
{
$Shopp = Shopp::object();
if (!current_user_can('shopp_settings_checkout')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
$next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1");
$next_setting = shopp_setting('next_order_id');
if ($next->id > $next_setting) {
$next_setting = $next->id;
}
$term_recount = false;
if (!empty($_POST['save'])) {
check_admin_referer('shopp-setup-management');
$next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']);
if ($next_order_id >= $next->id) {
if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) {
$next_setting = $next_order_id;
}
}
$_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']);
// Recount terms when this setting changes
if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) {
$term_recount = true;
}
shopp_set_formsettings();
$this->notice(Shopp::__('Management settings saved.'), 'notice', 20);
}
if ($term_recount) {
$taxonomy = ProductCategory::$taxon;
$terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
if (!empty($terms)) {
wp_update_term_count_now($terms, $taxonomy);
}
}
$states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels()));
$statusLabels = shopp_setting('order_status');
$statesLabels = shopp_setting('order_states');
$reasonLabels = shopp_setting('cancel_reasons');
if (empty($reasonLabels)) {
$reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp'));
}
$promolimit = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20', '25');
$lowstock = shopp_setting('lowstock_level');
if (empty($lowstock)) {
$lowstock = 0;
}
include $this->ui('management.php');
}
示例2: orders
/**
* Interface processor for the orders list interface
*
* @author Jonathan Davis
*
* @return void
**/
public function orders()
{
if (!current_user_can('shopp_orders')) {
wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp'));
}
global $Shopp, $Orders;
$defaults = array('page' => false, 'update' => false, 'newstatus' => false, 'paged' => 1, 'per_page' => 20, 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
$args = array_merge($defaults, $_GET);
extract($args, EXTR_SKIP);
$s = stripslashes($s);
$statusLabels = shopp_setting('order_status');
if (empty($statusLabels)) {
$statusLabels = array('');
}
$txnstatus_labels = Lookup::txnstatus_labels();
$Purchase = new ShoppPurchase();
$Orders = $this->orders;
$ordercount = $this->ordercount;
$num_pages = ceil($ordercount->total / $per_page);
$ListTable = ShoppUI::table_set_pagination($this->screen, $ordercount->total, $num_pages, $per_page);
$ranges = array('all' => __('Show All Orders', 'Shopp'), 'today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp'), 'lastexport' => __('Last Export', 'Shopp'), 'custom' => __('Custom Dates', 'Shopp'));
$exports = array('tab' => __('Tab-separated.txt', 'Shopp'), 'csv' => __('Comma-separated.csv', 'Shopp'), 'xls' => __('Microsoft® Excel.xls', 'Shopp'), 'iif' => __('Intuit® QuickBooks.iif', 'Shopp'));
$formatPref = shopp_setting('purchaselog_format');
if (!$formatPref) {
$formatPref = 'tab';
}
$exportcolumns = array_merge(ShoppPurchase::exportcolumns(), ShoppPurchased::exportcolumns());
$selected = shopp_setting('purchaselog_columns');
if (empty($selected)) {
$selected = array_keys($exportcolumns);
}
$Gateways = $Shopp->Gateways;
include $this->ui('orders.php');
}
示例3: orders_widget
/**
* Renders the recent orders dashboard widget
*
* @author Jonathan Davis
* @since 1.0
*
* @return void
**/
public static function orders_widget($args = false)
{
$defaults = array('before_widget' => '', 'before_title' => '', 'widget_name' => '', 'after_title' => '', 'after_widget' => '');
$args = array_merge($defaults, (array) $args);
extract($args, EXTR_SKIP);
$statusLabels = shopp_setting('order_status');
echo $before_widget;
echo $before_title;
echo $widget_name;
echo $after_title;
$purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
$purchasedtable = ShoppDatabaseObject::tablename(Purchased::$table);
$txnlabels = Lookup::txnstatus_labels();
if (!($Orders = get_transient('shopp_dashboard_orders'))) {
$Orders = sDB::query("SELECT p.*,count(*) as items FROM (SELECT * FROM {$purchasetable} WHERE txnstatus != 'purchased' AND txnstatus != 'invoiced' ORDER BY created DESC LIMIT 6) AS p LEFT JOIN {$purchasedtable} AS i ON i.purchase=p.id GROUP BY p.id ORDER BY p.id DESC", 'array');
set_transient('shopp_dashboard_orders', $Orders, 90);
// Keep for the next 1 minute
}
if (!empty($Orders)) {
echo '<table class="widefat">' . '<thead>' . ' <tr>' . ' <th scope="col">' . __('Name', 'Shopp') . '</th>' . ' <th scope="col">' . __('Date', 'Shopp') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Items') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Total') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Status') . '</th>' . ' </tr>' . '</thead>' . ' <tbody id="orders" class="list orders">';
$even = false;
foreach ($Orders as $Order) {
$classes = array();
if ($even = !$even) {
$classes[] = 'alternate';
}
$txnstatus = isset($txnlabels[$Order->txnstatus]) ? $txnlabels[$Order->txnstatus] : $Order->txnstatus;
$status = isset($statusLabels[$Order->status]) ? $statusLabels[$Order->status] : $Order->status;
$contact = '' == $Order->firstname . $Order->lastname ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname;
$url = add_query_arg(array('page' => ShoppAdmin()->pagename('orders'), 'id' => $Order->id), admin_url('admin.php'));
$classes[] = strtolower(preg_replace('/[^\\w]/', '_', $Order->txnstatus));
echo '<tr class="' . join(' ', $classes) . '">' . ' <td><a class="row-title" href="' . $url . '" title="View "Order ' . $Order->id . '"">' . (empty($Order->firstname) && empty($Order->lastname) ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname) . '</a></td>' . ' <td>' . date("Y/m/d", mktimestamp($Order->created)) . '</td>' . ' <td class="num items">' . $Order->items . '</td>' . ' <td class="num total">' . money($Order->total) . '</td>' . ' <td class="num status">' . $statusLabels[$Order->status] . '</td>' . '</tr>';
}
echo '</tbody></table>';
} else {
echo '<p>' . Shopp::__('No orders, yet.') . '</p>';
}
echo $after_widget;
}
示例4: management
public function management()
{
$Shopp = Shopp::object();
if (!current_user_can('shopp_settings_checkout')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
$next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1");
$next_setting = shopp_setting('next_order_id');
if ($next->id > $next_setting) {
$next_setting = $next->id;
}
if (!empty($_POST['save'])) {
check_admin_referer('shopp-setup-management');
$next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']);
if ($next_order_id >= $next->id) {
if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) {
$next_setting = $next_order_id;
}
}
shopp_set_formsettings();
$this->notice(Shopp::__('Management settings saved.'), 'notice', 20);
}
$states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels()));
$statusLabels = shopp_setting('order_status');
$statesLabels = shopp_setting('order_states');
$reasonLabels = shopp_setting('cancel_reasons');
if (empty($reasonLabels)) {
$reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp'));
}
include $this->ui('management.php');
}
示例5: prepare_items
public function prepare_items()
{
$defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'paged' => 1, 'per_page' => 20, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
$args = array_merge($defaults, $this->request());
extract($args, EXTR_SKIP);
// $url = $this->url($_GET);
$statusLabels = shopp_setting('order_status');
if (empty($statusLabels)) {
$statusLabels = array('');
}
$txnstatus_labels = Lookup::txnstatus_labels();
$Purchase = new ShoppPurchase();
$offset = get_option('gmt_offset') * 3600;
if ($this->request('start')) {
list($month, $day, $year) = explode("/", $this->request('start'));
$starts = mktime(0, 0, 0, $month, $day, $year);
}
if ($this->request('end')) {
list($month, $day, $year) = explode("/", $this->request('end'));
$ends = mktime(23, 59, 59, $month, $day, $year);
}
$pagenum = absint($paged);
$start = $per_page * ($pagenum - 1);
$where = array();
$joins = array();
if (!empty($status) || '0' === $status) {
$where[] = "status='" . sDB::escape($status) . "'";
}
if (!empty($s)) {
$s = stripslashes($s);
$search = array();
if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER) > 0) {
foreach ($props as $query) {
$keyword = sDB::escape(!empty($query[2]) ? $query[2] : $query[3]);
switch (strtolower($query[1])) {
case "txn":
$search[] = "txnid='{$keyword}'";
break;
case "company":
$search[] = "company LIKE '%{$keyword}%'";
break;
case "gateway":
$search[] = "gateway LIKE '%{$keyword}%'";
break;
case "cardtype":
$search[] = "cardtype LIKE '%{$keyword}%'";
break;
case "address":
$search[] = "(address LIKE '%{$keyword}%' OR xaddress='%{$keyword}%')";
break;
case "city":
$search[] = "city LIKE '%{$keyword}%'";
break;
case "province":
case "state":
$search[] = "state='{$keyword}'";
break;
case "zip":
case "zipcode":
case "postcode":
$search[] = "postcode='{$keyword}'";
break;
case "country":
$search[] = "country='{$keyword}'";
break;
case "promo":
case "discount":
$meta_table = ShoppDatabaseObject::tablename(ShoppMetaObject::$table);
$joins[$meta_table] = "INNER JOIN {$meta_table} AS m ON m.parent = o.id AND context='purchase'";
$search[] = "m.value LIKE '%{$keyword}%'";
break;
case "product":
$purchased = ShoppDatabaseObject::tablename(Purchased::$table);
$joins[$purchased] = "INNER JOIN {$purchased} AS p ON p.purchase = o.id";
$search[] = "p.name LIKE '%{$keyword}%' OR p.optionlabel LIKE '%{$keyword}%' OR p.sku LIKE '%{$keyword}%'";
break;
}
}
if (empty($search)) {
$search[] = "(id='{$s}' OR CONCAT(firstname,' ',lastname) LIKE '%{$s}%')";
}
$where[] = "(" . join(' OR ', $search) . ")";
} elseif (strpos($s, '@') !== false) {
$where[] = "email='" . sDB::escape($s) . "'";
} else {
$where[] = "(id='{$s}' OR CONCAT(firstname,' ',lastname) LIKE '%" . sDB::escape($s) . "%')";
}
}
if (!empty($starts) && !empty($ends)) {
$where[] = "created BETWEEN '" . sDB::mkdatetime($starts) . "' AND '" . sDB::mkdatetime($ends) . "'";
}
if (!empty($customer)) {
$where[] = "customer=" . intval($customer);
}
$where = !empty($where) ? "WHERE " . join(' AND ', $where) : '';
$joins = join(' ', $joins);
$countquery = "SELECT count(*) as total,SUM(IF(txnstatus IN ('authed','captured'),total,NULL)) AS sales,AVG(IF(txnstatus IN ('authed','captured'),total,NULL)) AS avgsale FROM {$Purchase->_table} AS o {$joins} {$where} ORDER BY o.created DESC LIMIT 1";
$this->ordercount = sDB::query($countquery, 'object');
$query = "SELECT o.* FROM {$Purchase->_table} AS o {$joins} {$where} ORDER BY created DESC LIMIT {$start},{$per_page}";
$this->items = sDB::query($query, 'array', 'index', 'id');
//.........这里部分代码省略.........
示例6: payment
/**
* Provides the current payment status (the transaction status)
*
* @api `shopp('purchase.payment')`
* @since 1.3
*
* @param string $result The output
* @param array $options The options
* @param ShoppPurchase $O The working object
* @return string The pay
**/
public static function payment($result, $options, $O)
{
$labels = Lookup::txnstatus_labels();
return isset($labels[$O->txnstatus]) ? $labels[$O->txnstatus] : $O->txnstatus;
}
示例7: order_status_label
/**
* Returns a human readable and translated order status label.
*
* We may wish to expand this to take account of mapped status labels in Shopp (where merchants
* can map their own label like "Completed" to an actual status of "Captured", etc).
*
* @param $status
* @return string
*/
protected function order_status_label($status)
{
$labels = Lookup::txnstatus_labels();
return isset($labels[$status]) ? $labels[$status] : '';
}