$session_data_zone = substr($session_data, $start_zone, strpos($session_data, ';', $start_zone) - $start_zone + 1);
        session_decode($session_data_id);
        session_decode($session_data_currency);
        session_decode($session_data_country);
        session_decode($session_data_zone);
        session_decode($session_data_cart);
        if (PHP_VERSION < 4) {
            $broken_cart = $cart;
            $cart = new shoppingCart();
            $cart->unserialize($broken_cart);
        }
        if (is_object($_SESSION['cart'])) {
            $contents[] = array('text' => $full_name . ' - ' . $ip_address . '<br />' . $info);
            $products = $_SESSION['cart']->get_products();
            for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
                $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_product_path($products[$i]['id']) . '&pID=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a>');
                // cPath=23&pID=74
            }
            if (sizeof($products) > 0) {
                $contents[] = array('text' => zen_draw_separator('pixel_black.gif', '100%', '1'));
                $contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total(), true, $_SESSION['currency']));
            } else {
                $contents[] = array('text' => TEXT_EMPTY_CART);
            }
        }
    }
}
if (zen_not_null($heading) && zen_not_null($contents)) {
    echo '            <td width="25%" valign="top">' . "\n";
    $box = new box();
    echo $box->infoBox($heading, $contents);
function validate_for_category($product_id, $coupon_id)
{
    global $db;
    $retVal = 'none';
    $productCatPath = zen_get_product_path($product_id);
    $catPathArray = array_reverse(explode('_', $productCatPath));
    $sql = "SELECT count(*) AS total\r\n            FROM " . TABLE_COUPON_RESTRICT . "\r\n            WHERE category_id = -1\r\n            AND coupon_restrict = 'Y'\r\n            AND coupon_id = " . (int) $coupon_id . " LIMIT 1";
    $checkQuery = $db->execute($sql);
    foreach ($catPathArray as $catPath) {
        $sql = "SELECT * FROM " . TABLE_COUPON_RESTRICT . "\r\n              WHERE category_id = " . (int) $catPath . "\r\n              AND coupon_id = " . (int) $coupon_id;
        $result = $db->execute($sql);
        if ($result->recordCount() > 0 && $result->fields['coupon_restrict'] == 'N') {
            return true;
        }
        if ($result->recordCount() > 0 && $result->fields['coupon_restrict'] == 'Y') {
            return false;
        }
    }
    if ($checkQuery->fields['total'] > 0) {
        return false;
    } else {
        return 'none';
    }
}
if (isset($_GET['page']) && $_GET['page'] > 1) {
    $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;
}
$rows = 0;
$products_query_raw = "select p.`products_id`, pd.`products_name`, p.`products_quantity`, p.`products_type` from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.`products_id` = pd.`products_id` and pd.`language_id`='" . $_SESSION['languages_id'] . "' order by p.`products_quantity`, pd.`products_name`";
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $products_query_raw, $products_query_numrows);
$products = $gBitDb->Execute($products_query_raw);
while (!$products->EOF) {
    // only show low stock on products that can be added to the cart
    if ($zc_products->get_allow_add_to_cart($products->fields['products_id']) == 'Y') {
        $rows++;
        if (strlen($rows) < 2) {
            $rows = '0' . $rows;
        }
        $type_handler = $zc_products->get_admin_handler($products->fields['products_type']);
        $cPath = zen_get_product_path($products->fields['products_id']);
        ?>
              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php 
        echo zen_href_link_admin($type_handler, '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product');
        ?>
'">
                <td class="dataTableContent" align="right"><?php 
        echo $products->fields['products_id'];
        ?>
&nbsp;&nbsp;</td>
                <td class="dataTableContent"><?php 
        echo '<a href="' . zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id']) . '">' . $products->fields['products_name'] . '</a>';
        ?>
</td>
                <td class="dataTableContent" align="center"><?php 
        echo $products->fields['products_quantity'];
                    $specials_current_price = zen_get_products_base_price($sInfo->products_id);
                } else {
                    $specials_current_price = $sInfo->products_price;
                }
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit&products_filter=' . $sInfo->products_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '</a>');
                $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->specials_date_added));
                $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->specials_last_modified));
                $contents[] = array('align' => 'center', 'text' => '<br>' . zen_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
                $contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($specials_current_price));
                $contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price));
                $contents[] = array('text' => '' . TEXT_INFO_DISPLAY_PRICE . ' ' . zen_get_products_display_price($sInfo->products_id));
                $contents[] = array('text' => '<br>' . TEXT_INFO_AVAILABLE_DATE . ' <b>' . (($specials->fields['specials_date_available'] != '0001-01-01' and $specials->fields['specials_date_available'] != '') ? zen_date_short($specials->fields['specials_date_available']) : TEXT_NONE) . '</b>');
                $contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . (($specials->fields['expires_date'] != '0001-01-01' and $specials->fields['expires_date'] != '') ? zen_date_short($specials->fields['expires_date']) : TEXT_NONE) . '</b>');
                $contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . zen_date_short($sInfo->date_status_change));
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CATEGORIES, '&action=new_product' . '&cPath=' . zen_get_product_path($sInfo->products_id, 'override') . '&pID=' . $sInfo->products_id . '&product_type=' . zen_get_products_type($sInfo->products_id)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>');
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SPECIALS, 'action=pre_add') . '">' . zen_image_button('button_select.gif', IMAGE_SELECT) . '<br />' . TEXT_INFO_MANUAL . '</a><br /><br />');
            }
            break;
    }
    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>
        ?>
</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;
        }
        ?>
            </td>
<?php 
        if (zen_has_product_attributes($products_filter, 'false')) {
            ?>
            <td class="smallText" align="center"><?php 
<?php

/**
 * category_icon_display module
 *
 * @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';
Beispiel #7
0
 public function exportPrepareFields(array $fields)
 {
     $fields = parent::exportPrepareFields($fields);
     $products_id = $fields['products_id'];
     $tax_class_id = $fields['products_tax_class_id'];
     unset($fields['products_id'], $fields['products_tax_class_id']);
     $default_language_code = $this->first_language_code;
     global $db;
     if ($this->export_language == 'all') {
         $this->debugMessage('Products::exportPrepareFields, language = ' . $this->export_language . ', default language = ' . $default_language_code . ', sql: ' . $this->saved_data['products_description_sql'] . ', languages: ' . print_r($this->languages, true));
         foreach ($this->languages as $language_code => $language_id) {
             if ($language_code != $default_language_code) {
                 $description_info = $db->Execute(sprintf($this->saved_data['products_description_sql'], $products_id, $language_id));
                 if (!$description_info->EOF) {
                     $encoded_fields = $this->exportEncodeData($description_info->fields);
                     foreach ($encoded_fields as $field_name => $field_value) {
                         if ($field_name != 'products_id' && $field_name != 'language_id') {
                             $fields[$field_name . '_' . $language_code] = $field_value;
                         }
                     }
                 }
             }
         }
     }
     $fields['manufacturers_name'] = zen_get_products_manufacturers_name($products_id);
     $tax_class_info = $db->Execute("SELECT tax_class_title FROM " . TABLE_TAX_CLASS . " WHERE tax_class_id = {$tax_class_id} LIMIT 1");
     $fields['tax_class_title'] = $tax_class_info->EOF ? '' : $tax_class_info->fields['tax_class_title'];
     $cPath_array = explode('_', zen_get_product_path($products_id));
     $default_language_id = $this->languages[DEFAULT_LANGUAGE];
     $categories_name = '';
     foreach ($cPath_array as $next_category_id) {
         $category_info = $db->Execute("SELECT categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " WHERE categories_id = {$next_category_id} AND language_id = {$default_language_id} LIMIT 1");
         $categories_name .= ($category_info->EOF ? self::DBIO_UNKNOWN_VALUE : $category_info->fields['categories_name']) . '^';
     }
     $fields['categories_name'] = $this->exportEncodeData(substr($categories_name, 0, -1));
     return $fields;
 }
 /**
  * Get ZenCart view data.
  */
 public function getZcViewData($request)
 {
     // category path - no support for get_terms_to_filter table. does anybody use that?
     $manufacturerId = $request->query->getInt('manufacturers_id');
     $productId = $request->query->get('products_id');
     $show_welcome = false;
     if ($request->query->has('cPath')) {
         if (!empty($productId) && empty($manufacturerId)) {
             $request->query->set('cPath', zen_get_product_path($productId));
         } elseif (SHOW_CATEGORIES_ALWAYS == '1' && empty($manufacturerId)) {
             $show_welcome = true;
             $request->query->set('cPath', defined('CATEGORIES_START_MAIN') ? CATEGORIES_START_MAIN : '');
         }
     }
     // end category path
     define('PAGE_PARSE_START_TIME', microtime());
     $lng = new \language();
     $languageId = $request->getSession()->getLanguageId();
     // breadcrumb
     $robotsNoIndex = false;
     $validCategories = array();
     $cPathArray = (array) $request->attributes->get('categoryIds');
     foreach ($cPathArray as $categoryId) {
         $category = $this->container->get('categoryService')->getCategoryForId($categoryId, $languageId);
         if (null != $category) {
             $validCategories[] = $category;
         } elseif (SHOW_CATEGORIES_ALWAYS == 0) {
             $robotsNoIndex = true;
             break;
         }
     }
     // ZenMagick does most of the following , we should be able to reuse it.
     $manufacturer = null;
     $manufacturerId = $request->query->getInt('manufacturers_id');
     if (null != $manufacturerId) {
         $manufacturer = $this->container->get('manufacturerService')->getManufacturerForId($manufacturerId, $languageId);
     }
     $product = null;
     if (null != $productId) {
         $product = $this->container->get('productService')->getProductForId($productId);
     }
     $breadcrumb = $this->initCrumbs($validCategories, $manufacturer, $product);
     // end breakdcrumb
     $params = $request->attributes->get('_route_params');
     $canonicalLink = $this->get('router')->generate($request->getRequestId(), $params, true);
     $this_is_home_page = $this->isHomePage();
     $zv_onload = $this->getOnLoadJS();
     $tpl = compact('breadcrumb', 'canonicalLink', 'lng', 'robotsNoIndex', 'show_welcome', 'this_is_home_page', 'zv_onload');
     $tpl['session_started'] = true;
     return $tpl;
 }
 function _dispatchProduct($map, $data)
 {
     $product_id = $data->fields['products_id'];
     $value = '<a href="' . zen_href_link(FILENAME_CATEGORIES, '&action=new_product' . '&cPath=' . zen_get_product_path($data->fields['products_id'], 'override') . '&pID=' . $data->fields['products_id'] . '&product_type=' . zen_get_products_type($data->fields['products_id'])) . '">' . $data->fields['products_name'] . '</a>';
     #$value = $data->fields['products_name'];
     return $value;
 }
Beispiel #10
0
    // auto expire featured products
    require_once DIR_FS_FUNCTIONS . 'featured.php';
    zen_start_featured();
    zen_expire_featured();
    // auto expire salemaker sales
    require_once DIR_FS_FUNCTIONS . 'salemaker.php';
    zen_start_salemaker();
    zen_expire_salemaker();
    $_SESSION['update_expirations'] = 'true';
}
// calculate category path
if (isset($_REQUEST['cPath'])) {
    $cPath = $_REQUEST['cPath'];
} elseif (isset($_REQUEST['products_id']) && !zen_check_url_get_terms()) {
    //	} elseif (isset($_REQUEST['products_id']) && !isset($_REQUEST['manufacturers_id']) && !isset($_REQUEST['music_genres_id'])) {
    $cPath = zen_get_product_path($_REQUEST['products_id']);
} else {
    if (SHOW_CATEGORIES_ALWAYS == '1' && !zen_check_url_get_terms()) {
        $show_welcome = 'true';
        $cPath = defined('CATEGORIES_START_MAIN') ? CATEGORIES_START_MAIN : '';
    } else {
        $show_welcome = 'false';
        $cPath = '';
    }
}
if (zen_not_null($cPath)) {
    $cPath_array = zen_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = $cPath_array[sizeof($cPath_array) - 1];
} else {
    $current_category_id = 0;