Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Advanced Search Price dropdown--preg_replace


muskokee

Recommended Posts

S far I have:

 

pull down menu is created. options are populated. values are converted between currencies. pound, euro, and yen are being replaced in the option value field, text displayed with currency symbol.

 

Only problem is that I can't seem to preg_replace the dollar symbol.

 

Here is the preg replace code:

 

$price_search = array ( '@$@i',
						  '@?@i',
						  '@&(yen|#165);@i',
						  '@&(euro|#8364);@i');
	$replace = array ('',
					 '',
					 '',
					 '');

 

I originally had the pound as the html symbol but it didn't replace so I changed it to alt0163 which now works!? Changing the $ sign to html code doesn't work, nor using the alt to enter it in.

 

Does anyone have any ideas to make the preg_replace "replace" the dollar sign?

 

Thanks

Sheri

Link to comment
Share on other sites

Does anyone have any ideas to make the preg_replace "replace" the dollar sign?

 

Thanks

Sheri

 

Solved it. Just had to sleep on the problem I guess!

 

Proper syntax to replace $ sign:

$price_search = array ( '/[$]/',
						  '@?@i',
						  '@&(yen|#165);@i',
						  '@&(euro|#8364);@i');
	$replace = array ('',
					 '',
					 '',
					 '');

 

Sheri

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...