本文整理汇总了PHP中Cart66Common类的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common类的具体用法?PHP Cart66Common怎么用?PHP Cart66Common使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cart66Common类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: setSelected
public function setSelected($value)
{
if ($value) {
$this->_data['isSelected'] = true;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Setting this live rate to selected: " . $this->_data['service']);
} else {
$this->_data['isSelected'] = false;
}
}
示例3: dump
public function dump()
{
if (Cart66Common::sessionType() == 'database') {
$value = Cart66SessionDb::dump();
} else {
$value = Cart66SessionNative::dump();
}
return $value;
}
示例4: 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;
}
示例5: getTrialPriceDescription
public function getTrialPriceDescription()
{
$description = 'No trial';
if ($this->offerTrial > 0) {
$description = Cart66Common::currency($this->trialPrice) . ' / ';
if ($this->trialPeriod > 1) {
$description .= $this->trialPeriod . ' ';
}
$description .= $this->getTrialPeriodUnit();
}
return $description;
}
示例6: pruneCarrierMethods
/**
* Delete all methods for the given carrier if the carrier code is not in the given array
*/
public function pruneCarrierMethods($carrier, array $codes)
{
$codes = array_map(array($this->_db, 'escape'), $codes);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Codes array map: " . print_r($codes, true));
$codes = implode("','", $codes);
$shippingMethods = $this->_tableName;
// $sql = "DELETE from $shippingMethods where carrier='$carrier' and code NOT IN ($codes)";
$sql = "DELETE from {$shippingMethods} where carrier=%s and code NOT IN ('{$codes}')";
$sql = $this->_db->prepare($sql, $carrier);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Pruning shipping methods: {$sql}");
$this->_db->query($sql);
}
示例7: getAddToCartImagePath
/**
* Return the image path for the add to cart button or false if no path is available
*/
public static function getAddToCartImagePath($attrs)
{
$path = false;
if (isset($attrs['img'])) {
// Look for custom image for this instance of the button
$path = $attrs['img'];
} else {
// Look for common images
$cartImgPath = Cart66Setting::getValue('cart_images_url');
if ($cartImgPath) {
$cartImgPath = Cart66Common::endSlashPath($cartImgPath);
$path = $cartImgPath . 'add-to-cart.png';
}
}
return $path;
}
示例8: getPriceDescription
public function getPriceDescription()
{
$product = new Cart66Product();
$spreedlyProduct = $product->getOne("where spreedly_subscription_id = {$this->id}");
if (!empty($spreedlyProduct->priceDescription)) {
$out = $spreedlyProduct->priceDescription;
} else {
$price = $this->price;
$out = Cart66Common::currency($price) . ' / ' . $this->terms;
if ($this->hasFreeTrial()) {
$duration = $this->chargeLaterDurationQuantity . ' ' . $this->chargeLaterDurationUnits;
$out .= " <span class='Cart66FreePeriod'>(first {$duration} free)</span>";
}
}
return $out;
}
示例9: 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;
}
示例10: checkFulfillmentSettings
public function checkFulfillmentSettings($orderId)
{
$order = new Cart66Order($orderId);
$data = array();
foreach ($order->getItems() as $item) {
$data[] = $item->product_id;
}
$orderFulfillment = new Cart66OrderFulfillment();
$orderF = $orderFulfillment->getModels();
$notify = new Cart66AdvancedNotifications($orderId);
foreach ($orderF as $of) {
$products = array_filter(explode(',', $of->products));
if (array_intersect($data, $products) || empty($products)) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] THEY INTERSECT!");
$notify->sendOrderFulfillmentEmails($of->id);
}
}
}
示例11: getRemoteRequestParams
public static function getRemoteRequestParams()
{
$params = false;
$setting = new Cart66Setting();
$orderNumber = Cart66Setting::getValue('order_number');
if (!$orderNumber) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order number not available");
}
$version = Cart66Setting::getValue('version');
if (!$version) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Version number not available");
}
if ($orderNumber && $version) {
global $wpdb;
$versionName = 'pro';
$params = sprintf("task=getLatestVersion&pn=Cart66&key=%s&v=%s&vnm=%s&wp=%s&php=%s&mysql=%s&ws=%s", urlencode($orderNumber), urlencode($version), urlencode($versionName), urlencode(get_bloginfo("version")), urlencode(phpversion()), urlencode($wpdb->db_version()), urlencode(get_bloginfo("url")));
}
return $params;
}
示例12: curlRequest
public static function curlRequest($url, $method = "get", $data = null)
{
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] curl request info: {$url}\nMethod: {$method}\nData: {$data}");
$ch = curl_init(self::$baseUri . $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, self::$apiToken . ":X");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 8);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml"));
switch ($method) {
case "post":
if ($data) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
}
break;
case "delete":
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
break;
case "put":
$fh = fopen("php://memory", "rw");
fwrite($fh, $data);
rewind($fh);
curl_setopt($ch, CURLOPT_INFILE, $fh);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($data));
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml", "Expect:"));
break;
default:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
break;
}
$result = new StdClass();
$result->response = curl_exec($ch);
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
return $result;
}
示例13: log
/**
* Log the PayPal recurring payment.
*
* The $data array paramter is a URL decoded version of the IPN post data.
* - Log the data in the pp_recurring_posts table
* - Update the account_subscriptions table with the new active_until date
*/
public function log(array $ipnData)
{
$isLogged = false;
$subscription = new Cart66AccountSubscription();
if ($subscription->loadByPayPalBillingProfileId($ipnData['recurring_payment_id'])) {
$data = array('account_id' => $subscription->accountId, 'recurring_payment_id' => $ipnData['recurring_payment_id'], 'mc_gross' => $ipnData['mc_gross'], 'txn_id' => $ipnData['txn_id'], 'product_name' => $ipnData['product_name'], 'first_name' => $ipnData['first_name'], 'last_name' => $ipnData['last_name'], 'payer_email' => $ipnData['payer_email'], 'ipn' => serialize($ipnData), 'next_payment_date' => $ipnData['next_payment_date'], 'time_created' => date('Y-m-d H:i:s', strtotime($ipnData['time_created'])));
$this->setData($data);
$id = $this->save();
if ($id > 0) {
$isLogged = true;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Recurring payment logged with ID: {$id}");
$subscription->extendActiveUntil($ipnData['next_payment_date']);
} else {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Failed to log recurring payment. " . print_r($data, true));
}
} else {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Unable to log recurring payment because the paypal billing profile id is unknown: " . $ipnData['recurring_payment_id']);
}
return $isLogged;
}
示例14: getSubscriptions
/**
* Return an array of enabled spreedly subscriptions
*
* @return array
*/
public static function getSubscriptions()
{
if (empty(self::$_subscriptionPlans)) {
$result = SpreedlyCommon::curlRequest("/subscription_plans.xml", "get");
if ($result->code == '200') {
$subscriptions = array();
$plans = new SimpleXmlElement($result->response);
foreach ($plans as $plan) {
$subscription = new SpreedlySubscription();
$subscription->setData($plan);
/// Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Spreedly subscription enabled: " . $subscription->enabled);
if ('true' == (string) $subscription->enabled) {
$subscriptions[] = $subscription;
}
}
self::$_subscriptionPlans = $subscriptions;
} else {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Spreedly Subscription: Unable to retrieve remote list of subscriptions ");
//throw new SpreedlyException('Spreedly Subscription: Unable to retrieve remote list of subscriptions', 66003);
}
}
return self::$_subscriptionPlans;
}
示例15: widget
public function widget($args, $instance)
{
extract($args);
$data['title'] = $instance['title'];
$data['shipping'] = isset($instance['shipping']) ? $instance['shipping'] : false;
if (!Cart66Session::get('Cart66Cart')) {
Cart66Session::set('Cart66Cart', new Cart66Cart());
}
$this->_items = Cart66Session::get('Cart66Cart')->getItems();
$data['items'] = $this->_items;
$data['cartPage'] = get_page_by_path('store/cart');
$data['checkoutPage'] = get_page_by_path('store/checkout');
$data['numItems'] = $this->countItems();
$data['cartWidget'] = $this;
$data['beforeWidget'] = $before_widget;
$data['afterWidget'] = $after_widget;
$data['beforeTitle'] = $before_title;
$data['afterTitle'] = $after_title;
if (isset($instance['standard_advanced']) && $instance['standard_advanced'] == 'advanced') {
echo Cart66Common::getView('views/cart-sidebar-advanced.php', $data);
} else {
echo Cart66Common::getView('views/cart-sidebar.php', $data);
}
}