PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | app/Services/ActivityService.php +18 -23 3.0.3 → 3.0.16 View file →
@@ -4,8 +4,9 @@
4 4
5 5 namespace Yatra\Services;
6 6
7 7 use Yatra\Repositories\ActivityRepository;
8 +use Yatra\Helpers\ClassificationLandingPageMetadata;
8 9 use Yatra\Helpers\SlugHelper;
9 10 use Yatra\Helpers\FormatHelper;
10 11 use Yatra\Database\Tables\ClassificationsTable;
11 12
@@ -71,9 +72,9 @@
71 72 // Always auto-generate slug from name (backend ensures uniqueness)
72 73 if (!empty($data['name'])) {
73 74 $data['slug'] = SlugHelper::generateUniqueFromDatabase(
74 75 $data['name'],
75 - 'yatra_new_classifications',
76 + 'yatra_classifications',
76 77 'slug'
77 78 );
78 79 } elseif (isset($data['slug'])) {
79 80 // If name is empty but slug is provided, sanitize it
@@ -130,16 +131,14 @@
130 131 }
131 132
132 133 // Handle SEO metadata
133 134 if (isset($data['seo_title']) || isset($data['seo_description']) || isset($data['seo_keywords'])) {
134 -
135 - $existing_metadata = [];
136 - if (isset($data['metadata']) && is_array($data['metadata'])) {
137 - $existing_metadata = $data['metadata'];
138 - } elseif (isset($data['metadata'])) {
139 - $existing_metadata = maybe_unserialize($data['metadata']);
140 - }
141 -
135 + $existing_metadata = ClassificationLandingPageMetadata::baseMetadataMergedWithRequest(
136 + null,
137 + $this->repository,
138 + $data
139 + );
140 +
142 141 // Add SEO fields to metadata
143 142 if (isset($data['seo_title'])) {
144 143 $existing_metadata['seo_title'] = sanitize_text_field($data['seo_title']);
145 144 unset($data['seo_title']); // Remove from main data
@@ -155,8 +154,10 @@
155 154
156 155 $data['metadata'] = $existing_metadata;
157 156 }
158 157
158 + ClassificationLandingPageMetadata::mergeLandingPageIntoData($data, null, $this->repository);
159 +
159 160 return $data;
160 161 }
161 162
162 163 /**
@@ -231,22 +232,14 @@
231 232 }
232 233
233 234 // Handle SEO metadata
234 235 if (isset($data['seo_title']) || isset($data['seo_description']) || isset($data['seo_keywords'])) {
235 - // Get existing metadata
236 - $existing_metadata = [];
237 - if (isset($data['metadata']) && is_array($data['metadata'])) {
238 - $existing_metadata = $data['metadata'];
239 - } elseif (isset($data['metadata'])) {
240 - $existing_metadata = maybe_unserialize($data['metadata']);
241 - } else {
242 - // Get existing metadata from database
243 - $existing = $this->repository->find($id);
244 - if ($existing && isset($existing->metadata)) {
245 - $existing_metadata = maybe_unserialize($existing->metadata);
246 - }
247 - }
248 -
236 + $existing_metadata = ClassificationLandingPageMetadata::baseMetadataMergedWithRequest(
237 + $id,
238 + $this->repository,
239 + $data
240 + );
241 +
249 242 // Add/update SEO fields in metadata
250 243 if (isset($data['seo_title'])) {
251 244 $existing_metadata['seo_title'] = sanitize_text_field($data['seo_title']);
252 245 unset($data['seo_title']); // Remove from main data
@@ -261,8 +254,10 @@
261 254 }
262 255
263 256 $data['metadata'] = $existing_metadata;
264 257 }
258 +
259 + ClassificationLandingPageMetadata::mergeLandingPageIntoData($data, $id, $this->repository);
265 260
266 261 return $data;
267 262 }
268 263