Are the images still there, in the backend?
what do you get with
at frontend.
Is the image there, in the json-output?
where do I donate the beers?
The link in my sig should work.
Working outside, must be the image TV. Anyway would it be possible for you to leave some comments in the script so I understand and learn? Would be great and thanks loads.
<?php
$set = $modx->getOption('set', $scriptProperties, '');//get the formit-scriptProperty &set for filtering specific sets
$input = $modx->fromJson($modx->resource->getTVValue('product'));//get the product-TV of the current resource and convert the json to an array
$output = array();
foreach ($input as $row) {
if (isset($set) && !empty($set) && ($set != $row['set']))
continue;//filter specific set, if specified
$productname = $modx->getOption('productname', $row, '');//get the productname of the MIGX-item
$product_orders = '';
//loop thrue the weeks (1-5) now
for ($i = 1; $i <= 5;$i++) {
$weight = $hook->getValue($productname.'_'.$i);//get the weight from input, for example: 'peccorino_1' to 'peccorino_5'
$week = strftime('%W',strtotime('+'.$i.' week'));//get the week-number
$product_orders .= $week . ' - ' . $weight . 'kg <br />';//prepare the output for a week, could also be done with getChunk
}
$output[] = $productname . ': <br />' . $product_orders;//fill the output-array with the product-output, could be done with getChunk
}
$products_output = implode("<br />", $output);//convert the output-array to a string
$hook->setValue('products_output', $products_output);//put the output into a formit-value, so it can be used by other hooks and as placeholder
return true;//return true, otherwise formit would stop processing here with an error-result
may be it would be better not to use the productname but the MIGX_id as the name for your input-fields
[ed. note: Bruno17 last edited this post 12 years ago.]
I think, you should change the image-placeholder
<div class="pur_col1 purlineitem"><img src="[[+image:add_before=`assets/images/`:phpthumbof=`w=100&h=100&zc=1]]" alt="Foto van [[+productname]] " ></div>
to
<div class="pur_col1 purlineitem"><img src="[[+productimage:phpthumbof=`w=100&h=100&zc=1]]" alt="Foto van [[+productname]] " ></div>