<style>
.heading{margin-bottom:0;}
.category-products{margin-bottom:20px;}
.my-account .col-main{padding:0;}
.my-account .category-products .product_list{
	border-width:0 0 1px;
	border-style:dashed;
	border-color:#ccc;
}
.my-account .category-products .product_list .list_item{width:33.3%;}
.my-account .product_list .list_item .list_item_inner .img_wrap .list_item_img{height:auto;}
.my-account .product_list .list_item .list_item_inner .product-description .item_title{
	margin-bottom:5px;}
.item_tips,.item_review{font-size:12px; color:#818181;}
.usold-price{text-decoration:line-through; font-size:22px;}
.item_tips .sold{color:blue; margin-left:5px; font-size:12px;}
.item_review .rating{display:inline-block; vertical-align:text-top; margin-right:5px;}
.item_review .line{padding:0 5px;}
.tips{color:#818181; margin:15px 0;}

@media (max-width: 1199px) {
  .my-account .category-products .product_list .list_item .list_item_inner .img_wrap {
    height: 200px;
  }
}

@media (max-width: 991px) {
	.my-account .category-products .product_list .list_item{width:50%;}
	.my-account .product_list .list_item .list_item_inner .img_wrap .list_item_img{height:150px;}
}

@media (max-width:767px) {
	.my-account .category-products .product_list .list_item .list_item_inner .img_wrap{ height:240px;}
	.my-account .product_list .list_item .list_item_inner .img_wrap .list_item_img{height:inherit;}
}

@media (max-width:640px) {
	.my-account .category-products .product_list .list_item .list_item_inner .img_wrap{ height:180px;}
}
</style>
<div class="my-account">
	<div class="heading">
        <dl class="acctip">
            <dt>My WishList</dt>
        </dl>
    </div>

    <div class="clearfix">
        <div class="col-main col-sm-24 wishlist-main">

            <table id="wishlist-table" class="data-table mobile-data-table">
                    <thead>
                        <tr class="first last">
                            <th>Item</th>
                            <th></th>
                            <th style="width:16%"></th>
                            <th style="width:18%">Price</th>
                            <th style="width:16%">Quantity</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php if(!empty($my_wishlists)){?>
          			<?php foreach($my_wishlists as $key=>$wish_product){ ?>
                    <tr>
                    <td colspan="3">
                       <div class="prod_info clearfix">
        <a class="product-image" href="<?php echo $wish_product['product_href']; ?>"><img src="<?php echo $wish_product['product_image_filename']; ?>"/></a>
        <h3 class="product-name"><a title="<?php echo $wish_product['product_title'];?>" href="<?php echo $wish_product['product_href']; ?>"><?php echo $wish_product['product_title'];?></a></h3>
        <div><small class="product-options">- Women's Shoe Size: 35</small></div>
        <a href="<?php echo $wish_product['remove_product_href']; ?>" title="Remove Item" class="icon_link link-remove">
        <span class="icon"><i class="icon-remove"></i></span>
        Remove</a>
                </div>
                    </td>
                    <td data-title="Price">
                        <div class="cart-cell">
                            <div class="price-box regular-price">
                            	<p class="old-price"><span class="price"><?php echo $wish_product['market_price']; ?></span></p>
                                <p class="special-price"><span class="price"><?php echo $wish_product['price']; ?></span></p>
                            </div>
                        </div>
                    </td>
                    <td class="last">
                        <div class="add-to-cart-alt">
                           <!--<button type="button" class="btn btn-dark-gray btn-cart" onclick="javascript:addtocart('<?php echo $wish_product['product_id']; ?>');">Add to Cart</button>-->
                           <input id="addtocart" data-product-options="<?php echo $wish_product['product_options']; ?>" data-product-id="<?php echo $wish_product['product_single_id']; ?>" type="submit" class="btn btn-primary btn-cart" value="Add to Cart">
                        </div>
                    </td>
                     </tr>
                      <?php }}else {?>
                        <p class="tips">You have no items in your wishlist.</p>
                	  <?php }?>
                    </tbody>
                </table>
                <!--add to cart-->
                <div id="atc-box" style="display: none;">
                  <div class="atc-inner">
                      <a href="javascript:void(0);" class="atc-close" id="atc-close-btn"></a>
                      <div class="clearfix">
                          <div class="atc-caption">
                              <i class="icon_success"></i>
                              New item added to cart
                          </div>
                <div class="atc-message-success"><em id="shopping_cart_num">0</em> total items in your Cart, Cart Total: <span id="shopping_cart_total" class="price"></span></div>
                          <div class="atc-actions">
                              <a href="javascript:void(0);" class="btn btn-dark-gray" id="continue_shopping_btn">Continue Shopping</a>
                              <a href="/index.php?controller=cart" class="btn btn-primary">View Cart & Checkout</a>
                              <div style="clear: both;"></div>
                          </div>
                      </div>
                  </div>
                </div>
                <!--add to cart end-->
				<script language="javascript" type="text/javascript">
				   function addtocart(product_id)
						alert("addtocart");
						$.ajax({
								type:'GET',
								url: 'index.php?controller=my_wishlist&action=ajaxaddtocart&product_id='+product_id,
								dataType: 'json',
								success: function(data) {
		//		                    window.location.href="index.php?controller=cart";
									if(data==1){
										window.location.href=<?php echo $href_cart; ?>
									}
								}
							});
						 return false;
					});
                </script>
                <!--page-->
               <div class="toolbar clearfix">
          <div class="sorter_bottom">
               <div class="col-sm-8 left"><?php echo $text_results;?></div>
               <div class="col-sm-16 right">                   
                    <a href="<?php echo $action . '&page=' . (($page>1)?($page-1):$page); ?>"><?php echo 'Previous'?></a>                     
                    <?php foreach ($pages as $f_page) { ?>        
                    <?php if ( $f_page['value'] < ($page - 2) ) {continue; } ?>
                    <?php if ( $f_page['value'] > ($page + 4) ) {continue; } ?>                                               
                    <?php if ($f_page['value'] == $page) { ?>
                    <b class="selected"><?php $x = explode(" ",$f_page['text']);echo $x[0]; ?></b>
                    <?php } else { ?>
                      <a class="page_btn" href="<?php echo $action . '&page=' . $f_page['value']; ?>"><?php $x = explode(" ",$f_page['text']);echo $x[0]; ?></a></td>
                    <?php } ?>   
                    <?php } ?>                       
                    <a class="page_btn" href="<?php echo $action . '&page=' . (($page<count($pages))?($page+1):$page); ?>"><?php echo 'Next'?></a>                     
                    <label>Go to Page</label>
                    <select onchange="return SelectPage(this.value)" style="width:50px;">
                        <?php foreach ($pages as $f_page){?>
                        <option value="<?php echo $f_page['value']?>" <?php if ($f_page['value'] == $page){echo 'selected';}?>><?php echo $f_page['value']?></option>
                        <?php };?>
                    </select>
                    <script type="text/javascript">
						function SelectPage(page) {
							window.location.href="<?php echo $action; ?>&page=" + page;
						}
					</script>
             </div>
          </div>
     </div>
                <!--page end-->
        </div>
    </div>
</div>

<script>
		//add to cart
		// $('#atc-box').hide();
		$('#atc-close-btn, #continue_shopping_btn').click(function(){
        	$('#atc-box').hide();
    	//window.location.reload();
    	})
    $("#addtocart").click(function(){
    	  var js_options = $(this).attr('data-product-options');
        var product_id = parseInt( $(this).attr('data-product-id') );
        var quantity   = 1;
        $.ajax({
                type:'GET',
                url: 'index.php?controller=product&action=ajax_addtocart&product_id='+product_id+'&quantity='+quantity+'&options='+js_options,
//              data: 'product_id=' + $('#product_id').val() + '&quantity=' + $('#quantity').val() + '&options=' + options,
                dataType: 'json',
                success: function(json) {
                    $('#shopping_cart_num').text(json['cart_count']);
                    $('#shopping_cart_total').text(json['cart_total']);
                    $('#atc-box').show();
                    reloadCartHeader();
                }
        });
        return false;
    });
    function reloadCartHeader() {
    $.get('index.php?controller=cart&action=ajax_cart_header_block', {}, function(data){
        $("#cartHeaderBlock").html(data);
    });
}
</script>
