本文整理汇总了PHP中Cart66Common::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::getTableName方法的具体用法?PHP Cart66Common::getTableName怎么用?PHP Cart66Common::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::getTableName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findLatestProductId
public function findLatestProductId($ids)
{
global $wpdb;
$output = false;
if (is_array($ids)) {
$sql = 'SELECT id from ' . Cart66Common::getTableName('orders') . " WHERE account_id = '" . $this->account_id . "'";
$orders = $wpdb->get_col($sql);
if (count($orders) > 0) {
$orderIds = implode($orders, ',');
$sql = 'SELECT product_id from ' . Cart66Common::getTableName('order_items') . " WHERE `order_id` IN ({$orderIds}) ORDER BY id desc";
$products = $wpdb->get_results($sql);
if (count($products) > 0) {
foreach ($products as $product) {
$productIds[] = $product->product_id;
if (in_array($product->product_id, $ids)) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] order item id: {$product->product_id} found in list of subscription products matching feature level and subscription name.");
$output = $product->product_id;
break;
}
}
}
}
}
return $output;
}
示例2: resendEmailFromLog
public static function resendEmailFromLog($id)
{
$resendEmail = false;
global $wpdb;
$tableName = Cart66Common::getTableName('email_log');
$sql = "SELECT * from {$tableName} where id = {$id}";
$results = $wpdb->get_results($sql);
if ($results) {
foreach ($results as $r) {
$resendEmail = Cart66Notifications::mail($r->to_email, $r->subject, $r->body, $r->headers);
$email = new Cart66EmailLog();
$email_data = array('from_email' => $r->from_email, 'from_name' => $r->from_name, 'to_email' => $r->to_email, 'to_name' => $r->to_name, 'head' => array('headers' => $r->headers), 'subject' => $r->subject, 'msg' => $r->body, 'attachments' => $r->attachments, 'order_id' => $r->order_id);
if (!$resendEmail) {
if (Cart66Setting::getValue('log_resent_emails')) {
$email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND FAILED');
}
} else {
if (Cart66Setting::getValue('log_resent_emails')) {
$email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND SUCCESSFUL');
}
}
}
}
return $resendEmail;
}
示例3: getCartSettings
public static function getCartSettings()
{
global $wpdb;
$out = "\n=====================\nCART SETTINGS\n=====================\n\n";
$cartTable = Cart66Common::getTableName('cart_settings');
$sql = "SELECT * from {$cartTable} order by `key`";
$results = $wpdb->get_results($sql, OBJECT);
foreach ($results as $row) {
$out .= $row->key . ' = ' . $row->value . "\n";
}
return $out;
}
示例4: save
/**
* Only save shipping methods if the carrier code combo does not exist.
*/
public function save()
{
$save = true;
$shippingMethods = Cart66Common::getTableName('shipping_methods');
if (!empty($this->carrier) && !empty($this->code)) {
$sql = "SELECT id from {$shippingMethods} where carrier=%s and code=%s";
$sql = $this->_db->prepare($sql, $this->carrier, $this->code);
$id = $this->_db->get_var($sql);
$save = $id === NULL;
}
if ($save) {
parent::save();
}
}
示例5: exportOrders
public static function exportOrders($startDate, $endDate)
{
global $wpdb;
$start = date('Y-m-d 00:00:00', strtotime($startDate));
$end = date('Y-m-d 00:00:00', strtotime($endDate . ' + 1 day'));
$orders = Cart66Common::getTableName('orders');
$items = Cart66Common::getTableName('order_items');
$orderHeaders = array('id' => __('Order ID', 'cart66'), 'trans_id' => __('Order Number', 'cart66'), 'ordered_on' => __('Date', 'cart66'), 'bill_first_name' => __('Billing First Name', 'cart66'), 'bill_last_name' => __('Billing Last Name', 'cart66'), 'bill_address' => __('Billing Address', 'cart66'), 'bill_address2' => __('Billing Address 2', 'cart66'), 'bill_city' => __('Billing City', 'cart66'), 'bill_state' => __('Billing State', 'cart66'), 'bill_country' => __('Billing Country', 'cart66'), 'bill_zip' => __('Billing Zip Code', 'cart66'), 'ship_first_name' => __('Shipping First Name', 'cart66'), 'ship_last_name' => __('Shipping Last Name', 'cart66'), 'ship_address' => __('Shipping Address', 'cart66'), 'ship_address2' => __('Shipping Address 2', 'cart66'), 'ship_city' => __('Shipping City', 'cart66'), 'ship_state' => __('Shipping State', 'cart66'), 'ship_country' => __('Shipping Country', 'cart66'), 'ship_zip' => __('Shipping Zip Code', 'cart66'), 'phone' => __('Phone', 'cart66'), 'email' => __('Email', 'cart66'), 'coupon' => __('Coupon', 'cart66'), 'discount_amount' => __('Discount Amount', 'cart66'), 'shipping' => __('Shipping Cost', 'cart66'), 'subtotal' => __('Subtotal', 'cart66'), 'tax' => __('Tax', 'cart66'), 'total' => __('Total', 'cart66'), 'ip' => __('IP Address', 'cart66'), 'shipping_method' => __('Delivery Method', 'cart66'), 'status' => __('Order Status', 'cart66'));
$orderColHeaders = implode(',', $orderHeaders);
$orderColSql = implode(',', array_keys($orderHeaders));
$out = $orderColHeaders . ",Form Data,Item Number,Description,Quantity,Product Price,Form ID\n";
$sql = "SELECT {$orderColSql} from {$orders} where ordered_on >= %s AND ordered_on < %s AND status != %s order by ordered_on";
$sql = $wpdb->prepare($sql, $start, $end, 'checkout_pending');
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] SQL: {$sql}");
$selectedOrders = $wpdb->get_results($sql, ARRAY_A);
foreach ($selectedOrders as $o) {
$itemRowPrefix = '"' . $o['id'] . '","' . $o['trans_id'] . '",' . str_repeat(',', count($o) - 3);
$orderId = $o['id'];
$sql = "SELECT form_entry_ids, item_number, description, quantity, product_price FROM {$items} where order_id = {$orderId}";
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Item query: {$sql}");
$selectedItems = $wpdb->get_results($sql, ARRAY_A);
$out .= '"' . implode('","', $o) . '"';
$printItemRowPrefix = false;
if (!empty($selectedItems)) {
foreach ($selectedItems as $i) {
if ($printItemRowPrefix) {
$out .= $itemRowPrefix;
}
if ($i['form_entry_ids'] && CART66_PRO) {
$i['form_id'] = $i['form_entry_ids'];
$GReader = new Cart66GravityReader();
$i['form_entry_ids'] = $GReader->displayGravityForm($i['form_entry_ids'], true);
$i['form_entry_ids'] = str_replace("\"", "''", $i['form_entry_ids']);
}
$i['description'] = str_replace(",", " -", $i['description']);
$out .= ',"' . implode('","', $i) . '"';
$out .= "\n";
$printItemRowPrefix = true;
}
} else {
$out .= "\n";
}
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Report\n{$out}");
return $out;
}
示例6: hideSubscriptionPages
/**
* Hide pages that the logged in user may not access
*/
public static function hideSubscriptionPages($featureLevel, $activeAccount = false)
{
global $wpdb;
$hiddenPages = array();
$posts = Cart66Common::getTableName('posts', '');
$meta = Cart66Common::getTableName('postmeta', '');
$sql = "SELECT post_id, meta_value from {$meta} where meta_key='_cart66_subscription'";
$results = $wpdb->get_results($sql);
if (count($results)) {
foreach ($results as $m) {
$requiredFeatureLevels = explode(',', $m->meta_value);
if (!in_array($featureLevel, $requiredFeatureLevels) || !$activeAccount) {
$hiddenPages[] = $m->post_id;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Excluding page: " . $m->post_id);
}
}
}
return $hiddenPages;
}
示例7: _deleteMe
protected static function _deleteMe()
{
global $wpdb;
$tableName = Cart66Common::getTableName('sessions');
$sql = "DELETE from {$tableName} where id = %d";
$sql = $wpdb->prepare($sql, self::$_data['id']);
$wpdb->query($sql);
}
示例8: loadByEmail
public function loadByEmail($email)
{
$itemsTable = Cart66Common::getTableName('accounts');
$sql = "SELECT id from {$itemsTable} where email = '{$email}'";
$id = $this->_db->get_var($sql);
$this->load($id);
return $this->id;
}
示例9: showReportData
public static function showReportData()
{
global $wpdb;
$orders = Cart66Common::getTableName('orders');
$reportData = array();
$sql = "SELECT sum(`total`) from {$orders}";
$lifetimeTotal = $wpdb->get_var($sql);
$reportData[] = array("Total Sales", "total_sales", $lifetimeTotal);
$sql = "SELECT count('id') from {$orders}";
$totalOrders = $wpdb->get_var($sql);
$reportData[] = array("Total Orders", "total_orders", $totalOrders);
$sql = "SELECT ordered_on from {$orders} order by id asc LIMIT 1";
$firstSaleDate = $wpdb->get_var($sql);
$reportData[] = array("First Sale", "first_sale", $firstSaleDate);
$sql = "SELECT ordered_on from {$orders} order by id desc LIMIT 1";
$lastSaleDate = $wpdb->get_var($sql);
$reportData[] = array("Last Sale", "last_sale", $lastSaleDate);
$postTypes = get_post_types('', 'names');
foreach ($postTypes as $postType) {
if (!in_array($postType, array("post", "page", "attachment", "nav_menu_item", "revision"))) {
$customPostTypes[] = $postType;
}
}
$customPostTypes = empty($customPostTypes) ? "none" : implode(',', $customPostTypes);
$reportData[] = array("Custom Post Types", "custom_post_types", $customPostTypes);
$output = "First Sale: " . $firstSaleDate . "<br>";
$output .= "Last Sale: " . $lastSaleDate . "<br>";
$output .= "Total Orders: " . $totalOrders . "<br>";
$output .= "Total Sales: " . $lifetimeTotal . "<br>";
$output .= "Custom Post Types: " . $customPostTypes . "<br>";
$output .= "WordPress Version: " . get_bloginfo("version") . "<br>";
$output .= CART66_PRO ? "Cart66 Version: Pro " . Cart66Setting::getValue('version') . "<br>" : "Cart66 Version: " . Cart66Setting::getValue('version') . "<br>";
$output .= "PHP Version: " . phpversion() . "<br>";
//$output .= ": " . "" . "<br>";
return $output;
}
示例10: deleteMe
public function deleteMe($resetInventory = false, $resetRedemptions = false)
{
if ($this->id > 0) {
// Delete attached Gravity Forms if they exist
$items = $this->getItems();
foreach ($items as $item) {
if (!empty($item->form_entry_ids)) {
$entryIds = explode(',', $item->form_entry_ids);
if (is_array($entryIds)) {
foreach ($entryIds as $entryId) {
RGFormsModel::delete_lead($entryId);
}
}
}
}
if ($resetInventory && Cart66Setting::getValue('track_inventory')) {
$this->resetInventoryForItems();
}
if ($resetRedemptions && $this->coupon != 'none') {
$this->resetRedemptionsForCoupon();
}
// Delete order items
$orderItems = Cart66Common::getTableName('order_items');
$sql = "DELETE from {$orderItems} where order_id = {$this->id}";
$this->_db->query($sql);
// Delete the order
$sql = "DELETE from {$this->_tableName} where id = {$this->id}";
$this->_db->query($sql);
}
}
示例11: __construct
public function __construct($id = null)
{
$this->_tableName = Cart66Common::getTableName('order_fulfillment');
parent::__construct($id);
}
示例12: _e
<?php
if (CART66_PRO) {
?>
<h3 style="margin-top: 40px;"><?php
_e('Daily Income Totals', 'cart66');
?>
</h3>
<?php
global $wpdb;
$data = array();
for ($i = 0; $i < 42; $i++) {
$dayStart = date('Y-m-d 00:00:00', strtotime('today -' . $i . ' days', Cart66Common::localTs()));
$dayEnd = date('Y-m-d 00:00:00', strtotime("{$dayStart} +1 day", Cart66Common::localTs()));
$orders = Cart66Common::getTableName('orders');
$sql = "SELECT sum(`total`) from {$orders} where ordered_on > '{$dayStart}' AND ordered_on < '{$dayEnd}'";
$dailyTotal = $wpdb->get_var($sql);
$data['days'][$i] = date('m/d/Y', strtotime($dayStart, Cart66Common::localTs()));
$data['totals'][$i] = $dailyTotal;
}
?>
<table class="Cart66TableMed">
<?php
for ($i = 0; $i < count($data['days']); $i++) {
?>
<?php
if ($i % 7 == 0) {
echo '<tr>';
}
?>
示例13: Cart66Product
}
if (isset($_GET['duid'])) {
$duid = $_GET['duid'];
$product = new Cart66Product();
if ($product->loadByDuid($duid)) {
$okToDownload = true;
if ($product->download_limit > 0) {
// Check if download limit has been exceeded
$order_item_id = $product->loadItemIdByDuid($duid);
if ($product->countDownloadsForDuid($duid, $order_item_id) >= $product->download_limit) {
$okToDownload = false;
}
}
if ($okToDownload) {
$data = array('duid' => $duid, 'downloaded_on' => date('Y-m-d H:i:s'), 'ip' => $_SERVER['REMOTE_ADDR'], 'order_item_id' => $product->loadItemIdByDuid($duid));
$downloadsTable = Cart66Common::getTableName('downloads');
$wpdb->insert($downloadsTable, $data, array('%s', '%s', '%s', '%s'));
$setting = new Cart66Setting();
if (!empty($product->s3Bucket) && !empty($product->s3File)) {
require_once CART66_PATH . '/models/Cart66AmazonS3.php';
$link = Cart66AmazonS3::prepareS3Url($product->s3Bucket, $product->s3File, '1 minute');
wp_redirect($link);
exit;
} else {
$dir = Cart66Setting::getValue('product_folder');
$path = $dir . DIRECTORY_SEPARATOR . $product->download_path;
Cart66Common::downloadFile($path);
}
exit;
} else {
echo '<p>' . __("You have exceeded the maximum number of downloads for this product", "cart66") . '.</p>';
示例14: promotionProductSearch
public static function promotionProductSearch()
{
global $wpdb;
$search = Cart66Common::getVal('q');
$product = new Cart66Product();
$tableName = Cart66Common::getTableName('products');
$products = $wpdb->get_results("SELECT id, name from {$tableName} WHERE name LIKE '%%%{$search}%%' ORDER BY id ASC LIMIT 10");
$data = array();
foreach ($products as $p) {
$data[] = array('id' => $p->id, 'name' => $p->name);
}
echo json_encode($data);
die;
}
示例15: totalFromRange
function totalFromRange($start, $end)
{
global $wpdb;
$tableName = Cart66Common::getTableName('orders');
$sql = "SELECT sum(total) as total from {$tableName} where ordered_on > '{$start}' AND ordered_on < '{$end}'";
$result = $wpdb->get_row($sql, ARRAY_A);
$output = $result ? (double) $result['total'] : "N/A";
return $output;
}