Example #1
0
function addApplication($arr)
{
    $conn = getConnection();
    $name = $arr['appNme'];
    $desc = str_replace("'", '`', $arr['appDsc']);
    $src = $arr['src'];
    $categoryID = getCategoryID($arr['catOpt']);
    $ioslink = $arr['ioslink'];
    $andlink = $arr['andlink'];
    $sql = "INSERT INTO `apps` (AppName, AppDesc, ImgSrc, CatID)\n        VALUES ('" . $name . "', '" . $desc . "', '" . $src . "', '" . $categoryID . "')";
    $conn->query($sql);
    $appID = getAppID($name);
    $sql = "INSERT INTO `link` (AppID, IOS, Android)\n        VALUES ('" . $appID . "', '" . $ioslink . "', '" . $andlink . "')";
    $ret = $conn->query($sql);
    $conn->close();
    return $ret;
}
Example #2
0
function processFile($path)
{
    $content = file_get_contents($path);
    $lines = explode("\n", $content);
    $header = explode(VALUE_SEPARATOR, $lines[0]);
    //for($i = 0; $i < count($header); $i++)
    //	echo $header[$i] . "<br>";
    //echo $content;
    for ($i = 1; $i < count($lines); $i++) {
        $oneLine = explode(VALUE_SEPARATOR, addslashes($lines[$i]));
        $supplierID = getSupplierID($oneLine[0]);
        $categoryID = getCategoryID($oneLine[1]);
        $producyTypeID = getProductTypeID($oneLine[2]);
        $producyID = getProduct($supplierID, $categoryID, $producyTypeID, $oneLine[3], $oneLine[4], $oneLine[5], $oneLine[6]);
        /*
        echo "$oneLine[0] ($supplierID)<br>";
        echo "$oneLine[1] ($categoryID)<br>";
        echo "$oneLine[2] ($producyTypeID)<br>";
        echo "$oneLine[3] ($producyID)<br>";
        */
    }
    echo "<hr>\n\n";
}
 } else {
     if ($product_name) {
         // if products name is defined add it
         $pid = insertProduct($product_name, $model, $price);
         $referred_cid = array();
         // hold the refereed cid
         $multicats = checkMultiCat($pid);
         $category2 = explode(';', $category);
         for ($c = 0; $c < count($category2); $c++) {
             $catdata = explode('||', $category2[$c]);
             $catdata_id = array();
             for ($s = 0; $s < count($catdata); $s++) {
                 if ($s > 0) {
                     $cid = getCategoryID($catdata[$s], $this->sys_language_uid, $catdata_id[$s - 1]);
                 } else {
                     $cid = getCategoryID($catdata[$s], $this->sys_language_uid);
                 }
                 if (!$cid) {
                     if ($s > 0) {
                         $cid = insertCategory($catdata[$s], $this->shop_pid, $this->sys_language_uid, $catdata_id[$s - 1]);
                     } else {
                         $cid = insertCategory($catdata[$s], $this->shop_pid, $this->sys_language_uid, 0);
                     }
                 }
                 $catdata_id[$s] = $cid;
             }
             if (count($category2) > 1) {
                 productToCategories($pid, $catdata_id[count($catdata_id) - 1]);
                 $referred_cid[] = $catdata_id[count($catdata_id) - 1];
             } else {
                 productToCategories($pid, $catdata_id[count($catdata_id) - 1]);
 function defaultsubcatlevel($catid, $catlevel)
 {
     $lvl2subcats = modApiFunc("Catalog", "getSubCategories", $catid);
     // Checking for subcategories which have level greater than 1
     if ($catlevel > 1) {
         $catname = getCategoryName($catid);
         $catlink = getCategoryLink($catid);
         $value = "";
         $value .= "<li><a href='{$catlink}'><span>" . $catname . "</span></a><div><ul>";
     }
     //Get subcategories for level2 and below
     $count = count($lvl2subcats) - 1;
     while ($count >= 0) {
         $value .= $this->defaultsubcatlevel(getCategoryID($lvl2subcats[$count]["category_id"]), 2);
         $count = $count - 1;
     }
     if ($catlevel > 1) {
         $value .= "</ul></div>";
     }
     return $value;
 }