function getBuildSelectAttributes($attributeValues, $attributeActive){
$jshopConfig = JSFactory::getConfig();
if (!$jshopConfig->admin_show_attributes) return array();
JPluginHelper::importPlugin('jshoppingproducts');
$dispatcher = JDispatcher::getInstance();
$attrib = JSFactory::getAllAttributes();
$userShop = JSFactory::getUserShop();
$selects = array();
foreach($attrib as $k=>$v){
$attr_id = $v->attr_id;
if ($attributeValues[$attr_id]){
$selects[$attr_id] = new stdClass();
$selects[$attr_id]->attr_id = $attr_id;
$selects[$attr_id]->attr_name = $v->name;
$selects[$attr_id]->attr_description = $v->description;
$selects[$attr_id]->firstval = $attributeActive[$attr_id];
$options = $attributeValues[$attr_id];
$attrimage = array();
foreach($options as $k2=>$v2){
$attrimage[$v2->val_id] = $v2->image;
}
$v2->addprice = getPriceFromCurrency($v2->addprice, $this->currency_id);
$v2->addprice = getPriceCalcParamsTax($v2->addprice, $this->product_tax_id);
if ($userShop->percent_discount){
$v2->addprice = getPriceDiscount($v2->addprice, $userShop->percent_discount);
}
if ($v->attr_type==1){
// attribut type select
if ($jshopConfig->attr_display_addprice){
foreach($options as $k2=>$v2){
if (($v2->price_mod=="+" || $v2->price_mod=="-") && $v2->addprice>0){
$ext_price_info = " (".$v2->price_mod.formatprice($v2->addprice).")";
$options[$k2]->value_name .=$ext_price_info;
}
}
}
if ($jshopConfig->product_attribut_first_value_empty){
$first = array();
$first[] = JHTML::_('select.option', '0', _JSHOP_SELECT, 'val_id','value_name');
$options = array_merge($first, $options);
}
$selects[$attr_id]->selects = JHTML::_('select.genericlist', $options, 'jshop_attr_id['.$attr_id.']','class = "inputbox" size = "1" onchange="setAttrValue(\''.$attr_id.'\', this.value);"','val_id','value_name', $attributeActive[$attr_id])."<span class='prod_attr_img'>".$this->getHtmlDisplayProdAttrImg($attr_id, $attrimage[$attributeActive[$attr_id]])."</span>";
$selects[$attr_id]->selects = str_replace(array("\n","\r","\t"), "", $selects[$attr_id]->selects);
}else{
// attribut type radio
foreach($options as $k2=>$v2){
if ($v2->image) $options[$k2]->value_name = "<img src='".$jshopConfig->image_attributes_live_path."/".$v2->image."' alt='' /> ".$v2->value_name;
}
if ($jshopConfig->attr_display_addprice){
foreach($options as $k2=>$v2){
if (($v2->price_mod=="+" || $v2->price_mod=="-") && $v2->addprice>0){
$ext_price_info = " (".$v2->price_mod.formatprice($v2->addprice).")";
$options[$k2]->value_name .=$ext_price_info;
}
}
}
$radioseparator = '';
if ($jshopConfig->radio_attr_value_vertical) $radioseparator = "<br/>";
foreach($options as $k2=>$v2){
$options[$k2]->value_name = "<span class='radio_attr_label'>".$v2->value_name."</span>";
}
$selects[$attr_id]->selects = sprintRadioList($options, 'jshop_attr_id['.$attr_id.']','onclick="setAttrValue(\''.$attr_id.'\', this.value);"','val_id','value_name', $attributeActive[$attr_id], $radioseparator);
$selects[$attr_id]->selects = str_replace(array("\n","\r","\t"), "", $selects[$attr_id]->selects);
}
$dispatcher->trigger('onBuildSelectAttribute', array(&$attributeValues, &$attributeActive, &$selects, &$options, &$attr_id, &$v));
}
}
return $selects;
}