Skip to content

Commit

Permalink
Merge pull request #197 from addonify/development
Browse files Browse the repository at this point in the history
Compare button options on products loop and product single page, and logged in user.
  • Loading branch information
Asok17 authored Sep 4, 2023
2 parents dd03ae5 + 27ceff1 commit 6e6bf37
Show file tree
Hide file tree
Showing 25 changed files with 676 additions and 308 deletions.
Binary file modified .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 21 additions & 6 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Contributors: addonify
Tags: compare, woocommerce compare, products comparison, compare products, compare woocommerce, addonify, woocommerce
Requires at least: 5.9
Tested up to: 6.2.2
Stable tag: 1.1.10
Tested up to: 6.3.1
Stable tag: 1.1.11
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -74,6 +74,10 @@ Yes, Addonify Product Compare should work with all themes if the theme authors h

Yes, you can select the fields from Dashboard > Addonify > Compare > Settings to display in the compare table.

= Is there a shortcode for adding product compare button?

Yes, there is. Use `[addonify_compare_button]` to add product compare button. `product_id` , `button_label`, `classes`, and `button_icon_position` are the shortcode attributes that can be used. Shortcode attribute, `product_id` is required in order to display the compare button outside the products loop. Value for shortcode attribute `classes` should be CSS classes separated by a space. The value for `button_icon_position`, should be either 'left', 'right' or 'none';. For more information [check doc.](https://docs.addonify.com/kb/woocommerce-compare-products/getting-started/compare-button/)

= I'm a developer, is it possible to customize frontend output? =

Yes, you can do it. Copy template from "/plublic/templates" the plugin's folder and paste them inside "/addonify/addonify-compare-products" of your theme's folder. For more information, read the [plugin's documentation](https://docs.addonify.com/kb/woocommerce-compare-products/)
Expand All @@ -98,6 +102,17 @@ Yes, you can do it. Copy template from "/plublic/templates" the plugin's folder

== Changelog ==

= 1.1.11 - 04 August, 2023 =

- Added: Option to enable compare product button for logged in user.
- Added: Options to enable compare product button on product single page.
- Added: Option to enable product button on products loop.
- Added: Shortcode, `[addonify_compare_button]`, for adding compare button.
- Updated: Plugin setting page link moved before the 'Deactivate' link in plugins list page.
- Updated: Compare dock is now visible only if there is compare button on a page.
- Tested: Up to WooCommerce version 8.0.3.
- Tested: WordPress version 6.3.1.

= 1.1.10 - 20 June, 2023 =

- Fix: Translation issue. String "N/A" is now translation ready. #181
Expand Down Expand Up @@ -168,20 +183,20 @@ Yes, you can do it. Copy template from "/plublic/templates" the plugin's folder

- Tested: with WordPress version 6.0.2.

== 1.0.3 - 7 August 2022 ==
= 1.0.3 - 7 August 2022 =

- Updated: Removed button from button.addonify-cp-button in custom.js

== 1.0.2 - 29 July 2022 ==
= 1.0.2 - 29 July 2022 =

- Updated: Readme.txt file.
- Fixed: Author URL.

== 1.0.1 - 29 July 2022 ==
= 1.0.1 - 29 July 2022 =

- Added: wordpress.org graphics.
- Fixed: Typo in vue js files.

== 1.0.0 - 28 July 2022 ==
= 1.0.0 - 28 July 2022 =

- New: Initial release
24 changes: 19 additions & 5 deletions addonify-compare-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Addonify - Compare Products For WooCommerce
* Plugin URI: https://wordpress.org/plugins/addonify-compare-products/
* Description: Addonify Compare Products is a WooCommerce extension that allows website visitors to compare multiple products on your online store.
* Version: 1.1.10
* Version: 1.1.11
* Author: Addonify
* Author URI: https://addonify.com/
* License: GPL-2.0+
Expand All @@ -24,7 +24,8 @@
die;
}

define( 'ADDONIFY_COMPARE_PRODUCTS_VERSION', '1.1.10' );
define( 'ADDONIFY_COMPARE_PRODUCTS_VERSION', '1.1.11' );
define( 'ADDONIFY_COMPARE_PRODUCTS_BASENAME', plugin_basename( __FILE__ ) );
define( 'ADDONIFY_CP_DB_INITIALS', 'addonify_cp_' );
define( 'ADDONIFY_CP_PLUGIN_PATH', dirname( __FILE__ ) );

Expand Down Expand Up @@ -64,8 +65,21 @@ function deactivate_addonify_compare_products() {
*/
function run_addonify_compare_products() {

$plugin = new Addonify_Compare_Products();
$plugin->run();
if ( class_exists( 'WooCommerce' ) ) {
$plugin = new Addonify_Compare_Products();
$plugin->run();
} else {
add_action(
'admin_notices',
function() {
?>
<div class="notice notice-error is-dismissible">
<p><?php esc_html_e( 'Addonify Compare Products is enabled but not effective. This plugin requires WooCommerce plugin in order to work.', 'addonify-compare-products' ); ?></p>
</div>
<?php
}
);
}

}
run_addonify_compare_products();
add_action( 'plugins_loaded', 'run_addonify_compare_products' );
2 changes: 1 addition & 1 deletion admin/assets/js/main.js

Large diffs are not rendered by default.

53 changes: 7 additions & 46 deletions admin/class-addonify-compare-products-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,6 @@ public function __construct( $plugin_name, $version ) {
$this->version = $version;
}

/**
* Initialize admin hooks.
*
* @since 1.0.0
*/
public function admin_init() {

// Enqueue admin scripts and styles.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

// Display admin notice if WooCommerce is not active.
if ( ! class_exists( 'WooCommerce' ) ) {

add_action( 'admin_notices', array( $this, 'woocommerce_not_active_notice' ) );
} else {
// Register admin menu in the dashboard.
add_action( 'admin_menu', array( $this, 'add_menu_callback' ), 20 );

// Add a custom link in plugins.php page in wp-admin.
add_action( 'plugin_action_links', array( $this, 'custom_plugin_link_callback' ), 10, 2 );
}
}

/**
* Register the stylesheets for the admin area.
Expand All @@ -102,7 +79,6 @@ public function enqueue_styles() {
}



/**
* Register the JavaScript for the admin area.
*
Expand Down Expand Up @@ -160,7 +136,6 @@ public function enqueue_scripts() {
}



/**
* Generate admin menu for this plugin
*
Expand Down Expand Up @@ -208,23 +183,19 @@ public function add_menu_callback() {
}



/**
* Print "settings" link in plugins.php admin page
* Add settings link to plugin actions.
*
* @since 1.0.0
* @param string $links Links.
* @param string $file PLugin file name.
* @param array $links Plugin actions.
*/
public function custom_plugin_link_callback( $links, $file ) {

if ( plugin_basename( dirname( __FILE__, 2 ) . '/addonify-compare-products.php' ) === $file ) {
public function custom_plugin_link_callback( $links ) {

// add "Settings" link.
$links[] = '<a href="admin.php?page=' . $this->settings_page_slug . '">' . __( 'Settings', 'addonify-compare-products' ) . '</a>';
}
$action_links = array(
'<a href="admin.php?page=' . $this->settings_page_slug . '">' . __( 'Settings', 'addonify-compare-products' ) . '</a>',
);

return $links;
return array_merge( $action_links, $links );
}


Expand All @@ -238,14 +209,4 @@ public function get_settings_screen_contents() {
<div id="___adfy-compare-products-app___"></div>
<?php
}

/**
* Show error message if woocommerce is not active
*
* @since 1.0.0
*/
public function woocommerce_not_active_notice() {

require dirname( __FILE__ ) . '/templates/woocommerce-not-active-notice.php';
}
}
25 changes: 25 additions & 0 deletions admin/src/components/core/Icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup>
/**
* Define props.
*
* @since 1.2.0
*/
const props = defineProps({
name: {
type: String,
required: true,
},
});
const { name } = props;
</script>
<template>
<template v-if="name === 'spinner'">
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
<path
fill="currentColor"
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
></path>
</svg>
</template>
</template>
43 changes: 43 additions & 0 deletions admin/src/components/core/Logo.vue

Large diffs are not rendered by default.

Loading

0 comments on commit 6e6bf37

Please sign in to comment.