<?php
/*-----------------------------------------------------------------
* 	ID:						cseov24_qf7.php
* 	Letzter Stand:			v2.2 R365
* 	zuletzt geaendert von:	akausch
* 	Datum:					2012/07/03
*
* 	Copyright (c) since 2010 commerce:SEO by Webdesign Erfurt
* 	http://www.commerce-seo.de
* ------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
* 	Released under the GNU General Public License
* ---------------------------------------------------------------*/

  class cseov24_qf7 {
    var $title, $output;

    function cseov24_qf7() {
      $this->code = 'cseov24_qf7';
      $this->version = '2.4.7';
      $this->title = 'cseov24_qf7';
      $this->description = 'Fix 7 für commerce:SEO v2next';
      $this->enabled = ((MODULE_CSEO_V241QF7_STATUS == 'true') ? true : false);
      $this->sort_order = MODULE_CSEO_V241QF7_SORT_ORDER;

      $this->output = array();
    }

    function process() {
      global $order, $xtPrice;


    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_CSEO_V241QF7_STATUS'");
        $this->_check = xtc_db_num_rows($check_query);
      }

      return $this->_check;
    }

    function keys() {
		return array('MODULE_CSEO_V241QF7_STATUS', 'MODULE_CSEO_V241QF7_SORT_ORDER');
    }

    function install() {
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_CSEO_V241QF7_STATUS', 'true', '6', '1','', now())");
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, date_added) VALUES ('MODULE_CSEO_V241QF7_SORT_ORDER', '1','6', '2', now())");
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, date_added) VALUES ('MODULE_CSEO_V241QF7', 'true','6', '3', now())");

		
		xtc_db_query("UPDATE configuration SET set_function = '' WHERE  configuration_key = 'GOOGLE_ANAL_CODE';");
		xtc_db_query("ALTER TABLE products_attributes ADD attributes_shippingtime INT( 4 ) NOT NULL;");
		xtc_db_query("ALTER TABLE attr_profile ADD attributes_shippingtime INT( 4 ) NOT NULL;");
		xtc_db_query("ALTER TABLE products_options_values ADD products_options_hex_image VARCHAR( 7 ) NOT NULL ;");
		xtc_db_query("INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'STOCK_LEVEL_SHIPPINGTIME', 'False', 9, 13, NULL, '0000-00-00 00:00:00', NULL, 'xtc_cfg_select_option(array(''True'', ''False''),');");
		xtc_db_query("INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'STOCK_LEVEL_SHIPPINGTIME_ID', '3', 9, 14, NULL, '2011-08-02 14:17:52', NULL, NULL);");
		xtc_db_query("ALTER TABLE orders_products_attributes ADD attributes_shippingtime VARCHAR( 255 ) NOT NULL ;");
		
		xtc_db_query("UPDATE database_version SET version = 'commerce:SEO v2next 2.4.7'");
		
	
    }

    function remove() {
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_CSEO_V241QF7'");
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'BLOG_MAIN_SORT'");
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MAIN_BLOG_MAXVALUE'");
	  xtc_db_query("UPDATE database_version SET version = 'commerce:SEO v2next 2.4.5'");
    }

  }
?>