Ah ok. Well from what I can tell there is no value being set to [[+fields]] as there is no input with a name of 'fields', unless there is a custom hook in the formit call that is setting that value?
The problem is that the field names are dynamic so this is why I advised to setup the names with 'product_', so in a hook you can find any values with this prefix, explode them and then dictate their return - someone may be able to advise you on the correct php for this as I assume mine didnt work
Try this - it may not work but if it fails check the error log for guidance or keep tweaking it to get it work
I think each time it loops through the value may be replaced though so I think you need to use str replace... hopefully someone can guide you on that.
<?php
$allValues = $hook->getValues();
$product = array();
foreach($allValues as $key => $value) {
if (strpos($key, 'products_') !== false) {
$modx->log(xPDO::LOG_LEVEL_ERROR, 'There were values found with the prefix product_');
list($prefix, $productTitle) = explode('_', $key);
$modx->log(xPDO::LOG_LEVEL_ERROR,'The products found were:' . $productTitle);
$productList .= 'Title:' . $product[$key] . 'Quantity' . $product[$value];
$hook->setValue('products', $productList);
return true;
} else{
$modx->log(xPDO::LOG_LEVEL_ERROR, 'There were no values matching product_');
return false;
}
}
Then set [[+products]] in your emailtpl.
As a get around the other thing you may be able to do is in your emailTpl recall all the titles using the getImageList snippet. Remove the product_ prefix from your chunk first though.
[[getImageList? &tvname=`WarmeGerechten` &tpl=`@CODE:<p>Product: [[+property.tvname]] Quantity: [[+title]]</p>`]]
[[getImageList? &tvname=`Burgers` &tpl=`@CODE:<p>Product: [[+property.tvname]] Quantity: [[+title]]</p>`]]
[[getImageList? &tvname=`Dranken` &tpl=`@CODE:<p>Product: [[+property.tvname]] Quantity: [[+title]]</p>`]]
...
[ed. note: lkfranklin last edited this post 5 years, 7 months ago.]