simple.php 8.98 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
$class_back = "";
16 17 18 19 20
if ($ext_ref) {
    $category_link = get_category_link($parent_cat[0]);
    $class_back = "ext-link";
} else {
    $category_link = "#";
21
}
22 23
do_action('woocommerce_before_add_to_cart_form');
?>
24 25 26
<ul class="hidden">
    <li class="color-list selected " data-color="<?php echo get_post_thumbnail_id($ID) ?>"></li>
</ul>
27 28
<div id="product" class="clearfix">
    <div class="product-images row animated">
29 30
        <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>
31 32 33
        </div>
        <div class="product-slides row">
            <div class="product-header">
34
                <h2 class="crete -italic font-small"><?php echo $sub_cat[0]->name ?></h2>
35 36
                <h3 class="crete"><?php the_title(); ?></h3>
            </div>
imac's avatar
imac committed
37
            <span class="close-btn display--only-mobile close-btn-mobile"></span>
38 39 40 41 42 43 44 45 46 47 48 49
            <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>
                            <li><span class="icon download"></span><span class="desc">Télécharger</span></li>
                        </ul>
                    </div>
                    <div id="slides"> 
                        <?php
                        ?>
50
                        <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">
51 52 53 54 55 56 57
                            <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
58 59 60 61 62
                        if (!empty($ambiance_product)) {
                            $ambiance = $ambiance_product;
                        } else {
                            $ambiance = array();
                        }
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
                        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; ?>

79 80 81 82 83 84 85 86

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


87
                        <article class = "row" data-color = "<?php echo get_post_thumbnail_id($ID) ?>">
88 89 90 91 92 93 94 95 96 97 98 99
                            <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');
                                ?>

100
                                <article class = "row" data-color = "<?php echo $value; ?>">
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
                                    <a class = "download-btn" href="<?php echo $hd[0]; ?>" download></a>
                                    <figure>
                                        <img src="<?php echo $attachment[0]; ?>" alt="" title="">
                                    </figure>
                                </article>
                                <?php
                            endforeach;
                        endif;
                        ?>


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

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

121 122 123
        <div class="product-info row center right border-l">
            <div class="info-content">
                <?php $formats = explode(',', nap_variation_format($id)); ?>
124
                <h2 class = "crete  font-small" ><?php echo $sub_cat[0]->name ?></h2>
125 126 127 128 129
                <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>
130
                    <p class="pq"><?php echo do_shortcode(get_the_excerpt()); ?></p>
131 132 133 134 135 136
                </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
137

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

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

142
                                <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
143

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


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

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

151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
                    </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>
            <div class="font-small circle-btn add-icon show-product"><span class= "abs-center">Produits associées</span></div>
        </div>
    </div>
    <div class="product-list transition border-l fixed">
        <div class="suggest-header">
            <h2>Produits associés</h2>
            <span class="close-btn"></span>
        </div>
        <div class="product-list-content"> 
            <article class = "row full-width">
                <a href="#"></a>
                <figure>
                    <img src="http://nap.mano.fr/wp-content/uploads/2017/07/505714-papier-toilette-jumbo-500x375.jpg" alt="" title="">
                </figure>
                <h3 class = "font-small" >Bobines papier toilette</h3>
            </article>
            <article class = "row full-width">
                <a href="#"></a>
                <figure>
                    <img src="http://nap.mano.fr/wp-content/uploads/2017/07/450108-flexibles-noirs-21cm-315x500.jpg" alt="" title="">
                </figure>
                <h3 class = "font-small" >Pailles</h3>
            </article>
        </div>
    </div>
imac's avatar
imac committed
184
    <div class="display--only-mobile"><span class = "chevron bottom blue-bg down-btn show-product-mobile"></span></div>
185
</div>