/** * Join products and their URLs * * @param Criteria $query */ protected function addJoinProduct(Criteria &$query) { // Join RewritingURL with Product to have only visible products $join = new Join(); $join->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductTableMap::TABLE_NAME, 'ID', null); $join->setJoinType(Criteria::INNER_JOIN); $query->addJoinObject($join, 'productJoin'); // Get only visible products $query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT); }
/** * Join products and their URLs * * @param Criteria $query */ protected function addJoinProductI18n(Criteria &$query) { // Join RewritingURL with Product to have only visible products $join = new Join(); $join->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductTableMap::TABLE_NAME, 'ID', null); $join->setJoinType(Criteria::INNER_JOIN); $query->addJoinObject($join, 'productJoin'); $query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT); // Join RewritingURL with ProductI18n to have product title for it's image $joinI18n = new Join(); $joinI18n->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductI18nTableMap::TABLE_NAME, 'ID', null); $joinI18n->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_LOCALE', null, ProductI18nTableMap::TABLE_NAME, 'LOCALE', null); $joinI18n->setJoinType(Criteria::INNER_JOIN); $query->addJoinObject($joinI18n); // Join RewritingURL with ProductImage to have image file $joinImage = new Join(); $joinImage->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductImageTableMap::TABLE_NAME, 'PRODUCT_ID', null); $joinImage->setJoinType(Criteria::INNER_JOIN); $query->addJoinObject($joinImage, 'productImageJoin'); $query->addJoinCondition('productImageJoin', ProductImageTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT); }