text
stringlengths
0
14.1k
$current_page = 1;
$limit_sql = '';
if( $pagination == 'yes' ) {
$count = array();
if( is_user_logged_in() ) {
$count = $wpdb->get_results( $wpdb->prepare( 'SELECT COUNT(*) as `cnt` FROM `' . YITH_WCWL_TABLE . '` WHERE `user_id` = %d', $user_id ), ARRAY_A );
$count = $count[0]['cnt'];
} elseif( yith_usecookies() ) {
$count[0]['cnt'] = count( yith_getcookie( 'yith_wcwl_products' ) );
} else {
$count[0]['cnt'] = count( $_SESSION['yith_wcwl_products'] );
}
$total_pages = $count/$per_page;
if( $total_pages > 1 ) {
$current_page = max( 1, get_query_var( 'page' ) );
$page_links = paginate_links( array(
'base' => get_pagenum_link( 1 ) . '%_%',
'format' => '&page=%#%',
'current' => $current_page,
'total' => $total_pages,
'show_all' => true
) );
}
$limit_sql = ""LIMIT "" . ( $current_page - 1 ) * 1 . ',' . $per_page;
}
if ($user_id != """") {
$wishlist = $wpdb->get_results(
$wpdb->prepare( ""SELECT * FROM `"" . YITH_WCWL_TABLE . ""` WHERE `user_id` = %s"" . $limit_sql, $user_id ),
ARRAY_A );
} elseif( yith_usecookies() ) {
$wishlist = yith_getcookie( 'yith_wcwl_products' );
} else {
$wishlist = isset( $_SESSION['yith_wcwl_products'] ) ? $_SESSION['yith_wcwl_products'] : array(); }
// Start wishlist page printing
$woocommerce->show_messages() ?>
<div id=""yith-wcwl-messages""></div>
<?php ct_woo_help_bar(); ?>
<div class=""my-account-left"">
<h4 class=""lined-heading""><span><?php _e(""My Account"", ""cootheme""); ?></span></h4>
<ul class=""nav my-account-nav"">
<li><a href=""<?php echo $myaccount_page_url; ?>""><?php _e(""Back to my account"", ""cootheme""); ?></a></li>
</ul>
</div>
<div class=""my-account-right tab-content"">
<form id=""yith-wcwl-form"" action=""<?php echo esc_url( $yith_wcwl->get_wishlist_url() ) ?>"" method=""post"">
<?php
do_action( 'yith_wcwl_before_wishlist_title' );
$wishlist_title = get_option( 'yith_wcwl_wishlist_title' );
if( !empty( $wishlist_title ) )
{ echo apply_filters( 'yith_wcwl_wishlist_title', '<h3>' . $wishlist_title . '</h3>' ); }
do_action( 'yith_wcwl_before_wishlist' );
?>
<table class=""shop_table cart wishlist_table"" cellspacing=""0"">
<thead>
<tr>
<th class=""product-thumbnail""><span class=""nobr""><?php _e( 'Item', 'cootheme' ) ?></span></th>
<th class=""product-name""><span class=""nobr""><?php _e( 'Product Name', 'cootheme' ) ?></span></th>
<?php if( get_option( 'yith_wcwl_price_show' ) == 'yes' ) { ?><th class=""product-price""><span class=""nobr""><?php _e( 'Unit Price', 'cootheme' ) ?></span></th><?php } ?>
<?php if( get_option( 'yith_wcwl_stock_show' ) == 'yes' ) { ?><th class=""product-stock-status""><span class=""nobr""><?php _e( 'Stock Status', 'cootheme' ) ?></span></th><?php } ?>
<?php if (!$ct_catalog_mode && get_option( 'yith_wcwl_add_to_cart_show' ) == 'yes') { ?>
<th class=""product-add-to-bag""><span class=""nobr""><?php _e( 'Actions', 'cootheme' ) ?></span></th>
<?php } ?>
<th class=""product-remove""></th>
</tr>
</thead>
<tbody>
<?php
if( count( $wishlist ) > 0 ) :
foreach( $wishlist as $values ) :
if( !is_user_logged_in() ) {
if( isset( $values['add-to-wishlist'] ) && is_numeric( $values['add-to-wishlist'] ) ) {
$values['prod_id'] = $values['add-to-wishlist'];
$values['ID'] = $values['add-to-wishlist'];
} else {
$values['prod_id'] = $values['prod_id'];
$values['ID'] = $values['prod_id'];
}
}
$product_obj = get_product( $values['prod_id'] );
if( $product_obj !== false && $product_obj->exists() ) : ?>
<tr id=""yith-wcwl-row-<?php echo $values['ID'] ?>"">
<td class=""product-thumbnail"">