コード例 #1
0
ファイル: coupon.php プロジェクト: sajad1441/TomatoShop-v1
 function toC_Coupon($coupon_code)
 {
     global $osC_Database, $osC_Language, $osC_CategoryTree;
     if (!empty($coupon_code)) {
         $Qcoupon = $osC_Database->query('select * from :table_coupons c, :table_coupons_description cd where c.coupons_id = cd.coupons_id and c.coupons_code = :coupons_code and cd.language_id = :language_id');
         $Qcoupon->bindTable(':table_coupons', TABLE_COUPONS);
         $Qcoupon->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
         $Qcoupon->bindValue(':coupons_code', $coupon_code);
         $Qcoupon->bindInt(':language_id', $osC_Language->getID());
         $Qcoupon->execute();
         if ($Qcoupon->numberOfRows() === 1) {
             $this->_data = $Qcoupon->toArray();
             //categories
             $QcouponCategories = $osC_Database->query('select categories_id from :table_coupons_to_categories where coupons_id = :coupons_id');
             $QcouponCategories->bindTable(':table_coupons_to_categories', TABLE_COUPONS_TO_CATEGORIES);
             $QcouponCategories->bindInt(':coupons_id', $this->_data['coupons_id']);
             $QcouponCategories->execute();
             while ($QcouponCategories->next()) {
                 $this->_categories[] = $QcouponCategories->valueInt('categories_id');
             }
             $QcouponCategories->freeResult();
             //get all sub categories
             if (!empty($this->_categories)) {
                 //add by tomatoshop
                 require_once 'category_tree.php';
                 $osC_CategoryTree = new osC_CategoryTree($categories_id);
                 //add by tomatoshop
                 $children = array();
                 foreach ($this->_categories as $categories_id) {
                     $osC_CategoryTree->getChildren($categories_id, $children);
                 }
                 $this->_categories = array_merge($this->_categories, $children);
                 //products
                 $QcouponProducts = $osC_Database->query('select products_id from :table_products_to_categories where categories_id in (' . implode(',', $this->_categories) . ')');
                 $QcouponProducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
                 $QcouponProducts->execute();
                 while ($QcouponProducts->next()) {
                     $this->_products[] = $QcouponProducts->valueInt('products_id');
                 }
                 $QcouponProducts->freeResult();
             } else {
                 //products
                 $QcouponProducts = $osC_Database->query('select products_id from :coupons_to_products where coupons_id = :coupons_id');
                 $QcouponProducts->bindTable(':coupons_to_products', TABLE_COUPONS_TO_PRODUCTS);
                 $QcouponProducts->bindInt(':coupons_id', $this->_data['coupons_id']);
                 $QcouponProducts->execute();
                 while ($QcouponProducts->next()) {
                     $this->_products[] = $QcouponProducts->valueInt('products_id');
                 }
                 $QcouponProducts->freeResult();
             }
         }
         $Qcoupon->freeResult();
     }
 }
コード例 #2
0
ファイル: categories.php プロジェクト: Doluci/tomatocart
 function loadCategoriesTree()
 {
     global $toC_Json, $osC_Language;
     $osC_CategoryTree = new osC_CategoryTree();
     $categories_array = array();
     $categories_array = $osC_CategoryTree->buildExtJsonTreeArray();
     echo $toC_Json->encode($categories_array);
 }
コード例 #3
0
ファイル: products.php プロジェクト: Doluci/tomatocart
 function getCategoriesTree()
 {
     global $toC_Json;
     $osC_CategoryTree = new osC_CategoryTree();
     $categories_array = $osC_CategoryTree->buildExtJsonTreeArray();
     echo $toC_Json->encode($categories_array);
 }
コード例 #4
0
ファイル: sitemap.php プロジェクト: CristianCCIT/shop4office
  Released under the GNU General Public License
*/
require 'includes/application_top.php';
require DIR_WS_MODULES . FILENAME_SITEMAP_SEO;
$keys_query = tep_db_query('SELECT name, value FROM seo WHERE type="sitemap"');
while ($keys = tep_db_fetch_array($keys_query)) {
    define('SITEMAP_' . strtoupper(str_replace('ë', 'e', $keys['name'])), $keys['value']);
}
/****************** DISPLAY CATEGORIES *********************/
$showCategories = '';
if (SITEMAP_CATEGORIEEN == '1') {
    $showCategories .= '<tr><td><h2>' . Translate('Categorie&euml;n') . '</h2></td></tr><tr><td height="10"></td></tr><tr><td class="sitemap">';
    $class = 'category_tree_no_products.php';
    $class = 'category_tree.php';
    require DIR_WS_CLASSES . $class;
    $osC_CategoryTree = new osC_CategoryTree();
    $showCategories .= $osC_CategoryTree->buildTree();
    $showCategories .= '</td></tr>';
}
/****************** DISPLAY INFOPAGES LINKS *********************/
$showInfoPages = '';
if (SITEMAP_INFOPAGINA == '1') {
    $sitemap_list = '';
    $countfirst = '';
    function tep_count_sitemap_children($nav_id)
    {
        $navigatie_count = 0;
        $navigatie_query = tep_db_query("select id from navigatie where parent_id = '" . (int) $nav_id . "'");
        while ($navigatie = tep_db_fetch_array($navigatie_query)) {
            $navigatie_count++;
        }
コード例 #5
0
  $Id: categories.php,v 1.27 2004/02/16 07:26:01 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/
?>
<!-- categories //-->
          <tr>
            <td>
<?php 
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
new infoBoxHeading($info_box_contents, true, false);
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setCategoryPath($cPath, '<b>', '</b>');
$osC_CategoryTree->setParentGroupString('', '');
$osC_CategoryTree->setParentString('', '->');
$osC_CategoryTree->setChildString('', '<br>');
$osC_CategoryTree->setSpacerString('&nbsp;', 2);
$info_box_contents = array();
$info_box_contents[] = array('text' => $osC_CategoryTree->buildTree());
new infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- categories_eof //-->
コード例 #6
0
ファイル: products.php プロジェクト: itnovator/oscommerce_cvs
  Copyright (c) 2005 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
// calculate category path
$cPath = isset($_GET['cPath']) ? $_GET['cPath'] : '';
if (!empty($cPath)) {
    $cPath_array = tep_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = end($cPath_array);
} else {
    $current_category_id = 0;
}
require '../includes/classes/category_tree.php';
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setSpacerString('&nbsp;', 2);
$categories_array = array();
foreach ($osC_CategoryTree->getTree() as $value) {
    $categories_array[] = array('id' => $value['id'], 'text' => $value['title']);
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (!isset($_GET['page']) || isset($_GET['page']) && !is_numeric($_GET['page'])) {
    $_GET['page'] = 1;
}
if (!isset($_GET['search'])) {
    $_GET['search'] = '';
}
if (!empty($action)) {
    switch ($action) {
        case 'delete_product_confirm':
コード例 #7
0
ファイル: edit.php プロジェクト: heshuai64/gamestore
</th>
            </tr>
          </thead>
          <tbody>
<?php 
$product_categories_array = array();
if (isset($osC_ObjectInfo)) {
    $Qcategories = $osC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id');
    $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
    $Qcategories->bindInt(':products_id', $osC_ObjectInfo->getInt('products_id'));
    $Qcategories->execute();
    while ($Qcategories->next()) {
        $product_categories_array[] = $Qcategories->valueInt('categories_id');
    }
}
$assignedCategoryTree = new osC_CategoryTree();
$assignedCategoryTree->setBreadcrumbUsage(false);
$assignedCategoryTree->setSpacerString('&nbsp;', 5);
foreach ($assignedCategoryTree->getArray() as $value) {
    echo '          <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . "\n" . '            <td>' . osc_draw_checkbox_field('categories[]', $value['id'], in_array($value['id'], $product_categories_array), 'id="categories_' . $value['id'] . '"') . '</td>' . "\n" . '            <td><a href="#" onclick="document.product.categories_' . $value['id'] . '.checked=!document.product.categories_' . $value['id'] . '.checked;">' . $value['title'] . '</a></td>' . "\n" . '          </tr>' . "\n";
}
?>
        </table></td>
      </tr>
    </table>
  </div>
</div>

<p align="right"><?php 
echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&cID=' . $_GET['cID']) . '\';" class="operationButton" />';
?>
コード例 #8
0
ファイル: categories.php プロジェクト: Doluci/tomatocart
 function setStatus($id, $flag, $product_flag)
 {
     global $osC_Database;
     include_once '../includes/classes/category_tree.php';
     $osC_CategoryTree = new osC_CategoryTree(true, true, false);
     $error = false;
     $subcategories_array = array($id);
     $subcategories_array = $osC_CategoryTree->getChildren($id, $subcategories_array);
     $categories_id = implode(',', $subcategories_array);
     $Qstatus = $osC_Database->query('update :table_categories set categories_status = :categories_status where categories_id in (:categories_id)');
     $Qstatus->bindTable(':table_categories', TABLE_CATEGORIES);
     $Qstatus->bindRaw(":categories_id", $categories_id);
     $Qstatus->bindValue(":categories_status", $flag);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         if ($flag == 0 && $product_flag == 1) {
             $Qupdate = $osC_Database->query('update :table_products set products_status = 0 where products_id in (select products_id from :table_products_to_categories where categories_id in (:categories_id))');
             $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
             $Qupdate->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qupdate->bindRaw(":categories_id", $categories_id);
             $Qupdate->execute();
         }
     }
     if (!$osC_Database->isError()) {
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         osC_Cache::clear('sefu-products');
         osC_Cache::clear('new_products');
         return true;
     }
     return false;
 }
コード例 #9
0
  Copyright (c) 2005 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
// calculate category path
$cPath = isset($_GET['cPath']) ? $_GET['cPath'] : '';
if (!empty($cPath)) {
    $cPath_array = tep_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = end($cPath_array);
} else {
    $current_category_id = 0;
}
require '../includes/classes/category_tree.php';
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setSpacerString('&nbsp;', 2);
$categories_array = array();
foreach ($osC_CategoryTree->getTree() as $value) {
    $categories_array[] = array('id' => $value['id'], 'text' => $value['title']);
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (!isset($_GET['page']) || isset($_GET['page']) && !is_numeric($_GET['page'])) {
    $_GET['page'] = 1;
}
if (!isset($_GET['search'])) {
    $_GET['search'] = '';
}
if (!empty($action)) {
    switch ($action) {
        case 'save_category':
コード例 #10
0
 function listCategories()
 {
     global $toC_Json, $osC_Language, $osC_Database;
     $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
     $limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
     $Qcategories = $osC_Database->query('select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from :table_categories c, :table_categories_description cd where c.categories_id = cd.categories_id and cd.language_id = :language_id');
     $Qcategories->appendQuery('and c.parent_id = :parent_id');
     if (isset($_REQUEST['categories_id']) && !empty($_REQUEST['categories_id'])) {
         $Qcategories->bindInt(':parent_id', $_REQUEST['categories_id']);
     } else {
         $Qcategories->bindInt(':parent_id', 0);
     }
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
         $Qcategories->appendQuery('and cd.categories_name like :categories_name');
         $Qcategories->bindValue(':categories_name', '%' . $_REQUEST['search'] . '%');
     }
     $Qcategories->appendQuery('order by c.sort_order, cd.categories_name');
     $Qcategories->bindTable(':table_categories', TABLE_CATEGORIES);
     $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
     $Qcategories->bindInt(':language_id', $osC_Language->getID());
     $Qcategories->setExtBatchLimit($start, $limit);
     $Qcategories->execute();
     $records = array();
     $osC_CategoryTree = new osC_CategoryTree();
     while ($Qcategories->next()) {
         $records[] = array('categories_id' => $Qcategories->value('categories_id'), 'categories_name' => $Qcategories->value('categories_name'), 'path' => $osC_CategoryTree->buildBreadcrumb($Qcategories->valueInt('categories_id')));
     }
     $response = array(EXT_JSON_READER_TOTAL => $Qcategories->getBatchSize(), EXT_JSON_READER_ROOT => $records);
     echo $toC_Json->encode($response);
 }
コード例 #11
0
ファイル: sitemap.php プロジェクト: eosc/EosC-2.3
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '10');
?>
</td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2">
          <tr>
            <td width="60%" class="main" valign="top"><?php 
require DIR_WS_CLASSES . 'category_tree.php';
$osC_CategoryTree = new osC_CategoryTree();
echo $osC_CategoryTree->buildTree();
?>
</td>
            <td width="40%" class="main" valign="top">
              <ul>
                <li><?php 
echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . PAGE_ACCOUNT . '</a>';
?>
</li>
                <ul>
                  <li><?php 
echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . PAGE_ACCOUNT_EDIT . '</a>';
?>
</li>
                  <li><?php 
コード例 #12
0
ファイル: sitemap.php プロジェクト: itnovator/oscommerce_cvs
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '10');
?>
</td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td width="50%" class="main" valign="top">
<?php 
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setShowCategoryProductCount(false);
echo $osC_CategoryTree->buildTree();
?>
            </td>
            <td width="50%" class="main" valign="top">
              <ul>
                <li><?php 
echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . PAGE_ACCOUNT . '</a>';
?>
</li>
                  <ul>
                    <li><?php 
echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'edit', 'SSL') . '">' . PAGE_ACCOUNT_EDIT . '</a>';
?>
</li>