* @package modules
 * @copyright Copyright 2003-2010 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: category_icon_display.php 16776 2010-06-24 20:48:53Z drbyte $
 */
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if ($cPath == '' || $cPath == 0) {
    $cPath = zen_get_product_path((int) $_GET['products_id']);
}
if (!isset($_GET['cPath']) || $_GET['cPath'] == '') {
    $_GET['cPath'] = $cPath;
}
$cPath_new = zen_get_path(zen_get_products_category_id((int) $_GET['products_id']));
//      if ((zen_get_categories_image(zen_get_products_category_id((int)$_GET['products_id']))) !='') {
switch (true) {
    case $module_show_categories == '1':
        $align = 'left';
        break;
    case $module_show_categories == '2':
        $align = 'center';
        break;
    case $module_show_categories == '3':
        $align = 'right';
        break;
}
//echo 'I SEE ' . $cPath . ' vs ' . $current_category_id;
//$category_icon_display_name = zen_get_categories_name(zen_get_products_category_id((int)$_GET['products_id']), $_SESSION['languages_id']);
//$category_icon_display_image = zen_get_categories_image(zen_get_products_category_id((int)$_GET['products_id']));
<?php

/**
 * Module Template
 *
 * @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: tpl_modules_category_icon_display.php 2747 2005-12-31 06:05:37Z ajeh $
 */
require DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORY_ICON_DISPLAY);
?>

<div align="<?php 
echo $align;
?>
" id="categoryIcon" class="categoryIcon"><?php 
echo '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . zen_get_categories_image(zen_get_products_category_id((int) $_GET['products_id'])), zen_get_categories_name(zen_get_products_category_id((int) $_GET['products_id']), $_SESSION['languages_id']), CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT) . '<br />' . zen_get_categories_name(zen_get_products_category_id((int) $_GET['products_id']), $_SESSION['languages_id']) . '</a>';
?>
</div>
function zen_get_products_sale_discount($product_id = false, $categories_id = false, $display_type = false)
{
    global $currencies;
    global $db;
    // get products category
    if ($categories_id == true) {
        $check_category = $categories_id;
    } else {
        $check_category = zen_get_products_category_id($product_id);
    }
    $deduction_type_array = array(array('id' => '0', 'text' => DEDUCTION_TYPE_DROPDOWN_0), array('id' => '1', 'text' => DEDUCTION_TYPE_DROPDOWN_1), array('id' => '2', 'text' => DEDUCTION_TYPE_DROPDOWN_2));
    $sale_maker_discount = 0;
    $salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_categories_all, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " where sale_status='1'");
    while (!$salemaker_sales->EOF) {
        $categories = explode(',', $salemaker_sales->fields['sale_categories_all']);
        while (list($key, $value) = each($categories)) {
            if ($value == $check_category) {
                $sale_maker_discount = $salemaker_sales->fields['sale_deduction_value'];
                $sale_maker_discount_type = $salemaker_sales->fields['sale_deduction_type'];
                break;
            }
        }
        $salemaker_sales->MoveNext();
    }
    switch (true) {
        // percentage discount only
        case $sale_maker_discount_type == 1:
            $sale_maker_discount = 1 - $sale_maker_discount / 100;
            break;
        case $sale_maker_discount_type == 0 and $display_type == true:
            $sale_maker_discount = $sale_maker_discount;
            break;
        case $sale_maker_discount_type == 0 and $display_type == false:
            $sale_maker_discount = $sale_maker_discount;
            break;
        case $sale_maker_discount_type == 2 and $display_type == true:
            $sale_maker_discount = $sale_maker_discount;
            break;
        default:
            $sale_maker_discount = 1;
            break;
    }
    if ($display_type == true) {
        if ($sale_maker_discount != 1 and $sale_maker_discount != 0) {
            switch (true) {
                case $sale_maker_discount_type == 0:
                    $sale_maker_discount = $currencies->format($sale_maker_discount) . ' ' . $deduction_type_array[$sale_maker_discount_type]['text'];
                    break;
                case $sale_maker_discount_type == 2:
                    $sale_maker_discount = $currencies->format($sale_maker_discount) . ' ' . $deduction_type_array[$sale_maker_discount_type]['text'];
                    break;
                case $sale_maker_discount_type == 1:
                    $sale_maker_discount = number_format(1.0 - $sale_maker_discount, 2, ".", "") . ' ' . $deduction_type_array[$sale_maker_discount_type]['text'];
                    break;
            }
        } else {
            $sale_maker_discount = '';
        }
    }
    return $sale_maker_discount;
}
Example #4
0
<?php

$display_num = 12;
$subCategoriesArray = array();
if (isset($_GET['products_id'])) {
    $relatedCategoriesParentId = zen_get_products_category_id($_GET['products_id']);
    $relatedCategoriesId = zen_get_categories_parent_id($relatedCategoriesParentId);
    zen_get_subcategoriesarray($subCategoriesArray, $relatedCategoriesId);
} else {
    if (isset($current_category_id)) {
        $parent_id = zen_get_categories_parent_id($current_category_id);
        zen_get_subcategoriesarray($subCategoriesArray, $relatedCategoriesId);
    }
}
$relatedCategoriesTotalNum = count($subCategoriesArray);
?>
<div class="fl allborder line_180" id="relate_cate">
	<h4 class="red line_30px in_1em"><?php 
echo BASE_COMMON_TEXT_RELATEDCATEGORIES;
?>
</h4>
	<ul>
	<?php 
if ($relatedCategoriesTotalNum > 0) {
    for ($i = 0; $i < $display_num; $i++) {
        echo '<li><a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $subCategoriesArray[$i]['categories_id']) . '" title="' . SEO_COMMON_KEYWORDS . $subCategoriesArray[$i]['categories_name'] . '">' . zen_clipped_string($subCategoriesArray[$i]['categories_name']) . '</a></li>';
    }
}
unset($row, $display, $subCategoriesArray, $related_categories_query);
?>
	</ul>
Example #5
0
        
        // bof note links
        // customers note
        if($nInfo->customers_id > 0)
          $contents[] = array('text' => '<a href="' . FILENAME_CUSTOMERS . '.php' . '?cID=' . $nInfo->customers_id . '&action=edit' . '"><strong>' . TEXT_INFO_NOTE_CUSTOMER . '</strong></a>');
        
        // orders note   
        if($nInfo->orders_id > 0)
          $contents[] = array('text' => '<a href="' . FILENAME_ORDERS . '.php' . '?oID=' . $nInfo->orders_id . '&action=edit' . '"><strong>' . TEXT_INFO_NOTE_ORDER . '</strong></a>');
        
        if(zen_not_null($nInfo->categories_id))
          $contents[] = array('text' => '<a href="' . FILENAME_CATEGORIES . '.php' . '?cPath=' . $nInfo->categories_id . '"><strong>' . TEXT_INFO_NOTE_CATEGORY . '</strong></a>');
        
        // products note
        if($nInfo->products_id > 0)
          $contents[] = array('text' => '<a href="' . FILENAME_PRODUCT . '.php' . '?action=new_product&pID=' . $nInfo->products_id . '&product_type=' . zen_get_products_type($nInfo->products_id) . '&cPath=' . zen_get_products_category_id($nInfo->products_id) . '"><strong>' . TEXT_INFO_NOTE_PRODUCT . '</strong></a>');                                
        // eof note links
         
        $contents[] = array('text' => '<br />' . TEXT_INFO_NOTE_TEXT . '<p style="font-weight: bold; ">' . nl2br(stripslashes($nInfo->notes_text)) . '</p>');
        
         $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_CREATED . zen_date_long($nInfo->notes_date_created));
        if (zen_not_null($nInfo->notes_date_modified)) $contents[] = array('text' => TEXT_INFO_NOTE_DATE_MODIFIED . ': ' . zen_date_long($nInfo->notes_date_modified));

      }
        break;
    }

    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
      echo '            <td width="25%" valign="top">' . "\n";

      $box = new box;
Example #6
0
            </table></td>
<?php 
    $heading = array();
    $contents = array();
    switch ($action) {
        case 'delete':
            $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_REVIEW . '</b>');
            $contents = array('form' => zen_draw_form('reviews', FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=deleteconfirm'));
            $contents[] = array('text' => TEXT_INFO_DELETE_REVIEW_INTRO);
            $contents[] = array('text' => '<br><b>' . $rInfo->products_name . '</b>');
            $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
            break;
        default:
            if (isset($rInfo) && is_object($rInfo)) {
                $heading[] = array('text' => '<b>' . $rInfo->products_name . '</b>');
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a> ' . ' <a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_products_category_id($rInfo->products_id) . '&pID=' . $rInfo->products_id) . '">' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '</a>');
                $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($rInfo->date_added));
                if (zen_not_null($rInfo->last_modified)) {
                    $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($rInfo->last_modified));
                }
                $contents[] = array('text' => '<br>' . zen_info_image($rInfo->products_image, $rInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
                $contents[] = array('text' => '<br>' . TEXT_INFO_REVIEW_AUTHOR . ' ' . $rInfo->customers_name);
                $contents[] = array('text' => TEXT_INFO_REVIEW_RATING . ' ' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $rInfo->reviews_rating . '.gif'));
                $contents[] = array('text' => TEXT_INFO_REVIEW_READ . ' ' . $rInfo->reviews_read);
                $contents[] = array('text' => '<br>' . TEXT_INFO_REVIEW_SIZE . ' ' . $rInfo->reviews_text_size . ' bytes');
                $contents[] = array('text' => '<br>' . TEXT_INFO_PRODUCTS_AVERAGE_RATING . ' ' . number_format($rInfo->average_rating, 2) . '%');
            }
            break;
    }
    if (zen_not_null($heading) && zen_not_null($contents)) {
        echo '            <td width="25%" valign="top">' . "\n";
Example #7
0
$canonicalLink = '';
switch (TRUE) {
    /**
     * SSL Pages get no special treatment, since they're not normally indexed (unless the entire site is intentionally set to always be SSL, which is not typical)
     */
    case $request_type == 'SSL' && substr(HTTP_SERVER, 0, 5) != 'https':
        $canonicalLink = '';
        break;
        /**
         * for products (esp those linked to multiple categories):
         */
    /**
     * for products (esp those linked to multiple categories):
     */
    case strstr($current_page, '_info') && isset($_GET['products_id']):
        $canonicalLink = zen_href_link($current_page, ($includeCPath ? 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&' : '') . 'products_id=' . $_GET['products_id'], 'NONSSL', false);
        break;
        /**
         * for product listings:
         */
    /**
     * for product listings:
     */
    case $current_page == 'index' && isset($_GET['cPath']):
        $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams), 'NONSSL', false);
        break;
        /**
         * for music products:
         */
    /**
     * for music products:
function zen_active_notes()
{
    global $db, $messageStack;
    // BOF list active notes
    $order_by = 'ORDER BY notes_categories_name';
    $notes_categories_query = "select * FROM " . TABLE_NOTES_CATEGORIES . " " . $order_by;
    $notes_categories_results = $db->Execute($notes_categories_query);
    while (!$notes_categories_results->EOF) {
        $order_by = 'ORDER BY notes_start_date DESC';
        // use CURDATE ?
        //$notes_active_query = ("select * FROM " . TABLE_NOTES . " n LEFT JOIN " . TABLE_NOTES_CATEGORIES . " nc ON (n.notes_categories_id = nc.notes_categories_id) " . " WHERE (`notes_status` = '1') AND (((`notes_start_date` <= NOW()) AND (`notes_start_date` >= '0001-01-01')) AND  ((`notes_end_date` >= NOW()) OR (`notes_end_date` <= '0001-01-01')))" . $order_by);
        $notes_active_query = "select * FROM " . TABLE_NOTES . " WHERE ((`notes_is_public` = '1' || `admin_id` = '" . (int) $_SESSION['admin_id'] . "') AND ((`notes_categories_id` = '" . $notes_categories_results->fields['notes_categories_id'] . "') AND ((`notes_status` = '1') AND (((`notes_start_date` <= NOW()) AND (`notes_start_date` >= '0001-01-01')) AND  ((`notes_end_date` >= NOW()) OR (`notes_end_date` <= '0001-01-01'))))))" . $order_by;
        $notes_active_results = $db->Execute($notes_active_query);
        if (count($notes_active_results) > 0) {
            if (isset($_GET['oID']) && $_GET['oID'] > 0) {
                // lookup the customer id of the order
                // so we can show the customer notes when viewing orders ($order is not available yet at this point, we need a query)
                $notes_customer_query = "select customers_id FROM " . TABLE_ORDERS . " WHERE (`orders_id` = " . (int) $_GET['oID'] . ") LIMIT 1";
                $notes_customer_result = $db->Execute($notes_customer_query);
            }
        }
        $messageStackArray = array();
        while (!$notes_active_results->EOF) {
            /*
            echo '<pre>';
            print_r($notes_active_results->fields);
            echo '</pre>';
            */
            $note_link = zen_href_link('notes', 'nID=' . $notes_active_results->fields['notes_id']);
            $notes_active_array = $notes_active_results->fields;
            $notes_active = new objectInfo($notes_active_array);
            //print_r($notes_active);
            switch (true) {
                case $notes_active->notes_is_special_status == 1:
                    // special products, customers, orders or categories note
                    if (basename($_SERVER['PHP_SELF']) != FILENAME_NOTES) {
                        // do not show on notes page itself
                        if ($notes_active->customers_id > 0 || $notes_active->orders_id > 0 || $notes_active->categories_id > 0 || $notes_active->products_id > 0) {
                            // these notes must only be shown when the customer/order/category/product is viewed by the admin
                            // customers note
                            if (isset($_GET['cID']) && $_GET['cID'] == $notes_active->customers_id || $notes_customer_result->fields['customers_id'] > 0 && $notes_customer_result->fields['customers_id'] == $notes_active->customers_id) {
                                $messageStackArray[] = '<a href="' . $note_link . '&action=view' . '">' . $notes_active_results->fields['notes_title'] . '</a> (Special Customers note)';
                            }
                            // orders note
                            if (isset($_GET['oID']) && $_GET['oID'] == $notes_active->orders_id) {
                                $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a> (Special Orders note)';
                            }
                            // category note
                            if (isset($_GET['cPath']) && $_GET['cPath'] != '' && $_GET['cPath'] == $notes_active->categories_id) {
                                $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a> (Special Categories note)';
                            }
                            // products note
                            if (isset($_GET['pID']) && $_GET['pID'] == $notes_active->products_id) {
                                $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a> (Special Products note)';
                            }
                        } else {
                            // note is not attached yet
                            if (isset($_GET['pID']) || isset($_GET['cPath']) || isset($_GET['oID']) || isset($_GET['cID'])) {
                                $parameters = '';
                                $parameters = (isset($_GET['cPath']) ? '&cPath=' . $_GET['cPath'] : '') . (isset($_GET['pID']) ? '&pID=' . (int) $_GET['pID'] : '') . (isset($_GET['oID']) ? '&oID=' . (int) $_GET['oID'] : '') . (isset($_GET['cID']) ? '&cID=' . (int) $_GET['cID'] : '');
                                $messageStackArray[] = 'Attach this ' . ' note now? ' . '<a href="' . $note_link . '&action=edit' . $parameters . '">' . $notes_active_results->fields['notes_title'] . '</a>';
                            }
                        }
                    }
                    break;
                case $notes_active->notes_is_special_status != 1 && ($notes_active->customers_id > 0 || $notes_active->orders_id > 0 || $notes_active->categories_id > 0 || $notes_active->products_id > 0):
                    // non special products, customers, orders or categories note
                    // customers note
                    if ($notes_active->customers_id > 0) {
                        $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a>' . '| <a href="' . FILENAME_CUSTOMERS . '.php' . '?cID=' . $notes_active->customers_id . '&action=edit' . '">' . 'Edit customer' . '</a>';
                    }
                    // orders note
                    if ($notes_active->orders_id > 0) {
                        $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a>' . ' | <a href="' . FILENAME_ORDERS . '.php' . '?oID=' . $notes_active->orders_id . '&action=edit' . '">' . 'Edit order' . '</a>';
                    }
                    // category note)
                    if (zen_not_null($notes_active->categories_id)) {
                        $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a>' . ' | <a href="' . FILENAME_CATEGORIES . '.php' . '?cPath=' . $notes_active->categories_id . '">' . 'Edit category' . '</a>';
                    }
                    // products note
                    if ($notes_active->products_id > 0) {
                        //&product_type=1&cPath=1_4&pID=1&action=new_product;
                        $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a>' . ' | <a href="' . FILENAME_PRODUCT . '.php' . '?action=new_product&pID=' . $notes_active->products_id . '&product_type=' . zen_get_products_type($notes_active->products_id) . '&cPath=' . zen_get_products_category_id($notes_active->products_id) . '">' . 'Edit product' . '</a>';
                    }
                    break;
                default:
                    // general notes
                    $messageStackArray[] = '<a href="' . $note_link . '">' . $notes_active_results->fields['notes_title'] . '</a>';
                    break;
            }
            if ($notes_active->notes_is_special_status == 1 && basename($_SERVER['PHP_SELF']) != FILENAME_NOTES) {
                $show_special = true;
            }
            if ($notes_active->customers_id > 0 || $notes_active->orders_id > 0 || $notes_active->categories_id > 0 || $notes_active->products_id > 0) {
            } elseif ($special) {
                // ask to attach
                //exit('special attach ' . $notes_active->notes_id);
            } elseif ($notes_active->notes_is_special_status != 1) {
            }
            $notes_active_results->MoveNext();
        }
        if (count($messageStackArray) > 0) {
            $messageStackNotes = implode('</li><li>', $messageStackArray);
            $messageStack->add($notes_categories_results->fields['notes_categories_name'] . ' notes:<ul id="notesNotifierList" style="margin: 0.1em;"><li>' . $messageStackNotes . '</li></ul>', 'warning');
        }
        $notes_categories_results->MoveNext();
    }
    // EOF list active notes
}
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 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: tpl_product_free_shipping_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
 */
// only display when more than 1
if ($products_found_count > 1) {
    ?>

<div class="fr"><a href="<?php 
    echo zen_href_link(FILENAME_DEFAULT, 'cPath=' . zen_get_products_category_id($_GET['products_id']));
    ?>
" / class="b_" title="<?php 
    echo zen_get_category_name(zen_get_products_category_id($_GET['products_id']), $_SESSION['languages_id']);
    ?>
">other item in the list</a>&nbsp;<span id="recent_flash_smallPage" class="product_title">
  <?php 
    //echo (PREV_NEXT_PRODUCT);
    ?>
  <?php 
    //echo ($position+1 . "/" . $counter);
    ?>
  </span></div>
<?php 
}
if ($messageStack->size('product_info') > 0) {
    echo $messageStack->output('product_info');
}
?>
     if ($productIsSBA[$i] && (PRODINFO_ATTRIBUTE_PLUGIN_MULTI == 'single_dropdown' || PRODINFO_ATTRIBUTE_PLUGIN_MULTI == 'single_radioset') && (PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '1' || PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '2')) {
         /* Breakdown the attributes into individual attributes to then be able to 
          * feed them into the applicable section(s).
          * 
          */
     }
     foreach ($_POST['id'] as $key => $value) {
         $check = zen_get_attributes_valid($_POST['products_id'], $key, $value);
         if ($check == false) {
             $the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . ($value == (int) PRODUCTS_OPTIONS_VALUES_TEXT_ID ? TEXT_INVALID_USER_INPUT : zen_values_name($value)) . '</span>' . '<br />';
         }
     }
 }
 if (!is_numeric($_POST['cart_quantity']) || $_POST['cart_quantity'] < 0) {
     // adjust quantity when not a value
     $chk_link = '<a href="' . zen_href_link(zen_get_info_page($_POST['products_id']), 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_POST['products_id'])) . '&products_id=' . $_POST['products_id']) . '">' . zen_get_products_name($_POST['products_id']) . '</a>';
     $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($_POST['cart_quantity']), 'caution');
     $_POST['cart_quantity'] = 0;
 }
 $attr_list = array();
 $attr_dash = array();
 $attr_id = array();
 $attr_val = array();
 if ((PRODINFO_ATTRIBUTE_PLUGIN_MULTI == 'single_dropdown' || PRODINFO_ATTRIBUTE_PLUGIN_MULTI == 'single_radioset') && (PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '1' || PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '2')) {
     /*single dropdown as multiple*/
     $attr_list = explode(',', $_POST['attrcomb']);
     foreach ($attr_list as $attr_item) {
         list($attr_id, $attr_val) = explode('-', $attr_item);
         if (zen_not_null($attr_id) && zen_not_null($attr_val)) {
             $_POST['id'][$attr_id] = $attr_val;
         }
<div class="centerBoxWrapper" id="similar_product">
<h2 class="centerBoxHeading"><span>Related Products</span></h2>
<ul>
<?php 
$products_id = (int) $_GET['products_id'];
$flash_page_id_con = array();
$flash_page_images_con = array();
$flash_page_price_con = array();
$flash_page_name_con = array();
$flash_page_query = "select p.products_id,p.products_image,pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.`products_id`=pd.`products_id` AND pd.`language_id` = '" . (int) $_SESSION['languages_id'] . "' AND p.`master_categories_id` = " . zen_get_products_category_id($products_id) . " ORDER BY rand() limit 12";
$flash_page = $db->Execute($flash_page_query);
while (!$flash_page->EOF) {
    $flash_page_items[] = $flash_page->fields;
    $flash_page_id_con[] = $flash_page->fields['products_id'];
    $flash_page_images_src = is_int(strpos($flash_page->fields['products_image'], ',')) ? substr($flash_page->fields['products_image'], 0, strpos($flash_page->fields['products_image'], ',')) : $flash_page->fields['products_image'];
    $flash_page_images_con[] = '"' . (zen_not_null($flash_page->fields['products_image']) ? $flash_page_images_src : PRODUCTS_IMAGE_NO_IMAGE) . '"';
    $flash_page_price_con[] = '"' . $currencies->display_price(zen_get_products_base_price($flash_page->fields['products_id']), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '"';
    $flash_page_name_con[] = '"' . zen_output_string(zen_get_products_name($flash_page->fields['products_id'])) . '"';
    $flash_page->MoveNext();
}
$flash_page_id = implode(",", $flash_page_id_con);
$flash_page_images = implode(",", $flash_page_images_con);
$flash_page_price = implode(",", $flash_page_price_con);
$flash_page_name = implode(",", $flash_page_name_con);
$flash_page_display_num = $flash_page->RecordCount();
for ($i = 0; $i < $flash_page_display_num; $i++) {
    ?>
<li id="li<?php 
    echo $i;
    ?>
" style="display:block;float:left;padding-left:10px;width:22%;">
Example #12
0
 function __retrieve_reward_point_ratio($products_id)
 {
     $categories_id = zen_get_products_category_id($products_id);
     if ($this->_retrieve_products_ratio($products_id) !== 'false') {
         // products ratio
         $ratio = $this->_retrieve_products_ratio($products_id);
     } elseif ($this->_retrieve_categories_ratio($categories_id) !== 'false') {
         // category ratio
         $ratio = $this->_retrieve_categories_ratio($categories_id);
     } else {
         // use global ratio
         $ratio = MODULE_ORDER_TOTAL_SC_ORDER_REWARD_PERCENTAGE;
     }
     return (double) ($ratio / 100);
 }
                case $module_show_categories == '3':
                    $align = 'right';
                    break;
            }
            if ($module_next_previous != '3') {
                ?>
  <tr>
    <td colspan="3" align="<?php 
                echo $align;
                ?>
">
      <?php 
                echo '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . zen_get_categories_image(zen_get_products_category_id((int) $_GET['products_id'])), zen_get_categories_name(zen_get_products_category_id((int) $_GET['products_id']), $_SESSION['languages_id']), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, ' align="middle"') . '</a>';
                ?>
      <?php 
                echo '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . zen_get_categories_name(zen_get_products_category_id((int) $_GET['products_id']), $_SESSION['languages_id']) . '</a>';
                ?>
    </td>
  </tr>
<?php 
            }
            // don't show when top and bottom
        }
    }
    ?>
  <tr>
    <td align="center" class="smallText" colspan="3"><?php 
    echo PREV_NEXT_PRODUCT;
    echo $position + 1 . "/" . $counter;
    ?>
</td>
Example #14
0
function zen_get_categories_products_list($categories_id, $include_deactivated = false, $include_child = true)
{
    global $db;
    global $categories_products_id_list;
    if ($include_deactivated) {
        $products = $db->Execute("select p.products_id\n                                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                                where p.products_id = p2c.products_id\n                                and p2c.categories_id = '" . (int) $categories_id . "'");
    } else {
        $products = $db->Execute("select p.products_id\n                                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                                where p.products_id = p2c.products_id\n                                and p.products_status = '1'\n                                and p2c.categories_id = '" . (int) $categories_id . "'");
    }
    while (!$products->EOF) {
        // categories_products_id_list keeps resetting when category changes ...
        //      echo 'Products ID: ' . $products->fields['products_id'] . '<br>';
        if (category_allowed($products->fields['categories_id']) == 'true') {
            $categories_products_id_list[] = $products->fields['products_id'];
        }
        $products->MoveNext();
    }
    if ($include_child && category_allowed(zen_get_products_category_id($products->fields['products_id'])) == 'true') {
        $childs = $db->Execute("select categories_id from " . TABLE_CATEGORIES . "\n                              where parent_id = '" . (int) $categories_id . "'");
        if ($childs->RecordCount() > 0) {
            while (!$childs->EOF) {
                zen_get_categories_products_list($childs->fields['categories_id'], $include_deactivated);
                $childs->MoveNext();
            }
        }
    }
    $products_id_listing = $categories_products_id_list;
    return $products_id_listing;
}
<?php

/**
 * @package modules
 * @author JunsGo@msn.com
 * @copyright Copyright 2013 SL Development Team
 * @copyright Portions Copyright 2003 osCommerce
 */
$tpl_products = array('title' => '', 'products' => array());
if ((int) $_GET['products_id'] > 0) {
    $sql = 'SELECT p.products_image, pd.products_name, p.products_quantity, p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price,
	 p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price,
	 p.products_sort_order, p.product_is_call, p.product_is_free, p.product_is_always_free_shipping, p.products_qty_box_status
			FROM ' . TABLE_PRODUCTS_DESCRIPTION . ' pd, .' . TABLE_PRODUCTS . ' p left join ' . TABLE_MANUFACTURERS . ' m on (p.manufacturers_id = m.manufacturers_id),
				' . TABLE_PRODUCTS_TO_CATEGORIES . ' p2c left join ' . TABLE_SPECIALS . ' s on (p2c.products_id = s.products_id)
			WHERE p.products_status = 1 and (p.products_id = p2c.products_id) and (pd.products_id = p2c.products_id)
					 and p.shop_id = ' . (int) $_SESSION['shop_id'] . '
				and pd.language_id = \'' . (int) $_SESSION['languages_id'] . '\' and p.master_categories_id = \'' . (int) zen_get_products_category_id($_GET['products_id']) . '\'
			ORDER BY RAND()';
    $relateds = $db->Execute($sql, MAX_DISPLAY_PRODUCTS_RELATED, true, CACHE_TIMELIFT);
    while (!$relateds->EOF) {
        $tpl_products['products'][$relateds->fields['products_id']] = array('name' => $relateds->fields['products_name'], 'image' => $relateds->fields['products_image'], 'quantity' => $relateds->fields['products_quantity'], 'weight' => $relateds->fields['products_weight'], 'type' => $relateds->fields['products_type'], 'categories_id' => $relateds->fields['master_categories_id'], 'manufacturers_id' => $relateds->fields['manufacturers_id'], 'products_price' => $relateds->fields['products_price'], 'tax_class_id' => $relateds->fields['products_tax_class_id'], 'specials_price' => $relateds->fields['specials_new_products_price'], 'final_price' => $relateds->fields['final_price'], 'sort_order' => $relateds->fields['products_sort_order'], 'is_call' => $relateds->fields['product_is_call'], 'is_always_free_shipping' => $relateds->fields['product_is_always_free_shipping'], 'qty_box_status' => $relateds->fields['products_qty_box_status'], 'href' => zen_href_link(zen_get_info_page($relateds->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($relateds->fields['master_categories_id']))) . '&products_id=' . $relateds->fields['products_id']), 'display_price' => zen_get_products_display_price($relateds->fields['products_id']), 'is_free' => $relateds->fields['product_is_free'] == '1' ? true : false, 'display_normal_price' => get_normal_price($relateds->fields['products_id']), 'display_special_price' => get_special_price($relateds->fields['products_id']), 'display_sale_price' => get_sale_discount_price($relateds->fields['products_id']));
        $relateds->MoveNext();
    }
}
Example #16
0
 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n                                  p.products_price,p.products_price_sample, p.products_weight, p.products_tax_class_id,\n                                  p.products_quantity_order_min, p.products_quantity_order_units,\n                                  p.product_is_free, p.products_priced_by_attribute,\n                                  p.products_discount_type, p.products_discount_type_from\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           where p.products_id = '" . (int) $products_id . "'\n                           and pd.products_id = p.products_id\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'] == 0 ? $products->fields['products_price_sample'] : $products->fields['products_price'];
             //fix here
             /*
             $special_price = zen_get_products_special_price($prid);
             if ($special_price) {
             $products_price = $special_price;
             }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 $categories_query = $db->Execute("SELECT categories_discount_type FROM " . TABLE_CATEGORIES . " WHERE categories_id = " . zen_get_products_category_id($products_id));
                 if ($products->fields['products_discount_type'] != 0 || $categories_query->fields['categories_discount_type'] != 0) {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->remove($products_id);
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 if ($fix_once == 0) {
                     if ($check_quantity < $check_quantity_min) {
                         $fix_once++;
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 //          $new_qty = round($new_qty, QUANTITY_DECIMALS);
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
                         break;
                 }
             } else {
                 $new_qty = $this->contents[$products_id]['qty'];
             }
             $check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
             if (strstr($check_unit_decimals, '.')) {
                 $new_qty = round($new_qty, QUANTITY_DECIMALS);
             } else {
                 $new_qty = round($new_qty, 0);
             }
             if ($new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
         }
     }
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
     return $products_array;
 }
Example #17
0
function zen_get_products_sale_discount_type($product_id = false, $categories_id = false, $return_value = false)
{
    global $currencies;
    global $db;
    /*
    0 = flat amount off base price with a special
    1 = Percentage off base price with a special
    2 = New Price with a special
    5 = No Sale or Skip Products with Special
    special options + option * 10
    0 = Ignore special and apply to Price
    1 = Skip Products with Specials switch to 5
    2 = Apply to Special Price
    If a special exist * 10+9
    0*100 + 0*10 = flat apply to price = 0 or 9
    0*100 + 1*10 = flat skip Specials = 5 or 59
    0*100 + 2*10 = flat apply to special = 20 or 209
    1*100 + 0*10 = Percentage apply to price = 100 or 1009
    1*100 + 1*10 = Percentage skip Specials = 110 or 1109 / 5 or 59
    1*100 + 2*10 = Percentage apply to special = 120 or 1209
    2*100 + 0*10 = New Price apply to price = 200 or 2009
    2*100 + 1*10 = New Price skip Specials = 210 or 2109 / 5 or 59
    2*100 + 2*10 = New Price apply to Special = 220 or 2209
    */
    // get products category
    if ($categories_id == true) {
        $check_category = $categories_id;
    } else {
        $check_category = zen_get_products_category_id($product_id);
    }
    $deduction_type_array = array(array('id' => '0', 'text' => DEDUCTION_TYPE_DROPDOWN_0), array('id' => '1', 'text' => DEDUCTION_TYPE_DROPDOWN_1), array('id' => '2', 'text' => DEDUCTION_TYPE_DROPDOWN_2));
    $sale_exists = 'false';
    $sale_maker_discount = '';
    $sale_maker_special_condition = '';
    $salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_categories_all, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " where sale_status='1'");
    while (!$salemaker_sales->EOF) {
        $categories = explode(',', $salemaker_sales->fields['sale_categories_all']);
        while (list($key, $value) = each($categories)) {
            if ($value == $check_category) {
                $sale_exists = 'true';
                $sale_maker_discount = $salemaker_sales->fields['sale_deduction_value'];
                $sale_maker_special_condition = $salemaker_sales->fields['sale_specials_condition'];
                $sale_maker_discount_type = $salemaker_sales->fields['sale_deduction_type'];
                break;
            }
        }
        $salemaker_sales->MoveNext();
    }
    $check_special = zen_get_products_special_price($product_id, true);
    if ($sale_exists == 'true' and $sale_maker_special_condition != 0) {
        $sale_maker_discount_type = $sale_maker_discount_type * 100 + $sale_maker_special_condition * 10;
    } else {
        $sale_maker_discount_type = 5;
    }
    if (!$check_special) {
        // do nothing
    } else {
        $sale_maker_discount_type = $sale_maker_discount_type * 10 + 9;
    }
    switch (true) {
        case !$return_value:
            return $sale_maker_discount_type;
            break;
        case $return_value == 'amount':
            return $sale_maker_discount;
            break;
        default:
            return 'Unknown Request';
            break;
    }
}
?>
</td>
															<td class="smallText" align="right"><?php 
echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']);
?>
</td>
														</tr>
													</table></td>
											</tr>
										</table></td>
<?php 
$heading = array();
$contents = array();
if (isset($pInfo) && is_object($pInfo)) {
    $heading[] = array('text' => '<b>' . $pInfo->products_name . '</b>');
    $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_products_category_id($pInfo->products_id) . '&pID=' . $pInfo->products_id . '&product_type=' . zen_get_products_type($pInfo->products_id)) . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
    $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_EXPECTED . ' ' . zen_date_short($pInfo->products_date_available));
}
if (zen_not_null($heading) && zen_not_null($contents)) {
    echo '            <td width="25%" valign="top">' . "\n";
    $box = new box();
    echo $box->infoBox($heading, $contents);
    echo '            </td>' . "\n";
}
?>
          </tr>
							</table></td>
					</tr>
				</table></td>
			<!-- body_text_eof //-->
		</tr>
    // show the attributes
    if ($products_filter != '' and $action != 'attribute_features_copy_to_product' and $action != 'attribute_features_copy_to_category' and $action != 'delete_all_attributes_confirm') {
        ?>
      <tr>
        <td colspan="2"><?php 
        echo zen_draw_separator('pixel_trans.gif', '1', '10');
        ?>
</td>
      </tr>

      <tr>
        <td colspan="2"><table border="1" cellspacing="2" cellpadding="4" align="left">
          <tr>
            <td colspan="7" class="main" align="center">
              <?php 
        echo TEXT_PRODUCTS_LISTING . TEXT_PRODUCTS_ID . $products_filter . TEXT_PRODUCT_IN_CATEGORY_NAME . zen_get_category_name(zen_get_products_category_id($products_filter), (int) $_SESSION['languages_id']) . '<br />' . zen_get_products_name($products_filter);
        ?>
            </td>
          </tr>
          <tr>
            <td class="smallText" align="center"><?php 
        echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_product_path($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
        ?>
</td>
            <td class="smallText" align="center">
              <?php 
        if ($zc_products->get_allow_add_to_cart($products_filter) == "Y") {
            echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '<br />' . TEXT_PRODUCTS_PRICE_MANAGER . '</a>';
        } else {
            echo TEXT_INFO_ALLOW_ADD_TO_CART_NO;
        }
        // master category linked
        ?>

<?php 
        if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
            ?>
          <tr>
<!--- Dual Pricing start --->
            <td colspan="8" class="main"><span class="alert">
<!--- Dual Pricing start --->
              <?php 
            echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_WARNING, $pInfo->master_categories_id, zen_get_products_category_id($products_filter));
            ?>
</span>
              <br /><strong><?php 
            echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_UPDATE_TO_CURRENT, $pInfo->master_categories_id, zen_get_products_category_id($products_filter));
            ?>
</strong>
            </td>
         </tr>
<?php 
        }
        echo zen_draw_hidden_field('master_categories_id', $pInfo->master_categories_id);
        ?>


          <tr bgcolor="#ebebff">
            <td class="main" width="200"><?php 
        echo TEXT_PRODUCTS_TAX_CLASS;
        ?>
</td>
 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  * @todo change while loop to a foreach
  */
 function actionMultipleAddProduct($goto, $parameters)
 {
     global $messageStack;
     if ($this->display_debug_messages) {
         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__, 'caution');
     }
     $addCount = 0;
     if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
         //echo '<pre>'; echo var_dump($_POST['products_id']); echo '</pre>';
         while (list($key, $val) = each($_POST['products_id'])) {
             $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);
             if (is_numeric($val) && $val > 0) {
                 $adjust_max = false;
                 $qty = $val;
                 $add_max = zen_get_products_quantity_order_max($prodId);
                 $cart_qty = $this->in_cart_mixed($prodId);
                 $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                 // bof: adjust new quantity to be same as current in stock
                 $chk_current_qty = zen_get_products_stock($prodId);
                 if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty > $chk_current_qty) {
                     $new_qty = $chk_current_qty;
                     $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                 }
                 // eof: adjust new quantity to be same as current in stock
                 if ($add_max == 1 and $cart_qty == 1) {
                     // do not add
                     $adjust_max = 'true';
                 } else {
                     // bof: adjust new quantity to be same as current in stock
                     if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty + $cart_qty > $chk_current_qty) {
                         $adjust_new_qty = 'true';
                         $alter_qty = $chk_current_qty - $cart_qty;
                         $new_qty = $alter_qty > 0 ? $alter_qty : 0;
                         $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                     }
                     // eof: adjust new quantity to be same as current in stock
                     // adjust quantity if needed
                     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                         $adjust_max = 'true';
                         $new_qty = $add_max - $cart_qty;
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
                     $addCount++;
                 }
                 if ($adjust_max == 'true') {
                     if ($this->display_debug_messages) {
                         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__ . '<br>' . ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                     }
                     $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                 }
             }
             if (!is_numeric($val) || $val < 0) {
                 // adjust quantity when not a value
                 $chk_link = '<a href="' . zen_href_link(zen_get_info_page($prodId), 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($prodId)) . '&products_id=' . $prodId) . '">' . zen_get_products_name($prodId) . '</a>';
                 $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($val), 'caution');
                 $val = 0;
             }
         }
         // display message if all is good and not on shopping_cart page
         if ($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
             $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
         } else {
             if (DISPLAY_CART == 'false') {
                 zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
             }
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     }
 }
Example #22
0
 function get_order_total()
 {
     global $order;
     $order_total = $order->info['total'];
     //echo($order_total . '<br />');
     if (MODULE_ORDER_TOTAL_SC_EXCLUDE_CATEGORIES == 'true') {
         // go through every product and any that are within a category that has a 0 ratio, subtract the products total from the order total
         $products = $_SESSION['cart']->get_products();
         foreach ($products as $product) {
             $subtract = false;
             // first check products ratio
             if ($this->_retrieve_products_ratio($product['id']) != 'false' && $this->_retrieve_products_ratio($product['id']) == 0) {
                 $subtract = true;
                 // set to true to subtract later
             } elseif ($this->_retrieve_products_ratio($product['id']) == 'false') {
                 // check category instead
                 $categories_id = zen_get_products_category_id($product['id']);
                 $cPath = zen_get_generated_category_path_ids($categories_id);
                 $categories = explode('_', $cPath);
                 foreach ($categories as $category_id) {
                     if ($this->_retrieve_categories_ratio($category_id) != 'false' && $this->_retrieve_categories_ratio($category_id) == 0) {
                         $subtract = true;
                         break;
                         // starts with lowest most category, so break if anything is found
                     }
                 }
             }
             if ($subtract) {
                 $price = $product['quantity'] * $product['final_price'];
                 $order_total -= $price;
             }
         }
     }
     if (MODULE_ORDER_TOTAL_SC_EXCLUDE_SHIPPING == 'true') {
         // shipping excluded
         $order_total -= $order->info['shipping_cost'];
     }
     //die($order_total);
     return $order_total;
 }