Ejemplo n.º 1
0
/**
 * Affiche les produits les mieux notés
 */
function b_oledrion_rated_show($options)
{
    // '10|0';	// Voir 10 produits, pour toutes les catégories ou une catégorie particulière
    global $xoopsConfig, $xoopsTpl;
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $products = $block = array();
    $start = 0;
    $limit = $options[0];
    $categoryId = $options[1];
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('bestrated')->setStart($start)->setLimit($limit)->setSort('product_rating')->setOrder('DESC')->setCategory($categoryId);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $url = OLEDRION_URL . 'include/oledrion.css';
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />");
        return $block;
    } else {
        // La liste des produits est introuvable (on ne trouve pas les produits vendus dans le stock des produits)
        return false;
    }
}
Ejemplo n.º 2
0
/**
 * Renvoie la liste des produits recommandés
 */
function b_oledrion_recomm_show($options)
{
    // '10|0';	// Voir 10 produits, pour toutes les catégories ou une catégorie particulière
    global $xoopsConfig, $xoopsTpl;
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $products = $block = array();
    $start = 0;
    $limit = $options[0];
    $categoyrId = $options[1];
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recommended')->setStart($start)->setLimit($limit)->setSort('product_recommended')->setOrder('DESC')->setCategory($categoyrId);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if ($h_oledrion_products->getRecommendedCount() > $limit) {
        // Il y a plus de produits recommandés dans la BDD que dans le bloc, on affiche donc un lien vers la page des produits recommandés
        $block['showMore'] = true;
    }
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $url = OLEDRION_URL . 'include/oledrion.css';
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />");
        return $block;
    } else {
        // Pas de produits recommandés
        return false;
    }
}
Ejemplo n.º 3
0
/**
 * Affiche x produit(s) au hasard
 */
function b_oledrion_random_show($options)
{
    // '10|0|0';	// Voir 10 produits, pour toutes les catégories ou une catégorie particulière, et pour ce mois-ci ou pour tout le temps ?
    global $xoopsConfig, $xoopsTpl;
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $products = $block = array();
    $start = 0;
    $limit = $options[0];
    $categoryId = $options[1];
    $thisMonthOnly = intval($options[2]);
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('random')->setStart($start)->setLimit($limit)->setSort('RAND()')->setCategory($categoryId)->setThisMonthOnly($thisMonthOnly);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $url = OLEDRION_URL . 'include/oledrion.css';
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />");
        return $block;
    } else {
        return false;
    }
}
Ejemplo n.º 4
0
 /**
  * Retourne la passerelle de paiement en cours d'utilisation
  *
  * @return string	Le nom de la  passerelle de paiement (en fait le nom de son répertoire)
  */
 function getCurrentGateway()
 {
     $return = xoops_trim(oledrion_utils::getModuleOption('used_gateway'));
     if ($return == '') {
         $return = 'paypal';
         // Valeur par défaut
     }
     return $return;
 }
Ejemplo n.º 5
0
/**
 * oledrion
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
 * @version     $Id: oledrion.php 12290 2014-02-07 11:05:17Z beckmi $
 */
function b_sitemap_oledrion()
{
    require '../oledrion/header.php';
    global $sitemap_configs;
    $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
    $table = $xoopsDB->prefix('oledrion_cat');
    $id_name = 'cat_cid';
    $pid_name = 'cat_pid';
    $title_name = 'cat_title';
    $url = 'category.php?cat_cid=';
    $order = 'cat_title';
    include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
    $mytree = new XoopsTree($table, $id_name, $pid_name);
    $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
    $sitemap = array();
    $myts = MyTextSanitizer::getInstance();
    $i = 0;
    $sql = "SELECT `{$id_name}`,`{$title_name}` FROM `{$table}` WHERE `{$pid_name}`=0";
    if ($order != '') {
        $sql .= " ORDER BY `{$order}`";
    }
    $result = $xoopsDB->query($sql);
    while (list($catid, $name) = $xoopsDB->fetchRow($result)) {
        $sitemap['parent'][$i]['id'] = $catid;
        $sitemap['parent'][$i]['title'] = $myts->htmlSpecialChars($name);
        if (oledrion_utils::getModuleOption('urlrewriting') == 1) {
            // On utilise l'url rewriting
            $url = 'category' . '-' . intval($catid) . oledrion_utils::makeSeoUrl($name) . '.html';
        } else {
            // Pas d'utilisation de l'url rewriting
            $url = 'category.php?cat_cid=' . intval($catid);
        }
        $sitemap['parent'][$i]['url'] = $url;
        if (@$sitemap_configs["show_subcategoris"]) {
            $j = 0;
            $child_ary = $mytree->getChildTreeArray($catid, $order);
            foreach ($child_ary as $child) {
                $count = strlen($child['prefix']) + 1;
                $sitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name];
                $sitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars($child[$title_name]);
                $sitemap['parent'][$i]['child'][$j]['image'] = $count > 3 ? 4 : $count;
                if (oledrion_utils::getModuleOption('urlrewriting') == 1) {
                    // On utilise l'url rewriting
                    $url = 'category' . '-' . intval($child[$id_name]) . oledrion_utils::makeSeoUrl($child[$title_name]) . '.html';
                } else {
                    // Pas d'utilisation de l'url rewriting
                    $url = 'category.php?cat_cid=' . intval($child[$id_name]);
                }
                $sitemap['parent'][$i]['child'][$j]['url'] = $url;
                $j++;
            }
        }
        $i++;
    }
    return $sitemap;
}
Ejemplo n.º 6
0
 public function __construct()
 {
     // Get the module's preferences
     $this->_decimalsCount = oledrion_utils::getModuleOption('decimals_count');
     $this->_thousandsSep = oledrion_utils::getModuleOption('thousands_sep');
     $this->_decimalSep = oledrion_utils::getModuleOption('decimal_sep');
     $this->_moneyFull = oledrion_utils::getModuleOption('money_full');
     $this->_moneyShort = oledrion_utils::getModuleOption('money_short');
     $this->_monnaiePlace = oledrion_utils::getModuleOption('monnaie_place');
     $this->_thousandsSep = str_replace('[space]', ' ', $this->_thousandsSep);
     $this->_decimalSep = str_replace('[space]', ' ', $this->_decimalSep);
 }
Ejemplo n.º 7
0
/**
 * This block shows the products that were recently sold
 * @param array $options    [0] = Nombre maximum de produits à voir
 * @return array
 */
function b_oledrion_recentlysold_show($options)
{
    global $xoopsConfig, $xoTheme;
    require XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $categoryId = 0;
    $start = 0;
    $limit = $options[0];
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recentlysold')->setStart($start)->setLimit($limit);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $block = array();
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoTheme->addStylesheet(OLEDRION_URL . 'assets/css/oledrion.css');
        return $block;
    } else {
        return false;
    }
}
Ejemplo n.º 8
0
/**
 * Affiche x produit(s) en promotion
 */
function b_oledrion_promotion_show($options)
{
    // '10|0';	// Voir 10 produits, pour toutes les catégories ou une catégorie particulière
    global $xoopsConfig, $xoTheme;
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $block = $products = array();
    $start = 0;
    $limit = $options[0];
    $categoryId = $options[1];
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('promotional')->setStart($start)->setLimit($limit)->setSort('product_submitted DESC, product_title')->setOrder('ASC')->setCategory($categoryId);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoTheme->addStylesheet(OLEDRION_URL . 'assets/css/oledrion.css');
        return $block;
    } else {
        return false;
    }
}
Ejemplo n.º 9
0
/**
 * This block shows the products that were recently sold
 * @param array $options	[0] = Nombre maximum de produits à voir
 * @return array
 */
function b_oledrion_recentlysold_show($options)
{
    global $xoopsConfig, $xoopsTpl;
    require XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $categoryId = 0;
    $start = 0;
    $limit = $options[0];
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recentlysold')->setStart($start)->setLimit($limit);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        unset($products['lastTitle']);
    }
    if (count($products) > 0) {
        $url = OLEDRION_URL . 'include/oledrion.css';
        $block = array();
        $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg');
        $block['block_products'] = $products;
        $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />");
        return $block;
    } else {
        return false;
    }
}
Ejemplo n.º 10
0
/**
 * block to display items in cart
 *
 * @param integer $options[0] Count of items to show (0 = no limit)
 * @return array Block's content
 */
function b_oledrion_cart_show($options)
{
    global $mod_pref, $xoopsConfig;
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
    $productsCount = intval($options[0]);
    $cartForTemplate = $block = array();
    $emptyCart = false;
    $shippingAmount = $commandAmount = $vatAmount = $discountsCount = 0;
    $goOn = '';
    $commandAmountTTC = 0;
    $discountsDescription = array();
    // Calcul du montant total du caddy
    $reductions = new oledrion_reductions();
    $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount);
    $dec = oledrion_utils::getModuleOption('decimals_count');
    if ($emptyCart) {
        return '';
    }
    $block['block_money_full'] = oledrion_utils::getModuleOption('money_full');
    $block['block_money_short'] = oledrion_utils::getModuleOption('money_short');
    $block['block_shippingAmount'] = sprintf("%0." . $dec . 'f', $shippingAmount);
    // Montant des frais de port
    $block['block_commandAmount'] = sprintf("%0." . $dec . 'f', $commandAmount);
    // Montant HT de la commande
    $block['block_vatAmount'] = sprintf("%0." . $dec . 'f', $vatAmount);
    // Montant de la TVA
    $block['block_commandAmountTTC'] = sprintf("%0." . $dec . 'f', $commandAmountTTC);
    // Montant TTC de la commande
    $block['block_discountsDescription'] = $discountsDescription;
    // Liste des réductions accordées
    if ($productsCount > 0 && count($cartForTemplate) > $productsCount) {
        array_slice($cartForTemplate, 0, $productsCount - 1);
    }
    $block['block_caddieProducts'] = $cartForTemplate;
    // Produits dans le caddy
    return $block;
}
Ejemplo n.º 11
0
                       $msg['PAYS'] = $countries[$commande->getVar('cmd_country')];
                       $msg['TELEPHONE'] = $commande->getVar('cmd_telephone');
                       $msg['EMAIL'] = $commande->getVar('cmd_email');
                       $msg['URL_BILL'] = OLEDRION_URL . 'invoice.php?id=' . $commande->getVar('cmd_id') . '&pass='******'cmd_password');
                       $msg['IP'] = oledrion_utils::IP();
                       if ($commande->getVar('cmd_bill') == 1) {
                           $msg['FACTURE'] = _YES;
                       } else {
                           $msg['FACTURE'] = _NO;
                       }
                       // Send mail to client
                       oledrion_utils::sendEmailFromTpl('command_client.tpl', $commande -> getVar('cmd_email'), sprintf(_OLEDRION_THANKYOU_CMD, $xoopsConfig['sitename']), $msg);
                       // Send mail to admin
                       oledrion_utils::sendEmailFromTpl('command_shop.tpl', oledrion_utils::getEmailsFromGroup(oledrion_utils::getModuleOption('grp_sold')), _OLEDRION_NEW_COMMAND, $msg);
                       */
                    // Send SMS
                    if (oledrion_utils::getModuleOption('sms_checkout')) {
                        $information['to'] = ltrim($commande->getVar('cmd_mobile'), 0);
                        $information['text'] = oledrion_utils::getModuleOption('sms_checkout_text');
                        $sms = oledrion_sms::sendSms($information);
                    }
                }
            } else {
                $ret['status'] = 0;
                $ret['message'] = _OLEDRION_ERROR10;
            }
        }
        $return = json_encode($ret);
        break;
}
echo $return;
Ejemplo n.º 12
0
 /**
  * Recharge le dernier panier de l'utilisateur
  *
  * @return boolean
  */
 function reloadPersistentCart()
 {
     global $xoopsUser, $h_oledrion_persistent_cart;
     if (oledrion_utils::getModuleOption('persistent_cart') == 0) {
         return false;
     }
     if (is_object($xoopsUser)) {
         $persistent_carts = array();
         $persistent_carts = $h_oledrion_persistent_cart->getUserProducts();
         if (count($persistent_carts) > 0) {
             foreach ($persistent_carts as $persistent_cart) {
                 $this->addProduct($persistent_cart->getVar('persistent_product_id'), $persistent_cart->getVar('persistent_qty'), null);
             }
         }
     }
     return true;
 }
Ejemplo n.º 13
0
     $vendors[0] = _ALL;
     ksort($vendors);
     $xoopsTpl->assign('disc_vendor_id_options', $vendors);
     $xoopsTpl->assign('disc_vendor_id_selected', $item->getVar('disc_vendor_id'));
     // Catégorie
     $xoopsTpl->assign('disc_cat_cid_options', $categoriesSelect);
     // Produits
     $products = $h_oledrion_products->getList();
     $products[0] = _ALL;
     ksort($products);
     $xoopsTpl->assign('disc_product_id_options', $products);
     $xoopsTpl->assign('disc_product_id_selected', $item->getVar('disc_product_id'));
     $productsSelect = $h_oledrion_products->productSelector(new oledrion_parameters(array('caption' => _AM_OLEDRION_DISCOUNT_PRODUCT, 'name' => 'disc_product_id', 'value' => $item->getVar('disc_product_id'), 'size' => 1, 'multiple' => false, 'values' => null, 'showAll' => true, 'sort' => 'product_title', 'order' => 'ASC', 'formName' => 'frmdiscount', 'description' => _AM_OLEDRION_DISCOUNT_HELP1, 'withNull' => _ALL)));
     $xoopsTpl->assign('disc_product_id', $productsSelect->render());
     $xoopsTpl->assign('discount', $discountForTemplate);
     $xoopsTpl->assign('currencyName', oledrion_utils::getModuleOption('money_full'));
     $editor = oledrion_utils::getWysiwygForm(_AM_OLEDRION_DISCOUNT_DESCR, 'disc_description', $item->getVar('disc_description', 'e'), 15, 60, 'description_hidden');
     $xoopsTpl->assign('editor', $editor->render());
     $xoopsTpl->display('db:oledrion_admin_discounts.html');
     show_footer();
     break;
     // ****************************************************************************************************************
 // ****************************************************************************************************************
 case 'copy':
     // Duplication d'une réduction
     // ****************************************************************************************************************
     xoops_cp_header();
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
     if (empty($id)) {
         oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
     }
Ejemplo n.º 14
0
require_once XOOPS_ROOT_PATH . '/header.php';
require_once OLEDRION_PATH . 'class/registryfile.php';
// Initialisations
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$limit = oledrion_utils::getModuleOption('newproducts');
// Nombre maximum d'éléments à afficher
$baseurl = OLEDRION_URL . basename(__FILE__);
// URL de ce script (sans son nom)
$registry = new oledrion_registryfile();
$lastTitle = '';
// Quelques options pour le template
$xoopsTpl->assign('nostock_msg', oledrion_utils::getModuleOption('nostock_msg'));
$xoopsTpl->assign('mod_pref', $mod_pref);
// Préférences du module
$xoopsTpl->assign('welcome_msg', nl2br($registry->getfile(OLEDRION_TEXTFILE1)));
$xoopsTpl->assign('columnsCount', oledrion_utils::getModuleOption('index_colums'));
// Lecture des TVA ********************************************************************************
$vatArray = $h_oledrion_vat->getAllVats(new oledrion_parameters());
// Récupération du nombre total de produits de la base
$xoopsTpl->assign('total_products_count', sprintf(_OLEDRION_THEREARE, $h_oledrion_products->getTotalPublishedProductsCount()));
if ($limit > 0) {
    $itemsCount = $h_oledrion_products->getRecentProductsCount();
    if ($itemsCount > $limit) {
        require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
        $pagenav = new XoopsPageNav($itemsCount, $limit, $start);
        $xoopsTpl->assign('pagenav', $pagenav->renderNav());
    }
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recent')->setStart($start)->setLimit($limit)->setSort('product_id DESC, product_title')->setWithXoopsUser(true)->setWithRelatedProducts(true);
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
    if (isset($products['lastTitle'])) {
        $lastTitle = strip_tags($products['lastTitle']);
Ejemplo n.º 15
0
 /**
  * Retourne une liste combinée des options de l'attribut
  *
  * @param string $format				Format dans lequel renvoyer les données
  * @param boolean $withFormatedPrices	Faut il retourner les prix formatés ?
  * @param object $product				Le produit de travail
  * @return array
  * @since 2.3.2009.03.11
  */
 function getAttributeOptions($format = 's', $withFormatedPrices = false, oledrion_products $product = null)
 {
     $ret = array();
     $counter = 0;
     if (!is_null($product)) {
         $vat_id = $product->getVar('product_vat_id');
     }
     $names = $this->getOption('attribute_names', $format);
     $values = $this->getOption('attribute_values', $format);
     if (oledrion_utils::getModuleOption('use_price')) {
         $prices = $this->getOption('attribute_prices', $format);
     }
     if (oledrion_utils::getModuleOption('attributes_stocks')) {
         $stocks = $this->getOption('attribute_stocks', $format);
     }
     if ($withFormatedPrices) {
         $oledrion_Currency = oledrion_Currency::getInstance();
     }
     if (count($names) > 0) {
         foreach ($names as $key => $name) {
             $price = $stock = 0;
             if (oledrion_utils::getModuleOption('use_price')) {
                 $price = $prices[$key];
                 if ($withFormatedPrices) {
                     $priceFormated = $oledrion_Currency->amountForDisplay($price);
                     $priceTtc = oledrion_utils::getAmountWithVat($price, $vat_id);
                     $priceTtcFormated = $oledrion_Currency->amountForDisplay($priceTtc);
                     $vat = $priceTtc - $price;
                     $vatFormated = $oledrion_Currency->amountForDisplay($vat);
                 }
             }
             if (oledrion_utils::getModuleOption('attributes_stocks')) {
                 $stock = $stocks[$key];
             }
             if (!$withFormatedPrices) {
                 $ret[] = array('name' => $name, 'value' => $values[$key], 'price' => $price, 'stock' => $stock);
             } else {
                 $ret[] = array('name' => $name, 'value' => $values[$key], 'price' => $price, 'priceFormated' => $priceFormated, 'priceTTC' => $priceTtc, 'priceTTCFormated' => $priceTtcFormated, 'vat' => $vat, 'vatFormated' => $vatFormated, 'counter' => $counter, 'stock' => $stock);
             }
             $counter++;
         }
     }
     return $ret;
 }
Ejemplo n.º 16
0
 /**
  * Retourne les produits d'un utilisateur
  *
  * @param  integer $persistent_uid L'ID de l'utilisateur
  * @return array   Tableaux d'objets de type oledrion_persistent_cart
  */
 public function getUserProducts($persistent_uid = 0)
 {
     if (oledrion_utils::getModuleOption('persistent_cart') == 0) {
         return false;
     }
     $persistent_uid = $persistent_uid == 0 ? oledrion_utils::getCurrentUserID() : $persistent_uid;
     $criteria = new Criteria('persistent_uid', $persistent_uid, '=');
     return $this->getObjects($criteria);
 }
Ejemplo n.º 17
0
foreach ($caddy as $item) {
    $tmp[] = $item->getVar('caddy_product_id');
}
// Recherche des produits ***********************************************************************************************
$products = $h_oledrion_products->getProductsFromIDs($tmp, true);
// Recherche des fabricants **********************************************************************************************
$tmp2 = $h_oledrion_productsmanu->getFromProductsIds($tmp);
$tmp = array();
foreach ($tmp2 as $item) {
    $tmp[] = $item->getVar('pm_manu_id');
    $productsManufacturers[$item->getVar('pm_product_id')][] = $item;
}
$manufacturers = $h_oledrion_manufacturer->getManufacturersFromIds($tmp);
// Informations sur la commande ***************************************************************************************
$xoopsTpl->assign('order', $order->toArray());
$xoopsTpl->assign('ask_vatnumber', oledrion_utils::getModuleOption('ask_vatnumber'));
$handlers = oledrion_handler::getInstance();
// Boucle sur le caddy ************************************************************************************************
foreach ($caddy as $itemCaddy) {
    $productForTemplate = $tblJoin = $productManufacturers = $productAttributes = array();
    $product = $products[$itemCaddy->getVar('caddy_product_id')];
    $productForTemplate = $product->toArray();
    // Produit
    // Est-ce qu'il y a des attributs ?
    if ($handlers->h_oledrion_caddy_attributes->getAttributesCountForCaddy($itemCaddy->getVar('caddy_id')) > 0) {
        $productAttributes = $handlers->h_oledrion_caddy_attributes->getFormatedAttributesForCaddy($itemCaddy->getVar('caddy_id'), $product);
    }
    $productForTemplate['product_attributes'] = $productAttributes;
    $productManufacturers = $productsManufacturers[$product->getVar('product_id')];
    foreach ($productManufacturers as $oledrion_productsmanu) {
        if (isset($manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')])) {
Ejemplo n.º 18
0
function listCart()
{
    global $xoopsTpl, $uid;
    $cartForTemplate = $discountsDescription = array();
    $emptyCart = false;
    $shippingAmount = $commandAmount = $vatAmount = $commandAmountTTC = $discountsCount = $ecotaxeAmount = $discountAmount = $totalSavings = 0;
    $goOn = '';
    $reductions = new oledrion_reductions();
    $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount, $ecotaxeAmount, $discountAmount, $totalSavings);
    $oledrion_Currency =& oledrion_Currency::getInstance();
    $xoopsTpl->assign('emptyCart', $emptyCart);
    // Caddy Vide ?
    $xoopsTpl->assign('caddieProducts', $cartForTemplate);
    // Produits dans le caddy
    $xoopsTpl->assign('shippingAmount', $oledrion_Currency->amountForDisplay($shippingAmount));
    // Montant des frais de port
    $xoopsTpl->assign('ecotaxeAmount', $oledrion_Currency->amountForDisplay($ecotaxeAmount));
    // Montant des frais de port
    $xoopsTpl->assign('commandAmount', $oledrion_Currency->amountForDisplay($commandAmount));
    // Montant HT de la commande
    $xoopsTpl->assign('discountAmount', $oledrion_Currency->amountForDisplay($discountAmount));
    // Total Discount
    $xoopsTpl->assign('totalSavings', $oledrion_Currency->amountForDisplay($totalSavings));
    // Total Savings
    $xoopsTpl->assign('vatAmount', $oledrion_Currency->amountForDisplay($vatAmount));
    // Montant de la TVA
    $xoopsTpl->assign('discountsCount', $discountsCount);
    // Nombre de réductions appliquées
    $xoopsTpl->assign('goOn', $goOn);
    // Adresse à utiliser pour continuer ses achats
    $xoopsTpl->assign('commandAmountTTC', $oledrion_Currency->amountForDisplay($commandAmountTTC, 'l'));
    // Montant TTC de la commande
    $xoopsTpl->assign('discountsDescription', $discountsDescription);
    // Liste des réductions accordées
    $showOrderButton = true;
    $showRegistredOnly = false;
    if (oledrion_utils::getModuleOption('restrict_orders', false) && $uid == 0) {
        $showRegistredOnly = true;
        $showOrderButton = false;
    }
    $xoopsTpl->assign('showRegistredOnly', $showRegistredOnly);
    $xoopsTpl->assign('showOrderButton', $showOrderButton);
}
Ejemplo n.º 19
0
                $configHandler->insertConfig($config);
            }
        }
        if (isset($_POST['product_property10'])) {
            if (oledrion_utils::getModuleOption('product_property10') != $_POST['product_property10']) {
                $criteria = new CriteriaCompo();
                $criteria->add($moduleIdCriteria);
                $criteria->add(new Criteria('conf_name', 'product_property10'));
                $config = $configHandler->getConfigs($criteria);
                $config = $config[0];
                $configValue = array('conf_modid' => $xoopsModule->getVar('mid'), 'conf_catid' => 0, 'conf_name' => 'product_property10', 'conf_value' => $_POST['product_property10'], 'conf_formtype' => 'hidden', 'conf_valuetype' => 'text');
                $config->setVars($configValue);
                $configHandler->insertConfig($config);
            }
        }
        if (isset($_POST['product_property10_title'])) {
            if (oledrion_utils::getModuleOption('product_property10_title') != $_POST['product_property10_title']) {
                $criteria = new CriteriaCompo();
                $criteria->add($moduleIdCriteria);
                $criteria->add(new Criteria('conf_name', 'product_property10_title'));
                $config = $configHandler->getConfigs($criteria);
                $config = $config[0];
                $configValue = array('conf_modid' => $xoopsModule->getVar('mid'), 'conf_catid' => 0, 'conf_name' => 'product_property10_title', 'conf_value' => $_POST['product_property10_title'], 'conf_formtype' => 'hidden', 'conf_valuetype' => 'text');
                $config->setVars($configValue);
                $configHandler->insertConfig($config);
            }
        }
        oledrion_utils::updateCache();
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=property', 2);
        break;
}
Ejemplo n.º 20
0
 /**
  * Retourne l'url à utiliser pour accéder à la catégorie en tenant compte des préférences du module
  *
  * @return string L'url à utiliser
  */
 public function getLink()
 {
     include_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
     $url = '';
     if (oledrion_utils::getModuleOption('urlrewriting') == 1) {
         // On utilise l'url rewriting
         $url = OLEDRION_URL . 'category-' . $this->getVar('cat_cid') . oledrion_utils::makeSeoUrl($this->getVar('cat_title', 'n')) . '.html';
     } else {
         // Pas d'utilisation de l'url rewriting
         $url = OLEDRION_URL . 'category.php?cat_cid=' . $this->getVar('cat_cid');
     }
     return $url;
 }
Ejemplo n.º 21
0
/**
 * Sélecteur de produits
 */
require_once '../../../include/cp_header.php';
require_once '../include/common.php';
require_once XOOPS_ROOT_PATH . '/class/template.php';
include_once OLEDRION_PATH . 'class/tree.php';
if (!isset($xoopsUser) || !is_object($xoopsUser)) {
    exit;
}
if (!oledrion_utils::isAdmin()) {
    exit;
}
$xoopsTpl = new XoopsTpl();
$ts =& MyTextSanitizer::getInstance();
$limit = oledrion_utils::getModuleOption('items_count');
// Nombre maximum d'éléments à afficher dans l'admin
$oledrion_handlers = oledrion_handler::getInstance();
$searchFields = array('product_title' => _OLEDRION_TITLE, 'product_summary' => _OLEDRION_SUMMARY, 'product_description' => _OLEDRION_DESCRIPTION, 'product_id' => _AM_OLEDRION_ID, 'product_sku' => _OLEDRION_NUMBER, 'product_extraid' => _OLEDRION_EXTRA_ID);
$searchCriterias = array(XOOPS_MATCH_START => _STARTSWITH, XOOPS_MATCH_END => _ENDSWITH, XOOPS_MATCH_EQUAL => _MATCHES, XOOPS_MATCH_CONTAIN => _CONTAINS);
$vendors = array();
$vendors = $oledrion_handlers->h_oledrion_vendors->getList();
$vendors[0] = '---';
sort($vendors);
$categories = $oledrion_handlers->h_oledrion_cat->getAllCategories(new oledrion_parameters());
$mytree = new Oledrion_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
$searchVendorSelected = $selectedCategory = $selectedSearchField = 0;
$start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0;
$mutipleSelect = isset($_REQUEST['mutipleSelect']) ? intval($_REQUEST['mutipleSelect']) : 0;
$callerName = isset($_REQUEST['callerName']) ? $_REQUEST['callerName'] : '';
if (isset($_REQUEST['op']) && $_REQUEST['op'] == 'search') {
Ejemplo n.º 22
0
 */
require 'header.php';
$type = isset($_GET['type']) ? strtolower($_GET['type']) : 'picture';
$product_id = isset($_GET['product_id']) ? intval($_GET['product_id']) : 0;
if ($product_id > 0) {
    $product = null;
    $product = $h_oledrion_products->get($product_id);
    if (!is_object($product)) {
        exit(_OLEDRION_ERROR1);
    }
    // Produit en ligne ?
    if ($product->getVar('product_online') == 0) {
        exit(_OLEDRION_ERROR2);
    }
    // Le produit est publié ?
    if (oledrion_utils::getModuleOption('show_unpublished') == 0 && $product->getVar('product_submitted') > time()) {
        exit(_OLEDRION_ERROR3);
    }
} else {
    exit(_ERRORS);
}
switch ($type) {
    case 'attachment':
        // Un fichier attaché à un produit
        $file_id = isset($_GET['file_id']) ? intval($_GET['file_id']) : 0;
        if ($file_id == 0) {
            exit(_OLEDRION_ERROR13);
        }
        $attachedFile = null;
        $attachedFile = $h_oledrion_files->get($file_id);
        if (!is_object($attachedFile)) {
Ejemplo n.º 23
0
 /**
  * Retourne l'url à utiliser pour accéder à la page d'un fabricant
  *
  * @return string
  */
 public function getLink()
 {
     $url = '';
     if (oledrion_utils::getModuleOption('urlrewriting') == 1) {
         // On utilise l'url rewriting
         $url = OLEDRION_URL . 'manufacturer-' . $this->getVar('manu_id') . oledrion_utils::makeSeoUrl($this->getVar('manu_commercialname', 'n') . ' ' . $this->getVar('manu_name')) . '.html';
     } else {
         // Pas d'utilisation de l'url rewriting
         $url = OLEDRION_URL . 'manufacturer.php?manu_id=' . $this->getVar('manu_id');
     }
     return $url;
 }
Ejemplo n.º 24
0
 $optionsCount = count($options);
 if ($optionsCount > 0) {
     foreach ($options as $option) {
         $class = $class == 'even' ? 'odd' : 'even';
         $content .= "<tr class='" . $class . "'>\n";
         $checked = '';
         if ($option['value'] == $defaultValue) {
             $checked = "checked = 'checked' ";
         }
         $content .= "<td align='center'><input type='radio' name='default' id='default' value='{$counter}' {$checked}/></td>\n";
         $content .= "<td align='center'><input type='text' name='name{$counter}' id='names{$counter}' size='15' maxlength='255' value='" . $option['name'] . "' /></td>\n";
         $content .= "<td align='center'><input type='text' name='value{$counter}' id='value{$counter}' size='15' maxlength='255' value='" . $option['value'] . "' /></td>\n";
         if (oledrion_utils::getModuleOption('use_price')) {
             $content .= "<td align='center'><input type='text' name='price{$counter}' id='price{$counter}' size='15' maxlength='10' value='" . $option['price'] . "' /></td>\n";
         }
         if (oledrion_utils::getModuleOption('attributes_stocks')) {
             $content .= "<td align='center'><input type='text' name='stock{$counter}' id='stock{$counter}' size='15' maxlength='10' value='" . $option['stock'] . "' /></td>\n";
         }
         // Les actions
         $content .= "<td align='center'>";
         // Suppression
         $content .= "<img class='btnremove' alt='{$delete}' title='{$delete}' style='border: 0; cursor:pointer;' name='btnremove-{$counter}' id='btnremove-{$counter}' src='" . OLEDRION_IMAGES_URL . "smalldelete.png' />";
         if ($counter > 0) {
             // Up
             $content .= "<img class='btnUp' alt='{$up}' title='{$up}' style='border: 0; cursor:pointer;' name='btnUp-{$counter}' id='btnUp-{$counter}' src='" . OLEDRION_IMAGES_URL . "smallup.png' />";
         } else {
             $content .= "<img src='" . OLEDRION_IMAGES_URL . "blankholder.png' />";
         }
         if ($counter < $optionsCount - 1) {
             // Down
             $content .= "<img class='btnDown' alt='{$down}' title='{$down}' style='border: 0; cursor:pointer;' name='btnDown-{$counter}' id='btnDown-{$counter}' src='" . OLEDRION_IMAGES_URL . "smalldown.png' />";
Ejemplo n.º 25
0
     $item = $h_oledrion_manufacturer->create(true);
 }
 $opRedirect = 'manufacturers';
 $item->setVars($_POST);
 for ($i = 1; $i <= 5; $i++) {
     if (isset($_POST['delpicture' . $i]) && intval($_POST['delpicture' . $i]) == 1) {
         $item->deletePicture($i);
     }
 }
 // Upload des fichiers
 for ($i = 1; $i <= 5; $i++) {
     $res1 = oledrion_utils::uploadFile($i - 1, OLEDRION_PICTURES_PATH);
     if ($res1 === true) {
         if (oledrion_utils::getModuleOption('resize_others')) {
             // Eventuellement on redimensionne l'image
             oledrion_utils::resizePicture(OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $destname, OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $destname, oledrion_utils::getModuleOption('images_width'), oledrion_utils::getModuleOption('images_height'), true);
         }
         $item->setVar('manu_photo' . $i, basename($destname));
     } else {
         if ($res1 !== false) {
             echo $res1;
         }
     }
 }
 $res = $h_oledrion_manufacturer->insert($item);
 if ($res) {
     oledrion_utils::updateCache();
     oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
 } else {
     oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
 }
Ejemplo n.º 26
0
 /**
  * Informe le propriétaire du site qu'une commande à échoué (le paiement)
  *
  * @param  object $order   La commande en question
  * @param  string $comment Optionel, un commentaire pour le mail envoyé au webmaster
  * @return void
  */
 public function notifyOrderCanceled(oledrion_commands $order, $comment = '')
 {
     $msg = array();
     $msg['NUM_COMMANDE'] = $order->getVar('cmd_id');
     $msg['COMMENT'] = $comment;
     oledrion_utils::sendEmailFromTpl('command_shop_cancel.tpl', oledrion_utils::getEmailsFromGroup(oledrion_utils::getModuleOption('grp_sold')), _OLEDRION_ORDER_CANCELED, $msg);
     oledrion_utils::sendEmailFromTpl('command_client_cancel.tpl', $order->getVar('cmd_email'), _OLEDRION_ORDER_CANCELED, $msg);
 }
Ejemplo n.º 27
0
 *					$options[2] - max font size (px or %)
 *					$options[3] - min font size (px or %)
 */
$modversion['blocks'][] = array('file' => 'oledrion_block_tag.php', 'name' => _MI_OLEDRION_TAG_CLOUD, 'description' => 'Show tag cloud', 'show_func' => 'oledrion_tag_block_cloud_show', 'edit_func' => 'oledrion_tag_block_cloud_edit', 'options' => '100|0|150|80', 'template' => 'oledrion_tag_block_cloud.tpl');
/*
 * $options:
 *					$options[0] - number of tags to display
 *					$options[1] - time duration, in days, 0 for all the time
 *					$options[2] - sort: a - alphabet; c - count; t - time
 */
$modversion['blocks'][] = array('file' => 'oledrion_block_tag.php', 'name' => _MI_OLEDRION_TOP_TAGS, 'description' => 'Show top tags', 'show_func' => 'oledrion_tag_block_top_show', 'edit_func' => 'oledrion_tag_block_top_edit', 'options' => '50|30|c', 'template' => 'oledrion_tag_block_top.tpl');
// Menu
$modversion['hasMain'] = 1;
$cptm = 0;
require_once 'class/oledrion_utils.php';
if (oledrion_utils::getModuleOption('use_price')) {
    $cptm++;
    $modversion['sub'][$cptm]['name'] = _MI_OLEDRION_SMNAME1;
    $modversion['sub'][$cptm]['url'] = 'caddy.php';
}
$cptm++;
$modversion['sub'][$cptm]['name'] = _MI_OLEDRION_SMNAME3;
$modversion['sub'][$cptm]['url'] = 'category.php';
$cptm++;
$modversion['sub'][$cptm]['name'] = _MI_OLEDRION_SMNAME4;
$modversion['sub'][$cptm]['url'] = 'categories-map.php';
$cptm++;
$modversion['sub'][$cptm]['name'] = _MI_OLEDRION_SMNAME5;
$modversion['sub'][$cptm]['url'] = 'whoswho.php';
$cptm++;
$modversion['sub'][$cptm]['name'] = _MI_OLEDRION_SMNAME6;
Ejemplo n.º 28
0
             }
         } else {
             oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
         }
     } else {
         oledrion_utils::htitle(_AM_OLEDRION_SORRY_NOREMOVE, 4);
         $tblTmp2 = array();
         $tblTmp2 = $h_oledrion_commands->getObjects(new Criteria('cmd_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
         echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>";
         $class = '';
         echo "<tr><th align='center'>" . _AM_OLEDRION_ID . "</th><th align='center'>" . _AM_OLEDRION_DATE . "</th><th align='center'>" . _AM_OLEDRION_CLIENT . "</th><th align='center'>" . _AM_OLEDRION_TOTAL_SHIPP . "</th></tr>";
         foreach ($tblTmp2 as $item) {
             $class = $class == 'even' ? 'odd' : 'even';
             $date = formatTimestamp(strtotime($item->getVar('cmd_date')), 's');
             echo "<tr class='" . $class . "'>\n";
             echo "<td align='right'>" . $item->getVar('cmd_id') . "</td><td align='center'>" . $date . "</td><td align='center'>" . $item->getVar('cmd_lastname') . ' ' . $item->getVar('cmd_firstname') . "</td><td align='center'>" . $item->getVar('cmd_total') . ' ' . oledrion_utils::getModuleOption('money_short') . ' / ' . $item->getVar('cmd_shipping') . ' ' . oledrion_utils::getModuleOption('money_short') . "</td>\n";
             echo "<tr>\n";
         }
         echo '</table>';
         include_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
     }
     break;
     // **********************************************************************************************
 // **********************************************************************************************
 case 'related':
     // ******************************************************************************************
     xoops_cp_header();
     global $xoopsUser;
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
     if (empty($id)) {
         oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
Ejemplo n.º 29
0
 *
 * Version : $Id:
 * ****************************************************************************
 */
/**
 * Plan des catégories
 */
require 'header.php';
$GLOBALS['current_category'] = -1;
$xoopsOption['template_main'] = 'oledrion_map.html';
require_once XOOPS_ROOT_PATH . '/header.php';
require_once OLEDRION_PATH . 'class/tree.php';
$xoopsTpl->assign('mod_pref', $mod_pref);
// Préférences du module
$categories = array();
$categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters());
$mytree = new Oledrion_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));
    }
}
oledrion_utils::setCSS();
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_SMNAME4)));
$title = _MI_OLEDRION_SMNAME4 . ' - ' . oledrion_utils::getModuleName();
oledrion_utils::setMetas($title, $title);
require_once XOOPS_ROOT_PATH . '/footer.php';
Ejemplo n.º 30
0
$h_oledrion_products_list = $oledrion_handlers->h_oledrion_products_list;
$h_oledrion_lists = $oledrion_handlers->h_oledrion_lists;
$h_oledrion_delivery = $oledrion_handlers->h_oledrion_delivery;
$h_oledrion_location = $oledrion_handlers->h_oledrion_location;
$h_oledrion_packing = $oledrion_handlers->h_oledrion_packing;
$h_oledrion_payment = $oledrion_handlers->h_oledrion_payment;
$h_oledrion_location_delivery = $oledrion_handlers->h_oledrion_location_delivery;
$h_oledrion_delivery_payment = $oledrion_handlers->h_oledrion_delivery_payment;
$h_oledrion_payment_log = $oledrion_handlers->h_oledrion_payment_log;
$oledrion_shelf = new oledrion_shelf();
// Façade
$oledrion_shelf_parameters = new oledrion_shelf_parameters();
// Les paramètres de la façade
// Définition des images
if (!defined("_OLEDRION_EDIT")) {
    global $xoopsConfig;
    if (file_exists(OLEDRION_PATH . 'language/' . $xoopsConfig['language'] . '/main.php')) {
        include OLEDRION_PATH . 'language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include OLEDRION_PATH . 'language/english/main.php';
    }
}
global $xoopsModule;
$dirname = basename(dirname(dirname(__FILE__)));
$module_handler = xoops_gethandler('module');
$module = $module_handler->getByDirname($dirname);
$pathIcon16 = '../' . $module->getInfo('icons16');
$icones = array('edit' => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _OLEDRION_EDIT . "' align='middle' />", 'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _OLEDRION_DELETE . "' align='middle' />", 'online' => "<img src='" . OLEDRION_IMAGES_URL . "online.gif' alt='" . _OLEDRION_ONLINE . "' align='middle' />", 'offline' => "<img src='" . OLEDRION_IMAGES_URL . "offline.gif' alt='" . _OLEDRION_OFFLINE . "' align='middle' />", 'ok' => "<img src='" . OLEDRION_IMAGES_URL . "ok.png' alt='" . _OLEDRION_VALIDATE_COMMAND . "' align='middle' />", 'copy' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _OLEDRION_DUPLICATE_PRODUCT . "' align='middle' />", 'details' => "<img src='" . OLEDRION_IMAGES_URL . "details.png' alt='" . _OLEDRION_DETAILS . "' align='middle' />", 'print' => "<img src='" . OLEDRION_IMAGES_URL . "print.png' alt='" . _OLEDRION_PRINT_VERSION . "' align='middle' />", 'delivery' => "<img src='" . OLEDRION_IMAGES_URL . "delivery.png' alt='" . _OLEDRION_DELIVERY . "' align='middle' />", 'package' => "<img src='" . OLEDRION_IMAGES_URL . "package.png' alt='" . _OLEDRION_PACK . "' align='middle' />", 'submit' => "<img src='" . OLEDRION_IMAGES_URL . "submit.png' alt='" . _OLEDRION_SUBMIT . "' align='middle' />", 'track' => "<img src='" . OLEDRION_IMAGES_URL . "track.png' alt='" . _OLEDRION_TRACK . "' align='middle' />");
// Chargement de quelques préférences
$mod_pref = array('money_short' => oledrion_utils::getModuleOption('money_short'), 'money_full' => oledrion_utils::getModuleOption('money_full'), 'url_rewriting' => oledrion_utils::getModuleOption('urlrewriting'), 'tooltip' => oledrion_utils::getModuleOption('infotips'), 'advertisement' => oledrion_utils::getModuleOption('advertisement'), 'rss' => oledrion_utils::getModuleOption('use_rss'), 'nostock_msg' => oledrion_utils::getModuleOption('nostock_msg'), 'use_price' => oledrion_utils::getModuleOption('use_price'), 'restrict_orders' => oledrion_utils::getModuleOption('restrict_orders'), 'isAdmin' => oledrion_utils::isAdmin());