PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / database / Seeder / ProductNameProvide.php

ProductNameProvide.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at database/Seeder/ProductNameProvide.php

527 lines 17.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\Database\Seeder;
4
5 use FluentCart\Faker\Provider\Base;
6 use FluentCart\Framework\Support\Arr;
7
8 class ProductNameProvide extends Base
9 {
10 public static function generateClothName(): string
11 {
12 $adjectives = array('Gorgeous', '', '', 'Elegant', '', '', 'Wonderful', '', '', 'Glittery', '', '', 'Dazzling');
13 $colors = array('Green', 'Blue', 'Red', 'Violet', 'White', 'Black', 'Purple');
14 $names = array('Jacket', 'Shorts', 'Coat', 'Jeans', 'Shirt', 'Suit', 'Polo shirt', 'Hoodie', 'Pant', 'Sweater', 'Dress');
15 $adjectives = $adjectives[array_rand($adjectives)];
16 $colors = $colors[array_rand($colors)];
17 $names = $names[array_rand($names)];
18
19 return $adjectives . ' ' . $colors . ' ' . $names;
20 }
21
22 public function generateTvName(): string
23 {
24 $brands = array('Samsung', 'Xiaomi', 'Lg', 'Sony', 'Toshiba', 'Panasonic', 'Philips',);
25 $size = array('16 inch', '20 inch', '24inch', '32inch', '32inch', '49inch', '55inch',);
26
27 $brands = $brands[array_rand($brands)];
28 $size = $size[array_rand($size)];
29
30 return $brands . ' ' . $size . ' Tv';
31 }
32
33 public static function generateMobileName(): string
34 {
35 $mobileBrands = ['Nokia', 'Samsung', 'Iphone', 'Oppo', 'Vivo', 'Xiaomi', 'Realme', 'OnePlus', 'Tecno'];
36
37 $modelPrefix = ['N', '', '', 'V', '', '', 'Razor'];
38 $modelSuffix = ['V', '', '', 'T', '', 'M'];
39
40 $variants = ['128gb', '', '256gb', '', '512gb', '',];
41
42
43 $name = $mobileBrands[array_rand($mobileBrands)];
44
45 if ($name === 'Iphone') {
46 $iphoneSuffix = ['Max', 'Pro', 'Pro Max', 'Max Pro'];
47 $name .= ' ' . wp_rand(7, 15) . ' ' . $iphoneSuffix[array_rand($iphoneSuffix)];
48 } else if ($name === 'Samsung') {
49 $samsungPrefix = ['Z Flip', 'Z Fold', 'Note', 'Galaxy'];
50 $samsungSuffix = ['Ultra', ''];
51 $samsungNumberSuffix = ['A', 'S', 'M'];
52 $name .= ' ' . $samsungPrefix[array_rand($samsungPrefix)] . ' ' . $samsungNumberSuffix[array_rand($samsungNumberSuffix)] . wp_rand(8, 30) . ' ' . $samsungSuffix[array_rand($samsungSuffix)];
53 } else {
54
55 $prefix = $modelPrefix[array_rand($modelPrefix)];
56
57 $suffix = '';
58
59 if (empty($prefix)) {
60 $suffix = $modelSuffix[array_rand($modelSuffix)];
61 }
62
63
64 $name .= ' ' . $prefix . wp_rand(10, 50) . $suffix;
65 }
66
67 return trim($name . ' ' . $variants[array_rand($variants)]);
68
69 }
70
71 public static function generateFoodName(): string
72 {
73 $productNames = array(
74 "Pizza",
75 "Burger",
76 "Spaghetti Carbonara",
77 "Chicken Tikka Masala",
78 "Sushi",
79 "Ice Cream",
80 "Chocolate Chip Cookies",
81 "Caesar Salad",
82 "Tacos",
83 "Pancakes",
84 "Steak",
85 "Pad Thai",
86 "Lasagna",
87 "Chicken Alfredo",
88 "Ramen",
89 "Chicken Noodle Soup",
90 "Fried Chicken",
91 "Apple Pie",
92 "Chocolate Brownies",
93 "Cupcakes",
94 "Macaroni and Cheese",
95 "Fish and Chips",
96 "Mango Lassi",
97 "Fajitas",
98 "Hamburger",
99 "Pho",
100 "Chicken Parmesan",
101 "Cheesecake",
102 "Mashed Potatoes",
103 "Gelato",
104 "Hot Dog",
105 "Guacamole",
106 "Churros",
107 "Falafel",
108 "Shrimp Scampi",
109 "Pumpkin Pie",
110 "Cannoli",
111 "Hummus",
112 "Croissant",
113 "Clam Chowder",
114 "Nachos",
115 "Creme Brulee",
116 "Beef Stroganoff",
117 "Key Lime Pie",
118 "Garlic Bread",
119 "Baklava",
120 "Chicken Satay",
121 "Poutine",
122 "Biscuits and Gravy",
123 "Samosa",
124 "Crème Caramel",
125 "Fried Rice",
126 "Shawarma",
127 "Tom Yum",
128 "Miso Soup",
129 "Gyoza",
130 "Spanakopita",
131 "Spring Rolls",
132 "Tiramisu",
133 "Cuban Sandwich",
134 "Pierogi",
135 "Baklava",
136 "Peking Duck",
137 "Croque Madame",
138 "Goulash",
139 "Pani Puri",
140 "Peking Duck",
141 "Crab Rangoon",
142 "Baba Ganoush",
143 "Chimichanga",
144 "Red Velvet Cake",
145 "Ceviche",
146 "Fish Tacos",
147 "Gazpacho",
148 "Pavlova",
149 "Chicken Shawarma",
150 "Lobster Bisque",
151 "Borscht",
152 "Jambalaya",
153 "Ratatouille",
154 "Tandoori Chicken",
155 "Banana Bread",
156 "Chicken Adobo",
157 "Tempura",
158 "Croque Monsieur",
159 "Scones",
160 "Kimchi",
161 "Escargot",
162 "Naan Bread",
163 "Chicken Katsu",
164 "Pierogi",
165 "Chiles En Nogada",
166 "Challah",
167 "Pecan Pie",
168 "Risotto",
169 "Chicken Souvlaki",
170 "Bakewell Tart",
171 "Tarte Tatin",
172 "Shrimp and Grits",
173 "Cassoulet",
174 "Welsh Rarebit",
175 "Moussaka",
176 "Bouillabaisse",
177 "Lamb Tagine",
178 "Blini",
179 "Borscht",
180 "Tzatziki",
181 "Coleslaw",
182 "Pav Bhaji",
183 "Biryani",
184 "Scotch Egg",
185 "Vindaloo",
186 "Tom Kha Gai",
187 );
188
189 return $productNames[array_rand($productNames)];
190 }
191
192 public static function generateElectronicProductName(): string
193 {
194 $productNames = [
195 "iPhone 13",
196 "Samsung Galaxy S21",
197 "Sony PlayStation 5",
198 "Dell XPS 13",
199 "Apple MacBook Pro",
200 "LG OLED TV",
201 "Canon EOS R5",
202 "Nintendo Switch",
203 "Bose QuietComfort 35 II",
204 "Amazon Echo Dot",
205 "Microsoft Surface Laptop",
206 "Fitbit Charge 4",
207 "HP Spectre x360",
208 "Sony WH-1000XM4",
209 "GoPro HERO9 Black",
210 "Samsung QLED TV",
211 "Xbox Series X",
212 "DJI Mavic Air 2",
213 "Bose SoundLink Revolve",
214 "Apple Watch Series 7",
215 "Nikon Z6",
216 "Sony A7 III",
217 "LG NanoCell TV",
218 "Google Pixel 6",
219 "Microsoft Xbox Elite Controller",
220 "Razer BlackWidow V3",
221 "Amazon Kindle Oasis",
222 "Sonos One",
223 "NVIDIA GeForce RTX 3080",
224 "Panasonic Lumix GH5",
225 "Apple AirPods Pro",
226 "Sony Xperia 1 III",
227 "Lenovo ThinkPad X1 Carbon",
228 "Xiaomi Mi 11",
229 "Canon EOS Rebel T8i",
230 "Logitech MX Master 3",
231 "Fitbit Versa 3",
232 "Huawei MateBook X Pro",
233 "Garmin Forerunner 945",
234 "Samsung Galaxy Tab S7",
235 "JBL Flip 5",
236 "ASUS ROG Strix G15",
237 "Beats Studio Buds",
238 "LG UltraGear Monitor",
239 "Dell Alienware M15 R6",
240 "Razer Blade 15",
241 "Samsung Odyssey G9",
242 "Apple iPad Pro",
243 "Google Nest Hub",
244 "OnePlus 9 Pro",
245 "Corsair K70 RGB",
246 "Microsoft Surface Pro 7",
247 "Jabra Elite 85t",
248 "Lenovo Legion 5",
249 "Sony WF-1000XM4",
250 "AMD Ryzen 9 5950X",
251 "NVIDIA GeForce RTX 3070",
252 "Bose Noise Cancelling Headphones 700",
253 "Apple iMac",
254 "ASUS ROG Zephyrus G14",
255 "Fitbit Inspire 2",
256 "Samsung Galaxy Buds Pro",
257 "Logitech G Pro X",
258 "Sony X800H 4K TV",
259 "Acer Predator Helios 300",
260 "Xiaomi Mi Electric Scooter",
261 "Anker PowerCore 10000",
262 "Raspberry Pi 4",
263 "Roku Streaming Stick+",
264 "Amazon Fire TV Stick",
265 "Ring Video Doorbell Pro",
266 "GoPro HERO10 Black",
267 "NETGEAR Nighthawk AX12",
268 "ASUS ZenWiFi AX",
269 "Apple AirTag",
270 "Sony WF-SP800N",
271 "Samsung T7 Portable SSD",
272 "Xbox Wireless Controller",
273 "Canon PIXMA TR150",
274 "Logitech G502 Hero",
275 "Samsung Odyssey G7",
276 "Bose SoundSport Free",
277 "JBL Boombox 2",
278 "Anker Soundcore Liberty Air 2 Pro",
279 "Apple TV 4K",
280 "Microsoft Surface Go 2",
281 "Bose Frames",
282 "Garmin Venu 2",
283 "Samsung Galaxy Watch 4",
284 "Sony HT-Z9F Soundbar",
285 "LG CX OLED TV",
286 "ASUS TUF Gaming VG27AQL1A",
287 "Apple Magic Keyboard",
288 "Sony X950H 4K TV",
289 "Logitech C920s Webcam",
290 "Amazon Echo Show 8",
291 "Google Nest Thermostat",
292 ];
293
294 return $productNames[array_rand($productNames)];
295 }
296
297 public static function generateSubscribableProductName(): string
298 {
299 $productNames = [
300 "YouTube Premium",
301 "Netflix",
302 "Spotify Premium",
303 "Amazon Prime",
304 "Disney+",
305 "Apple One",
306 "HBO Max",
307 "Microsoft 365",
308 "Adobe Creative Cloud",
309 "Dropbox Plus",
310 "FluentCRM Pro",
311 "Fluent Forms Pro",
312 "Fluent Support",
313 "FluentSMTP",
314 "Fluent Booking",
315 "FluentAuth",
316 "Shopify Plus",
317 "WordPress VIP",
318 "Google Workspace",
319 "Notion Plus"
320 ];
321 return $productNames[array_rand($productNames)];
322 }
323
324 public static function generateSubscriptionName(): string
325 {
326 return static::generateSubscribableProductName();
327
328 }
329
330
331 public function getProduct($productTypes = null): array
332 {
333 $predefinedTypes = [
334 'cloth' => 1,
335 'tv' => 2,
336 'mobile' => 3,
337 'food' => 4,
338 'subscription' => 5,
339 'electronic' => 6
340 ];
341
342
343 if ($productTypes !== null && is_string($productTypes)) {
344 $productTypes = explode(",", $productTypes);
345 } else {
346 $productTypes = $predefinedTypes;
347 }
348
349
350 $arrayKeys = Arr::isAssoc($productTypes) ? array_keys($productTypes) : $productTypes;
351
352
353 $generatableTypes = Arr::only($predefinedTypes, $arrayKeys);
354
355 $randomNumber = $predefinedTypes[array_rand(($generatableTypes))];
356
357 if ($randomNumber === 1) {
358 return [
359 'name' => static::generateClothName(),
360 'variationType' => 'cloth',
361 'payment_type' => 'onetime',
362 ];
363 //return static::generateClothName().'+'.'cloth';
364 }
365 if ($randomNumber === 2) {
366 return [
367 'name' => static::generateTvName(),
368 'variationType' => 'tv',
369 'payment_type' => 'onetime',
370 ];
371 }
372 if ($randomNumber === 3) {
373 return [
374 'name' => static::generateMobileName(),
375 'variationType' => 'mobile',
376 'payment_type' => 'onetime',
377 ];
378 }
379 if ($randomNumber === 4) {
380 return [
381 'name' => static::generateFoodName(),
382 'variationType' => 'food',
383 'payment_type' => 'onetime',
384 ];
385 }
386 if ($randomNumber === 5) {
387 return [
388 'name' => static::generateSubscriptionName(),
389 'variationType' => 'subscribable',
390 'payment_type' => 'subscription',
391 ];
392 } else return [
393 'name' => static::generateElectronicProductName(),
394 'variationType' => 'electronic',
395 'payment_type' => 'onetime',
396 ];
397 }
398
399 public function productVariation($type, $productTitle, $paymentType, $index): string
400 {
401 if ($type === 'cloth') {
402 return static::generateClothVariation();
403 }
404 if ($type === 'tv') {
405 return static::generateTvVariation();
406 }
407 if ($type === 'mobile') {
408 return static::generateMobileVariation();
409 }
410 if ($type === 'food') {
411 return static::generateFoodVariation();
412 }
413 if ($type === 'subscribable') {
414 return static::generateSubscribableVariation($productTitle, $paymentType, $index);
415 } else return static::generateElectronicProductVariation();
416 }
417
418 public static function generateSubscribableVariation($productTitle, $paymentType, $index): string
419 {
420
421 $prefixes = ['Lifetime', 'Weekly', "Monthly", "Yearly"];
422
423 return Arr::get($prefixes, $index, 'Lifetime') . " " . $productTitle;
424 // if ($paymentType === 'onetime') {
425 // return "Lifetime $productTitle";
426 // } else {
427 // $prefixes = ['Weekly', "Monthly", "Yearly"];
428 //
429 // return $prefixes[array_rand($prefixes)] . " " . $productTitle;
430 // }
431 }
432
433 public static function generateClothVariation(): string
434 {
435 $fabric = array('Cotton', 'Polyester', 'Silk', 'Wool', 'Linen', 'Velvet', 'Satin', 'Chiffon');
436 $size = array('Small', 'Medium', 'Large', 'Extra-large', 'Plus sizes');
437 $fabric = $fabric[array_rand($fabric)];
438 $size = $size[array_rand($size)];
439
440 return $fabric . ' ' . $size;
441 }
442
443 public function generateTvVariation(): string
444 {
445 $type = array("LED", "OLED", "QLED", "LCD", "Plasma", "Curved screens");
446 $size = array("32 inches", "40 inches", "55 inches", "65 inches", "75 inches", "85 inches");
447 $resolution = array("HD (720p)", "Full HD (1080p)", "4K Ultra HD (2160p)", "8K Ultra HD (4320p)");
448
449 $type = $type[array_rand($type)];
450 $size = $size[array_rand($size)];
451 $resolution = $resolution[array_rand($resolution)];
452
453 return $type . ' ' . $size . ' ' . $resolution;
454 }
455
456 public static function generateMobileVariation(): string
457 {
458
459 $size = ["Small (below 5 inches)", "Standard (5 to 6 inches)", "Large (above 6 inches)"];
460 $storageCapacity = ["64GB", "128GB", "256GB", "512GB"];
461 $cameraCapabilities = ["Single-camera", "Dual-camera", "Triple-camera", "Quad-camera", "Front camera resolution"];
462
463 $size = $size[array_rand($size)];
464 $storageCapacity = $storageCapacity[array_rand($storageCapacity)];
465 $cameraCapabilities = $cameraCapabilities[array_rand($cameraCapabilities)];
466
467 return $size . ' ' . $storageCapacity . ' ' . $cameraCapabilities;
468 }
469
470 public static function generateFoodVariation(): string
471 {
472
473 $cuisine = ["Italian", "Chinese", "Indian", "Mexican", "Japanese", "Thai", "American", "French", "Mediterranean", "Middle Eastern"];
474 $category = ["Snacks", "Beverages", "Dairy products", "Meat and poultry", "Fruits and vegetables"];
475 $preference = ["Vegan", "Vegetarian", "Gluten-free", "Organic", "Halal", "Kosher"];
476 $flavor = ["Sweet", "Salty", "Spicy", "Sour", "Bitter", "Umami"];
477 $packagingSize = ["Family packs", "Individual servings", "Economy size", "Travel-size packs"];
478
479 $cuisine = $cuisine[array_rand($cuisine)];
480 $category = $category[array_rand($category)];
481 $preference = $preference[array_rand($preference)];
482 $flavor = $flavor[array_rand($flavor)];
483 $packagingSize = $packagingSize[array_rand($packagingSize)];
484
485 return $cuisine . ' ' . $category . ' ' . $preference . ' ' . $flavor . ' ' . $packagingSize;
486 }
487
488 public static function generateElectronicProductVariation(): string
489 {
490 $displaySize = ["11-inch", "13-inch", "15-inch", "17-inch", "24-inch", "32-inch", "40-inch", "55-inch", "65-inch", "75-inch"];
491 $screenResolution = ["HD (720p)", "Full HD (1080p)", "4K Ultra HD (2160p)", "8K Ultra HD (4320p)"];
492 $memory = ["4GB", "8GB", "16GB", "32GB", "64GB", "128GB", "256GB", "512GB", "1TB", "2TB"];
493 $cameraResolution = ["12MP", "16MP", "20MP", "24MP", "32MP", "48MP", "64MP", "108MP"];
494 $batteryLife = ["8 hours", "10 hours", "12 hours", "24 hours"];
495
496 $displaySize = $displaySize[array_rand($displaySize)];
497 $screenResolution = $screenResolution[array_rand($screenResolution)];
498 $memory = $memory[array_rand($memory)];
499 $cameraResolution = $cameraResolution[array_rand($cameraResolution)];
500 $batteryLife = $batteryLife[array_rand($batteryLife)];
501
502 return $displaySize . ' ' . $screenResolution . ' ' . $memory . ' ' . $cameraResolution . ' Battery - Up to ' . $batteryLife;
503 }
504
505 public static function productSignUpFeeName(): string
506 {
507 $feeNames = array(
508 'QuickStart',
509 'SwiftSetup',
510 'RapidCharge',
511 'TurboInstall',
512 'SnapSetup',
513 'BlitzCharge',
514 'FastTrack',
515 'InstaCharge',
516 'EasyStart',
517 'SpeedySetup',
518 'LightningCharge',
519 'PromptInstall',
520 'ExpressSetup',
521 'FlashCharge',
522 'SimpleStart'
523 );
524
525 return $feeNames[array_rand($feeNames)];
526 }
527 }