Jump to content

Michael Kinder

Members
  • Posts

    16
  • Joined

  • Last visited

  • Days Won

    5

Reputation Activity

  1. Thanks
    Michael Kinder reacted to Michael in BlestaForums in pre-beta   
    I started BlestaForums to get a community forum part of Blesta and make it more integrated and amazing. I've been very busy lately working in my new job as-well and I've been doing other things. Timothy (@timnboys) has been helping complete the forums as he wanted to get it to work on his site instead of the paid and free ones.

    So together we've been doing the Blesta Forums and we're proud to announce that it's now in Pre-beta! This means we're testing it with our own customers so we can ensure it's as bug free as we can before the private beta emerges.
    Both of us will be selling the product with our own licensing servers and we'll both support it's growth together. it will be open code minus the encoding for licensing purposes and we have so much planned.

    I've got a to-do list here: https://atlantis.plutio.com/p/blestaforums
     
    He's a small preview for our non customers:



     





     
    Our site: https://blesta.store/client/plugin/blesta_forums/
    Timothy's site: https://cubedata.net/client/plugin/blesta_forums/
  2. Like
    Michael Kinder reacted to HostKoala in Trutone Blesta Integration   
    So blue
  3. Like
    Michael Kinder reacted to Paul in Trutone Blesta Integration   
    Little late on the reply, but I like it it.  Not a big fan of all the blue, but it does fit together well.  
  4. Like
    Michael Kinder reacted to Chris in Trutone Blesta Integration   
    It's very smooth. Nice work. The blue reminded me of that song blue Da ba dee
  5. Thanks
    Michael Kinder got a reaction from Joseph H in Use Multi-Currency On Your Site Using GeoIP   
    Hi everyone! I just wanted to share this with you because I think it would be useful to those who aren't necessarily familiar with PHP and want to display different currencies based upon the user's IP address. Big thanks to @Blesta.Store for sharing a big portion of this code already on the forum. This will pull prices from Blesta's API and allow you to use multiple currencies.
     
    After you've uploaded the API SDK, you're going to want to download this file: https://www.geoplugin.com/_media/webservices/geoplugin.class.phps
    Upload that file into your site's directory, then take the contents below and place it at the top of your site files (or the pages where you will be displaying the prices).
     
    <?php require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); // create a variable for the country code $var_country_code = $geoplugin->countryCode; // redirect based on country code: if ($var_country_code == "AU") { $selected_currency = "AUD"; } else if ($var_country_code == "CA") { $selected_currency = "CAD"; } else if ($var_country_code == "AT") { $selected_currency = "EUR"; } else if ($var_country_code == "BE") { $selected_currency = "EUR"; } else if ($var_country_code == "BG") { $selected_currency = "EUR"; } else if ($var_country_code == "CY") { $selected_currency = "EUR"; } else if ($var_country_code == "CZ") { $selected_currency = "EUR"; } else if ($var_country_code == "DK") { $selected_currency = "EUR"; } else if ($var_country_code == "EE") { $selected_currency = "EUR"; } else if ($var_country_code == "FI") { $selected_currency = "EUR"; } else if ($var_country_code == "DE") { $selected_currency = "EUR"; } else if ($var_country_code == "GR") { $selected_currency = "EUR"; } else if ($var_country_code == "HU") { $selected_currency = "EUR"; } else if ($var_country_code == "IE") { $selected_currency = "EUR"; } else if ($var_country_code == "IT") { $selected_currency = "EUR"; } else if ($var_country_code == "LV") { $selected_currency = "EUR"; } else if ($var_country_code == "LU") { $selected_currency = "EUR"; } else if ($var_country_code == "MT") { $selected_currency = "EUR"; } else if ($var_country_code == "NL") { $selected_currency = "EUR"; } else if ($var_country_code == "PL") { $selected_currency = "EUR"; } else if ($var_country_code == "PT") { $selected_currency = "EUR"; } else if ($var_country_code == "RO") { $selected_currency = "EUR"; } else if ($var_country_code == "SK") { $selected_currency = "EUR"; } else if ($var_country_code == "SI") { $selected_currency = "EUR"; } else if ($var_country_code == "ES") { $selected_currency = "EUR"; } else if ($var_country_code == "SE") { $selected_currency = "EUR"; } else if ($var_country_code == "GB") { $selected_currency = "GBP"; } else if ($var_country_code == "IN") { $selected_currency = "INR"; } else if ($var_country_code == "MX") { $selected_currency = "MXN"; } else { $selected_currency = "USD"; } require_once "/home/username/public_html/blesta/api/blesta_api.php"; $user = "username"; $key = "key"; $url = "url"; $api = new BlestaApi($url, $user, $key); $company_id = 1; // Set acceptable currencies $valid_currencies = array("USD", "GBP", "EUR", "INR", "MXN", "AUD"); // Set default currency // Set another currency if given if (isset($_GET['currency']) && in_array(strtoupper($_GET['currency']), $valid_currencies)) $selected_currency = strtoupper($_GET['currency']); $price1 = getPackagePrice($api, 4, "month", 1); $price2 = getPackagePrice($api, 57, "year", 1); $price3 = getPackagePrice($api, 29, "month", 1); $price4 = getPackagePrice($api, 50, "month", 1); $price5 = getPackagePrice($api, 298, "year", 1); $price1_amount = formatCurrency($api, $price1->price, $price1->currency, $selected_currency, $company_id); $price2_amount = formatCurrency($api, $price2->price, $price2->currency, $selected_currency, $company_id); $price3_amount = formatCurrency($api, $price3->price, $price3->currency, $selected_currency, $company_id); $price4_amount = formatCurrency($api, $price4->price, $price4->currency, $selected_currency, $company_id); $price5_amount = formatCurrency($api, $price5->price, $price5->currency, $selected_currency, $company_id); function getPackagePrice($api, $package_id, $period, $term) { $package = $api->get("packages", "get", array('package_id' => $package_id))->response(); $package_price = null; foreach ($package->pricing as $price) { // Get monthly term if ($price->period == $period && $price->term == $term) { return $price; } } return false; } function formatCurrency($api, $amount, $from_currency, $to_currency, $company_id) { // Do the currency conversion $amount = $api->get("currencies", "convert", array('amount' => $amount, 'from_currency' => $from_currency, 'to_currency' => $to_currency, 'company_id' => $company_id))->response(); // Format the currency return $api->get("currencies", "toCurrency", array('value' => $amount, 'currency' => $to_currency, 'company_id' => $company_id))->response(); } ?>  
    Next, you're going to want to create your API credentials in Blesta and fill them in appropriately.
    After you've done this, simply place the following code (changing the numbers appropriately) where you would like to display the prices.
     
    <?php echo $price1_amount; ?>  
    Of course you can make modifications as you desire, but I wanted to share this with you in case anyone wanted to do the same.
  6. Like
    Michael Kinder got a reaction from Michael in Use Multi-Currency On Your Site Using GeoIP   
    Hi everyone! I just wanted to share this with you because I think it would be useful to those who aren't necessarily familiar with PHP and want to display different currencies based upon the user's IP address. Big thanks to @Blesta.Store for sharing a big portion of this code already on the forum. This will pull prices from Blesta's API and allow you to use multiple currencies.
     
    After you've uploaded the API SDK, you're going to want to download this file: https://www.geoplugin.com/_media/webservices/geoplugin.class.phps
    Upload that file into your site's directory, then take the contents below and place it at the top of your site files (or the pages where you will be displaying the prices).
     
    <?php require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); // create a variable for the country code $var_country_code = $geoplugin->countryCode; // redirect based on country code: if ($var_country_code == "AU") { $selected_currency = "AUD"; } else if ($var_country_code == "CA") { $selected_currency = "CAD"; } else if ($var_country_code == "AT") { $selected_currency = "EUR"; } else if ($var_country_code == "BE") { $selected_currency = "EUR"; } else if ($var_country_code == "BG") { $selected_currency = "EUR"; } else if ($var_country_code == "CY") { $selected_currency = "EUR"; } else if ($var_country_code == "CZ") { $selected_currency = "EUR"; } else if ($var_country_code == "DK") { $selected_currency = "EUR"; } else if ($var_country_code == "EE") { $selected_currency = "EUR"; } else if ($var_country_code == "FI") { $selected_currency = "EUR"; } else if ($var_country_code == "DE") { $selected_currency = "EUR"; } else if ($var_country_code == "GR") { $selected_currency = "EUR"; } else if ($var_country_code == "HU") { $selected_currency = "EUR"; } else if ($var_country_code == "IE") { $selected_currency = "EUR"; } else if ($var_country_code == "IT") { $selected_currency = "EUR"; } else if ($var_country_code == "LV") { $selected_currency = "EUR"; } else if ($var_country_code == "LU") { $selected_currency = "EUR"; } else if ($var_country_code == "MT") { $selected_currency = "EUR"; } else if ($var_country_code == "NL") { $selected_currency = "EUR"; } else if ($var_country_code == "PL") { $selected_currency = "EUR"; } else if ($var_country_code == "PT") { $selected_currency = "EUR"; } else if ($var_country_code == "RO") { $selected_currency = "EUR"; } else if ($var_country_code == "SK") { $selected_currency = "EUR"; } else if ($var_country_code == "SI") { $selected_currency = "EUR"; } else if ($var_country_code == "ES") { $selected_currency = "EUR"; } else if ($var_country_code == "SE") { $selected_currency = "EUR"; } else if ($var_country_code == "GB") { $selected_currency = "GBP"; } else if ($var_country_code == "IN") { $selected_currency = "INR"; } else if ($var_country_code == "MX") { $selected_currency = "MXN"; } else { $selected_currency = "USD"; } require_once "/home/username/public_html/blesta/api/blesta_api.php"; $user = "username"; $key = "key"; $url = "url"; $api = new BlestaApi($url, $user, $key); $company_id = 1; // Set acceptable currencies $valid_currencies = array("USD", "GBP", "EUR", "INR", "MXN", "AUD"); // Set default currency // Set another currency if given if (isset($_GET['currency']) && in_array(strtoupper($_GET['currency']), $valid_currencies)) $selected_currency = strtoupper($_GET['currency']); $price1 = getPackagePrice($api, 4, "month", 1); $price2 = getPackagePrice($api, 57, "year", 1); $price3 = getPackagePrice($api, 29, "month", 1); $price4 = getPackagePrice($api, 50, "month", 1); $price5 = getPackagePrice($api, 298, "year", 1); $price1_amount = formatCurrency($api, $price1->price, $price1->currency, $selected_currency, $company_id); $price2_amount = formatCurrency($api, $price2->price, $price2->currency, $selected_currency, $company_id); $price3_amount = formatCurrency($api, $price3->price, $price3->currency, $selected_currency, $company_id); $price4_amount = formatCurrency($api, $price4->price, $price4->currency, $selected_currency, $company_id); $price5_amount = formatCurrency($api, $price5->price, $price5->currency, $selected_currency, $company_id); function getPackagePrice($api, $package_id, $period, $term) { $package = $api->get("packages", "get", array('package_id' => $package_id))->response(); $package_price = null; foreach ($package->pricing as $price) { // Get monthly term if ($price->period == $period && $price->term == $term) { return $price; } } return false; } function formatCurrency($api, $amount, $from_currency, $to_currency, $company_id) { // Do the currency conversion $amount = $api->get("currencies", "convert", array('amount' => $amount, 'from_currency' => $from_currency, 'to_currency' => $to_currency, 'company_id' => $company_id))->response(); // Format the currency return $api->get("currencies", "toCurrency", array('value' => $amount, 'currency' => $to_currency, 'company_id' => $company_id))->response(); } ?>  
    Next, you're going to want to create your API credentials in Blesta and fill them in appropriately.
    After you've done this, simply place the following code (changing the numbers appropriately) where you would like to display the prices.
     
    <?php echo $price1_amount; ?>  
    Of course you can make modifications as you desire, but I wanted to share this with you in case anyone wanted to do the same.
  7. Like
    Michael Kinder got a reaction from Paul in Need a Register Form   
    Hello Uneschewed!
    The option to add an order form is not in the Billing Overview screen. Follow the steps outlined here in the documentation to create an order form. Just be sure to select Client Registration as the type: https://docs.blesta.com/display/user/Order+System#OrderSystem-CreatinganOrderForm
     
    Hope this helps!
  8. Like
    Michael Kinder got a reaction from activa in Trutone Blesta Integration   
    还不足以继续这个对话。
    I'll stick to English. ?
  9. Like
    Michael Kinder got a reaction from BeZazz in The PHP IMAP extension is required   
    Hi there, Gabriel!
    Thanks for reaching out to the community!
    IMAP is an extension in PHP and is required in order to process IMAP on your server via PHP execution. To install the PHP extension, follow the steps below.
    Login into your WHM panel via URL https://server-IP-Address:2087. In the left-hand menu pane, type EasyApache and you will see EasyApache4 option appearing. Click on EasyApache4 option.


      On the next screen, click on Customize button on current Apache settings. It will load your current Apache settings.



      Click the PHP Extensions option on the left side.
      Enable your choice of PHP modules for the PHP version you select (in this case you'll want to search for IMAP) and click on Next. 

      Once necessary PHP modules are selected, the setup will review all the selection. It may take between 2 to 15 minutes based on a number of selected modules.


      On the next screen, the setup will show the list of packages to be installed.


      Click on Provision button to install the packages you have selected.

     
     
    Hope this helps! 
  10. Like
    Michael Kinder got a reaction from activa in Use Multi-Currency On Your Site Using GeoIP   
    Hi everyone! I just wanted to share this with you because I think it would be useful to those who aren't necessarily familiar with PHP and want to display different currencies based upon the user's IP address. Big thanks to @Blesta.Store for sharing a big portion of this code already on the forum. This will pull prices from Blesta's API and allow you to use multiple currencies.
     
    After you've uploaded the API SDK, you're going to want to download this file: https://www.geoplugin.com/_media/webservices/geoplugin.class.phps
    Upload that file into your site's directory, then take the contents below and place it at the top of your site files (or the pages where you will be displaying the prices).
     
    <?php require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); // create a variable for the country code $var_country_code = $geoplugin->countryCode; // redirect based on country code: if ($var_country_code == "AU") { $selected_currency = "AUD"; } else if ($var_country_code == "CA") { $selected_currency = "CAD"; } else if ($var_country_code == "AT") { $selected_currency = "EUR"; } else if ($var_country_code == "BE") { $selected_currency = "EUR"; } else if ($var_country_code == "BG") { $selected_currency = "EUR"; } else if ($var_country_code == "CY") { $selected_currency = "EUR"; } else if ($var_country_code == "CZ") { $selected_currency = "EUR"; } else if ($var_country_code == "DK") { $selected_currency = "EUR"; } else if ($var_country_code == "EE") { $selected_currency = "EUR"; } else if ($var_country_code == "FI") { $selected_currency = "EUR"; } else if ($var_country_code == "DE") { $selected_currency = "EUR"; } else if ($var_country_code == "GR") { $selected_currency = "EUR"; } else if ($var_country_code == "HU") { $selected_currency = "EUR"; } else if ($var_country_code == "IE") { $selected_currency = "EUR"; } else if ($var_country_code == "IT") { $selected_currency = "EUR"; } else if ($var_country_code == "LV") { $selected_currency = "EUR"; } else if ($var_country_code == "LU") { $selected_currency = "EUR"; } else if ($var_country_code == "MT") { $selected_currency = "EUR"; } else if ($var_country_code == "NL") { $selected_currency = "EUR"; } else if ($var_country_code == "PL") { $selected_currency = "EUR"; } else if ($var_country_code == "PT") { $selected_currency = "EUR"; } else if ($var_country_code == "RO") { $selected_currency = "EUR"; } else if ($var_country_code == "SK") { $selected_currency = "EUR"; } else if ($var_country_code == "SI") { $selected_currency = "EUR"; } else if ($var_country_code == "ES") { $selected_currency = "EUR"; } else if ($var_country_code == "SE") { $selected_currency = "EUR"; } else if ($var_country_code == "GB") { $selected_currency = "GBP"; } else if ($var_country_code == "IN") { $selected_currency = "INR"; } else if ($var_country_code == "MX") { $selected_currency = "MXN"; } else { $selected_currency = "USD"; } require_once "/home/username/public_html/blesta/api/blesta_api.php"; $user = "username"; $key = "key"; $url = "url"; $api = new BlestaApi($url, $user, $key); $company_id = 1; // Set acceptable currencies $valid_currencies = array("USD", "GBP", "EUR", "INR", "MXN", "AUD"); // Set default currency // Set another currency if given if (isset($_GET['currency']) && in_array(strtoupper($_GET['currency']), $valid_currencies)) $selected_currency = strtoupper($_GET['currency']); $price1 = getPackagePrice($api, 4, "month", 1); $price2 = getPackagePrice($api, 57, "year", 1); $price3 = getPackagePrice($api, 29, "month", 1); $price4 = getPackagePrice($api, 50, "month", 1); $price5 = getPackagePrice($api, 298, "year", 1); $price1_amount = formatCurrency($api, $price1->price, $price1->currency, $selected_currency, $company_id); $price2_amount = formatCurrency($api, $price2->price, $price2->currency, $selected_currency, $company_id); $price3_amount = formatCurrency($api, $price3->price, $price3->currency, $selected_currency, $company_id); $price4_amount = formatCurrency($api, $price4->price, $price4->currency, $selected_currency, $company_id); $price5_amount = formatCurrency($api, $price5->price, $price5->currency, $selected_currency, $company_id); function getPackagePrice($api, $package_id, $period, $term) { $package = $api->get("packages", "get", array('package_id' => $package_id))->response(); $package_price = null; foreach ($package->pricing as $price) { // Get monthly term if ($price->period == $period && $price->term == $term) { return $price; } } return false; } function formatCurrency($api, $amount, $from_currency, $to_currency, $company_id) { // Do the currency conversion $amount = $api->get("currencies", "convert", array('amount' => $amount, 'from_currency' => $from_currency, 'to_currency' => $to_currency, 'company_id' => $company_id))->response(); // Format the currency return $api->get("currencies", "toCurrency", array('value' => $amount, 'currency' => $to_currency, 'company_id' => $company_id))->response(); } ?>  
    Next, you're going to want to create your API credentials in Blesta and fill them in appropriately.
    After you've done this, simply place the following code (changing the numbers appropriately) where you would like to display the prices.
     
    <?php echo $price1_amount; ?>  
    Of course you can make modifications as you desire, but I wanted to share this with you in case anyone wanted to do the same.
  11. Like
    Michael Kinder got a reaction from activa in Trutone Blesta Integration   
    Recently redid the website and here's the result of the integration into the new site design. What do you think?
     


  12. Like
    Michael Kinder got a reaction from activa in how to pass on paypal merchant fees?   
    A simple fix you could implement (I used to do this) is to setup a tax at a set percentage that will be sufficient to cover the PayPal fees and then once they pay, the fees will be taken from the total amount and you'll be left with the actual amount for the service.
  13. Like
    Michael Kinder got a reaction from Tyson in Use Multi-Currency On Your Site Using GeoIP   
    Hi everyone! I just wanted to share this with you because I think it would be useful to those who aren't necessarily familiar with PHP and want to display different currencies based upon the user's IP address. Big thanks to @Blesta.Store for sharing a big portion of this code already on the forum. This will pull prices from Blesta's API and allow you to use multiple currencies.
     
    After you've uploaded the API SDK, you're going to want to download this file: https://www.geoplugin.com/_media/webservices/geoplugin.class.phps
    Upload that file into your site's directory, then take the contents below and place it at the top of your site files (or the pages where you will be displaying the prices).
     
    <?php require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); // create a variable for the country code $var_country_code = $geoplugin->countryCode; // redirect based on country code: if ($var_country_code == "AU") { $selected_currency = "AUD"; } else if ($var_country_code == "CA") { $selected_currency = "CAD"; } else if ($var_country_code == "AT") { $selected_currency = "EUR"; } else if ($var_country_code == "BE") { $selected_currency = "EUR"; } else if ($var_country_code == "BG") { $selected_currency = "EUR"; } else if ($var_country_code == "CY") { $selected_currency = "EUR"; } else if ($var_country_code == "CZ") { $selected_currency = "EUR"; } else if ($var_country_code == "DK") { $selected_currency = "EUR"; } else if ($var_country_code == "EE") { $selected_currency = "EUR"; } else if ($var_country_code == "FI") { $selected_currency = "EUR"; } else if ($var_country_code == "DE") { $selected_currency = "EUR"; } else if ($var_country_code == "GR") { $selected_currency = "EUR"; } else if ($var_country_code == "HU") { $selected_currency = "EUR"; } else if ($var_country_code == "IE") { $selected_currency = "EUR"; } else if ($var_country_code == "IT") { $selected_currency = "EUR"; } else if ($var_country_code == "LV") { $selected_currency = "EUR"; } else if ($var_country_code == "LU") { $selected_currency = "EUR"; } else if ($var_country_code == "MT") { $selected_currency = "EUR"; } else if ($var_country_code == "NL") { $selected_currency = "EUR"; } else if ($var_country_code == "PL") { $selected_currency = "EUR"; } else if ($var_country_code == "PT") { $selected_currency = "EUR"; } else if ($var_country_code == "RO") { $selected_currency = "EUR"; } else if ($var_country_code == "SK") { $selected_currency = "EUR"; } else if ($var_country_code == "SI") { $selected_currency = "EUR"; } else if ($var_country_code == "ES") { $selected_currency = "EUR"; } else if ($var_country_code == "SE") { $selected_currency = "EUR"; } else if ($var_country_code == "GB") { $selected_currency = "GBP"; } else if ($var_country_code == "IN") { $selected_currency = "INR"; } else if ($var_country_code == "MX") { $selected_currency = "MXN"; } else { $selected_currency = "USD"; } require_once "/home/username/public_html/blesta/api/blesta_api.php"; $user = "username"; $key = "key"; $url = "url"; $api = new BlestaApi($url, $user, $key); $company_id = 1; // Set acceptable currencies $valid_currencies = array("USD", "GBP", "EUR", "INR", "MXN", "AUD"); // Set default currency // Set another currency if given if (isset($_GET['currency']) && in_array(strtoupper($_GET['currency']), $valid_currencies)) $selected_currency = strtoupper($_GET['currency']); $price1 = getPackagePrice($api, 4, "month", 1); $price2 = getPackagePrice($api, 57, "year", 1); $price3 = getPackagePrice($api, 29, "month", 1); $price4 = getPackagePrice($api, 50, "month", 1); $price5 = getPackagePrice($api, 298, "year", 1); $price1_amount = formatCurrency($api, $price1->price, $price1->currency, $selected_currency, $company_id); $price2_amount = formatCurrency($api, $price2->price, $price2->currency, $selected_currency, $company_id); $price3_amount = formatCurrency($api, $price3->price, $price3->currency, $selected_currency, $company_id); $price4_amount = formatCurrency($api, $price4->price, $price4->currency, $selected_currency, $company_id); $price5_amount = formatCurrency($api, $price5->price, $price5->currency, $selected_currency, $company_id); function getPackagePrice($api, $package_id, $period, $term) { $package = $api->get("packages", "get", array('package_id' => $package_id))->response(); $package_price = null; foreach ($package->pricing as $price) { // Get monthly term if ($price->period == $period && $price->term == $term) { return $price; } } return false; } function formatCurrency($api, $amount, $from_currency, $to_currency, $company_id) { // Do the currency conversion $amount = $api->get("currencies", "convert", array('amount' => $amount, 'from_currency' => $from_currency, 'to_currency' => $to_currency, 'company_id' => $company_id))->response(); // Format the currency return $api->get("currencies", "toCurrency", array('value' => $amount, 'currency' => $to_currency, 'company_id' => $company_id))->response(); } ?>  
    Next, you're going to want to create your API credentials in Blesta and fill them in appropriately.
    After you've done this, simply place the following code (changing the numbers appropriately) where you would like to display the prices.
     
    <?php echo $price1_amount; ?>  
    Of course you can make modifications as you desire, but I wanted to share this with you in case anyone wanted to do the same.
  14. Thanks
    Michael Kinder got a reaction from Paul in Use Multi-Currency On Your Site Using GeoIP   
    Hi everyone! I just wanted to share this with you because I think it would be useful to those who aren't necessarily familiar with PHP and want to display different currencies based upon the user's IP address. Big thanks to @Blesta.Store for sharing a big portion of this code already on the forum. This will pull prices from Blesta's API and allow you to use multiple currencies.
     
    After you've uploaded the API SDK, you're going to want to download this file: https://www.geoplugin.com/_media/webservices/geoplugin.class.phps
    Upload that file into your site's directory, then take the contents below and place it at the top of your site files (or the pages where you will be displaying the prices).
     
    <?php require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); // create a variable for the country code $var_country_code = $geoplugin->countryCode; // redirect based on country code: if ($var_country_code == "AU") { $selected_currency = "AUD"; } else if ($var_country_code == "CA") { $selected_currency = "CAD"; } else if ($var_country_code == "AT") { $selected_currency = "EUR"; } else if ($var_country_code == "BE") { $selected_currency = "EUR"; } else if ($var_country_code == "BG") { $selected_currency = "EUR"; } else if ($var_country_code == "CY") { $selected_currency = "EUR"; } else if ($var_country_code == "CZ") { $selected_currency = "EUR"; } else if ($var_country_code == "DK") { $selected_currency = "EUR"; } else if ($var_country_code == "EE") { $selected_currency = "EUR"; } else if ($var_country_code == "FI") { $selected_currency = "EUR"; } else if ($var_country_code == "DE") { $selected_currency = "EUR"; } else if ($var_country_code == "GR") { $selected_currency = "EUR"; } else if ($var_country_code == "HU") { $selected_currency = "EUR"; } else if ($var_country_code == "IE") { $selected_currency = "EUR"; } else if ($var_country_code == "IT") { $selected_currency = "EUR"; } else if ($var_country_code == "LV") { $selected_currency = "EUR"; } else if ($var_country_code == "LU") { $selected_currency = "EUR"; } else if ($var_country_code == "MT") { $selected_currency = "EUR"; } else if ($var_country_code == "NL") { $selected_currency = "EUR"; } else if ($var_country_code == "PL") { $selected_currency = "EUR"; } else if ($var_country_code == "PT") { $selected_currency = "EUR"; } else if ($var_country_code == "RO") { $selected_currency = "EUR"; } else if ($var_country_code == "SK") { $selected_currency = "EUR"; } else if ($var_country_code == "SI") { $selected_currency = "EUR"; } else if ($var_country_code == "ES") { $selected_currency = "EUR"; } else if ($var_country_code == "SE") { $selected_currency = "EUR"; } else if ($var_country_code == "GB") { $selected_currency = "GBP"; } else if ($var_country_code == "IN") { $selected_currency = "INR"; } else if ($var_country_code == "MX") { $selected_currency = "MXN"; } else { $selected_currency = "USD"; } require_once "/home/username/public_html/blesta/api/blesta_api.php"; $user = "username"; $key = "key"; $url = "url"; $api = new BlestaApi($url, $user, $key); $company_id = 1; // Set acceptable currencies $valid_currencies = array("USD", "GBP", "EUR", "INR", "MXN", "AUD"); // Set default currency // Set another currency if given if (isset($_GET['currency']) && in_array(strtoupper($_GET['currency']), $valid_currencies)) $selected_currency = strtoupper($_GET['currency']); $price1 = getPackagePrice($api, 4, "month", 1); $price2 = getPackagePrice($api, 57, "year", 1); $price3 = getPackagePrice($api, 29, "month", 1); $price4 = getPackagePrice($api, 50, "month", 1); $price5 = getPackagePrice($api, 298, "year", 1); $price1_amount = formatCurrency($api, $price1->price, $price1->currency, $selected_currency, $company_id); $price2_amount = formatCurrency($api, $price2->price, $price2->currency, $selected_currency, $company_id); $price3_amount = formatCurrency($api, $price3->price, $price3->currency, $selected_currency, $company_id); $price4_amount = formatCurrency($api, $price4->price, $price4->currency, $selected_currency, $company_id); $price5_amount = formatCurrency($api, $price5->price, $price5->currency, $selected_currency, $company_id); function getPackagePrice($api, $package_id, $period, $term) { $package = $api->get("packages", "get", array('package_id' => $package_id))->response(); $package_price = null; foreach ($package->pricing as $price) { // Get monthly term if ($price->period == $period && $price->term == $term) { return $price; } } return false; } function formatCurrency($api, $amount, $from_currency, $to_currency, $company_id) { // Do the currency conversion $amount = $api->get("currencies", "convert", array('amount' => $amount, 'from_currency' => $from_currency, 'to_currency' => $to_currency, 'company_id' => $company_id))->response(); // Format the currency return $api->get("currencies", "toCurrency", array('value' => $amount, 'currency' => $to_currency, 'company_id' => $company_id))->response(); } ?>  
    Next, you're going to want to create your API credentials in Blesta and fill them in appropriately.
    After you've done this, simply place the following code (changing the numbers appropriately) where you would like to display the prices.
     
    <?php echo $price1_amount; ?>  
    Of course you can make modifications as you desire, but I wanted to share this with you in case anyone wanted to do the same.
  15. Thanks
    Michael Kinder got a reaction from BeZazz in User Variables   
    Hey everyone! Paul asked me to share this with you guys, as it may come useful for anyone trying to identify logged in users in a chat system. Below are the variables you can use in the structure.pdt file.
    <?php $this->Html->_($contact->email);?> <?php echo $this->Html->_($contact->first_name, true) . ' ' . $this->Html->_($contact->last_name, true);?>  
  16. Thanks
    Michael Kinder got a reaction from Paul in User Variables   
    Hey everyone! Paul asked me to share this with you guys, as it may come useful for anyone trying to identify logged in users in a chat system. Below are the variables you can use in the structure.pdt file.
    <?php $this->Html->_($contact->email);?> <?php echo $this->Html->_($contact->first_name, true) . ' ' . $this->Html->_($contact->last_name, true);?>  
×
×
  • Create New...