Displaying Product Options in a Select List

For example, the product has options, the change of which does not change the price.

In the admin of the product characteristics I prescribe through ||

And in the product card can be displayed through a snippet:

                            <select name="test__154__add">
                                [[GetSelect?&docid=`[*id*]`]]
                            </select>


Well, on the merchandise list.

                            <select name="test__154__add">
                                [[GetSelect?&docid=`[+id+]`]]
                            </select>

snippet

<?php
$docid = (isset($docid) && (int)$docid>0) ? (int)$docid : $modx->documentIdentifier;  
//ho $docid;
$tv=$modx->getTemplateVarOutput('aroma',$docid,1);
//echo $tv['aroma'];
$array = explode("||",$tv['aroma']);
 
foreach($array as $k=> $v)
 
{
 
 echo '<option value="'.$v.'" selected>'.$v.'</option>';
 
}
?>

Where:

aroma - имя TV параметра
[ +
test + ] - плейсхолдер в строке корзины(возле имени товара)

Let’s discuss your project

Tell me what you would like to build. I will reply by email.

Or message me on Telegram @ifwcom