Post by HATEPOLICY » Tue Nov 22, 2011 6:00 pm

Hi guys,

Tried searching all last night, could only find this: http://forum.opencart.com/viewtopic.php?t=1210
That post is dated and Opencart system has changed since then, so I need some help please?
I am in no way a php coder, so please be gentle!

I want to do the same though, move the currency to display ONLY on the product page,
Next to the price or something, I tried a few copy paste experiments from header.tpl to product.tpl, but alas, no joy.
I am on the latest Opencart.
Any help would be greatly appreciated.

Many thanks in advance! :)

H.
Last edited by HATEPOLICY on Wed Dec 07, 2011 12:08 am, edited 1 time in total.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by HATEPOLICY » Wed Nov 30, 2011 1:17 am

bump? ???
anyone please? help?

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by HATEPOLICY » Tue Dec 06, 2011 10:10 pm

Bump again!

If nobody can provide any support could someone point me to place that can?

cheers.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by uksitebuilder » Tue Dec 06, 2011 11:13 pm

edit catalog/controller/product/product.php

find

Code: Select all

		$this->load->model('catalog/product');
add after

Code: Select all

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['currency_code'])) {
      		$this->currency->set($this->request->post['currency_code']);
			
			unset($this->session->data['shipping_methods']);
			unset($this->session->data['shipping_method']);
			$this->redirect($this->request->post['redirect']);

   		}

		$this->load->model('localisation/currency');
		 
		 $this->data['currencies'] = array();
		 
		$results = $this->model_localisation_currency->getCurrencies();	
		
		foreach ($results as $result) {
			if ($result['status']) {
   				$this->data['currencies'][] = array(
					'title'        => $result['title'],
					'code'         => $result['code'],
					'symbol_left'  => $result['symbol_left'],
					'symbol_right' => $result['symbol_right']				
				);
			}
		}
edit catalog/view/theme/default/template/product/product.tpl

find

Code: Select all

      <?php if ($price) { ?>
add after

Code: Select all

  <?php if (count($currencies) > 1) { ?>
  <form action="" method="post" enctype="multipart/form-data">
    <div id="currency">
      <?php foreach ($currencies as $currency) { ?>
      <?php if (isset($currency_code)&&$currency['code'] == $currency_code) { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_left']; ?></b></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_right']; ?></b></a>
      <?php } ?>
      <?php } else { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_left']; ?></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_right']; ?></a>
      <?php } ?>
      <?php } ?>
      <?php } ?>
      <input type="hidden" name="currency_code" value="" />
      <input type="hidden" name="redirect" value="index.php?route=product/product&product_id=<?php echo $this->request->get['product_id']; ?>" />
    </div>
  </form>
  <?php } ?>
edit catalog/view/theme/default/template/common/header.tpl

find & delete

Code: Select all

  <?php if (count($currencies) > 1) { ?>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <div id="currency"><?php echo $text_currency; ?><br />
      <?php foreach ($currencies as $currency) { ?>
      <?php if ($currency['code'] == $currency_code) { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_left']; ?></b></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>"><b><?php echo $currency['symbol_right']; ?></b></a>
      <?php } ?>
      <?php } else { ?>
      <?php if ($currency['symbol_left']) { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_left']; ?></a>
      <?php } else { ?>
      <a title="<?php echo $currency['title']; ?>" onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>').submit(); $(this).parent().parent().submit();"><?php echo $currency['symbol_right']; ?></a>
      <?php } ?>
      <?php } ?>
      <?php } ?>
      <input type="hidden" name="currency_code" value="" />
      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
    </div>
  </form>
  <?php } ?>
edit: catalog/view/theme/default/stylesheet/stylesheet.css

find and delete

Code: Select all

#currency {
	width: 75px;
	position: absolute;
	top: 15px;
	left: 425px;
	color: #999;
	line-height: 17px;
}
BACKUP Files first

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by HATEPOLICY » Tue Dec 06, 2011 11:41 pm

Thanks ever so much UKSiteBuilder!!!
Much appreciated! I am sure it works but will report back anyway.

Edit: Just noticed you have a donate button, I will be using it this week if this works!
Many thanks again.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by HATEPOLICY » Wed Dec 07, 2011 12:16 am

Worked like a charm, nice one.

For any other n00bs like myself,
I have a custom template, so I edited the same files on it.

I'm off to buy you a few drinks Simon, thanks again

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by uksitebuilder » Wed Dec 07, 2011 12:21 am

You're welcome

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom
Who is online

Users browsing this forum: No registered users and 75 guests