PHP Code:
$attrs = $_product->setStoreFilter(0)->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
foreach($attrs as $attr) {
if(
(0 == strcmp("finish", $attr['attribute_code']))||
(0 == strcmp("structure", $attr['attribute_code']))
) {
$options = $attr['values'];
foreach($options as $option) {
//var_dump($option);
$__ll = str_replace(array('^', '$'), array('<span class="ll_macroattribute">', '</span>'), $option['store_label']);
//print "{$option['store_label']}<br />";
$filter = $option['store_label'];
$macro = '';
if ($filter[0] == '^'){
$macro = substr($filter, strpos($filter, "^")+1, strpos($filter, "$")-(strpos($filter, "^")+1));
}
$url = strtolower(str_replace(array('"', ' '), ' ', $macro).'_'.trim(str_replace('^'.$macro.'$', '', $option['store_label']))).'.jpg';
$url = str_replace(' ', '', $url);
$url = str_replace('è', 'e', $url);
$url = str_replace('é', 'e', $url);
$url = str_replace('à', 'a', $url);
$url = str_replace('ì', 'i', $url);
$url = str_replace('ò', 'o', $url);
$url = str_replace('ù', 'u', $url);
$url = str_replace("'", "", $url);
array_push($newmenu, array("url" => $url, "filter" => '<span class="ll_macroattribute">'.trim(strtoupper(str_replace('^'.$macro.'$', '', $option['store_label']))).'</span><br>', "macro" => '<span class="ll_macroattribute" style="color:#666;">' . $macro . '</span>'));
//echo $__ll.'<br>';
}
}
}
Bookmarks