The following code retrieves the name of a product’s manufacturer. $manufacturer = $product->getAttributeText(‘manufacturer’);
Getting a product’s type (Magento 1)
Use this code to determine a product’s type (such as simple or configurable):
|
1 2 |
// configurable, simple, ... $type = $product->getTypeId(); |
Could not determine temp directory, please specify a cache_dir manually (Magento 2)
If your Magento 2 store displays the error Could not determine temp directory, please specify a cache_dir manually , Magento cannot access the temporary PHP directory. Fix this by setting sys_temp_dir in php.ini to a directory that your store can…
Running MageSetup in Magento 2
If you have installed MageSetup for Magento 2, you still need to apply it so that tax rules and other configuration data are created. Run the following command in the Linux shell to generate the MageSetup configuration:
|
1 |
php bin/magento magesetup:setup:run de. |
You can…
Generating CSS and JavaScript files manually for de_DE (Magento 2)
Sometimes JavaScript and CSS assets in Magento 2 are not loaded correctly. If you need to generate the JavaScript and CSS resources manually, you can do so from the Linux command line. The following command generates the files:
|
1 |
php bin/magento setup:static-content:deploy de_DE |
German language pack for Magento 2
Magento 2 is a powerful and fast ecommerce platform. Unfortunately, it does not come with German translations out of the box. With the Sprachpaket from Splendid can quickly provide the missing translations.
Category page loads extremely slowly (Magento 1)
If your Magento category pages are extremely slow, Magento swatches may be the culprit. Override /app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php and remove
|
1 2 3 4 |
// normalize to all lower case before we start using them $optionLabels = array_map(function ($value) { return array_map('Mage_ConfigurableSwatches_Helper_Data::normalizeKey', $value); }, $optionLabels); |
from its original location, then insert that code immediately above the surrounding foreach loop. This can substantially improve category page load…
Magento 2 Expert
If you are having trouble with your Magento 2 store or would like advice and development support for an upcoming Magento 2 project, simply get in touch. I will be happy to help. I look forward to hearing from you.
Sorting order items by SKU (Magento 1)
To display ordered products sorted by SKU in the order view, override the app/design/adminhtml/default/default/template/sales/order/view/items.phtml in your theme and replace
|
1 2 3 4 5 6 7 8 |
<?php $_items = $this->getItemsCollection() ?> <?php $i=0;foreach ($_items as $_item):?> <?php if ($_item->getParentItem()) continue; else $i++;?> <tbody class="<?php echo $i%2?'even':'odd' ?>"> <?php echo $this->getItemHtml($_item) ?> <?php echo $this->getItemExtraInfoHtml($_item) ?> </tbody> <?php endforeach; ?> |
with
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $_items = $this->getItemsCollection() ?> <?php $_sortedItems = array(); ?> <?php foreach ($_items as $_item) : ?> <?php $_sortedItems[$_item->getSku()] = $_item;?> <?php endforeach;?> <?php ksort($_sortedItems); // Sort by array keys ?> <?php $i=0;foreach ($_sortedItems as $_item):?> <?php if ($_item->getParentItem()) continue; else $i++;?> <tbody class="<?php echo $i%2?'even':'odd' ?>"> <?php echo $this->getItemHtml($_item) ?> <?php echo $this->getItemExtraInfoHtml($_item) ?> </tbody> <?php endforeach; ?> |
That’s it. When you open an order containing two or more products, they will now be displayed in…