/** * 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; }
/** * 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')); }
$result = $xoopsDB->query($sqlCount); $rowCount = $xoopsDB->fetchArray($result); if ($rowCount['cpt'] > $limit) { require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new XoopsPageNav($rowCount['cpt'], $limit, $start, 'start'); $xoopsTpl->assign('pagenav', $pagenav->renderNav()); } $sql .= ' GROUP BY b.product_id ORDER BY product_submitted DESC'; $result = $xoopsDB->query($sql, $limit, $start); $ret = array(); $tempProduct = $h_oledrion_products->create(true); while ($myrow = $xoopsDB->fetchArray($result)) { $ret = array(); $ret['link'] = $tempProduct->getLink($myrow['product_id'], $myrow['product_title']); $ret['title'] = $myts->htmlSpecialChars($myrow['product_title']); $ret['href_title'] = oledrion_utils::makeHrefTitle($myts->htmlSpecialChars($myrow['product_title'])); $ret['time'] = $myrow['product_submitted']; $ret['uid'] = $myrow['product_submitter']; $xoopsTpl->append('products', $ret); } unset($tempProduct); } else { $xoopsTpl->assign('search_results', false); $xoopsTpl->assign('global_advert', oledrion_utils::getModuleOption('advertisement')); $xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb(array(OLEDRION_URL . basename(__FILE__) => _OLEDRION_SEARCHFOR))); oledrion_utils::setMetas(oledrion_utils::getModuleName() . ' - ' . _OLEDRION_SEARCHFOR, oledrion_utils::getModuleName() . ' - ' . _OLEDRION_SEARCHFOR); } require_once OLEDRION_PATH . 'include/product_search_form.php'; $sform = oledrion_utils::formMarkRequiredFields($sform); $xoopsTpl->assign('search_form', $sform->render()); oledrion_utils::setCSS();
/** * Rentourne la chaine à envoyer dans une balise <a> pour l'attribut href * * @return string */ public function getHrefTitle() { return oledrion_utils::makeHrefTitle($this->getVar('cat_title')); }
/** * Retourne les éléments du produits formatés pour affichage * * @param string $format Le format à utiliser * @return array Les informations formatées */ public function toArray($format = 's') { $ret = array(); $ret = parent::toArray($format); $oledrion_Currency = oledrion_Currency::getInstance(); $ttc = $finalPriceTTC = $this->getTTC(); $finalPriceHT = floatval($this->getVar('product_price')); $ret['product_ecotaxe_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_ecotaxe')); $ret['product_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_price', 'e')); $ret['product_shipping_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_shipping_price', 'e')); $ret['product_discount_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_discount_price', 'e')); $ret['product_price_ttc'] = $oledrion_Currency->amountForDisplay($ttc); $ret['product_price_ttc_long'] = $oledrion_Currency->amountForDisplay($ttc, 'l'); if (intval($this->getVar('product_discount_price')) > 0) { //geeker $finalPriceTTC = $this->getDiscountTTC(); $finalPriceHT = floatval($this->getVar('product_discount_price', 'e')); $ret['product_discount_price_ttc'] = $oledrion_Currency->amountForDisplay($this->getDiscountTTC()); $ret['product_discount_price_ttc_long'] = $oledrion_Currency->amountForDisplay($this->getDiscountTTC(), 'l'); } else { $ret['product_discount_price_ttc'] = ''; $ret['product_discount_price_ttc_long'] = ''; } // Les informations sur les attributs $attributesCount = $this->productAttributesCount(); $ret['product_attributes_count'] = $attributesCount; if ($attributesCount > 0) { $optionsPrice = $this->getInitialOptionsPrice(); $ret['product_price_formated'] = $oledrion_Currency->amountForDisplay(floatval($this->getVar('product_price', 'e')) + $optionsPrice); $ret['product_discount_price_formated'] = $oledrion_Currency->amountForDisplay(floatval($this->getVar('product_discount_price', 'e')) + $optionsPrice); $ret['product_price_ttc'] = $oledrion_Currency->amountForDisplay($ttc + $optionsPrice); $ret['product_price_ttc_long'] = $oledrion_Currency->amountForDisplay($ttc + $optionsPrice, 'l'); if (intval($this->getVar('product_discount_price')) != 0) { $finalPriceTTC = $this->getDiscountTTC() + $optionsPrice; $finalPriceHT = floatval($this->getVar('product_discount_price', 'e')) + $optionsPrice; $ret['product_discount_price_ttc'] = $oledrion_Currency->amountForDisplay(floatval($this->getDiscountTTC()) + $optionsPrice); $ret['product_discount_price_ttc_long'] = $oledrion_Currency->amountForDisplay(floatval($this->getDiscountTTC()) + $optionsPrice, 'l'); } } $ret['product_final_price_ht_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceHT, 'l'); $ret['product_final_price_ttc'] = $finalPriceTTC; $ret['product_final_price_ttc_javascript'] = oledrion_utils::formatFloatForDB($finalPriceTTC); $ret['product_final_price_ttc_formated'] = $oledrion_Currency->amountForDisplay($finalPriceTTC); $ret['product_final_price_ttc_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceTTC, 'l'); $ret['product_vat_amount_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceHT - $finalPriceTTC); $ret['product_tooltip'] = oledrion_utils::makeInfotips($this->getVar('product_description')); $ret['product_url_rewrited'] = $this->getLink(); $ret['product_href_title'] = oledrion_utils::makeHrefTitle($this->getVar('product_title')); $ret['product_recommended'] = $this->isRecommended(); $ret['product_recommended_picture'] = $this->recommendedPicture(); $ret['product_image_full_url'] = $this->getPictureUrl(); $ret['product_thumb_full_url'] = $this->getThumbUrl(); $ret['product_image_full_path'] = $this->getPicturePath(); $ret['product_thumb_full_path'] = $this->getThumbPath(); $ret['product_shorten_summary'] = oledrion_utils::truncate_tagsafe($this->getVar('product_summary'), OLEDRION_SUMMARY_MAXLENGTH); $ret['product_shorten_description'] = oledrion_utils::truncate_tagsafe($this->getVar('product_description'), OLEDRION_SUMMARY_MAXLENGTH); $ret['product_new'] = $this->isNewProduct(); return $ret; }
if ($count > 0) { $tblTmp = array(); $tblTmp = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $count, 'category' => $product->getVar('product_cid'), 'sort' => 'product_submitted DESC, product_title', 'order' => '', 'excluded' => $product_id))); foreach ($tblTmp as $item) { $product_price = $item->getVar('product_price'); $product_price_ttc = oledrion_utils::getTTC($item->getVar('product_price'), ''); if ($h_oledrion_attributes->getProductAttributesCount($item->getVar('product_id')) > 0) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('attribute_product_id', $item->getVar('product_id'))); $attribute = $h_oledrion_attributes->getObjects($criteria, false); foreach ($attribute as $root) { $product_price = $root->getVar('attribute_default_value'); $product_price_ttc = oledrion_utils::getTTC($root->getVar('attribute_default_value'), ''); } } $datas = array('last_categ_product_title' => $item->getVar('product_title'), 'last_categ_product_url_rewrited' => $item->getLink(), 'last_categ_product_href_title' => oledrion_utils::makeHrefTitle($item->getVar('product_title')), 'product_thumb_url' => $item->getVar('product_thumb_url'), 'product_thumb_full_url' => $item->getThumbUrl(), 'product_url_rewrited' => $item->getLink(), 'product_href_title' => oledrion_utils::makeHrefTitle($item->getVar('product_title')), 'product_title' => $item->getVar('product_title'), 'product_property1' => $item->getVar('product_property1'), 'product_property2' => $item->getVar('product_property2'), 'product_property3' => $item->getVar('product_property3'), 'product_property4' => $item->getVar('product_property4'), 'product_property5' => $item->getVar('product_property5'), 'product_property6' => $item->getVar('product_property6'), 'product_property7' => $item->getVar('product_property7'), 'product_property8' => $item->getVar('product_property8'), 'product_property9' => $item->getVar('product_property9'), 'product_property10' => $item->getVar('product_property10'), 'product_id' => $item->getVar('product_id'), 'product_new' => $item->isNewProduct(), 'product_stock' => $item->getVar('product_stock'), 'product_price' => $product_price, 'product_price_ttc' => $product_price_ttc); $xoopsTpl->append('product_current_categ', $datas); } unset($tblTmp); } // Deux c'est mieux ******************************************************************************* $count = oledrion_utils::getModuleOption('better_together'); $xoopsTpl->assign('better_together', $count); if ($count > 0) { $productWith = 0; // On recherche le produit qui s'est le plus vendu avec ce produit $productWith = $h_oledrion_caddy->getBestWith($product->getVar('product_id')); if ($productWith > 0) { $tmpProduct = null; $tmpProduct = $h_oledrion_products->get($productWith); if (is_object($tmpProduct)) {
/** * Affiche le bloc des catégories en fonction de la catégorie en cours (fonctionne de paire avec les pages du module) */ function b_oledrion_category_show($options) { global $xoopsTpl; $block = array(); include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $url = OLEDRION_URL . 'include/oledrion.css'; $xoopsTpl->assign("xoops_module_header", "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$url}\" />"); $block['nostock_msg'] = oledrion_utils::getModuleOption('nostock_msg'); if (intval($options[0]) == 0) { // Catégories selon la page en cours $block['block_option'] = 0; if (!isset($GLOBALS['current_category']) || $GLOBALS['current_category'] == -1) { return false; } $cat_cid = intval($GLOBALS['current_category']); include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; if ($cat_cid > 0) { include_once XOOPS_ROOT_PATH . '/class/tree.php'; $tbl_categories = $tblChilds = $tbl_tmp = array(); $tbl_categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters()); $mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid'); $tblChilds = $mytree->getAllChild($cat_cid); //$tblChilds = array_reverse($tblChilds); foreach ($tblChilds as $item) { $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . oledrion_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>"; } $block['block_categories'] = $tbl_tmp; $category = null; if ($cat_cid > 0) { $category = $h_oledrion_cat->get($cat_cid); if (is_object($category)) { $block['block_current_category'] = $category->toArray(); } } } else { // On est à la racine, on n'affiche donc que les catégories mères $tbl_categories = array(); $criteria = new Criteria('cat_pid', 0, '='); $criteria->setSort('cat_title'); $tbl_categories = $h_oledrion_cat->getObjects($criteria, true); foreach ($tbl_categories as $item) { $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . oledrion_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>"; } $block['block_categories'] = $tbl_tmp; } } elseif (intval($options[0]) == 1) { // Affichage classique $block['block_option'] = 1; include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; include_once OLEDRION_PATH . 'class/tree.php'; $tbl_categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters()); $mytree = new Oledrion_XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid'); $jump = OLEDRION_URL . "category.php?cat_cid="; $additional = "onchange='location=\"" . $jump . "\"+this.options[this.selectedIndex].value'"; if (isset($GLOBALS['current_category']) && $GLOBALS['current_category'] != -1) { $cat_cid = intval($GLOBALS['current_category']); } else { $cat_cid = 0; } $htmlSelect = $mytree->makeSelBox('cat_cid', 'cat_title', '-', $cat_cid, false, 0, $additional); $block['htmlSelect'] = $htmlSelect; } else { // Affichage de toute l'arborescence, dépliée $block['block_option'] = 2; $block['liMenu'] = $h_oledrion_cat->getUlMenu('category_title'); } return $block; }
$tblTmp = array(); $tblTmp = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $count, 'category' => 0, 'sort' => 'product_submitted DESC, product_title', 'order' => '', 'excluded' => $product_id))); foreach ($tblTmp as $item) { $datas = array('last_categs_product_title' => $item->getVar('product_title'), 'last_categs_product_url_rewrited' => $item->getLink(), 'last_categs_product_href_title' => oledrion_utils::makeHrefTitle($item->getVar('product_title'))); $xoopsTpl->append('product_all_categs', $datas); } unset($tblTmp); } // x derniers produits dans cette catégorie ********************************************************* $count = oledrion_utils::getModuleOption('summarycategory'); $xoopsTpl->assign('summarycategory', $count); if ($count > 0) { $tblTmp = array(); $tblTmp = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $count, 'category' => $product->getVar('product_cid'), 'sort' => 'product_submitted DESC, product_title', 'order' => '', 'excluded' => $product_id))); foreach ($tblTmp as $item) { $datas = array('last_categ_product_title' => $item->getVar('product_title'), 'last_categ_product_url_rewrited' => $item->getLink(), 'last_categ_product_href_title' => oledrion_utils::makeHrefTitle($item->getVar('product_title'))); $xoopsTpl->append('product_current_categ', $datas); } unset($tblTmp); } // Deux c'est mieux ******************************************************************************* $count = oledrion_utils::getModuleOption('better_together'); $xoopsTpl->assign('better_together', $count); if ($count > 0) { $productWith = 0; // On recherche le produit qui s'est le plus vendu avec ce produit $productWith = $h_oledrion_caddy->getBestWith($product->getVar('product_id')); if ($productWith > 0) { $tmpProduct = null; $tmpProduct = $h_oledrion_products->get($productWith); if (is_object($tmpProduct)) {
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $catLink = $category->getLink(); $pagenav = new XoopsPageNav($productsCount, $limit, $start, 'start', 'cat_cid=' . $cat_cid); $xoopsTpl->assign('pagenav', $pagenav->renderNav()); } else { $xoopsTpl->assign('pagenav', ''); } // Breadcrumb ********************************************************************************* $ancestors = $mytree->getAllParent($cat_cid); $ancestors = array_reverse($ancestors); $tbl_tmp[] = "<a href='" . OLEDRION_URL . "index.php' title='" . oledrion_utils::makeHrefTitle(oledrion_utils::getModuleName()) . "'>" . oledrion_utils::getModuleName() . '</a>'; foreach ($ancestors as $item) { $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . oledrion_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . '</a>'; } // Ajout de la catégorie courante $tbl_tmp[] = "<a href='" . $category->getLink() . "' title='" . oledrion_utils::makeHrefTitle($category->getVar('cat_title')) . "'>" . $category->getVar('cat_title') . '</a>'; $breadcrumb = implode(' » ', $tbl_tmp); $xoopsTpl->assign('breadcrumb', $breadcrumb); // Meta *************************************************************************************** $title = strip_tags($breadcrumb); if (!oledrion_utils::getModuleOption('manual_meta')) { oledrion_utils::setMetas($title, $title, str_replace('»', ',', $title)); } else { $pageTitle = xoops_trim($category->getVar('cat_metatitle')) == '' ? $title : $category->getVar('cat_metatitle'); $metaDescription = xoops_trim($category->getVar('cat_metadescription')) != '' ? $category->getVar('cat_metadescription') : $title; $metaKeywords = xoops_trim($category->getVar('cat_metakeywords')); oledrion_utils::setMetas($pageTitle, $metaDescription, $metaKeywords); } // Données des Produits ************************************************************************* $products = array(); $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recent')->setCategory($cat_cid)->setStart($start)->setLimit($limit)->setSort('product_submitted DESC, product_title');