Maybe a stupid question which has been asked lots of times on the forum, but I can't find a solution.
In my template ProductOverzicht.ss I have the following code:
<% if Children %>
<% control GetChildren %>
<section class="blok">
<article>
<% if Top.isNieuw %><div class="nieuw">nieuw</div><% else %>nope $ID<% end_if %>
<div class="links">
<% if MyFotos %><% control MyFotos %><% control Plaatje %><% if First %>$setWidth(188)<% end_if %><% end_control %><% end_control %><% else %>
<img src="/themes/agrideals/images/no-image.png" alt="no image"/><% end_if %>
</div>
<div class="rechts"><h2>$Title</h2>
$Content.FirstParagraph
</div>
<div class="bekijk"><a href="$Link">Bekijk product</a></div>
</article>
</section>
<% end_control %>
<% end_if %>
I want to find out how I can get the current ID of the Child of Top.isNieuw
The function isNieuw:
public function isNieuw(){
$aantalweken = 2;
$tijd = time() - ((7 * 24 * 60 * 60) * $aantalweken);
$obj = DataObject::get_one('Product', 'ID='.$this->ID.' AND UNIX_TIMESTAMP(Created) > '.$tijd);
Debug::show($obj);
if($obj) return false;
else return true;
}
Currently I get the ID of the parent, not the child...