If the error message Required parameter ‘theme_dir’ was not passed appears in your Magento 2 store, the cause is very likely the themetable. It contains theme entries whose file paths no longer exist on the server. Solution: Open Tabelle theme…
Product images missing on category pages (Magento 2)
If product images are missing on your category pages after an upgrade, for example, the following shell command may help (run it from your Magento 2 root directory): php magento catalog:images:resize Note: Depending on the number of products, this process…
Restricting maintenance mode by IP address (Magento 1)
When you create maintenance.flag in Magento’s root directory, the entire store becomes unavailable, including the admin area. That is inconvenient if you still need to work on the site. Add the following code at the beginning of index.php to allow…
Setting the size of a collection programmatically (Magento 1)
Use this code to set the page size of a Magento collection programmatically:
|
1 |
$orders = Mage::getResourceModel('sales/order_collection')->setPageSize(100); |
Adding a custom library / PHP script (Magento 1)
If you would like to add your own library / custom PHP script to Magento, simply copy it to the /lib folder and name it the required way. Place your lib into /lib/MyOwnLib/MyLib.php for example and name the class inside…
Adding a custom library or PHP script (Magento 1)
To make a custom PHP library available in Magento, copy it into the lib directory and give it an appropriate name. For example, put the library in /lib/MyLibFolder/MyLib.php, name the file MyLib.php and structure it as follows:
|
1 2 3 |
class MyLibFolder_MyLib { // ... } |
You can…
Overriding standard translations (Magento 1)
Open your theme’s translate.csv file and add the following content as a new line:
|
1 |
"Mage_Catalog::Choose an Option...","Wählen Sie eine Option" |
This allows you to override the default translation of “Choose an Option…” with your own translation. You only need the original English text (“Choose an…
Getting a category attribute value (Magento 1)
You can use this code to retrieve any attribute of a Magento category:
|
1 |
$attributeValue = $category->getData('attribute_code'); |
Getting the PayPal transaction ID (Magento 1)
Use the following code to get the Magento PayPal transaction ID from an order object: $transactionId = $order->getPayment()->getLastTransId();
Getting the PayPal transaction ID (Magento 1)
Use this code to retrieve the PayPal transaction ID for a Magento order:
|
1 |
$transactionId = $order->getPayment()->getLastTransId(); |