function execute() { global $languages_id, $HTTP_GET_VARS, $currencies, $oscTemplate; $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and r.reviews_status = 1"; if (isset($HTTP_GET_VARS['products_id'])) { $random_select .= " and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'"; } $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS; $random_product = tep_random_select($random_select); $reviews_box_contents = ''; if ($random_product) { // display random review box $rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $languages_id . "'"); $rand_review = tep_db_fetch_array($rand_review_query); $rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br />'); $reviews_box_contents .= ' <ul class="module-content boxproduct">' . ' <li class="clearfix">' . ' <a class="boxproduct-img" href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', '') . '</a>' . ' <div class="boxproduct-info">' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $rand_review_text . ' ..</a>' . ' <div class="rating-img">' . tep_draw_rating($random_product['reviews_rating']) . '</div>' . ' </div>' . ' </li>' . ' </ul>'; } elseif (isset($HTTP_GET_VARS['products_id'])) { // display 'write a review' box $reviews_box_contents .= ' <div class="module-content">' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_draw_icon('fa-pencil') . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW . '</a>' . ' </div>'; } else { // display 'no reviews' box $reviews_box_contents .= '<div class="module-content">' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</div>'; } $data = '<div class="module reviews-box">' . ' <h3 class="module-heading"><a href="' . tep_href_link(FILENAME_REVIEWS) . '">' . MODULE_BOXES_REVIEWS_BOX_TITLE . '</a></h3>' . ' ' . $reviews_box_contents . '</div>'; $oscTemplate->addBlock($data, $this->group); }
function add($class, $message, $type = 'error') { if ($type == 'error') { $this->messages[] = array('params' => 'class="alert alert-danger"', 'class' => $class, 'text' => tep_draw_icon('fa-bug') . ' ' . $message); } elseif ($type == 'warning') { $this->messages[] = array('params' => 'class="alert alert-warning"', 'class' => $class, 'text' => tep_draw_icon('fa-exclamation') . ' ' . $message); } elseif ($type == 'success') { $this->messages[] = array('params' => 'class="alert alert-success"', 'class' => $class, 'text' => tep_draw_icon('fa-info') . ' ' . $message); } else { $this->messages[] = array('params' => 'class="alert alert-danger"', 'class' => $class, 'text' => $message); } }
function execute() { global $HTTP_GET_VARS, $customer_id, $PHP_SELF, $request_type, $oscTemplate; if (isset($HTTP_GET_VARS['products_id'])) { if (tep_session_is_registered('customer_id')) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . (int) $customer_id . "'"); $check = tep_db_fetch_array($check_query); $notification_exists = $check['count'] > 0 ? true : false; } else { $notification_exists = false; } $notif_contents = ''; if ($notification_exists == true) { $notif_contents = ' <ul class="module-content">' . ' <li>' . ' <a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=notify_remove', $request_type) . '">' . tep_draw_icon('fa-chain-broken') . '</a>' . ' <a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=notify_remove', $request_type) . '">' . sprintf(MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_NOTIFY_REMOVE, tep_get_products_name($HTTP_GET_VARS['products_id'])) . '</a>' . ' </li>' . ' </ul>'; } else { $notif_contents = ' <ul class="module-content">' . ' <li>' . ' <a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=notify', $request_type) . '">' . tep_draw_icon('fa-pencil-square-o') . '</a>' . ' <a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=notify', $request_type) . '">' . sprintf(MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_NOTIFY, tep_get_products_name($HTTP_GET_VARS['products_id'])) . '</a>' . ' </li>' . ' </ul>'; } $data = '<div class="module notify-box">' . ' <h3 class="module-heading"><a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL') . '">' . MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_TITLE . '</a></h3>' . ' ' . $notif_contents . '</div>'; $oscTemplate->addBlock($data, $this->group); } }
function execute() { global $customer_id, $languages_id, $PHP_SELF, $oscTemplate; if (tep_session_is_registered('customer_id')) { // retreive the last x products purchased $orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int) $customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX); if (tep_db_num_rows($orders_query)) { $product_ids = ''; while ($orders = tep_db_fetch_array($orders_query)) { $product_ids .= (int) $orders['products_id'] . ','; } $product_ids = substr($product_ids, 0, -1); $customer_orders_string = '<ul class="module-content box-list">'; $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int) $languages_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { $customer_orders_string .= ' <li>' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a>' . ' <a class="remove" href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '">' . tep_draw_icon('fa-shopping-cart') . '</a>' . ' </li>'; } $customer_orders_string .= '</ul>'; $data = '<div class="module order-history">' . ' <h3 class="module-heading">' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</h3>' . ' ' . $customer_orders_string . '</div>'; $oscTemplate->addBlock($data, $this->group); } } }
$products_name = '<table class="aligh-top no-indent">' . ' <tr>' . ' <td class="align-top product-image"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . ' <td class="align-top product-name-td"><a class="product-name" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a>'; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; echo ' <td class="align-top no-padding">' . $products_name . '</td>' . ' <td class="align-middle quantity">' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], '') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . tep_draw_button(tep_draw_icon('fa-refresh'), 'refresh btn btn-default') . '</td>' . ' <td class="text-center align-middle td-price"><span class="price">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</span></td>' . ' <td class="text-center align-middle td-delete"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product') . '">' . tep_draw_icon('fa-trash-o') . '</a></td>' . ' </tr>'; } ?> </table> <div class="row"> <div class="sub-total col-xs-6 col-xs-offset-6"> <div class="clearfix"> <div class="col-xs-6 text-right subtotal-text"><?php echo SUB_TITLE_SUB_TOTAL; ?> </div> <div class="col-xs-6 text-right price"><?php echo $currencies->format($cart->show_total()); ?> </div> </div>
function execute() { global $languages_id, $cart, $new_products_id_in_cart, $currencies, $oscTemplate, $new_products_atribute; $request_type = getenv('HTTPS') == 'on' ? 'SSL' : 'NONSSL'; $cart_contents_string = ''; if ($request_type == 'NONSSL') { $serv = HTTP_SERVER; } else { $serv = HTTPS_SERVER; } $actual_link = str_replace($serv . DIR_WS_HTTP_CATALOG, '', $serv . $_SERVER['REQUEST_URI']); if (MODULE_BOXES_HEADER_SHOPPING_CART_DROPDOWN && MODULE_BOXES_HEADER_SHOPPING_CART_DROPDOWN == 'True') { $dropDown = ' dropdown'; } else { $dropDown = ''; } if ($cart->count_contents() > 0) { $cart_contents_string = '<ul class="infoBoxContents">'; $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix\n\t\t\t\t\t\t\t\t\t\t from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t\t\t\t\t\t\t where pa.products_id = '" . (int) $products[$i]['id'] . "'\n\t\t\t\t\t\t\t\t\t\t and pa.options_id = '" . (int) $option . "'\n\t\t\t\t\t\t\t\t\t\t and pa.options_id = popt.products_options_id\n\t\t\t\t\t\t\t\t\t\t and pa.options_values_id = '" . (int) $value . "'\n\t\t\t\t\t\t\t\t\t\t and pa.options_values_id = poval.products_options_values_id\n\t\t\t\t\t\t\t\t\t\t and popt.language_id = '" . (int) $languages_id . "'\n\t\t\t\t\t\t\t\t\t\t and poval.language_id = '" . (int) $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } $cart_contents_string .= '<li>' . '<div class="product-image">' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' . '</div>' . '<div class="product-info">' . '<span class="cart-counter">'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= '<span class="newItemInCart">'; } $cart_contents_string .= $products[$i]['quantity'] . ' x '; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= '</span>'; } $cart_contents_string .= '</span><span class="cart-product-name"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= '<span class="newItemInCart">'; } $cart_contents_string .= $products[$i]['name']; if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $cart_contents_string .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= '</span>'; } $cart_contents_string .= '</a></span><span class="price">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</span>' . '<a class="remove" href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_cart_product&actual_link=' . $actual_link . '') . '">' . tep_draw_icon('fa-times-circle') . '</a></div></li>'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { tep_session_unregister('new_products_id_in_cart'); } } $cart_contents_string .= '</ul>' . '<div class="total price"><span class="total-text">' . MODULE_BOXES_HEADER_SHOPPING_CART_SUB_TOTAL . '</span><span class="total-price">' . $currencies->format($cart->show_total()) . '</span></div>' . '<div class="cart-button">' . tep_draw_button(HEADER_TITLE_CART_CONTENTS, 'btn btn-default', tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')) . '</div>'; if ($cart->count_contents() > 1) { $productCount = $cart->count_contents() . ' ' . MODULE_BOXES_HEADER_SHOPPING_CART_BOX_ITEMS; } else { $productCount = $cart->count_contents() . ' ' . MODULE_BOXES_HEADER_SHOPPING_CART_BOX_ITEM; } } else { $productCount = MODULE_BOXES_HEADER_SHOPPING_CART_BOX_CART_EMPTY; $cart_contents_string .= '<div class="infoBoxContents">' . MODULE_BOXES_HEADER_SHOPPING_CART_BOX_CART_EMPTY . '</div>'; } $data .= '<div class="header-shopping-cart' . $dropDown . '">' . ' <h3><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_HEADER_SHOPPING_CART_BOX_TITLE . '<span class="productCount">' . $productCount . '</span></a></h3>' . ' <div class="cart-content">' . $cart_contents_string . '</div>' . '</div>'; if (MODULE_BOXES_HEADER_SHOPPING_CART_DROPDOWN && MODULE_BOXES_HEADER_SHOPPING_CART_DROPDOWN == 'True') { $data .= "<script type='text/javascript'>\n\t\t\t\t\t\$('.dropdown h3 a').on('click', function(){\n\t\t\t\t\t\tif(\$('.dropdown .cart-content').is(':hidden')) {\n\t\t\t\t\t\t\t\$('.dropdown .cart-content').show();\t\n\t\t\t\t\t\t\t\$(this).addClass('active');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\$('.dropdown .cart-content').hide();\n\t\t\t\t\t\t\t\$(this).removeClass('active');\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t});\n\t\t\t\t\t\$(document).on('click', function(e){\n\t\t\t\t\t\t\$('.dropdown .cart-content').hide();\n\t\t\t\t\t\t\$('.dropdown h3 a').removeClass('active');\t\n\t\t\t\t\t});\n\t\t\t\t\t\$('.dropdown .cart-content').on('click', function(e){\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t});\n\t\t\t\t</script>"; } if ($new_products_id_in_cart) { $popUpContent = ''; $product = $cart->get_popup_product($new_products_id_in_cart, $new_products_atribute); $popUpContent = ''; $popUpContent .= '<div class="popup-container">' . ' <div class="popup-heading">' . MODULE_BOXES_HEADER_SHOPPING_CART_SUCCESS . '</div>' . ' <div class="product-image">' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']) . '">' . tep_image(DIR_WS_IMAGES . $product['image'], $product['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' . ' </div>' . ' <div class="product-info">' . ' <a class="product-name" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']) . '">' . $product['name'] . '</a>' . ' <div class="price">' . $currencies->display_price($product['final_price'], tep_get_tax_rate($product['tax_class_id'])) . '</div>' . ' <div class="popup-button">' . tep_draw_button(HEADER_TITLE_CART_CONTENTS, 'btn btn-default', tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')) . '</div>' . ' </div>' . '</div>'; $data .= "<script type='text/javascript'>\n\t\t\t\t\tcontent = '" . $popUpContent . "';\n\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\$.fancybox({\n\t\t\t\t\t\t\t'type': 'html',\n\t\t\t\t\t\t\t'content' : content\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\t</script>"; } $oscTemplate->addBlock($data, $this->group); }
$caroucelImages .= '<div class="productThumbsWrapper"><ul id="productThumbs">'; $caroucelImages .= '<li class="thumb_1"><a href="#" data-image="' . DIR_WS_IMAGES . $product_info['products_image'] . '" data-zoom-image="' . DIR_WS_IMAGES . $product_info['products_image'] . '">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), PRODUCTTHUMB_IMAGE_WIDTH, PRODUCTTHUMB_IMAGE_HEIGHT) . '</a></li>'; while ($pi = tep_db_fetch_array($pi_query)) { $pi_counter++; if (tep_not_null($pi['htmlcontent'])) { $pi_html = $pi['htmlcontent']; } else { $pi_html = ''; } $caroucelImages .= '<li class="thumb_' . $pi_counter . '">'; $caroucelImages .= '<a href="#" data-image="' . DIR_WS_IMAGES . $pi['image'] . '" data-zoom-image="' . DIR_WS_IMAGES . $pi['image'] . '">' . tep_image(DIR_WS_IMAGES . $pi['image'], $pi_html, PRODUCTTHUMB_IMAGE_WIDTH, PRODUCTTHUMB_IMAGE_HEIGHT, 'id="piGalImg_' . $pi_counter . '"') . '</a></li>'; } $caroucelImages .= '</ul></div>'; echo $caroucelImages; if ($pi_counter > 3) { echo '<div id="allImages"><span class="closed">' . tep_draw_icon('fa-caret-down') . '</span><span class="opened">' . tep_draw_icon('fa-caret-up') . '</span></div>'; } ?> </div> <script type="text/javascript"> $(".product-image").elevateZoom({ gallery:'productThumbs', cursor: 'url(<?php echo DIR_WS_IMAGES . '/mouse.png'; ?> ),auto', galleryActiveClass: 'active', imageCrossfade: true, loadingIcon: 'http://www.elevateweb.co.uk/spinner.gif' }); $(".product-image").bind("click", function(e) { var ez = $('.product-image').data('elevateZoom'); $.fancybox(ez.getGalleryList()); return false; });