This question has been answered by multiple community members. See the first response.
$tplName = "ProductDetailTpl";
$productId = $_GET['productId'];
$product = $modx->getObject('modProduct', $productId);
if ($product) {
$fields = $product->toArray();
$output = $modx->getChunk($tplName, $fields);
} else {
$output ='Product not found';
}
return $output;
<a href="[[~177? &[[+itemno]]=`~177`]]"><img src="[[+imgLink]]" /></a>
<?php
$path = MODX_CORE_PATH . 'components/aeiproducts/';
$result = $modx->addPackage('aeiproducts',$path .
'model/','aei_');
if (! $result) {
return 'failed to add package';
}
$productId = $_GET['number'];
$product = $modx->getObject('Products', $productId);
if ($product) {
$fields = $product->toArray();
$output = $modx->getChunk('ShowProdDetail', $fields);
} else {
$output ='Product not found';
}
return $output;<a href="[[~177? &number=`[[+itemno]]`]]"><img src="[[+imgLink]]" /></a>
I think you're close. Your snippet looks good, but I believe you want something like this in the Tpl chunk:
<a href="[[~177? &number=`[[+itemno]]`]]"><img src="[[+imgLink]]"></a>
You want a URL that looks like this:
products-detail.html? number=123456