Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIB] Display Currency Flag Images instead of Drop Down Box


Recommended Posts

Posted

Support thread for "Display Currency Flag Images instead of Drop Down Box" Contribution

 

This contribution replaces the standard currency drop down menu infobox with clickable currency flag images instead, very similar to the languages infobox. The selected currency flag will display as bright (highlighted) and the other flags will appear deselected in a opaque manner. Flags are fully customisable and can be edited via your store's administration panel.

 

http://www.oscommerce.com/community/contributions,4609

  • 2 weeks later...
Posted
Support thread for "Display Currency Flag Images instead of Drop Down Box" Contribution

 

This contribution replaces the standard currency drop down menu infobox with clickable currency flag images instead, very similar to the languages infobox. The selected currency flag will display as bright (highlighted) and the other flags will appear deselected in a opaque manner. Flags are fully customisable and can be edited via your store's administration panel.

 

http://www.oscommerce.com/community/contributions,4609

Posted

I'd like to thank you for your contribution. I tried it, looks wonderful! (I changed the flags and resized it).

 

I'd like to take this contribution for a further step, and I'm looking for your advice:

 

Is there any way to take the content of the currency box (just the flags) out of the currency box and put it on the top of my website? I'm using STS moudle. don't know if there is a way doing that. I saw that some found a way to put the search field out of the box, but I haven't found how to do it so far. I guess once there will be a soultion for this, it will be helpful to solve everything (I promise to post, if i'll find it by then)

 

 

Thanks for the help

 

 

BTW I'm new with php and oscommerce, so I don't have a lot to share, I hope that i'll be useful more in the future. meanwhile, you guys are wonderful with sharing your information and I'd like to thank you very much!. :blush:

Posted

JUst add this code where you want it displayed:

 

<?php

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
	$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($currencies->currencies);

while (list($key, $value) = each($currencies->currencies) ) {
if( $currency == $key )
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image1'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
else
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image2'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
									'text' => 'Currency: ' . $hidden_get_variables);

new infoBox($info_box_contents);
?>

 

If the table or box is not required, you could rename the infoBox($info_box_contents) call and create a new infobox structure in includes/classes/boxes.php

  • 2 months later...
Posted

Hi,

 

I need help to remove the table/box around the flags so I can integrate it in my page...

Could somebody be more specific about the statement made in the earlier post

 

AS FOLLOW:

 

 

 

If the table or box is not required, you could rename the infoBox($info_box_contents) call and create a new infobox structure in includes/classes/boxes.php

 

 

Thanks Guys

 

Martin

  • 4 months later...
Posted (edited)
Support thread for "Display Currency Flag Images instead of Drop Down Box" Contribution

 

This contribution replaces the standard currency drop down menu infobox with clickable currency flag images instead, very similar to the languages infobox. The selected currency flag will display as bright (highlighted) and the other flags will appear deselected in a opaque manner. Flags are fully customisable and can be edited via your store's administration panel.

 

http://www.oscommerce.com/community/contributions,4609

 

hey stu,

 

We have had our OScommerce customized, so when i try and add this hack it totally messes up the pricing, we get 0 for everything! i took a look and apparently it deletes all the currency database in mysql. Then i edit each currency one by one in the admin panel, worked fine for 10 mins, 10 mins later all of sudden all prices are back to 0!

 

Also the flags dont display on our site! our site is http://www.thescotlandkiltcompany.co.uk , any ideas how i can get these flag boxes to appear, i tried this hack on a brand new installation of oscommerce without a custom skin it worked completely fine, but on the custom skin it constantly gives me problems!

Edited by ahmadyar
  • 5 months later...
Posted
JUst add this code where you want it displayed:

 

<?php

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
	$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($currencies->currencies);

while (list($key, $value) = each($currencies->currencies) ) {
if( $currency == $key )
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image1'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
else
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image2'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
									'text' => 'Currency: ' . $hidden_get_variables);

new infoBox($info_box_contents);
?>

 

If the table or box is not required, you could rename the infoBox($info_box_contents) call and create a new infobox structure in includes/classes/boxes.php

 

 

 

hey Stu, i did the above, wondering if you can assist - i want to actually remove the box itself, when i view the source it places the currency flags etc within a table. I suspect it's the tableBox($info_box_contents); piece of code in the boxes.php. I just want to display the contents, no table formatting - any idea what i can remove from the below to make this happen?

 

 

function CurrenciesBoxContents($contents) {

 

 

$info_box_contents = array();

 

for ($i=0, $n=sizeof($contents); $i<$n; $i++) {

$info_box_contents[] = array(array('align' => $contents[$i]['align'],

'form' => $contents[$i]['form'],

'params' => '',

'text' => $contents[$i]['text']));

}

 

return $this->tableBox($info_box_contents);

}

}

  • 3 weeks later...
Posted
JUst add this code where you want it displayed:

 

<?php

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
	$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($currencies->currencies);

while (list($key, $value) = each($currencies->currencies) ) {
if( $currency == $key )
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image1'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
else
	$hidden_get_variables .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . tep_image(DIR_WS_ICONS . $value['image2'], $value['title'], '', '', 'align=absmiddle') . '</a> ';
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
									'text' => 'Currency: ' . $hidden_get_variables);

new infoBox($info_box_contents);
?>

 

If the table or box is not required, you could rename the infoBox($info_box_contents) call and create a new infobox structure in includes/classes/boxes.php

 

Hi Stu

 

Justs installed your contrib, thanks it's very good but i'm having trouble positioning it in my website. It's stuck at the bottom and i can't move it anywhere and when i try moving it using infobox positions it messes all the other boxes out of place.

Is the code above a solution for this? If so where do i paste it?

 

Sorry but i've just started and i don't know much about any of this, in fact this is my first website and first contrib installation! :'(

 

Thanks

Posted (edited)

function calculate_price() is missing from file catalog/admin/includes/classes/currencies.php included in the archive.

 

if you have done the manual installation then you are fine however if you copied the included files in the archive over your files then you will have a problem.

Not having the above function doesn't prevent the add-on from installing however as soon as you add aproduct to your cart things will get messy.

here's how to fix this issue:

 

open catalog/includes/classes/currencies.php

 

FIND:

 

function is_set($code) {
  if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
	return true;
  } else {
	return false;
  }
}

 

ADD BEFORE:

 

function calculate_price($products_price, $products_tax, $quantity = 1) {
  global $currency;

  return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
}

Edited by nimz

Santa's little freelancer

  • 2 months later...
Posted

Hi

 

I think it was this contrib that i installed and it might have made my account.php page not work when you are logged in.

 

I get this error.

 

1054 - Unknown column 's.public_flag' in 'where clause'

 

select count(*) as total from orders o, orders_status s where o.customers_id = '119' and o.orders_status = s.orders_status_id and s.language_id = '1' and s.public_flag = '1'

 

[TEP STOP]

  • 3 months later...
Posted

hello

 

I installed this contribution but unfortunately it doesn't appear. i still have the drop down box listing them. Was there an extra step or 2 to do other than change all the currience.php's? do i have to add code where its suppost to be or something.

 

Thanks

 

I'm a n00b

  • 9 months later...
Posted

We already have auto-update-currencies contribution installed. Will this still work if we install Display Currency Flag Images instead of Drop Down Box?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...