Advertisement
jayelkaake

Magento Store Credit Extension Simple Example

Jan 28th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. // Loads a blank page and displays something like "This customer's store credit balance is $150.25"
  3. // If you don't already have the Magecredit Magento extension you can get it at www.magecredit.com
  4.  
  5. require_once('app/Mage.php'); //Path to Magento
  6. umask(0);
  7. Mage::app();
  8.  
  9. // The next line loads the magecredit customer balance model.
  10. $_balance = Mage::getModel('wf_customerbalance/balance')
  11.             ->setCustomerId(136) // change this to whatever your customer ID is.
  12.             ->loadByCustomer();
  13.  
  14. // This line formats the amount using the currently loaded store's currency
  15. $_amount = Mage::app()->getStore()->formatPrice( $_balance->getAmount() );
  16.  
  17. // Example Output: This customer's store credit balance is $150.25
  18. echo Mage::helper('core')->__('This customer\'s store credit balance is %s', $_amount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement