I currently have numerous Super Tables with date fields inside and I am trying to get all table items to list themselves together in date order depending on what the user inputs. I have tried using the Super Sort plugin but haven't had any luck.
Not sure if there is somewhere below where I have gone wrong or misunderstood the documentation. The plugin I am trying to use can be found here
Does anyone know if this is possible with Super Tables or Matrix fields?
The error I'm currently getting is:
Object of class Craft\ElementCriteriaModel could not be converted to string
protected function doDisplay(array $context, array $blocks = array())
{
echo $this->getAttribute($this->getAttribute(($context["object"] ?? $this->getContext($context, "object")), "tourDates", array()), "tourDate", array());
}
if (version_compare(PHP_VERSION, '7', '>=') && $code === 2 &&
strpos($message, 'should be compatible with') !== false)
{
return;
}
parent::handleError($code, $message, $file, $line);
protected function displayWithErrorHandling(array $context, array
$blocks = array())
{
try {
$this->doDisplay($context, $blocks);
} catch (Twig_Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
This is the code I current have:
{% set artists = craft.entries.section('artists') %}
{% set entries = artists | supersort('sortAs', '{ tourDates.tourDate }') %}
{% for entry in entries %}
{% if entry.tourDates %}
{% for row in entry.tourDates %}
{{ row.tourDate|date("d/m/Y") }}
{% endfor %}
{% endif %}
{% endfor %}
I have also tried:
{% set entries = artists | supersort('sortAs', '{ tourDate }') %}
and
{% set entries = artists | supersort('sortAs', '{{ artists.tourDates.tourDate }}') %}