public static function productsTable() { $columns = array('id', 'item_number', 'name', 'price', 'taxable', 'shipped'); $indexColumn = "id"; $tableName = Cart66Common::getTableName('products'); $where = self::dataTablesWhere($columns); $limit = self::dataTablesLimit() == '' ? null : self::dataTablesLimit(); $order = self::dataTablesOrder($columns); if ($where == null) { $where = "where spreedly_subscription_id = 0 and is_paypal_subscription = 0"; } else { $where .= " AND spreedly_subscription_id = 0 AND is_paypal_subscription = 0"; } $iTotal = self::totalRows($indexColumn, $tableName, $where); $iFilteredTotal = self::filteredRows($indexColumn, $tableName, $where); $data = array(); $product = new Cart66Product(); $products = $product->getNonSubscriptionProducts($where, $order, $limit); foreach ($products as $p) { $gfTitles = self::gfData(); if ($p->gravityFormId > 0 && isset($gfTitles) && isset($gfTitles[$p->gravityFormId])) { $gfTitles = '<br/><em>Linked To Gravity Form: ' . $gfTitles[$p->gravityFormId] . '</em>'; } else { $gfTitles = ''; } $data[] = array($p->id, $p->item_number, $p->name . $gfTitles, Cart66Common::currency($p->price), $p->taxable ? ' Yes' : 'No', $p->shipped ? ' Yes' : 'No'); } $array = array('sEcho' => $_GET['sEcho'], 'iTotalRecords' => $iTotal[0], 'iTotalDisplayRecords' => $iFilteredTotal[0], 'aaData' => $data); echo json_encode($array); die; }
$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 if ($errorMessage) { ?> <div style="margin: 30px 50px 10px 5px;"><?php echo $errorMessage; ?> </div> <?php } ?>