%PDF- %PDF-
Direktori : /proc/1857783/root/var/www/cwg/wp-content/themes/cwg/ |
Current File : //proc/1857783/root/var/www/cwg/wp-content/themes/cwg/single-product.php |
<?php /** * The main template file * Template Name: Product * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * * @package onepoint */ get_header(); ?> <!----Should be placed when there is no carousel--> <div class="js-headerGap h-[51px]"></div> <div> <?php while (have_posts()) : the_post(); $row_image = get_field('image_cover'); $cat = get_the_terms(get_the_ID(), 'product_cat'); $catName = $cat[0]->name; $parentCat = $cat[0]->parent !== 0 ? get_the_category_by_ID($cat[0]->parent) : $catName; $isJW = in_array('Jewellery', array($catName, $parentCat), false); ?> <div class="px-5 lg:px-[60px] mt-[30px] mb-5 lg:mb-[30px]"> <?php the_breadcrumbs(); ?> </div> <div class="px-5 lg:px-[60px] flex flex-col lg:flex-row pd-md-0"> <?php if(get_field('image_carousel') == false){ ?> <div class="lg:w-[70%] lg:hidden"> <div class="js-slider-product-page slider-product-page w-full h-full"> <?php // ndlr : Jewellery doesn't have it's main image imported on gallery, so we have to put it before the loop. ?> <div class="slide-container w-full"> <?= get_the_post_thumbnail(get_the_ID(), 'full', array('class' => 'h-full w-full object-cover')); ?> </div> <?php $product = new WC_product(get_the_ID()); $attachment_ids = $product->get_gallery_image_ids(); !$isJW ? array_shift($attachment_ids) : null; ?> <?php foreach ($attachment_ids as $attachment_id) : ?> <div class="slide-container w-full"> <?= wp_get_attachment_image($attachment_id, 'full', false, array('class' => 'h-full w-full object-cover')); ?> </div> <?php endforeach; ?> </div> </div> <div class="lg:pl:7 lg:w-[70%] gap-4 hidden lg:flex lg:flex-col"> <?php $product = new WC_product(get_the_ID()); $attachment_ids = $product->get_gallery_image_ids(); !$isJW ? array_shift($attachment_ids) : null; ?> <div class="relative h-0 pt-[100%] w-full"> <?= get_the_post_thumbnail(get_the_ID(), 'full', array('class' => 'h-full w-full object-cover object-bottom absolute top-0')); ?> </div> <?php foreach ($attachment_ids as $attachment_id) { ?> <?= wp_get_attachment_image($attachment_id, 'full', false, array('class' => 'h-auto w-full object-cover')); ?> <?php } ?> </div> <div class="lg:w-[30%] mt-7 lg:mt-0 collapsible-product"> <div class="lg:sticky lg:top-[100px]"> <div class="lg:pl-[60px] lg:pr-7 title"> <?php $artists = get_field('artist_label'); $product_id = $product->get_id(); ?> <div class="flex w-full relative"> <h2 class="text-[16px] leading-4 uppercase font-medium"><?= $parentCat === "Shop" ? the_title() : $artists; ?></h2> <?php if (is_user_logged_in()) : ?> <span class="text-black absolute right-0 top-0 whishlist-title"> <?= do_shortcode('[yith_wcwl_add_to_wishlist]'); ?> </span> <?php else : $path_register = get_page_by_path('login'); $link_login = add_query_arg('p', get_the_ID(), get_permalink($path_register)); ?> <a href="<?php echo redirect_login_account($link_login, ['redirect_to' => get_permalink(get_the_ID())]); ?>" class="text-black absolute right-0 top-0 whishlist-title gtm-wishlist"> <?php include(locate_template('/assets/img/icon-action-favorite-border-black.svg')); ?> </a> <?php endif; ?> </div> <div class="text-grey-dark flex flex-row items-center"> <div class="text-[16px] leading-4 font-thin text-grey-textLight w-full"> <h1 class="leading-4 overflow-ellipsis overflow-hidden pt-1 max-w-[calc(100%-25px)]"> <?php if ($parentCat === "Shop") : ?> by <span class="uppercase"><?= $artists ?></span> <?php else : ?> <span class="uppercase"> <?= the_title() ?><?= $parentCat === "Jewellery" && get_field('collection_details') !== '' ? ' - ' . get_field('collection_details') : ""; ?> </span> <?php endif; ?> </h1> </div> </div> <?php if ($parentCat === "Jewellery" || $catName === "Jewellery") : ?> <div class="text-grey-dark flex flex-row items-center"> <div class="text-[16px] uppercase font-thin text-grey-textLight"> <div class="inline-block font-light whitespace-nowrap leading-4 overflow-ellipsis overflow-hidden pt-1"><?= get_field('edition_details'); ?></div> </div> </div> <?php endif; ?> <?php if (isUserB2B() || $parentCat === "Shop" || $parentCat === "Jewellery") : $isOnRequest = get_field("retail_price_note"); $currency = $parentCat === "Work" && get_field('currency') !== '' ? get_field('currency') : '€'; // $price = $isOnRequest || !is_numeric(-) || $product->get_price() == '0' ? 'On request' : $currency . number_format($product->get_price(), 0, ',', ','); ?> <div class="text-xs text-grey-dark flex flex-row items-center justify-between <?= $parentCat === "Jewellery" ? '' : 'my-6' ?>"> <div class="flex flex-row items-baseline"> <p class="uppercase font-thin <?= $parentCat !== "Work" ? '' : 'text-grey-textLight' ?> text-[16px]"> <?= get_price_formatted($isOnRequest, $product->get_price(), $currency) ?> <span class="ml-0.5 font-thin text-[16px] <?= $parentCat !== "Work" ? '' : 'text-grey-textLight' ?>"><?= $parentCat === "Work" && isUserB2B() && $product->get_price() != "0" && !$isOnRequest ? " (excl. pro discount)" : "" ?></span> </p> </div> </div> <?php endif ?> <?php $sizeArr = get_field("jewellery_size"); if ($sizeArr > 0 && $parentCat !== "Shop" && $parentCat !== "Work") : ?> <div class="flex flex-row justify-between mt-5"> <div class="btn-stroked font-thin w-[48%]"> <select class="arrow_select font-thin bg-white w-full h-full border-none focus:outline-none px-[25%] appearance-none"> <option>SIZE *</option> <?php foreach ($sizeArr as $key => $value) { ?> <option value="<?php echo $value["size"]; ?>"><?php echo $value["size"]; ?></option> <?php } ?> </select> </div> <?php $args = ['width' => 48]; include_once(locate_template('/template-parts/buttons/enquire-button.php', false, true, $args)); ?> </div> <?php else : ?> <?php if ($parentCat !== "Shop") { ?> <div class="mt-3 flex flex-row justify-between"> <?php $args = ['width' => 100]; include_once(locate_template('/template-parts/buttons/enquire-button.php', false, true, $args)); ?> </div> <?php }; ?> <?php endif; ?> <?php if ($parentCat !== "Work") { ?> <div class="mt-5 flex flex-row justify-between"> <a href="?add-to-cart=<?= $product->get_id(); ?>" data-productId="<?= $product->get_id(); ?>" class="js-showPopUpBag btn-stroked-dark w-[100%] font-thin"> ADD TO CART </a> </div> <?php }; ?> <div class="hide-empty my-[30px] gap-5 flex flex-col"> <?php if (get_the_content() != '' && (($parentCat === "Shop" || $parentCat === "Jewellery") || ($parentCat === 'Work' && !isUserB2B()))) : ?> <div> <?php $item = array('title' => 'LEARN MORE'); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer flex-col"> <div class="prose text-xs font-light pt-1"> <?php the_content(); ?> </div> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> <?php endif; $allConditions = [ get_field('product_materials') == true, get_field('height') || get_field('height_inches') || get_field('dimensions'), get_field('shop_weight') == true, get_field('year') == true, get_field('editor') && $parentCat === "Shop", get_field('edition_details') == true, is_array(get_field('shown_in')) && count(get_field('shown_in')) > 0, !isUserB2B() && $parentCat === "Work", get_field('deliveries') == true, get_field('note'), get_field('short_description') == true ]; if (in_array(true, $allConditions)) : ?> <div> <?php $item = array('title' => 'DETAILS', 'is_open' => $parentCat === "Work"); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer flex-col"> <?php if ($allConditions[0]) : ?> <div> <div class="text-[13px] font-medium">Materials</div> <div class="text-xs font-light pt-1"> <?= get_field('product_materials') ?> </div> </div> <?php endif; ?> <?php if ($allConditions[1]) : ?> <div class="text-[13px] pt-4 font-medium">Dimensions</div> <div class="flex flex-row w-[70%]"> <div class="size-product-container"> <div class="pr-4 text-[13px]">CM</div> <div class="pr-4 text-[13px]">IN</div> <?php if (get_field('diameter')) : ?> <div class="pr-4 text-[13px]">Diameter</div> <?php endif; ?> </div> <div class="size-product-container"> <div class="detail-size-little-container">H:<?= get_field('height') ?></div> <div class="detail-size-little-container">H:<?= get_field('height_inches') ?></div> <?php if (get_field('diameter')) : ?> <div class="detail-size-little-container">∅<?= get_field('diameter'); ?></div> <?php endif; ?> </div> <div class="size-product-container"> <div class="detail-size-little-container">W:<?= get_field('width') ?></div> <div class="detail-size-little-container">W:<?= get_field('width_inches') ?></div> </div> <div class="size-product-container"> <div class="detail-size-little-container">D:<?= get_field('depth') ?></div> <div class="detail-size-little-container">D:<?= get_field('depth_inches') ?></div> </div> </div> <?php endif; ?> <?php if ($allConditions[2]) : ?> <?php $weight = get_field('shop_weight'); $weightPounds = $weight; preg_match_all('/\d+/', $weight, $match); $match = !empty($match) ? $match[0] : null; $poundsMin = count($match) > 0 ? floatval($match[0]) * 2.2 : null; $poundsMax = count($match) > 1 ? floatval($match[1]) * 2.2 : null; $poundsMin ? $weightPounds = str_replace($match[0], strval($poundsMin), $weightPounds) : null; $poundsMin ? $weightPounds = str_replace('kg', 'lbs', $weightPounds) : null; $poundsMax ? $weightPounds = str_replace($match[1], strval($poundsMax), $weightPounds) : null; ?> <div> <p class="text-[13px] pt-4 font-medium">Weight</p> <div class="text-xs font-light pt-1"> <?= $weight; ?> <?= $poundsMin ? '<br>' . $weightPounds : ''; ?> </div> </div> <?php endif ?> <?php if ($allConditions[3]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Year</p> <div class="text-xs font-light pt-1 "><?= get_field('year'); ?></div> </div> <?php endif ?> <?php if ($allConditions[4]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Editor</p> <div class="text-xs font-light pt-1 "><?= get_field('editor'); ?></div> </div> <?php endif ?> <?php if ($allConditions[5]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Edition details</p> <div class="text-xs font-light pt-1 prose"><?= get_field('edition_details') === " " ? "Not specified" : get_field('edition_details'); ?></div> </div> <?php endif ?> <?php if ($allConditions[6]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Show in</p> <div class="text-xs font-light pt-1"> <?= get_field('shown_in')[0]->post_title; ?> </div> </div> <?php endif ?> <?php if ($allConditions[7]) : $productPrice = intval($product->get_price()); ?> <p class="text-[13px] pt-4 font-medium">Price indication</p> <div class="text-xs font-light pt-1"><?= $product->get_price() !== "0" && get_field("retail_price_note") == "" ? getPriceRange($productPrice) : 'On request'; ?></div> <?php endif ?> <?php if ($allConditions[8]) : ?> <p class="text-[13px] font-medium pt-4">Deliveries</p> <div class="text-xs font-light pt-1 prose"><?= get_field('deliveries') ?></div> <?php endif ?> <?php if ($allConditions[9]) : ?> <p class="text-[13px] font-medium pt-4">Note</p> <div class="text-xs font-light pt-1 prose"><?= get_field('note') ?></div> <?php endif ?> <?php if ($allConditions[10]) : ?> <p class="text-[13px] font-medium pt-4">Additional Information</p> <div class="text-xs font-light pt-1 prose"><?= get_field('short_description') ?></div> <?php endif ?> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> </div> <?php endif; $pdfDoc = get_field('technical_doc'); $scan = get_field('3d_scan'); if (!empty($pdfDoc) /*|| !empty($scan)*/) { ?> <div class="mt-4 mb-5"> <?php $item = array('title' => 'DOCUMENTS'); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer"> <?php if (!empty($pdfDoc)) { ?> <a href="<?= $pdfDoc ?>" class="btn-stroked w-[50%] lg:w-full font-thin" rel="noopener noreferrer nofollow"> <?php include(locate_template('/assets/img/icon-file-download.svg')); ?> <span class="ml-3">PRODUCT INFORMATION</span> </a> <?php } ?> <?php if (isUserB2B()) : ?> <?php if ($scan !== null) { ?> <!-- <a href="<?= $$scan ?>" class="btn-stroked w-[50%] font-thin mt-3"> 3D Scan </a>--> <?php } ?> <?php endif ?> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> <?php } ?> <div class="flex justify-end my-[20px] md:my-[30px]"> <div class="hidden lg:flex"> <!-- <div class="px-8 md:px-0 font-thin flex items-center gap-2 text-xs cursor-pointer" onclick="copyToClipboard(<?php get_permalink(get_the_ID()); ?>)"> --> <div class="share-post-btn"> <?php echo do_shortcode('[addthis tool="addthis_inline_share_toolbox_qfxd"]'); ?> </div> </div> </div> <div class="flex justify-start my-[20px] md:my-[30px]"> <div class="flex lg:hidden cursor-pointer js-shareBtn"> <!-- <div class="text-xs font-thin flex items-left"> --> <!-- <span><?php include(locate_template('/assets/img/share-black.svg')); ?></span> <span class="ml-1 pt-[3px]">SHARE</span> --> <div class="share-post-btn"> <?php echo do_shortcode('[addthis tool="addthis_inline_share_toolbox_qfxd"]'); ?> </div> <!-- </div> --> </div> </div> </div> </div> </div> <?php } elseif (get_field('image_carousel') == true) { ?> <div class="lg:pl:7 lg:w-[70%] gap-4"> <div class="js-product-carrousel hidden md:block exhib-carrousel carrousel-height w-full"> <?php ob_start(); ?> <?= get_the_post_thumbnail(get_the_ID(), 'full', array('class' => 'h-full w-full object-cover')); ?> <?php $product = new WC_product(get_the_ID()); $attachment_ids = $product->get_gallery_image_ids(); !$isJW ? array_shift($attachment_ids) : null; ?> <?php foreach ($attachment_ids as $attachment_id) : ?> <?= wp_get_attachment_image($attachment_id, 'full', false, array('class' => 'h-full w-full object-cover')); ?> <?php endforeach; ?> <?php $carrousel_content = ob_get_clean() ?> <?= $carrousel_content ?> </div> <div class="js-product-carrousel-mobile md:hidden exhib-carrousel carrousel-height w-full"> <?= $carrousel_content ?> </div> </div> <div class="lg:w-[30%] mt-7 lg:mt-0 collapsible-product"> <div class="lg:sticky lg:top-[100px]"> <div class="lg:pl-[60px] lg:pr-7 title"> <?php $artists = get_field('artist_label'); $product_id = $product->get_id(); ?> <div class="flex w-full relative"> <h2 class="text-[16px] leading-4 uppercase font-medium"><?= $parentCat === "Shop" ? the_title() : $artists; ?></h2> <?php if (is_user_logged_in()) : ?> <span class="text-black absolute right-0 top-0 whishlist-title"> <?= do_shortcode('[yith_wcwl_add_to_wishlist]'); ?> </span> <?php else : $path_register = get_page_by_path('login'); $link_login = add_query_arg('p', get_the_ID(), get_permalink($path_register)); ?> <a href="<?php echo redirect_login_account($link_login, ['redirect_to' => get_permalink(get_the_ID())]); ?>" class="text-black absolute right-0 top-0 whishlist-title gtm-wishlist"> <?php include(locate_template('/assets/img/icon-action-favorite-border-black.svg')); ?> </a> <?php endif; ?> </div> <div class="text-grey-dark flex flex-row items-center"> <div class="text-[16px] leading-4 font-thin text-grey-textLight w-full"> <h1 class="leading-4 overflow-ellipsis overflow-hidden pt-1 max-w-[calc(100%-25px)]"> <?php if ($parentCat === "Shop") : ?> by <span class="uppercase"><?= $artists ?></span> <?php else : ?> <span class="uppercase"> <?= the_title() ?><?= $parentCat === "Jewellery" && get_field('collection_details') !== '' ? ' - ' . get_field('collection_details') : ""; ?> </span> <?php endif; ?> </h1> </div> </div> <?php if ($parentCat === "Jewellery" || $catName === "Jewellery") : ?> <div class="text-grey-dark flex flex-row items-center"> <div class="text-[16px] uppercase font-thin text-grey-textLight"> <div class="inline-block font-light whitespace-nowrap leading-4 overflow-ellipsis overflow-hidden pt-1"><?= get_field('edition_details'); ?></div> </div> </div> <?php endif; ?> <?php if (isUserB2B() || $parentCat === "Shop" || $parentCat === "Jewellery") : $isOnRequest = get_field("retail_price_note"); $currency = $parentCat === "Work" && get_field('currency') !== '' ? get_field('currency') : '€'; // $price = $isOnRequest || !is_numeric(-) || $product->get_price() == '0' ? 'On request' : $currency . number_format($product->get_price(), 0, ',', ','); ?> <div class="text-xs text-grey-dark flex flex-row items-center justify-between <?= $parentCat === "Jewellery" ? '' : 'my-6' ?>"> <div class="flex flex-row items-baseline"> <p class="uppercase font-thin <?= $parentCat !== "Work" ? '' : 'text-grey-textLight' ?> text-[16px]"> <?= get_price_formatted($isOnRequest, $product->get_price(), $currency) ?> <span class="ml-0.5 font-thin text-[16px] <?= $parentCat !== "Work" ? '' : 'text-grey-textLight' ?>"><?= $parentCat === "Work" && isUserB2B() && $product->get_price() != "0" && !$isOnRequest ? " (excl. pro discount)" : "" ?></span> </p> </div> </div> <?php endif ?> <?php $sizeArr = get_field("jewellery_size"); if ($sizeArr > 0 && $parentCat !== "Shop" && $parentCat !== "Work") : ?> <div class="flex flex-row justify-between mt-5"> <div class="btn-stroked font-thin w-[48%]"> <select class="arrow_select font-thin bg-white w-full h-full border-none focus:outline-none px-[25%] appearance-none"> <option>SIZE *</option> <?php foreach ($sizeArr as $key => $value) { ?> <option value="<?php echo $value["size"]; ?>"><?php echo $value["size"]; ?></option> <?php } ?> </select> </div> <?php $args = ['width' => 48]; include_once(locate_template('/template-parts/buttons/enquire-button.php', false, true, $args)); ?> </div> <?php else : ?> <?php if ($parentCat !== "Shop") { ?> <div class="mt-3 flex flex-row justify-between"> <?php $args = ['width' => 100]; include_once(locate_template('/template-parts/buttons/enquire-button.php', false, true, $args)); ?> </div> <?php }; ?> <?php endif; ?> <?php if ($parentCat !== "Work") { ?> <div class="mt-5 flex flex-row justify-between"> <a href="?add-to-cart=<?= $product->get_id(); ?>" data-productId="<?= $product->get_id(); ?>" class="js-showPopUpBag btn-stroked-dark w-[100%] font-thin"> ADD TO CART </a> </div> <?php }; ?> <div class="hide-empty my-[30px] gap-5 flex flex-col"> <?php if (get_the_content() != '' && (($parentCat === "Shop" || $parentCat === "Jewellery") || ($parentCat === 'Work' && !isUserB2B()))) : ?> <div> <?php $item = array('title' => 'LEARN MORE'); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer flex-col"> <div class="prose text-xs font-light pt-1"> <?php the_content(); ?> </div> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> <?php endif; $allConditions = [ get_field('product_materials') == true, get_field('height') || get_field('height_inches') || get_field('dimensions'), get_field('shop_weight') == true, get_field('year') == true, get_field('editor') && $parentCat === "Shop", get_field('edition_details') == true, is_array(get_field('shown_in')) && count(get_field('shown_in')) > 0, !isUserB2B() && $parentCat === "Work", get_field('deliveries') == true, get_field('note'), get_field('short_description') == true ]; if (in_array(true, $allConditions)) : ?> <div> <?php $item = array('title' => 'DETAILS', 'is_open' => $parentCat === "Work"); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer flex-col"> <?php if ($allConditions[0]) : ?> <div> <div class="text-[13px] font-medium">Materials</div> <div class="text-xs font-light pt-1"> <?= get_field('product_materials') ?> </div> </div> <?php endif; ?> <?php if ($allConditions[1]) : ?> <div class="text-[13px] pt-4 font-medium">Dimensions</div> <div class="flex flex-row w-[70%]"> <div class="size-product-container"> <div class="pr-4 text-[13px]">CM</div> <div class="pr-4 text-[13px]">IN</div> <?php if (get_field('diameter')) : ?> <div class="pr-4 text-[13px]">Diameter</div> <?php endif; ?> </div> <div class="size-product-container"> <div class="detail-size-little-container">H:<?= get_field('height') ?></div> <div class="detail-size-little-container">H:<?= get_field('height_inches') ?></div> <?php if (get_field('diameter')) : ?> <div class="detail-size-little-container">∅<?= get_field('diameter'); ?></div> <?php endif; ?> </div> <div class="size-product-container"> <div class="detail-size-little-container">W:<?= get_field('width') ?></div> <div class="detail-size-little-container">W:<?= get_field('width_inches') ?></div> </div> <div class="size-product-container"> <div class="detail-size-little-container">D:<?= get_field('depth') ?></div> <div class="detail-size-little-container">D:<?= get_field('depth_inches') ?></div> </div> </div> <?php endif; ?> <?php if ($allConditions[2]) : ?> <?php $weight = get_field('shop_weight'); $weightPounds = $weight; preg_match_all('/\d+/', $weight, $match); $match = !empty($match) ? $match[0] : null; $poundsMin = count($match) > 0 ? floatval($match[0]) * 2.2 : null; $poundsMax = count($match) > 1 ? floatval($match[1]) * 2.2 : null; $poundsMin ? $weightPounds = str_replace($match[0], strval($poundsMin), $weightPounds) : null; $poundsMin ? $weightPounds = str_replace('kg', 'lbs', $weightPounds) : null; $poundsMax ? $weightPounds = str_replace($match[1], strval($poundsMax), $weightPounds) : null; ?> <div> <p class="text-[13px] pt-4 font-medium">Weight</p> <div class="text-xs font-light pt-1"> <?= $weight; ?> <?= $poundsMin ? '<br>' . $weightPounds : ''; ?> </div> </div> <?php endif ?> <?php if ($allConditions[3]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Year</p> <div class="text-xs font-light pt-1 "><?= get_field('year'); ?></div> </div> <?php endif ?> <?php if ($allConditions[4]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Editor</p> <div class="text-xs font-light pt-1 "><?= get_field('editor'); ?></div> </div> <?php endif ?> <?php if ($allConditions[5]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Edition details</p> <div class="text-xs font-light pt-1 prose"><?= get_field('edition_details') === " " ? "Not specified" : get_field('edition_details'); ?></div> </div> <?php endif ?> <?php if ($allConditions[6]) : ?> <div> <p class="text-[13px] pt-4 font-medium">Show in</p> <div class="text-xs font-light pt-1"> <?= get_field('shown_in')[0]->post_title; ?> </div> </div> <?php endif ?> <?php if ($allConditions[7]) : $productPrice = intval($product->get_price()); ?> <p class="text-[13px] pt-4 font-medium">Price indication</p> <div class="text-xs font-light pt-1"><?= $product->get_price() !== "0" && get_field("retail_price_note") == "" ? getPriceRange($productPrice) : 'On request'; ?></div> <?php endif ?> <?php if ($allConditions[8]) : ?> <p class="text-[13px] font-medium pt-4">Deliveries</p> <div class="text-xs font-light pt-1 prose"><?= get_field('deliveries') ?></div> <?php endif ?> <?php if ($allConditions[9]) : ?> <p class="text-[13px] font-medium pt-4">Note</p> <div class="text-xs font-light pt-1 prose"><?= get_field('note') ?></div> <?php endif ?> <?php if ($allConditions[10]) : ?> <p class="text-[13px] font-medium pt-4">Additional Information</p> <div class="text-xs font-light pt-1 prose"><?= get_field('short_description') ?></div> <?php endif ?> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> </div> <?php endif; $pdfDoc = get_field('technical_doc'); $scan = get_field('3d_scan'); if (!empty($pdfDoc) /*|| !empty($scan)*/) { ?> <div class="mt-4 mb-5"> <?php $item = array('title' => 'DOCUMENTS'); ?> <?php include(locate_template('template-parts/collapsible/start.php')); ?> <div class="productPageDropdownContainer"> <?php if (!empty($pdfDoc)) { ?> <a href="<?= $pdfDoc ?>" class="btn-stroked w-[50%] lg:w-full font-thin" rel="noopener noreferrer nofollow"> <?php include(locate_template('/assets/img/icon-file-download.svg')); ?> <span class="ml-3">PRODUCT INFORMATION</span> </a> <?php } ?> <?php if (isUserB2B()) : ?> <?php if ($scan !== null) { ?> <!-- <a href="<?= $$scan ?>" class="btn-stroked w-[50%] font-thin mt-3"> 3D Scan </a>--> <?php } ?> <?php endif ?> </div> <?php include(locate_template('template-parts/collapsible/end.php')); ?> </div> <?php } ?> <div class="flex justify-end my-[20px] md:my-[30px]"> <div class="hidden lg:flex"> <!-- <div class="px-8 md:px-0 font-thin flex items-center gap-2 text-xs cursor-pointer" onclick="copyToClipboard(<?php get_permalink(get_the_ID()); ?>)"> --> <div class="share-post-btn"> <?php echo do_shortcode('[addthis tool="addthis_inline_share_toolbox_qfxd"]'); ?> </div> </div> </div> <div class="flex justify-start my-[20px] md:my-[30px]"> <div class="flex lg:hidden cursor-pointer js-shareBtn"> <!-- <div class="text-xs font-thin flex items-left"> --> <!-- <span><?php include(locate_template('/assets/img/share-black.svg')); ?></span> <span class="ml-1 pt-[3px]">SHARE</span> --> <div class="share-post-btn"> <?php echo do_shortcode('[addthis tool="addthis_inline_share_toolbox_qfxd"]'); ?> </div> <!-- </div> --> </div> </div> </div> </div> </div> <?php } ?> </div> </div> <?php $user = wp_get_current_user(); $idSale = $user->client_sale; $productName = $product->get_title(); $subject = $productName; $userName = $user->user_firstname . ' ' . $user->user_lastname; $userMail = $user->user_email; if ($idSale) { $sale = get_user_by('id', $idSale); $sale_mail = $sale->user_email; $cc = []; $to = $sale_mail; if (have_rows('alias', 'user_' . $user->ID)) { while (have_rows('alias', 'user_' . $user->ID)) : the_row(); $cc[] = get_sub_field('email'); endwhile; } if (!empty($cc)) { $to = implode(';', $cc); } } else { $to = 'enquirydispatchteam@carpentersworkshopgallery.com'; } ?> <?php include(locate_template('template-parts/popups/enquire-modal.php')); ?> <div class="mb-[30px] px-5 lg:px-10 lg:hidden"> <?php $product_cat = get_product_category_originel($post->ID); if (isset($product_cat[0]->name)) { $product_cat = $product_cat[0]->name; } else { $product_cat = ''; } $featured_posts = get_field('artist_override'); if ($featured_posts) : ?> <?php foreach ($featured_posts as $post) : setup_postdata($post); $image = get_field('tall_large_grid_image'); $artist_terms = get_the_terms($post, 'artist-type'); $artist_cats = []; foreach ($artist_terms as $term) { if (isset($term->slug)) { array_push($artist_cats, $term->slug); } } $artist_cat = 'Shop'; if (in_array('collectible-design', $artist_cats)) { $artist_cat = 'Work'; } else if (in_array('jewellery', $artist_cats)) { $artist_cat = 'Jewellery'; } $the_product_cat = 'Shop'; if ($product_cat == 'Work' || $product_cat == 'Jewellery') { $the_product_cat = $product_cat; } else if ($artist_cat == 'Work') { $the_product_cat = 'Work'; } ?> <div class="lg:flex lg:flex-col"> <h3 class="text-[13px] text-grey-dark pb-3 uppercase"><?php the_title(); ?></h3> <div class="lg:flex lg:flex-row"> <?= wp_get_attachment_image($image['id'], 'full', false, array('class' => 'h-full w-full object-cover overflow-ellipsis max-h-[372px] lg:w-[48.5%]')); ?> <div class="lg:w-[50%] lg:pl-12 "> <div class="font-thin text-[12px] leading-normal tracking-normal pt-3 lg:pt-0 artist-description"><?= get_field('description') ?></div> <div class="flex flex-row mt-4 mb-7 lg:mt-0"> <a href="<?php the_permalink(); ?>" class="btn-stroked-variant w-full px-8 py-3 font-thin"> More Information </a> </div> </div> </div> </div> <div class="w-full grid grid-cols-2 gap-4 grid-rows-1 lg:gap-10 lg:grid-cols-4 lg:mt-12"> <?php $args = array( 'posts_per_page' => 4, 'post_type' => 'product', 'product_cat' => $the_product_cat, 'post__not_in' => array($product_id), 'order' => 'DESC', 'post_status' => 'publish', 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'artist_override', 'value' => get_the_id(), 'compare' => 'LIKE', ) ) ); $wc_query = new WP_Query($args); if ($wc_query->have_posts()) { while ($wc_query->have_posts()) { $wc_query->the_post(); $product = wc_get_product(get_the_ID()); $price = $product->get_price(); $cat = get_the_terms(get_the_ID(), 'product_cat'); $parentCat = get_the_category_by_ID($cat[0]->parent); $artist = get_field('multiple_artist_title') ? get_field('multiple_artist_title') : get_field('artist_override'); $mobile_class = in_array((floatval($wc_query->current_post) + 1), [5, 6, 7, 8]) ? 'hidden lg:block' : ''; if ($parentCat === "Work") { include(locate_template('template-parts/products/collectible-item.php')); } else { include(locate_template('template-parts/products/list-item-reco-little.php')); } } } ?> </div> <?php endforeach; wp_reset_postdata(); ?> <?php endif; ?> </div> <div class="mb-12 px-5 lg:px-[60px] hidden lg:block"> <?php $featured_posts = get_field('artist_override'); if ($featured_posts) : ?> <?php foreach ($featured_posts as $post) : setup_postdata($post); $image = get_field('tall_large_grid_image'); ?> <div class="lg:flex lg:flex-col"> <div class="w-[48.5%] pb-5 pt-[70px]"> <h3 class="text-[13px] text-grey-dark pb-3 uppercase"><?php the_title(); ?></h3> <div> <div class="font-thin text-[12px] leading-[18px] tracking-normal pt-3 lg:pt-0"><?= get_field('description') ?></div> <div class="flex flex-row mt-4 mb-7 lg:mt-0"> <a href="<?php the_permalink(); ?>" class="btn-stroked-variant w-[170px] mt-5 py-3 font-thin"> More Information </a> </div> </div> </div> <div class="lg:flex lg:flex-row"> <div class="grid grid-cols-4 gap-[30px] grid-rows-2 w-full"> <div class="hidden lg:block relative col-span-2 row-span-2"> <div class="mt-[100%]"></div> <?= wp_get_attachment_image($image['id'], 'full', false, array('class' => 'w-full h-full object-cover absolute top-0')); ?> </div> <?php $args = array( 'posts_per_page' => 4, 'post_type' => 'product', 'product_cat' => $the_product_cat, 'post__not_in' => array($product_id), 'order' => 'DESC', 'post_status' => 'publish', 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'artist_override', 'value' => get_the_id(), 'compare' => 'LIKE', ) ) ); $wc_query = new WP_Query($args); if ($wc_query->have_posts()) { while ($wc_query->have_posts()) { $wc_query->the_post(); $product = wc_get_product(get_the_ID()); $price = $product->get_price(); $cat = get_the_terms(get_the_ID(), 'product_cat'); $parentCat = get_the_category_by_ID($cat[0]->parent); $artist = get_field('multiple_artist_title') ? get_field('multiple_artist_title') : get_field('artist_override'); $mobile_class = in_array((floatval($wc_query->current_post) + 1), [5, 6, 7, 8]) ? 'hidden lg:block' : ''; if ($parentCat === "Work") { include(locate_template('template-parts/products/collectible-item.php')); } else { include(locate_template('template-parts/products/list-item-reco-little.php')); } } wp_reset_postdata(); } ?> </div> <?php endforeach; ?> </div> </div> <?php endif; ?> </div> <div class="px-5 lg:px-[60px]"> <div class="text-[13px] md:text-[15px] mt-8 lg:mt-[70px] text-grey-dark uppercase"> Related works </div> <script type="text/javascript"> var geometry = justifiedLayout([0.5, 1.5, 1, 1.8, 0.4, 0.7, 0.9, 1.1, 1.7, 2, 2.1]); </script> <div class="w-full lg:grid flex overflow-x-auto gap-4 mt-3 lg:gap-[30px] moz-hidden-scrollbar"> Custom Work <?php $featured_posts = get_field('you_might_also_be_interested_in'); if( $featured_posts ): ?> <ul> <?php foreach( $featured_posts as $post ): // Setup this post for WP functions (variable must be named $post). setup_postdata($post); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo $product->get_price(); ?></span> <?php echo get_the_post_thumbnail( $post, 'full' ); ?> <span>A custom field from this post: <?php the_field( 'field_name' ); ?></span> </li> <?php endforeach; ?> </ul> <?php // Reset the global post object so that the rest of the page works correctly. wp_reset_postdata(); ?> <?php endif; ?> End of Custom Work </div> <?php if ($parentCat !== 'Jewellery') : ?> <div class="w-full lg:grid lg:grid-cols-2 flex overflow-x-auto gap-4 mt-3 lg:gap-[30px] moz-hidden-scrollbar"> <?php $args = array( 'posts_per_page' => 2, 'post_type' => 'product', 'product_cat' => 'Work', 'order' => 'rand', 'post_status' => 'publish', 'post__not_in' => array($product_id), 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'artist_override', 'value' => get_the_id(), 'compare' => '!=' ) ) ); $wc_query = new WP_Query($args); if ($wc_query->have_posts()) { while ($wc_query->have_posts()) { $wc_query->the_post(); $product = wc_get_product(get_the_ID()); $price = $product->get_price(); $terms = get_the_terms(get_the_ID(), 'product_cat'); $term = $terms[0]->name; $mobile_class = in_array((floatval($wc_query->current_post) + 1), [3, 4]) ? 'hidden lg:block' : ''; $artist = get_field('multiple_artist_title') ? get_field('multiple_artist_title') : get_field('artist_override'); $no_magic_size = true; include(locate_template('template-parts/products/list-item-reco-big.php')); } wp_reset_postdata(); } ?> </div> <?php endif; ?> <?php wp_reset_postdata(); ?> <div class="w-full grid grid-cols-2 gap-4 grid-rows-1 lg:gap-[30px] lg:grid-cols-4 mt-4 lg:mt-[30px] lg:mb-[70px] mb-[30px]"> <?php $args = array( 'posts_per_page' => 4, 'post_type' => 'product', 'post__not_in' => array($product_id), 'product_cat' => $parentCat === 'Jewellery' ? 'Jewellery' : 'Shop', 'orderby' => 'rand', 'post_status' => 'publish', ); $wc_query = new WP_Query($args); if ($wc_query->have_posts()) { while ($wc_query->have_posts()) { $wc_query->the_post(); $product = wc_get_product(get_the_ID()); $price = $product->get_price(); $mobile_class = in_array((floatval($wc_query->current_post) + 1), [3, 4]) ? 'hidden lg:block' : ''; $artist = get_field('multiple_artist_title') ? get_field('multiple_artist_title') : get_field('artist_override'); include(locate_template('template-parts/products/list-item-reco-little.php')); } wp_reset_postdata(); } ?> </div> </div> <?php endwhile; ?> <?php get_footer(); ?>