For Users

Installation

First way to install plugin:

  1. Download plugin from your BeRocket account
  2. Open your site admin panel and go to Plugins -> Add New -> Upload Plugin
  3. Click Browse and select downloaded zip file and click Install Now
  4. Click Activate Plugin

 

Second way to install plugin:  

  1. Download plugin from your BeRocket account
  2. Open your site via FTP
  3. Go to WordPress folder/wp-content/plugins
  4. Extract files from downloaded zip file and copy extracted folders to plugins folder
  5. Open your site admin panel and go to Plugins
  6. Find WooCommerce Currency Exchange and click Activate under it

Setup

Enable currency

  • Open your site admin panel and go to WooCommerce -> Curency Exchange?
  • Select currencies, that you want to use on you site
  • Enter exchange rate for selected currencies or use auto update from some of the currency exchange rate sites

Change currency

There is some way to change currency on front end:

  • Currency from the user's IP on first load - enable in plugin settings( WooCommerce -> Curency Exchange ) "Use IP to detect currency" option
  • Change currency with help of selectbox or radio buttons - place widget or shortcode on page
  • Change currency from user profile - enable in plugin settings( WooCommerce -> Curency Exchange ) "Currency in profile" option

Account/Product Key

BeRocket Account and Product key uses for auto update plugins from BeRocket site.

Where can you find Account Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. From right side on page you can find all information about your BeRocket account including Account Key

  4. You can click on account key and copy it
  5. What can you do with Account Key?

Where can you find Product Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. Click on key icon on right side from plugin name WooCommerce Products Compare

  4. You can click on Product key and copy it
  5. In left field you can type any notice for this key and click DONE to save
  6. What can you do with Product Key?

Settings

WooCommerce Products Compare have settings in Admin Panel -> WooCommerce -> Currency Exchange

Currencies

Contains general settings for Currencies.

  • Visual only - replace only price on shop frontend, but use default currency in checkout page and admin dashboard
  • Use IP to detect currency? - currency will be set from the user's IP on first load
  • Currency in profile - add currency select field to user profile pages
  • Exchange Rates - settings to get currencies exchange rate from different sites
  • Multiplier - multiply currency when exchanging by this value
  • Additional currencies - table with currencies, that you can use on your site
    • Mark checkbox to use currency
    • Place currency exchange rate from your WooCommerce currency or click "Update rates" button to use rates from site, that you selected
    • Also you can select or add image for every currency and use it in widgets to select currency

CSS

Contains setting to set custom CSS code that will be added to frontend pages.

  • Custom CSS - any CSS code, that you want

JavaScript

Contains setting to set JavaScript code that will be executed on some actions.

  • On Page Load - on every page load
  • Before Language Set? - when selected new language, but not set yet
  • After Language Set? - when new language was selected and added to cookie. By default: location.reload();

License

Plugin key - uses for updates plugin from BeRocket site. You can get this on BeRocket site -> My Account page on click key icon

BeRocket Account

BeRocket account settings are in Admin Panel -> Settings -> BeRocket Account.

Contains field for place BeRocket Account Key

Where can you find Account Key?

  1. Copy Account Key from BeRocket site
  2. Paste this key to Account key field
  3. Press Test button
  4. If you use right Account Key you will see

  5. Then press Save button

Widget

The widget from plugin called WooCommerce Currency Exchange. You can place this widget to any widget area like other widgets.

  • Title - Widget title
  • Type - select box with widget type select or radio.
  • Buttons - type of information that is represent language. Click on button to add needed information, you can sort it with clicking on buttons with arrows. You can remove any block just click under buttons with arrow.

Shortcode

[br_currency_exchange] - shortcode to display language selector

Options:

  • title - title of block
  • type - select or radio
  • currency_text - type of information that is represent language. Types that can be used: text, flag, symbol, image, space. You can use one or multiple types ( Examples: "text", "flag,text", "flag,space,symbol,space,text" )

For Developers

Filter hooks

berocket_ce_user_func

Parameters

  1. scripts - array with scripts from plugin settings. Array:
    • js_page_load - executes on page load
    • js_before_set - executes when language changed, but not set to cookie
    • js_after_set - executes when language changed and is set to cookie

Usage

<?php
function change_berocket_ce_user_func ( $scripts ) {
//your code here
    return $scripts;
}

add_filter( 'berocket_ce_user_func', 'change_berocket_ce_user_func', 10, 2 );
?>

ce_get_template_part

Template that uses in plugin.

Parameters

  1. template - link to template that will be loaded.
  2. name - template name.

Usage

<?php
function change_ce_get_template_part ( $template, $name ) {
//your code here
    return $template;
}

add_filter( 'ce_get_template_part', 'change_ce_get_template_part', 10, 2 );
?>

berocket_ce_shortcode_options

Attributes for shortcode.

Parameters

  1. attributes - array with shortcode attributes. Array:
    • title - title of shortcode
    • type - select or radio
    • currency_text - type of information that is represent language. Types that can be used: text, flag, symbol, image, space. You can use one or multiple types ( Examples: "text", "flag,text", "flag,space,symbol,space,text" )

Usage

<?php
function change_berocket_ce_shortcode_options ( $attributes ) {
//your code here
    return $attributes;
}

add_filter( 'berocket_ce_shortcode_options', 'change_berocket_ce_shortcode_options' );
?>

ce_widget_title

Title for widgets and shortcodes.

Parameters

  1. title - Title for widgets and shortcodes.

Usage

<?php
function change_ce_widget_title ( $title ) {
//your code here
    return $title;
}

add_filter( 'ce_widget_title', 'change_ce_widget_title' );
?>

ce_widget_type

Type of widgets and shortcodes.

Parameters

  1. type - select or radio type of widgets and shortcodes.

Usage

<?php
function change_ce_widget_type ( $type ) {
//your code here
    return $type;
}

add_filter( 'ce_widget_type', 'change_ce_widget_type' );
?>

ce_widget_text_builder

Type of information that is represent language.

Parameters

  1. currency_text - array with types. Sorting is important. Array can contain this values:
    • text - currency name from WooCommerce
    • flag - country flag where currency uses
    • symbol - currency symbol from WooCommerce
    • image - currency image from plugin settings
    • space - whitespace character

Usage

<?php
function change_ce_widget_text_builder ( $currency_text ) {
//your code here
    return $currency_text;
}

add_filter( 'ce_widget_text_builder', 'change_ce_widget_text_builder' );
?>

br_currency_widget_type_of_text

Type of information that is represent language and can be selected in widgets or shortcodes.

Parameters

  1. currency_text - array with types.  Array contain this value as key:
    • text - currency name from WooCommerce
    • flag - country flag where currency uses
    • symbol - currency symbol from WooCommerce
    • image - currency image from plugin settings
    • space - whitespace character

Usage

<?php
function change_br_currency_widget_type_of_text ( $currency_text ) {
//your code here
    return $currency_text;
}

add_filter( 'br_currency_widget_type_of_text', 'change_br_currency_widget_type_of_text' );
?>

br_currency_widget_do_type_of_text

Type of information that is represent language and can be selected in widgets or shortcodes.

Parameters

  1. text - empty string by default
  2. element - Type of information that is represent language.  String with type key
  3. currency_code - currency code ( Example: EUR, USD )

Usage

<?php
function change_br_currency_widget_do_type_of_text ( $text, $element, $currency_code ) {
//your code here
    return $text;
}

add_filter( 'br_currency_widget_do_type_of_text', 'change_br_currency_widget_do_type_of_text' );
?>

Functions

includes/functions.php

br_get_woocommerce_version()

Public function to get WooCommerce version

return string. woocommerce version

br_get_currency_text_for_element($elements, $currency_load = false)

Convert array with type elements to string for currency

  • $elements - array with element type
  • $currency_load - currency code, if needed text for one currency only

return string. currency text

br_ce_create_ip_table()

Create table to convert user IP to currency

br_ce_get_currency()

Get currency code from current user IP

return string. currency code

woocommerce-curency-exchange.php

All of these functions is in class BeRocket_CE as static functions.

init ()

Function for initialize scripts.

register_ce_options ()

Function for initialize scripts and settings page in admin panel.

ce_options ()

Add option page to admin menu.

br_get_template_part( $name = '' )

Get template part (for templates like the slider).

  • $name - template name

Default templates places in plugins folder woocommerce-curency-exchange/templates.

To rewrite the template in your theme folder create folder with name woocommerce-curency-exchange and places new template with identical name in this folder.

Options

All settings you can find in BeRocket_CE class in static variables $defaults.

public static $defaults = array(
        'visual_only'       => '1',
        'currency_via_ip'   => '1',
        'user_profile'      => '',
        'use_currency'      => array(),
        'currency'          => array(),
        'currency_image'    => array(),
        'custom_css'        => '',
        'multiplier'        => '1',
        'use_open_exchange' => '0',
        'currency_site'     => 'oer',
        'open_exchange_api' => '',
        'currencylayer_api' => '',
        'last_oer_data'     => array('update' => 0, 'base' => 'USD'),
        'script'            => array(
            'js_page_load'      => '',
            'js_before_set'     => '',
            'js_after_set'      => 'location.reload();',
        ),
        'plugin_key'        => '',
    );

Files

  • woocommerce-curency-exchange.php - main plugin file
  • css - folder with CSS files
    • admin_ce.css - styles for admin panel
    • colpick.css - styles for color picker block
    • font-awesome.css - standard Font Awesome styles
    • shop_ce.css - front end styles
  • fonts - Font Awesome fonts
  • image - folder with images
    • flag - country flag images
  • includes - folder with additional PHP files
    • create_db.php - create table in database to convert user IP to country code
    • functions.php - public functions
    • updater.php - BeRocket Updater for plugins update from BeRocket site
    • widget.php - widget for products that added to compare list
  • js - folder with JavaScript files
    • accounting.min.js - formating money via JavaScript
    • admin.js - JavaScript for admin panel settings
    • colpick.js - JavaScript for color picker in admin panel settings
    • curency_exchange.js - JavaScript for front end
    • jquery.cookie.js - jQuery plugin for cookie
    • money.min.js - convert money via JavaScript
  • templates - templates for settings, list style and buttons
    • settings.php - plugin settings page
    • widget.php - widget template