select($query); if($results==TRUE) { $googleBaseContent = "product_url\tname\tdescription\timage_url\tprice\r\n"; for($i=0; $i 0){ $price = $salePrice; } else { $price = $results[$i]['price']; } $name = str_replace(array(" ","\t","\r","\n","\0","\x0B"," "),"",strip_tags($results[$i]['name'])); $name = str_replace(" ","",$name); $desc = str_replace(array(" ","\t","\r","\n","\0","\x0B"," "),"",strip_tags($results[$i]['description'])); $desc = str_replace(" ","",$desc); $googleBaseContent .= $glob['storeURL']."/index.php?act=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc; if($results[$i]['image']){ $googleBaseContent .= "\t".$glob['storeURL']."/images/uploads/".$results[$i]['image']; } else { $googleBaseContent .= "\t".$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif"; } $googleBaseContent .= "\t".$price."\r\n"; } $filename = "GoogleBaseFeed_"; $contentLength = strlen($googleBaseContent); $content = $googleBaseContent; $filename .= date("dMy").".txt"; header('Pragma: private'); header('Cache-control: private, must-revalidate'); header("Content-Disposition: attachment; filename=".$filename); header("Content-type: text/plain"); header("Content-type: application/octet-stream"); header("Content-length: ".$contentLength); header("Content-Transfer-Encoding: binary"); echo $content; exit; } } elseif(isset($_GET['delete']) && $_GET["delete"]>0){ // delete product $where = "productId=".$db->mySQLSafe($_GET["delete"]); $delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where); // set categories -1 $cats = $db->select("SELECT cat_id FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$db->mySQLSafe($_GET["delete"])); if($cats==TRUE){ for($i=0;$icategoryNos($cats[$i]['cat_id'], "-"); } } // delete category index $where = "productId=".$db->mySQLSafe($_GET["delete"]); $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); unset($record); // delete product options $record['product'] = $db->mySQLSafe($_GET["delete"]); $where = "product=".$db->mySQLSafe($_GET["delete"]); $deleteOps = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); unset($record); if($delete == TRUE){ $msg = "

".$lang['admin']['products']['delete_success']."

"; } else { $msg = "

".$lang['admin']['products']['delete_fail']."

"; } } elseif(isset($_POST['productId'])) { // generate product code if(empty($_POST['productCode'])){ $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", "4","5","6","7","8","9","0"); $max_chars = count($chars) - 1; srand((double)microtime()*1000000); for($i = 0; $i < 5; $i++){ $randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; } $record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']); } else { $record["productCode"] = $db->mySQLSafe($_POST['productCode']); } $record["name"] = $db->mySQLSafe($_POST['name']); $record["cat_id"] = $db->mySQLSafe($_POST['cat_id']); $record["description"] = $db->mySQLSafe($_POST['description']); $record["image"] = $db->mySQLSafe($_POST['imageName']); $record["price"] = $db->mySQLSafe($_POST['price']); $record["sale_price"] = $db->mySQLSafe($_POST['sale_price']); $record["stock_level"] = $db->mySQLSafe($_POST['stock_level']); $record["useStockLevel"] = $db->mySQLSafe($_POST['useStockLevel']); $record["digital"] = $db->mySQLSafe($_POST['digital']); $record["digitalDir"] = $db->mySQLSafe($_POST['digitalDir']); $record["prodWeight"] = $db->mySQLSafe($_POST['prodWeight']); $record["taxType"] = $db->mySQLSafe($_POST['taxType']); $record["showFeatured"] = $db->mySQLSafe($_POST['showFeatured']); // if image is a JPG check thumbnail doesn't exist and if not make one $imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName'])); if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){ if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'])){ @chmod($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'], 0775); unlink($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); } $thumb=new thumbnail($GLOBALS['rootDir']."/images/uploads/".$_POST['imageName']); $thumb->size_auto($config['gdthumbSize']); $thumb->jpeg_quality($config['gdquality']); $thumb->save($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); } if(isset($_POST['productId']) && $_POST['productId']>0) { $where = "productId=".$db->mySQLSafe($_POST['productId']); $update = $db->update($glob['dbprefix']."CubeCart_inventory", $record, $where); unset($record, $where); // update category count if($_POST['oldCatId']!==$_POST['cat_id']){ // set old category -1 IF IT WAS IN THERE BEFORE $numOldCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['oldCatId'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); if($numOldCat>0){ $db->categoryNos($_POST['oldCatId'], "-"); } // set new category +1 IF IT WAS NOT IN THERE BEFORE $numNewCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['cat_id'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); if($numNewCat == 0) { $db->categoryNos($_POST['cat_id'], "+"); } // delete old idx $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['oldCatId']); $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); unset($record); // delete new index if it was added as an extra before $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['cat_id']); $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); unset($record); // add new idx $record['productId'] = $db->mySQLSafe($_POST['productId']); $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); unset($record); } if($update == TRUE){ $msg = "

'".$_POST['name']."' ".$lang['admin']['products']['update_successful']."

"; } else { $msg = "

".$lang['admin']['products']['update_fail']."

"; } } else { $insert = $db->insert($glob['dbprefix']."CubeCart_inventory", $record); unset($record); $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); $record['productId'] = $db->insertid(); $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); unset($record); if($insert == TRUE){ $msg = "

'".$_POST['name']."' ".$lang['admin']['products']['add_success']."

"; // notch up amount of products in category $db->categoryNos($_POST['cat_id'], "+"); } else { $msg = "

".$lang['admin']['products']['add_fail']."

"; } } } if(!isset($_GET['mode'])){ // make sql query if(isset($_GET['edit']) && $_GET['edit']>0){ $query = sprintf("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productId = %s", $db->mySQLSafe($_GET['edit'])); } else { if(isset($_GET['orderCol']) && isset($_GET['orderDir'])){ $orderBy = $glob['dbprefix']."CubeCart_inventory.".$_GET['orderCol']." ".$_GET['orderDir']; } else { $orderBy = $glob['dbprefix']."CubeCart_inventory.productId ASC"; } $whereClause = ""; if(isset($_GET['searchStr']) && !empty($_GET['searchStr'])){ $searchwords = split ( "[ ,]", $_GET['searchStr']); foreach($searchwords as $word){ $searchArray[]=$word; } $noKeys = count($searchArray); for ($i=0; $i<$noKeys;$i++) { $ucSearchTerm = strtoupper($searchArray[$i]); if(($ucSearchTerm!=="AND")AND($ucSearchTerm!=="OR")){ $like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') OR "; } else { $like = substr($like,0,strlen($like)-3); $like .= $ucSearchTerm; } } $like = substr($like,0,strlen($like)-3); $whereClause .= "WHERE ".$like; } if(isset($_GET['category']) && $_GET['category']>0){ if(isset($like)){ $whereClause .= " AND "; } else { $whereClause .= " WHERE "; } $whereClause .= $glob['dbprefix']."CubeCart_inventory.cat_id = ".$_GET['category']; } $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY ".$orderBy; } // query database if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 0; } $results = $db->select($query, $productsPerPage, $page); $numrows = $db->numrows($query); $pagination = $db->paginate($numrows, $productsPerPage, $page, "page"); } $query = "SELECT cat_id, cat_name, cat_father_id FROM ".$glob['dbprefix']."CubeCart_category ORDER BY cat_id DESC"; $categoryArray = $db->select($query); include("../includes/header.inc.php"); ?>

href="?mode=new" class="txtLink" >
Download Google Base Product Feed

by in


onclick="openPopUp('admin/products/extraCats.php?productId=&cat_id=&cat_father_id=&cat_name=&name=','extraCats',500,450,1);" class="txtLink">
<?php echo $results[$i]['name']; ?>49){ ?>height="50" />
href="?edit=" class="txtLink"> href="javascript:decision('','?delete=&cat_id=');" class="txtLink"> href="languages.php?prod_master_id=" class="txtLink">

0 && permission("products","edit")==TRUE)){ if(isset($_GET["edit"]) && $_GET["edit"]>0){ $modeTxt = $lang['admin']['edit']; } else { $modeTxt = $lang['admin']['add']; } ?>

0){ echo $modeTxt; } else { echo $modeTxt; } echo $lang['admin']['products']['product'];?>

BasePath = $GLOBALS['rootRel'].'admin/includes/rte/' ; if(isset($results[0]['description'])){ $oFCKeditor->Value = $results[0]['description']; } else { $oFCKeditor->Value = ""; } $oFCKeditor->Create(); ?>

" alt="" title="" />


/> />
/> /> class="hiddenTextbox" />
  0){ echo $modeTxt; } else { echo $modeTxt; } ?> " />