<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/

  require('includes/application_top.php');
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST);

  if(!isset($_GET['public_id'])) {
    tep_redirect(tep_href_link(FILENAME_DEFAULT));
  }

  $public_id = $_GET['public_id'];

  /*******************************************************************
  ****************** QUERY CUSTOMER INFO FROM ID *********************
  *******************************************************************/

  $customer_query = tep_db_query("select customers_firstname from " . TABLE_CUSTOMERS . " where customers_id = '" . $public_id . "'");
  $customer = tep_db_fetch_array($customer_query);

  /*******************************************************************
  ****************** ADD PRODUCT TO SHOPPING CART ********************
  *******************************************************************/
  if (isset($HTTP_POST_VARS['add_wishprod'])) {
    foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
      $product_id = tep_get_prid($value);
      if ( $HTTP_POST_VARS['przycisk'] == $value ) {
        $cart->add_cart($product_id, $cart->get_quantity(tep_get_uprid($product_id, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);
        $messageStack->add('wishlist', WISHLIST_ADD_TO_CART, 'success');
      }
    }
//    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }


  $breadcrumb->add(NAVBAR_TITLE_WISHLIST, tep_href_link(FILENAME_WISHLIST, '', 'SSL'));

  $content = 'wishlist_public';

  include (bts_select('main', $content_template)); // BTSv1.5

  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>