This issue has ben solved. I contacted a MODx core developer and am paying for his help (I still owe you a pint Susan) and even though I’m paying for it I thought those of you who chipped in should also reap the rewards. That main issue wasn’t math, but MODx. You might have already known this:
"$modx->documentObject[’unpub_date’] always applies to the document from which Ditto was called rather than each individual document."
Here’s how it all came together:
1) I have a container document that has cache deselected (important) with this Ditto call:
[[Ditto? &parents=`136` &display=`33` &tpl=`chefmenu` &sortDir=`ASC`]]
2) The snippet `LateEarly` call resides in the tpl called above:
{{chunk1}} [+content+] {{chunk2}} [[LateEarly? &unpub=`[+unpub_date+]`]]
(chunk1 and chunk2 are just divs with page title placeholder where needed because there’s no way I’m going to use a calendar app. Too much work and they can never approach the niceties that of rolling your own divs can. Also this frees my client from extra work. He merely has to copy and paste into the content pane. He’s not only an accomplished Chef but understands technology pretty well)
The Snippet is called `LateEarly`:
<?php
$unpub = isset($unpub) ? $unpub : $modx->documentObject[’unpub_date’];
$noon = mktime(12,0,0);
$which = ($unpub - $noon);
if ($which <= 118800) {
$c = $modx->getChunk(’fourteen’);
} else {
$c = $modx->getChunk(’twelve’);
}
return($c);
?>
3) `fourteen` and `twelve` are simply the bottom half of the form with the price $14 and $12.
You can see this in action at
http://www.chefsbasketcolorado.com/daily-to-go-meals.html
This is Foxycart+MODx. I can’t tell you how nice it is to use both.