I've tried everything I can find to remove the slashes that are being added to this:
$attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'c2c_used_by_game');
if ($attribute->usesSource()) {
$options = $attribute->getSource()->getAllOptions(false);
echo ('<form method="post">');
echo ('<select onChange="window.location.href=this.value">');
foreach ($options as $option)
{
echo '<option value="'.Mage::getUrl('catalogsearch/advanced/result',array ('?c2c_used_by_game='=>$option['value'])).'">'.$option['label'].'</option>';
}
echo ('</select>');
echo ('</form>');
}
So that's outputing a select dropdown that creates a link such as on here .
I need one stinking slash removed after the equal sign so its c2c_used_by_game=561
and I just can't figure it out.
array ('?c2c_used_by_game='=>(str_replace('/','',$option['value'])))).
'">'.str_replace('/','',$option['label']).'</option>';
Use _query
in the second parameter to construct query properly:
Mage::getUrl('catalogsearch/advanced/result', array('_query' => array ('c2c_used_by_game' => $option['value'])));
More info on getUrl
function usage can be found on the Magento Wiki page .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.