PATH:
home
/
niazsaze
/
public_html
/
wp-content
/
plugins
/
flatsome-plus
/
template
/
amazing-slider
/
layout-2
<?php $params = array( 'post_type' => 'product', 'meta_key' => 'include_amazingwrap_option', 'meta_value' => 'yes', 'posts_per_page' => fplus_helper::amazing_slider_option('amazing_per_page',5) ); $querys = wc_get_products($params); $products = []; $valuess = []; $first_children_type = ''; foreach ($querys as $tmp) { if ($tmp->is_type( 'variable' )) { $children_product = $tmp->get_children(); if(count($children_product) >=1){ $first_children_type = $children_product[0]; } $variation = wc_get_product($first_children_type); $valuess = $variation ? get_post_meta($variation->get_parent_id(), 'description_amazing_option') : ''; $products[] = $variation; } else { $products[] = $tmp; } } $image_end_discount = FLATSOMEPLUS_ASSET .'img/finist.png'; $img_id = fplus_helper::amazing_slider_option('finish_amazing_time','متن پیشفرض'); if( $img_id ) { $img_src = wp_get_attachment_image_src($img_id,'medium'); if( $img_src ) { $image_end_discount = $img_src[0]; } } ?> <section id="shop-carousel" class="main-carousel"> <div class="backimgright"></div> <div class="backimgleft"></div> <div class='carousel-next'> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/> </svg> </div> <div class='carousel-prev'> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/> </svg> </div> <?php $i=0; foreach($products as $product): $sale = 0; if( !$product ) { continue; } if( is_numeric( $product->get_price() ) && $product->get_price() != 0 ) { $sale = round((1-$product->get_price()/$product->get_regular_price())*100); } ?> <div class="carousel-item <?php if($sale==0) { ?>no-sale<?php } ?> <?php if($i==0) { ?>carousel-item--active<?php } ?>" data-slide-id="<?php echo $i;?>"> <div class="carousel-item--data"> <div class="no-sale-image"> <img src="<?php echo $image_end_discount; ?> " alt="ranout"> </div> <div class="carousel-image"> <div class="carousel-special-offer-badge"><?php echo fplus_helper::amazing_slider_option('title_amazing_slider','متن پیشفرض'); ?></div> <?php echo $product->get_image('shop_catalog');?> <?php if ( $product->is_on_sale() ) { ?> <div class="timemande" > زمان باقی مانده تا اتمام تخفیف </div> <?php $sale_date_end = get_post_meta( $product->get_id(), '_sale_price_dates_to', true ); $sale_date_start = get_post_meta( $product->get_id(), '_sale_price_dates_from', true ); echo fplus_helper::flatplus_count_down( $product,'amazing-slider-timer-layou-2' ); } ?> </div> <div class="carousel-title-container"> <h3 class="carousel-title"> <a href="<?= $product->get_permalink();?>"><?=$product->get_title()?></a> </h3> </div> <div class='carousel-utilities'> <?php if( $product->get_type() !== 'simple' ) { $parentData = $product->get_parent_id(); $variableProduct = new WC_Product_Variable($parentData); $allVariations = $variableProduct->get_available_variations(); } if(isset($allVariations) && count($allVariations) >=1){ foreach($valuess as $value){ echo htmlspecialchars_decode(stripslashes($value)); } } $values = get_post_meta($product->get_id(), 'description_amazing_option'); if(is_array($values)): foreach($values as $value): ?> <?= htmlspecialchars_decode(stripslashes($value)) ?> <?php endforeach;?> <?php endif?> </div> <div class="carousel-off"> <div> <small>قیمت اصلی محصول : <?php if(isset($allVariations) && $allVariations):?> <?php echo is_float($allVariations[0]['display_regular_price'])?number_format($allVariations[0]['display_regular_price']) : number_format($allVariations[0]['display_regular_price']);?> <?php endif?> <span class="item-real-price"><?php echo is_string($product->get_regular_price()) ? wc_price($product->get_regular_price()) : wc_price($product->get_regular_price()) ;?></span> </small> <span class="pricee">قیمت با <?php if( $product->get_price() != 0 && $product->get_regular_price() && $product->get_price() !== $product->get_regular_price() ): ?> <span class='off-amount'><b><?php echo round((1-$product->get_price()/$product->get_regular_price())*100) ?>%</b></span> <?php endif; ?> تخفیف محصول : <?php if($product->get_sale_price() != 0): ?> <span class="item-sell-price"><b><?= is_string( $product->get_sale_price() ) ? wc_price($product->get_sale_price()) : wc_price($product->get_sale_price())?></b></span> <?php endif;?> </span> </div> </div> </div> <div class="add-to-cart"> <a id="add-to-cart" href="<?= $product->get_permalink();?>"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#fff" class="bi bi-cart-fill" viewBox="0 0 16 16"> <path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .491.592l-1.5 8A.5.5 0 0 1 13 12H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/> </svg> <span> مشاهده و خرید </span> </a> </div> </div> <?php $i++; endforeach;?> <div class="carousel-swiper"> <ul class="carousel-swiper-slides "> <?php $i=0; foreach($products as $product):?> <?php if( !$product ) continue; ?> <li class="swiper-slide <?php if ( is_admin() ) { echo "adminpanel"; }elseif($i==0) {?>swiper-slide--active<?php } ?>" data-slide-id="<?php echo $i?>"><?=$product->get_title()?></li> <?php $i++; endforeach;?> </ul> </div> </section> <?php
[-] index.php
[edit]
[+]
..