init
This commit is contained in:
@@ -0,0 +1,215 @@
|
||||
td.wishlist-empty{
|
||||
text-align: center!important;
|
||||
padding: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.wishlist_table .add_to_cart{
|
||||
line-height: 1.3;
|
||||
padding: 7px 10px;
|
||||
}
|
||||
|
||||
/* Popup message */
|
||||
#yith-wcwl-popup-message{
|
||||
background: #fff;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 15px 0;
|
||||
font-size: 120%;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(50%);
|
||||
width: 300px;
|
||||
z-index: 10000; /* Thanks WP -.- */
|
||||
}
|
||||
|
||||
.wishlist-icon{
|
||||
position: relative;
|
||||
}
|
||||
.wishlist-popup {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
padding: 5px;
|
||||
margin-top: -10px;
|
||||
border-radius: 5px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
font-size: .9em;
|
||||
top:100%;
|
||||
background-color: rgba(0,0,0,.8);
|
||||
right:0;
|
||||
color:#FFF;
|
||||
transition: opacity .3s, max-height .3s;
|
||||
transition-delay: .3s;
|
||||
}
|
||||
|
||||
.wishlist-popup:after {
|
||||
bottom: 100%;
|
||||
right: 10px;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-bottom-color: rgba(0,0,0,.8);
|
||||
border-width: 10px;
|
||||
margin-left: -10px;
|
||||
}
|
||||
|
||||
.wishlist-icon:hover .wishlist-popup{
|
||||
opacity: 1;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.wishlist-popup a{
|
||||
color:#ccc;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wishlist-popup a:hover{
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
.wishlist-icon.added:after{
|
||||
background-color:red;
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.wishlist-popup .ajax-loading,
|
||||
.wishlist-popup .feedback{
|
||||
display: none!important;
|
||||
}
|
||||
|
||||
.wishlist-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#yith-wcwl-form .hidden-title-form,
|
||||
#yith-wcwl-form .hide-title-form i,
|
||||
.wishlist-title .button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.wishlist-title,
|
||||
.wishlist-empty,
|
||||
.yith_wcwl_wishlist_footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.share-icons-title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.wishlist_table.mobile {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .product-checkbox {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper {
|
||||
display: inline-block;
|
||||
width: calc(100% - 25px);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.wishlist_manage_table.mobile li .item-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper .product-thumbnail {
|
||||
display: inline-block;
|
||||
max-width: 60px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile li .item-wrapper .product-thumbnail {
|
||||
margin-right: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper .item-details {
|
||||
display: inline-block;
|
||||
width: calc(100% - 74px);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile.with-checkbox li .additional-info-wrapper {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile.with-checkbox li .additional-info-wrapper {
|
||||
padding-left: 0;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .additional-info-wrapper {
|
||||
border-bottom: 1px solid #ececec;
|
||||
width: calc(100% - 25px);
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .additional-info-wrapper .product-add-to-cart,
|
||||
.wishlist_table.mobile li .additional-info-wrapper .move-to-another-wishlist {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .button.add_to_cart_button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile td {
|
||||
border-bottom: none;
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li[id^="yith-wcwl-row-"] {
|
||||
position: relative;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: -12px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 18px;
|
||||
font-size: 18px;
|
||||
border-radius: 100%;
|
||||
color: #ccc;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border: 2px solid currentColor;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile .product-remove {
|
||||
left: unset;
|
||||
right: -12px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a {
|
||||
position: unset;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a i {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a:after {
|
||||
content: '×';
|
||||
color: #ccc;
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
Flatsome.behavior('wishlist', {
|
||||
attach: function (context) {
|
||||
jQuery('.wishlist-button', context).each(function (index, element) {
|
||||
'use strict'
|
||||
|
||||
jQuery(element).on('click', function (e) {
|
||||
var $this = jQuery(this)
|
||||
// Browse wishlist
|
||||
if ($this.parent().find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) {
|
||||
window.location.href = $this.parent().find('.yith-wcwl-wishlistexistsbrowse a, .yith-wcwl-wishlistaddedbrowse a').attr('href')
|
||||
return
|
||||
}
|
||||
$this.addClass('loading')
|
||||
// Delete or add item (only one of both is present).
|
||||
$this.parent().find('.delete_item').click()
|
||||
$this.parent().find('.add_to_wishlist').click()
|
||||
|
||||
e.preventDefault()
|
||||
})
|
||||
})
|
||||
|
||||
markAdded()
|
||||
}
|
||||
})
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
var flatsomeAddToWishlist = function () {
|
||||
jQuery('.wishlist-button').removeClass('loading')
|
||||
markAdded()
|
||||
|
||||
jQuery.ajax({
|
||||
beforeSend: function () {
|
||||
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
},
|
||||
data: {
|
||||
action: 'flatsome_update_wishlist_count',
|
||||
},
|
||||
success: function (data) {
|
||||
var $icon = jQuery('i.wishlist-icon')
|
||||
$icon.addClass('added')
|
||||
if (data == 0) {
|
||||
$icon.removeAttr('data-icon-label')
|
||||
}
|
||||
else if (data == 1) {
|
||||
$icon.attr('data-icon-label', '1')
|
||||
}
|
||||
else {
|
||||
$icon.attr('data-icon-label', data)
|
||||
}
|
||||
setTimeout(function () {
|
||||
$icon.removeClass('added')
|
||||
}, 500)
|
||||
},
|
||||
|
||||
url: yith_wcwl_l10n.ajax_url,
|
||||
})
|
||||
}
|
||||
|
||||
jQuery('body').on('added_to_wishlist removed_from_wishlist', flatsomeAddToWishlist)
|
||||
})
|
||||
|
||||
function markAdded () {
|
||||
jQuery('.wishlist-icon').each(function () {
|
||||
var $this = jQuery(this)
|
||||
if ($this.find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) {
|
||||
$this.find('.wishlist-button').addClass('wishlist-added')
|
||||
}
|
||||
})
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* YITH wishlist integration
|
||||
*
|
||||
* @author UX Themes
|
||||
* @package Flatsome/Integrations
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'flatsome_wishlist_integrations_scripts' ) ) {
|
||||
/**
|
||||
* Enqueues wishlist integrations scripts
|
||||
*/
|
||||
function flatsome_wishlist_integrations_scripts() {
|
||||
global $integrations_uri;
|
||||
|
||||
wp_dequeue_style( 'yith-wcwl-main' );
|
||||
wp_deregister_style( 'yith-wcwl-main' );
|
||||
wp_dequeue_style( 'yith-wcwl-font-awesome' );
|
||||
wp_deregister_style( 'yith-wcwl-font-awesome' );
|
||||
|
||||
// TODO 4.0 Move and apply on AJAX search plugin.
|
||||
wp_dequeue_style( 'yith_wcas_frontend' );
|
||||
wp_deregister_style( 'yith_wcas_frontend' );
|
||||
|
||||
wp_enqueue_script( 'flatsome-woocommerce-wishlist', $integrations_uri . '/wc-yith-wishlist/wishlist.js', array( 'jquery', 'flatsome-js' ), '3.10.2', true );
|
||||
wp_enqueue_style( 'flatsome-woocommerce-wishlist', $integrations_uri . '/wc-yith-wishlist/wishlist.css', 'flatsome-woocommerce-style', '3.10.2' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_wishlist_integrations_scripts' );
|
||||
|
||||
if ( ! function_exists( 'flatsome_wishlist_account_item' ) ) {
|
||||
/**
|
||||
* Add wishlist button to my account dropdown
|
||||
*/
|
||||
function flatsome_wishlist_account_item() {
|
||||
$page_id = get_option( 'yith_wcwl_wishlist_page_id' );
|
||||
if ( ! $page_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wishlist_page = yith_wcwl_object_id( $page_id );
|
||||
?>
|
||||
<li class="wishlist-account-element <?php if ( is_page( $wishlist_page ) ) echo 'active'; ?>">
|
||||
<a href="<?php echo YITH_WCWL()->get_wishlist_url(); ?>"><?php echo get_the_title( $wishlist_page ); ?></a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_account_links', 'flatsome_wishlist_account_item' );
|
||||
|
||||
|
||||
if ( ! function_exists( 'flatsome_product_wishlist_button' ) ) {
|
||||
/**
|
||||
* Add wishlist Button to Product Image
|
||||
*/
|
||||
function flatsome_product_wishlist_button() {
|
||||
$icon = get_theme_mod( 'wishlist_icon', 'heart' );
|
||||
if ( ! $icon ) $icon = 'heart';
|
||||
?>
|
||||
<div class="wishlist-icon">
|
||||
<button class="wishlist-button button is-outline circle icon" aria-label="<?php echo __( 'Wishlist', 'flatsome' ); ?>">
|
||||
<?php echo get_flatsome_icon( 'icon-' . $icon ); ?>
|
||||
</button>
|
||||
<div class="wishlist-popup dark">
|
||||
<?php echo do_shortcode( '[yith_wcwl_add_to_wishlist]' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_product_image_tools_top', 'flatsome_product_wishlist_button', 2 );
|
||||
add_action( 'flatsome_product_box_tools_top', 'flatsome_product_wishlist_button', 2 );
|
||||
|
||||
if ( ! function_exists( 'flatsome_header_wishlist' ) ) {
|
||||
/**
|
||||
* Header Wishlist element
|
||||
*
|
||||
* @param $elements
|
||||
* @return mixed
|
||||
*/
|
||||
function flatsome_header_wishlist( $elements ) {
|
||||
$elements['wishlist'] = __( 'Wishlist', 'flatsome' );
|
||||
|
||||
return $elements;
|
||||
}
|
||||
}
|
||||
add_filter( 'flatsome_header_element', 'flatsome_header_wishlist' );
|
||||
|
||||
if ( ! function_exists( 'flatsome_update_wishlist_count' ) ) {
|
||||
/**
|
||||
* Update Wishlist Count
|
||||
*/
|
||||
function flatsome_update_wishlist_count() {
|
||||
wp_send_json( YITH_WCWL()->count_products() );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_ajax_flatsome_update_wishlist_count', 'flatsome_update_wishlist_count' );
|
||||
add_action( 'wp_ajax_nopriv_flatsome_update_wishlist_count', 'flatsome_update_wishlist_count' );
|
Reference in New Issue
Block a user