Jump to content

Warning on line 1595 classes/controller/AdminController.php


rionormal

Recommended Posts

Help Me..!! I have Problem with this bug, I need help to solve this problem.

 

 

Warning on line 1595 in file /home/classes/controller/AdminController.php
[2] Cannot modify header information - headers already sent by (output started at /home/public_html/nusadebali/modules/forcecurrency/en.php:13)

 

 

post-1081869-0-51548400-1441847420_thumb.jpg

 

 

Thanks

Link to comment
Share on other sites

thanks for reply
 
sorry, file what you want? and I'm really confused because this is my first time using prestashop. and so I click payment in BO and appeared bug problem.
I use paypal and bank wire modul.
 
Warning on line 1595 in file /home/classes/controller/AdminController.php
[2] Cannot modify header information - headers already sent by (output started at /home/public_html/nusadebali/modules/forcecurrency/en.php:13)
 
so the file what should I show you
 
and thanks again tuk66
Link to comment
Share on other sites

Sorry my mistake. is it this files u asked?

<?php

/*

 *  Prestashop (http://prestashop.com)

 *    Force Currency Module - Allows your store to manage

 *  	inventory in one currency, and sell in another.

 * 		For example your default currency is Euros, but you

 * 		want to sell your products to the USA, in Dollars.

 * 		So add US Dollars as a currency to your shop, then install

 * 		this module and configure US Dollars as the forced currency.

 *    Even if you have the Currency Block module installed, you will

 *    not be able to select another currency.

 *    

 *    Limitations: Obvously you can only use one default shop currency

 *    and one forced currency. If you have other currencies installed

 *    they will not be able to be used.

 *    On the first page load, you may notice a page refresh. This is the

 *    only way I could manage to refresh the currency cookie and reload

 *    the currencies. If anyone has a better solution please feel free to

 *    update this code. Likewise, you will see a refresh after configuring

 *    the module. If there is a better solution - please contribute.

 *    

 *    IMPORTANT: After installing the module, for best performance, you

 *    must use the Module "Positions" sub-tab and move this module to the

 *    very first position in the "Top of pages" block.

 *    

 *    

 *  I built this module for my own business use, and am freely sharing it.

 * 	This module however is totally unsupported! Do not expect me to answer

 * 	any questions by email or in the Prestashop forum. I don't have time.

 *  If I make any updates to this code, I will post them, but that's it.

 *  Sorry.

 * 

 * 	December 2008 - S.F.

 */

 

class ForceCurrency extends Module

{

	function __construct()

	{

		$this->name = 'forcecurrency';

		$this->tab = 'Blocks';

		$this->version = 0.1;



		$config = Configuration::getMultiple(array('FORCE_CURRENCY_ID'));

		if (isset($config['FORCE_CURRENCY_ID']))

			$this->fcid = $config['FORCE_CURRENCY_ID'];



		parent::__construct(); /* The parent construct is required for translations */



		$this->page = basename(__FILE__, '.php');

		$this->displayName = $this->l('Force Currency');

		$this->description = $this->l('Forces the customer currency');

		$this->confirmUninstall = $this->l('Are you sure you want to delete your details?');



		if (!isset($this->fcid))

			$this->warning = $this->l('A currency must be selected in order to use this module correctly');

	}



	function install()

	{

		if (!parent::install())

			return false;

		if (!$this->registerHook('top'))

			return false;

		return true;

	}

	public function uninstall()

	{

		if (!Configuration::deleteByName('FORCE_CURRENCY_ID')

				OR !parent::uninstall())

			return false;

	}





	private function _postProcess()

	{

		if (isset($_POST['btnSubmit']))

		{

			Configuration::updateValue('FORCE_CURRENCY_ID', $_POST['fcid']);

			$cookie->id_currency = intval($_POST['fcid']);

		}

		$refreshme = intval($_POST['refreshme']);

		if ($refreshme == 1) {

			$this->_html =

			'<form id="refreshme" action="'.$_SERVER['REQUEST_URI'].'" method="post">

			  <input type="hidden" name="refreshme" value="0">

			</form>

			<script type="text/javascript">

			$(\'form#refreshme\').submit();

			</script>';

		}

		

		$this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('ok').'" /> '.$this->l('Settings updated').'</div>';

	}





	private function _displayForceCurrency()

	{

		$this->_html .= '<b>'.$this->l('This module allows you to force your customers to have only one currency option.').'<br /><br />

		'.$this->l('This is useful if you price your products in a different currency than you sell them. You must have at least two currencies enabled to make this module work properly.').'<br /><br /><br />';

	}



	private function _displayForm()

	{

		$currencies_string = '';

		$currencies = Currency::getCurrencies();

		foreach ($currencies as $currency)

		{

			$currencies_string .= '<label style="float:none; "><input type="radio" value="'.$currency['id_currency'].'" name="fcid"';

			if ($this->fcid == $currency['id_currency'])

				$currencies_string .= ' checked="checked"';

			$currencies_string .= '/> <span style="font-weight:bold;">'.$currency['name'].'</span> ('.$currency['sign'].')</label><br />';

		}

		$currencies_string .= '<label style="float:none; "><input type="radio" value="0" name="fcid"';

		if ($this->fcid == 0)

			$currencies_string .= ' checked="checked"';

		$currencies_string .= '/> <span style="font-weight:bold;">Not forced</label><br />';



		$this->_html .=

		'<form action="'.$_SERVER['REQUEST_URI'].'" method="post">

		  <input type="hidden" name="refreshme" value="1">

			<fieldset>

			<legend><img src="../img/admin/contact.gif" />'.$this->l('Details').'</legend>

				<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">

					<tr><td colspan="2">'.$this->l('Please specify the currency you want to your customers to use').'.<br /><br /></td></tr>

					<tr><td width="60" style="height: 35px;">'.$this->l('Currency').'</td><td>'.$currencies_string.'</td></tr>

					<tr><td colspan="2" align="center"><input class="button" name="btnSubmit" value="'.$this->l('Update settings').'" type="submit" /></td></tr>

				</table>

			</fieldset>

		</form>';

	}



	public function getContent()

	{

		$this->_html = '<h2>'.$this->displayName.'</h2>';



		if (!empty($_POST))

			$this->_postProcess();

		else

			$this->_html .= '<br />';



		$this->_displayForceCurrency();

		$this->_displayForm();



		return $this->_html;

	}





	function hookTop($params)

	{

		$currencies = Currency::getCurrencies();

		if (!sizeof($currencies))

			return '';

		$forcedCurrencyID = $this->forceCurrency(Configuration::get('FORCE_CURRENCY_ID'));

		if ($forcedCurrencyID)

		{

			$returnHTML ='<form id="forceCurrency" action="'.$_SERVER['REQUEST_URI'].'" method="post">

<input type="hidden" name="id_currency" value="'.$forcedCurrencyID.'"/>

</form>

<script type="text/javascript">

	$(\'form#forceCurrency\').submit();

</script>';

			return $returnHTML;

		}else

			return '';

	}





	private function forceCurrency($ForcedCurrencyId)

	{

		global $cookie;

		if ($cookie->id_currency != intval($ForcedCurrencyId)) 

		{

			$currency = new Currency(intval($ForcedCurrencyId));

			if (is_object($currency) AND $currency->id AND !$currency->deleted)

				$cookie->id_currency = intval($currency->id);

			if ($cookie->id_currency)

			{

				$currency = new Currency(intval($currency->id));

				if (is_object($currency) AND $currency->id AND intval($currency->deleted) != 1)

					return $ForcedCurrencyId;

			}		

			/* if it fails to force the currency for some reason, then do reset to default and do nothing */

			$currency = new Currency(intval(Configuration::get('PS_CURRENCY_DEFAULT')));

			if (is_object($currency) AND $currency->id)

				$cookie->id_currency = intval($currency->id);

			return 0;

		}else

			return 0;

	}



}



?>

Thanks for reply.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...