Subversion Repositories SmartDukaan

Rev

Rev 11250 | Rev 11731 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
if(isset($product_details->entity) && !empty($product_details->entity)){
  $product_detail = $product_details->entity;
  if(isset($product_detail->items) && !empty($product_detail->items)) {
    $i=0;
     foreach ($product_detail->items as $item){
       if(isset($item->color) && !empty($item->color)){
          $color[$i]['color'] = $item->color;
          $color[$i]['id'] = $item->id;
          $i++;
       }
     }
  }
  $colorCount = sizeof($product_detail->items);
  $authorized = $this->session->userdata('authorized');
  if(isset($authorized['pincode']) && !empty($authorized['pincode'])){
    $pinCode = $authorized['pincode'];
  }
  elseif (isset($product_detail->pinCode) & !empty($product_detail->pinCode)) {
    $pinCode = $product_detail->pinCode;
  }
  $authorized = $this->session->userdata('authorized');
  if(isset($authorized['email']) && !empty($authorized['email'])){
    if(strpos($authorized['email'], 'anonymous') == false){
        $email = $authorized['email'];
    }
  }
  //print_r($product_detail);
?>  
<div id="error" class="error_msg" style="display:none"></div>    
<div class="pd_name">
        <div><?php echo $product_detail->name;?></div>
        <?php if(isset($product_detail->warranty) && !empty($product_detail->warranty)){?>
        <div><?php echo $product_detail->warranty;?></div><?php } ?>
      </div><!--pd-name-->
      <?php if(count($product_detail->images) == 1){?>
      <div class="pd-images tcenter rec-hldr" id="swipe_0">
        <div class="pd-wrapper">
          <div class="pd-image" style="background:url('<?php echo $product_detail->images[0]->url;?>')no-repeat center center;background-size:contain;"></div>
        </div>
      </div><!--pd-images-->
      <?php } else{ ?>
      <div class="pd-images">
        <div class="pd-wrapper">
          <?php foreach($product_detail->images as $image){?>
          <div class="pd-image" style="background:url('<?php echo $image->url;?>')no-repeat center center;background-size:contain;"></div>
          <?php } ?>
        </div>
      </div><!--pd-images-->
      <?php } ?>
            <div class="pd-price-cont clearfix">
        <div class="btn-hldr clearfix">
          <?php if(isset($color) && !empty($color) && count($color)>1){?>
          <div class="color-count">Choose Color(<?php echo $colorCount; ?>):</div>
          <?php if(isset($color) && !empty($color)){?>
          <select id="color" onchange="updateColor(event)">
            <?php
            foreach ($color as $key => $value) { ?>
            <option value="<?php echo $value['id'];?>"><?php echo $value['color']; ?></option>
            <?php  }  ?>
          </select>
          <?php } }elseif(isset($color) && !empty($color) && count($color)==1){?>
          <p class="tcenter">Available in <?php print_r($color[0]['color']);?> color</p>
          <?php }?>
        </div>
        <div class="price-hldr">
          <?php if(isset($product_detail->items[0]->mrp) || isset($product_detail->items[0]->sellingPrice)){?>
          <span id="rs">Rs</span><?php }?>
          <span id='mrp'><?php if(isset($product_detail->items[0]->mrp) && $product_detail->items[0]->mrp != 0){echo $product_detail->items[0]->mrp;} else { echo '';}?></span>
          <span id='sellingPrice'><?php if(isset($product_detail->items[0]->sellingPrice) && $product_detail->items[0]->sellingPrice != 0){echo $product_detail->items[0]->sellingPrice;} else { echo '';}?></span>
          <?php if(isset($product_detail->items[0]->discount) && !empty($product_detail->items[0]->discount)){?>
          <span id='discount'>(<?php echo $product_detail->items[0]->discount;?>% off)</span><?php } ?>
          <?php if(isset($product_detail->items[0]->minEmi)){?>
          <div id='emi'>EMI from Rs. <?php echo $product_detail->items[0]->minEmi;?> per month</div><?php } ?>
          <div id='comingSoon' style="display:<?php if(isset($product_detail->items[0]->comingSoon) && $product_detail->items[0]->comingSoon == 1){echo 'block';} else {echo 'none';};?>;color:red;">Coming Soon</div>
          <?php if(isset($product_detail->offerText)){?>
          <div class="pd-offer clearfix"><div>offer</div><div><?php echo $product_detail->offerText; ?></div></div><?php } ?>
        </div><!--price-hldr-->
      </div><!--pd-price-cont-->
            <input type="text" id="email" onFocus="clearError()" value="<?php if(isset($email) && !empty($email)) {echo $email;}?>" style="display:<?php if(strcasecmp($product_detail->items[0]->buttonText, 'notify me') == 0){ echo 'block';} else{ echo 'none';}?>" placeholder="Enter email address to recieve notification">
      <div id="buy" onclick="addToCart()"class="buy-now btn">
             <?php echo $product_detail->items[0]->buttonText; ?>
          </div>
      <div class="check-aval">
          <!-- <div>Check delivery time for Area PIN Code</div> -->
          <div class="clearfix">
            <input type="text" id="pincode" placeholder="Enter Pin Code.." value="<?php if(isset($pinCode) && !empty($pinCode)) echo $pinCode;?>"/>
            <div class="btn-blue btn" onclick="checkShipping()">
              Check Delivery Time
            </div>
          </div>
      </div><!--check-aval-->
      <div id="service" class="info-div">
          <?php if(($product_detail->logisticsInfo->delivery_estimate) && ($product_detail->logisticsInfo->delivery_estimate != -1)){?>
          <p>Free Delivery by&nbsp;<span id="delivery"><?php if(isset($product_detail->items[0]->comingSoon) && $product_detail->items[0]->comingSoon == 1){echo $product_detail->logisticsInfo->delivery_estimate.' after arrival';}else{ echo $product_detail->logisticsInfo->delivery_estimate; }?></span></p>
          <?php if(isset($product_detail->logisticsInfo->is_cod_available_for_location) && ($product_detail->logisticsInfo->is_cod_available_for_location) == 1){?>
          <p>You can pay by&nbsp;<span id="cod">Cash on Delivery</span></p><?php } ?>
        <div id="otg" class="clearfix" style="display:<?php if(isset($product_detail->logisticsInfo->on_time_guarantee) && !empty($product_detail->logisticsInfo->on_time_guarantee)) {echo 'block';} else { echo 'none';} ?>"><p>On Time Guarantee&nbsp;<span id="guarantee">Available</span></p></div>
      <?php } ?>
      </div><!--info-div-->
      <div style="display:<?php if(($product_detail->logisticsInfo->delivery_estimate) && ($product_detail->logisticsInfo->delivery_estimate == -1)){ echo 'block';} else { echo 'none'; }?>" id="error1"class="info-div"><div class="clearfix"><p>This loction is not serviceable</p></div></div>



      
        <div class="pd-tab clearfix" >
          <span>Highlights</span>
          <!-- <span>+</span> -->
        </div>
               
        <div class="pd-tab-open" id="tab1">
          <div class="detail-div">
          <?php foreach ($product_detail->keySpecs as $key => $value) {?>
          <div>
              <?php echo $value;?>
          </div>
          <?php } ?>
          </div>
        </div><!--pd-tab-open-->
         
     
        <div class="pd-tab clearfix" onclick="togglelist(event,'tab2')";>
          <span>Detailed Specifications</span>
          <span>+</span>
        </div>
        
          <div class="pd-tab-open" id="tab2" style="display:none;">
            <?php foreach ($product_detail->detailedSpecs as $specs) {?>
            <table>
            <tr>
            <th colspan="2"><?php echo $specs->title; ?></th>
            </tr>
            <?php foreach ($specs->specs as $item) {?>
            <tr>
              <td><?php echo $item->name;?></td>
              <td><?php echo implode('',$item->values);?></td>
            </tr>
            <?php }?>
          </table>
          <?php } ?>
          
        </div><!--pd-tab-open-->

        <?php if(isset($product_detail->packageContents) && !empty($product_detail->packageContents)):?>
        <div class="pd-tab clearfix" onclick="togglelist(event,'tab4')";>
          <span>Package Contents</span>
          <span>+</span> 
        </div>
        <div class="pd-tab-open" id="tab4" style="display:none;">
          <div class="detail-div">
          <?php foreach ($product_detail->packageContents as $key => $value) :?>
          <div>
              <?php echo $value;?>
          </div>
          <?php endforeach; ?>
          </div>
        </div><!--pd-tab-open-->
        <?php endif;?>

        <?php if(isset($product_detail->expertReviews) && !empty($product_detail->expertReviews)){?>
        <div class="pd-tab clearfix" onclick="togglelist(event,'tab3')";>
          <span>What experts say</span>
            <span>+</span>
        </div>
        <div id="tab3" class="pd-tab-open expert-review" style="display:none;">
          <?php foreach ($product_detail->expertReviews as $review) {?>
             <?php echo $review->review; ?>
             <div><?php echo $review->source; ?></div>
          <?php }?>
        </div>
        <?php } ?>
        <?php if(isset($product_detail->reocmmendedAccessories) && !empty($product_detail->reocmmendedAccessories)){?>
            <div class="recommended-pd">
        <div class="head">
        <div>Recommended Accessories</div>
        </div>
        <div class="rec-hldr" id="swipe_1">
        <div class="rec-wrapper">
        <?php foreach ($product_detail->reocmmendedAccessories as $item) { ?>
        <a class="rec-product" href="<?php echo $item->url;?>" onclick="trackAccessories('<?php echo $item->title;?>')">
          <img src="<?php echo $item->image_url; ?>" alt="recomended" />
          <div class="pd-name"><?php echo $item->title; ?> </div>
          <div class="pd-price"><span>Rs <?php if(isset($item->price)){echo $item->price;}else{echo '';}?></span><span>Rs <?php if(isset($item->mrp)){echo $item->mrp;}else{echo '';} ?></span></div>
        </a><!--rec-product-->
        <?php } ?>
        </div>
        </div><!--rec-hldr-->
      </div><!--recomended-pd-->
      <?php  } } ?>
      <script type="text/javascript">
      var items = <?php echo json_encode($product_detail->items);?>
      </script>
      <script type="text/javascript">

  var isIE10 = false;

  /*@cc_on

   if (/^10/.test(@_jscript_version)) {

   isIE10 = true;

   }

   @*/

  var iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g);

  var ua = navigator.userAgent;

  var userAgent = navigator.userAgent.toLowerCase();

  if (isIE10) {
       var a = document.getElementsByClassName('rec-hldr');
      
          for (var i = 0; i < a.length; i++) {
      
            a[i].style.overflowX = 'auto';
      
          }
      
        }
        
        else if (ua.indexOf("Android") >= 0) {

          var androidversion = parseFloat(ua.slice(ua.indexOf("Android") + 8));
        
         if (androidversion < 3.0) {

       var script = document.createElement("script");

      script.type = "text/javascript";

      script.src = base_url+'assets/js/iscroll.js'

      document.body.appendChild(script);

      script.onload = function() {

        var point, pointStartX, pointStartY, deltaX, deltaY;

        var i, scroller = [], len = document.getElementsByClassName('rec-hldr').length;

        var scrollerArray = document.getElementsByClassName('rec-hldr');

           for ( i = 0; i < scrollerArray.length; i++) {     

          var length = scrollerArray[i].children.length;

          scroller[i] = new iScroll("swipe_"+ i, {

            bounce : true,

            momentum : true,

            //hScroll: true,

            vScroll : false,

            hScrollbar : false,

            vScrollbar : false,

            snap : true,

            onBeforeScrollStart : function(e) {

              console.log("onBeforeScrollStart");

              point = e.touches[0];

              pointStartX = point.pageX;

              pointStartY = point.pageY; null;

            },

            onBeforeScrollMove : function(e) {

              console.log(e);

              point = e.touches[0];

              //alert("onBeforeScrollMove");

              deltaX = Math.abs(point.pageX - pointStartX);

              deltaY = Math.abs(point.pageY - pointStartY);

              if (deltaX >= deltaY) {
                e.preventDefault();

                // alert("horizontal");

              } else {

                //alert("vertical");

                null;

              }

            }
          });



        setTimeout(function() {

          for ( i = 0; i < len; i++) {

            scroller[i].refresh();

          }

        }, 100);
        }

      }
       }else {

      var a = document.getElementsByClassName('rec-hldr');

       for (var i = 0; i < a.length; i++) {

        a[i].style.overflowX = 'auto';

        a[i].style.webkitOverflowScrolling = 'touch';

      }

    }
    
    }else if (iOS) {

    if (navigator.userAgent.match(/(iPad|iPhone|iPod|iPod touch);.*CPU.*OS (6|7)_\d/i) ? true : false) {
    
     var a = document.getElementsByClassName('rec-hldr');
      for (var i = 0; i < a.length; i++) {
        a[i].style.overflowX = 'auto';
        a[i].style.overflowY = 'hidden';
        a[i].style.webkitOverflowScrolling = 'touch';
      }

    }else{
      
       var script = document.createElement("script");

      script.type = "text/javascript";

      script.src = base_url+'assets/js/iscroll.js'

      document.body.appendChild(script);

      script.onload = function() {

        var point, pointStartX, pointStartY, deltaX, deltaY;

        var i, scroller = [], len = document.getElementsByClassName('rec-wrapper').length;

        var scrollerArray = document.getElementsByClassName('rec-wrapper');

     

          //var length = scrollerArray[i].children.length;

          scroller[i] = new iScroll(swipe_1, {

            bounce : true,

            momentum : true,

            //hScroll: true,

            vScroll : false,

            hScrollbar : false,

            vScrollbar : false,

            snap : true,

            onBeforeScrollStart : function(e) {

              console.log("onBeforeScrollStart");

              point = e.touches;

              pointStartX = point.pageX;

              pointStartY = point.pageY; null;

            },

            onBeforeScrollMove : function(e) {

              console.log(e);

              point = e.touches;

              //alert("onBeforeScrollMove");

              deltaX = Math.abs(point.pageX - pointStartX);

              deltaY = Math.abs(point.pageY - pointStartY);

              if (deltaX >= deltaY) {
                e.preventDefault();

                // alert("horizontal");

              } else {

                //alert("vertical");

                null;

              }

            }
          });
      
    }
    
    }
    
    }else if (ua.indexOf("BlackBerry") >= 0 || ua.indexOf("BB10") >= 0) {

    var a = document.getElementsByClassName('rec-hldr');

    for (var i = 0; i < a.length; i++) {

      a[i].style.overflowX = 'auto';

      a[i].style.webkitOverflowScrolling = 'touch';
    }

  }

</script>