<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
    <table border="0" style="width:100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" style="width:100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageGeneralsign"></td>
            <td class="pageGeneralsign" align="right"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
      </tr>
<?php
  $date_availability = 'AND (to_days(items_date_available_end) IS NULL OR (to_days(items_date_available_end) IS NOT NULL AND to_days(now()) <= to_days(items_date_available_end)))';
  $items_new_array = array(); 
  $items_new_query_raw = "select max(p.items_id), p.items_id, pd.items_name, p.items_picture, p.items_price, p.items_tax_class_id, p.items_date_added, p.items_model, m.producers_name, s.specials_new_items_price, p.delivery_time_id from (((" . DB_TBL_ITEMS . " p, " . DB_TBL_CATEGORIES . " c, " . DB_TBL_ITEMS_TO_CATEGORIES . " p2c) left join " . DB_TBL_PRODUCERS . " m on (p.producers_id = m.producers_id) left join " . DB_TBL_SPECIALS . " s on p.items_id = s.items_id), " . DB_TBL_ITEMS_DESCRIPTION . " pd) where c.categories_status=1 and p.items_id = p2c.items_id and c.categories_id = p2c.categories_id and p.items_status = '1' and p.items_id = pd.items_id and pd.language_id = '" . (int)$languages_id . "' $date_availability GROUP BY p.items_id order by p.items_date_added DESC, pd.items_name";
  $items_new_split = new splitPageResults($items_new_query_raw, MAX_SHOW_ITEMS_NEW);
  if (($items_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
      <tr>
        <td><table border="0" style="width:100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="smallText"><?php echo $items_new_split->display_count(TEXT_SHOW_NUMBER_OF_ITEMS_NEW); ?></td>
            <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $items_new_split->display_links(MAX_SHOW_PAGE_LINKS, go_get_all_get_parameter(array('page', 'info', 'x', 'y'))); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><table border="0" style="width:100%" cellspacing="0" cellpadding="2">
<?php
  if ($items_new_split->number_of_rows > 0) {
    $items_new_query = go_db_query($items_new_split->sql_query);

    while ($items_new = go_db_fetch_array($items_new_query)) {


    	
	 		$hidden = '';		 
	 		$after_price = ''; 		 
	 		$before_price = '';
	 		$no_normal_form = '';
	 		   	 	
			$item_service_status_query = go_db_query("select * from " . DB_TBL_ITEMS . " where items_id = '" . (int)$items_new['items_id'] . "'");
			$item_service_status = go_db_fetch_array($item_service_status_query);

			// Loopthrough11b

			if ($item_service_status['iss_masseinheit'] == '1'){						
				$before_price = BEFORE_PRICE_MASSEINHEIT;
			}									
								
			if ($item_service_status['domainservice_status'] != '0'){
					$after_price = $item_service_status['domainservice_zahlungsintervall'];
					$after_price = str_replace("0", " (" . DOMAIN_PAYMENT_ONCE . ")", $after_price);
					$after_price = str_replace("12", " (" . DOMAIN_PAYMENT_ANNUAL . ")", $after_price);
					$after_price = str_replace("1", " (" . DOMAIN_PAYMENT_MONTHLY . ")", $after_price);
					$form_to = go_href_link($GLOBALS[CONFIG_NAME_FILE][bestell_domaincheck], go_get_all_get_parameter(array('action')), 'NONSSL');
						
					$hidden .= go_fetch_hidden_field ('items_price_domainservice', $featured_items['items_price'],'');
					$hidden .= go_fetch_hidden_field ('gewuenschtes_paket', $featured_items['items_name'],'');
			}
			else{
				$form_to = go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], go_get_all_get_parameter(array('action')) . 'action=add_item');
			} 
	
			// Loopthrough11

			if (file_exists(FOLDER_ABSOLUT_CATALOG . 'modules/download')) {
				$download_items_id = $items_new['items_id'];
				require(FOLDER_ABSOLUT_CATALOG . 'modules/download/load_this/mods/mods_bigware_7_10_11.php');
			}
      	
      	
      	if ($items_new['items_price'] == "123456.7890"){
      		$preistext = QUERYTEXT1 . $items_new['items_name'] . QUERYTEXT2 . $items_new['items_model'] . QUERYTEXT3 ;
    			$preistext = urlencode($preistext);
      		$items_price = PRICE_ON_DEMAND_TEXT2;
      		$item_price_d = $items_price;
      	}else{ 
	       $items_price = $currencies->display_special_pricing($item_service_status, $attendee_id);
	        if (PRICES_LOGGED_IN == 'false') {
	        $item_price_d = $before_price . $items_price . $after_price;
	            }
	        if ((PRICES_LOGGED_IN == 'true') && (!go_session_is_registered('attendee_id'))) {
	        	$item_price_d = ('<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_40], '','SSL') . '">'  . PRICES_LOGGED_IN_TEXT . '</a>&nbsp;' );
	        }  else  {
	          $item_price_d = $before_price . $items_price . $after_price;
	        } 
      	}
    $picture_frame = picture_frame();    
?>
          <tr>
            <td style="width:<?php echo SMALL_PICTURE_WIDTH + 10; ?>px" valign="top" class="main"><?php echo $picture_frame['begin_frame'] . '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '">' . go_picture(FOLDER_RELATIV_PICTURES . $items_new['items_picture'], $items_new['items_name'], SMALL_PICTURE_WIDTH, SMALL_PICTURE_HEIGHT) . '</a>' . $picture_frame['end_frame']; ?></td>
            <td valign="top" class="main"><div style="margin-left: 6"><?php echo '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '"><b>' . $items_new['items_name'] . '</b></a><br>' . TEXT_PRODUCER . ' ' . $items_new['producers_name'] . '<br><br>' . TEXT_PRICE . ' <br><br>' . $item_price_d . $currencies->shipping_tag($items_new,false); ?></div></td> 
            <td align="right" valign="middle" class="main">
<?php 
         if ($items_new['items_price'] == "123456.7890"){
            	 echo '<a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_8] . '?enquiry=' . $preistext . '">' . go_picture_button('button_fragen_now.gif', PICTURE_BUTTON_BUY_NOW) . '</a>';
	} 
	else{ 
    if (PRICES_LOGGED_IN == 'false'){
    	if ((STOCK_ALLOW_CHECKOUT == 'false')&&(go_get_items_stock($items_new['items_id']) < 1)) {
    		$submit_button = '';
	}
	else{
		$count_merkmal_query = go_db_query("select count(*) as merkmal_total from " . DB_TBL_ITEMS_CHARACTERISTICS . " where items_id='" . $items_new['items_id'] . "'");
		$count_merkmal_result = go_db_fetch_array($count_merkmal_query);
		
			// Loopthrough11a2
						
     if ($item_service_status['iss_masseinheit'] == '1'){
      $the_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '">' . go_picture_button('button_in_cart.gif', PICTURE_BUTTON_IN_CART) . '</a>';
			$no_normal_form = '1';  // individuelle weiterleitung
     }	 		 
		
		if ($item_service_status['domainservice_status'] != '0'){
			$the_button = go_picture_submit('button_buy_now_domain.gif', PICTURE_BUTTON_IN_CART);
			$no_normal_form = '1';  // individuelle weiterleitung
		}
		if ($no_normal_form != '1'){
			$the_button = go_picture_submit('button_in_cart.gif', PICTURE_BUTTON_IN_CART);
		}
		if ($count_merkmal_result['merkmal_total'] > 0) {    
			$submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '">' . go_picture_button('button_in_cart.gif', PICTURE_BUTTON_IN_CART) . '</a>';   
		}else{
			$submit_button = go_fetch_form('cart_quantity', $form_to) . go_fetch_hidden_field('cart_quantity', '1') . go_fetch_hidden_field('items_id', $items_new['items_id']) . $hidden . $the_button . '</form>';
			//$submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_38], go_get_all_get_parameter(array('action')) . 'action=buy_now&items_id=' . $items_new['items_id']) . '">' . go_picture_button('button_in_cart.gif', PICTURE_BUTTON_IN_CART)  . '</a>';
		}
	} 
                 }
		if ( (PRICES_LOGGED_IN == 'true') && (!go_session_is_registered('attendee_id'))) {
          $submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_40], '','SSL') . '">'  . PRICES_LOGGED_IN_SUBMIT . '</a>&nbsp;'; 
		}else {
			if ((STOCK_ALLOW_CHECKOUT == 'false')&&(go_get_items_stock($items_new['items_id']) < 1)) {
        	$submit_button = '';
			}else{
				$count_merkmal_query = go_db_query("select count(*) as merkmal_total from " . DB_TBL_ITEMS_CHARACTERISTICS . " where items_id='" . $items_new['items_id'] . "'");
				$count_merkmal_result = go_db_fetch_array($count_merkmal_query);

				//Loopthrough11a
				
        if ($item_service_status['iss_masseinheit'] == '1'){
          $the_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '">' . go_picture_button('button_in_cart.gif', PICTURE_BUTTON_IN_CART) . '</a>';
					$no_normal_form = '1';  // individuelle weiterleitung
        }	   

				if ($item_service_status['domainservice_status'] != '0'){
		    	$the_button = go_picture_submit('button_buy_now_domain.gif', PICTURE_BUTTON_IN_CART);
		    	$no_normal_form = '1';  // individuelle weiterleitung
		    }
				if ($no_normal_form != '1'){
		    	$the_button = go_picture_submit('button_in_cart.gif', PICTURE_BUTTON_IN_CART);
		    }
				if ($count_merkmal_result['merkmal_total'] > 0) {    
					$submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_34], 'items_id=' . $items_new['items_id']) . '">' . go_picture_button('button_in_cart.gif', PICTURE_BUTTON_IN_CART) . '</a>';   
				}else{  
					$submit_button = go_fetch_form('cart_quantity', $form_to) . go_fetch_hidden_field('cart_quantity', '1') . go_fetch_hidden_field('items_id', $items_new['items_id']) . $hidden . $the_button . '</form>';                  
					//$submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_38], go_get_all_get_parameter(array('action')) . 'action=buy_now&items_id=' . $items_new['items_id']) . '">' . $the_button  . '</a>';
				}
			} 
		}
      echo $submit_button;         
        
        }
?>        
            </td>
          </tr>
          <tr>
            <td colspan="3"><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
          </tr>
<?php 
    }
  } else {
?>
          <tr>
            <td class="main"><?php echo TEXT_NO_NEW_ITEMS; ?></td>
          </tr>
          <tr>
            <td><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
          </tr>
<?php
  }
?>
        </table></td>
      </tr>
<?php
  if (($items_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
      <tr>
        <td><table border="0" style="width:100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="smallText"><?php echo $items_new_split->display_count(TEXT_SHOW_NUMBER_OF_ITEMS_NEW); ?></td>
            <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $items_new_split->display_links(MAX_SHOW_PAGE_LINKS, go_get_all_get_parameter(array('page', 'info', 'x', 'y'))); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table>
