Пример #1
0
switch ($action) {
    case "productsList":
        if (!empty($jtSorting)) {
            $rows = productsListOrderBy($jtSorting);
        } else {
            $rows = productsList();
        }
        $jTableResult['Result'] = "OK";
        $jTableResult['Records'] = $rows;
        break;
    case "addProduct":
        $res = addProduct(filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "precio", FILTER_SANITIZE_STRING));
        //Return result to jTable
        if ($res) {
            $jTableResult['Result'] = "OK";
            $jTableResult['Record'] = productsList();
        } else {
            $jTableResult['Result'] = "ERROR";
        }
        break;
    case "modifyProduct":
        $res = modifyProduct(filter_input(INPUT_POST, "IDP", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "precio", FILTER_SANITIZE_STRING));
        //Return result to jTable
        if ($res) {
            $jTableResult['Result'] = "OK";
        } else {
            $jTableResult['Result'] = "ERROR";
        }
        break;
    case "removeProduct":
        $res = removeProduct(filter_input(INPUT_POST, "IDP", FILTER_SANITIZE_STRING));
Пример #2
0
<?php

function productsList()
{
    $page = new page();
    $prod = new product();
    if (isset($_GET['sort'])) {
        if ($_GET['sort'] == "ASC") {
            $sort = "DESC";
        } else {
            $sort = "ASC";
        }
    } else {
        $sort = "";
    }
    $params = array();
    $params = $page->setProductsParams();
    $products = $prod->getList($params, $sort);
    $page->displayProducts($products, $params, $sort);
}
include "include/page.class.php";
productsList();
include "include/bottom.php";
Пример #3
0
  */
 $printsResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}prints\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}prints.print_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'prints')\r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}prints.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}prints.attachment = 'galleries' OR {$dbinfo[pre]}prints.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}prints.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'prints' AND item_id = {$dbinfo[pre]}prints.print_id AND gallery_id = '{$_SESSION[id]}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}prints.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}prints.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}prints.sortorder\r\n\t\t\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($printsResult)) {
     while ($prints = mysqli_fetch_assoc($printsResult)) {
         $printsArray[] = printsList($prints);
     }
     $smarty->assign('printRows', $returnRows);
     $smarty->assign('prints', $printsArray);
 }
 /*
  * Get the products assigned to this gallery
  */
 $productsResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}products\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}products.prod_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'products') \r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}products.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}products.attachment = 'galleries' OR {$dbinfo[pre]}products.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}products.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'products' AND item_id = {$dbinfo[pre]}products.prod_id AND gallery_id = '{$_SESSION[id]}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}products.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}products.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}products.sortorder\r\n\t\t\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($productsResult)) {
     while ($products = mysqli_fetch_assoc($productsResult)) {
         $productsArray[] = productsList($products);
     }
     $smarty->assign('productRows', $returnRows);
     $smarty->assign('products', $productsArray);
 }
 /*
  * Get the packages assigned to this gallery
  */
 $packagesResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}packages\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages') \r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}packages.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}packages.attachment = 'galleries' OR {$dbinfo[pre]}packages.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}packages.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'packages' AND item_id = {$dbinfo[pre]}packages.pack_id AND gallery_id = '{$_SESSION['id']}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}packages.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}packages.sortorder\r\n\t\t\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($packagesResult)) {
     while ($packages = mysqli_fetch_assoc($packagesResult)) {
         $packagesArray[] = packagesList($packages);
     }
     $smarty->assign('packageRows', $returnRows);
     $smarty->assign('packages', $packagesArray);
 }
Пример #4
0
     case 'add':
         $product['credits'] = $mediaCredits + $product['credits'];
         break;
     case 'sub':
         $product['credits'] = $mediaCredits - $product['credits'];
         break;
     case 'mult':
         $product['credits'] = $mediaCredits * $product['credits'];
         break;
 }
 if ($product['quantity'] != '0') {
     if ($product['product_type'] == '1') {
         // Check if this is a media based product
         $productsArray[$product['prod_id']] = productsList($product, $mediaID);
     } else {
         $productsArray[$product['prod_id']] = productsList($product, false);
     }
     // Stand Alone
     $optionsResult = mysqli_query($db, "SELECT og_id FROM {$dbinfo[pre]}option_grp WHERE parent_type = 'products' AND parent_id = '{$product[prod_id]}' AND deleted = 0");
     // See if there are any options for this item
     if (mysqli_num_rows($optionsResult)) {
         $productsArray[$product['prod_id']]['addToCartLink'] = $productsArray[$product['prod_id']]['linkto'];
         // Workbox popup
         $productsArray[$product['prod_id']]['directToCart'] = false;
         // Workbox popup
     } else {
         if ($config['EncryptIDs']) {
             $cartLink = "{$siteURL}/cart.php?mode=add&type=product&id=" . $productsArray[$product['prod_id']]['encryptedID'];
             if ($product['product_type'] == '1') {
                 $cartLink .= "&mediaID={$media[encryptedID]}";
             }
Пример #5
0
     }
     switch ($product['credits_calc']) {
         case 'add':
             $product['credits'] = $mediaCredits + $product['credits'];
             break;
         case 'sub':
             $product['credits'] = $mediaCredits - $product['credits'];
             break;
         case 'mult':
             $product['credits'] = $mediaCredits * $product['credits'];
             break;
     }
     $smarty->assign('mediaID', $mediaID);
     $smarty->assign('media', $media);
 }
 $productArray = productsList($product);
 $productArray['options'] = getProductOptions('products', $productArray['prod_id'], $product['taxable']);
 /*
  * If editing this then select the correctly selected items
  */
 if ($edit) {
     if ($productArray['options']) {
         foreach ($productArray['options'] as $key => $value) {
             foreach ($productArray['options'][$key]['options'] as $key2 => $value2) {
                 if ($optionSelections[$key . '-' . $key2]) {
                     $productArray['options'][$key]['options'][$key2]['selected'] = true;
                 }
                 // Set selected option to true
             }
         }
     }
Пример #6
0
     $cartItemsArray[$cartItem['oi_id']]['lineItemCreditsEach'] = $lineItemCreditsEach;
     $cartItemsArray[$cartItem['oi_id']]['lineItemCreditsTotal'] = $lineItemCreditsTotal;
     $cartItemsArray[$cartItem['oi_id']]['itemDetails'] = $printDetails;
     if ($cartItem['asset_id']) {
         // Check if a media file has been attached to this item
         $cartItemsArray[$cartItem['oi_id']]['itemDetails']['media'] = getMediaDetailsForCart($cartItem['asset_id']);
     }
     $cartItemsArray[$cartItem['oi_id']]['itemTypeShort'] = 'print';
     // Update prices and credits for invoice item in the db
     mysqli_query($db, "\r\n\t\t\t\t\t\t\tUPDATE {$dbinfo[pre]}invoice_items SET \r\n\t\t\t\t\t\t\tprice_total='{$lineItemPriceTotal}',\r\n\t\t\t\t\t\t\tprice='{$lineItemPriceEach}',\r\n\t\t\t\t\t\t\tcredits_total='{$lineItemCreditsTotal}',\r\n\t\t\t\t\t\t\tcredits='{$lineItemCreditsEach}'\r\n\t\t\t\t\t\t\tWHERE oi_id = '{$cartItem[oi_id]}'\r\n\t\t\t\t\t\t");
     break;
 case "product":
     $productResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT * FROM {$dbinfo[pre]}products \r\n\t\t\t\t\t\t\tWHERE prod_id = '{$cartItem[item_id]}'\r\n\t\t\t\t\t\t\t");
     // Select product here
     $product = mysqli_fetch_assoc($productResult);
     $productDetails = productsList($product, $cartItem['asset_id']);
     $productDetails['cartEditLink'] .= '&edit=' . $cartItem['oi_id'];
     // Add edit var
     if (!$cartItem['paytype']) {
         $cartItem['paytype'] = 'cur';
     }
     // Make sure the payType is set just in case
     $cartItemsArray[$cartItem['oi_id']]['usePayType'] = $cartItem['paytype'];
     // Set the payType to the item
     $cartItemsArray[$cartItem['oi_id']]['payTypeCount'] = 0;
     // Number of options available to pay
     $numOfProducts += $cartItem['quantity'];
     // Count the number of product items in the cart
     /*
      * Currency
      */
Пример #7
0
        	$smarty->assign('featuredPrintsRows',$returnRows);
        	$smarty->assign('featuredPrints',$featuredPrintsArray);
        }
        */
    } catch (Exception $e) {
        die(exceptionError($e));
    }
}
/*
 * Get featured homepage products
 */
if ($config['settings']['hpprods']) {
    try {
        $featuredProductsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}products\r\n\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\tON ({$dbinfo[pre]}products.prod_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'products') \r\n\t\t\t\tWHERE {$dbinfo[pre]}products.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}products.homepage = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}products.deleted = 0\r\n\t\t\t\tAND ({$dbinfo[pre]}products.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\tAND ({$dbinfo[pre]}products.quantity = '' OR {$dbinfo[pre]}products.quantity > '0' OR {$dbinfo[pre]}products.product_type = 1)\r\n\t\t\t\tORDER BY {$dbinfo[pre]}products.sortorder\r\n\t\t\t\t");
        while ($featuredProducts = mysqli_fetch_assoc($featuredProductsResult)) {
            $featuredProductsArray[] = productsList($featuredProducts);
        }
        $smarty->assign('featuredProductsRows', count($featuredProductsArray));
        $smarty->assign('featuredProducts', $featuredProductsArray);
        /*
        if($returnRows = mysqli_num_rows($featuredProductsResult))
        {
        	while($featuredProducts = mysqli_fetch_assoc($featuredProductsResult))
        		$featuredProductsArray[] = productsList($featuredProducts);
        
        	$smarty->assign('featuredProductsRows',$returnRows);
        	$smarty->assign('featuredProducts',$featuredProductsArray);
        }
        */
    } catch (Exception $e) {
        die(exceptionError($e));
Пример #8
0
                 }
             }
         }
     }
 }
 $smarty->assign('prints', $printsArray);
 $smarty->assign('printRows', $printRows);
 /*
  * Products within the package
  */
 $productsResult = mysqli_query($db, "\r\n\t\t\t\t\tSELECT * \r\n\t\t\t\t\tFROM {$dbinfo[pre]}package_items \r\n\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}products \r\n\t\t\t\t\tON {$dbinfo[pre]}package_items.item_id = {$dbinfo[pre]}products.prod_id\r\n\t\t\t\t\tWHERE {$dbinfo[pre]}products.deleted='0' \r\n\t\t\t\t\tAND {$dbinfo[pre]}package_items.pack_id = '{$package[pack_id]}'\r\n\t\t\t\t\tAND {$dbinfo[pre]}package_items.item_type = 'prod'\r\n\t\t\t\t\tORDER BY {$dbinfo[pre]}products.sortorder,{$dbinfo[pre]}products.item_name\r\n\t\t\t\t\t");
 if ($productRows = mysqli_num_rows($productsResult)) {
     //$arrayNum = 1;
     while ($product = mysqli_fetch_array($productsResult)) {
         $arrayNum++;
         $productDetails = productsList($product);
         if ($package['allowoptions']) {
             $tempOptions = getProductOptions('products', $product['prod_id'], $product['taxable']);
         }
         if ($product['groupmult'] == 0) {
             for ($x = 0; $x < $product['iquantity']; $x++) {
                 $productsArray[$arrayNum] = $productDetails;
                 $productsArray[$arrayNum]['options'] = $tempOptions;
                 $productsArray[$arrayNum]['quantityDisplay'] = 1;
                 $productsArray[$arrayNum]['existingMedia'] = $mediaIDs[$arrayNum];
                 /*
                  * If editing this then select the correctly selected items
                  */
                 if ($edit) {
                     if ($productsArray[$arrayNum]['options']) {
                         foreach ($productsArray[$arrayNum]['options'] as $key => $value) {