Testing Credit Card Numbers

In Payment Gateway on February 3rd, 2012

Just in case you might have been searching around for the right image to use on your eCommerce web page or shopping cart, here are some images that might help. You can copy the Plug In HTML code directly into your webpage! Test credit card numbers and card prefixes are listed at the bottom of the page!

Testing Card type and number

MasterCard: 5431111111111111
MasterCard: 5399 9999 9999 9999 (ogone)
Amex: 341111111111111
Discover: 6011601160116611
American Express (15 digits) 378282246310005
American Express (15 digits) 371449635398431
American Express Corporate (15 digits) 378734493671000
Diners Club (14 digits) 30569309025904
Diners Club (14 digits) 38520000023237
Discover (16 digits) 6011111111111117
Discover (16 digits) 6011000990139424
JCB (16 digits) 3530111333300000
JCB (16 digits) 3566002020360505
MasterCard (16 digits) 5555555555554444
MasterCard (16 digits) 5105105105105100
Visa (16 digits) 4111111111111111
Visa (16 digits) 4012888888881881
Visa (13 digits) 4222222222222

Card Format

Visa: 13 or 16 numbers starting with 4
MasterCard: 16 numbers starting with 5
Discover:16 numbers starting with 6011
AMEX:15 numbers starting with 34 or 37

CKEditor and Image upload

In Javascript on November 2nd, 2011

CKEditor is excellent RTF (WYSIWYG) editor, but in latest version they remove image upload features. That was inbuilt in earlier version. Now they have CKFInder, a plugin which need to be purchased. There is nothing wrong that they want to earn money with CKFinder plugin. Still thanks to CKEditor team, they made easy to integrate third party plugins.

I have found another easy and free way to integrate file upload, it is called FileManager. So, here is how I integrated file upload in CKEditor.

  1. Download FileManger from here http://labs.corefive.com/Projects/FileManager/. Or from here https://github.com/simogeo/Filemanager
  2. Follow instruction in readme.md file. of instruction in above link to configure FileManger and connector.
  3. Now, all you to do is change config.js (full pate ckeditor/config.js) file of your CKEditor.  Below is sample configuration I kept:
  1. CKEDITOR.editorConfig = function( config )
  2. {
  3.  // Define changes to default configuration here. For example:
  4.  // config.language = 'fr';
  5.  // config.uiColor = '#AADC6E';
  6.  config.filebrowserBrowseUrl = 'http://myhost.com/filemanager/index.html';
  7.   config.filebrowserImageBrowseUrl = 'http://myhost.com/filemanager/index.html?type=Images&currentFolder=/Image/';
  8.   config.filebrowserFlashBrowseUrl = 'http://myhost.com/filemanager/index.html?type=Flash&currentFolder=/Flash/';
  9.   config.filebrowserUploadUrl = 'http://myhost.com/filemanager/connectors/php/filemanager.php?mode=add&type=Files&currentFolder=/File/';
  10.   config.filebrowserImageUploadUrl = 'http://myhost.com/filemanager/connectors/php/filemanager.php?mode=add&type=Images&currentFolder=/Image/';
  11.   config.filebrowserFlashUploadUrl = 'http://myhost.com/filemanager/connectors/php/filemanager.php?mode=add&type=Flash&currentFolder=/Flash/';
  12.  
  13. };

Magento – Currency Converter in multi-site multi-currency website

In Magento on August 16th, 2011

While working multi-site and multi-currency, one way to convert currency:

  1. $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
  2. $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
  3. $price = 100;
  4.  
  5. // convert price from current currency to base currency
  6. $priceOne = Mage::helper('directory')->currencyConvert($price, $currentCurrencyCode, $baseCurrencyCode);
  7.  
  8. // convert price from base currency to current currency
  9. $priceTwo = Mage::helper('directory')->currencyConvert($price, $baseCurrencyCode, $currentCurrencyCode);

Above code is copied from Mukesh’s blog.

Another way to convert currency is:

  1. $price = "100";
  2. $block = Mage::getBlockSingleton('checkout/cart_shipping');
  3. $block->getQuote()->getStore()->convertPrice(Mage::helper('tax')->getShippingPrice($price));

Above code automatically convert the base currency to current currency.