<li>
<p>
<strong>[[+title]]</strong>
[[+description]]
[[+price]]
</p>
<select name="product_[[+title]]">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</li> <fieldset>
[[!+fi.validation_error_message:notempty=`<div class="alert alert-error">[[!+fi.validation_error_message]]</div>`]]
[[!+fi.successMessage]]
<div id="productenlist">
<h3><br>Warme Gerechten</h3>
<ul>[[getImageList? &tvname=`WarmeGerechten` &tpl=`tLoadlist`]]</ul>
<h3><br>Burgers</h3>
<ul>[[getImageList? &tvname=`Burgers` &tpl=`tLoadlist`]]</ul>
<h3><br>Dranken</h3>
<ul>[[getImageList? &tvname=`Dranken` &tpl=`tLoadlist`]]</ul>
<h3><br>Warme Broodjes</h3>
<ul>[[getImageList? &tvname=`WarmeBroodjes` &tpl=`tLoadlist`]]</ul>
<h3><br>KoudeBroodjes</h3>
<ul>[[getImageList? &tvname=`KoudeBroodjes` &tpl=`tLoadlist`]]</ul>
<h3><br>Salades</h3>
<ul>[[getImageList? &tvname=`Salades` &tpl=`tLoadlist`]]</ul>
<h3><br>Snacks en Frites</h3>
<ul>[[getImageList? &tvname=`SnacksFrites` &tpl=`tLoadlist`]]</ul>
</div>
<input type="hidden" name="inputChecker" value="" />
<input type="hidden" name="contactFormIt" value="1" />
<label for="naam">Name</label>
<input type="text" id="naam" name="naam" placeholder="full name" title="Enter your name" class="required" value="[[!+fi.naam]]">
<label for="naam">Company</label>
<input type="text" id="bedrijf" name="bedrijf" placeholder="company name" title="Enter your name" class="required" value="[[!+fi.bedrijf]]">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="[email protected]" title="Enter your e-mail address" class="required email" value="[[!+fi.email]]">
<label for="bericht">Message</label>
<textarea id="bericht" name="bericht">[[!+fi.bericht]]</textarea>
<input type="submit" class="button" value="Send Message">
</fieldset>
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;
}
}
[[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>`]] ...
[[!FormIt? &hooks=`spam,FormItSaveForm,email,FormItAutoResponder,redirect` &emailSubject=`RCDTBP Contact [[+firstname]] [[+lastname]]` &emailTpl=`EmailSent` &emailTo=`[email protected]` &store=`1` &redirectTo=`77` &validate=`firstname:required, lastname:required, email:email:required, tel:required, nospam:blank` &fiarTpl=`emailResponseContactForm` &fiarSubject=`My Website Contact Form` &fiarToField=`email` &fiarFrom=`[email protected]` &fiarReplyTo=`[email protected]` &fiarReplyToName=`Custom Name`
Hello [[!+firstname]] [[!+lastname]] Some more text and custom fields.....
&hooks=`processOrder,spam,email,FormItSaveForm`
[[getImageList? &tvname=`WarmeGerechten` &tpl=`@CODE:<p>Product: [[+property.tvname]][[+title]] Quantity: [[+amount[[+MIGX_id]]]]</p>`]]