Esempio n. 1
0
function createProductCategory($aracMarka, $aracModel, $anaGrup, $altGrup)
{
    // get category informations
    $aracModelId = getChildDetails(0, $aracModel, $main = 1);
    $anaGrupId = getChildDetails($aracModelId, $anaGrup);
    $altGrupId = getChildDetails($anaGrupId, $altGrup);
    if ($aracModelId < 1) {
        $aracModelId = modelCreate(null, $aracMarka, $aracModel);
        echo "{$aracModel} created (category)\n";
    }
    if ($anaGrupId < 1) {
        $anaGrupId = anaGrupCreate($aracModelId, $aracMarka, $aracModel, $anaGrup);
        echo "{$anaGrup} created (category)\n";
    }
    if ($altGrupId < 1) {
        $altGrupId = altGrupCreate($anaGrupId, $aracMarka, $aracModel, $anaGrup, $altGrup);
        echo "{$altGrup} created (category)\n";
    }
    return array("model" => $aracModelId, "ana_grup" => $anaGrupId, "alt_grup" => $altGrupId);
}
Esempio n. 2
0
$altGrup = 'Helezon Yayı';
//print_r(wp_list_categories('product_cat'));
echo "<pre>";
//print_r($catId=categoryExist('Mazda', $parent, $parameters));
//$aracCatId = getChildDetails(0, $aracMarka);
$aracModelId = getChildDetails(0, $aracModel, $main = 1);
$anaGrupId = getChildDetails($aracModelId, $anaGrup);
$altGrupId = getChildDetails($anaGrupId, $altGrup);
/*
 if ($aracCatId < 1) {
    $aracCatId = markaCreate(0, $aracMarka);
    echo "$aracMarka created (category)\n";
}
*/
if ($aracModelId < 1) {
    $aracModelId = modelCreate($aracCatId, $aracMarka, $aracModel);
    echo "{$aracModel} created (category)\n";
}
if ($anaGrupId < 1) {
    $anaGrupId = anaGrupCreate($aracModelId, $aracMarka, $aracModel, $anaGrup);
    echo "{$anaGrup} created (category)\n";
}
if ($altGrupId < 1) {
    $altGrupId = altGrupCreate($anaGrupId, $aracMarka, $aracModel, $anaGrup, $altGrup);
    echo "{$altGrup} created (category)\n";
}
function markaCreate($parent_term_id, $aracMarka)
{
    $parent_term = wp_insert_term($aracMarka, 'product_cat', array('description' => $aracMarka . ' Yedek Parçalarına uygun fiyata erişebileceğiniz tek site - http://' . strtolower($aracMarka) . '.yedekleri.com', 'slug' => convert2Turkish("{$aracMarka}-yedek-parcalari"), 'parent' => $parent_term_id));
    return $parent_term['term_id'];
}