Skip to content

Commit

Permalink
#148 [RegistrationCertificate] add: create product brand if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-theo committed Mar 31, 2023
1 parent c25cf6e commit a3dc068
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@
$productId = $product->create($user);

if ($productId > 0) {
$category->fetch(0, $registrationCertificateObject->CarMake->CurrentTextValue);
$product->setCategories(array($category->id, $conf->global->DOLICAR_CAR_BRANDS_TAG));
$resultCategory = $category->fetch(0, $registrationCertificateObject->CarMake->CurrentTextValue);

if ($category <= 0) {
$category->label = $registrationCertificateObject->CarMake->CurrentTextValue;
$category->description = $registrationCertificateObject->CarMake->CurrentTextValue;
$category->visible = 1;
$category->type = 'product';
$category->fk_parent = $conf->global->DOLICAR_CAR_BRANDS_TAG;
$categoryID = $category->create($user);
} else {
$categoryID = $category->id;
}

$product->setCategories(array($categoryID, $conf->global->DOLICAR_CAR_BRANDS_TAG));
} else {
$error++;
}
Expand Down

0 comments on commit a3dc068

Please sign in to comment.