// | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.zen-cart.com/license/2_0.txt. | // | If you did not receive a copy of the zen-cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | license@zen-cart.com so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: specials.php 1266 2005-04-29 02:51:24Z ajeh $ // // test if box should display $show_specials = false; if (isset($_GET['products_id'])) { $show_specials = false; } else { $show_specials = true; } if ($show_specials == true) { $random_specials_sidebox_product_query = "select p.products_id, pd.products_name, p.products_price,\r\n p.products_tax_class_id, p.products_image,\r\n s.specials_new_products_price\r\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s\r\n where p.products_status = '1'\r\n and p.products_id = s.products_id\r\n and pd.products_id = s.products_id\r\n and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\r\n and s.status = '1'\r\n limit " . MAX_RANDOM_SELECT_SPECIALS; $random_specials_sidebox_product = zen_random_select($random_specials_sidebox_product_query); if ($random_specials_sidebox_product->RecordCount() > 0) { $specials_box_price = zen_get_products_display_price($random_specials_sidebox_product->fields['products_id']); require $template->get_template_dir('tpl_specials.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_specials.php'; $title = BOX_HEADING_SPECIALS; $left_corner = false; $right_corner = false; $right_arrow = false; $title_link = FILENAME_SPECIALS; require $template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base, 'common') . '/' . $column_box_default; } }
function zen_rss_products($sql_products, $random) { global $db, $currencies, $rss, $additionalURL; $imageSize = isset($_GET['imgsize']) ? $_GET['imgsize'] : RSS_DEFAULT_IMAGE_SIZE; //IFNULL(, 0)?????? $sql_maxdate = "SELECT GREATEST(MAX(products_date_added), MAX(IFNULL(products_last_modified, 0))) as max_date\n FROM " . TABLE_PRODUCTS . "\n WHERE products_status = 1"; $maxdate = $db->Execute($sql_maxdate); if (!$maxdate->EOF) { $rss->rss_feed_set('lastBuildDate', date('r', strtotime($maxdate->fields['max_date']))); } if ($random) { $products = zen_random_select($sql_products); } else { $products = $db->Execute($sql_products); } $cashTaxRate = array(); while (!$products->EOF) { $info_page = zen_get_info_page($products->fields['products_id']); $xtags = array(); if (RSS_PRODUCTS_PRICE == 'true' && $products->fields['price'] > 0) { if (!isset($cashTaxRate[$products->fields['products_tax_class_id']])) { $cashTaxRate[$products->fields['products_tax_class_id']] = zen_get_tax_rate($products->fields['products_tax_class_id']); } $xtags['g:price'] = number_format(zen_add_tax($products->fields['price'] * $currencies->get_value($_SESSION['currency']), $cashTaxRate[$products->fields['products_tax_class_id']]), $currencies->get_decimal_places($_SESSION['currency']), '.', ''); // $xtags['c:price_formatted type="string"'] = zen_get_products_display_price($products->fields['products_id']); // $xtags['c:price_formatted type="string"'] = $currencies->display_price($products->fields['price'], $cashTaxRate[$products->fields['products_tax_class_id']]); } if (RSS_PRODUCTS_CURRENCY == 'true') { $xtags['g:currency'] = $_SESSION["currency"] == 'RUR' ? 'RUB' : $_SESSION["currency"]; } if (RSS_PRODUCTS_ID == 'true') { $xtags['g:id'] = $products->fields['products_id']; } if (RSS_PRODUCTS_WEIGHT == 'true' && $products->fields['products_weight'] > 0) { $xtags['g:weight'] = $products->fields['products_weight']; } if (RSS_PRODUCTS_BRAND == 'true' && zen_not_null($products->fields['manufacturers_name'])) { $xtags['g:brand'] = $rss->_clear_string($products->fields['manufacturers_name']); } if (RSS_PRODUCTS_QUANTITY == 'true' && $products->fields['products_quantity'] > 0) { $xtags['g:quantity'] = $products->fields['products_quantity']; } if (RSS_PRODUCTS_MODEL == 'true' && zen_not_null($products->fields['products_model'])) { $xtags['g:model_number'] = $rss->_clear_string($products->fields['products_model']); } if (RSS_PRODUCTS_RATING == 'true' && zen_not_null($products->fields['reviews_rating'])) { $xtags['g:rating'] = $products->fields['reviews_rating']; } // rating - The rating of the item. Format: Text. XML example: <g:rating>4 stars</g:rating> /* image_link The URL of an associated image for the item. Use your full-sized images; do not use thumbnail images. If you do not have an image available, leave the attribute blank. Do not include logos or an image that says, "Image not available." Format: URL. (Must include the http:// portion.) Up to 10 URLs can be included. For XML, include each URL as a separate <image_link> attribute. XML example: <g:image_link>http://www.example.com/image1.jpg</g:image_link> <g:image_link>http://www.example.com/image2.jpg</g:image_link> */ if (RSS_PRODUCTS_IMAGES == 'true' && zen_not_null($products->fields['products_image'])) { $products_image = ltrim($products->fields['products_image'], '/'); require DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE); switch ($imageSize) { case 'small': $xtags['g:image_link'][0] = HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $rss->_clear_url($products_image); break; case 'medium': $xtags['g:image_link'][0] = HTTP_SERVER . DIR_WS_CATALOG . $rss->_clear_url($products_image_medium); break; case 'large': default: $xtags['g:image_link'][0] = HTTP_SERVER . DIR_WS_CATALOG . $rss->_clear_url($products_image_large); break; } if (isset($_GET['products_id']) || isset($_GET['products_model'])) { require DIR_WS_MODULES . zen_get_module_directory('additional_images.php'); $num_images = min(9, $num_images); for ($i = 0, $n = $num_images; $i < $n; $i++) { $file = $images_array[$i]; $products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . 'large/', $products_image_directory) . str_replace($products_image_extension, '', $file) . IMAGE_SUFFIX_LARGE . $products_image_extension; $flag_has_large = file_exists($products_image_large); $products_image_large = $flag_has_large ? $products_image_large : $products_image_directory . $file; $xtags['g:image_link'][] = HTTP_SERVER . DIR_WS_CATALOG . $rss->_clear_url($products_image_large); } } } $link = zen_href_link($info_page, 'products_id=' . $products->fields['products_id'] . $additionalURL, 'NONSSL', false); $products_description = $products->fields['products_description']; if (RSS_PRODUCTS_DESCRIPTION_IMAGE == 'true' && zen_not_null($products->fields['products_image'])) { $image_url = zen_image(DIR_WS_IMAGES . $products->fields['products_image'], $products->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'style="float: left; margin: 0px 8px 8px 0px;"'); $image_url = str_replace('<img src="', '<img src="' . HTTP_SERVER . DIR_WS_CATALOG, $image_url); $image_link = '<a href="' . $link . '">' . $image_url . '</a>'; if (RSS_STRIP_TAGS == 'true') { $products_description = '<![CDATA[' . $image_link . ']]>' . $products_description; } else { $products_description = $image_link . $products_description; } } if (RSS_PRODUCTS_DESCRIPTION_BUYNOW == 'true') { /* $buynow_link = '<br /><br />' . zen_draw_form('cart_quantity', $link . '&action=add_product', 'post', 'enctype="multipart/form-data" target="_blank"') . "\n"; // $buynow_link .= '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($products->fields['products_id'])) . '" maxlength="6" size="4" />' . zen_get_products_quantity_min_units_display((int)$products->fields['products_id']); $buynow_link .= zen_draw_hidden_field('cart_quantity', zen_get_buy_now_qty($products->fields['products_id'])); $buynow_link .= zen_draw_hidden_field('products_id', (int)$products->fields['products_id']); $buynow_link .= str_replace('<img src="', '<img src="' . HTTP_SERVER . DIR_WS_CATALOG, zen_image_submit(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT)); $buynow_link .= '</form>'; */ $buynow_button = str_replace('<img src="', '<img src="' . HTTP_SERVER . DIR_WS_CATALOG, zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT)); $buynow_button = preg_replace('@onmouseover="[^"]*"@i', '', $buynow_button); $buynow_button = preg_replace('@onmouseout="[^"]*"@i', '', $buynow_button); $buynow_button = str_replace(' >', '>', $buynow_button); // $buynow_link = '<br /><br />' . '<a href="' . $link . '&action=buy_now' . '" target="_blank">' . $buynow_button . '</a>' . "\n"; $buynow_link = '<br /><br />' . '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products->fields['products_id'] . '&action=buy_now' . $additionalURL, 'SSL', false) . '" target="_blank">' . $buynow_button . '</a>' . "\n"; if (RSS_STRIP_TAGS == 'true') { $products_description .= "\n" . '<![CDATA[' . $buynow_link . ']]>'; } else { $products_description .= "\n" . $buynow_link; } } if (RSS_BUYNOW_LINK == 'true') { /* $buynow_link = '<br /><br />' . zen_draw_form('cart_quantity', $link . '&action=add_product', 'post', 'enctype="multipart/form-data" target="_blank"') . "\n"; // $buynow_link .= '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($products->fields['products_id'])) . '" maxlength="6" size="4" />' . zen_get_products_quantity_min_units_display((int)$products->fields['products_id']); $buynow_link .= zen_draw_hidden_field('cart_quantity', zen_get_buy_now_qty($products->fields['products_id'])); $buynow_link .= zen_draw_hidden_field('products_id', (int)$products->fields['products_id']); $buynow_link .= str_replace('<img src="', '<img src="' . HTTP_SERVER . DIR_WS_CATALOG, zen_image_submit(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT)); $buynow_link .= '</form>'; */ $buynow_button = str_replace('<img src="', '<img src="' . HTTP_SERVER . DIR_WS_CATALOG, zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT)); $buynow_button = preg_replace('@onmouseover="[^"]*"@i', '', $buynow_button); $buynow_button = preg_replace('@onmouseout="[^"]*"@i', '', $buynow_button); $buynow_button = str_replace(' >', '>', $buynow_button); // $buynow_link = $link . '&action=buy_now'; $buynow_link = zen_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products->fields['products_id'] . '&action=buy_now' . $additionalURL, 'SSL', false); $xtags['zencart:buynow_link'] = $buynow_link; $xtags['zencart:buynow_button'] = $buynow_button; } // TODO: // Attribute processing // Model, weight, brand & etc... $rss->rss_feed_item($products->fields['products_name'], $link, array('url' => $link, 'PermaLink' => true), date('r', strtotime($products->fields['products_date'])), $products_description, $rss->_clear_url($products->fields['products_image']), zen_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $products->fields['products_id'] . $additionalURL, 'NONSSL', false), RSS_AUTHOR == '' ? STORE_OWNER_EMAIL_ADDRESS . " <" . STORE_OWNER . ">" : RSS_AUTHOR, false, false, $xtags); if ($random) { break; } $products->MoveNext(); } }
* reviews sidebox - displays a random product-review * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: reviews.php 2718 2005-12-28 06:42:39Z drbyte $ */ // if review must be approved or disabled do not show review $review_status = " and r.status = 1 "; $random_review_sidebox_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name\r\n from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n where p.products_status = '1'\r\n and p.products_id = r.products_id\r\n and r.reviews_id = rd.reviews_id\r\n and rd.languages_id = '" . (int) $_SESSION['languages_id'] . "'\r\n and p.products_id = pd.products_id\r\n and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'" . $review_status; if (isset($_GET['products_id'])) { $random_review_sidebox_select .= " and p.products_id = '" . (int) $_GET['products_id'] . "'"; } $random_review_sidebox_select .= " limit " . MAX_RANDOM_SELECT_REVIEWS; $random_review_sidebox_product = zen_random_select($random_review_sidebox_select); if ($random_review_sidebox_product->RecordCount() > 0) { // display random review box $review_box_text_query = "select substring(reviews_text, 1, 60) as reviews_text\r\n from " . TABLE_REVIEWS_DESCRIPTION . "\r\n where reviews_id = '" . (int) $random_review_sidebox_product->fields['reviews_id'] . "'\r\n and languages_id = '" . (int) $_SESSION['languages_id'] . "'"; $review_box_text = $db->Execute($review_box_text_query); // $review_box_text = zen_break_string(zen_output_string_protected($review_box_text->fields['reviews_text']), 15, '-<br />'); $review_box_text = zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_box_text->fields['reviews_text']))), 60, '-<br />'); require $template->get_template_dir('tpl_reviews_random.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_reviews_random.php'; } elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) { // display 'write a review' box require $template->get_template_dir('tpl_reviews_write.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_reviews_write.php'; } else { // display 'no reviews' box require $template->get_template_dir('tpl_reviews_none.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_reviews_none.php'; } $title = BOX_HEADING_REVIEWS;
<?php /** * whats_new sidebox - displays a random "new" product * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: whats_new.php 2769 2006-01-02 07:34:58Z drbyte $ */ // display limits $display_limit = zen_get_products_new_timelimit(); $random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price\r\n from " . TABLE_PRODUCTS . " p\r\n where p.products_status = 1 " . $display_limit . "\r\n limit " . MAX_RANDOM_SELECT_NEW; $random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query); if ($random_whats_new_sidebox_product->RecordCount() > 0) { $whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']); $random_whats_new_sidebox_product->fields['products_name'] = zen_get_products_name($random_whats_new_sidebox_product->fields['products_id']); $random_whats_new_sidebox_product->fields['specials_new_products_price'] = zen_get_products_special_price($random_whats_new_sidebox_product->fields['products_id']); require $template->get_template_dir('tpl_whats_new.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_whats_new.php'; $title = BOX_HEADING_WHATS_NEW; $title_link = FILENAME_PRODUCTS_NEW; require $template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base, 'common') . '/' . $column_box_default; }
<?php /** * featured sidebox - displays a random Featured Product * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: featured.php 2808 2006-01-06 17:17:32Z drbyte $ */ // test if box should display $show_featured = true; if ($show_featured == true) { $random_featured_products_query = "select p.products_id, p.products_image, pd.products_name\r\n from (" . TABLE_PRODUCTS . " p\r\n left join " . TABLE_FEATURED . " f on p.products_id = f.products_id\r\n left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )\r\n where p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\r\n order by pd.products_name desc\r\n limit " . MAX_RANDOM_SELECT_FEATURED_PRODUCTS; // randomly select ONE featured product from the list retrieved: $random_featured_product = zen_random_select($random_featured_products_query); if ($random_featured_product->RecordCount() > 0) { $featured_box_price = zen_get_products_display_price($random_featured_product->fields['products_id']); require $template->get_template_dir('tpl_featured.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_featured.php'; $title = BOX_HEADING_FEATURED_PRODUCTS; $title_link = FILENAME_FEATURED_PRODUCTS; require $template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base, 'common') . '/' . $column_box_default; } }