Sometimes the web service used to update exchange rates is unavailable, causing the error WARNING: Cannot retrieve rate from http://www.webservicex.net/CurrencyConvertor.asmx… to appear. The free extension FixerIOCurrencyImport can resolve the problem.
Getting shipment item data (Magento 1)
Use the following code to retrieve the data for a Magento shipment item, such as its short description or description.
|
1 2 |
$description = $shipmentItem->getOrderItem()->getProduct()->getDescription(); $whatever = $shipmentItem->getOrderItem()->getProduct()->getWhatever(); |
Logging in Magento 2
You can write messages to Magento 2′s system.log using the following code:
|
1 |
$this->_logger->info('... message ... '); |
How secure is your Magento store?
“How secure is my Magento store, and can customers safely buy from it?” Do you ask yourself this occasionally? You can find an answer at http://magereport.com , quickly and completely free of charge. No registration required. If any security problems…
Fixing Allowed memory size exhausted during compilation (Magento 2)
If you receive the message Allowed memory size of 123456789 bytes exhausted during Magento 2 compilation, you can try increasing the available memory by specifying -dmemory_limit=5G . The command might look like this:
|
1 |
php -dmemory_limit=5G bin/magento setup:di:compile |
Checking the Magento version via the command line
The following command displays the Magento 2 version in your shell. Run it from the Magento 2 root directory.
|
1 |
php bin/magento --version |
Getting the currency symbol (Magento 1)
Use the following code to retrieve the appropriate currency symbol:
|
1 2 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode(); $symbol = Mage::app()->getLocale()->currency($currency)->getSymbol(); |
Enabling template hints in Magento 2
In Magento 2, you can find Template Hints under Shops > Erweitert > Entwickler > Debuggen. Easy once you know where to look
SUPEE-9767 form key validation fix script (Magento 1)
The changes required after installing Magento patch SUPEE-9767 can be time-consuming. To save time, you may also run the scripts listed at https://gist.github.com/schmengler/c42acc607901a887ef86b4daa7a0445b. They do not work in every case, but they can still be useful.