14 if (!defined(
'IN_PEEL')) {
18 if (!function_exists(
'get_produit_details_html')) {
28 function get_produit_details_html(&
$product_object, $color_id = null, $secondary_images_width = 50, $secondary_images_height = 60)
34 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'produit_details_html.tpl');
35 $tpl->assign(
'medium_width',
$GLOBALS[
'site_parameters'][
'medium_width']);
36 $tpl->assign(
'medium_height',
$GLOBALS[
'site_parameters'][
'medium_height']);
37 $tpl->assign(
'photo_not_available_alt',
$GLOBALS[
'STR_PHOTO_NOT_AVAILABLE_ALT']);
38 $tpl->assign(
'STR_CONDITIONING',
$GLOBALS[
'STR_CONDITIONING']);
39 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
40 if(!empty(
$GLOBALS[
'site_parameters'][
'default_picture'])) {
41 $tpl->assign(
'no_photo_src',
$GLOBALS[
'repertoire_upload'] .
'/' .
$GLOBALS[
'site_parameters'][
'default_picture']);
43 if(empty(
$GLOBALS[
'site_parameters'][
'avoid_increment_products_nb_view'])) {
45 query(
"UPDATE peel_produits
46 SET nb_view = (nb_view+1)
49 $product_images =
$product_object->get_product_pictures(
true, $color_id);
50 $display_first_image_on_mini_pictures_list =
true;
52 if (!empty($product_images[0])) {
53 $this_thumb =
thumbs($product_images[0],
$GLOBALS[
'site_parameters'][
'medium_width'],
$GLOBALS[
'site_parameters'][
'medium_height'],
'fit');
56 if(!empty($imgInfo)) {
57 if (!empty(
$GLOBALS[
'site_parameters'][
'lightbox_gallery_enable'])) {
63 $a_other_pictures_attributes =
' href="[ZOOM_IMAGE]"'.$data_lightbox.
' onclick="switch_product_images(\'[SMALL_IMAGE]\',\'[ZOOM_IMAGE]\',\'[VIGNETTE_CLASS]\'); return false;"';
64 $srcWidth = $imgInfo[0];
65 $srcHeight = $imgInfo[1];
68 $zoom_width = max($srcWidth, $min_zoom_width);
69 $zoom_height = round($srcHeight * $zoom_width/max($srcWidth, 1));
70 if (
$GLOBALS[
'site_parameters'][
'zoom'] ==
'cloud-zoom') {
72 $a_zoom_attributes =
' class="cloud-zoom" rel="adjustX: 10, adjustY:-4"';
73 $a_other_pictures_attributes =
' href="[ZOOM_IMAGE]" class="cloud-zoom-gallery" rel="useZoom:\'zoom1\', smallImage: \'[SMALL_IMAGE]\'"';
75 a_other_pictures_attributes=\'' . str_replace(
"'",
"\'", $a_other_pictures_attributes) .
'\';
77 } elseif ($GLOBALS['site_parameters
']['zoom
'] == 'jqzoom
') {
78 $a_zoom_attributes = ' rel=
"gal' . $product_object->id . '" class=
"jqzoom' . $product_object->id . '"';
79 $a_other_pictures_attributes = ' href=
"javascript:void(0);" rel=
"{gallery: \'gal' . $product_object->id . '\', smallimage: \'[SMALL_IMAGE]\',largeimage: \'[ZOOM_IMAGE]\'}"';
80 if (!empty($srcWidth)) {
81 $GLOBALS['js_ready_content_array
'][] = '
82 $(
".jqzoom' . $product_object->id . '").jqzoom({
83 zoomWidth:
' . $zoom_width . ',
84 zoomHeight:
' . $zoom_height . ',
90 } elseif ($GLOBALS['site_parameters
']['zoom
'] == 'lightbox
') {
91 $display_first_image_on_mini_pictures_list = false;
92 $a_zoom_attributes = ' class=
"lightbox"'.$data_lightbox;
94 $a_zoom_attributes = '';
96 $tpl->assign('main_image
', array(
97 'href
' => $GLOBALS['repertoire_upload
'] . '/
' . String::rawurlencode($product_images[0]),
98 'src
' => $GLOBALS['repertoire_upload
'] . '/
thumbs/
' . $this_thumb,
99 'is_pdf
' => (get_file_type($product_images[0]) == 'pdf
')
102 $tpl->assign('a_zoom_attributes
', vb($a_zoom_attributes));
103 $tpl->assign('a_other_pictures_attributes
', vb($a_other_pictures_attributes));
104 if (!empty($product_object->on_estimate)) {
105 $tpl->assign('title_price
', array(
106 'txt
' => $GLOBALS['STR_ON_ESTIMATE
'],
109 } elseif ($product_object->on_gift) {
110 $tpl->assign('title_price
', array(
112 'value
' => $product_object->on_gift_points . ' ' . $GLOBALS['STR_GIFT_POINTS
']
114 } elseif ($product_object->get_final_price(get_current_user_promotion_percentage(), display_prices_with_taxes_active(), check_if_module_active('reseller
') && is_reseller()) != 0) {
115 $tpl->assign('title_price
', array(
117 'value
' => str_replace(' ', ' ', $product_object->affiche_prix(display_prices_with_taxes_active(), check_if_module_active('reseller
') && is_reseller(), true, false, 'title_price
', false, true, 'price_in_product_title
', true, true))
120 $tpl->assign('title_price
', array(
121 'txt
' => $GLOBALS['STR_FREE
'],
125 if (check_if_module_active('participants
') && est_identifie() && $_SESSION['session_utilisateur
']['id_utilisateur
'] != $product_object->id_utilisateur) {
126 $tpl->assign('subscribe_trip_form
', get_subscribe_trip_form($product_object->id, vn($_SESSION['session_utilisateur
']['id_utilisateur
'])));
127 $tpl->assign('display_registred_user
', display_registred_user($product_object->id));
129 if (check_if_module_active('vacances
')) {
130 if (get_vacances_type() == 1) {
131 $tpl->assign('global_error
', array(
132 'txt
' => vb($GLOBALS['site_parameters
']['module_vacances_client_msg_
' . $_SESSION['session_langue
']]),
135 } elseif (get_vacances_type() == 2) {
136 // on récupère le fournisseur pour afficher sa date de retour
137 $supplier_back = query("SELECT on_vacances, on_vacances_date
138 FROM peel_utilisateurs
139 WHERE id_utilisateur = " . $product_object->id_utilisateur . " AND " . get_filter_site_cond('utilisateurs
') . "");
140 $res_supplier_back = fetch_assoc($supplier_back);
141 if (num_rows($supplier_back) == 1 && !empty($res_supplier_back['on_vacances_date
']) && !empty($res_supplier_back['on_vacances
'])) {
142 $tpl->assign('global_error
', array(
143 'txt
' => $GLOBALS['STR_HOLIDAY_AVAILABLE
'],
144 'date
' => get_formatted_date($res_supplier_back['on_vacances_date
'])
149 $tpl->assign('link_contact
', get_url('/utilisateurs/contact.php
'));
150 $tpl->assign('contact
', $GLOBALS["STR_CONTACT"]);
151 $tpl->assign('product_detail_image
', $GLOBALS['site_parameters
']['general_product_image
']);
152 $tpl->assign('product_name
', $product_object->name);
153 $tpl->assign('product_id
', $product_object->id);
154 $tpl->assign('product_href
', $product_object->get_product_url());
155 if (!empty($GLOBALS['site_parameters
']['enable_categorie_sentence_displayed_on_product
'])) {
156 $tpl->assign('categorie_sentence_displayed_on_product
', $product_object->categorie_sentence_displayed_on_product);
158 if (!empty($_GET['catid
'])) {
159 // Permet de gérer si catégorie imposée
160 $current_catid = intval($_GET['catid
']);
162 $current_catid = $product_object->categorie_id;
164 $prev = (check_if_module_active('precedent_suivant
') ? show_preview_next($product_object->id, $product_object->position, 'prev
', $current_catid) : '');
165 $next = (check_if_module_active('precedent_suivant
') ? show_preview_next($product_object->id, $product_object->position, 'next
', $current_catid) : '');
166 $tpl->assign('prev
', $prev);
167 $tpl->assign('next
', $next);
169 if ($product_object->is_price_flash(check_if_module_active('reseller
') && is_reseller())) {
170 $tpl->assign('flash_txt
', $GLOBALS['STR_TEXT_FLASH1
'] . ' ' . get_formatted_duration(strtotime($product_object->flash_end) - time(), false, 'day
') . ' ' . $GLOBALS['STR_TEXT_FLASH2
']);
173 if (empty($GLOBALS['site_parameters
']['admin_product_edit_links_in_front_office_disable
']) && a_priv('admin_products
', false)) {
174 $tpl->assign('admin
', array(
175 'href
' => $GLOBALS['administrer_url
'] . '/produits.php?mode=modif&
id=
' . $product_object->id,
176 'modify_txt
' => $GLOBALS['STR_MODIFY_PRODUCT
'],
177 'is_offline
' => (bool)($product_object->etat == 0),
178 'offline_txt
' => $GLOBALS['STR_OFFLINE_PRODUCT
']
181 if (est_identifie() && !empty($GLOBALS['site_parameters
']['enable_create_product_in_front
']) && $product_object->id_utilisateur == $_SESSION['session_utilisateur
']['id_utilisateur
']) {
182 // On récupère les informations manquantes
183 $sql = "SELECT p.id, p.titre_" . $_SESSION['session_langue
'] . " AS titre, p.on_special, pc.rubrique_id, r.nom_" . $_SESSION['session_langue
'] . " AS rubrique_nom
185 INNER JOIN peel_articles_rubriques pc ON p.id = pc.article_id
186 INNER JOIN peel_rubriques r ON r.id = pc.rubrique_id AND " . get_filter_site_cond('rubriques
', 'r
') . "
187 WHERE p.technical_code = 'display_product_form
' AND p.etat='1
' AND titre_" . $_SESSION['session_langue
'] . "!='' AND " . get_filter_site_cond('articles
', 'p
') . "";
188 $query = query($sql) ;
189 if ($result = fetch_assoc($query)) {
190 $tpl->assign('modify_product_by_owner
', array(
191 'href
' => get_content_url($result['id'], $result['titre
'], $result['rubrique_id
'], $result['rubrique_nom
']) . '?mode=modif&product_id=
' . $product_object->id,
192 'label
' => $GLOBALS['STR_MODIFY_PRODUCT
']
196 if (!empty($product_images) && count($product_images) > 1) {
198 if (!empty($GLOBALS['site_parameters
']['order_product_images_per_ratio
'])) {
199 // Tri des images en fonction du ratio d'image.
201 $new_product_images_array = array();
202 foreach ($product_images as $key => $name) {
204 $imgInfo = @getimagesize(
$GLOBALS[
'uploaddir'].
'/'.$name);
206 if (!empty($imgInfo) && !empty($imgInfo[0])) {
207 $tmp[$key] = $imgInfo[1]/$imgInfo[0];
214 foreach ($tmp as $key=>$ratio) {
216 $new_product_images_array[] = $product_images[$key];
219 $product_images = $new_product_images_array;
221 foreach ($product_images as $key => $name) {
222 if (!$display_first_image_on_mini_pictures_list && $key == 0) {
225 $vignette_id =
'vignette' . $key;
227 $small_image =
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($name,
$GLOBALS[
'site_parameters'][
'medium_width'],
$GLOBALS[
'site_parameters'][
'medium_height'],
'fit');
230 'id' => $vignette_id,
231 'a_attr' => str_replace(array(
'[SMALL_IMAGE]',
'[ZOOM_IMAGE]',
'[VIGNETTE_CLASS]'), array($small_image,
$GLOBALS[
'repertoire_upload'] .
'/' . $name, $vignette_id), $a_other_pictures_attributes),
232 'src' =>
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($name, $secondary_images_width, $secondary_images_height,
'fit'),
237 'href' =>
$GLOBALS[
'repertoire_upload'] .
'/' . $name,
238 'src' =>
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($name, $secondary_images_width, $secondary_images_height,
'fit'),
243 $tpl->assign(
'product_images', $tmp_imgs);
246 $tpl->assign(
'tell_friends', array(
247 'href' => get_tell_friends_url(
false),
248 'src' =>
$GLOBALS[
'site_parameters'][
'general_send_email_image'],
249 'txt' =>
$GLOBALS[
'STR_TELL_FRIEND']
256 $q_average_rating =
query(
"SELECT AVG(note) AS average_rating
258 WHERE id_produit = '" . intval(
$product_object->id) .
"' AND etat = '1'");
259 $r_average_rating =
fetch_assoc($q_average_rating);
260 $average_rating = number_format($r_average_rating[
'average_rating'], 0);
261 $sqlAvis =
"SELECT note
265 $resAvis =
query($sqlAvis);
266 $notation_array = array();
268 if (!isset($notation_array[$Avis[
'note']])) {
269 $notation_array[$Avis[
'note']] = 0;
271 $notation_array[$Avis[
'note']]++;
274 $tpl->assign(
'avis', array(
276 'src' =>
$GLOBALS[
'site_parameters'][
'general_give_your_opinion_image'],
277 'txt' =>
$GLOBALS[
'STR_DONNEZ_AVIS']
279 $tpl->assign(
'tous_avis', array(
281 'src' =>
$GLOBALS[
'site_parameters'][
'general_read_all_reviews_image'],
282 'txt' =>
$GLOBALS[
'STR_TOUS_LES_AVIS'],
283 'STR_POSTED_OPINION' =>
$GLOBALS[
'STR_POSTED_OPINION'],
284 'STR_POSTED_OPINIONS' =>
$GLOBALS[
'STR_POSTED_OPINIONS'],
285 'STR_MODULE_AVIS_NOTE' =>
$GLOBALS[
'STR_MODULE_AVIS_NOTE'],
286 'nb_avis' => array_sum($notation_array),
287 'star_src' => get_url(
'/images/star1.gif'),
288 'average_rating' => $average_rating,
289 'display_opinion_resume_in_product_page' => !empty(
$GLOBALS[
'site_parameters'][
'display_opinion_resume_in_product_page'])
292 if (!empty(
$GLOBALS[
'site_parameters'][
'quick_add_product_from_search_page'])) {
293 $tpl->assign(
'add_easy_list', array(
294 'href' =>
$GLOBALS[
'wwwroot'].
'/search.php?type=quick_add_product_from_search_page&prodid=' .
$product_object->id .
'&quantite=1',
295 'txt' =>
$GLOBALS[
'STR_PRODUCT_ADD_TO_EASY_LIST']
299 $tpl->assign(
'pensebete', array(
301 'src' =>
$GLOBALS[
'site_parameters'][
'general_add_notepad_image'],
302 'txt' =>
$GLOBALS[
'STR_AJOUT_PENSE_BETE']
305 $tpl->assign(
'print', array(
306 'src' =>
$GLOBALS[
'site_parameters'][
'general_print_image'],
311 $tpl->assign(
'reference', array(
312 'label' =>
$GLOBALS[
'STR_REFERENCE'],
317 $tpl->assign(
'ean_code', array(
324 $brand_link = trim(get_brand_link_html(
$product_object->id_marque,
true));
325 if(!empty($brand_link)) {
326 $tpl->assign(
'marque', array(
334 $tpl->assign(
'points', array(
339 if(
vb(
$GLOBALS[
'site_parameters'][
'show_short_description_on_product_details'])) {
342 $tpl->assign(
'descriptif',
'');
345 if(!empty(
$GLOBALS[
'site_parameters'][
'show_qrcode_on_product_pages'])) {
348 if(!empty(
$GLOBALS[
'site_parameters'][
'show_barcode_on_product_pages'])) {
362 $tpl->assign(
'critere_stock', affiche_critere_stock(
$product_object,
'details', null,
true));
364 $tpl->assign(
'critere_stock',
'');
367 $tpl->assign(
'on_estimate', array(
368 'label' =>
$GLOBALS[
'STR_ON_ESTIMATE'],
369 'action' => get_contact_url(
false,
false),
370 'contact_us' =>
$GLOBALS[
'STR_CONTACT_US']
378 tab1_html_' .
$_SESSION[
'session_langue'] .
' AS tab1_html,
379 tab2_html_' .
$_SESSION[
'session_langue'] .
' AS tab2_html,
380 tab3_html_' .
$_SESSION[
'session_langue'] .
' AS tab3_html,
381 tab4_html_' .
$_SESSION[
'session_langue'] .
' AS tab4_html,
382 tab5_html_' .
$_SESSION[
'session_langue'] .
' AS tab5_html,
383 tab6_html_' .
$_SESSION[
'session_langue'] .
' AS tab6_html,
384 tab1_title_' .
$_SESSION[
'session_langue'] .
' AS tab1_title,
385 tab2_title_' .
$_SESSION[
'session_langue'] .
' AS tab2_title,
386 tab3_title_' .
$_SESSION[
'session_langue'] .
' AS tab3_title,
387 tab4_title_' .
$_SESSION[
'session_langue'] .
' AS tab4_title,
388 tab5_title_' .
$_SESSION[
'session_langue'] .
' AS tab5_title,
389 tab6_title_' .
$_SESSION[
'session_langue'] .
' AS tab6_title
398 if (!empty($render_avis_public_list)) {
400 'tab_id' =>
'tab_opinion',
402 'title' =>
$GLOBALS[
'STR_TOUS_LES_AVIS'],
403 'is_current' =>
true,
404 'content' => $render_avis_public_list);
409 for (
$i = 1;
$i <= 6;
$i++) {
410 $title = trim($tab[
'tab' .
$i .
'_title']);
411 if (!empty($title)) {
414 'tab_id' =>
'tab_' .
$i,
417 'is_current' => (
bool)(
$i == 1 && empty($render_avis_public_list)),
418 'content' => $tab_html
426 $tpl->assign(
'tabs', $tabs);
433 if (!empty(
$GLOBALS[
'site_parameters'][
'category_order_on_catalog'])) {
434 $nb_colonnes =
vn(
$GLOBALS[
'site_parameters'][
'associated_products_columns_if_order_allowed_on_products_lists']);
436 $nb_colonnes =
vn(
$GLOBALS[
'site_parameters'][
'associated_products_columns_default']);
439 if (empty(
$GLOBALS[
'site_parameters'][
'disable_addthis_buttons'])) {
440 $tpl->assign(
'addthis_buttons', addthis_buttons());
442 $tpl->assign(
'display_share_tools_on_product_pages', !empty(
$GLOBALS[
'site_parameters'][
'display_share_tools_on_product_pages']));
443 $tpl->assign(
'associated_products', affiche_produits(null, 3,
'associated_product',
$GLOBALS[
'site_parameters'][
'nb_produit_page'],
vb(
$GLOBALS[
'site_parameters'][
'associated_products_display_mode']),
true,
$product_object->id, $nb_colonnes, !empty(
$GLOBALS[
'site_parameters'][
'no_display_if_empty']),
false));
445 $tpl->assign(
'javascript', null);
453 if (!function_exists(
'get_products_list_brief_html')) {
461 function get_products_list_brief_html(
$catid, $display_subcategories =
true, $type =
'category')
463 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'products_list_brief.tpl');
464 $sqlcat =
"SELECT technical_code, image_" .
$_SESSION[
'session_langue'] .
" AS image, description_" .
$_SESSION[
'session_langue'] .
", nom_" .
$_SESSION[
'session_langue'] .
", meta_titre_" .
$_SESSION[
'session_langue'] .
" AS meta_titre, type_affichage, etat";
466 $sqlcat .=
", promotion_devises, promotion_percent";
468 $sqlcat .=
" FROM peel_categories
471 $rescat =
query($sqlcat);
474 if (empty(
$GLOBALS[
'site_parameters'][
'get_straight_category_page_title'])) {
476 foreach(explode(
' ', $cat_infos[
'meta_titre']) as $this_word) {
481 $page_h1 .=
' ' . $this_word;
488 if (
a_priv(
'admin_products',
false)) {
489 $cat[
'admin'] = array(
490 'href' =>
$GLOBALS[
'administrer_url'] .
'/categories.php?mode=modif&id=' .
$catid,
491 'label' =>
$GLOBALS[
'STR_MODIFY_CATEGORY']
494 if (($cat_infos[
'etat'] == 0 &&
a_priv(
'admin_products',
false))) {
495 $cat[
'offline'] =
$GLOBALS[
'STR_OFFLINE_CATEGORY'];
497 if (!empty($cat_infos[
'image'])) {
498 $this_thumb =
thumbs($cat_infos[
'image'],
$GLOBALS[
'site_parameters'][
'small_width'],
$GLOBALS[
'site_parameters'][
'small_height'],
'fit');
499 if(!empty($this_thumb)) {
500 $cat[
'image'] = array(
501 'src' =>
$GLOBALS[
'repertoire_upload'] .
'/thumbs/' . $this_thumb,
506 $cat[
'description'] = $cat_infos[
'description_' .
$_SESSION[
'session_langue']];
507 if (
check_if_module_active(
'category_promotion') && (
vn($cat_infos[
'promotion_devises']) > 0 ||
vn($cat_infos[
'promotion_percent']) > 0)) {
508 $cat[
'promotion'] = array(
509 'label' =>
$GLOBALS[
'STR_REDUCTION_ON_ALL_PRODUCTS_FROM_CATEGORIE'],
510 'discount_text' =>
get_discount_text($cat_infos[
'promotion_devises'], $cat_infos[
'promotion_percent'],
true)
513 $tpl->assign(
'cat', $cat);
516 if (!empty($cat_infos[
'type_affichage']) && $cat_infos[
'type_affichage'] ==
"1") {
517 $products_display_mode =
'line';
520 $products_display_mode =
vb(
$GLOBALS[
'site_parameters'][
'global_products_display_mode'],
'column');
521 $nb_colonnes =
$GLOBALS[
'site_parameters'][
'product_category_pages_nb_column'];
523 if ($cat_infos[
'technical_code'] ==
'show_draft' &&
est_identifie()) {
525 $type =
'show_draft';
527 if (!empty($display_subcategories)) {
529 $subcategories_table = get_subcategories_table(
$catid,
$GLOBALS[
'site_parameters'][
'subcategorie_nb_column'],
true);
530 if (!empty($subcategories_table)) {
531 $tpl->assign(
'subcategories', $subcategories_table);
535 if (!empty(
$GLOBALS[
'site_parameters'][
'display_main_categories_on_subcategory_pages'])) {
536 $tpl->assign(
'main_categories', get_categories_output(null,
'categories', null,
'html',
' ', null, null,
false, 25, null, 0,
$catid));
538 if(empty($subcategories_table) && empty($cat[
'description'])) {
542 $additional_sql_cond =
'';
543 $tpl->assign(
'associated_products', affiche_produits(
$catid, 2, $type,
vn(
$GLOBALS[
'site_parameters'][
'nb_produit_page']), $products_display_mode,
true, null, $nb_colonnes, !empty(
$GLOBALS[
'site_parameters'][
'no_display_if_empty']),
vn(
$GLOBALS[
'site_parameters'][
'always_show_multipage_footer']), null, $additional_sql_cond));
544 return $tpl->fetch();
548 if (!function_exists(
'affiche_prix')) {
567 function affiche_prix(&
$product_object, $with_taxes =
true, $reseller_mode =
false, $return_mode =
false, $display_with_measurement =
false, $item_id = null, $display_ecotax =
true, $display_old_price =
true, $table_css_class =
'full_width', $display_old_price_inline =
true, $force_display_with_vat_symbol =
true, $add_rdfa_properties =
false, $display_minimal_price = null)
573 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'prix.tpl');
575 if($display_minimal_price === null) {
576 $display_minimal_price =
vb(
$GLOBALS[
'site_parameters'][
'product_display_minimal_price'],
false);
578 $tpl->assign(
'table_css_class', $table_css_class);
580 $tpl->assign(
'item_id', $item_id);
581 $tpl->assign(
'display_old_price_inline', $display_old_price_inline);
583 $display_with_vat_symbol =
true;
585 $display_with_vat_symbol =
false;
588 if (!empty($display_minimal_price)) {
594 $tpl->assign(
'original_price',
$product_object->get_original_price($with_taxes, $reseller_mode,
true));
596 $tpl->assign(
'original_price', null);
599 $tpl->assign(
'ecotax', array(
604 $tpl->assign(
'ecotax', null);
607 $tpl->assign(
'measurement', array(
608 'label' => $GLOBALS[
'STR_PRICE_WEIGHT'],
612 $tpl->assign(
'measurement', array(
613 'label' => $GLOBALS[
'STR_PRICE_LITRE'],
617 $tpl->assign(
'measurement', null);
619 $tpl->assign(
'hide_price', !empty($GLOBALS[
'site_parameters'][
'price_hide_if_not_loggued']) && !
est_identifie());
620 $tpl->assign(
'STR_PLEASE_LOGIN', $GLOBALS[
'STR_PLEASE_LOGIN']);
631 if (!function_exists(
'display_on_estimate_information')) {
639 function display_on_estimate_information($return_mode =
false, $return_without_div =
false)
642 if(!isset($GLOBALS[
'site_parameters'][
'show_on_estimate_text']) || $GLOBALS[
'site_parameters'][
'show_on_estimate_text']) {
643 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'on_estimate_information.tpl');
644 $tpl->assign(
'without_div', $return_without_div);
645 $tpl->assign(
'label', $GLOBALS[
'STR_ON_ESTIMATE']);
656 if (!function_exists(
'affiche_produits')) {
675 function affiche_produits($condition_value1, $title_level = 2, $type, $nb_par_page,
$mode =
'general', $return_mode =
false, $reference_id = 0, $nb_colonnes = null, $no_display_if_empty =
false, $always_show_multipage_footer =
true, $additional_sql_inner = null, $additional_sql_cond = null, $additionnal_sql_having = null, $description_length = null, $template_additional_variables = null, $use_index_sql = null)
677 if(
$mode ==
'line') {
679 }
elseif(empty($nb_colonnes)) {
680 $nb_colonnes =
vn($GLOBALS[
'site_parameters'][
'product_category_pages_nb_column'], 3);
682 $params =
params_affiche_produits($condition_value1, null, $type, $nb_par_page,
$mode, $reference_id, $nb_colonnes, $always_show_multipage_footer, $additional_sql_inner, $additional_sql_cond, $additionnal_sql_having, $use_index_sql);
683 if (empty($description_length)) {
685 if (!empty($GLOBALS[
'site_parameters'][
'catalog_product_description_length'])) {
686 $description_length = $GLOBALS[
'site_parameters'][
'catalog_product_description_length'];
689 $description_length = 250;
694 $GLOBALS[
'products_found'] = $params[
'Links']->nbRecord;
696 if (!empty($GLOBALS[
'site_parameters'][
'products_list_no_display_if_empty'])) {
698 $no_display_if_empty =
true;
701 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'produits.tpl');
702 $tpl->assign(
'is_associated_product', ((!$no_display_if_empty || !empty(
$results_array)) AND $type ==
'associated_product'));
704 $tpl->assign(
'titre', $params[
'titre']);
705 if (!empty($params[
'titre']) && $type ==
'associated_product') {
706 $tpl->assign(
'titre_mode',
'associated');
707 }
elseif ($params[
'mode'] ==
'home') {
708 $tpl->assign(
'titre_mode',
'home');
709 }
elseif ($type ==
'category') {
710 $tpl->assign(
'titre_mode',
'category');
711 $tpl->assign(
'filtre', $params[
'affiche_filtre']);
712 }
elseif (!empty($params[
'titre'])) {
713 $tpl->assign(
'titre_mode',
'default');
716 $tpl->assign(
'title_level', $title_level);
717 $tpl->assign(
'products_found', $GLOBALS[
'products_found']);
720 $tpl->assign(
'no_results',
true);
721 if (!$no_display_if_empty) {
722 if ($params[
'mode'] ==
'line' || $params[
'mode'] ==
'column') {
723 $tpl->assign(
'no_results_msg', $GLOBALS[
'STR_NO_INDEX_PRODUCT']);
724 }
elseif ($params[
'mode'] ==
'general') {
725 $tpl->assign(
'no_results_msg', $GLOBALS[
'STR_NOT_AVAILABLE_CURRENTLY']);
729 $allow_order =
false;
730 $tpl->assign(
'no_results',
false);
731 if (
vn($GLOBALS[
'site_parameters'][
'category_order_on_catalog']) ==
'1' || $type ==
'save_cart') {
732 $details_text = $GLOBALS[
'STR_MORE_DETAILS'];
734 }
elseif (
vb($GLOBALS[
'site_parameters'][
'category_show_more_on_catalog_if_no_order_allowed'])) {
735 $details_text = $GLOBALS[
'STR_MORE'];
737 $tpl->assign(
'details_text',
vb($details_text));
738 $tpl->assign(
'allow_order', $allow_order);
741 $tpl->assign(
'prods_line_mode', ($params[
'mode'] ==
'line'));
742 $tpl->assign(
'cartridge_product_css_class', $params[
'cartridge_product_css_class']);
743 $tpl->assign(
'small_width', $params[
'small_width']);
744 $tpl->assign(
'small_height', $params[
'small_height']);
745 $tpl->assign(
'multipage', $params[
'Links']->GetMultipage());
751 if ((!
a_priv(
"admin_product") && !
a_priv(
"reve")) && $prod[
'on_reseller'] == 1) {
756 $tmpProd[
'display_border'] = (($j % $params[
'nb_colonnes'] != $params[
'nb_colonnes'] - 1) && ($j != count(
$results_array) - 1));
760 $tmpProd[
'i'] = $j + 1;
766 if ($type ==
'save_cart') {
767 $tmpProd[
'save_cart'] = array(
768 'src' => get_url(
'/' . $GLOBALS[
'site_parameters'][
'backoffice_directory_name'] .
'/images/b_drop.png'),
769 'href' =>
get_current_url(
false) .
'?mode=delete&id=' . $prod[
'save_cart_id'],
770 'confirm_msg' => $GLOBALS[
'STR_DELETE_CART_PRESERVATION'],
771 'title' => $GLOBALS[
'STR_DELETE_CART_TITLE'],
772 'label' => $GLOBALS[
'STR_DELETE']
779 if (
$mode ==
'line' || empty($GLOBALS[
'site_parameters'][
'disable_description_in_products_columns'])) {
782 if (!empty($_GET[
'cId']) && !empty($_GET[
'pId']) && $_GET[
'pId'] == $prod[
'id']) {
784 $display_picture =
$product_object->get_product_pictures(
false, $_GET[
'cId'],
true);
785 $display_picture = $display_picture[0];
789 if (!empty($display_picture)) {
791 $tmpProd[
'image'] = array(
792 'src' => $GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs(
'logoPDF_small.png', $params[
'small_width'], $params[
'small_height'],
'fit', $GLOBALS[
'dirroot'] .
'/images/'),
793 'width' => $GLOBALS[
'site_parameters'][
'small_width'],
794 'height' => $GLOBALS[
'site_parameters'][
'small_height'],
797 'href' => $GLOBALS[
'repertoire_upload'] .
'/' . $display_picture,
798 'is_lightbox' =>
false,
800 'label' => $GLOBALS[
'STR_ZOOM']
804 $tmpProd[
'image'] = array(
805 'src' => $GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($display_picture, $params[
'small_width'], $params[
'small_height'],
'fit'),
810 'href' => $GLOBALS[
'repertoire_upload'] .
'/' . $display_picture,
811 'is_lightbox' => empty($GLOBALS[
'site_parameters'][
'lightbox_disable']),
812 'label' => $GLOBALS[
'STR_ZOOM']
816 }
elseif(!empty($GLOBALS[
'site_parameters'][
'default_picture'])) {
817 $tmpProd[
'image'] = array(
818 'src' => $GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($GLOBALS[
'site_parameters'][
'default_picture'], $params[
'small_width'], $params[
'small_height'],
'fit'),
821 'alt' => $GLOBALS[
'STR_PHOTO_NOT_AVAILABLE_ALT']
824 $tmpProd[
'image'] = null;
830 $tmpProd[
'subscribe_trip_form'] = get_subscribe_trip_form(
$product_object->id,
vn(
$_SESSION[
'session_utilisateur'][
'id_utilisateur']));
834 $tmpProd[
'on_estimate'] = display_on_estimate_information(
true);
836 $tmpProd[
'on_estimate'] =
$product_object->on_gift_points .
' ' . $GLOBALS[
'STR_GIFT_POINTS'];
838 if ((
vn($GLOBALS[
'site_parameters'][
'category_order_on_catalog']) != 1) && ($type !=
'save_cart') && empty($GLOBALS[
'site_parameters'][
'disable_add_to_cart_section_for_products'])) {
839 $tmpProd[
'on_estimate'] =
$product_object->affiche_prix(
display_prices_with_taxes_active(),
check_if_module_active(
'reseller') && is_reseller(),
true,
false, null,
false,
true,
'full_width', ($params[
'mode'] !=
'line'),
false, null);
842 $tmpProd[
'on_estimate'] =
'<span class="title_price_free">'.$GLOBALS[
'STR_FREE'].
'</span>';
847 if (
vn($GLOBALS[
'site_parameters'][
'category_order_on_catalog']) ==
'1' || $type ==
'save_cart') {
849 $tmpProd[
'check_critere_stock'] = affiche_check(
$product_object->id,
'cheque', null,
true);
851 if ($type ==
'save_cart') {
852 $tmpProd[
'check_critere_stock'] = affiche_critere_stock(
$product_object,
'save_cart_details_', null,
true,
true,
vn($prod[
'save_cart_id']),
vn($prod[
'saved_couleur_id']),
vn($prod[
'saved_taille_id']),
vn($prod[
'saved_attributs_list']),
vn($prod[
'saved_quantity']));
853 }
elseif ($type ==
'search') {
854 $tmpProd[
'check_critere_stock'] = affiche_critere_stock(
$product_object,
'catalogue_details_', null,
true);
856 $tmpProd[
'check_critere_stock'] = affiche_critere_stock(
$product_object,
'catalogue_details_', null,
true,
true);
860 if (empty($GLOBALS[
'site_parameters'][
'admin_product_edit_links_in_front_office_disable']) &&
a_priv(
'admin_products',
false)) {
861 $tmpProd[
'admin'] = array(
862 'href' => $GLOBALS[
'administrer_url'] .
'/produits.php?mode=modif&id=' .
$product_object->id,
863 'label' => $GLOBALS[
'STR_MODIFY_PRODUCT']
866 $tmpProd[
'last_month'] = ($prod[
'date_insere'] > date(
"Y-m-d", time() - 30 * 24 * 3600));
867 if (
est_identifie() && !empty($GLOBALS[
'site_parameters'][
'enable_create_product_in_front']) &&
$product_object->id_utilisateur ==
$_SESSION[
'session_utilisateur'][
'id_utilisateur']) {
869 $sql =
"SELECT p.id, p.titre_" .
$_SESSION[
'session_langue'] .
" AS titre, p.on_special, pc.rubrique_id, r.nom_" .
$_SESSION[
'session_langue'] .
" AS rubrique_nom
871 INNER JOIN peel_articles_rubriques pc ON p.id = pc.article_id " . (!empty($category_id)?
" AND pc.rubrique_id = '" . intval($category_id) .
"'":
'') .
"
872 INNER JOIN peel_rubriques r ON r.id = pc.rubrique_id AND " .
get_filter_site_cond(
'rubriques',
'r') .
"
873 WHERE p.technical_code = 'display_product_form' AND p.etat='1' AND titre_" .
$_SESSION[
'session_langue'] .
"!='' AND " .
get_filter_site_cond(
'articles',
'p') .
"";
876 $tmpProd[
'modify_product_by_owner'] = array(
878 'label' => $GLOBALS[
'STR_MODIFY_PRODUCT']
886 $tpl->assign(
'products', $prods);
887 $tpl->assign(
'nb_col_sm', min($params[
'nb_colonnes'],3));
888 $tpl->assign(
'nb_col_md', $params[
'nb_colonnes']);
889 $tpl->assign(
'vars', $template_additional_variables);
891 $tpl->assign(
'STR_BEFORE_TWO_POINTS', $GLOBALS[
'STR_BEFORE_TWO_POINTS']);
898 if ($type ==
'associated_product' && $j == 0) {
910 if (!function_exists(
'affiche_critere_stock')) {
923 function affiche_critere_stock(&
$product_object, $form_basename, $listcadeaux_owner = null, $return_mode =
false, $is_in_catalog =
false, $save_cart_id = null, $saved_color_id = null, $saved_size_id = null, $saved_attributs_list = null, $saved_quantity = null)
927 if (!empty($save_cart_id)) {
928 $save_suffix_id =
'_' . $save_cart_id;
929 }
elseif ($is_in_catalog) {
932 $save_suffix_id =
'';
934 $form_id = $form_basename .
'ajout' .
$product_object->id . $save_suffix_id;
935 if ($GLOBALS[
'site_parameters'][
'anim_prod'] == 1) {
936 $anim_prod_var =
' addToBasket(' .
$product_object->id .
'); setTimeout(\'document.getElementById(\\\'' . $form_id .
'\\\').submit()\',1000); return false;';
941 $condensed_display_mode =
false;
942 $selected_color_id = 0;
947 $and_scId_if_needed = empty($save_cart_id) || (!empty($save_cart_id) && !empty($_GET[
'scId']) && $save_cart_id ==
vn($_GET[
'scId']));
948 if ($and_scId_if_needed && ((!empty($_GET[
'cId']) && !$is_in_catalog) || ($is_in_catalog && !empty($_GET[
'cId']) && !empty($_GET[
'pId']) &&
vn($_GET[
'pId']) ==
$product_object->id))) {
949 $selected_color_id = intval($_GET[
'cId']);
954 }
elseif($saved_color_id) {
956 $selected_color_id = $saved_color_id;
959 $selected_color_id = 0;
966 $stock_remain_all = 0;
967 if (!empty($product_stock_infos)) {
968 foreach ($product_stock_infos as $stock_infos) {
969 if (($is_in_catalog && empty(
$product_object->configuration_color_id)) || (!empty(
$product_object->configuration_color_id) && $stock_infos[
'couleur_id'] ==
$product_object->configuration_color_id) || (empty($_GET[
'cId']) && empty($_GET[
'tId'])) || (!empty($stock_infos[
'couleur_id']) && !empty($_GET[
'cId']) && $_GET[
'cId'] == $stock_infos[
'couleur_id']) || (!empty($stock_infos[
'taille_id']) && !empty($_GET[
'tId']) && $_GET[
'tId'] == $stock_infos[
'taille_id'])) {
970 $stock_remain_all += $stock_infos[
'stock_temp'];
974 if (empty($stock_remain_all) && empty($GLOBALS[
'site_parameters'][
'allow_add_product_with_no_stock_in_cart'])) {
979 $urlprod_with_cid =
$product_object->get_product_url(
true,
true) .
'cId=';
982 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'critere_stock.tpl');
984 if (!empty($GLOBALS[
'site_parameters'][
'remove_product_after_adding_to_cart'])) {
986 $tpl->assign(
'save_cart_id', $save_cart_id);
988 $tpl->assign(
'save_suffix_id', $save_suffix_id);
989 $tpl->assign(
'urlprod_with_cid', $urlprod_with_cid);
990 $tpl->assign(
'STR_BEFORE_TWO_POINTS', str_replace(
' ',
' ', $GLOBALS[
'STR_BEFORE_TWO_POINTS']));
991 $tpl->assign(
'STR_COLOR', $GLOBALS[
'STR_COLOR']);
992 $tpl->assign(
'STR_CHOOSE_COLOR', $GLOBALS[
'STR_CHOOSE_COLOR']);
993 $tpl->assign(
'STR_NO_AVAILABLE', $GLOBALS[
'STR_NO_AVAILABLE']);
994 $tpl->assign(
'STR_SIZE', $GLOBALS[
'STR_SIZE']);
995 $tpl->assign(
'STR_CHOOSE_SIZE', $GLOBALS[
'STR_CHOOSE_SIZE']);
996 $tpl->assign(
'STR_STOCK_ATTRIBUTS', $GLOBALS[
'STR_STOCK_ATTRIBUTS']);
1008 $update_class = (!empty($attributs_infos_array) ?
'special_select' :
'');
1010 $tpl->assign(
'is_form',
true);
1011 $tpl->assign(
'action', $GLOBALS[
'wwwroot'] .
'/achat/caddie_ajout.php?prodid=' .
$product_object->id);
1012 $tpl->assign(
'form_id', $form_id);
1013 $tpl->assign(
'update_class', $update_class);
1014 $tpl->assign(
'condensed_display_mode', $condensed_display_mode);
1015 if (!$condensed_display_mode) {
1017 if (!empty($colors_array)) {
1018 $tpl->assign(
'is_color',
true);
1019 $id_select_color =
'couleur' . $save_suffix_id;
1020 if (!empty($save_cart_id)) {
1021 $scId_if_needed =
'+\'&scId=' . $save_cart_id .
'#save_cart_' . $save_cart_id .
'\'';
1023 $scId_if_needed =
'';
1025 if (!$is_in_catalog && !empty($urlprod_with_cid)) {
1026 $on_change_action =
'document.location=\'' . $urlprod_with_cid .
'\'+getElementById(\
'' . $id_select_color .
'\').value
' . $scId_if_needed . ';
';
1027 } elseif ($is_in_catalog && !defined('IN_SEARCH_BRAND') && !empty($urlcat_with_cid) && check_if_module_active('stock_advanced
') && ($product_object->on_stock == 1)) {
1028 // Ajout de redirection pour recharger la page après sélection d'un attribut
1029 $on_change_action =
'document.location=\'' . $urlcat_with_cid .
'\'+getElementById(\
'' . $id_select_color .
'\').value
' . $scId_if_needed . ';
';
1031 $on_change_action = '';
1033 $tpl->assign('id_select_color
', $id_select_color);
1034 $tpl->assign('color_on_change_action
', $on_change_action);
1035 $tplColors = array();
1036 foreach ($colors_array as $this_color_id => $this_color_name) {
1037 $isavailable = true;
1038 if (check_if_module_active('stock_advanced
') && $product_object->on_stock == 1 && empty($GLOBALS['site_parameters
']['allow_add_product_with_no_stock_in_cart
'])) {
1039 // Par défaut on considère que le produit n'est pas disponible dans la configuration de stock étudiée
1041 $isavailable =
false;
1042 foreach ($product_stock_infos as $this_stock_info) {
1043 if ($this_stock_info[
'couleur_id'] == $this_color_id && $this_stock_info[
'stock_temp'] > 0) {
1044 $isavailable =
true;
1048 $tplColors[] = array(
1049 'id' => $this_color_id,
1050 'issel' => ($selected_color_id == $this_color_id),
1051 'isavailable' => $isavailable,
1052 'name' => $this_color_name,
1056 $tpl->assign(
'colors', $tplColors);
1058 $tpl->assign(
'is_color',
false);
1059 $selected_color_id = 0;
1061 if (!empty($sizes_infos_array) && count($sizes_infos_array)>=1) {
1062 $tpl->assign(
'is_sizes',
true);
1065 $id_select_size =
'taille' . $save_suffix_id;
1066 $tpl->assign(
'id_select_size', $id_select_size);
1068 $tplSizes = array();
1069 foreach ($sizes_infos_array as $this_size_infos) {
1071 $update_product_price_needed =
false;
1072 $isavailable =
true;
1073 $option_content =
'';
1074 if (!empty(
$_SESSION[
'session_taille_id']) && !defined(
'IN_CART_PRESERVATION')) {
1075 if ($this_size_infos[
'id'] ==
$_SESSION[
'session_taille_id']) {
1079 }
elseif (!empty($_GET[
'sId'])) {
1080 if ($this_size_infos[
'id'] == $_GET[
'sId']) {
1084 if ($this_size_infos[
'id'] ==
$product_object->configuration_size_id) {
1090 $update_product_price_needed =
true;
1093 if (!empty($this_size_infos[
'row_final_price']) && $this_size_infos[
'row_final_price'] > 0 && (empty($GLOBALS[
'site_parameters'][
'disable_display_size_overcost']))) {
1094 $option_content .= $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': +' .
fprix($this_size_infos[
'final_price_formatted'],
true);
1095 }
elseif (!empty($this_size_infos[
'row_final_price']) && $this_size_infos[
'row_final_price'] < 0 && (empty($GLOBALS[
'site_parameters'][
'disable_display_size_overcost']))) {
1096 $option_content .= $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': ' .
fprix($this_size_infos[
'final_price_formatted'],
true);
1099 $found_stock_info = 0;
1101 foreach ($product_stock_infos as $this_stock_info) {
1103 if (($this_stock_info[
'couleur_id'] == $selected_color_id || empty($selected_color_id)) && $this_stock_info[
'taille_id'] == $this_size_infos[
'id']) {
1104 $found_stock_info += $this_stock_info[
'stock_temp'];
1107 if ($found_stock_info > 0 || !empty($GLOBALS[
'site_parameters'][
'allow_add_product_with_no_stock_in_cart'])) {
1108 if (
$product_object->affiche_stock == 1 && empty($GLOBALS[
'site_parameters'][
'allow_add_product_with_no_stock_in_cart'])) {
1109 $option_content .=
' - ' . $GLOBALS[
'STR_STOCK_ATTRIBUTS'] . $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': ' . $found_stock_info;
1113 $isavailable =
false;
1114 $option_content .=
' - ' . $GLOBALS[
'STR_NO_AVAILABLE'];
1117 $tplSizes[] = array(
1118 'id' => $this_size_infos[
'id'],
1119 'issel' => $selected,
1120 'isavailable' => $isavailable,
1121 'name' => $this_size_infos[
'nom_' .
$_SESSION[
'session_langue']],
1122 'suffix' => $option_content,
1123 'update_product_price_needed' => $update_product_price_needed
1127 $tpl->assign(
'sizes_options', $tplSizes);
1129 $tpl->assign(
'is_sizes',
false);
1132 $tplStocks = array();
1134 foreach ($product_stock_infos as $stock_infos) {
1135 if ($stock_infos[
'stock_temp'] > 0 || !empty($GLOBALS[
'site_parameters'][
'allow_add_product_with_no_stock_in_cart'])) {
1136 $tmpStockLabel =
'';
1137 if (!empty($stock_infos[
'couleur_nom'])) {
1138 $tmpStockLabel .= $GLOBALS[
'STR_COLOR'] . $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': ' . $stock_infos[
'couleur_nom'];
1140 if (!empty($stock_infos[
'taille_nom'])) {
1141 $tmpStockLabel .=
' - ' . $GLOBALS[
'STR_SIZE'] . $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': ' . $stock_infos[
'taille_nom'];
1143 if (!empty($stock_infos[
'taille_id']) && !empty($sizes_infos_array[$stock_infos[
'taille_id']][
'row_final_price'])) {
1144 $tmpStockLabel .=
' +' . $sizes_infos_array[$stock_infos[
'taille_id']][
'final_price_formatted'];
1147 $tmpStockLabel .=
' - ' . $GLOBALS[
'STR_STOCK_ATTRIBUTS'] . $GLOBALS[
'STR_BEFORE_TWO_POINTS'] .
': ' . $stock_infos[
'stock_temp'];
1150 $tplStocks[] = array(
1151 'isavailable' =>
true,
1152 'value' => $stock_infos[
'couleur_id'] .
'|' . $stock_infos[
'taille_id'],
1153 'issel' => (
vb($_GET[
'liste']) == $stock_infos[
'couleur_id'] .
'|' . $stock_infos[
'taille_id']),
1154 'label' => $tmpStockLabel
1158 $tplStocks[] = array(
1159 'isavailable' =>
false,
1160 'couleur_nom' => $stock_infos[
'couleur_nom'],
1161 'taille_nom' => $stock_infos[
'taille_nom'],
1166 $tpl->assign(
'stock_options', $tplStocks);
1169 $tpl->assign(
'is_form',
false);
1171 $tpl->assign(
'STR_DELIVERY_STOCK', $GLOBALS[
'STR_DELIVERY_STOCK']);
1172 $tpl->assign(
'STR_QUANTITY', $GLOBALS[
'STR_QUANTITY']);
1173 $tpl->assign(
'STR_NONE_COLOR_SELECTED', $GLOBALS[
'STR_NONE_COLOR_SELECTED']);
1174 $tpl->assign(
'STR_NONE_SIZE_SELECTED', $GLOBALS[
'STR_NONE_SIZE_SELECTED']);
1175 $tpl->assign(
'STR_ADD_CART', $GLOBALS[
'STR_ADD_CART']);
1181 $tpl->assign(
'affiche_attributs_form_part', $attributs_form_part);
1182 if(!empty($attributs_form_part)) {
1183 $update_product_price_needed =
true;
1187 $stock_remain_all = 0;
1188 foreach ($product_stock_infos as $stock_infos) {
1189 if (empty($selected_color_id) || (!empty($selected_color_id) && ($selected_color_id == $stock_infos[
'couleur_id']))){
1190 $stock_remain_all += $stock_infos[
'stock_temp'];
1193 $tpl->assign(
'affiche_etat_stock', affiche_etat_stock($stock_remain_all,
false,
true));
1194 if (!empty($stock_remain_all)) {
1195 if (
$product_object->affiche_stock == 1 && !empty($product_stock_infos)) {
1196 $tpl->assign(
'stock_remain_all', $stock_remain_all);
1198 }
elseif(empty($GLOBALS[
'site_parameters'][
'allow_add_product_with_no_stock_in_cart'])) {
1203 $tpl->assign(
'display_javascript_for_price_update', display_javascript_for_price_update(
$product_object, $save_suffix_id, $form_id, 0, !empty($update_product_price_needed)));
1214 $tpl->assign(
'product_affiche_prix', display_on_estimate_information(
true));
1216 $tpl->assign(
'product_affiche_prix',
$product_object->on_gift_points .
' ' . $GLOBALS[
'STR_GIFT_POINTS']);
1218 $display_old_price_inline = (
vn($GLOBALS[
'site_parameters'][
'category_order_on_catalog']) ==
'1') ?
false :
true;
1219 $tpl->assign(
'product_affiche_prix',
$product_object->affiche_prix(
display_prices_with_taxes_active(),
check_if_module_active(
'reseller') && is_reseller(),
true,
true,
'prix_' .
$product_object->id . $save_suffix_id,
true,
true,
'full_width', $display_old_price_inline,
true, null));
1228 $tpl->assign(
'etat_stock', affiche_etat_stock($stock_remain_all,
false,
true));
1233 $q_owner = getNessQuantityFromGiftList(
$product_object->id, $selected_color_id, $saved_size_id, $listcadeaux_owner);
1236 $q_owner =
vn($GLOBALS[
'site_parameters'][
'product_default_quantity'], 1);
1239 $tpl->assign(
'on_estimate',
false);
1241 $tpl->assign(
'qte_hidden',
false);
1242 $tpl->assign(
'qte_value', (!empty($saved_quantity) ? intval($saved_quantity) :
vn($q_owner)));
1244 $tpl->assign(
'qte_hidden',
true);
1245 if (!empty($saved_quantity)) {
1246 $tpl->assign(
'qte_value', intval($saved_quantity));
1249 $tpl->assign(
'qte_value',
vn($GLOBALS[
'site_parameters'][
'product_default_quantity'], 1));
1253 $tpl->assign(
'giftlist', array(
1254 'listcadeaux_owner' =>
vn($listcadeaux_owner),
1256 'form' => get_add_giftlist_form(
$product_object->id, $form_basename,
true)
1259 if (!empty($colors_array)) {
1260 $color_array_result = 1;
1262 $color_array_result = 0;
1264 if (!empty($sizes_infos_array)) {
1265 $sizes_infos_array_result = 1;
1267 $sizes_infos_array_result = 0;
1269 $tpl->assign(
'color_array_result', $color_array_result);
1270 $tpl->assign(
'sizes_infos_array_result', $sizes_infos_array_result);
1271 $tpl->assign(
'anim_prod_var', $anim_prod_var);
1273 $tpl->assign(
'on_estimate',
true);
1277 return $tpl->fetch();
1284 if (!function_exists(
'get_subcategories_table')) {
1294 function get_subcategories_table($parent_id, $nb_colonnes, $return_mode =
false, $display_image =
true)
1297 $qid_c =
query(
'SELECT id, nom_' .
$_SESSION[
'session_langue'] .
', description_' .
$_SESSION[
'session_langue'] .
', parent_id, image_' .
$_SESSION[
'session_langue'] .
' AS image
1298 FROM peel_categories
1299 WHERE parent_id="' . intval($parent_id) .
'" AND id>"0" AND etat="1" AND ' .
get_filter_site_cond(
'categories') .
'
1300 ORDER BY position' . (!empty($GLOBALS[
'site_parameters'][
'category_primary_order_by'])?
", " . $GLOBALS[
'site_parameters'][
'category_primary_order_by'] :
'') .
'');
1302 if (!empty($nb_cellules)) {
1303 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'subcategories_table.tpl');
1308 $tmpCat[
'href'] = get_product_category_url($cat[
'id'], $cat[
'nom_' .
$_SESSION[
'session_langue']]);
1309 $tmpCat[
'name'] = $cat[
'nom_' .
$_SESSION[
'session_langue']];
1310 $tmpCat[
'i'] = $j + 1;
1312 if (!empty($cat[
'image']) && $display_image) {
1313 $tmpCat[
'src'] = $GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($cat[
'image'],
vn($GLOBALS[
'site_parameters'][
'small_width']),
vn($GLOBALS[
'site_parameters'][
'small_height']),
"fit");
1315 $tpl->assign(
'nb_col_md', $nb_colonnes);
1316 $tpl->assign(
'nb_col_sm', $nb_colonnes-1);
1321 $tpl->assign(
'cats', $cats);
1332 if (!function_exists(
'affiche_categorie_accueil')) {
1341 function affiche_categorie_accueil($return_mode =
false, $nb_col_md = 4, $nb_col_sm = 3)
1344 $qid =
query(
'SELECT c.id, c.nom_' .
$_SESSION[
'session_langue'] .
' AS categorie, c.image_' .
$_SESSION[
'session_langue'] .
' AS image
1345 FROM peel_categories c
1346 WHERE c.etat = "1" AND c.on_special = "1" AND c.nom_' .
$_SESSION[
'session_langue'] .
'!="" AND ' .
get_filter_site_cond(
'categories',
'c') .
'
1347 ORDER BY c.position');
1349 if (!empty($nb_cellules)) {
1350 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'categorie_accueil.tpl');
1351 $tpl->assign(
'header', $GLOBALS[
'STR_CATALOG']);
1357 $tmpCat[
'href'] = get_product_category_url($cat[
'id'], $cat[
'categorie']);
1358 $tmpCat[
'name'] = $cat[
'categorie'];
1359 if (!empty($cat[
'image'])) {
1360 $tmpCat[
'src'] = $GLOBALS[
'repertoire_upload'] .
'/thumbs/' .
thumbs($cat[
'image'], $GLOBALS[
'site_parameters'][
'small_width'], $GLOBALS[
'site_parameters'][
'small_height'],
'fit');
1366 $tpl->assign(
'nb_col_md', $nb_col_md);
1367 $tpl->assign(
'nb_col_sm', $nb_col_sm);
1368 $tpl->assign(
'cats', $cats);
1379 if (!function_exists(
'affiche_arbre_categorie')) {
1391 function affiche_arbre_categorie(
$catid = 0, $additional_text = null, $id_produit = null, $categories_treated = array(), $hidden =
false)
1393 if (!empty($id_produit)) {
1400 if(empty($categories_treated[
$catid])) {
1403 $qid =
query(
'SELECT parent_id, nom_' .
$_SESSION[
'session_langue'] .
' AS nom
1404 FROM peel_categories
1405 WHERE id = "' . intval($catid) .
'" AND etat = "1" AND ' .
get_filter_site_cond(
'categories') .
'');
1407 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'arbre_categorie.tpl');
1408 $tpl->assign(
'href', get_product_category_url($catid,
$result[
'nom']));
1410 $tpl->assign(
'hidden', $hidden);
1411 $nom =
$tpl->fetch();
1412 $parent =
$result[
'parent_id'];
1414 $categories_treated[
$catid] =
true;
1417 return affiche_arbre_categorie($parent,
' > ' . $nom .
' ' . $additional_text, null, $categories_treated, $hidden) . (!empty($product_name) && !$hidden ?
' > ' . $product_name :
'');
1419 return $nom .
' ' . $additional_text . (!empty($product_name) && !$hidden ?
' > ' . $product_name :
'');
1424 if (!function_exists(
'affiche_select_categorie')) {
1430 function affiche_select_categorie()
1432 $frm[
'categories_select'] = array();
1433 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'select_categorie.tpl');
1434 $tpl->assign(
'search_label', $GLOBALS[
'STR_SEARCH_CATEGORY']);
1435 $tpl->assign(
'cats', get_categories_output(null,
'categories',
vb(
$frm[
'categories_select']),
'option',
' ', null));
1440 if (!function_exists(
'get_product_in_container_html')) {
1448 function get_product_in_container_html(&
$product_object, $only_show_products_with_picture =
true, $display_minimal_price = null)
1452 if($display_minimal_price === null) {
1453 $display_minimal_price =
vb($GLOBALS[
'site_parameters'][
'product_display_minimal_price'],
false);
1458 if (!$only_show_products_with_picture || !empty($display_picture)) {
1460 $tpl = $GLOBALS[
'tplEngine']->createTemplate(
'product_in_container_html.tpl');
1466 $tpl->assign(
'user', array(
'pseudo'=>$user_info[
'pseudo']));
1468 $tpl->assign(
'user', null);
1470 $tpl->assign(
'href', $urlprod);
1472 if (!empty($display_picture)) {
1473 $this_picture =
thumbs($display_picture, $GLOBALS[
'site_parameters'][
'small_width'], $GLOBALS[
'site_parameters'][
'small_height'],
"fit");
1474 if($only_show_products_with_picture && empty($this_picture)) {
1477 $tpl->assign(
'src', $GLOBALS[
'repertoire_upload'] .
'/thumbs/' . $this_picture);
1479 $tpl->assign(
'src', null);
1481 $tpl->assign(
'more_detail_label', $GLOBALS[
'STR_MORE_DETAILS']);
1483 $tpl->assign(
'on_estimate', display_on_estimate_information(
true));
1485 $tpl->assign(
'on_estimate',
$product_object->on_gift_points .
' ' . $GLOBALS[
'STR_GIFT_POINTS']);
1487 $tpl->assign(
'on_estimate',
$product_object->affiche_prix(
display_prices_with_taxes_active(),
check_if_module_active(
'reseller') && is_reseller(),
true,
false, null,
false,
false,
'full_width',
true,
false, null, $display_minimal_price));
1497 if (!function_exists(
'get_product_new_list')) {
1507 function get_product_new_list($location =
"left", $return_mode =
true)
1509 $output =
'get_product_new_list';
1518 if (!function_exists(
'display_javascript_for_price_update')) {
1530 function display_javascript_for_price_update(&
$product_object, $save_suffix_id, $form_id, $taille_display_mode = 0, $update_product_price_needed =
true, $product_object2 = null)
1534 $get_javascript_price = array();
1536 if(!empty($product_object2)) {
1538 $attributs_infos_array[$this_key] = $this_value;
1542 if(!empty($product_object2)) {
1544 $sizes_infos_array[$this_key] = $this_value;
1547 if (!empty($sizes_infos_array) || (
check_if_module_active(
'attributs') && !empty($attributs_infos_array))) {
1549 <script><!--//--><![CDATA[//><!--
1555 if (!empty($sizes_infos_array)) {
1557 if ($taille_display_mode == 0) {
1560 select_size = document.getElementById("taille' . $save_suffix_id .
'");
1561 size_id = select_size.options[select_size.selectedIndex].value;
1566 select_size = document.getElementById("taille' . $save_suffix_id .
'");
1567 for (var i=0; select_size && i<select_size.length;i++) {
1568 if (radio[i].checked) {
1569 size_id = radio[i].value;
1577 function update_product_price' . ($save_suffix_id) .
'(){
1578 var attribut_list="";
1580 ' . $get_infos_js .
'
1581 jQuery.post("'.$GLOBALS[
'wwwroot'].
'/get_product_price.php", {product_id: '.
$product_object->id.
', product2_id: '.(!empty($product_object2)?$product_object2->id:
'""').
', size_id: size_id, attribut_list: attribut_list, hash: \''.sha256(
'HFhza8462naf'.
$product_object->id).
'\'},
function(data){
1582 var divtoshow =
"#prix_' . vn($product_object->id) . $save_suffix_id . '";
1583 if(data.length >0) {
1584 jQuery(divtoshow).show();
1585 jQuery(divtoshow).html(data);
1589 if($update_product_price_needed){
1590 $GLOBALS['js_ready_content_array
'][] = '
1591 update_product_price
' . ($save_suffix_id) . '();
1603 if (!function_exists(
'get_recommanded_product_on_cart_page')) {
1610 function get_recommanded_product_on_cart_page()
1613 $sql =
"SELECT p.*, c.id AS categorie_id, c.nom_" .
$_SESSION[
'session_langue'] .
" AS categorie
1614 FROM peel_produits p
1615 INNER JOIN peel_produits_categories pc ON p.id = pc.produit_id
1616 INNER JOIN peel_categories c ON c.id = pc.categorie_id AND " .
get_filter_site_cond(
'categories',
'c') .
"
1617 WHERE p.recommanded_product_on_cart_page = '1' AND p.id NOT IN ('" . implode(
"','",
nohtml_real_escape_string(
$_SESSION[
'session_caddie']->articles)) .
"') AND p.nom_" .
$_SESSION[
'session_langue'] .
" != '' AND c.nom_" .
$_SESSION[
'session_langue'] .
" != '' AND p.etat='1' ".(empty($GLOBALS[
'site_parameters'][
'allow_command_product_ongift'])?
" AND p.on_gift != '1'":
'').
" AND " .
get_filter_site_cond(
'produits',
'p') .
"
1627 $product_html .= get_product_in_container_html(
$product_object, $GLOBALS[
'site_parameters'][
'only_show_products_with_picture_in_containers']);
1630 if (!empty($product_html)) {
1634 var product_liste_html = "'.filtre_javascript($product_html,
true,
false,
true,
true,
false).
'";
1635 product_liste_html += "<br /><div style=\"width:100%; text-align:center;\"><a href=\"#\" onclick=\"$(\'#caddieFormArticle\').submit();return false;\" class=\"tooltip_link btn btn-lg btn-primary\">'.$GLOBALS[
'STR_ORDER'].
'</a></div>"
1636 function display_recommanded_product_on_cart_page_popup(){
1638 message: product_liste_html,
1639 title: "' .
filtre_javascript($GLOBALS[
'STR_HAVE_YOU_THINK_ABOUT'],
true,
false,
true,
true,
false) .
'",
1644 <a href="#" onclick="display_recommanded_product_on_cart_page_popup();" class="tooltip_link btn btn-lg btn-primary">'.$GLOBALS[
'STR_ORDER'].
' <span class="glyphicon glyphicon-chevron-right"></span></a>';
1650 if (!function_exists(
'get_next_product_flash')) {
1657 function get_next_product_flash () {
1661 WHERE flash_start > '" . date(
"Y-m-d", time()) .
"' AND " .
get_filter_site_cond(
'produits') .
"
1662 ORDER BY flash_start
1667 $output = get_product_in_container_html(
$product_object, $GLOBALS[
'site_parameters'][
'only_show_products_with_picture_in_containers']);
if(isset($_GET['catid'])&&empty($_GET['catid'])) if(empty($_GET['catid'])&&!empty($GLOBALS['site_parameters']['disallow_main_category'])&&empty($_GET['convert_gift_points'])) $catid
static strip_tags($string, $allowed_tags=null)
String::strip_tags()
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
get_discount_text($remise_valeur, $remise_percent, $is_remise_valeur_including_taxe)
Retourne la remise d'un code promotionnel (en % dans le cas d'une remise en pourcentage ou dans le fo...
get_user_information($user_id=null, $get_full_infos=false)
Chargement des détails de l'utilisateur.
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
static rawurldecode($string, $avoid_slash=false)
Returns rawurldecode.
is_user_tva_intracom_for_no_vat($user_id=null)
is_user_tva_intracom_for_no_vat()
affiche_attributs_form_part(&$product_object, $display_mode= 'table', $save_cart_id=null, $save_suffix_id=null, $form_id=null, $technical_code_array=null, $excluded_technical_code_array=null, $force_reseller_mode=null, $get_attributes_with_multiple_options_only=true, $filter_using_show_description=false, $get_attributes_with_single_options_only=false, $update_last_calculation_additional_price_ht=true)
affiche_attributs_form_part()
render_avis_public_list($prodid, $type, $display_specific_note=null, $no_display_if_empty=false, $ad_owner_opinion=false)
render_avis_public_list()
static html_entity_decode_if_needed($string)
String::html_entity_decode_if_needed()
params_affiche_produits($condition_value1, $unused, $type, $nb_par_page, $mode= 'general', $reference_id=0, $nb_colonnes, $always_show_multipage_footer=true, $additional_sql_inner=null, $additional_sql_cond=null, $additionnal_sql_having=null, $use_index_sql=null)
params_affiche_produits()
static strtolower($string)
Returns string with all alphabetic characters converted to lowercase.
static strlen($string)
Returns the length of the given string.
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
get_current_user_promotion_percentage()
Calcule la réduction générale applicable à un utilisateur et garde la valeur en session pour accélére...
if(empty($_GET['id'])) if(!empty($GLOBALS['site_parameters']['allow_multiple_product_url_with_category'])) $product_object
if(!defined('IN_PEEL')) thumbs($source_filename, $width, $height, $method= 'fit', $source_folder=null, $thumb_folder=null, $thumb_rename=true, $return_absolute_path=false)
Charge l'image dont le nom est $source_filename dans le répertoire d'upload, et crée une vignette pou...
static str_shorten_words($string, $length_limit=100, $separator=" ", $force_shorten_if_special_content=false, $add_separator_instead_of_cutting=true)
On rajoute des espaces à l'intérieur des mots trop longs => à utiliser pour éviter de casser une mise...
build_attr_var_js($attr_var_name, $attributs_infos_array, $form_id)
build_attr_var_js()
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
if(!defined('IN_PEEL')) display_prices_with_taxes_active()
display_prices_with_taxes_active()
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
if(!defined('IN_PEEL')) est_identifie()
Retourne true si l'utilisateur est identifié
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
num_rows($query_result)
num_rows()
fetch_assoc($query_result)
fetch_assoc()
get_file_type($filename)
get_file_type()
$GLOBALS['page_columns_count']
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
fprix($price, $display_currency=false, $currency_code_or_default=null, $convertion_needed_into_currency=true, $currency_rate=null, $display_iso_currency_code=false, $format=true, $force_format_separator=null, $add_rdfa_properties=false, $round_even_if_no_format=false)
fprix formatte le prix donné en le convertissant si nécessaire au préalable et en ajoutant éventuelle...
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
static nl2br_if_needed($string)
Fonction de compatibilité avec de vieilles versions de PEEL ou du contenu qui vient d'ailleurs...
static str_shorten($string, $length_limit, $middle_separator= '', $ending_if_no_middle_separator= '...', $ideal_length_with_clean_cut_if_possible=null)
Raccourcit une chaine de caractère en insérant au milieu ou à la fin un séparateur.
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']