This thread is about kind of what you need:
http://forum.x-cart.com/showthread.php?t=70512
Anyway, here is couple more things to consider:
1) If you want to pull products with attribute Color having value Red and these attributes are product-specific, you would call it like this:
PHP Code:
$name = 'Color';
$value = 'Red';
$products = \XLite\Core\Database::getRepo('\XLite\Model\Product')
->createQueryBuilder('p')
->linkInner('p.attributes')
->linkInner('attributes.translations', 'atranslations')
->linkInner('attributes.attribute_options')
->linkInner('attribute_options.translations', 'aotranslations')
->andWhere('atranslations.name = :name AND aotranslations.name = :value')
->setParameter('name', $name)
->setParameter('value', $value)
->getResult();
foreach ($products as $product) {
echo $product->getName();
}
2) If you need the same but for global attributes you would call it like this:
PHP Code:
$name = 'Manufacturer';
$value = 'Toyty';
$a = \XLite\Core\Database::getRepo('\XLite\Model\AttributeValue\AttributeValueSelect')
->createQueryBuilder('avs')
->linkInner('avs.attribute', 'a')
->linkInner('a.translations', 'at')
->linkInner('avs.attribute_option', 'ao')
->linkInner('ao.translations', 'aot')
->andWhere('at.name = :attributename AND aot.name = :optionvalue')
->setParameter('attributename', $name)
->setParameter('optionvalue', $value)
->getResult();
foreach ($a as $av) {
echo $av->getProduct()->getName() . ' ';
}
Please, let me know if it helps.