Location: PHPKode > projects > HikaShop > back/types/discount.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
class HikashopDiscountType{
	function load($form){
		$this->values = array();
		if(!$form){
			$this->values[] = JHTML::_('select.option', 'all',JText::_('HIKA_ALL') );
		}
		$this->values[] = JHTML::_('select.option', 'discount',JText::_('DISCOUNTS'));		
		$this->values[] = JHTML::_('select.option', 'coupon',JText::_('COUPONS'));	
	}
	function display($map,$value,$form=false){
		$this->load($form);
		$attribute='';
		if(!$form){
			$attribute = ' onchange="document.adminForm.submit( );"';
		}else{
			if(empty($value)){
				$value = 'discount';
			}
			$js = '
			function hikashopToggleDiscount(value){
				autoLoad = document.getElementById(\'hikashop_auto_load\');
				minOrder = document.getElementById(\'hikashop_min_order\');
				if(autoLoad && minOrder){
					if(value==\'discount\'){
						autoLoad.style.display = \'none\';
						minOrder.style.display = \'none\';
					}else{
						autoLoad.style.display = \'\';
						minOrder.style.display = \'\';
					}
				}
			}
			window.addEvent(\'domready\', function(){
				hikashopToggleDiscount(\''.$value.'\');
			});';
			$doc =& JFactory::getDocument();
			$doc->addScriptDeclaration($js);
			$attribute = ' onchange="hikashopToggleDiscount(this.value);"';
		}
		return JHTML::_('select.genericlist',   $this->values, $map, 'class="inputbox" size="1"'.$attribute, 'value', 'text', $value );
	}
}
Return current item: HikaShop