$errors = $product->getErrors(); $errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The file upload failed", "cart66") . ":</b></p>"); } Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Product save failed ({$errorCode}): " . strip_tags($errorMessage)); } } elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $product->load($id); } elseif (isset($_GET['task']) && $_GET['task'] == 'delete' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $product->load($id); $product->deleteMe(); $product->clear(); } elseif (isset($_GET['task']) && $_GET['task'] == 'xdownload' && isset($_GET['id']) && $_GET['id'] > 0) { // Load the product $id = Cart66Common::getVal('id'); $product->load($id); // Delete the download file $setting = new Cart66Setting(); $dir = Cart66Setting::getValue('product_folder'); $path = $dir . DIRECTORY_SEPARATOR . $product->download_path; unlink($path); // Clear the name of the download file from the object and database $product->download_path = ''; $product->save(); } $data['products'] = $product->getNonSubscriptionProducts('where id>0', null, '1'); $data['spreedly'] = $product->getSpreedlyProducts(null, null, '1'); ?> <?php
public function section_notifications_settings() { $tab = 'notifications-email_receipt_settings'; $data = array('tab' => $tab); if (CART66_PRO) { $reminder = new Cart66MembershipReminders(); $orderFulfillment = new Cart66OrderFulfillment(); $errorMessage = ''; $successMessage = ''; if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($_POST['cart66-action'] == 'email log settings') { foreach ($_POST['emailLog'] as $key => $value) { Cart66Setting::setValue($key, $value); } $tab = 'notifications-email_log_settings'; } if ($_POST['cart66-action'] == 'save reminder') { try { $reminder->load($_POST['reminder']['id']); $reminder->setData($_POST['reminder']); $reminder->save(); $reminder->clear(); } catch (Cart66Exception $e) { $errorCode = $e->getCode(); // Reminder save failed if ($errorCode == 66302) { $errors = $reminder->getErrors(); $exception = Cart66Exception::exceptionMessages($e->getCode(), __("The reminder could not be saved for the following reasons", "cart66"), $errors); $errorMessage = Cart66Common::getView('views/error-messages.php', $exception); } } $tab = 'notifications-reminder_settings'; } if ($_POST['cart66-action'] == 'save order fulfillment') { try { $orderFulfillment->load($_POST['fulfillment']['id']); $orderFulfillment->setData($_POST['fulfillment']); $orderFulfillment->save(); $orderFulfillment->clear(); } catch (Cart66Exception $e) { $errorCode = $e->getCode(); if ($errorCode == 66303) { $errors = $orderFulfillment->getErrors(); $exception = Cart66Exception::exceptionMessages($e->getCode(), __("The order fulfillment could not be saved for the following reasons", "cart66"), $errors); $errorMessage = Cart66Common::getView('views/error-messages.php', $exception); } } $tab = 'notifications-fulfillment_settings'; } if ($_POST['cart66-action'] == 'advanced notifications') { Cart66Setting::setValue('enable_advanced_notifications', $_POST['enable_advanced_notifications']); $successMessage = __('Your notification settings have been saved.', 'cart66'); $tab = 'notifications-advanced_notifications'; } } elseif ($_SERVER['REQUEST_METHOD'] == "GET") { if (isset($_GET['task']) && $_GET['task'] == 'edit_reminder' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $reminder->load($id); $tab = 'notifications-reminder_settings'; } elseif (isset($_GET['task']) && $_GET['task'] == 'delete_reminder' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $reminder->load($id); $reminder->deleteMe(); $reminder->clear(); $tab = 'notifications-reminder_settings'; } elseif (isset($_GET['task']) && $_GET['task'] == 'cancel_reminder') { $tab = 'notifications-reminder_settings'; } elseif (isset($_GET['task']) && $_GET['task'] == 'edit_fulfillment' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $orderFulfillment->load($id); $tab = 'notifications-fulfillment_settings'; } elseif (isset($_GET['task']) && $_GET['task'] == 'delete_fulfillment' && isset($_GET['id']) && $_GET['id'] > 0) { $id = Cart66Common::getVal('id'); $orderFulfillment->load($id); $orderFulfillment->deleteMe(); $orderFulfillment->clear(); $tab = 'notifications-fulfillment_settings'; } elseif (isset($_GET['task']) && $_GET['task'] == 'cancel_fulfillment') { $tab = 'notifications-fulfillment_settings'; } } $data = array('reminder' => $reminder, 'order_fulfillment' => $orderFulfillment, 'tab' => $tab, 'error_message' => $errorMessage, 'success_message' => $successMessage); } echo Cart66Common::getView('admin/settings/notifications.php', $data, false); }
public static function paypalSubscriptions() { $data = array(); if (CART66_PRO) { $sub = new Cart66PayPalSubscription(); $data['subscription'] = $sub; if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'save paypal subscription') { $subData = Cart66Common::postVal('subscription'); $subData['setup_fee'] = isset($subData['setup_fee']) ? Cart66Common::convert_currency_to_number($subData['setup_fee']) : ''; $subData['price'] = isset($subData['price']) ? Cart66Common::convert_currency_to_number($subData['price']) : ''; $sub->setData($subData); $errors = $sub->validate(); if (count($errors) == 0) { $sub->save(); $sub->clear(); $data['subscription'] = $sub; } else { $data['errors'] = $sub->getErrors(); $data['jqErrors'] = $sub->getJqErrors(); } } else { if (Cart66Common::getVal('task') == 'edit' && isset($_GET['id'])) { $sub->load(Cart66Common::getVal('id')); $data['subscription'] = $sub; } elseif (Cart66Common::getVal('task') == 'delete' && isset($_GET['id'])) { $sub->load(Cart66Common::getVal('id')); $sub->deleteMe(); $sub->clear(); $data['subscription'] = $sub; } } $data['plans'] = $sub->getModels('where is_paypal_subscription>0', 'order by name', '1'); $view = Cart66Common::getView('pro/admin/paypal-subscriptions.php', $data); echo $view; } else { echo '<h2>PayPal Subscriptions</h2><p class="description">This feature is only available in <a href="http://cart66.com">Cart66 Professional</a>.</p>'; } }
echo "<p class='Cart66Error'>{$paymentProfileError}</p>"; } } else { try { throw new Cart66Exception(ucwords($response['L_SHORTMESSAGE0']), 66503); } catch (Cart66Exception $e) { $exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage(), array('Error Number: ' . $response['L_ERRORCODE0'], $response['L_LONGMESSAGE0'])); echo Cart66Common::getView('views/error-messages.php', $exception); } } } } // End if doexpresscheckout } elseif (isset($_GET['token']) || isset($_GET['PayerID'])) { $token = Cart66Common::getVal('token'); $payerId = Cart66Common::getVal('PayerID'); $details = $pp->GetExpressCheckoutDetails($token); $state = $details['SHIPTOSTATE']; // Calculate tax $tax = 0; $isTaxed = $taxRate->loadByZip($details['SHIPTOZIP']); if ($isTaxed == false) { $isTaxed = $taxRate->loadByState($state); } if ($isTaxed == false) { $isTaxed = $taxRate->loadByState('All Sales'); } if ($isTaxed) { $taxable = Cart66Session::get('Cart66Cart')->getTaxableAmount($taxRate->tax_shipping); $tax = number_format($taxable * ($taxRate->rate / 100), 2, '.', ''); if ($tax == 0) {
public static function updateGravityProductQuantityField() { $formId = Cart66Common::getVal('formId'); $gr = new Cart66GravityReader($formId); $fields = $gr->getStandardFields(); header('Content-type: application/json'); echo json_encode($fields); die; }
/** * Load the cart from the session or put a new cart in the session */ public function initCart() { if (!Cart66Session::get('Cart66Cart')) { Cart66Session::set('Cart66Cart', new Cart66Cart()); // Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Creating a new Cart66Cart OBJECT for the database session."); } if (isset($_POST['task'])) { if ($_POST['task'] == 'addToCart') { Cart66Session::get('Cart66Cart')->addToCart(); } elseif ($_POST['task'] == 'updateCart') { Cart66Session::get('Cart66Cart')->updateCart(); } } elseif (isset($_GET['task'])) { if ($_GET['task'] == 'removeItem') { $itemIndex = Cart66Common::getVal('itemIndex'); Cart66Session::get('Cart66Cart')->removeItem($itemIndex); } } elseif (isset($_POST['cart66-action'])) { $task = Cart66Common::postVal('cart66-action'); if ($task == 'authcheckout') { $inventoryMessage = Cart66Session::get('Cart66Cart')->checkCartInventory(); if (!empty($inventoryMessage)) { Cart66Session::set('Cart66InventoryWarning', $inventoryMessage); } } } }
<?php global $wpdb; $order = new Cart66Order(); $status = ''; $stats = trim(Cart66Setting::getValue('status_options')); if (Cart66Common::getVal('status')) { $status = strlen($stats) >= 1 && strpos(strtolower($stats), strtolower(Cart66Common::getVal('status'))) > -1 ? Cart66Common::getVal('status') : ''; } ?> <h2><?php _e('Cart66 Orders', 'cart66'); ?> </h2> <div class='wrap' style='margin-bottom:60px;'> <?php $setting = new Cart66Setting(); if (strlen($stats) >= 1) { $stats = explode(',', $stats); ?> <p style="float: left; clear: both; margin-top:0; padding-top: 0;"><?php _e('Filter Orders by Status', 'cart66'); ?> : <?php foreach ($stats as $s) { $s = trim(strtolower($s)); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order status query: WHERE status='{$s}'"); $tmpRows = $order->getOrderRows("WHERE status='{$s}'", null, null, 'id');