Subversion Repositories SmartDukaan

Rev

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

<!-- template for deals tab -->
<script>
  $(document).ready(function(){
    $('.uvideo').click(function(){
      var source= $(this).data('source');
      // alert(source);
      $('#content-add').empty();
      var content = "<iframe width='100%' height='100%' src='http://www.youtube.com/embed/"+source+"?autoplay=1'></iframe>"
      $('#content-add').append(content);
      $('#videoModal').modal('show');
    });
    
    $('.close').click(function(){
      $('#videoModal').modal('hide');
      $('.text-center').empty();
    });

    $('#videoModal').click(function(){
      $('#content-add').empty();
      // $('.text-center').append('<img src="/img/ajax-loader.gif"/>');
    });

    $('.see_more_link a').click(function(){
       $('#loadingModal').modal('show');
    });
    setTimeout(function () {$('.carterror').fadeOut('slow');}, 20000);
  });
</script>

<div class="modal fade" id="videoModal">
  <div class="modal-dialog">
    <div class="modal-content">      
      <div class="modal-body">
        <div class="text-center" id='content-add'>
                 
        </div>        
      </div>      
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div>

<?php echo $this->element('unlikemodal');?>

<?php //debug($deals)?>

<?php if(isset($errorstr) && !empty($errorstr)):?>
        <div class="alert alert-warning carterror">
    <a href="#" class="close" data-dismiss="alert">&times;</a>
    <?php echo $errorstr;?>
</div>
<?php endif;?>

<?php if($response_count ==1 && empty($deals)):?>
  <div class="text-center">
  <span class="nodeals" data-href="<?php echo $base_url;?>search/?user_id=<?php echo $logged_user['id'];?>">Didn't find your deal? Search for it</span>
</div>
<br><br><br>
<?php else:?>

<?php if(!empty($deals) && !empty($deals[0])):?>
    <?php foreach($deals AS $dealarray):?>
    <div class="row card">   

    <?php foreach ($dealarray as $key => $deal) :?>
    <?php //debug($deal);?>
    <?php if(empty($deal))continue;?> 
     <?php if (!empty($deal['dealObject'])):?>
        

     <!-- <dealobject part start here> -->

     <?//debug($deal);?>
      <div class="subcard">
        <div class="col-xs-4">
          <?php if($key == 0):?>
          
          <div class="img-overlay">
                  <!-- <div class="product_actions like">
                    <span data-id="<?php //echo $deal['_id'];?>" class="likedeal <?php //if(isset($likedDeals[$deal['_id']])):?>active<?php //endif;?>">
                    </span>
                  </div>  -->
                  <div class="productthumb viewproduct" data-id="<?php echo $deal['_id'];?>">
                  <img src="<?php echo $base_url;?>app/webroot/timthumb.php?src=<?php echo urlencode ($deal['img_url']);?>&h=100&q=95" />
                  </div>
                  
                 <!-- <div class="product_actions dislike">
                    <span data-id="<?php //echo $deal['_id'];?>" class="dislikedeal <?php //if(isset($disLikedDeals[$deal['_id']])):?>active<?php //endif;?>">
                    </span>
                  </div>  --> 
                          </div>
          
          
          <?php else:?>
                  <span class="pull-right arrowright"></span>
                <?php endif;?>
        </div>

        <div class="col-xs-8">
          <?php if(isset($deal['link1']) && !empty($deal['link1'])):?>
          <div class="text-small" );?>
            <?php echo $deal['link1'];?>
          </div>
          <?php endif;?>
          
          <?php if(isset($deal['link2']) && !empty($deal['link2'])):?>
          <div class="text-small" );?>
            <?php echo $deal['link2'];?>
          </div>
          <?php endif;?>

          <?php if(isset($deal['link3']) && !empty($deal['link3'])):?>
          <div class="text-small" );?>
            <?php echo $deal['link3'];?>
          </div>
          <?php endif;?>

          <?php if(isset($deal['link4']) && !empty($deal['link4'])):?>
          <div class="text-small" );?>
            <?php echo $deal['link4'];?>
          </div>
          <?php endif;?>

          <?php if(isset($deal['link5']) && !empty($deal['link5'])):?>
          <div class="text-small" );?>
            <?php echo $deal['link5'];?>
          </div>
          <?php endif;?>

        </div>
      </div>


     <!-- <dealObject part end here> -->
        
     <?php else:?>
      <?php //debug($deal);?>
        <div class="subcard">
        <div class="col-xs-4 productimage">
          <?php if($key == 0):?>
                  <div class="img-overlay">
                  <div class="product_actions likeit" data-id="<?php echo $deal['_id'];?>" name="likediv_<?php echo $deal['_id'];?>">
                    <span class="likedeal <?php if(isset($likedDeals[$deal['_id']])):?>active<?php endif;?>">
                    </span>
                  </div>
                  <div class="productthumb viewproduct" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                  <img src="<?php echo $base_url;?>app/webroot/timthumb.php?src=<?php echo urlencode($deal['thumbnail']);?>&h=100&q=95" />
                  </div>
                  <div class="product_actions dislikeit" data-id="<?php echo $deal['_id'];?>" name="dislikediv_<?php echo $deal['_id'];?>">
                    <span class="dislikedeal <?php if(isset($disLikedDeals[$deal['_id']])):?>active<?php endif;?>">
                    </span>
                  </div>
                          </div>
          
                <?php else:?>
                  <span class="pull-right arrowright"></span>
                <?php endif;?>
          
        </div>

                <div class="col-xs-8 <?php if($key == 0):?>productdetails<?php else:?>productsmalldetails<?php endif;?>" data-id="<?php echo $deal['_id'];?>">
                        <?php if($key == 0):?>
                        <div class="product_title">
                        <h5 class="producttitle viewproduct" data-id="<?php echo $deal['_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-source="<?php echo $deal['source_id'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                <?php echo $deal['source_product_name'];?>
                        </h5>
                        </div>
                        
                        <?php endif;?>
                        <div class="col-xs-6 productpricedetails">
                                <?php if($key == 0):?>
                                <div class="viewproduct <?php if(strlen(strip_tags($deal['tagline'],'<p>')) == strlen($deal['tagline'])):?>product_short_description<?php endif;?> <?php if(!isset($deal['tagline'])):?>hidden<?php endif;?>" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>"  data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                    <?php //echo $deal['tagline'];?>
                    <?php 
                        $str1=preg_replace('/<\/p>/i', '', $deal['tagline']);
                        if($str1 != $deal['tagline']) {
                          $str=preg_replace('/<p[^>]*>/i', '', $str1);
                          echo $str;
                        } else {
                          echo $deal['tagline'];
                        }
                    ?>
                        </div>
                        <?php endif;?>
                                <?php if((isset($deal['showMrp']) && ($deal['showMrp']==1) && isset($deal['mrp']) && ($deal['mrp']>0))) :?>
                          <div class="text-small">
                            
                            <?php if(isset($deal['showMrp']) && ($deal['showMrp']==1) && isset($deal['mrp']) && ($deal['mrp']>0)):?>
                              <?php if(isset($deal['quantity']) && $deal['quantity']>1):?>
                                MRP <span class="cashbackrupee"></span> <?php echo round(($deal['mrp']/$deal['quantity']), 2);?>/- per unit.(Total <span class="cashbackrupee"></span> <?php echo $deal['mrp']?>)
                              <?php else:?> 
                                MRP <span class="cashbackrupee"></span><span style="font-size:14px; color:#ff0000"><strong><?php echo $deal['mrp'];?></strong></span>
                              <?php endif;?>
                            <?php endif;?>
                
                          </div>
                           <?php endif;?>
                        
                        <?php if(isset($deal['ppq']) && !empty($deal['ppq']) &&($deal['ppq']>0)):?>
                           <div class="text-small" );?>
                              <span class="rupee"></span><span style="font-size:14px; color:#ff0000"><strong><?php echo $deal['ppq'];?></strong></span> /- per unit.
                            </div>
                          <?php endif;?>
                        
                        <div <?php if(!empty($deal['coupon'])):?>style="margin:0 !important"<?php endif;?> class="product_prices viewproduct" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>" <?php if($key > 0):?>style='margin:0;'<?php endif;?>>
                            <div>
                              <?php if($key == 0 && isset($deal['showDp']) && $deal['showDp']==1 && !empty($deal['dp'])):?>
                              <div class="dp">DP <span class="cashbackrupee"></span> <?php echo $deal['dp'];?></div>
                              <?php endif;?>
                              <span class="rupee"></span>
                              <?php if(isset($deal['gross_price']) && $deal['gross_price']>$deal['available_price']):?>
                                <span class="red pt2"><?php echo intval($deal['gross_price']);?></span>
                              <?php else:?>
                                <span class="product_price" data-did="<?php echo $deal['_id']; ?>"><?php echo intval($deal['available_price']);?></span>
                              <?php endif;?>
                              <?php if(isset($deal['cash_back_type']) && !empty($deal['cash_back_type']) && $deal['cash_back_type']!=0 && $deal['cash_back']>0):?>&nbsp;+
                                <?php if($deal['cash_back_type'] == 2):?>
                                  <span class="cashbackrupee"></span> <span class="cashback"><?php echo $deal['cash_back'];?></span>   
                                <?php else:?>
                                  <?php echo $deal['cash_back'];?> %
                                <?php endif;?> 
                                Cashback
                              <?php endif;?>
                            </div>
                          </div> 
                          
                          <?php if(isset($deal['gross_price']) && $deal['gross_price']>$deal['available_price']):?>
                          <div class="text-small viewproduct" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                            Paytm cashback <?php echo ($deal['gross_price']-$deal['available_price']);?><br/> Net Price = <span class='product_price'><span class="rupee"></span> <?php echo $deal['available_price'];?></span>
                          </div>
                          <?php endif;?>
                          
                          <?php if(isset($deal['coupon']) && !empty($deal['coupon'])):?>
                          <div class="text-small viewproduct" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                            Use Coupon <span class="red"><?php echo $deal['coupon'];?></span>
                          </div>
                          <?php endif;?>
                          
                          <?php if(isset($deal['codAvailable']) && !$deal['codAvailable']):?>
                          <div class="text-small viewproduct" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                            (COD not available)
                          </div>
                          <?php else:?>
                            <?php if($key!=0):?>
                            <div class="text-small viewproduct" data-id="<?php echo $deal['_id'];?>" data-source="<?php echo $deal['source_id'];?>" data-url="<?php echo $deal['marketPlaceUrl'];?>" data-price="<?php echo intval($deal['available_price']);?>">
                              (COD available)
                            </div>
                            <?php endif;?>
                          <?php endif;?>
                          
                          <div class="dealoffer <?php if(!isset($deal['offer']) || empty($deal['offer'])):?>hidden<?php endif;?> row">
                              <div class="<?php if(strlen(strip_tags($deal['offer'],'<p>')) == strlen($deal['offer'])):?>offerhasnohtml<?php endif;?> offertext" data-fulltext="<?php echo strip_tags($deal['offer']);?>">              
                                <?php //echo $this->Text->truncate($deal['offer'],140);?>
                                <?php 
                                  if(strlen($deal['offer'])>0){
                                    echo $deal['offer'];
                                  } 
                                  else if($deal['source_id'] == 4){ 
                                    echo "Exclusive price @ProfitMandi";
                                  } 
                                ?>
                              </div>
                
                          </div>
                          
                          <?php if(isset($deal['videoLink']) && !empty($deal['videoLink'])):?>
          
                          <div class="text-small" style = "padding-top:4px;padding-bottom:4px;">
                            <button type="button" class="btn btn-default btn-sm uvideo" data-source="<?php echo $deal['videoLink'];?>">
                              <span class="glyphicon glyphicon-play-circle"></span> Play Video
                            </button>
                          </div>
                          <?php endif;?>
                          
          <?php if(isset($deal['filterLink']) && !empty($deal['filterLink']) && isset($deal['filterText']) && !empty($deal['filterText'])):?>
          <div class='see_more_link'>
              <?php if(count($dealarray) >1):?>
                <?php if($key == 1):?>
                  <a href = <?php echo $deal['filterLink'];?> style='color:#737373;'><u><?php echo $deal['filterText'];?></u></a>
                <?php endif;?>
              <?php else:?>
                <a href = <?php echo $deal['filterLink'];?> style='color:#737373;'><u><?php echo $deal['filterText'];?></u></a>
              <?php endif;?>
          </div> 

          <?php endif;?>
                          <?php $colors=0;
                          $colorsAvailable = array();
                          if($deal['source_id']==4  && isset($deal['availabilityInfo']) && count($deal['availabilityInfo']) >1){
                              foreach ($deal['availabilityInfo'] as $key => $value){
                                  if($value['color']!=''){
                                     $colors= $colors+1;
                                     if($value['availability']>0){
                                        array_push($colorsAvailable,$value);
                                     }
                                  }
                              }
                          }
                          ?>
                                <?php if($colors>1 && count($colorsAvailable)>1):?>
                                  <div  class="see_more_colors" data-id="<?php echo $deal['skuBundleId']?>">
                             <span class="morecolors"><u>View More Colors</u></span>
                            </div>
                                <?php endif;?>
                          
                        </div>
                        
                        <?php if($deal['source_id']==4):?>
                        <?php if(isset($deal['availabilityInfo']) && count($deal['availabilityInfo'])>0):?>
                        <div class="col-xs-2 cartaddition">
                                <div class="input-group number-spinner" data-name="<?php echo $deal['source_product_name'];?>" data-brand="<?php echo $deal['brand'];?>">
                                        <span class="input-group-btn data-up">
                                                <button class="btn btn-default plusqtybutton" data-id="<?php echo $deal['availabilityInfo'][0]['item_id'];?>" data-price="<?php echo intval($deal['availabilityInfo'][0]['sellingPrice']);?>" data-did="<?php echo $deal['_id'];?>" data-dir="up"><span class="glyphicon glyphicon-plus plusqty"></span></button>
                                        </span>
                                        <input type="text" class="itemquantity" value="0" min="0" max="<?php echo $deal['availabilityInfo'][0]['maxQuantity'];?>" data-did="<?php echo $deal['_id'];?>">
                                        <span class="input-group-btn data-dwn">
                                                <button class="btn btn-default minusqtybutton" data-id="<?php echo $deal['availabilityInfo'][0]['item_id'];?>" data-price="<?php echo intval($deal['availabilityInfo'][0]['sellingPrice']);?>" data-did="<?php echo $deal['_id'];?>" data-dir="dwn"><span class="glyphicon glyphicon-minus minusqty"></span></button>
                                        </span>
                                </div>
                        </div>
                                          
                        <?php endif;?>  
                <?php endif;?>
                </div>
                
                
      </div>
        <?php if($deal['source_id']==4  && isset($deal['availabilityInfo']) && count($colorsAvailable) >1 && $colors>1):?>
        <div class="morecoloroptions_<?php echo $deal['skuBundleId']?> hidden"
                style="background: #fff;">
                                        <div class="col-xs-2"></div>
                                        <div class="col-xs-10 button-checkbox text-left">
                                                <?php for($i=0; $i<count($colorsAvailable); $i=$i+2){
                                                                $value = $colorsAvailable[$i];
                                                        ?>
                                                <button type="button" class="btn btn-xs choosecolor colorbtn" data-id="<?php echo $value['item_id'];?>" data-price="<?php echo $value['sellingPrice'];?>" data-did="<?php echo $deal['_id'];?>" data-color="primary" data-max="<?php echo $value['maxQuantity'];?>"><?php echo strtoupper($value['color']);?></button>
                                                <?php
                                                        $j = $i+1;
                                                        $value = $colorsAvailable[$j];
                                                        if($j<count($colorsAvailable)){?>
                                                        <button type="button" class="btn btn-xs choosecolor colorbtn" data-id="<?php echo $value['item_id'];?>" data-price="<?php echo $value['sellingPrice'];?>" data-did="<?php echo $deal['_id'];?>" data-color="primary" data-max="<?php echo $value['maxQuantity'];?>"><?php echo strtoupper($value['color']);?></button><br>      
                            
                                                <?php }?>
                                    <?php }?>
                                </div>
                                
        </div>
        <?php endif;?>

        <?php endif;?>


             
      <?php endforeach;?>
    </div>  
  <?php endforeach;?>  


  <?php if(!$noscrolling):?>
    <?php if($this->params->controller=='store_products'):?>
      <p class="text-center"><a class="btn btn-primary infitescroller" href="/store_products/getdeals/?page=<?php echo $page+1;?>&sort=<?php echo $sort;?>&direction=<?php echo $direction;?><?php echo $filterstr;?>">Load More</a></p>
    <?php else:?>
      <p class="text-center"><a class="btn btn-primary infitescroller" href="/categories/getdeals/<?php echo $id;?>/?page=<?php echo ($page+1);?>&sort=<?php echo $sort;?>&direction=<?php echo $direction;?><?php echo $filterstr;?>">Load More</a></p>
      
    <?php endif;?>
  <?php endif;?>
  <?php else:?>
    <?php if($page==1):?>
      <h4>The content you requested couldn't be found</h4>
      <div class="text-center">
        <button type="button" class="btn btn-xs btn-primary refresh">Retry</button>
      </div>
    <?php endif;?>
  <?php endif;?>



<?php endif;?>