<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
require_once(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST);

if (is_array($wishlist->wishID) && !empty($wishlist->wishID)) {
  reset($wishlist->wishID);
  ?>
  <!-- wishlist //-->
  <?php
  $boxHeading = BOX_HEADING_CUSTOMER_WISHLIST;
  $corner_left = 'rounded';
  $corner_right = 'rounded';
  $boxContent_attributes = ' align="center"';
  $box_base_name = 'wishlist';
  $box_id = $box_base_name . 'Box';

  $boxContent = '<div class="whis_kont">';

    if (count($wishlist->wishID) < MAX_DISPLAY_WISHLIST_BOX) {
      $counter = 1;
      while (list($wishlist_id, ) = each($wishlist->wishID)) {
        $wishlist_id = tep_get_prid($wishlist_id);

        $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on pd.products_id = s.products_id where pd.products_id = '" . $wishlist_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");
        $products = tep_db_fetch_array($products_query);

        $boxContent .= '<div class="whis_list"><a class="boxLink" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . osc_trunc_string($products['products_name'], 50, 1) . '</a></div>';
        if (file_exists(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif')) {
            $boxContent .= '<div class="whis_line">' . tep_image(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif') . '</div>';
        }

        $counter++;
      }
      $boxContent .= '<div class="whis_img">';
      $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('small_view.gif') . '</a>';
      $boxContent .= '</div>';

    } else {

      $boxContent .= '<div class="whis_list">';
      $boxContent .= sprintf(TEXT_WISHLIST_COUNT, count($wishlist->wishID));
      $boxContent .= '</div>';
      if (file_exists(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif')) {
         $boxContent .= '<div class="whis_line">' . tep_image(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif') . '</div>';
      }
      $boxContent .= '<div class="whis_list">';
      $query_price_to_guest_result = ALLOW_GUEST_TO_SEE_PRICES;
      if ((($query_price_to_guest_result=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {
        $boxContent .= TEXT_WISHLIST_TOTAL .''. $currencies->format($wishlist->show_wishlist_total());
      }
      $boxContent .= '</div>';
      $boxContent .= '<div class="whis_img">';
      $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('small_view.gif') . '</a>';
      $boxContent .= '</div>';

    }

  $boxContent .= '</div>';
  include (bts_select('boxes', $box_base_name)); // BTS 1.5
}
?>