/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; }
/** * 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; }
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); }
/** * Edition des paramètres du bloc * * @param array $options [0] = Nombre maximum de listes à voir, [1] = Type de listes (0 = les 2, 1 = liste cadeaux, 2 = produits recommandés) * @return array */ function b_oledrion_category_lists_edit($options) { include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $form = ''; $form .= "<table border='0'>"; $form .= '<tr><td>' . _MB_OLEDRION_LISTS_COUNT . "</td><td><input type='text' name='options[]' id='options' value='" . intval($options[0]) . "' /></td></tr>"; $listTypes = oledrion_lists::getTypesArray(); $listTypeSelect = oledrion_utils::htmlSelect('options[]', $listTypes, intval($options[1]), false); $form .= '<tr><td>' . _MB_OLEDRION_LISTS_TYPE . "</td><td>" . $listTypeSelect . "</td></tr>"; $form .= '</table>'; return $form; }
/** * Affiche les listes de l'utilisateur * * @param array $options [0] = Nombre maximum de listes à voir * @return array */ function b_oledrion_my_lists_show($options) { require XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; oledrion_utils::loadLanguageFile('modinfo.php'); $start = 0; $limit = intval($options[0]); $uid = oledrion_utils::getCurrentUserID(); if ($uid == 0) { return null; } $listType = OLEDRION_LISTS_ALL; $block = array(); $handlers = oledrion_handler::getInstance(); $items = array(); $items = $handlers->h_oledrion_lists->getRecentLists(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'sort' => 'list_date', 'order' => 'DESC', 'idAsKey' => true, 'listType' => $listType, 'list_uid' => $uid))); if (count($items) > 0) { foreach ($items as $item) { $block['my_lists'][] = $item->toArray(); } } return $block; }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; }
$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; }
$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;
* $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;
/** * 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; }
// **************************************************************************************************************** case 'delete': // Suppression d'un fabricant // **************************************************************************************************************** xoops_cp_header(); $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (empty($id)) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5); } $opRedirect = 'manufacturers'; // On vérifie que ce fabriquant n'est pas relié à des produits $cnt = $h_oledrion_manufacturer->getManufacturerProductsCount($id); if ($cnt == 0) { $item = null; $item = $h_oledrion_manufacturer->get($id); if (is_object($item)) { $res = $h_oledrion_manufacturer->deleteManufacturer($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); } } else { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); } } else { oledrion_utils::redirect(_AM_OLEDRION_ERROR_5, $baseurl . '?op=' . $opRedirect, 5); } break; }
/** * 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/) * @author Hossein Azizabadi (azizabadi@faragostaresh.com) * @version $Id: functions_update.php 12290 2014-02-07 11:05:17Z beckmi $ */ function xoops_module_update_oledrion($module, $version) { global $xoopsDB; // Présence des nouvelles tables et nouvelles zones dans la base de données // Nouvelle table oledrion_gateways_options $tableName = $xoopsDB->prefix('oledrion_gateways_options'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `option_id` int(10) unsigned NOT NULL auto_increment,\n `option_gateway` varchar(50) NOT NULL COMMENT 'nom de la passerelle de paiement',\n `option_name` varchar(50) NOT NULL,\n `option_value` text NOT NULL,\n PRIMARY KEY (`option_id`),\n KEY `option_gateway` (`option_gateway`),\n KEY `option_name` (`option_name`),\n KEY `option_gateway_name` (`option_gateway`,`option_name`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } // Nouveau champ cmd_comment dans oledrion_commands $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_comment', $tableName)) { oledrion_utils::addField('`cmd_comment` TEXT NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_vat_number', $tableName)) { oledrion_utils::addField('`cmd_vat_number` VARCHAR( 255 ) NOT NULL', $tableName); } /** * Nouvelle table oledrion_lists * @since 2.2.2009.01.29 */ $tableName = $xoopsDB->prefix('oledrion_lists'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `list_id` int(10) unsigned NOT NULL auto_increment,\n `list_uid` mediumint(8) unsigned NOT NULL,\n `list_title` varchar(255) NOT NULL,\n `list_date` int(10) unsigned NOT NULL,\n `list_productscount` mediumint(8) unsigned NOT NULL,\n `list_views` mediumint(8) unsigned NOT NULL,\n `list_password` varchar(50) NOT NULL,\n `list_type` tinyint(3) unsigned NOT NULL,\n `list_description` text NOT NULL,\n PRIMARY KEY (`list_id`),\n KEY `list_uid` (`list_uid`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_lists * @since 2.2.2009.01.29 */ $tableName = $xoopsDB->prefix('oledrion_products_list'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `productlist_id` int(10) unsigned NOT NULL auto_increment,\n `productlist_list_id` int(10) unsigned NOT NULL,\n `productlist_product_id` int(10) unsigned NOT NULL,\n PRIMARY KEY (`productlist_id`),\n KEY `productlist_list_id` (`productlist_list_id`),\n KEY `productlist_product_id` (`productlist_product_id`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } if (!oledrion_utils::fieldExists('productlist_date', $tableName)) { oledrion_utils::addField('productlist_date DATE NOT NULL', $tableName); } /** * Nouvelle table oledrion_attributes * @since 2.3.2009.03.09 */ $tableName = $xoopsDB->prefix('oledrion_attributes'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `attribute_id` int(10) unsigned NOT NULL auto_increment,\n `attribute_weight` mediumint(7) unsigned default NULL,\n `attribute_title` varchar(255) default NULL,\n `attribute_name` varchar(255) NOT NULL,\n `attribute_type` tinyint(3) unsigned default NULL,\n `attribute_mandatory` tinyint(1) unsigned default NULL,\n `attribute_values` text,\n `attribute_names` text,\n `attribute_prices` text,\n `attribute_stocks` text,\n `attribute_product_id` int(11) unsigned default NULL,\n `attribute_default_value` varchar(255) default NULL,\n `attribute_option1` mediumint(7) unsigned default NULL,\n `attribute_option2` mediumint(7) unsigned default NULL,\n PRIMARY KEY (`attribute_id`),\n KEY `attribute_product_id` (`attribute_product_id`),\n KEY `attribute_weight` (`attribute_weight`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_caddy_attributes * @since 2.3.2009.03.10 */ $tableName = $xoopsDB->prefix('oledrion_caddy_attributes'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `ca_id` int(10) unsigned NOT NULL auto_increment,\n `ca_cmd_id` int(10) unsigned NOT NULL,\n `ca_caddy_id` int(10) unsigned NOT NULL,\n `ca_attribute_id` int(10) unsigned NOT NULL,\n `ca_attribute_values` text NOT NULL,\n `ca_attribute_names` text NOT NULL,\n `ca_attribute_prices` text NOT NULL,\n PRIMARY KEY (`ca_id`),\n KEY `ca_cmd_id` (`ca_cmd_id`),\n KEY `ca_caddy_id` (`ca_caddy_id`),\n KEY `ca_attribute_id` (`ca_attribute_id`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Augmentation des types numéraires pour accepter le million * @since 2.3.2009.04.20 */ $definition = oledrion_utils::getFieldDefinition('product_price', $xoopsDB->prefix('oledrion_products')); if ($definition != '') { if (xoops_trim($definition['Type']) == 'decimal(7,2)') { $tablesToUpdates = array('oledrion_products' => array('product_price', 'product_shipping_price', 'product_discount_price', 'product_ecotaxe'), 'oledrion_caddy' => array('caddy_price'), 'oledrion_commands' => array('cmd_shipping'), 'oledrion_discounts' => array('disc_price_degress_l1total', 'disc_price_degress_l2total', 'disc_price_degress_l3total', 'disc_price_degress_l4total', 'disc_price_degress_l5total')); foreach ($tablesToUpdates as $tableName => $fields) { foreach ($fields as $field) { $sql = 'ALTER TABLE ' . $xoopsDB->prefix($tableName) . ' CHANGE `' . $field . '` `' . $field . '` DECIMAL( 16, 2 ) NOT NULL'; $xoopsDB->queryF($sql); } } } } /** * Add product_property * @since 2.3.2012.08.03 */ $tableName = $xoopsDB->prefix('oledrion_products'); if (!oledrion_utils::fieldExists('product_property1', $tableName)) { oledrion_utils::addField('`product_property1` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property2', $tableName)) { oledrion_utils::addField('`product_property2` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property3', $tableName)) { oledrion_utils::addField('`product_property3` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property4', $tableName)) { oledrion_utils::addField('`product_property4` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property5', $tableName)) { oledrion_utils::addField('`product_property5` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property6', $tableName)) { oledrion_utils::addField('`product_property6` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property7', $tableName)) { oledrion_utils::addField('`product_property7` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property8', $tableName)) { oledrion_utils::addField('`product_property8` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property9', $tableName)) { oledrion_utils::addField('`product_property9` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property10', $tableName)) { oledrion_utils::addField('`product_property10` varchar(255) NOT NULL', $tableName); } /** * Nouvelle table oledrion_packing * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_packing'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `packing_id` int(5) unsigned NOT NULL auto_increment,\n `packing_title` varchar(255) NOT NULL default '',\n `packing_width` varchar(50) NOT NULL,\n `packing_length` varchar(50) NOT NULL,\n `packing_weight` varchar(50) NOT NULL,\n `packing_image` varchar(255) NOT NULL,\n `packing_description` text,\n `packing_price` decimal(16,2) NOT NULL,\n `packing_online` tinyint(1) NOT NULL default '1',\n PRIMARY KEY (`packing_id`),\n KEY `packing_title` (`packing_title`),\n KEY `packing_online` (`packing_online`),\n KEY `packing_price` (`packing_price`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_location * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_location'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `location_id` int(5) unsigned NOT NULL auto_increment,\n `location_pid` int(5) unsigned NOT NULL default '0',\n `location_title` varchar(255) NOT NULL default '',\n `location_online` tinyint(1) NOT NULL default '1',\n `location_type` enum('location','parent') NOT NULL,\n PRIMARY KEY (`location_id`),\n KEY `location_title` (`location_title`),\n KEY `location_pid` (`location_pid`),\n KEY `location_online` (`location_online`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_delivery'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `delivery_id` int(10) unsigned NOT NULL auto_increment,\n `delivery_title` varchar(255) NOT NULL default '',\n `delivery_description` text,\n `delivery_online` tinyint(1) NOT NULL default '1',\n `delivery_image` varchar(255) NOT NULL,\n PRIMARY KEY (`delivery_id`),\n KEY `delivery_title` (`delivery_title`),\n KEY `delivery_online` (`delivery_online`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_payment * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_payment'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `payment_id` int(10) unsigned NOT NULL auto_increment,\n `payment_title` varchar(255) NOT NULL default '',\n `payment_description` text,\n `payment_online` tinyint(1) NOT NULL default '1',\n `payment_type` enum('online','offline') NOT NULL,\n `payment_gateway` varchar(64) NOT NULL default '',\n `payment_image` varchar(255) NOT NULL,\n PRIMARY KEY (`payment_id`),\n KEY `payment_title` (`payment_title`),\n KEY `payment_online` (`payment_online`),\n KEY `payment_type` (`payment_type`),\n KEY `payment_gateway` (`payment_gateway`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_location_delivery * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_location_delivery'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `ld_id` int(5) unsigned NOT NULL auto_increment,\n `ld_location` int(5) unsigned NOT NULL,\n `ld_delivery` int(5) unsigned NOT NULL,\n `ld_price` decimal(16,2) NOT NULL,\n `ld_delivery_time` mediumint(8) unsigned NOT NULL,\n PRIMARY KEY (`ld_id`),\n KEY `ld_location` (`ld_location`),\n KEY `ld_delivery` (`ld_delivery`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery_payment * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_delivery_payment'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `dp_id` int(5) unsigned NOT NULL auto_increment,\n `dp_delivery` int(5) unsigned NOT NULL,\n `dp_payment` int(5) unsigned NOT NULL,\n PRIMARY KEY (`dp_id`),\n KEY `dp_delivery` (`dp_delivery`),\n KEY `dp_payment` (`dp_payment`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery_payment * @since 2.3.4 2013.03.15 */ $tableName = $xoopsDB->prefix('oledrion_payment_log'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `log_id` int(10) unsigned NOT NULL auto_increment,\n `log_create` int(10) unsigned NOT NULL,\n `log_status` tinyint(1) unsigned NOT NULL,\n `log_ip` varchar(32) NOT NULL,\n `log_type` enum('online','offline') NOT NULL,\n `log_payment` int(10) unsigned NOT NULL,\n `log_gateway` varchar(64) NOT NULL default '',\n `log_uid` int(10) unsigned NOT NULL,\n `log_command` int(10) unsigned NOT NULL,\n `log_amount` double(16,2) NOT NULL,\n `log_authority` varchar(255) NOT NULL,\n PRIMARY KEY (`log_id`),\n KEY `log_uid` (`log_uid`),\n KEY `log_command` (`log_command`),\n KEY `log_status` (`log_status`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Add New fields to oledrion_commands * @since 2.3.2013.03.15 */ $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_create', $tableName)) { oledrion_utils::addField('`cmd_create` int(10) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing', $tableName)) { oledrion_utils::addField('`cmd_packing` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing_id', $tableName)) { oledrion_utils::addField('`cmd_packing_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_location', $tableName)) { oledrion_utils::addField('`cmd_location` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_location_id', $tableName)) { oledrion_utils::addField('`cmd_location_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_delivery', $tableName)) { oledrion_utils::addField('`cmd_delivery` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_delivery_id', $tableName)) { oledrion_utils::addField('`cmd_delivery_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_payment', $tableName)) { oledrion_utils::addField('`cmd_payment` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_payment_id', $tableName)) { oledrion_utils::addField('`cmd_payment_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_status', $tableName)) { oledrion_utils::addField('`cmd_status` tinyint(1) unsigned NOT NULL default "1"', $tableName); } if (!oledrion_utils::fieldExists('cmd_mobile', $tableName)) { oledrion_utils::addField('`cmd_mobile` varchar(30) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing_price', $tableName)) { oledrion_utils::addField('`cmd_packing_price` decimal(16,2) NOT NULL', $tableName); } /** * Add/update product urls * @since 2.3.2013.08.03 */ $tableName = $xoopsDB->prefix('oledrion_products'); if (!oledrion_utils::fieldExists('product_url2', $tableName)) { oledrion_utils::addField('`product_url2` VARCHAR( 255 ) NOT NULL AFTER `product_url`', $tableName); } if (!oledrion_utils::fieldExists('product_url3', $tableName)) { oledrion_utils::addField('`product_url3` VARCHAR( 255 ) NOT NULL AFTER `product_url`', $tableName); } /** * Add cmd_track * @since 2014.01.03 */ $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_track', $tableName)) { oledrion_utils::addField('`cmd_track` VARCHAR( 255 ) NOT NULL', $tableName); } /** * Add cmd_track * @since 2014.01.10 */ $tableName = $xoopsDB->prefix('oledrion_related'); if (!oledrion_utils::fieldExists('related_product_percent', $tableName)) { oledrion_utils::addField('`related_product_percent` INT( 4 ) NOT NULL', $tableName); } }
echo "<tr>\n"; } echo '</table>'; if (isset($pagenav) && is_object($pagenav)) { echo "<div align='right'>" . $pagenav->renderNav() . "</div>"; } include_once OLEDRION_ADMIN_PATH . 'admin_footer.php'; break; // **************************************************************************************************************** // **************************************************************************************************************** case 'delete': // Suppression d'une liste // **************************************************************************************************************** xoops_cp_header(); $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (empty($id)) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl . '?op=' . $operation, 5); } $list = null; $list = $oledrion_handlers->h_oledrion_lists->get($id); if (!is_object($list)) { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $operation, 5); } if ($oledrion_handlers->h_oledrion_lists->deleteList($list)) { oledrion_utils::updateCache(); oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $operation, 2); } else { oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $operation, 5); } break; }
/** * Rentourne la chaine à envoyer dans une balise <a> pour l'attribut href * * @return string */ public function getHrefTitle() { return oledrion_utils::makeHrefTitle($this->getVar('manu_commercialname') . ' ' . $this->getVar('manu_name')); }
$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']); unset($products['lastTitle']); } $xoopsTpl->assign('products', $products); } // Mise en place des catégories de niveau 1 $count = 1; $categories = $h_oledrion_cat->getMotherCategories(); foreach ($categories as $category) { $tmp = $category->toArray(); $tmp['count'] = $count; $xoopsTpl->append('categories', $tmp); $count++; } oledrion_utils::setCSS(); oledrion_utils::setLocalCSS($xoopsConfig['language']); oledrion_utils::setMetas($lastTitle . ' - ' . oledrion_utils::getModuleName(), oledrion_utils::getModuleName()); require_once XOOPS_ROOT_PATH . '/footer.php';
/** * Retourne les éléments à ajouter au formulaire en tant que zones cachées * * @param array $order La commande client * @param array */ function getCheckoutFormContent($order) { global $xoopsConfig; $gatewayName = $this->gatewayInformation['foldername']; $paypal_money = $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'paypal_money'); $paypal_email = $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'paypal_email'); $use_ipn = intval($this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'use_ipn')); $ret = array(); $ret['cmd'] = '_xclick'; $ret['upload'] = '1'; $ret['currency_code'] = $paypal_money; $ret['business'] = $paypal_email; $ret['return'] = OLEDRION_URL . 'thankyou.php'; // Page (générique) de remerciement après paiement $ret['image_url'] = XOOPS_URL . '/images/logo.gif'; $ret['cpp_header_image'] = XOOPS_URL . '/images/logo.gif'; $ret['invoice'] = $order->getVar('cmd_id'); $ret['item_name'] = _OLEDRION_COMMAND . $order->getVar('cmd_id') . ' - ' . oledrion_utils::makeHrefTitle($xoopsConfig['sitename']); $ret['item_number'] = $order->getVar('cmd_id'); $ret['tax'] = 0; // ajout 25/03/2008 $ret['amount'] = $this->formatAmount(floatval($order->getVar('cmd_total', 'n'))); $ret['custom'] = $order->getVar('cmd_id'); //$ret['rm'] = 2; // Renvoyer les données par POST (normalement) $ret['email'] = $order->getVar('cmd_email'); if (xoops_trim($order->getVar('cmd_cancel')) != '') { // URL à laquelle le navigateur du client est ramené si le paiement est annulé $ret['cancel_return'] = OLEDRION_URL . 'cancel-payment.php?id=' . $order->getVar('cmd_cancel'); } if ($use_ipn == 1) { $ret['notify_url'] = OLEDRION_URL . 'gateway-notify.php'; // paypal-notify.php } return $ret; }
$id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (empty($id)) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5); } $opRedirect = 'dashboard'; $item = $h_oledrion_votedata->get($id); if (is_object($item)) { $res = $h_oledrion_votedata->delete($item, true); if ($res) { $product_id = $item->getVar('vote_product_id'); $product = null; $product = $h_oledrion_products->get($product_id); if (is_object($product)) { // Update Product's rating $totalVotes = $sumRating = $ret = $finalrating = 0; $ret = $h_oledrion_votedata->getCountRecordSumRating($product->getVar('product_id'), $totalVotes, $sumRating); if ($totalVotes > 0) { $finalrating = $sumRating / $totalVotes; $finalrating = number_format($finalrating, 4); } $h_oledrion_products->updateRating($product_id, $finalrating, $totalVotes); } oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); } else { oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); } } else { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); } break; }
} // On vérifie que la commande associée est payée $order = null; $order = $h_oledrion_commands->get($caddy->getVar('caddy_cmd_id')); if ($order == null) { oledrion_utils::redirect(_OLEDRION_ERROR16, OLEDRION_URL, 5); } // Tout est bon, on peut envoyer le fichier au navigateur, s'il y a un fichier à télécharger, et s'il existe $file = ''; $file = $product->getVar('product_download_url'); if (xoops_trim($file) == '') { oledrion_utils::redirect(_OLEDRION_ERROR17, OLEDRION_URL, 5); } if (!file_exists($file)) { oledrion_utils::redirect(_OLEDRION_ERROR18, OLEDRION_URL, 5); } // Mise à jour, le fichier n'est plus disponible au téléchargement $h_oledrion_caddy->markCaddyAsNotDownloadableAnyMore($caddy); $fileContent = file_get_contents($file); // Plugins ************************************************ $plugins = oledrion_plugins::getInstance(); $parameters = new oledrion_parameters(array('fileContent' => $fileContent, 'product' => $product, 'order' => $order, 'fullFilename' => $file)); $parameters = $plugins->fireFilter(oledrion_plugins::EVENT_ON_PRODUCT_DOWNLOAD, $parameters); if (trim($parameters['fileContent']) != '') { $fileContent = $parameters['fileContent']; } // ********************************************************* // Et affichage du fichier avec le type mime qui va bien header("Content-Type: " . oledrion_utils::getMimeType($file)); header('Content-disposition: inline; filename="' . basename($file) . '"'); echo $fileContent;
// Lecture des TVA ******************************************************************************** $vatArray = array(); $vatArray = $h_oledrion_vat->getAllVats(new oledrion_parameters()); // 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('columnsCount', oledrion_utils::getModuleOption('catagory_colums')); $xoopsTpl->assign('welcome_msg', nl2br($registry->getfile(OLEDRION_TEXTFILE3))); // Récupération du nombre total de produits publiés dans la base $itemsCount = $h_oledrion_products->getRecommendedCount(); if ($itemsCount > $limit) { $pagenav = new XoopsPageNav($itemsCount, $limit, $start); $xoopsTpl->assign('pagenav', $pagenav->renderNav()); } if ($limit > 0) { // Récupération de la liste des produits récents $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recommended')->setStart($start)->setLimit($limit)->setSort('product_recommended')->setOrder('DESC')->setCategory(0)->setWithXoopsUser(true)->setWithRelatedProducts(true); $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('global_advert', oledrion_utils::getModuleOption('advertisement')); $xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb(array(OLEDRION_URL . basename(__FILE__) => _OLEDRION_RECOMMENDED))); oledrion_utils::setCSS(); oledrion_utils::setLocalCSS($xoopsConfig['language']); oledrion_utils::setMetas(_OLEDRION_RECOMMENDED . ' - ' . oledrion_utils::getModuleName(), oledrion_utils::getModuleName()); require_once XOOPS_ROOT_PATH . '/footer.php';
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** * 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: rate-product.php 12290 2014-02-07 11:05:17Z beckmi $ */ /** * Notation d'un produit */ require 'header.php'; oledrion_utils::redirect(_OLEDRION_NORATE, 'index.php', 5); /* $product_id = 0; // Les tests ************************************************************************************** // Peut on voter ? if (oledrion_utils::getModuleOption('rateproducts') == 0 ) { oledrion_utils::redirect(_OLEDRION_NORATE, 'index.php', 5); } // Recherche du n° du produit if (isset($_GET['product_id'])) { $product_id = intval($_GET['product_id']); } elseif (isset($_POST['product_id'])) { $product_id = intval($_POST['product_id']); } else { oledrion_utils::redirect(_OLEDRION_ERROR1, 'index.php', 5); }
/** * Ajoute un produit à une liste utilisateur * * @param integer $productlist_id Id de la liste * @param integer $productlist_product_id Id du produit * @return boolean */ function addProductToUserList($productlist_list_id, $productlist_product_id) { $product_list = $this->create(true); $product_list->setVar('productlist_list_id', intval($productlist_list_id)); $product_list->setVar('productlist_product_id', intval($productlist_product_id)); $product_list->setVar('productlist_date', oledrion_utils::getCurrentSQLDate()); return $this->insert($product_list, true); }
/** * Calcul le prix HT des options sélectionnées pour un produit * * @param array $choosenAttributes [clé] = attribute_id, [value] = array(valueId1, valueId2 ...) * @param integer $product_vat_id L'ID de TVA du produit * @param array $descriptions Tableau valorisé par la méthode [clé] = Id attribut [valeur] = array('attribute_title', array('attribute_names', 'attribute_prices')) * @return float * @since 2.3.2009.03.21 */ function getProductOptionsPrice($choosenAttributes, $product_vat_id, &$descriptions = null) { static $vats = array(); if (is_array($vats) && isset($vats[$product_vat_id])) { $vat_rate = $vats[$product_vat_id]; } else { $vat = null; $vat = oledrion_handler::getInstance()->h_oledrion_vat->get($product_vat_id); if (is_object($vat)) { $vats[$product_vat_id] = $vat_rate = $vat->getVar('vat_rate', 'n'); } } $ret = 0; $attributesIds = $attributes = array(); if (!is_array($choosenAttributes) || count($choosenAttributes) == 0) { return $ret; } $attributesIds = array_keys($choosenAttributes); $attributes = $this->getItemsFromIds($attributesIds); if (count($attributes) == 0) { return $ret; } $oledrion_Currency = oledrion_Currency::getInstance(); foreach ($choosenAttributes as $userAttributeId => $userAttributeValues) { if (isset($attributes[$userAttributeId])) { $attribute = $attributes[$userAttributeId]; $dataForDescriptions = array(); $optionDescription = ''; if (is_array($userAttributeValues) && count($userAttributeValues) > 0) { foreach ($userAttributeValues as $option) { $optionName = oledrion_utils::getName($option); $price = $attribute->getOptionPriceFromValue($optionName); $optionDescription = $attribute->getOptionNameFromValue($optionName); $vatAmount = oledrion_utils::getVAT($price, $vat_rate); $ttc = $price + $vatAmount; $vatAmountFormated = $oledrion_Currency->amountForDisplay($vatAmount); $htFormated = $oledrion_Currency->amountForDisplay($price); $ttcFormated = $oledrion_Currency->amountForDisplay($ttc); $dataForDescriptions[] = array('option_name' => $optionDescription, 'option_value' => $optionName, 'option_price' => $price, 'option_vat' => $vatAmount, 'option_ttc' => $ttc, 'option_price_ht_formated' => $htFormated, 'option_vat_formated' => $vatAmountFormated, 'option_ttc_formated' => $ttcFormated); $ret += $price; // Total de toutes les options } } else { $optionName = oledrion_utils::getName($userAttributeValues); $price = $attribute->getOptionPriceFromValue($optionName); $optionDescription = $attribute->getOptionNameFromValue($optionName); $vatAmount = oledrion_utils::getVAT($price, $vat_rate); $ttc = $price + $vatAmount; $vatAmountFormated = $oledrion_Currency->amountForDisplay($vatAmount); $htFormated = $oledrion_Currency->amountForDisplay($price); $ttcFormated = $oledrion_Currency->amountForDisplay($ttc); $dataForDescriptions[] = array('option_name' => $optionDescription, 'option_value' => $optionName, 'option_price' => $price, 'option_vat' => $vatAmount, 'option_ttc' => $ttc, 'option_price_ht_formated' => $htFormated, 'option_vat_formated' => $vatAmountFormated, 'option_ttc_formated' => $ttcFormated); $ret += $price; // Total de toutes les options } if (is_array($descriptions)) { $descriptions[$attribute->getVar('attribute_id')] = array('attribute_title' => $attribute->getVar('attribute_title'), 'attribute_options' => $dataForDescriptions); } } } return $ret; }
* * 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';
$criteria->setLimit($limit); $products = array(); $products = $oledrion_handlers->h_oledrion_products->getObjects($criteria); $javascriptSearch = array("'", '"'); $javascriptReplace = array(' ', ' '); if (count($products) > 0) { foreach ($products as $product) { $productData = $product->toArray(); $productData['product_title_javascript'] = str_replace($javascriptSearch, $javascriptReplace, $product->getVar('product_title', 'n')); //$productData['product_title_javascript'] = $product->getVar('product_title', 'n'); $xoopsTpl->append('products', $productData); } } } oledrion_utils::loadLanguageFile('modinfo.php'); oledrion_utils::loadLanguageFile('main.php'); $categoriesSelect = $mytree->makeSelBox('product_cid', 'cat_title', '-', $selectedCategory, '---', 0, "class='selectLists'"); $xoopsTpl->assign('callerName', $callerName); $xoopsTpl->assign('sart', $start); $xoopsTpl->assign('theme_set', xoops_getcss($xoopsConfig['theme_set'])); $xoopsTpl->assign('xoopsConfig', $xoopsConfig); $xoopsTpl->assign('mutipleSelect', $mutipleSelect); $xoopsTpl->assign('searchVendorSelected', $searchVendorSelected); $xoopsTpl->assign('baseurl', OLEDRION_URL . 'admin/' . basename(__FILE__)); // URL de ce script $xoopsTpl->assign('searchVendor', $vendors); $xoopsTpl->assign('searchCriteria', $searchCriterias); $xoopsTpl->assign('searchField', $searchFields); $xoopsTpl->assign('searchCategory', $categoriesSelect); $xoopsTpl->assign('searchFieldSelected', $selectedSearchField); echo $xoopsTpl->fetch('db:oledrion_productsselector.html');