function generateKeywords($product_id)
{
    use_class('styles');
    use_class('Product');
    use_class('ProductAttribute');
    $class_s = new styles();
    $keywords = array();
    $product = new Product($product_id);
    $language_id = 2;
    //Step 1 (Brand)
    if ($product->brand_id == 24) {
        $keywords = array(strtolower($product->brand_name), 'eli', 'silberschmuck', '925', 'junger', 'modischer', 'trendy', 'fashion');
    } elseif ($product->brand_id == 3) {
        $keywords = array(strtolower($product->brand_name), 'vergoldet', 'golden', 'gold', 'vermeil');
    } elseif ($product->brand_id == 7) {
        $keywords = array(strtolower($product->brand_name), 'perlenschmuck', 'brautschmuck', 'hochzeit');
    }
    //Step 2 (Symbol)
    $symbol = $class_s->getProductStyle($product_id);
    if ($symbol['Symbol'] > 0) {
        $style = new ProductAttribute($symbol['Symbol']);
        if ($symbol['Symbol'] != '') {
            array_push($keywords, strtolower($style->displayAttributeName($product_id, ProductAttribute::GROUP_ID_SYMBOL, $language_id)));
        }
    }
    //Step 3 (Basic)
    array_push($keywords, 'günstiger', 'frau', 'freundin', 'geschenk', 'juwelier');
    //Step 4 (Material)
    $materials = array();
    $q = "SELECT ptpm.products_materials_id AS id" . " , material_name AS name" . " FROM products_to_products_materials ptpm" . " INNER JOIN products_materials pm" . " ON pm.products_materials_id = ptpm.products_materials_id" . " WHERE ptpm.products_id = {$product_id}";
    $r = tep_db_query($q);
    while ($row = tep_db_fetch_array($r)) {
        $materials[$row['id']] = $row['name'];
    }
    foreach ($materials as $key => $value) {
        if ($key == 4 || $key == 2) {
            list($material_name2, $material_name1, $material_name3) = split(",", $value);
            array_push($keywords, strtolower($material_name2), 'glamourös', 'funkelnd', 'glitzernd', 'strass', 'festlich', 'elegant');
        } else {
            list($material_name2, $material_name1, $material_name3) = split(",", $value);
            array_push($keywords, strtolower($material_name2));
        }
    }
    //Step 5 (Color)
    $color = $product->getColors($language_id);
    array_push($keywords, strtolower($color));
    //Step 6 (Rest of the products)
    array_push($keywords, 'basic', 'klassik', 'klassisch', 'schlicht', 'elegant', 'zeitlos', 'sportlich', 'dezent', 'filigran', 'zart', 'schlicht');
    $final_k = implode(',', $keywords);
    //echo $pid." = ".$final_k;
    $sda = array();
    $sda['products_head_keywords_tag'] = $final_k;
    tep_db_perform('products_description', $sda, 'update', "products_id={$product_id} AND language_id={$language_id}");
}
     $row[] = '';
 } else {
     $row[] = date('Y-m-d');
 }
 //SaleEndDate
 if ($price_old <= $price) {
     $row[] = '';
 } else {
     $row[] = LAZADA_ZALORA_DEFAULT_SALE_END_DATE;
 }
 //Name
 if ($jng_sp_id == '1001') {
     if ($category_top_id == '1') {
         if ($category_id == '29') {
             if ($a['length'] > 4.6 && $a['length'] < 6.0) {
                 $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid);
             }
         } else {
             $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid);
         }
     } else {
         $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $p->getName($lid) . ' ' . $p->getColors($lid);
     }
 } else {
     if ($category_top_id == '1') {
         if ($category_id == '29') {
             if ($a['length'] > 4.6 && $a['length'] < 6.0) {
                 $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid);
             }
         } else {
             $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid);
/**
 * Get cell value for Matahari catalog cell
 * @global Int $jng_sp_id
 * @global Array $sp_detail
 * @param String $column_key
 * @param Product $product
 * @param Int $aid
 * @return String
 */
function getMatahariCatalogCellValue($column_key, $product, $aid)
{
    global $class_pb, $jng_sp_id, $sp_detail, $sp_values_brand, $sp_values_colors, $sp_values_navcat, $sp_values_navsubcat, $category_top_id;
    $lid = $sp_detail['languages_id'];
    if (!isset($sp_values_brand[$product->brand_id])) {
        $sp_brands = $class_pb->getSPbrands($product->brand_id);
        $sp_values_brand[$product->brand_id] = $sp_brands[$jng_sp_id];
    }
    $product_old_function = $product->getOldProductFunction()->retrieveDetail($product->id, 'p,pd,pd2,pc,pnc,cat,pei,pci');
    if ($category_top_id == '1') {
        if ($product_old_function['pci']['products_clear_image'] != '') {
            $main_image = substr($product_old_function['pci']['products_clear_image'], 23);
        } else {
            $main_image = substr($product_old_function['p']['products_image'], 23);
        }
    } else {
        $main_image = substr($product_old_function['p']['products_image'], 23);
    }
    $additional_images = array_values($product_old_function['pei']);
    $category_id = $product->category_id;
    $selling_points = $product->getSellingPointsAsArray($lid);
    switch ($column_key) {
        case 'Title*':
            if ($category_top_id == '1') {
                //JEWELRY
                $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid);
                //                $value = 'VON LORENZ' . ' ' .
                //                    $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid);
            } else {
                $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product->getName($lid) . ' ' . $product->getColors($lid);
            }
            break;
        case 'Brand':
            $value = $sp_values_brand[$product->brand_id];
            //            $value = 'VON LORENZ';
            break;
        case 'Model':
            $value = '';
            break;
        case 'Color*':
            $value = $product->getColors($lid);
            break;
        case 'Sale Price (Amount)*':
            $price = $product->getPriceSelling($jng_sp_id);
            $price_old = $product->getPriceSellingOld($jng_sp_id);
            if ($price_old <= $price) {
                //show blank if its not discounted
                $price = '';
            }
            $value = $price;
            break;
        case 'Price (Amount)*':
            $price = $product->getPriceSelling($jng_sp_id);
            $price_old = $product->getPriceSellingOld($jng_sp_id);
            if ($price_old <= $price) {
                $price_old = $price;
            }
            $value = $price_old;
            break;
        case 'SKU*':
            $value = $product->getSKU($aid);
            break;
        case 'Size':
            //todo: translate ring sizes
            if ($category_top_id == '1') {
                if ($category_id == '29') {
                    $value = $product->convertRingSizeToJapaneseSize($product->getLengthOrSizeAsText($aid));
                } else {
                    $value = 'One Size';
                }
            } else {
                $value = $product->getLengthOrSizeAsText($aid);
            }
            break;
        case 'Model Number':
            $value = $product->getEAN($aid);
            break;
        case 'Stock':
            $value = $product->retrieveStockQuantity($aid);
            break;
        case 'Product Line':
            $value = 'Wanita';
            break;
        case 'Normal Price (Amount)*':
            $value = $product->getPriceDefault();
            break;
        case 'Normal Price (Currency)*':
            $value = 'IDR';
            break;
        case 'Main Material':
            $value = '';
            break;
        case 'Description*':
            $value = $product->getDescription($lid);
            break;
        case 'Youtube URL':
            $value = '';
            break;
        case 'Highlight 1':
            $value = $selling_points[0];
            break;
        case 'Highlight 2':
            $value = $selling_points[1];
            break;
        case 'Highlight 3':
            $value = $selling_points[2];
            break;
        case 'Highlight 4':
            $value = $selling_points[3];
            break;
        case 'Highlight 5':
            $value = $selling_points[4];
            break;
        case 'Highlight 6':
            $value = '';
            break;
        case 'Highlight 7':
            $value = '';
            break;
        case 'Highlight 8':
            $value = '';
            break;
        case 'Highlight 9':
            $value = '';
            break;
        case 'Highlight 10':
            $value = '';
            break;
        case 'Highlight 11':
            $value = '';
            break;
        case 'Highlight 12':
            $value = '';
            break;
        case 'Insurance option':
            $value = '1';
            break;
        case 'Handling fee (IDR)':
            $value = '0';
            break;
        case 'Product Dimension':
            //Measurements is from Zalora Template
            $value = $product->displayMeasurement($lid);
            break;
        case 'Product Weight':
            $value = $product->displayWeight($lid);
            break;
        case 'Package Dimension (L x W x H cm)':
            //todo: use dynamic data
            $value = '40 x 35 x 3 cm';
            break;
        case 'Certification':
            $value = '';
            break;
        case 'Product Country':
            $value = ProductAttribute::displayAttributeName($product->id, ProductAttribute::GROUP_ID_ORIGIN, $lid);
            break;
        case 'Item Condition*':
            $value = 'new';
            break;
        case 'Product Waranty':
            $value = '';
            break;
        case 'Image 1*':
            //Currently Kristel will copy the link to this field manually.
            $value = $main_image;
            break;
        case 'Image 2':
            $value = $additional_images[0] == '' ? '' : substr($additional_images[0], 23);
            break;
        case 'Image 3':
            $value = $additional_images[1] == '' ? '' : substr($additional_images[1], 23);
            break;
        case 'Image 4':
            $value = $additional_images[2] == '' ? '' : substr($additional_images[2], 23);
            break;
        case 'Image 5':
            $value = $additional_images[3] == '' ? '' : substr($additional_images[3], 23);
            break;
        case 'Product Line':
            $value = ucfirst($product->getProductGender('1'));
            break;
        case 'Price (Currency)*':
            $value = 'IDR';
            break;
        case 'Type':
            $value = '';
            break;
        case 'Package Weight (Kg)':
            $value = 0.4;
            break;
        case 'product_id(MUST BE DELETED BEFORE UPLOAD)':
            $value = $product->id;
            break;
        default:
            $value = '';
    }
    return $value;
}