Exemple #1
0
function b_myshop_rated_edit($options)
{
    // '10|0';	// Display 10 products from all categories or specify category id
    global $xoopsConfig;
    include XOOPS_ROOT_PATH . '/modules/myshop/include/common.php';
    include_once MYSHOP_PATH . 'class/tree.php';
    $tblCategories = array();
    $tblCategories = $h_myshop_cat->getAllCategories();
    $mytree = new Myshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
    $form = '';
    $checkeds = array('', '');
    $checkeds[$options[1]] = 'checked';
    $form .= "<table border='0'>";
    $form .= '<tr><td>' . _MB_MYSHOP_PRODUCTS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_MYSHOP_ALL_CATEGORIES);
    $form .= '<tr><td>' . _MB_MYSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
    $form .= '</table>';
    return $form;
}
Exemple #2
0
<?php

/**
 * Categories map
 */
require 'header.php';
$GLOBALS['current_category'] = -1;
$xoopsOption['template_main'] = 'myshop_map.html';
require_once XOOPS_ROOT_PATH . '/header.php';
require_once MYSHOP_PATH . 'class/tree.php';
$xoopsTpl->assign('mod_pref', $mod_pref);
$categories = array();
$categories = $h_myshop_cat->getAllCategories();
$mytree = new Myshop_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
$tree = $mytree->makeTreeAsArray('cat_title', '-');
foreach ($tree as $key => $value) {
    if (isset($categories[$key])) {
        $category = $categories[$key];
        $xoopsTpl->append('categories', array('cat_url_rewrited' => $category->getLink(), 'cat_href_title' => $category->getHrefTitle(), 'cat_title' => $value));
    }
}
myshop_utils::setCSS();
if (file_exists(MYSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php')) {
    require_once MYSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php';
} else {
    require_once MYSHOP_PATH . 'language/english/modinfo.php';
}
$xoopsTpl->assign('global_advert', myshop_utils::getModuleOption('advertisement'));
$xoopsTpl->assign('breadcrumb', myshop_utils::breadcrumb(array(MYSHOP_URL . basename(__FILE__) => _MI_MYSHOP_SMNAME4)));
$title = _MI_MYSHOP_SMNAME4 . ' - ' . myshop_utils::getModuleName();
myshop_utils::setMetas($title, $title);
Exemple #3
0
<?php

/**
 * Advanced Search
 */
if (!defined('XOOPS_ROOT_PATH')) {
    die('XOOPS root path not defined');
}
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$sform = new XoopsThemeForm(myshop_utils::getModuleName() . ' - ' . _MYSHOP_SEARCHFOR, 'productsSearchForm', MYSHOP_URL . 'search.php', 'post');
$sform->addElement(new XoopsFormText(_MYSHOP_TEXT, 'product_text', 50, 255, ''), false);
$sform->addElement(new XoopsFormSelectMatchOption(_MYSHOP_TYPE, 'search_type', 3), false);
// Select categories
$categorySelect = new XoopsFormSelect(_MYSHOP_CATEGORY, 'product_category', 0);
$mytree = new Myshop_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
$select_categ = $mytree->makeSelBox('cat_pid', 'cat_title', '-');
$select_categ = str_replace("<select id='cat_pid[]' name='cat_pid[]' size='5' multiple='multipe'>", '', $select_categ);
$select_categ = str_replace('</select>', '', $select_categ);
$select_categ = explode("</option>", $select_categ);
$tblTmp = array();
//$tblTmp[0] = _MYSHOP_ALL_CATEGORIES;
foreach ($select_categ as $item) {
    $array = array();
    // TODO : Simplify
    preg_match("/<option value=\\'([0-9]*)\\'>/", $item, $array);
    // Get each category ID
    $label = preg_replace("/<option value=\\'([0-9]*)\\'>/", '', $item);
    // Keep label only
    if (isset($array[1])) {
        $catId = intval($array[1]);
        $tblTmp[$catId] = $label;
Exemple #4
0
    }
}
// Display blocks
$xoopsOption['template_main'] = 'myshop_category.html';
require_once XOOPS_ROOT_PATH . '/header.php';
$vatArray = $tbl_categories = array();
$limit = myshop_utils::getModuleOption('perpage');
// VAT
$vatArray = $h_myshop_vat->getAllVats();
// Ccategories
$categories = $h_myshop_cat->getAllCategories();
// Template options
$xoopsTpl->assign('mod_pref', $mod_pref);
require_once MYSHOP_PATH . 'class/tree.php';
$tbl_tmp = array();
$mytree = new Myshop_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
// Parent category or no category specified
if (is_object($category) && $category->getVar('cat_pid') == 0 || $cat_cid == 0) {
    // Display 4 blocks
    $xoopsTpl->assign('case', 1);
    $tblChildsO = $tblChilds = array();
    $tblChilds[] = $cat_cid;
    if ($cat_cid > 0) {
        $tblChildsO = $mytree->getAllChild($cat_cid);
        foreach ($tblChildsO as $item) {
            $tblChilds[] = $item->getVar('cat_cid');
        }
    }
    if (is_object($category)) {
        // Speficic category
        $xoopsTpl->assign('category', $category->toArray());
Exemple #5
0
 case 'default':
     xoops_cp_header();
     myshop_adminMenu(8);
     myshop_utils::htitle(_MI_MYSHOP_ADMENU7, 4);
     require_once MYSHOP_PATH . 'class/tree.php';
     $sform = new XoopsThemeForm(_MI_MYSHOP_ADMENU7, 'frmnewsletter', $baseurl);
     $datesTray = new XoopsFormElementTray(_AM_MYSHOP_NEWSLETTER_BETWEEN);
     $minDate = $maxDate = 0;
     $h_myshop_products->getMinMaxPublishedDate($minDate, $maxDate);
     $date1 = new XoopsFormTextDateSelect('', 'date1', 15, $minDate);
     $date2 = new XoopsFormTextDateSelect(_AM_MYSHOP_EXPORT_AND, 'date2', 15, $maxDate);
     $datesTray->addElement($date1);
     $datesTray->addElement($date2);
     $sform->addElement($datesTray);
     $categories = $h_myshop_cat->getAllCategories();
     $mytree = new Myshop_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
     $htmlSelect = $mytree->makeSelBox('cat_cid', 'cat_title', '-', 0, _AM_MYSHOP_ALL);
     $sform->addElement(new XoopsFormLabel(_AM_MYSHOP_IN_CATEGORY, $htmlSelect), true);
     $sform->addElement(new XoopsFormHidden('op', 'newsletter'), false);
     $sform->addElement(new XoopsFormHidden('action', 'launch'), false);
     $sform->addElement(new XoopsFormRadioYN(_AM_MYSHOP_REMOVE_BR, 'removebr', 1), false);
     $sform->addElement(new XoopsFormRadioYN(_AM_MYSHOP_NEWSLETTER_HTML_TAGS, 'removehtml', 0), false);
     $sform->addElement(new XoopsFormTextArea(_AM_MYSHOP_NEWSLETTER_HEADER, 'header', '', 4, 70), false);
     $sform->addElement(new XoopsFormTextArea(_AM_MYSHOP_NEWSLETTER_FOOTER, 'footer', '', 4, 70), false);
     $button_tray = new XoopsFormElementTray('', '');
     $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
     $button_tray->addElement($submit_btn);
     $sform->addElement($button_tray);
     $sform = myshop_utils::formMarkRequiredFields($sform);
     $sform->display();
     break;
Exemple #6
0
 }
 $discountForTemplate['disc_shipping_type_checked1'] = $disc_shipping_type_checked1;
 $discountForTemplate['disc_shipping_type_checked2'] = $disc_shipping_type_checked2;
 $discountForTemplate['disc_shipping_type_checked3'] = $disc_shipping_type_checked3;
 $discountForTemplate['disc_shipping_type_checked4'] = $disc_shipping_type_checked4;
 // Groups
 $xoopsTpl->assign('disc_groups_selected', $item->getVar('disc_group'));
 $member_handler =& xoops_gethandler('member');
 $groups = array();
 $groups = $member_handler->getGroupList();
 $groups[0] = _ALL;
 ksort($groups);
 $xoopsTpl->assign('disc_groups_options', $groups);
 // Categories
 $categories = $h_myshop_cat->getAllCategories();
 $mytree = new Myshop_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
 $categoriesSelect = $mytree->makeSelBox('disc_cat_cid', 'cat_title', '-', $item->getVar('disc_cat_cid'), _ALL);
 $discountForTemplate['disc_cat_cid_select'] = $categoriesSelect;
 // stores
 $stores = $h_myshop_stores->getList();
 $stores[0] = _ALL;
 ksort($stores);
 $xoopsTpl->assign('disc_store_id_options', $stores);
 $xoopsTpl->assign('disc_store_id_selected', $item->getVar('disc_store_id'));
 // Category
 $xoopsTpl->assign('disc_cat_cid_options', $categoriesSelect);
 // Products
 $products = $h_myshop_products->getList();
 $products[0] = _ALL;
 ksort($products);
 $xoopsTpl->assign('disc_product_id_options', $products);
Exemple #7
0
function b_myshop_category_show($options)
{
    global $xoopsTpl;
    $block = array();
    include XOOPS_ROOT_PATH . '/modules/myshop/include/common.php';
    $url = MYSHOP_URL . 'include/myshop.css';
    $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />");
    $block['nostock_msg'] = myshop_utils::getModuleOption('nostock_msg');
    if (intval($options[0]) == 0) {
        $block['block_option'] = 0;
        if (!isset($GLOBALS['current_category']) || $GLOBALS['current_category'] == -1) {
            return false;
        }
        $cat_cid = intval($GLOBALS['current_category']);
        include XOOPS_ROOT_PATH . '/modules/myshop/include/common.php';
        if ($cat_cid > 0) {
            include_once XOOPS_ROOT_PATH . '/class/tree.php';
            $tbl_categories = $tblChilds = $tbl_tmp = array();
            $tbl_categories = $h_myshop_cat->getAllCategories();
            $mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid');
            $tblChilds = $mytree->getAllChild($cat_cid);
            foreach ($tblChilds as $item) {
                $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . myshop_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>";
            }
            $block['block_categories'] = $tbl_tmp;
            $category = null;
            if ($cat_cid > 0) {
                $category = $h_myshop_cat->get($cat_cid);
                if (is_object($category)) {
                    $block['block_current_category'] = $category->toArray();
                }
            }
        } else {
            $tbl_categories = array();
            $criteria = new Criteria('cat_pid', 0, '=');
            $criteria->setSort('cat_title');
            $tbl_categories = $h_myshop_cat->getObjects($criteria, true);
            foreach ($tbl_categories as $item) {
                $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . myshop_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>";
            }
            $block['block_categories'] = $tbl_tmp;
        }
    } else {
        // Normal display
        $block['block_option'] = 1;
        include XOOPS_ROOT_PATH . '/modules/myshop/include/common.php';
        include_once MYSHOP_PATH . 'class/tree.php';
        $tbl_categories = $h_myshop_cat->getAllCategories();
        $mytree = new Myshop_XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid');
        $jump = MYSHOP_URL . "category.php?cat_cid=";
        $additional = "onchange='location=\"" . $jump . "\"+this.options[this.selectedIndex].value'";
        if (isset($GLOBALS['current_category']) && $GLOBALS['current_category'] != -1) {
            $cat_cid = intval($GLOBALS['current_category']);
        } else {
            $cat_cid = 0;
        }
        $htmlSelect = $mytree->makeSelBox('cat_cid', 'cat_title', '-', $cat_cid, false, 0, $additional);
        $block['htmlSelect'] = $htmlSelect;
    }
    return $block;
}