Skip to content

Commit

Permalink
update meta fields using addCategory function
Browse files Browse the repository at this point in the history
  • Loading branch information
shreesh-webkul committed Oct 3, 2024
1 parent c55dea1 commit 1dfcebe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public function update($null_values = false)
return $return;
}

public function addCategory($name, $parent_cat = false, $group_ids, $ishotel = false, $idHotel = false, $link_rewrite = false)
public function addCategory($name, $parent_cat = false, $group_ids, $ishotel = false, $idHotel = false, $link_rewrite = false, $meta_title = false, $meta_description = false, $meta_keywords = false)
{
$context = Context::getContext();
if (!$parent_cat) {
Expand Down Expand Up @@ -700,6 +700,15 @@ public function addCategory($name, $parent_cat = false, $group_ids, $ishotel = f
}
$category->id_parent = $parent_cat;
$category->groupBox = $group_ids;
if ($meta_title) {
$category->meta_title = $meta_title;
}
if ($meta_description) {
$category->meta_description = $meta_description;
}
if ($meta_keywords) {
$category->meta_keywords = $meta_keywords;
}
$category->add();
return $category->id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,18 +688,19 @@ public function processSave()
Category::regenerateEntireNtree();
} else {
if ($catHotel = $objHotelBranch->addCategory(
$hotelCatName, $catCity, $groupIds, 1, $newIdHotel, $linkRewriteArray
$hotelCatName,
$catCity,
$groupIds,
1,
$newIdHotel,
$linkRewriteArray,
$metaTitleArray,
$metaDescriptionArray,
$metaKeywordsArray
)) {
$objHotelBranch = new HotelBranchInformation($newIdHotel);
$objHotelBranch->id_category = $catHotel;
$objHotelBranch->save();

$objCategory = new Category($catHotel);
$objCategory->meta_title = $metaTitleArray;
$objCategory->meta_description = $metaDescriptionArray;
$objCategory->meta_keywords = $metaKeywordsArray;
$objCategory->save();

}
}
}
Expand Down

0 comments on commit 1dfcebe

Please sign in to comment.