示例#1
0
文件: category.php 项目: naao/myshop
     require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
     $catLink = $category->getLink();
     $pagenav = new XoopsPageNav($productsCount, $limit, $start, 'start', 'cat_cid=' . $cat_cid);
     $xoopsTpl->assign('pagenav', $pagenav->renderNav());
 } else {
     $xoopsTpl->assign('pagenav', '');
 }
 // Breadcrumb
 $ancestors = $mytree->getAllParent($cat_cid);
 $ancestors = array_reverse($ancestors);
 $tbl_tmp[] = "<a href='" . MYSHOP_URL . "index.php' title='" . myshop_utils::makeHrefTitle(myshop_utils::getModuleName()) . "'>" . myshop_utils::getModuleName() . '</a>';
 foreach ($ancestors as $item) {
     $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . myshop_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . '</a>';
 }
 // Add current category
 $tbl_tmp[] = "<a href='" . $category->getLink() . "' title='" . myshop_utils::makeHrefTitle($category->getVar('cat_title')) . "'>" . $category->getVar('cat_title') . '</a>';
 $breadcrumb = implode(' &raquo; ', $tbl_tmp);
 $xoopsTpl->assign('breadcrumb', $breadcrumb);
 // Meta
 $title = strip_tags($breadcrumb);
 if (!myshop_utils::getModuleOption('manual_meta')) {
     myshop_utils::setMetas($title, $title, str_replace('&raquo;', ',', $title));
 } else {
     $pageTitle = xoops_trim($category->getVar('cat_metatitle')) == '' ? $title : $category->getVar('cat_metatitle');
     $metaDescription = xoops_trim($category->getVar('cat_metadescription')) != '' ? $category->getVar('cat_metadescription') : $title;
     $metaKeywords = xoops_trim($category->getVar('cat_metakeywords'));
     myshop_utils::setMetas($pageTitle, $metaDescription, $metaKeywords);
 }
 // Products Data
 $products = array();
 $myshop_shelf_parameters->resetDefaultValues()->setProductsType('recent')->setCategory($cat_cid)->setStart($start)->setLimit($limit)->setSort('product_submitted DESC, product_title');
示例#2
0
 /**
  * Renturn tag <a> 
  *
  * @return string
  */
 function getHrefTitle()
 {
     return myshop_utils::makeHrefTitle($this->getVar('cat_title'));
 }
示例#3
0
文件: product.php 项目: naao/myshop
    $tblTmp = array();
    $tblTmp = $h_myshop_products->getRecentProducts(0, $count, 0, 'product_submitted DESC, product_title', '', $product_id);
    foreach ($tblTmp as $item) {
        $datas = array('last_categs_product_title' => $item->getVar('product_title'), 'last_categs_product_url_rewrited' => $item->getLink(), 'last_categs_product_href_title' => myshop_utils::makeHrefTitle($item->getVar('product_title')));
        $xoopsTpl->append('product_all_categs', $datas);
    }
    unset($tblTmp);
}
// x recent products of this category
$count = myshop_utils::getModuleOption('summarycategory');
$xoopsTpl->assign('summarycategory', $count);
if ($count > 0) {
    $tblTmp = array();
    $tblTmp = $h_myshop_products->getRecentProducts(0, $count, $product->getVar('product_cid'), 'product_submitted DESC, product_title', '', $product_id);
    foreach ($tblTmp as $item) {
        $datas = array('last_categ_product_title' => $item->getVar('product_title'), 'last_categ_product_url_rewrited' => $item->getLink(), 'last_categ_product_href_title' => myshop_utils::makeHrefTitle($item->getVar('product_title')));
        $xoopsTpl->append('product_current_categ', $datas);
    }
    unset($tblTmp);
}
// Related product
$count = myshop_utils::getModuleOption('better_together');
$xoopsTpl->assign('better_together', $count);
if ($count > 0) {
    $productWith = 0;
    // Most selled product
    $productWith = $h_myshop_caddy->getBestWith($product->getVar('product_id'));
    if ($productWith > 0) {
        $tmpProduct = null;
        $tmpProduct = $h_myshop_products->get($productWith);
        if (is_object($tmpProduct)) {
示例#4
0
 /**
  * Rentourne la chaine à envoyer dans une balise <a> pour l'attribut href
  *
  * @return string
  */
 function getHrefTitle()
 {
     return myshop_utils::makeHrefTitle($this->getVar('manu_commercialname') . ' ' . $this->getVar('manu_name'));
 }
示例#5
0
 /**
  * Return products data to show
  *
  * @param string $format
  * @return array
  */
 function toArray($format = 's')
 {
     $ret = array();
     $ret = parent::toArray($format);
     $myshop_Currency = myshop_Currency::getInstance();
     $ret['product_price_formated'] = $myshop_Currency->amountForDisplay($this->getVar('product_price'));
     $ret['product_shipping_price_formated'] = $myshop_Currency->amountForDisplay($this->getVar('product_shipping_price'));
     $ret['product_discount_price_formated'] = $myshop_Currency->amountForDisplay($this->getVar('product_discount_price'));
     $ret['product_price_ttc'] = $myshop_Currency->amountForDisplay($this->getTTC());
     $ret['product_ecotaxe_formated'] = $myshop_Currency->amountForDisplay($this->getVar('product_ecotaxe'));
     if (intval($this->getVar('product_discount_price')) != 0) {
         $ret['product_discount_price_ttc'] = $myshop_Currency->amountForDisplay($this->getDiscountTTC());
     } else {
         $ret['product_discount_price_ttc'] = '';
     }
     $ret['product_tooltip'] = myshop_utils::makeInfotips($this->getVar('product_description'));
     $ret['product_url_rewrited'] = $this->getLink();
     $ret['product_href_title'] = myshop_utils::makeHrefTitle($this->getVar('product_title'));
     $ret['product_recommended'] = $this->isRecommended();
     $ret['product_recommended_picture'] = $this->recommendedPicture();
     $ret['product_image_full_url'] = $this->getPictureUrl();
     $ret['product_thumb_full_url'] = $this->getThumbUrl();
     $ret['product_image_full_path'] = $this->getPicturePath();
     $ret['product_thumb_full_path'] = $this->getThumbPath();
     $ret['product_shorten_summary'] = myshop_utils::truncate_tagsafe($this->getVar('product_summary'), MYSHOP_SUMMARY_MAXLENGTH);
     $ret['product_shorten_description'] = myshop_utils::truncate_tagsafe($this->getVar('product_description'), MYSHOP_SUMMARY_MAXLENGTH);
     return $ret;
 }
示例#6
0
文件: search.php 项目: naao/myshop
    // Search stores
    if (isset($_POST['product_stores'])) {
        $stores = intval($_POST['product_stores']);
        if ($stores > 0) {
            $sql .= ' AND product_store_id = ' . $stores;
        }
    }
    $sql .= ' GROUP BY b.product_id ORDER BY product_submitted DESC';
    $result = $xoopsDB->query($sql);
    $ret = array();
    $tempProduct = $h_myshop_products->create(true);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $ret = array();
        $ret['link'] = $tempProduct->getLink($myrow['product_id'], $myrow['product_title']);
        $ret['title'] = $myts->htmlSpecialChars($myrow['product_title']);
        $ret['href_title'] = myshop_utils::makeHrefTitle($myts->htmlSpecialChars($myrow['product_title']));
        $ret['time'] = $myrow['product_submitted'];
        $ret['uid'] = $myrow['product_submitter'];
        $xoopsTpl->append('products', $ret);
    }
    unset($tempProduct);
} else {
    $xoopsTpl->assign('search_results', false);
    $xoopsTpl->assign('global_advert', myshop_utils::getModuleOption('advertisement'));
    $xoopsTpl->assign('breadcrumb', myshop_utils::breadcrumb(array(MYSHOP_URL . basename(__FILE__) => _MYSHOP_SEARCHFOR)));
    myshop_utils::setMetas(myshop_utils::getModuleName() . ' - ' . _MYSHOP_SEARCHFOR, myshop_utils::getModuleName() . ' - ' . _MYSHOP_SEARCHFOR);
}
require_once MYSHOP_PATH . 'include/product_search_form.php';
$sform = myshop_utils::formMarkRequiredFields($sform);
$xoopsTpl->assign('search_form', $sform->render());
myshop_utils::setCSS();
示例#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;
}