Tsimi

catalog/wishlist.php

Feb 11th, 2015
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.   $Id: wishlist.php, 2.3.4 revision 3  2014/11/21 Dennis Blake
  4.   osCommerce, Open Source E-Commerce Solutions
  5.   http://www.oscommerce.com
  6.  
  7.   Released under the GNU General Public License
  8. */
  9. // This version, removes the product when adding to a cart now, replaced all of the  HTTP_POST_VARS for $_POST
  10.  
  11.   require('includes/application_top.php');
  12.   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST);
  13.  
  14.     $pg = (isset($_GET['page']) ? 'page=' . $_GET['page'] : '');
  15.  
  16.   $wish_products = $wishList->get_wishlist_products();
  17.   for ($i=0, $n=sizeof($wish_products); $i<$n; $i++) {
  18. // Push all attributes information in an array
  19.     if (isset($wish_products[$i]['attributes']) && is_array($wish_products[$i]['attributes'])) {
  20.       while (list($option, $value) = each($wish_products[$i]['attributes'])) {
  21.         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
  22.                                    from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
  23.                                    where pa.products_id = '" . (int)$wish_products[$i]['id'] . "'
  24.                                    and pa.options_id = '" . (int)$option . "'
  25.                                    and pa.options_id = popt.products_options_id
  26.                                    and pa.options_values_id = '" . (int)$value . "'
  27.                                    and pa.options_values_id = poval.products_options_values_id
  28.                                    and popt.language_id = '" . (int)$languages_id . "'
  29.                                    and poval.language_id = '" . (int)$languages_id . "'");
  30.         $attributes_values = tep_db_fetch_array($attributes);
  31.         $wish_products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
  32.         $wish_products[$i][$option]['options_values_id'] = $value;
  33.         $wish_products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
  34.         $wish_products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
  35.         $wish_products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
  36.       }
  37.     }
  38.   }
  39.  
  40. /*******************************************************************
  41. ****************** ADD PRODUCT TO SHOPPING CART ********************
  42. *******************************************************************/
  43.  
  44.   if (isset($_POST['add_wishprod'])) {
  45.     if (isset($_POST['wlaction']) && $_POST['wlaction'] == 'cart') {
  46.         for ($i=0, $n=sizeof($wish_products); $i<$n; $i++) {
  47.             if (isset($_POST['add_wishprod'][$wish_products[$i]['id']]) && ($_POST['add_wishprod'][$wish_products[$i]['id']] == $wish_products[$i]['id'])) {
  48.                 $cart->add_cart($wish_products[$i]['id'], $cart->get_quantity($wish_products[$i]['id'])+(int)$_POST['quantity'][$wish_products[$i]['id']], $wish_products[$i]['attributes']);
  49.                 $wishList->remove($wish_products[$i]['id']);
  50.                 }
  51.             }
  52.             if (DISPLAY_CART == 'true') tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  53.             tep_redirect(tep_href_link(FILENAME_WISHLIST)); // reload updated wish list if not redirecting to cart
  54.         }
  55.     }
  56.  
  57. /*******************************************************************
  58. ****************** UPDATE WISH LIST QUANTITY ***********************
  59. *******************************************************************/
  60.  
  61.   if (isset($_POST['wlaction']) && $_POST['wlaction'] == 'update_qty') {
  62.       for ($i=0, $n=sizeof($wish_products); $i<$n; $i++) {
  63.             if (isset($_POST['quantity'][$wish_products[$i]['id']]) && is_numeric($_POST['quantity'][$wish_products[$i]['id']])) {
  64.                 $qty = (int)$_POST['quantity'][$wish_products[$i]['id']];
  65.                 if ($qty < 1) { // remove if quantity is 0 or less
  66.                     $wishList->remove($wish_products[$i]['id']);
  67.                 } elseif ($qty != $wish_products[$i]['quantity']) { // update if quantity has changed
  68.                     $wishList->update_quantity($wish_products[$i]['id'], $qty, $wish_products[$i]['attributes']);
  69.                 }
  70.             }
  71.         } //print_r($_POST); echo '<br><br><br><br>'; print_r($products);
  72.         tep_redirect(tep_href_link(FILENAME_WISHLIST, $pg)); // reload updated wish list
  73.     }
  74.  
  75. /*******************************************************************
  76. ****************** DELETE PRODUCT FROM WISHLIST ********************
  77. *******************************************************************/
  78.  
  79.   if (isset($_POST['add_wishprod'])) {
  80.     if (isset($_POST['wlaction']) && $_POST['wlaction'] == 'delete') {
  81.         foreach ($_POST['add_wishprod'] as $key => $value) {
  82.             if ($key == $value) $wishList->remove($value);
  83.           }
  84.             tep_redirect(tep_href_link(FILENAME_WISHLIST)); // reload updated wish list
  85.       }
  86.   }
  87.  
  88. /*******************************************************************
  89. ************* EMAIL THE WISHLIST TO MULTIPLE FRIENDS ***************
  90. *******************************************************************/
  91.  
  92.     $wishlist_not_empty = ($wishList->count_contents() > 0);
  93.     $error = false;
  94.     $guest_errors = "";
  95.     $email_errors = "";
  96.     $message_error = "";
  97.     $from_name = $from_email = '';
  98.     for ($x = 0; $x < DISPLAY_WISHLIST_EMAILS; $x++) $friend[$x] = $email[$x] = '';
  99.   if (isset($_POST['wlaction']) && ($_POST['wlaction'] == 'email') && isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken) && $wishlist_not_empty) {
  100.  
  101.     $message = tep_db_prepare_input($_POST['message']);
  102.         if(strlen($message) < 1) {
  103.             $error = true;
  104.             $message_error .= "<div class=\"alert alert-danger\">" . ERROR_MESSAGE . "</div>";
  105.         }          
  106.     // check for links to other web sites, a sign that a spammer is trying to use this site to send spam
  107.     $protocols = array('http://', 'https://', 'file://', 'ftp://', 'news://', 'mailto:', 'telnet://', 'ssh:');
  108.     $check = strtolower($message);
  109.     $thisdomain = HTTP_SERVER;
  110.     $thisdomain = strtolower(substr($thisdomain, strpos($thisdomain, '://') + 3));
  111.     foreach ($protocols as $p ) {
  112.       $x = 0;
  113.       while (strpos($check, $p, $x) !== false) {
  114.         $x = strpos($check, $p, $x) + strlen($p);
  115.         if ((substr($check, $x, strlen($thisdomain)) != $thisdomain) || !preg_match('/\/|\s/', substr($check, $x + strlen($thisdomain), 1))) {
  116.           $error = true;
  117.           $message_error .= "<div class=\"alert alert-danger\">" . ERROR_INVALID_LINK . "</div>";
  118.         }
  119.       }
  120.     }
  121.  
  122.         if(tep_session_is_registered('customer_id')) { // logged in
  123.             $customer_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
  124.         if (tep_db_num_rows($customer_query) != 1 ) tep_redirect(tep_href_link(FILENAME_LOGOFF, '', 'SSL')); // invalid customer id
  125.         $customer = tep_db_fetch_array($customer_query);
  126.    
  127.             $from_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
  128.             $from_email = $customer['customers_email_address'];
  129.             $subject = $customer['customers_firstname'] . ' ' . WISHLIST_EMAIL_SUBJECT;
  130.             $link = tep_href_link(FILENAME_WISHLIST_PUBLIC, "public_id=" . $customer_id);
  131.    
  132.             $body = $message . sprintf(WISHLIST_EMAIL_LINK, $from_name, $link, $link);
  133.         } else { // guest
  134.             $from_name = tep_db_prepare_input($_POST['your_name']);
  135.             $from_email = tep_db_prepare_input($_POST['your_email']);
  136.             if(strlen($from_name) < 1) {
  137.                 $error = true;
  138.                 $guest_errors .= "<div class=\"alert alert-danger\">" . ERROR_YOUR_NAME . "</div>";
  139.             }
  140.             if(strlen($from_email) < 1) {
  141.                 $error = true;
  142.                 $guest_errors .= "<div class=\"alert alert-danger\">" .ERROR_YOUR_EMAIL . "</div>";
  143.             } elseif(!tep_validate_email($from_email)) {
  144.                 $error = true;
  145.                 $guest_errors .= "<div class=\"alert alert-danger\">" . ERROR_VALID_EMAIL . "</div>";
  146.             }
  147.  
  148.             $subject = $from_name . ' ' . WISHLIST_EMAIL_SUBJECT;
  149.  
  150.             $prods = "";
  151.             for ($i=0, $n=sizeof($wish_products); $i<$n; $i++) {
  152.                 $prods .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wish_products[$i]['id']) .'">' . $wish_products[$i]['name'] . "\n";
  153.         if (isset($wish_products[$i]['attributes']) && is_array($wish_products[$i]['attributes']))
  154.           foreach($wish_products[$i]['attributes'] as $option => $value) {
  155.                         $prods .= "  " . $wish_products[$i][$option]['products_options_name'] . ": " . $wish_products[$i][$option]['products_options_values_name'] . "\n";
  156.                     }
  157.                 $prods .= "  " . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wish_products[$i]['id']) . "</a>\n\n";
  158.             }
  159.             $body = $message . "\n\n" . $prods . "\n\n" . $from_name . WISHLIST_EMAIL_GUEST;
  160.       }
  161.  
  162.         //Check each posted name => email for errors.
  163.     $email = tep_db_prepare_input($_POST['email']);
  164.     $friend = tep_db_prepare_input($_POST['friend']);
  165.         for ($j=0; $j < sizeof($friend); $j++) {
  166.           $friend[$j] = $friend[$j];
  167.             if($j == 0) {
  168.                 if($friend[0] == '' && $email[0] == '') {
  169.                     $error = true;
  170.                     $email_errors .= "<div class=\"alert alert-danger\">" . ERROR_ONE_EMAIL . "</div>";
  171.                 }
  172.             }
  173.  
  174.             if(isset($friend[$j]) && $friend[$j] != '') {
  175.                 if(strlen($email[$j]) < '1') {
  176.                     $error = true;
  177.                     $email_errors .= "<div class=\"alert alert-danger\">" . ERROR_ENTER_EMAIL . "</div>";
  178.                 } elseif(!tep_validate_email($email[$j])) {
  179.                     $error = true;
  180.                     $email_errors .= "<div class=\"alert alert-danger\">" . ERROR_VALID_EMAIL . "</div>";
  181.                 }
  182.             }
  183.  
  184.             if(isset($email[$j]) && $email[$j] != '') {
  185.                 if(strlen($friend[$j]) < '1') {
  186.                     $error = true;
  187.                     $email_errors .= "<div class=\"alert alert-danger\">" . ERROR_ENTER_NAME . "</div>";
  188.                 }
  189.             }
  190.         }
  191.  
  192.     // check for attempt to send email from another page besides this sites Wish List script
  193.     if (substr($_SERVER['HTTP_REFERER'], 0, strpos($_SERVER['HTTP_REFERER'], '.php') + 4) != tep_href_link(FILENAME_WISHLIST)) {
  194.       if (tep_session_is_registered('customer_id')) {
  195.         $cid = $customer_id;
  196.       } else {
  197.         $cid = TEXT_SPAM_NO_ID;
  198.       }
  199.       $spammsg = sprintf(TEXT_SPAM_MESSAGE, date('l F j, Y  H:i:s'), $cid, $from_name, $from_email, $_SERVER['HTTP_REFERER'], tep_get_ip_address(), $_SERVER['REMOTE_PORT'], $_SERVER['HTTP_USER_AGENT']) . $message;
  200.       tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, TEXT_SPAM_SUBJECT, $spammsg, $from_name, $from_email);
  201.       foreach ($_SESSION as $key => $value) unset($_SESSION[$key]);
  202.       echo ERROR_SPAM_BLOCKED;
  203.       tep_exit();
  204.     }
  205.  
  206.     $actionRecorder = new actionRecorder('ar_wish_list', (tep_session_is_registered('customer_id') ? $customer_id : null), $from_name);
  207.     if (!$actionRecorder->canPerform()) {
  208.       $error = true;
  209.  
  210.       $actionRecorder->record(false);
  211.  
  212.       $messageStack->add('wishlist', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_WISH_LIST_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_WISH_LIST_EMAIL_MINUTES : 15)));
  213.     }
  214.  
  215.         if($error == false) {
  216.             for ($j=0; $j < sizeof($friend); $j++) {
  217.                 if($friend[$j] != '') {
  218.                     tep_mail($friend[$j], $email[$j], $subject, $friend[$j] . ",\n\n" . $body, $from_name, $from_email);
  219.                 }
  220.             //Clear Values
  221.                 $friend[$j] = "";
  222.                 $email[$j] = "";
  223.             }
  224.             $message = "";
  225.             $actionRecorder->record();
  226.         $messageStack->add('wishlist', WISHLIST_SENT, 'success');
  227.         }
  228.   }
  229.  
  230.  $breadcrumb->add(NAVBAR_TITLE_WISHLIST, tep_href_link(FILENAME_WISHLIST, '', 'SSL'));
  231.  
  232.  require(DIR_WS_INCLUDES . 'template_top.php');
  233. ?>
  234. <?php  
  235.   if ($messageStack->size('wishlist') > 0) {
  236.     echo $messageStack->output('wishlist');
  237.   }
  238. ?>
  239. <?php echo $guest_errors; ?>
  240. <?php echo $email_errors; ?>
  241. <?php echo $message_error; ?>
  242.  
  243. <h1><?php echo HEADING_TITLE; ?></h1>
  244. <div class="contentContainer">
  245. <?php echo tep_draw_form('wishlist_form', tep_href_link(FILENAME_WISHLIST, $pg), 'post', 'class="form-horizontal"', true);
  246.  
  247. // display split-page-number-links
  248.     function wlist_display_links($max_page_links, $parameters = '') {
  249.       global $request_type, $pages, $page;
  250.  
  251.       $display_links_string = '';
  252.       if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';
  253.  
  254. // previous button - not displayed on first page
  255.       if ($page > 1) {
  256.         $display_links_string .= '<li><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . ($page - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' ">&laquo;</a></li>';
  257.       } else {
  258.         $display_links_string .= '<li class="disabled"><span>&laquo;</span></li>';
  259.       }
  260. // check if number_of_pages > $max_page_links
  261.       $cur_window_num = intval($page / $max_page_links);
  262.       if ($page % $max_page_links) $cur_window_num++;
  263.  
  264.       $max_window_num = intval($pages / $max_page_links);
  265.       if ($pages % $max_page_links) $max_window_num++;
  266.  
  267. // previous window of pages
  268.       if ($cur_window_num > 1) $display_links_string .= '<li><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a></li>';
  269.  
  270. // page nn button
  271.       for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $pages); $jump_to_page++) {
  272.         if ($jump_to_page == $page) {
  273.           $display_links_string .= '<li class="active"><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . $jump_to_page, $request_type) . '" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '<span class="sr-only">(current)</span></a></li>';
  274.         } else {
  275.           $display_links_string .= '<li><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '</a></li>';
  276.         }
  277.       }
  278.  
  279. // next window of pages
  280.       if ($cur_window_num < $max_window_num) $display_links_string .= '<li><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a></li>';
  281.  
  282. // next button
  283.       if (($page < $pages) && ($pages != 1)) {
  284.         $display_links_string .= '<li><a href="' . tep_href_link(FILENAME_WISHLIST, $parameters . 'page=' . ($page + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' ">&raquo;</a></li>';
  285.       } else {
  286.         $display_links_string .= '<li class="disabled"><span>&raquo;</span></li>';
  287.       }
  288.       return $display_links_string;
  289.       }
  290.  
  291. if ($wishList->count_contents() > 0) {
  292.   $n=sizeof($wish_products);
  293.     $pages = ceil($n / MAX_DISPLAY_WISHLIST_PRODUCTS);
  294.     $page = (isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1);
  295.     if ($page > $pages) $page = $pages;
  296.     $offset = (MAX_DISPLAY_WISHLIST_PRODUCTS * ($page - 1));
  297.     $limit = $page * MAX_DISPLAY_WISHLIST_PRODUCTS;
  298.     if ($limit > $n) $limit = $n;
  299.  
  300.     if ($n > 0 && (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3')) {
  301. ?>
  302.  
  303. <div class="row">
  304.   <div class="col-sm-6 pagenumber hidden-xs">
  305.     <?php echo sprintf(TEXT_DISPLAY_NUMBER_OF_WISHLIST, $offset+1, $limit, $n); ?>
  306.   </div>
  307.   <div class="col-sm-6">
  308.     <div class="pull-right pagenav"><ul class="pagination"><?php echo wlist_display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></ul></div>
  309.  <span class="pull-right"><?php echo TEXT_RESULT_PAGE; ?></span>
  310.   </div>
  311. </div> 
  312.  
  313. <?php
  314.   }
  315. ?>
  316.   <table class="table table-striped table-hover table-responsive">
  317.   <thead>
  318.     <tr>
  319.         <th class="text-center hidden-xs"><?php echo BOX_TEXT_IMAGE; ?></th>
  320.         <th><?php echo BOX_TEXT_PRODUCT; ?></th>
  321.         <th><?php echo BOX_TEXT_QTY; ?></th>
  322.         <th class="text-center"><?php echo BOX_TEXT_PRICE; ?></th>
  323.         <th class="text-center"><?php echo BOX_TEXT_SELECT; ?></th>
  324.     </tr>
  325.     </thead>
  326.     <tbody>
  327. <?php for ($i=$offset; $i<$limit; $i++) { ?>
  328.     <tr>
  329.       <td class="hidden-xs"><?php
  330.                $image = '';
  331.                  if (isset($wish_products[$i]['image_display']) && isset($wish_products[$i]['image_folder'])) { // if using protected images contribution
  332.            if ($wish_products[$i]['image_display'] == 1) {
  333.              $image = tep_image(DIR_WS_LANGUAGES . $language . '/images/' . 'no_picture.gif', TEXT_NO_PICTURE, SMALL_IMAGE_WIDTH*0.5, SMALL_IMAGE_HEIGHT*0.5);
  334.            } elseif (($wish_products[$i]['image_display'] != 2) && tep_not_null($wish_products[$i]['image'])) {
  335.              $image = tep_image(DIR_WS_IMAGES_THUMBS . $wish_products[$i]['image_folder'] . $wish_products[$i]['image'], $wish_products[$i]['name'], SMALL_IMAGE_WIDTH*0.5, SMALL_IMAGE_HEIGHT*0.5);
  336.            }
  337.                  } else { // using standard osCommerce images
  338.                      $image = tep_image(DIR_WS_IMAGES . $wish_products[$i]['image'], $wish_products[$i]['name'], SMALL_IMAGE_WIDTH*0.5, SMALL_IMAGE_HEIGHT*0.5);
  339.                  }
  340.                if ($wish_products[$i]['products_status'] == 0) {
  341.                      echo $image;
  342.                  } else {
  343.            echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wish_products[$i]['id'], 'NONSSL') . '">' . $image . '</a>';
  344.          } ?></td>
  345.         <td class="text-left"><strong><?php
  346.                   if($wish_products[$i]['products_status'] == 0) {
  347.                       echo $wish_products[$i]['products_name'];
  348.                     }   else {
  349.                       echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wish_products[$i]['id'], 'NONSSL') .'">' . $wish_products[$i]['name'] . '</a>';
  350.           }
  351.                     echo '</strong>';
  352.                     $att_name = "";
  353.           if (isset($wish_products[$i]['attributes']) && is_array($wish_products[$i]['attributes'])) {
  354.                         $att_name = "<small><em>";
  355.             foreach($wish_products[$i]['attributes'] as $option => $value) {
  356.                           $att_name .= "<br />" . $wish_products[$i][$option]['products_options_name'] . ": " . $wish_products[$i][$option]['products_options_values_name'];
  357.                       }
  358.                         $att_name .= '</em></small>';
  359.           }
  360.                     echo $att_name;
  361. /*******************************************************************
  362. ******* CHECK TO SEE IF PRODUCT HAS BEEN ADDED TO THEIR CART *******
  363. *******************************************************************/
  364.  
  365.             if ($cart->in_cart($wish_products[$i]['id'])) {
  366.                 echo '<br /><strong style="color: red">' . TEXT_ITEM_IN_CART . '</strong>';
  367.             }
  368.  
  369. /*******************************************************************
  370. ********** CHECK TO SEE IF PRODUCT IS NO LONGER AVAILABLE **********
  371. *******************************************************************/
  372.  
  373.             if ($wish_products[$i]['products_status'] == 0) {
  374.                 echo '<br /><strong style="color: red">' . TEXT_ITEM_NOT_AVAILABLE . '</strong>';
  375.             }
  376. ?></td>
  377. <!-- ADDITIONAL WORKAROUND FOR WISHLIST PUBLIC ISSUE //-->
  378. <td><?php
  379. if (($wish_products[$i]['products_status'] == 0) || ($cart->in_cart($wish_products[$i]['id']))) {
  380.     echo tep_draw_input_field('quantity[' . $wish_products[$i]['id'] . ']', $wish_products[$i]['quantity'], 'style="width:60px; text-align:center;" disabled');
  381. } else {
  382.     echo tep_draw_input_field('quantity[' . $wish_products[$i]['id'] . ']', $wish_products[$i]['quantity'], 'style="width:60px; text-align:center;"');
  383. }
  384. ?></td>
  385. <!-- EOF ADDITIONAL WORKAROUND FOR WISHLIST PUBLIC ISSUE //-->
  386.     <td class="text-center">
  387.         <?php
  388.             $attributes_addon_price = $wishList->attributes_price($wish_products[$i]['id']);
  389.             if (isset($wish_products[$i]['sale_price'])) {
  390.                 $products_price = '<span class="price-new-wish"><strong>' . $currencies->display_price($wish_products[$i]['sale_price']+$attributes_addon_price, tep_get_tax_rate($wish_products[$i]['tax_class_id']), $wish_products[$i]['quantity']) . '</strong></span>';
  391.                 if (tep_not_null($wish_products[$i]['sale_expires'])) $products_price .= '<br /><small>' . BOX_TEXT_SALE_EXPIRES .  $wish_products[$i]['sale_expires'] . '</small>';
  392.                 $products_price .= '<span class="price-old-wish">' . $currencies->display_price($wish_products[$i]['price']+$attributes_addon_price, tep_get_tax_rate($wish_products[$i]['tax_class_id']), $wish_products[$i]['quantity']) . '</span>';
  393.             } else {
  394.                 $products_price = '<span class="price-new-wish"><strong>' . $currencies->display_price($wish_products[$i]['price']+$attributes_addon_price, tep_get_tax_rate($wish_products[$i]['tax_class_id']), $wish_products[$i]['quantity']) . '</strong></span>';
  395.             }
  396.             echo $products_price;
  397.         ?>
  398.     </td>
  399.     <td class="text-center"><?php
  400.  
  401. /*******************************************************************
  402. * PREVENT THE ITEM FROM BEING ADDED TO CART IF NO LONGER AVAILABLE *
  403. *******************************************************************/
  404.     // ADDITIONAL WORKAROUND FOR WISHLIST PUBLIC ISSUE
  405.          if (($wish_products[$i]['products_status'] == 0) || ($cart->in_cart($wish_products[$i]['id']))) {
  406.                 echo '';
  407.               } else {
  408.                 echo tep_draw_checkbox_field('add_wishprod[' . $wish_products[$i]['id'] . ']', $wish_products[$i]['id']);
  409.               }
  410.     // EOF ADDITIONAL WORKAROUND FOR WISHLIST PUBLIC ISSUE
  411. ?></td>
  412.     </tr>
  413. <?php } ?>
  414.     </tbody>
  415.   </table>
  416.   <hr />
  417.   <p class="text-right"><strong><?php echo TEXT_WISHLIST_TOTAL . $currencies->format($wishList->show_total()); ?></strong></p>
  418.   <br />
  419.   <br />
  420. <?php
  421.   if ($n > 0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) {
  422. ?>
  423. <div class="row">
  424.   <div class="col-sm-6 pagenumber hidden-xs">
  425.     <?php echo sprintf(TEXT_DISPLAY_NUMBER_OF_WISHLIST, $offset+1, $limit, $n); ?>
  426.   </div>
  427.   <div class="col-sm-6">
  428.     <div class="pull-right pagenav"><ul class="pagination"><?php echo wlist_display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></ul></div>
  429.  <span class="pull-right"><?php echo TEXT_RESULT_PAGE; ?></span>
  430.   </div>
  431. </div> 
  432. <?php
  433.     }
  434. ?>
  435.  
  436. <div class="row">
  437. <div class="col-sm-4" style="margin-top:10px;">
  438. <?php echo tep_draw_button(BUTTON_TEXT_DELETE, 'glyphicon glyphicon-trash', null, 'primary', array('params' => 'name="wlaction" value="delete"'), 'btn btn-danger'); ?>
  439. </div>  
  440. <div class="col-sm-4 text-center" style="margin-top:10px;">
  441. <?php echo tep_draw_button(BUTTON_UPDATE_QTY, 'glyphicon glyphicon-refresh', null, 'primary', array('params' => 'name="wlaction" value="update_qty"'), 'btn btn-primary'); ?>
  442. </div>  
  443. <div class="col-sm-4 text-right" style="margin-top:10px;">
  444. <?php echo tep_draw_button(BUTTON_TEXT_ADD_CART, 'glyphicon glyphicon-shopping-cart', null, 'primary', array('params' => 'name="wlaction" value="cart"'), 'btn btn-success'); ?>
  445. </div>
  446. </div>  
  447. <br />
  448. <!--
  449. /*******************************************************************
  450. *********** CODE TO SPECIFY HOW MANY EMAILS TO DISPLAY *************
  451. *******************************************************************/
  452. //-->
  453. <?php if(!tep_session_is_registered('customer_id')) { ?>
  454.  
  455.    <div class="alert alert-info">
  456.         <?php
  457.             echo '<a style="cursor:pointer;" data-toggle="modal" data-target="#ModalWishHelp"><strong>' . TEXT_WISHLIST_HELP . '</strong></a><br />';
  458.             echo WISHLIST_EMAIL_TEXT_GUEST;
  459.         ?>
  460.     </div>
  461.     <span class="inputRequirement pull-right text-right"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
  462.     <div class="form-group has-feedback">
  463.       <label for="wishName" class="control-label col-sm-3"><?php echo TEXT_YOUR_NAME; ?></label>
  464.       <div class="col-sm-6">
  465.         <?php
  466.             echo tep_draw_input_field('your_name', NULL, 'id="wishName" placeholder="' . ENTRY_WISH_NAME . '"', $from_name);
  467.             echo FORM_REQUIRED_INPUT;
  468.         ?>
  469.        </div>
  470.     </div> 
  471.     <div class="form-group has-feedback">
  472.       <label for="wishEmail" class="control-label col-sm-3"><?php echo TEXT_YOUR_EMAIL; ?></label>
  473.       <div class="col-sm-6">
  474.         <?php
  475.             echo tep_draw_input_field('your_email', NULL, 'id="wishEmail" placeholder="' . ENTRY_WISH_EMAIL_ADDRESS . '"', $from_email);   
  476.             echo FORM_REQUIRED_INPUT;
  477.         ?>
  478.       </div>
  479.     </div>
  480.  <hr />
  481.   <?php
  482.     } else {
  483. ?>
  484.        <div class="alert alert-info">
  485.         <?php
  486.             echo '<a style="cursor:pointer;" data-toggle="modal" data-target="#ModalWishHelp"><strong>' . TEXT_WISHLIST_HELP . '</strong></a><br />';
  487.             echo WISHLIST_EMAIL_TEXT;
  488.         ?>
  489.     </div>
  490.   <?php
  491.     }
  492. ?>
  493.  
  494.   <?php
  495.     $email_counter = 0;
  496. ?>
  497. <?php
  498.     while($email_counter < DISPLAY_WISHLIST_EMAILS) {
  499. ?>
  500.  
  501.         <div class="form-group has-feedback">
  502.           <label for="recvName" class="control-label col-sm-3"><?php echo TEXT_NAME; ?></label>
  503.           <div class="col-sm-6">
  504.             <?php
  505.                 echo tep_draw_input_field('friend[]', NULL, 'id="recvName" placeholder="' . ENTRY_NAME . '"', $friend[$email_counter]);
  506.                 echo FORM_REQUIRED_INPUT;
  507.             ?>
  508.            </div>
  509.         </div> 
  510.         <div class="form-group has-feedback">
  511.           <label for="recvEmail" class="control-label col-sm-3"><?php echo TEXT_EMAIL; ?></label>
  512.           <div class="col-sm-6">
  513.             <?php
  514.                 echo tep_draw_input_field('email[]', NULL, 'id="recvEmail" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', $email[$email_counter]);
  515.                 echo FORM_REQUIRED_INPUT;
  516.             ?>
  517.            </div>
  518.         </div>
  519. <hr />
  520. <?php
  521.     $email_counter++;
  522.     }
  523. ?>
  524.  
  525.   <div class="form-group has-feedback">
  526.     <label for="wishMessage" class="control-label col-sm-3"><?php echo TEXT_MESSAGE; ?></label>
  527.    <div class="col-sm-7">
  528.     <?php
  529.         echo tep_draw_textarea_field('message', 'soft', 45, 5, NULL, 'id="wishMessage" placeholder="' . ENTRY_MESSAGE . '"');
  530.         echo FORM_REQUIRED_INPUT;
  531.     ?>
  532.    </div>
  533.   </div>
  534.   <p class="text-right"><?php echo tep_draw_button(WISHLIST_EMAIL_BUTTON, 'glyphicon glyphicon-envelope', null, 'primary', array('params' => 'name="wlaction" value="email"')); ?></p>
  535.  
  536. <?php
  537. } else { // Nothing in the customers wishlist
  538. ?>
  539.   <div class="alert alert-danger"><?php echo BOX_TEXT_NO_ITEMS; ?></div>
  540.   <p><?php echo '<a style="cursor:pointer;" data-toggle="modal" data-target="#ModalWishHelp"><strong>' . TEXT_WISHLIST_HELP . '</strong></a>';?></p>
  541.   <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'glyphicon glyphicon-chevron-right', tep_href_link(FILENAME_DEFAULT)); ?></div>
  542. <?php } ?>
  543.   </form>
  544. </div> <!-- .contentContainer //-->
  545. <?php
  546.   require(DIR_WS_INCLUDES . 'template_bottom.php');
  547.   require(DIR_WS_INCLUDES . 'application_bottom.php');
  548. ?>
  549.  
  550. <div class="modal fade" id="ModalWishHelp" tabindex="-1" role="dialog" >
  551. <div class="modal-dialog">
  552.   <div class="modal-content">
  553.     <div class="modal-header">
  554.       <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times; </button>
  555.       <h3 class="modal-title-site text-center" ><?php echo TEXT_WISHLIST_HELP_TITLE; ?> </h3>
  556.     </div> <!-- /.modal-header -->
  557.     <div class="modal-body">
  558.         <?php echo TEXT_INFORMATION; ?>
  559.     </div> <!-- /.modal-body -->
  560.     <div class="modal-footer">
  561.         <button type="button" class="btn btn-default" data-dismiss="modal"><i class="glyphicon glyphicon-remove"></i><?php echo IMAGE_BUTTON_CLOSE;?></button>
  562.     </div> <!-- /.modal-footer -->
  563.   </div> <!-- /.modal-content -->
  564. </div> <!-- /.modal-dialog -->
  565. </div> <!-- /.Modal Login -->
RAW Paste Data