Public snippet   |  Code orientation PHP  |   Tested for Magento version 1.3.1.1 Testing Magento code can be tedious. Here we create a testing file that allows us to run many of the snippets you'll find here on snippi.net.
Create a file called, 'test.php' in the root of your Magento development environment.
Copy the code below into your test.php file.
Browse to http://yourstore/test.php.

<?php

// Tell this file to use the Mage libraries
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
umask(0);

// Note we are using the 'app' directive not the 'run' directive here
// Also note the store is named 'default' by, well, default.  But as Zeke pointed out if your store is
// 'en' then you  would need to edit the following line to say Mage::app('en')
// Let's go with 'default' for simplicity ...
Mage::app('default');

// Your test code goes here
// Let's find out what entity type id Magento is using for customers
$customerEavTypeId = Mage::getModel('eav/entity')->setType('customer')->getTypeId();
print_r("Customer Entity Type ID: " . $customerEavTypeId);

Total snippets

158

Who's new

  • Naguripisto
  • Stolenfinche
  • anhreg
  • HamuroGTRx
  • almotaRom
 
Magento Code Snippets by the developers for developers :) | Established & Maintained by Branko Ajzele from ActiveCodeline