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); }
// Include the client library require_once 'wp-config.php'; require_once 'wp-includes/wp-db.php'; require_once 'wp-admin/includes/taxonomy.php'; require_once 'wp-load.php'; $aracMarka = 'Honda'; $aracModel = 'City'; $anaGrup = 'Süspansiyon Öndüzen'; $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) {