We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f83ffc3 commit c88cea2Copy full SHA for c88cea2
Model/Product/Enricher.php
@@ -33,11 +33,10 @@ public function getAttributes()
33
*/
34
public function parsePrompt($prompt, $product): String
35
{
36
- return str_replace(
37
- ['{{name}}', '{{sku}}'],
38
- [$product->getName(), $product->getSku()],
39
- $prompt
40
- );
+ $prompt = preg_replace_callback('/\{\{(.+?)\}\}/', function ($matches) use ($product) {
+ return $product->getData($matches[1]);
+ }, $prompt);
+ return $prompt;
41
}
42
43
public function enrichAttribute($product, $attributeCode)
0 commit comments