当前位置: 首页>>代码示例>>PHP>>正文


PHP Shopp::redirect方法代码示例

本文整理汇总了PHP中Shopp::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::redirect方法的具体用法?PHP Shopp::redirect怎么用?PHP Shopp::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shopp的用法示例。


在下文中一共展示了Shopp::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete()
 {
     $delete = $this->request('delete');
     if (false === $delete) {
         return;
     }
     $active = (array) shopp_setting('active_shipping');
     $index = false;
     if (strpos($delete, '-') !== false) {
         list($delete, $index) = explode('-', $delete);
     }
     if (!array_key_exists($delete, $active)) {
         return $this->notice(Shopp::__('The requested shipping method could not be deleted because it does not exist.'), 'error');
     }
     if (is_array($active[$delete])) {
         if (array_key_exists($index, $active[$delete])) {
             unset($active[$delete][$index]);
             if (empty($active[$delete])) {
                 unset($active[$delete]);
             }
         }
     } else {
         unset($active[$delete]);
     }
     shopp_set_setting('active_shipping', $active);
     $this->notice(Shopp::__('Shipping method setting removed.'));
     Shopp::redirect($this->url());
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:28,代码来源:ShippingRates.php

示例2: updates

 public function updates()
 {
     $rates = shopp_setting('taxrates');
     $updates = $this->form('taxrates');
     if (!empty($updates)) {
         if (array_key_exists('new', $updates)) {
             $rates[] = $updates['new'];
         } else {
             $rates = array_replace($rates, $updates);
         }
         // Re-sort taxes from generic to most specific
         usort($rates, array($this, 'sortrates'));
         $rates = stripslashes_deep($rates);
         shopp_set_setting('taxrates', $rates);
         unset($_POST['settings']['taxrates']);
     }
     shopp_set_formsettings();
     // Save other tax settings
     $this->notice(Shopp::__('Tax settings saved.'));
     Shopp::redirect(add_query_arg());
 }
开发者ID:msigley,项目名称:shopp,代码行数:21,代码来源:Taxes.php

示例3: loader

 public function loader($workflow = false)
 {
     if (!current_user_can('shopp_products')) {
         return;
     }
     add_screen_option('per_page', array('label' => __('Products Per Page', 'Shopp'), 'default' => 20, 'option' => 'edit_' . ShoppProduct::$posttype . '_per_page'));
     $per_page_option = get_current_screen()->get_option('per_page');
     $defaults = array('cat' => false, 'paged' => 1, 'per_page' => $per_page_option['default'], 's' => '', 'sl' => '', 'matchcol' => '', 'view' => $this->view, 'is_inventory' => false, 'is_trash' => false, 'is_bestselling' => false, 'categories_menu' => false, 'inventory_menu' => false, 'lowstock' => 0, 'columns' => '', 'orderby' => '', 'order' => '', 'where' => array(), 'joins' => array());
     $args = array_merge($defaults, $_GET);
     if (false !== ($user_per_page = get_user_option($per_page_option['option']))) {
         $args['per_page'] = $user_per_page;
     }
     extract($args, EXTR_SKIP);
     $url = ShoppAdminController::url($_GET);
     $subs = array('all' => array('label' => Shopp::__('All'), 'where' => array("p.post_status!='trash'")), 'published' => array('label' => Shopp::__('Published'), 'where' => array("p.post_status='publish'")), 'drafts' => array('label' => Shopp::__('Drafts'), 'where' => array("p.post_status='draft'")), 'onsale' => array('label' => Shopp::__('On Sale'), 'where' => array("s.sale='on' AND p.post_status != 'trash'")), 'featured' => array('label' => Shopp::__('Featured'), 'where' => array("s.featured='on' AND p.post_status != 'trash'")), 'bestselling' => array('label' => Shopp::__('Bestselling'), 'where' => array("p.post_status!='trash'", BestsellerProducts::threshold() . " < s.sold"), 'order' => 'bestselling'), 'inventory' => array('label' => Shopp::__('Inventory'), 'where' => array("s.inventory='on' AND p.post_status != 'trash'")), 'trash' => array('label' => Shopp::__('Trash'), 'where' => array("p.post_status='trash'")));
     if (!shopp_setting_enabled('inventory')) {
         unset($subs['inventory']);
     }
     switch ($view) {
         case 'inventory':
             if (shopp_setting_enabled('inventory')) {
                 $is_inventory = true;
             } else {
                 Shopp::redirect(add_query_arg('view', null, $url), true);
             }
             break;
         case 'trash':
             $is_trash = true;
             break;
         case 'bestselling':
             $is_bestselling = true;
             break;
     }
     if ($is_inventory) {
         $per_page = 50;
     }
     $pagenum = absint($paged);
     $start = $per_page * ($pagenum - 1);
     $where = $subs[$this->view]['where'];
     if (!empty($s)) {
         $SearchResults = new SearchResults(array('search' => $s, 'nostock' => 'on', 'published' => 'off', 'paged' => -1));
         $SearchResults->load();
         $ids = array_keys($SearchResults->products);
         $where[] = "p.ID IN (" . join(',', $ids) . ")";
     }
     if (!empty($cat)) {
         global $wpdb;
         $joins[$wpdb->term_relationships] = "INNER JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)";
         $joins[$wpdb->term_taxonomy] = "INNER JOIN {$wpdb->term_taxonomy} AS tt ON (tr.term_taxonomy_id=tt.term_taxonomy_id AND tt.term_id={$cat})";
         if (-1 == $cat) {
             unset($joins[$wpdb->term_taxonomy]);
             $joins[$wpdb->term_relationships] = "LEFT JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)";
             $where[] = 'tr.object_id IS NULL';
         }
     }
     // Detect custom taxonomies
     $taxonomies = array_intersect(get_object_taxonomies(ShoppProduct::$posttype), array_keys($_GET));
     if (!empty($taxonomies)) {
         foreach ($taxonomies as $n => $taxonomy) {
             global $wpdb;
             $term = get_term_by('slug', $_GET[$taxonomy], $taxonomy);
             if (!empty($term->term_id)) {
                 $joins[$wpdb->term_relationships . '_' . $n] = "INNER JOIN {$wpdb->term_relationships} AS tr{$n} ON (p.ID=tr{$n}.object_id)";
                 $joins[$wpdb->term_taxonomy . '_' . $n] = "INNER JOIN {$wpdb->term_taxonomy} AS tt{$n} ON (tr{$n}.term_taxonomy_id=tt{$n}.term_taxonomy_id AND tt{$n}.term_id={$term->term_id})";
             }
         }
     }
     if (!empty($sl) && shopp_setting_enabled('inventory')) {
         switch ($sl) {
             case "ns":
                 foreach ($where as &$w) {
                     $w = str_replace("s.inventory='on'", "s.inventory='off'", $w);
                 }
                 $where[] = "s.inventory='off'";
                 break;
             case "oos":
                 $where[] = "(s.inventory='on' AND s.stock = 0)";
                 break;
             case "ls":
                 $ls = shopp_setting('lowstock_level');
                 if (empty($ls)) {
                     $ls = '0';
                 }
                 $where[] = "(s.inventory='on' AND s.lowstock != 'none')";
                 break;
             case "is":
                 $where[] = "(s.inventory='on' AND s.stock > 0)";
         }
     }
     $lowstock = shopp_setting('lowstock_level');
     // Setup queries
     $pd = WPDatabaseObject::tablename(ShoppProduct::$table);
     $pt = ShoppDatabaseObject::tablename(ShoppPrice::$table);
     $ps = ShoppDatabaseObject::tablename(ProductSummary::$table);
     $orderdirs = array('asc', 'desc');
     if (in_array($order, $orderdirs)) {
         $orderd = strtolower($order);
     } else {
         $orderd = 'asc';
     }
//.........这里部分代码省略.........
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:Warehouse.php

示例4: download

 /**
  * Handles product file download requests
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function download()
 {
     $Shopp = Shopp::object();
     $download = $this->request['shopp_download'];
     $Purchase = false;
     $Purchased = false;
     if (defined('WP_ADMIN')) {
         $forbidden = false;
         $Download = new ProductDownload($download);
     } else {
         $Order = ShoppOrder();
         $accounts = 'none' != shopp_setting('account_system');
         $Download = new ProductDownload();
         $Download->loadby_dkey($download);
         $Purchased = $Download->purchased();
         $Purchase = new ShoppPurchase($Purchased->purchase);
         $Purchase->load_events();
         $name = $Purchased->name . (!empty($Purchased->optionlabel) ? ' (' . $Purchased->optionlabel . ')' : '');
         $forbidden = false;
         // Voided orders
         if ($Purchase->isvoid()) {
             shopp_add_error(Shopp::__('&quot;%s&quot; cannot be downloaded because the order has been cancelled.', $name));
             $forbidden = true;
         }
         // Purchase Completion check
         if (!$Purchase->ispaid() && !SHOPP_PREPAYMENT_DOWNLOADS) {
             shopp_add_error(Shopp::__('&quot;%s&quot; cannot be downloaded because payment has not been received yet.', $name));
             $forbidden = true;
         }
         // If accounts are used and this is not a guest account
         if ($accounts && Shopp::__('Guest') != ShoppCustomer()->type) {
             // User must be logged in when accounts are being used
             if (!ShoppCustomer()->loggedin()) {
                 shopp_add_error(Shopp::__('You must login to download purchases.'));
                 $forbidden = true;
             }
             // Logged in account must be the owner of the purchase
             if (ShoppCustomer()->id != $Purchase->customer) {
                 shopp_add_error(Shopp::__('You are not authorized to download the requested file.'));
                 $forbidden = true;
             }
         }
         // Download limit checking
         if (shopp_setting('download_limit') && $Purchased->downloads + 1 > shopp_setting('download_limit')) {
             shopp_add_error(Shopp::__('&quot;%s&quot; is no longer available for download because the download limit has been reached.', $name));
             $forbidden = true;
         }
         // Download expiration checking
         if (shopp_setting('download_timelimit') && $Purchased->created + shopp_setting('download_timelimit') < current_time('timestamp')) {
             shopp_add_error(Shopp::__('&quot;%s&quot; is no longer available for download because it has expired.', 'Shopp', $name));
             $forbidden = true;
         }
         // IP restriction checks
         if ('ip' == shopp_setting('download_restriction') && !empty($Purchase->ip) && $Purchase->ip != $_SERVER['REMOTE_ADDR']) {
             shopp_add_error(Shopp::__('&quot;%s&quot; cannot be downloaded because your computer could not be verified as the system the file was purchased from.', $name));
             $forbidden = true;
         }
         do_action_ref_array('shopp_download_request', array($Purchased));
     }
     if (apply_filters('shopp_download_forbidden', $forbidden, $Purchased)) {
         Shopp::redirect(add_query_arg('downloads', '', Shopp::url(false, 'account')), true, 303);
     }
     // Send the download
     $download = $Download->download();
     if (is_a($download, 'ShoppError')) {
         // If the result is an error redirect to the account downloads page
         Shopp::redirect(add_query_arg('downloads', '', Shopp::url(false, 'account')), true, 303);
     } else {
         do_action_ref_array('shopp_download_success', array($Purchased, $Purchase, $Download));
         // @deprecated use shopp_download_order_event instead
         shopp_add_order_event($Purchase->id, 'download', array('purchased' => $Purchased->id, 'download' => $Download->id, 'ip' => ShoppShopping()->ip, 'customer' => ShoppCustomer()->id));
     }
     exit;
 }
开发者ID:msigley,项目名称:shopp,代码行数:82,代码来源:Resources.php

示例5: pdt

 /**
  * Handle the synchronous return from PPS (PDT and default return)
  *
  * @author Jonathan Davis
  * @since 1.2
  **/
 public function pdt()
 {
     $Order = ShoppOrder();
     if (!$this->pdtvalid()) {
         return;
     }
     $Message = $this->Message;
     $id = $Message->order();
     $event = $Message->event();
     $Purchase = new ShoppPurchase($id);
     if (empty($Purchase->id)) {
         shopp_debug('PDT processing could not load the in progress order from the database.');
         return Shopp::redirect(Shopp::url(false, 'thanks', false));
     }
     $Order->inprogress = $Purchase->id;
     $this->process($event, $Purchase);
     Shopp::redirect(Shopp::url(false, 'thanks', false));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:24,代码来源:PayPalStandard.php

示例6: updates

 public function updates()
 {
     $form = $this->form();
     if (empty($form)) {
         return;
     }
     do_action('shopp_save_payment_settings');
     $Gateways = Shopp::object()->Gateways;
     $gateways = array_keys($Gateways->activated());
     $gateway = key($form);
     // Handle Multi-instance payment systems
     $indexed = false;
     if (preg_match('/\\[(\\d+)\\]/', $gateway, $matched)) {
         $indexed = '-' . $matched[1];
         $gateway = str_replace($matched[0], '', $gateway);
     }
     // Merge the existing gateway settings with the newly updated settings
     if (isset($Gateways->active[$gateway])) {
         $Gateway = $Gateways->active[$gateway];
         // Cannot use array_merge() because it adds numeric index values instead of overwriting them
         $this->form[$gateway] = (array) $this->form[$gateway] + (array) $Gateway->settings;
     }
     // Add newly activated gateways
     if (!in_array($gateway . $indexed, $gateways)) {
         $gateways[] = $gateway . $indexed;
         shopp_set_setting('active_gateways', join(',', $gateways));
     }
     // Save the gateway settings
     shopp_set_formsettings();
     $this->notice(Shopp::__('Shopp payments settings saved.'));
     Shopp::redirect(add_query_arg());
 }
开发者ID:msigley,项目名称:shopp,代码行数:32,代码来源:Payments.php

示例7: cart

 /**
  * Handles shopping cart requests
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function cart()
 {
     if (isset($_REQUEST['shopping']) && 'reset' == strtolower($_REQUEST['shopping'])) {
         ShoppShopping()->reset();
         Shopp::redirect(Shopp::url());
     }
     if (empty($_REQUEST['cart'])) {
         return true;
     }
     do_action('shopp_cart_request');
     if (isset($_REQUEST['checkout'])) {
         Shopp::redirect(Shopp::url(false, 'checkout', $this->security()));
     }
     if (isset($_REQUEST['ajax'])) {
         $Cart = ShoppOrder()->Cart;
         $Cart->totals();
         $Cart->ajax();
     }
     $redirect = false;
     if (isset($_REQUEST['redirect'])) {
         $redirect = $_REQUEST['redirect'];
     }
     switch ($redirect) {
         case 'checkout':
             Shopp::redirect(Shopp::url(false, $redirect, ShoppOrder()->security()));
             break;
         default:
             if (!empty($_REQUEST['redirect'])) {
                 Shopp::safe_redirect($_REQUEST['redirect']);
             } else {
                 Shopp::redirect(Shopp::url(false, 'cart'));
             }
     }
     exit;
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:43,代码来源:Storefront.php

示例8: loader


//.........这里部分代码省略.........
         } else {
             $this->notice(sprintf(__('%d orders updated.', 'Shopp'), count($selected)));
         }
     }
     $Purchase = new ShoppPurchase();
     $offset = get_option('gmt_offset') * 3600;
     if (!empty($start)) {
         $startdate = $start;
         list($month, $day, $year) = explode("/", $startdate);
         $starts = mktime(0, 0, 0, $month, $day, $year);
     }
     if (!empty($end)) {
         $enddate = $end;
         list($month, $day, $year) = explode("/", $enddate);
         $ends = mktime(23, 59, 59, $month, $day, $year);
     }
     $pagenum = absint($paged);
     $start = $per_page * ($pagenum - 1);
     $where = array();
     $joins = array();
     if (!empty($status) || $status === '0') {
         $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->orders = sDB::query($query, 'array', 'index', 'id');
     $num_pages = ceil($this->ordercount->total / $per_page);
     if ($paged > 1 && $paged > $num_pages) {
         Shopp::redirect(add_query_arg('paged', null, $url));
     }
 }
开发者ID:jonathandavis,项目名称:shopp,代码行数:101,代码来源:Service.php

示例9: legacyupdate

 /**
  * Handle auto-updates from Shopp 1.0
  *
  * @since 1.1
  *
  * @return void
  **/
 public function legacyupdate()
 {
     global $plugin_page;
     if ('shopp-settings-update' == $plugin_page && isset($_GET['updated']) && $_GET['updated'] == 'true') {
         Shopp::redirect(add_query_arg('page', ShoppAdmin::pagename('orders'), admin_url('admin.php')));
     }
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:14,代码来源:Admin.php

示例10: lock

 /**
  * Create a lock for transaction processing
  *
  * @author Jonathan Davis
  * @since 1.2.1
  *
  * @return boolean
  **/
 public function lock($data)
 {
     if (!isset($data['order'])) {
         return false;
     }
     $order = $data['order'];
     $locked = 0;
     for ($attempts = 0; $attempts < 3 && $locked == 0; $attempts++) {
         $locked = sDB::query("SELECT GET_LOCK('{$order}'," . SHOPP_TXNLOCK_TIMEOUT . ") AS locked", 'auto', 'col', 'locked');
         if (0 == $locked) {
             sleep(1);
         }
         // Wait a sec before trying again
     }
     if (1 == $locked) {
         return true;
     }
     shopp_debug("Purchase authed lock for order #{$order} failed. Could not achieve a lock.");
     Shopp::redirect(Shopp::url(false, 'thanks', ShoppOrder()->security()));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:28,代码来源:Events.php

示例11: workflow

 /**
  * Handles loading, saving and deleting categories in a workflow context
  *
  * @author Jonathan Davis
  * @since 1.0
  * @return void
  **/
 public function workflow()
 {
     $defaults = array('action' => false, 'selected' => array(), 'page' => false, 'id' => false, 'save' => false, 'next' => false, '_wpnonce' => false);
     $args = array_merge($defaults, $_REQUEST);
     extract($args, EXTR_SKIP);
     if (!defined('WP_ADMIN') || $page != $this->page()) {
         return false;
     }
     $adminurl = admin_url('admin.php');
     add_screen_option('per_page', array('label' => __('Categories Per Page', 'Shopp'), 'default' => 20, 'option' => 'edit_' . ProductCategory::$taxon . '_per_page'));
     if ('delete' == $action && wp_verify_nonce($_wpnonce, 'shopp_categories_manager')) {
         if (!empty($id)) {
             $selected = array($id);
         }
         $total = count($selected);
         foreach ($selected as $selection) {
             $DeletedCategory = new ProductCategory($selection);
             $deleted = $DeletedCategory->name;
             $DeletedCategory->delete();
         }
         if (1 == $total) {
             $this->notice(Shopp::__('Deleted %s category.', "<strong>{$deleted}</strong>"));
         } else {
             $this->notice(Shopp::__('Deleted %s categories.', "<strong>{$total}</strong>"));
         }
         $reset = array('selected' => null, 'action' => null, 'id' => null, '_wpnonce' => null);
         $redirect = add_query_arg(array_merge($_GET, $reset), $adminurl);
         Shopp::redirect($redirect);
         exit;
     }
     if ($id && 'new' != $id) {
         $Category = new ProductCategory($id);
     } else {
         $Category = new ProductCategory();
     }
     $meta = array('specs', 'priceranges', 'options', 'prices');
     foreach ($meta as $prop) {
         if (!isset($Category->{$prop})) {
             $Category->{$prop} = array();
         }
     }
     if ($save) {
         $this->save($Category);
         // Workflow handler
         if (isset($_REQUEST['settings']) && isset($_REQUEST['settings']['workflow'])) {
             $workflow = $_REQUEST['settings']['workflow'];
             $working = array_search($id, $this->worklist);
             switch ($workflow) {
                 case 'close':
                     $next = 'close';
                     break;
                 case 'new':
                     $next = 'new';
                     break;
                 case 'next':
                     $key = $working + 1;
                     break;
                 case 'previous':
                     $key = $working - 1;
                     break;
             }
             if (isset($key)) {
                 $next = isset($this->worklist[$key]) ? $this->worklist[$key] : 'close';
             }
         }
         if ($next) {
             if ('new' == $next) {
                 $Category = new ProductCategory();
             } else {
                 $Category = new ProductCategory($next);
             }
         } else {
             if (empty($id)) {
                 $id = $Category->id;
             }
             $Category = new ProductCategory($id);
         }
     }
     ShoppCollection($Category);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:87,代码来源:Categories.php

示例12: process

 public function process()
 {
     $action = $this->form('checkout');
     if ('process' != $action) {
         return;
     }
     $Payments = ShoppOrder()->Payments;
     $Cart = ShoppOrder()->Cart;
     $forcedconfirm = 'always' == shopp_setting('order_confirmation');
     $wasfree = $Cart->orderisfree();
     // Get current free status
     $estimated = $Cart->total();
     // Get current total
     $Cart->totals();
     // Retotal after checkout to capture order total changes
     // We have to avoid truthiness, hence the strange logic expression
     if (true !== apply_filters('shopp_validate_checkout', true)) {
         return;
     } else {
         $this->customer();
     }
     // Catch changes from validation
     // Catch originally free orders that get extra (shipping) costs added to them
     if ($wasfree && $Payments->count() > 1 && !$Cart->orderisfree() && empty($Payments->selected()->cards)) {
         shopp_add_error(Shopp::__('The order amount changed and requires that you select a payment method.'));
         Shopp::redirect(Shopp::url(false, 'checkout', ShoppOrder()->security()));
     }
     // Do not use shopp_checkout_processed for payment gateway redirect actions
     // Free order processing doesn't take over until the order is submitted for processing in `shopp_process_order`
     do_action('shopp_checkout_processed');
     // If the cart's total changes at all, confirm the order
     if (apply_filters('shopp_order_confirm_needed', $estimated != $Cart->total() || $forcedconfirm)) {
         Shopp::redirect(Shopp::url(false, 'confirm', ShoppOrder()->security()));
         return;
     }
     do_action('shopp_process_order');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:37,代码来源:Checkout.php

示例13: returned

 public function returned()
 {
     if ($this->id() != $_GET['rmtpay']) {
         return;
     }
     // Not our offsite payment
     $request = array_merge(array('merchant_order_id' => false, 'key' => false, 'order_number' => false, 'total' => false, 'credit_card_processed' => false, 'invoice_id' => false, 'pay_method' => false), $_GET);
     extract($request, EXTR_SKIP);
     if (Shopp::str_true($this->settings['verify']) && !$this->verify($key)) {
         shopp_add_error(Shopp::__('The order submitted by 2Checkout could not be verified.'), SHOPP_TRXN_ERR);
         Shopp::redirect(Shopp::url(false, 'checkout'));
     }
     if (empty($merchant_order_id)) {
         shopp_add_error(Shopp::__('The order submitted by 2Checkout did not specify a transaction ID.'), SHOPP_TRXN_ERR);
         Shopp::redirect(Shopp::url(false, 'checkout'));
     }
     $Purchase = ShoppPurchase(new ShoppPurchase((int) $merchant_order_id));
     if (!$Purchase->exists()) {
         shopp_add_error(Shopp::__('The order submitted by 2Checkout did not match any submitted orders.'), SHOPP_TRXN_ERR);
         Shopp::redirect(Shopp::url(false, 'checkout'));
     }
     if ('Y' != $credit_card_processed) {
         shopp_add_order_event($Purchase->id, 'auth-fail', array('amount' => $total, 'error' => 'Declined', 'message' => Shopp::__('The payment was not completed succesfully'), 'gateway' => $this->module));
         shopp_add_error(Shopp::__('The order submitted by 2Checkout did not match any submitted orders.'), SHOPP_TRXN_ERR);
         Shopp::redirect(Shopp::url(false, 'checkout'));
     }
     $this->Order->inprogress = $Purchase->id;
     add_action('shopp_authed_order_event', array(ShoppOrder(), 'notify'));
     add_action('shopp_authed_order_event', array(ShoppOrder(), 'accounts'));
     add_action('shopp_authed_order_event', array(ShoppOrder(), 'success'));
     shopp_add_order_event($Purchase->id, 'authed', array('txnid' => $order_number, 'amount' => (double) $total, 'fees' => false, 'gateway' => $this->module, 'paymethod' => '2Checkout', 'paytype' => $pay_method, 'payid' => $invoice_id, 'capture' => true));
     Shopp::redirect(Shopp::url(false, 'thanks', false));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:33,代码来源:2Checkout.php

示例14: prepare_items


//.........这里部分代码省略.........
     }
     $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');
     $num_pages = ceil($this->ordercount->total / $per_page);
     if ($paged > 1 && $paged > $num_pages) {
         Shopp::redirect(add_query_arg('paged', null, $url));
     }
     $Gateways = Shopp::object()->Gateways;
     $this->gateways = array_merge($Gateways->modules, array('ShoppFreeOrder' => $Gateways->freeorder));
     $this->statuses = (array) shopp_setting('order_status');
     $this->txnstatuses = ShoppLookup::txnstatus_labels();
     // Convert other date formats to numeric but preserve the order of the month/day/year or day/month/year
     $date_format = get_option('date_format');
     $date_format = preg_replace("/[^A-Za-z0-9]/", '', $date_format);
     // Force month display to numeric with leading zeros
     $date_format = str_replace(array('n', 'F', 'M'), 'm/', $date_format);
     // Force day display to numeric with leading zeros
     $date_format = str_replace(array('j'), 'd/', $date_format);
     // Force year display to 4-digits
     $date_format = str_replace('y', 'Y/', $date_format);
     $this->dates = trim($date_format, '/');
     $this->set_pagination_args(array('total_items' => $this->ordercount->total, 'total_pages' => $this->ordercount->total / $per_page, 'per_page' => $per_page));
 }
开发者ID:msigley,项目名称:shopp,代码行数:101,代码来源:Orders.php

示例15: upgrades

 /**
  * Begins database updates
  *
  * @since 1.3.6
  *
  * @return void
  **/
 public function upgrades()
 {
     if (empty($_GET['action']) || 'shopp-upgrade' != $_GET['action']) {
         return;
     }
     // Prevent unauthorized users from upgrading (without giving admin's a chance to backup)
     if (!current_user_can('activate_plugins')) {
         return;
     }
     // Prevent outsiders from the upgrade process
     check_admin_referer('shopp-upgrade');
     $Installer = new ShoppInstallation();
     $Installer->upgrade();
     $welcome = add_query_arg(array('page' => $this->Admin->pagename('welcome')), admin_url('admin.php'));
     Shopp::redirect($welcome, true);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:23,代码来源:Flow.php


注:本文中的Shopp::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。