This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); | |
// http://mysitedomain.com/ | |
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); | |
// http://mysitedomain.com/skin/ | |
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); | |
// http://mysitedomain.com/media/ | |
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); | |
// http://mysitedomain.com/index.php/ | |
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include the Mage.php(app/Mage.php) file residing in app folder of magento to our file which resides outside of magento folder . | |
<?php | |
// Include Magento application | |
require_once ( "/var/www/your-magento-directory/app/Mage.php" ); | |
umask(0); | |
// Initialize Magento | |
Mage::app("default"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app\code\core\Mage\Core\Model\App.php | |
<?php | |
public function dispatchEvent($eventName, $args){ | |
$eventName = strtolower($eventName); | |
foreach ($this->_events as $area=>$events) { | |
/* add this */ | |
//Mage::log($eventName, null, 'events.log'); | |
//Mage::log("test", null, 'events.log'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Firstly PHP creates a unique identifier number (a random string of 32 hexadecimal number, e.g 3c7foj34c3jj973hjkop2fc937e3443) for an individual session. | |
PHPSESSID cookie passes that unique identification number to users’ browser to save that number. | |
A new file is created on the server with the same name of unique identification number with sess_ prefix (ie sess_3c7foj34c3jj973hjkop2fc937e3443.) | |
The browser sends that cookie to the server with each request. | |
If PHP gets that unique identification number from PHPSESSID cookie (on each request), then PHP searches in the temporary directory and compares that number to the file name. If both are the same, then it retrieves the existing session, otherwise it creates a new session for that user. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We need to be sure that PHP modules ext-mcrypt and ext-intl are loaded. PHP 7 that comes with MAMP already has them, we just need to be sure the OS uses the MAMP version. | |
Check the location of PHP : | |
which php | |
If the output is /usr/bin/php it means the default OSX PHP version is loaded and we need to change it. | |
Edit .bash_profile: | |
sudo nano ~/.bash_profile | |
or | |
sub ~/.bash_profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The quote is created when you call Mage::getSingleton("checkout/session")->getQuote(). Check how the method Mage_Checkout_Model_Session::getQuote works. If there is a quote for the specified customer it returns it. If not, it creates one and returns it | |
is_active field is used in the following cases: | |
is_active is always 1 for cart/quote created by web user | |
is_active is always 0 for cart/quote created from admin | |
To load quote by Customer Id, is_active = 1 is taken into account | |
When quote is converted to order, is_active becomes 0 | |
To restore the quote which is cleared by payment errors etc during checkout., make is_active = 1 | |
When you create a quote via API, is_active is always 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Magento provides a capability for adding options that aren't product attributes or product custom options. They are set on the product and quote items with the option code additional_options. | |
There are two steps you need to take, each can be handled via an event observer. If you want the additional options to carry through reordering, you will need also observe a third event. | |
Add options to quote item | |
The first step is to add the event observer to set the additional options on the loaded product before it is added to the cart. One option is to use the catalog_product_load_after event. | |
<catalog_product_load_after> | |
<observers> | |
<extra_options> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo getcwd(); | |
define('MAGENTO_ROOT', getcwd()); | |
$mageFilename = MAGENTO_ROOT . '/app/Mage.php'; | |
require_once $mageFilename; | |
Mage::app()->loadArea('frontend'); | |
// access the magento session outside | |
$customerSession = Mage::getModel('customer/session'); | |
print_r($customerSession); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SEE version | |
php -v | |
# See What loaded | |
which php | |
# See settings (memory_limit) | |
php -i | grep memory_limit | |
or | |
php -r "echo ini_get('memory_limit').PHP_EOL;" |