Ejemplo n.º 1
0
 /**
  *
  * Enter description here ...
  *
  * @author Valerie Isaksen
  * @author Max Milbers
  * @param VirtueMartCart $cart
  * @param int            $method
  * @param array          $cart_prices
  */
 protected function checkConditions($cart, $method, $cart_prices)
 {
     vmAdminInfo('vmPsPlugin function checkConditions not overriden, gives always back FALSE');
     return FALSE;
 }
Ejemplo n.º 2
0
	/**
	 * Final setting of template
	 * Accepts a string, an id or an array with at least the keys template and params
	 * @author Max Milbers
	 */
	static function setTemplate ($template = 0) {

		$res = false;

		if(is_array($template)){
			$res = $template;
		} else {
			if(empty($template) or $template == 'default'){
				$res = self::loadVmTemplateStyle();
			} else {
				if(is_numeric($template)){
					$res = self::getTemplateById($template);
				} else {
					vmAdminInfo('Your template settings are old, please check your template settings in the vm config and in your categories');
					vmdebug('Your template settings are old, please check your template settings in the vm config and in your categories');
				}
			}
		}

		$registry = null;
		if($res){
			$registry = new JRegistry;
			$registry->loadString($res['params']);
			$template = $res['template'];
		}

		if(is_dir( VMPATH_THEMES.DS.$template )) {
			$app = JFactory::getApplication();
			if($app->isSite()) $app->setTemplate($template,$registry);

		} else {
			vmError( 'The chosen template couldnt be found on the filesystem: '.VMPATH_THEMES.DS.$template );
		}

		return $template;
	}
Ejemplo n.º 3
0
	/**
	 * Check the conditions on Zip code
	 * @param int $zip : zip code
	 * @param $params paremters for this specific shiper
	 * @author Valérie Isaksen
	 * @return string if Zip condition is ok or not
	 */
	private function _zipCond($zip, $method) {
		$zip = (int)$zip;
		if (!empty($zip)) {
			$zip_cond = (($zip >= $method->zip_start AND $zip <= $method->zip_stop)
				OR
				($method->zip_start <= $zip AND ($method->zip_stop == 0)));
		} else {
			$zip_cond = true;
		}
		vmAdminInfo('weigth_countries _zipCond zip:'. $zip, ' method->zip_start:'. $method->zip_start.
			' method->zip_stop:'.
			$method->zip_stop. ' result:'.$zip_cond);
		return $zip_cond;
	}
Ejemplo n.º 4
0
 /**
  * Final setting of template
  *
  * @author Max Milbers
  */
 static function setTemplate($template)
 {
     if (!empty($template) && $template != 'default') {
         $app = JFactory::getApplication('site');
         if (JVM_VERSION === 1) {
             if (is_dir(JPATH_THEMES . DS . $template)) {
                 $app->set('setTemplate', $template);
             } else {
                 JError::raiseWarning(412, 'The chosen template couldnt find on the filesystem: ' . $template);
             }
         } else {
             $registry = null;
             if (is_numeric($template)) {
                 $db = JFactory::getDbo();
                 $query = 'SELECT `template`,`params` FROM `#__template_styles` WHERE `id`="' . $template . '" ';
                 $db->setQuery($query);
                 $res = $db->loadAssoc();
                 if ($res) {
                     $registry = new JRegistry();
                     $registry->loadString($res['params']);
                     $template = $res['template'];
                 }
             } else {
                 vmAdminInfo('Your template settings are old, please check your template settings in the vm config and in your categories');
                 vmdebug('Your template settings are old, please check your template settings in the vm config and in your categories');
             }
             if (is_dir(JPATH_THEMES . DS . $template)) {
                 $app->setTemplate($template, $registry);
             } else {
                 JError::raiseWarning(412, 'The chosen template couldnt find on the filesystem: ' . $template);
             }
         }
     }
     return $template;
 }
	/**
	 * Check the conditions on Zip code
	 *
	 * @param int $zip : zip code
	 * @param     $params paremters for this specific shiper
	 * @author Valérie Isaksen
	 * @return string if Zip condition is ok or not
	 */
	private function _zipCond ($zip, $method) {

		$zip = (int)$zip;
		$zip_cond = true;
		if (!empty($zip) ) {

			if(!empty($method->zip_start) and !empty( $method->zip_stop)){
				$zip_cond = (($zip >= $method->zip_start AND $zip <= $method->zip_stop));
			} else if (!empty($method->zip_start)) {
				$zip_cond = ($zip >= $method->zip_start);
			} else if (!empty($method->zip_stop)) {
				$zip_cond = ($zip <= $method->zip_stop);
			}
		} else if(!empty($method->zip_start) or !empty( $method->zip_stop)){
			$zip_cond = false;
		}

		vmAdminInfo ('weigth_countries _zipCond zip:' . $zip, ' method->zip_start:' . $method->zip_start .
			' method->zip_stop:' .
			$method->zip_stop . ' result:' . $zip_cond);
		return $zip_cond;
	}