Пример #1
0
     $attributeParameters .= "</div>\n";
     // ****
     $attributeParameters .= "</div>";
     $sform->addElement(new XoopsFormLabel(_AM_OLEDRION_ATTRIBUTE_PARAMETERS, $attributeParameters));
     // *******************************************
     // Attribut requis
     $sform->addElement(new XoopsFormRadioYN(_AM_OLEDRION_ATTRIBUTE_REQUIRED, 'attribute_mandatory', $item->getVar('attribute_mandatory')), true);
     // Les options
     $divContent = "<div class='ajaxOptions' id='ajaxOptions'></div>";
     $ajaxOptions = new XoopsFormLabel(_AM_OLEDRION_ATTRIBUTE_OPTIONS, $divContent);
     $sform->addElement($ajaxOptions, false);
     $button_tray = new XoopsFormElementTray('', '');
     $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit');
     $button_tray->addElement($submit_btn);
     $sform->addElement($button_tray);
     oledrion_utils::callJavascriptFile('attributes.js', false, true);
     $sform = oledrion_utils::formMarkRequiredFields($sform);
     $sform->display();
     include_once 'admin_footer.php';
     break;
     // ****************************************************************************************************************
 // ****************************************************************************************************************
 case 'saveedit':
     // Sauvegarde de l'option
     // ****************************************************************************************************************
     xoops_cp_header();
     $id = isset($_POST['attribute_id']) ? intval($_POST['attribute_id']) : 0;
     if (!empty($id)) {
         $edit = true;
         $item = $oledrion_handlers->h_oledrion_attributes->get($id);
         if (!is_object($item)) {
Пример #2
0
// Préférences du module
$xoopsTpl->assign('mod_pref', $mod_pref);
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$limit = oledrion_utils::getModuleOption('perpage');
// Lecture des produits
$itemsCount = $oledrion_shelf->getProductsCount('recent');
if ($itemsCount > $limit) {
    $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start');
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
}
$products = array();
$oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recent')->setStart($start)->setLimit($limit)->setSort('product_submitted DESC, product_title');
$products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
if (isset($products['lastTitle'])) {
    $lastTitle = strip_tags($products['lastTitle']);
    unset($products['lastTitle']);
}
$xoopsTpl->assign('products', $products);
$xoopsTpl->assign('pdf_catalog', oledrion_utils::getModuleOption('pdf_catalog'));
oledrion_utils::setCSS();
if (!OLEDRION_MY_THEME_USES_JQUERY) {
    oledrion_utils::callJavascriptFile('jquery/jquery.js');
}
oledrion_utils::callJavascriptFile('noconflict.js');
oledrion_utils::callJavascriptFile('tablesorter/jquery.tablesorter.min.js');
oledrion_utils::loadLanguageFile('modinfo.php');
$xoopsTpl->assign('global_advert', oledrion_utils::getModuleOption('advertisement'));
$xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb(array(OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME6)));
$title = _MI_OLEDRION_SMNAME6 . ' - ' . oledrion_utils::getModuleName();
oledrion_utils::setMetas($title, $title);
require_once XOOPS_ROOT_PATH . '/footer.php';
Пример #3
0
             $tmp['product_price_ttc'] = oledrion_utils::getTTC($tmpProduct->getVar('product_price'), $tblVat[$tmpProduct->getVar('product_vat_id')]->getVar('vat_rate'));
             $tmp['product_discount_price_ttc'] = oledrion_utils::getTTC($tmpProduct->getVar('product_discount_price'), $tblVat[$tmpProduct->getVar('product_vat_id')]->getVar('vat_rate'));
             $xoopsTpl->assign('bestwith', $tmp);
         }
     }
 }
 // Notation produit *********************************************************************************
 if (oledrion_utils::getModuleOption('rateproducts') == 1) {
     $canRate = true;
     if ($currentUser != 0) {
         $canRate = !$h_oledrion_votedata->hasUserAlreadyVoted($currentUser, $product->getVar('product_id'));
     } else {
         $canRate = !$h_oledrion_votedata->hasAnonymousAlreadyVoted('', $product->getVar('product_id'));
     }
     $xoTheme->addScript("browse.php?Frameworks/jquery/jquery.js");
     oledrion_utils::callJavascriptFile('rateit.js');
     oledrion_utils::setCSS(OLEDRION_URL . 'assets/css/rateit.css');
     $xoopsTpl->assign('userCanRate', $canRate);
 }
 // Meta et CSS ************************************************************************************
 oledrion_utils::setCSS();
 oledrion_utils::setLocalCSS($xoopsConfig['language']);
 if (oledrion_utils::getModuleOption('manual_meta')) {
     $pageTitle = xoops_trim($product->getVar('product_metatitle')) == '' ? $title : $product->getVar('product_metatitle');
     $metaDescription = xoops_trim($product->getVar('product_metadescription')) != '' ? $product->getVar('product_metadescription') : $title;
     $metaKeywords = xoops_trim($product->getVar('product_metakeywords')) != '' ? $product->getVar('product_metakeywords') : oledrion_utils::createMetaKeywords($product->getVar('product_title') . ' ' . $product->getVar('product_summary') . ' ' . $product->getVar('product_description'));
     oledrion_utils::setMetas($pageTitle, $metaDescription, $metaKeywords);
 } else {
     oledrion_utils::setMetas($title, $title, oledrion_utils::createMetaKeywords($product->getVar('product_title') . ' ' . $product->getVar('product_summary') . ' ' . $product->getVar('product_description')));
 }
 require_once XOOPS_ROOT_PATH . '/include/comment_view.php';
Пример #4
0
 /**
  * Construit un sélecteur de produit(s) en fonction des paramètres et en tenant compte du nombre total de produits dans la base
  *
  * @todo: Remplacer les paramètres par un objet paramètre et/ou un tableau
  * @param  string  $caption     Le titre du sélecteur
  * @param  string  $name        Le nom du champ qui receuille les produits
  * @param  mixed   $value       La valeur sélectionnées
  * @param  integer $size        Le nombre d'éléments visibles dans le sélecteur
  * @param  boolean $multiple    Indique si c'est un sélecteur multiple ou pas
  * @param  array   $values      Les valeurs sélectionnées ou les valeurs qui font le sélecteur
  * @param  boolean $showAll     Indique s'il faut voir tous les produits ou pas (pas publiés et en stock)
  * @param  string  $sort        Zone de tri
  * @param  string  $order       Ordre de tri
  * @param  string  $formName    Nom du formulaire
  * @param  string  $description Description à rajouter à la zone
  * @param  mixed   $withNull    Option à rajouter en premier
  * @return object  Retourne soit un objet de type tray {@link XoopsFormElementTray} soit un select {@link XoopsFormSelect}
  */
 public function productSelector(oledrion_parameters $parameters)
 {
     $parameters = $parameters->extend(new oledrion_parameters(array('caption' => '', 'name' => '', 'value' => null, 'size' => 1, 'multiple' => false, 'values' => null, 'showAll' => true, 'sort' => 'product_title', 'order' => 'ASC', 'formName' => '', 'description' => '', 'withNull' => null)));
     static $jqueryIncluded = null;
     require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('product_id', 0, '<>'));
     if (!$parameters['showAll']) {
         if (oledrion_utils::getModuleOption('show_unpublished') == 0) {
             // Ne pas afficher les produits qui ne sont pas publiés
             $criteria->add(new Criteria('product_submitted', time(), '<='));
         }
         if (oledrion_utils::getModuleOption('nostock_display') == 0) {
             // Se limiter aux seuls produits encore en stock
             $criteria->add(new Criteria('product_stock', 0, '>'));
         }
     }
     $criteria->setSort($parameters['sort']);
     $criteria->setOrder($parameters['order']);
     $itemsCount = $this->getCount($criteria);
     if ($itemsCount > oledrion_utils::getModuleOption('max_products')) {
         // Il faut créer notre propre sélecteur
         if ($parameters['multiple']) {
             if ($jqueryIncluded == null) {
                 $jqueryIncluded = true;
                 global $xoTheme;
                 $xoTheme->addScript("browse.php?Frameworks/jquery/jquery.js");
             }
             oledrion_utils::callJavascriptFile('select/select.js', false, true);
             $productTray = new XoopsFormElementTray($parameters['caption'], '');
             $productsList = new XoopsFormSelect('', $parameters['name'], $parameters['values'], $parameters['size'], $parameters['multiple']);
             // Recherche des produits
             $selectedProducts = $this->getList(new Criteria('product_id', '(' . implode(',', $parameters['values']) . ')', 'IN'));
             $productsList->addOptionArray($selectedProducts);
             // Les valeurs sélectionnées
             $productTray->addElement($productsList);
             $removeButton = new XoopsFormButton('', 'removeProduct', _AM_OLEDRION_REMOVE_SELECTED, 'button');
             if (oledrion_utils::isX20()) {
                 $removeButton->setExtra(" onclick=\"removeOptionSelected('" . $parameters['name'] . "[]');\"");
             } else {
                 $removeButton->setExtra(" onclick=\"removeOptionSelected('" . $parameters['name'] . "');\"");
             }
             $productTray->addElement($removeButton);
             if (oledrion_utils::isX20()) {
                 $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=1&amp;callerName=" . $parameters['name'] . "[]', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_OTHER_P . "</a>";
             } else {
                 $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=1&amp;callerName=" . $parameters['name'] . "', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_OTHER_P . "</a>";
             }
             $linkLabel = new xoopsFormLabel('', '<br />' . $link);
             $productTray->addElement($linkLabel);
             echo "<script type=\"text/javascript\">\n";
             echo "jQuery().ready(function(\$) {\n";
             echo "\$(\"#" . $parameters['formName'] . "\").submit( function() {\n";
             echo "\tselectAll('" . $parameters['name'] . "', true);\n";
             echo "} );\n";
             echo "});\n";
             echo "</script>\n";
         } else {
             // Pas de sélection multiple
             $productTray = new XoopsFormElementTray($parameters['caption'], '');
             $productsList = new XoopsFormSelect('', $parameters['name'], $parameters['value'], $parameters['size'], $parameters['multiple']);
             // Recherche des produits
             if ($parameters['value'] > 0) {
                 $selectedProducts = $this->getList(new Criteria('product_id', $parameters['value'], '='));
                 if (!is_null($parameters['withNull'])) {
                     $selectedProducts[0] = $parameters['withNull'];
                     ksort($selectedProducts);
                 }
                 $productsList->addOptionArray($selectedProducts);
                 // Les valeurs sélectionnées
             }
             $productTray->addElement($productsList);
             $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=0&amp;callerName=" . $parameters['name'] . "', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_PRODUCT . "</a>";
             $linkLabel = new xoopsFormLabel('', '<br />' . $link);
             $productTray->addElement($linkLabel);
         }
     } else {
         $productTray = new XoopsFormSelect($parameters['caption'], $parameters['name'], $parameters['value'], $parameters['size'], $parameters['multiple']);
         $products = $this->getList($criteria);
         $productTray->addOptionArray($products);
     }
     if (trim($parameters['description']) != '') {
         $productTray->setDescription($parameters['description']);
     }
     return $productTray;
 }
Пример #5
0
}
$tbl_tmp['product_rating_formated'] = number_format($product->getVar('product_rating'), 2);
if ($product->getVar('product_votes') == 1) {
    $tbl_tmp['product_votes_count'] = _OLEDRION_ONEVOTE;
} else {
    $tbl_tmp['product_votes_count'] = sprintf(_OLEDRION_NUMVOTES, $product->getVar('product_votes'));
}
// Attributs
if ($handlers->h_oledrion_attributes->getProductAttributesCount($product_id) > 0) {
    $attributes = array();
    $mandatoryFieldsCount = 0;
    if ($handlers->h_oledrion_caddy->isInCart($product_id)) {
    }
    $attributes = $handlers->h_oledrion_attributes->constructHtmlProductAttributes($product, $mandatoryFieldsCount);
    if (count($attributes) > 0) {
        oledrion_utils::callJavascriptFile('validate/jquery.validate.min.js');
        //$xoTheme->addStylesheet(OLEDRION_URL.'include/validate.css');
        oledrion_utils::setCSS(OLEDRION_URL . 'include/validate.css');
        $tbl_tmp['product_attributes'] = $attributes;
        $xoopsTpl->assign('mandatoryFieldsCount', $mandatoryFieldsCount);
    }
}
$xoopsTpl->assign('product', $tbl_tmp);
// Breadcrumb *************************************************************************************
$tbl_tmp = array();
$mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid');
$tbl_ancestors = $mytree->getAllParent($product->getVar('product_cid'));
$tbl_ancestors = array_reverse($tbl_ancestors);
$tbl_tmp[] = "<a href='" . OLEDRION_URL . "index.php' title='" . oledrion_utils::makeHrefTitle(oledrion_utils::getModuleName()) . "'>" . oledrion_utils::getModuleName() . "</a>";
foreach ($tbl_ancestors as $item) {
    $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . oledrion_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>";