Пример #1
0
require_once BASE_PATH . '/assets/includes/cart.inc.php';
require_once BASE_PATH . '/assets/includes/affiliate.inc.php';
require_once BASE_PATH . '/assets/includes/header.inc.php';
require_once BASE_PATH . '/assets/includes/errors.php';
require_once BASE_PATH . '/assets/classes/invoicetools.php';
require_once BASE_PATH . '/assets/includes/errors.php';
if (!$billID) {
    // Make sure this exists before going on
    die('No billID was passed. Cannot proceed.');
}
$gatewayMode = "publicForm";
/*
 * Get currency info from db
 */
$currency = getCurrencyInfo($config['settings']['defaultcur']);
$invoice = new invoiceTools();
$billInfo = $invoice->getBillDetails($billID);
// Get the bill info using the passed bill ID
$invoiceInfo = $invoice->getInvoiceDetailsViaBillDBID($billInfo['bill_id']);
// Get invoice details
// xxxxxx Check if this is a membership and if so then check to see if tax needs to be added
$parms['noDefault'] = true;
// Do not allow defaults just in case
$cartInfo['orderNumber'] = $invoiceInfo['invoice_number'];
$uniqueOrderID = "bill-{$billID}";
$cartTotals['subtotalMinusDiscounts'] = $invoiceInfo['total'] * 1;
// Round it
$cartTotals['taxTotal'] = 0;
$cartTotals['shippingTotal'] = 0;
$cartTotals['cartGrandTotal'] = $invoiceInfo['total'] * 1;
// Round it
Пример #2
0
require_once BASE_PATH . '/assets/includes/language.inc.php';
require_once BASE_PATH . '/assets/includes/cart.inc.php';
require_once BASE_PATH . '/assets/includes/affiliate.inc.php';
define('META_TITLE', '');
// Override page title, description, keywords and page encoding here
define('META_DESCRIPTION', '');
define('META_KEYWORDS', '');
define('PAGE_ENCODING', '');
require_once BASE_PATH . '/assets/includes/header.inc.php';
require_once BASE_PATH . '/assets/includes/errors.php';
require_once BASE_PATH . '/assets/classes/invoicetools.php';
try {
    if (!$itemType) {
        die('No itemType passed!');
    }
    $invoice = new invoiceTools();
    if ($downloadOrderID) {
        $invoice->setOrderID($downloadOrderID);
        // Set the order ID
        if ($orderInfo = $invoice->getOrderDetails()) {
            //print_r($orderInfo); exit;
            $smarty->assign('downloadOrderID', $downloadOrderID);
        }
    }
    $invoiceOptions = $invoice->getOnlyItemOptions($itemType, $itemID);
    // Get the options as a temp array
    $invoiceItem = $invoiceOptions[$itemID];
    // Put those options into the invoice items array
    $invoiceItem['item_type'] = $itemType;
    $smarty->assign('invoiceItemID', $itemID);
    $smarty->assign('invoiceItem', $invoiceItem);
Пример #3
0
require_once BASE_PATH . '/assets/includes/affiliate.inc.php';
define('META_TITLE', '');
// Override page title, description, keywords and page encoding here
define('META_DESCRIPTION', '');
define('META_KEYWORDS', '');
define('PAGE_ENCODING', '');
require_once BASE_PATH . '/assets/includes/header.inc.php';
require_once BASE_PATH . '/assets/includes/errors.php';
require_once BASE_PATH . '/assets/classes/invoicetools.php';
require_once BASE_PATH . '/assets/classes/mediatools.php';
if (!$_GET['orderID']) {
    // Make sure an order ID is passed and if not die
    die("No order ID was passed");
}
try {
    $invoice = new invoiceTools();
    $invoice->setOrderID($orderID);
    // Set the order ID
    $invoiceTotals = new number_formatting();
    // Used to make sure the bills are showing in the admins currency
    $invoiceTotals->set_custom_cur_defaults($config['settings']['defaultcur']);
    $parms['noDefault'] = true;
    $adminCurrency = getCurrencyInfo($config['settings']['defaultcur']);
    if ($orderInfo = $invoice->getOrderDetails()) {
        $invoiceInfo = $invoice->getInvoiceDetailsViaOrderDBID($orderInfo['order_id']);
        $invoiceItemsCount = $invoice->queryInvoiceItems();
        // Number of invoice items total
        //print_r($invoiceInfo); exit;
        $invoice->options = false;
        // Do not select options here
        $digitalInvoiceItems = $invoice->getDigitalItems();
Пример #4
0
//print_k($download); exit;
/*
 * If the download type is order then check to make sure that the 
 * customer has access to download the file by doing these checks.
 */
if ($download['downloadType'] == 'order') {
    $maxDownloadAttempts = ($config['settings']['dl_attempts'] == 0 or $download['collectionDownload'] == 1) ? 9999 : $config['settings']['dl_attempts'];
    // Find the max download attempts - if unlimited use 999
    //echo $maxDownloadAttempts; exit;
    // Check authorization
    if ($_SESSION['downloadAuthorization'] != k_encrypt($download['downloadTypeID'])) {
        echo "You are not authorized to download this file";
        exit;
    } else {
        try {
            $invoice = new invoiceTools();
            $digitalItem = $invoice->getSingleInvoiceItem($download['invoiceItemID']);
            // Check expiration
            if ($nowGMT > $digitalItem['expires'] and $digitalItem['expires'] != '0000-00-00 00:00:00') {
                echo "This download has expired";
                exit;
            }
            // Check download count
            if ($digitalItem['downloads'] >= $maxDownloadAttempts) {
                echo "You have reached the maximum number of downloads for this file.";
                exit;
            }
        } catch (Exception $e) {
            echo $e->getMessage();
            exit;
        }
Пример #5
0
//echo $shippingDetails['price']['display'];
if ($_SESSION['cartTotalsSession']['shippingRequired']) {
    // Create step numbers depending on if shipping is needed or not
    $stepNumber = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4);
} else {
    $stepNumber = array('a' => 1, 'b' => 0, 'c' => 2, 'd' => 3);
}
$currency = getCurrencyInfo($_SESSION['selectedCurrencySession']);
// Get the details of the currently selected currency
//echo 'name: '.$_SESSION['shippingAddressSession']['name']; exit;
// Update invoice with shipping and billing info if known
mysqli_query($db, "\r\n\t\tUPDATE {$dbinfo[pre]}invoices SET \r\n\t\tinvoice_mem_id='{$_SESSION[member][mem_id]}',\r\n\t\texchange_rate='{$currency[exchange_rate]}',\r\n\t\ttotal='{$cartGrandTotal}',\r\n\t\tsubtotal='{$_SESSION[cartTotalsSession][priceSubTotal]}',\r\n\t\ttaxa_cost='{$recalcTaxA}',\r\n\t\ttaxb_cost='{$recalcTaxB}',\r\n\t\ttaxc_cost='{$recalcTaxC}',\r\n\t\ttax_ratea='{$_SESSION[tax][tax_a_default]}',\r\n\t\ttax_rateb='{$_SESSION[tax][tax_b_default]}',\r\n\t\ttax_ratec='{$_SESSION[tax][tax_c_default]}',\r\n\t\tship_id='{$_SESSION[cartInfoSession][selectedShippingMethodID]}',\r\n\t\tshipping_cost='{$shippingDetails[total]}',\r\n\t\tship_name='{$_SESSION[shippingAddressSession][name]}',\r\n\t\tship_address='{$_SESSION[shippingAddressSession][address]}',\r\n\t\tship_address2='{$_SESSION[shippingAddressSession][address2]}',\r\n\t\tship_city='{$_SESSION[shippingAddressSession][city]}',\r\n\t\tship_state='{$_SESSION[shippingAddressSession][stateID]}',\r\n\t\tship_country='{$_SESSION[shippingAddressSession][countryID]}',\r\n\t\tship_zip='{$_SESSION[shippingAddressSession][postalCode]}',\r\n\t\tship_phone='{$_SESSION[shippingAddressSession][phone]}',\r\n\t\tship_email='{$_SESSION[shippingAddressSession][email]}',\r\n\t\tbill_name='{$_SESSION[billingAddressSession][name]}',\r\n\t\tbill_address='{$_SESSION[billingAddressSession][address]}',\r\n\t\tbill_address2='{$_SESSION[billingAddressSession][address2]}',\r\n\t\tbill_city='{$_SESSION[billingAddressSession][city]}',\r\n\t\tbill_state='{$_SESSION[billingAddressSession][stateID]}',\r\n\t\tbill_country='{$_SESSION[billingAddressSession][countryID]}',\r\n\t\tbill_zip='{$_SESSION[billingAddressSession][postalCode]}',\r\n\t\tbill_phone='{$_SESSION[billingAddressSession][phone]}',\r\n\t\tbill_email='{$_SESSION[billingAddressSession][email]}',\r\n\t\tshippable='{$_SESSION[cartTotalsSession][shippingRequired]}',\r\n\t\tshipping_summary='{$_SESSION[cartTotalsSession][shippingSummary]}'\r\n\t\tWHERE invoice_id = '{$_SESSION[cartInfoSession][invoiceID]}'\r\n\t");
mysqli_query($db, "UPDATE {$dbinfo[pre]}orders SET member_id='{$_SESSION[member][mem_id]}',checkout_lang='{$_SESSION[member][language]}' WHERE uorder_id = '{$_SESSION[uniqueOrderID]}'");
// Upade orders db
try {
    $invoice = new invoiceTools();
    $invoice->setInvoiceID($_SESSION['cartInfoSession']['invoiceID']);
    $invoiceItemsCount = $invoice->queryInvoiceItems();
    // Number of invoice items total
    $digitalInvoiceItems = $invoice->getDigitalItems();
    $physicalInvoiceItems = $invoice->getPhysicalItems();
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    $smarty->assign('invoiceItemsCount', $invoiceItemsCount);
    // Number
    $smarty->assign('digitalInvoiceItems', $digitalInvoiceItems);
    // Digital invoice items
    $smarty->assign('physicalInvoiceItems', $physicalInvoiceItems);
    // Physical invoice items
Пример #6
0
define('META_DESCRIPTION', '');
define('META_KEYWORDS', '');
define('PAGE_ENCODING', '');
require_once BASE_PATH . '/assets/includes/header.inc.php';
require_once BASE_PATH . '/assets/includes/errors.php';
require_once BASE_PATH . '/assets/classes/invoicetools.php';
try {
    $billTotal = new number_formatting();
    // Used to make sure the bills are showing in the admins currency
    $billTotal->set_custom_cur_defaults($config['settings']['defaultcur']);
    $parms['noDefault'] = true;
    if (!$billID and !$orderID) {
        die('No bill/order ID was passed');
    }
    // Just to be safe make sure a bill/order ID was passed
    $invoiceObj = new invoiceTools();
    // Create new invoice object
    $invoiceObj->options = false;
    // Do not select options here
    $adminCurrency = getCurrencyInfo($config['settings']['defaultcur']);
    if ($billID) {
        $invoiceObj->setUBillID($billID);
        if ($billInfo = $invoiceObj->getBillDetails()) {
            $invoice = $invoiceObj->getInvoiceDetailsViaBillDBID($billInfo['bill_id']);
            if ($billInfo['bill_type'] == 2) {
                $ordersResult = mysqli_query($db, "\r\n\t\t\t\t\t\tSELECT * FROM {$dbinfo[pre]}orders \r\n\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}invoices \r\n\t\t\t\t\t\tON {$dbinfo[pre]}orders.order_id = {$dbinfo[pre]}invoices.order_id\r\n\t\t\t\t\t\tWHERE {$dbinfo[pre]}orders.bill_id = {$billInfo[bill_id]}\r\n\t\t\t\t\t\t");
                // Select invoice items
                $invoiceItemsCount = mysqli_num_rows($ordersResult);
                while ($order = mysqli_fetch_array($ordersResult)) {
                    $invoiceItems[$order['order_id']] = $order;
                    $invoiceItems[$order['order_id']]['name'] = "{$lang[order]} {$order[order_number]}";
try {
    $queryStr = k_decrypt($dlKey);
    parse_str($queryStr, $downloadKey);
    // Parse the query string
    //$downloadKey['collectionID'];
    //$downloadKey['uorderID'];
    if ($config['EncryptIDs']) {
        $downloadKey['collectionID'] = k_decrypt($downloadKey['collectionID']);
        // Collection ID
        $downloadKey['uorderID'] = k_decrypt($downloadKey['uorderID']);
        // Order ID
        $downloadKey['invoiceItemID'] = k_decrypt($downloadKey['invoiceItemID']);
        // Invoice Item ID
    }
    //print_r($downloadKey); exit;
    $invoice = new invoiceTools();
    $invoice->setOrderID($downloadKey['uorderID']);
    // Set the order ID
    $invoiceItem = $invoice->getSingleInvoiceItem($downloadKey['invoiceItemID']);
    //echo $downloadKey['invoiceItemID']; exit;
    if ($orderInfo = $invoice->getOrderDetails()) {
        $collectionResult = mysqli_query($db, "\t\t\t\r\n\t\t\t\tSELECT SQL_CALC_FOUND_ROWS *\r\n\t\t\t\tFROM {$dbinfo[pre]}collections \r\n\t\t\t\tWHERE coll_id = '{$downloadKey[collectionID]}'\r\n\t\t\t");
        if ($returnRows = getRows()) {
            $collection = mysqli_fetch_array($collectionResult);
            $collectionArray = collectionsList($collection);
            $smarty->assign('collectionRows', $returnRows);
            $smarty->assign('collection', $collectionArray);
            if ($collection['colltype'] == 1) {
                $collectionGalleriesResult = mysqli_query($db, "SELECT gallery_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'collections' AND item_id = '{$downloadKey[collectionID]}'");
                while ($collectionGallery = mysqli_fetch_array($collectionGalleriesResult)) {
                    $collectionGalleriesArray[] = $collectionGallery['gallery_id'];