I can get it work with the first code you gave, but not with the second code; it does not load the product 'setup' when I order a product from the category mudflap. And it messes up my template after adjusting the code..
This is what I added after the first <?php
$already = false;
$ids = array();
foreach($this->rows as $i => $row){
if($row->product_code =='setup') $already = true;
$ids[]=$row->product_id;
}
$db=&JFactory::getDBO();
$db->setQuery('SELECT * FROM '.hikashop::table('product_category').' WHERE product_id IN ('.implode(',',$ids).') AND category_id=12');
$entry = $db->loadResult();
if(!$already && !empty($result)){
$app =& JFactory::getApplication();
$app->redirect(hikashop::completeLink('product&task=updatecart&product_id=106&quantity=1&add=0&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
with replacing
one time: 'extra_product' with the code 'setup' of the extra product
one time: 'YY' with '12' as the category ID of the mudflap category
one time: 'XX' with '106' as the product id of the extra product 'setup'.
what do i miss?
thanks for your reply.