public static function spreedlyTable() { $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"; } else { $where .= " AND spreedly_subscription_id > 0"; } $iTotal = self::totalRows($indexColumn, $tableName, $where); $iFilteredTotal = self::filteredRows($indexColumn, $tableName, $where); $data = array(); $spreedly = new Cart66Product(); $spreedlys = $spreedly->getSpreedlyProducts($where, $order, $limit); foreach ($spreedlys as $s) { $gfTitles = self::gfData(); if ($s->gravityFormId > 0 && isset($gfTitles) && isset($gfTitles[$s->gravityFormId])) { $gfTitles = '<br/><em>Linked To Gravity Form: ' . $gfTitles[$s->gravityFormId] . '</em>'; } else { $gfTitles = ''; } $data[] = array($s->id, $s->item_number, $s->name . $gfTitles, $s->getPriceDescription(), $s->taxable ? ' Yes' : 'No', $s->shipped ? ' Yes' : 'No'); } $array = array('sEcho' => $_GET['sEcho'], 'iTotalRecords' => $iTotal[0], 'iTotalDisplayRecords' => $iFilteredTotal[0], 'aaData' => $data); echo json_encode($array); die; }
$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 } ?>