
<div class="osahan-breadcrumb">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12">
<?php 
                if(isset($single_product)){
                    if(count($single_product) > 0){

         ?>
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
                        <li itemprop="itemListElement" itemscope
                            itemtype="https://schema.org/ListItem" class="breadcrumb-item"><a itemtype="https://schema.org/Thing"
                                                                      itemprop="item"  href="<?php echo base_url();
                                                                      ?>"><span itemprop="name"><i class="icofont icofont-ui-home"></i> Home</span></a></a>
                            <meta itemprop="position" content="1" />
                        </li>
                        <?php $catslug = $single_product[0]->cat_slug;
                                $this->db->where('slug', $catslug);
                                $sq = $this->db->get('category');
                                if($sq->num_rows() > 0){
                                    $catresult = $sq->row();



                        ?><li itemprop="itemListElement" itemscope
                              itemtype="https://schema.org/ListItem" class="breadcrumb-item" >
                                    <a itemtype="https://schema.org/Thing"
                                       itemprop="item" href="<?php echo base_url('categories/').$catresult->slug;?>">
                                        <span itemprop="name"><?php echo
                                            $catresult->category_name;?></span>  </a>
                                    <meta itemprop="position" content="2" />
                                    </li>
                                <?php }?>
                        <li itemprop="itemListElement" itemscope
                            itemtype="https://schema.org/ListItem" class="breadcrumb-item" class="breadcrumb-item active" >
                            <a itemtype="https://schema.org/Thing"
                               itemprop="item" href="<?php echo base_url('product/').$single_product[0]->slug;?>">
                                <span itemprop="name"><?php echo $single_product[0]->name;?></span>
                                <meta itemprop="position" content="3" />
                            </a>
                        </li>
                   </ol>
</div>
</div>
</div>
</div>
<section class="products_page">
<div itemtype="http://schema.org/Product" itemscope>
<meta itemprop="mpn" content="<?php echo "XToysHub_".$single_product[0]->id;?>" />
                                    <meta itemprop="name" content="<?php echo $single_product[0]->name;?>" />
                                    <link itemprop="image" href="<?php echo base_url('uploads/resized/').$single_product[0]->img; ?>" />
                                    <meta itemprop="description" content="<?php echo $single_product[0]->m_des;?>" />
                                    <div itemprop="offers" itemtype="http://schema.org/Offer" itemscope>
                                        <link itemprop="url" href="<?php echo base_url('product/')
                                            .$single_product[0]->slug;?>" />
                                        <meta itemprop="availability" <?php if($single_product[0]->stock == 'yes'){?>content="https://schema.org/InStock" <?php }else{?> content="https://schema.org/OutOfStock" <?php }?> />
                                        <meta itemprop="priceCurrency" content="PKR" />
                                        <meta itemprop="itemCondition" content="https://schema.org/NewCondition" />
                                        <meta itemprop="price" content="<?php echo $single_product[0]->sail_price;?>" />
                                        <meta itemprop="priceValidUntil" content="2023-12-30" />
                                        <div itemprop="seller" itemtype="http://schema.org/Organization" itemscope>
                                            <meta itemprop="name" content="XToysHub.Pk" />
                                        </div>

                                    </div>
  <div class="container">
         <div class="row">
            <div class="col-lg-5 col-md-5" style=" border: 1px solid rgba(193, 193, 193, 0.4); ">
               <div class="shop-detail-left">
                  <div class="item-img-grid">
                        <div class="item"><img alt="<?php echo $single_product[0]->name;?>" src="<?php echo base_url('uploads/resized/').$single_product[0]->img; ?>" class="img-responsive img-center"></div>
                   
                  </div>
               </div>
            </div>
            <div class="col-lg-7 col-md-7">
<div class="shop-detail-right">
<div class="widget">
<div class="product-name">
<h3><?php echo $single_product[0]->name;?></h3>

  <?php
                                            $catslug = $single_product[0]->cat_slug;
                                            $this->db->where('slug', $catslug);
                                            $sq = $this->db->get('category');
                                            if($sq->num_rows() > 0){
                                                $catresult = $sq->row();

                                        ?>
                                                <b>Category:</b> <a href="<?php echo base_url('categories/').$catresult->slug;
                                                ?>"><strong class="text-info"><?php echo
                                                        $catresult->category_name;?></strong> </a>
                                                <?php   }?>
</div>
<div class="price-box">
<h5>
<span class="product-desc-price">Price : <?php echo $single_product[0]->price; ?> PKR</span>
<span class="product-price text-danger">Special Price <i class="icofont icofont-price"></i> <?php echo $single_product[0]->sail_price; ?> PKR</span>
<span class="badge badge-danger"><?php
                            $actual_price = $single_product[0]->price;
                            $sail_price = $single_product[0]->sail_price;
                            $remaing = $actual_price - $sail_price;
                            $parent = $remaing / $actual_price *100;
                            $roundamount = round($parent);
                            echo "- $roundamount%";
                            ?> Off</span>
</h5>
<h6><strong><span class="badge badge-success"></span>Size</strong> - <?php echo $single_product[0]->size; ?></h6>
<h6><strong><span class="badge badge-primary"></span>Imported From</strong> - <?php echo $single_product[0]->imported_from; ?></h6>

</div>
<div class="ratings">
<div class="stars-rating">
<?php
                                        if(isset($single_product)){
                                        if($single_product != 0){
                                        $total_stars = 0;
                                        $i = 1;
                                        $product_sl = $single_product[0]->slug;
                                        $dt = $this->db->where('product_slug',$product_sl);
                                        $dt = $this->db->where('status', 1);
                                        $dt = $this->db->get('reviews');
                                        if($dt->num_rows() > 0){
                                        $stt = $dt->result();
                                        foreach ($stt as $stars){
                                            $total_stars = $total_stars + $stars->stars;
                                        }
                                            $tnum = count($stt);
                                        $grand = $total_stars/$tnum;
                                        $fil = round($grand);
                                        while ($i <= 5){
                                        ?>
                                        <i <?php if($i <= $fil){ echo " class='icofont icofont-star active' "; } else{ echo " class='icofont icofont-star active-o' "; }?> ></i>
                                            <?php $i++; } ?>
<span>(<?php echo $tnum;?>)</span>
<span class="rating-links pull-right"> <a href="#"><?php echo $tnum;?> Review(s)</a> <span class="separator"> </span> <a href="#"><i class="icofont icofont-comment"></i> Add Your Review</a> </span>
 <div itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating" itemscope>
                                            <meta itemprop="reviewCount" content="<?php echo $tnum;?>" />
                                            <meta itemprop="ratingValue" content="<?php echo $fil;?>" />
                                        </div>
										   <div itemprop="review" itemtype="http://schema.org/Review" itemscope>

                                            <div itemprop="author" itemtype="http://schema.org/Person" itemscope>
                                                <?php
                                                $slugx = $single_product[0]->slug;
                                                $this->db->where('product_slug', $slugx);
                                                $this->db->where('status', 1);
                                                $ss = $this->db->get('reviews');
                                                if($ss->num_rows() > 0){
                                                    $nameofrat = $ss->result();
                                                    foreach ($nameofrat as $person){
                                                        ?>
                                                <meta itemprop="name" content="<?php echo $person->name;?>" />
                                                <?php } }?>

                                            </div>

                                            <?php
                                            $slugx = $single_product[0]->slug;
                                            $this->db->where('product_slug', $slugx);
                                            $this->db->where('status', 1);
                                            $ss = $this->db->get('reviews');
                                            if($ss->num_rows() > 0){
                                            $nameofrat = $ss->result();
                                            foreach ($nameofrat as $person){
                                            ?>
                                            <div itemprop="reviewRating" itemtype="http://schema.org/Rating" itemscope>
                                                <meta itemprop="ratingValue" content="<?php echo $person->stars;?>" />
                                                <meta itemprop="bestRating" content="5" />
                                            </div>
                                            <?php } }?>
                                        </div>
										 <meta itemprop="sku" content="<?php echo $single_product[0]->slug.$single_product[0]->id;?>" />
                                    <div itemprop="brand" itemtype="http://schema.org/Brand" itemscope>
                                        <meta itemprop="name" content="XToysHub.Pk" />
                                    </div>
                                    <?php  }else{ ?>
                                    <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i>
                                    <?php } } } ?>
</div>
</div>
<div class="short-description">
<h4>
Quick Overview
<span class="pull-right">Availability: <?php if
                                            ($single_product[0]->stock == 'yes'){?> <strong class="badge badge-success">In Stock</strong></span><?php }else{
                                                echo "<b style='color: red;'>Out of 
                                                Stock</b>";}?> 
											
</h4>
<p>
 <?php 
                                            echo $single_product[0]->short_description;
                                     ?>
</p>

</div>
<div class="mt-3">
<button type="button" class="btn btn-primary btn-lg" onclick="window.location.href='<?php echo base_url('online_order/').$single_product[0]->slug;?>';">
                                        <i class="icofont icofont-shopping-cart"></i>
                                         Order Now</span>
                                    </button>
                                    <button type="button" class="btn btn-success btn-lg" onclick="window.location.href='https://api.whatsapp.com/send?phone=923401230101&text=Hello, I want to purchase:*<?php echo $single_product[0]->name;?>* Price:*<?php echo $single_product[0]->sail_price;?> URL:*<?php echo base_url('product/')
                                            .$single_product[0]->slug;?>* Thank You !';">
                                        <i class="fa fa-whatsapp"></i> Order Via Whatsapp
                                    </button>
                            </div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="det" class="pb-5 pt-0 shop-single-detail bg-light">
<div class="container">
	    <?php
              $success = $this->session->flashdata('success');
               if(isset($success)){  ?>
           <div class="alert alert-success" style=" color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; ">
              <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
              <?php echo $this->session->flashdata('success');?>
          </div>
		   <?php } ?>
<div class="row">
<div class="col-md-12">
<div class="rounded shadow-sm bg-white">
<ul class="nav nav-pills p-3" id="pills-tab" role="tablist">
<li class="nav-item"> <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Description</a>
</li>
<li class="nav-item"> <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Tags</a>
</li>
<li class="nav-item"> <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Reviews (<?php echo $tnum;?>)</a>
</li>
</ul>
<div class="tab-content p-4 border-top" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
 <div class="table-responsive">
<?php 
                                            echo $single_product[0]->des;
                                     ?>
                                     	                                    <hr>
	                                    <p>Buy <a href="<?php echo base_url('product/').$single_product[0]->slug;?>"> <?php echo $single_product[0]->name;?> </a> At Starting Price Of Rs <?php echo $single_product[0]->sail_price;?> PKR - Available In Karachi | Lahore | Peshawar | Quetta | Rawalpindi | Bahawalnagar | Bahawalpur | Attock | Gujranwala | Gujrat | Gwadar | Hyderabad | Jhelum | Kasur | Larkana | Mansehra | Mardan | Mianwali | Muzaffargarh | Nawabshah | Nowshera | Rahim Yar Khan | Sahiwal | Sargodha | Sialkot | Sukkur | Swabi | Vehari | Chakwal | Faisalabad | Gilgit | Wazirabad | Mandi Bahaudin | Dera Ghazi Khan | Dera Ismail Khan | Azad kashmir And All Other Major Cities Of Pakistan.How To Use,Shopping Online,Order Online,How To Buy Original,Contact Number,Official Website,Online Purchase,Review,Side Effects,Customer Reviews,FAQ</p>
	                                    </div>
</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
<ul class="widget-tag-btn">
                                    
 <?php
//                                $ip = $this->input->ip_address();
//                                echo $ip;
                                $tag = $single_product[0]->tags;
                                if($tag != ''){
                                    $tagsi = explode(',', $tag);
//                                print_r($tagsi);
                                    if($tagsi != ''){
                                foreach ($tagsi as $tagx){
                                ?>
                                    <li> <a href="<?php echo base_url('tag/').$slug = preg_replace('/[^a-z0-9]+/i',
                                                '-', $tagx );?>" class="tag"><?php echo $tagx;?></a> </li>
                                <?php } } }?>
</ul>
</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">

<div class="row">
<div class="col-sm-12">
<div class="widget reviews-section-comment mb18">
<h3>Customers Reviews For <?php echo $single_product[0]->name;?> </h3>
<?php
                                    if(isset($single_product)){
                                        if($single_product != 0){
                                            $product_sl = $single_product[0]->slug;
                                            $dt = $this->db->where('product_slug',$product_sl);
                                            $dt = $this->db->where('status', 1);
                                            $dt = $this->db->get('reviews');
                                            if($tnum = $dt->num_rows() > 0){

                                                $str = $dt->result();
                                                foreach ($str as $datast){
                                                    $x = 1;
//                                                    $tot = 0;
//
//                                                    foreach ($str as $strd){
//                                                        $tot = $tot + $strd->stars;
//                                                    }
//                                                    $bb = $tot/$tnum;
//                                                    $all_stars = round($bb);
                                ?>
<div class="row">

<div class="col-sm-3">
<div class="review-block-name"><a href="#"><i class="icofont icofont-ui-user"></i> <?php echo $datast->name;?>  <small style="font-size: 14px; color: green;"><i class="fa fa-check-circle"></i> Verified Purchase</small></a></div>
<div class="review-block-date"><i class="icofont icofont-ui-calendar"></i> <?php echo $datast->date;?></div>
</div>
<div class="col-sm-9">
<div class="review-block-title">
<span class="stars-rating"> 
<?php
$all_stars = $datast->stars;
                                        while($x <= 5){
                                        ?>
                                            <i <?php if($x <= $all_stars){ echo "class='icofont icofont-star active'"; }else{ echo "class='icofont icofont-star active-o'"; }?> ></i> <?php $x++; } ?>
</span>
</div>
<div class="review-block-description"><?php echo $datast->review;?></div>
</div>
</div>
<hr />
<?php } } } } ?>			
</div>
</div>
</div>
<div class="p-4 bg-light rounded mt-4">
<h5 class="card-title mb-4">Leave a Review</h5>
<form autocomplete="off" action="<?php echo base_url('Order/rating/'); ?>" method="post" class="comment-form m-0">
<div class="row">
<div class="control-group form-group col-lg-4 col-md-4">
<div class="controls">
<label>Your Name <span class="text-danger">*</span></label>
<input type="text" name="name" class="form-control" required="">
<input type="hidden" value="<?php echo $single_product[0]->slug; ?>" name="product_slug" class="form-control">
</div>
</div>
<div class="control-group form-group col-lg-4 col-md-4">
<div class="controls">
<label>Your Email <span class="text-danger">*</span></label>
<input type="email" name="email"  class="form-control" required="">
</div>
</div>
<div class="control-group form-group col-lg-4 col-md-4">
<div class="controls">
<label>Rating <span class="text-danger">*</span></label>
 <select name="stars" class="req form-control" id="rat">
                                                    <option value="1">1 Star [Worst]</option>
                                                    <option value="2">2 Star [Poor]</option>
                                                    <option value="3">3 Star [Average]</option>
                                                    <option value="4">4 Star [Very Good]</option>
                                                    <option value="5" selected="">5 Star [Excellent]</option>
                                                </select>
</div>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Review <span class="text-danger">*</span></label>
<textarea rows="3" cols="100" name="review" class="form-control"></textarea>
</div>
</div>
<div class="text-right">
<button type="submit" class="btn btn-primary">Submit Now</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="categories-list">
<div class="container">
<div class="section-header">
<h5 class="heading-design-h5">
RELATED PRODUCTS</h5>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="single-categorie">
<div class="owl-carousel owl-carousel-featured">
<?php 
                    $cslug = $single_product[0]->cat_slug;

                    $rel = $this->db->where('cat_slug', $cslug);
                    $rel = $this->db->get('product');
                    if($rel->num_rows() > 0){
                        $related = $rel->result();
                     
                        foreach ($related as $reldata) {
                           if($single_product[0]->slug != $reldata->slug){
                     ?>
<div class="item">
<div class="h-100">
<div class="product-item">
<span class="badge badge-danger offer-badge">HOT</span>
<div class="product-item-image">
<span class="like-icon"><a href="<?php echo base_url('product/').$reldata->slug; ?>"></a></span>
<a href="<?php echo base_url('product/').$reldata->slug; ?>"><img class="card-img-top img-fluid" src="<?php echo base_url('uploads/thumbs/').$reldata->img; ?>" alt="<?php echo $reldata->name; ?>"></a>
</div>
<div class="product-item-body">
<div class="product-item-action">
<a data-toggle="tooltip" data-placement="top" title="Add To Cart" class="btn btn-theme-round btn-sm" href="<?php echo base_url('online_order/').$reldata->slug; ?>"><i class="icofont icofont-shopping-cart"></i></a>
<a data-toggle="tooltip" data-placement="top" title="View Detail" class="btn btn-theme-round btn-sm" href="<?php echo base_url('product/').$reldata->slug; ?>"><i class="icofont icofont-search-alt-2"></i></a>
</div>
<p class="card-title"><a href="<?php echo base_url('product/').$reldata->slug; ?>"><?php echo $reldata->name; ?></a></p>
<p>
<span class="product-desc-price">Rs : <?php echo $reldata->price; ?></span>
<span class="product-price">Rs : <?php echo $reldata->sail_price; ?></span>
<span class="product-discount"><?php
                                $actual_price = $reldata->price;
                                if($actual_price != 0) {
                                    $sail_price = $reldata->sail_price;
                                    $remaing = $actual_price - $sail_price;
                                    $parent = ($remaing * 100) / $actual_price;
                                    $roundamount = round($parent);
                                    echo "- $roundamount%";
                                }
                            ?> Off</span>
</p>
</div>
<div class="product-item-footer">
<div class="stars-rating">
<?php

                                       $total_stars = 0;
                                       $i = 1;
                                       $product_sl = $reldata->slug;
                                       $dt = $this->db->where('product_slug',$product_sl);
                                       $dt = $this->db->where('status', 1);
                                       $dt = $this->db->get('reviews');
                                       if($dt->num_rows() > 0){
                                           $stt = $dt->result();
                                           foreach ($stt as $stars){
                                               $total_stars = $total_stars + $stars->stars;
                                           }
                                           $tnum = count($stt);
                                           $grand = $total_stars/$tnum;
                                           $fil = round($grand);
                                           echo "Review ($tnum)";
                                           while ($i <= 5){
                                               ?>
                                               <i <?php if($i <= $fil){ echo " class='icofont icofont-star active' "; } else{ echo " class='icofont icofont-star active-o' "; }?> ></i>
                                               <?php $i++; }?>

                                           <?php } ?>
</div>
</div>
</div>

</div>
</div>
	 <?php } } } ?>
</div>
<?php }else{ ?>
                        <div class="col-md-12" style="padding:
                            165px;">
                            <div class="col-md-8" style="margin:0 auto; float: none; text-align: center; ">
                                <h1>Sorry no data found</h1>
                                <h2><a href="<?php echo base_url();?>">Go to Home Page</a></h2>
                            </div>
                            <!-- /.col-md-6 -->
                        </div>
                        <!-- /.col-md-12 -->
                        <?php
                    } }else{ ?>
        <h1 style="text-align: center;">WELCOME TO <a href="<?php echo base_url(); ?>">XToysHub.Pk</a></h1>
    <?php } ?>
</div>

</div>

</div>

</div>

</section>
  