<?php 
$accessories = get_post_meta(get_the_ID(), 'product_accessories', true);

if (!empty($accessories)):
    $accessories = json_decode($accessories, true);

  
?>
<div class="container">
<div class=" m-0 p-0 pt-5 pb-5">
 <div class=" m-0 overflow-hidden ">
<div class="heading-block border-bottom-0 text-center" data-animate="zoomIn" >

<h2 class="text-transform-none fw-semibold mb-1 "><?php echo esc_attr( $instance['title']); ?></h2>
</div>
</div>

<div class="row ">
<?php
    foreach ($accessories as $accessory):
        
        $product_id = $accessory['value'];
	 $drone_image = get_post_meta($product_id, 'product_image', true);
	     $drone_image = swap_get_image_url($drone_image);
	    
if (empty($drone_image)) $drone_image = TMPL . 'assets/assets/images/logo.svg';
        
        ?>

<div class="col-lg-4 col-sm-6 mb-5">
<a href="<?php echo get_permalink( $product_id); ?>"><div class="feature-box hover-effect h-p  fbox-center fbox-bg fbox-light fbox-lg ">
<div class="fbox-icon p-icon">
<i ><img src="<?php echo esc_url($drone_image); ?>" class="border-0 bg-transparent " data-animate="fadeInRight"  style="z-index: 2;" alt="<?php echo get_the_title($product_id); ?>"></i>
</div>
<div class="fbox-content">
<h3 class="mb-4 text-transform-none ls-0"><a href="<?php echo get_permalink($product_id ); ?>" class="text-dark"><?php echo get_the_title($product_id); ?></a></h3>
<p class="mb-4"><?php
                                $excerpt = get_the_excerpt($product_id);
                                echo string_limit_words($excerpt, 15) . '...';?>

</div>
<a href="<?php echo get_permalink($product_id ); ?>" class="btn btn-success " type="submit" data-animate="fadeInLeft">View Details</a>

</div></a>
</div>

<?php
	endforeach; ?>


</div>

	</div>
</div>

 <?php   
    

endif;?>