Thank you Nicolas
i modified the checkout/custom_fields view as follow
<?php
/**
* @package HikaShop for Joomla!
* @version 2.1.0
* @author hikashop.com
* @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
$showfields = array(
'my_special_field1' => 0, // my_special_field1 display only on step 0
);
$type = $this->type;
foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
// Stefano Start
$user =& JFactory::getUser();
$userGroups = JAccess::getGroupsByUser($user->id, true);
// non entra e quindi non stampa se l'utente fa parte del gruppo "Cliente Abbonato" e se il campo custom da scrivere si chiama 'order_portaunamico'
// ci vorrebbe una miglioria per evitare di stampare la sezione "informazioni supplementari" qualora ci fosse solo il campo 'order_portaunamico'
// nel mio caso avendone di sicuro 2 non mi metto a perdere tempo su questa miglioria
// parte per conotrollo se almeno un prodotto fa parte della categoria regalo
$regalo = 0;
foreach($this->rows as $product){
$db = JFactory::getDBO();
$db->setQuery('SELECT category_id FROM #__hikashop_category WHERE product_id='.$product->product_id);
$categories = $db->loadObjectList();
foreach($categories as $category){
if($category->category_id==39){
$regalo = 1;
}
}
}
$visualizza = 1;
if ( (in_array(11,$userGroups) and ($oneExtraField->field_namekey=='order_portaunamico')) ) $visualizza = 0;
if ( ($regalo == 0) and ($oneExtraField->field_namekey=='order_bigliettoauguri') ) $visualizza = 0;
if ( ($regalo == 0) and ($oneExtraField->field_namekey=='order_comespedirebiglietto') ) $visualizza = 0;
if ( ($regalo == 0) and ($oneExtraField->field_namekey=='order_notespedizionebiglietto') ) $visualizza = 0;
if ( ($regalo == 0) and ($oneExtraField->field_namekey=='order_emailamico') ) $visualizza = 0;
if ( ($regalo == 0) and ($oneExtraField->field_namekey=='order_frasebiglietto') ) $visualizza = 0;
if ($visualizza == 1) {
// Stefano End
if(isset($showfields[$fieldName]) && $this->step != $showfields[$fieldName]) {
echo '<tr style="display:none;"><td><input type="hidden" name="data['.$type.']['.$fieldName.']" value="'.$this->escape($this->$type->$fieldName).'"/></td></tr>';
continue;
}
?>
<tr class="hikashop_checkout_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>">
<td class="key">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</td>
<td>
<?php
$onWhat='onchange';
if($oneExtraField->field_type=='radio')
$onWhat='onclick';
echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data['.$type.']['.$fieldName.']',false,' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"');
?>
</td>
</tr>
<?php
// Stefano Start
}
// Stefano End
}
but unfortunatelty is doesn't work.
is it my foult?
I receive these messages if I enable the Joomla Log:
Warning: Invalid argument supplied for foreach() in /home/madeinv1/public_html/labs/templates/miv_icons_14/html/com_hikashop/checkout/custom_fields.php on line 30
Line 30 is: foreach($categories as $category){