simple.php 8.49 KB
Newer Older
imac's avatar
imac committed
1
<?php
2
// A factoriser avec variable.php
3 4
if (!defined('ABSPATH')) {
    exit;
imac's avatar
imac committed
5 6 7
}

global $product;
8 9
$ambiance_product = $product->get_gallery_attachment_ids();

10
$id = get_the_ID();
11 12 13
$parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent' => 0, 'fields' => 'ids'));
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent' => $parent_cat[0], 'fields' => 'all'));

14
$ext_ref = externe_referrer();
15 16 17
$category_link = get_category_link($parent_cat[0]);
if(!$ext_ref) {
    $class_back = "int-link";
18
}
19 20
do_action('woocommerce_before_add_to_cart_form');
?>
21 22 23
<ul class="hidden">
    <li class="color-list selected " data-color="<?php echo get_post_thumbnail_id($ID) ?>"></li>
</ul>
24 25
<div id="product" class="clearfix">
    <div class="product-images row animated">
26 27
        <div class = "btn-wrapper row close-panel <?php echo $class_back ?>">
            <div class="pink-btn circle-btn "><a href="<?php echo $category_link ?>"><span class = "abs-center backlink">Retour</span></a></div>
28 29 30
        </div>
        <div class="product-slides row">
            <div class="product-header">
31
                <h2 class="crete -italic font-small"><?php echo $sub_cat[0]->name ?></h2>
32 33
                <h3 class="crete"><?php the_title(); ?></h3>
            </div>
imac's avatar
imac committed
34
            <span class="close-btn display--only-mobile close-btn-mobile"></span>
35 36 37 38 39 40
            <div class="slides-wrapper center">
                <div class="row">
                    <div class="nav-slider transition">
                        <ul>
                            <li id = "mozaique"><span class="icon mozaique row"></span><span class="desc">Mozaïque</span></li>
                            <li id = "zoom" data-active="false" ><span class="icon zoom"></span><span class="desc">Zoom</span></li>
41 42 43
                            <?php if ( is_user_logged_in() ) { ?>
                                <li><span class="icon download"></span><span class="desc">Télécharger</span></li>
                            <?php } ?>
44 45 46 47 48
                        </ul>
                    </div>
                    <div id="slides"> 
                        <?php
                        ?>
49
                        <div style="background-image:url('<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>')" class="image element-slider  easyzoom easyzoom--overlay easyzoom--with-toggle"  data-color = "<?php echo get_post_thumbnail_id($ID) ?>" data-slick-index = "1">
50 51 52 53 54 55 56
                            <a href="<?php echo get_the_post_thumbnail_url($ID, 'full') ?>">
                                <!--<img src="<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>" alt="" />-->
                            </a>
                        </div>


                        <?php
Nahla Shiri's avatar
Nahla Shiri committed
57 58 59 60 61
                        if (!empty($ambiance_product)) {
                            $ambiance = $ambiance_product;
                        } else {
                            $ambiance = array();
                        }
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
                        if (get_field('images_ambiance', 'product_cat_' . $sub_cat[0]->term_id)):
                            while (has_sub_field('images_ambiance', 'product_cat_' . $sub_cat[0]->term_id)) :
                                $image_amb = get_sub_field('img_ab');
                                $ambiance [] = $image_amb;

                            endwhile;
                        endif;
                        foreach ($ambiance as $key => $value) :
                            $attachment = wp_get_attachment_image_src($value, 'medium');
                            $hd = wp_get_attachment_image_src($value, 'full');
                            ?>
                            <div  style="background-image:url('<?php echo $attachment[0]; ?>')" class="image element-slider  easyzoom easyzoom--overlay easyzoom--with-toggle" data-color = "<?php echo $value; ?>" data-slick-index = "1">
                                <a href="<?php echo $hd[0]; ?>"> </a>
                            </div>
                        <?php endforeach; ?>

78 79 80 81 82 83 84 85

                    </div>  
                </div>
                <div class="gallery clearfix">
                    <div class="gallery-content clearfix">
                        <span class="close-btn"></span>


86
                        <article class = "row" data-color = "<?php echo get_post_thumbnail_id($ID) ?>">
87 88 89 90 91 92 93 94 95 96 97 98
                            <a href="<?php echo get_the_post_thumbnail_url($ID, 'full') ?>"></a>
                            <figure>
                                <img src="<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>" alt="" title="">
                            </figure>
                        </article>
                        <?php
                        if (!empty($ambiance)):
                            foreach ($ambiance as $key => $value) :
                                $attachment = wp_get_attachment_image_src($value, 'medium');
                                $hd = wp_get_attachment_image_src($value, 'full');
                                ?>

99
                                <article class = "row" data-color = "<?php echo $value; ?>">
imac's avatar
imac committed
100 101 102
                                    <?php if ( is_user_logged_in() ) { ?>
                                        <a class = "download-btn" href="<?php echo $hd[0]; ?>" download></a>
                                    <?php } ?>    
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
                                    <figure>
                                        <img src="<?php echo $attachment[0]; ?>" alt="" title="">
                                    </figure>
                                </article>
                                <?php
                            endforeach;
                        endif;
                        ?>


                    </div>
                </div>
            </div> 
        </div>
    </div>
imac's avatar
imac committed
118

119 120
    <?php $formats = explode(',', nap_variation_format($id)); ?>
    <div class="product-details full-height row right transition">
121

122 123 124
        <div class="product-info row center right border-l">
            <div class="info-content">
                <?php $formats = explode(',', nap_variation_format($id)); ?>
125
                <h2 class = "crete  font-small" ><?php echo $sub_cat[0]->name ?></h2>
126 127 128 129 130
                <h3 class = "crete  font-small info-attr" ><span class="info-format"><?php echo $formats[0]; ?></span> <span class="info-color"><?php echo$_GET['attribute_couleur'] ?></span></h3>
                <div class="details font-small">
                    <p class="info-format-txt"> 
                        <?php echo $formats[0]; ?>
                    </p>
131
                    <p class="pq"><?php echo do_shortcode(get_the_excerpt()); ?></p>
132 133 134 135 136 137
                </div>
                <div class="price">
                    <span class="crete"><?php echo $price = get_post_meta(get_the_ID(), '_regular_price', true); ?> € ht</span>
                    <div class="notice">( prix public conseillé )</div>
                    <div class="font-small">
                        <div class="product_meta">
imac's avatar
imac committed
138

139
                            <?php do_action('woocommerce_product_meta_start'); ?>
imac's avatar
imac committed
140

141
                            <?php if (wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type('variable') )) : ?>
imac's avatar
imac committed
142

143
                                <span class="sku_wrapper"><span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : nap_variable_meta($current_variationID, 'sku'); ?></span></span>
imac's avatar
imac committed
144

145
                            <?php endif; ?>
imac's avatar
imac committed
146 147


148
                            <?php do_action('woocommerce_product_meta_end'); ?>
imac's avatar
imac committed
149

150
                        </div>
imac's avatar
imac committed
151

152 153 154 155 156 157 158 159
                    </div>
                </div>
            </div>
            <div class = "btn-list">
                <a href="<?php echo get_permalink(157); ?>" class="btn pink-btn rounded">Nous contacter</a>
                <a class="btn pink-btn rounded download-btn download_file">Télécharger la fiche technique </a>
                <a href="<?php echo get_permalink(43); ?>?product_id=<?php echo $product->get_id() ?>&" class="hidden download_file_link" id="<?php echo $current_variationID ?>"></a>
            </div>
Nahla Shiri's avatar
Nahla Shiri committed
160 161
           <?php if(count($product->get_upsell_ids())):
            ?>
162
            <div class="font-small circle-btn add-icon show-product"><span class= "abs-center">Produits associées</span></div>
Nahla Shiri's avatar
Nahla Shiri committed
163 164 165
            <?php
            endif;
            ?>
166 167 168
        </div>
    </div>
    <div class="product-list transition border-l fixed">
Nahla Shiri's avatar
Nahla Shiri committed
169 170 171 172 173
        
        <?php 
        echo nap_show_associated_products();
        ?>
        
174
    </div>
imac's avatar
imac committed
175
    <div class="display--only-mobile"><span class = "chevron bottom blue-bg down-btn show-product-mobile"></span></div>
176
</div>