Hot answers tagged

98

Debugging is a bit of an art, but something that can easily be mastered by following a simple regimen. Follow each point until you finally reach a solution. Enable PHP Errors This is key to most issues. For security or other reasons, PHP error display could likely be disabled by default by your PHP configuration. You can enable errors with a more ...


78

I've managed to stabalize the issue as follows: Step 1: Rewrite the Catalog URL model (Using your own module: How To) Note: If you overwrite the core file without using a rewrite this will render your instance of Magento incapable of future upgrades. As per Jahnni's solution on the MagentoCommerce boards (no longer active with new board), app/code/...


45

While I hope someone here comes up with an answer, I don't know that you'll find one. This table gets bulky for a lot of different reasons. Bugs in earlier (and possibly current) versions of Magento is one. Another is there's logic in this table that tries to track changes to the URL key value so that 301/302 rewrites are setup for old products. Because ...


27

Yes it does. First of all, less modules means less code to (potentially) load and process. Next to that, a lot of modules, like for example the Mage_Rss module run a lot of code in the background like forcing reindexes on certain events. On the method best to use: disabling a module using System > Configuration > Advanced only suppresses the output of ...


24

I would like to add a fix for this url rewrite indexer bug which has been developed at the bugathon in March 2013 and which has been further improved afterwards. It should solve this issue. As a reference, here is the patch file from the link: diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php --- ...


19

isAvailable() looks like this: public function isAvailable() { return $this->getTypeInstance(true)->isSalable($this) || Mage::helper('catalog/product')->getSkipSaleableCheck(); } This means that the result of the method depends on the product type. Each product type has a isSalable() method: Mage_Catalog_Model_Product_Type_Grouped::...


18

As requested on Twitter and discussed on Meta I'll start here a debugging tutorial for non-devs. First I think (even thou magento tries to engage this) Magento is too complex for a merchant without developer/development team. But if you are brave and want to try it, we are giving our best here to help you. I think for some questions is the border between "...


14

Create a file in app/etc/modules called Zzz.xml (so it loaded last) with this content <?xml version="1.0"?> <config> <modules> <Mage_Downloadable> <active>false</active> </Mage_Downloadable> <Mage_Authorizenet> <active>false</active> &...


14

Despite being late with an answer I would like to answer the question You gain even more performance if you physically remove the files. Simply all of them, except Mage_Core ;-) But to disable tight couple modules you need to install another module which takes care that nothing will break. Therefore I've developed: https://github.com/Zookal/magento-mock ...


13

I just spoke to Magento community manager today and besides other things I raised this question. He agreed that this is an issue and assured that they are working on it and will make a community contribution clockwork run again soon. How soon? Who knows. Until then there's unfortunately no alternative.


13

Maybe it's a little bit late, but for anyone who is searching for the correct answer here it is Mage::getSingleton('core/resource')->getTableName('customer_entity'); It will returns "yourtableprefix_customer_entity"


12

There is a list of design patterns which are used in Magento on Stack Overflow From the article: The obvious ones are: Factory: $product = Mage::getModel('catalog/product'); Singleton: $category = Mage::getSingleton('catalog/session'); Registry: $currentCategory = Mage::registry('current_category'); View Helper: Mage::helper('...


12

After you applied the patch posted by Simon, you can use the following query to remove junk data: DELETE FROM core_url_rewrite WHERE is_system <> 1 AND id_path REGEXP "^[0-9]+_[0-9]+$" AND (request_path REGEXP ".*-[0-9]*\.html" OR target_path = request_path); In contrast to Ashish Hira's query, this only effects URLs which have an ...


11

Unfortunately the core/messages.phtml file is not used for the messages you're speaking of. All the HTML is generated on the Block level in Mage_Core_Block_Messages. The good news is you can control the tags used in the messages by calling these functions: Mage_Core_Block_Messages::setMessagesFirstLevelTagName($tagName) Mage_Core_Block_Messages::...


10

See Marius' answer regarding a simple and quick XML way of disabling modules. Create a single file zzz_Disabled_Modules.xml with the contents <?xml version="1.0"?> <config> <modules> <Mage_Rss> <active>false</active> </Mage_Rss> <Mage_PaypalUk> <active>...


10

Here is the order in which you should customize core features. Start from the top and if one option is not possible go to the next one. Observers Class rewrites Copy class to local folder. Edit the core - Do this only if you want the universe to implode on itself. The observers approach is the safest. Observers usually don't disappear on an upgrade and ...


9

You need to override this model: Mage_Cms_Model_Template_Filter Mage_Widget_Model_Template_Filter and add a method for your own shortcode. Let's assume your short code is called 'custom', you need to add a method called customDirective($construction) that handles your shrotcode. To get an idea on how that method should look like, take a look at ...


9

When you rewrite a helper class, it will only take effect when you use Mage::helper('...'). However, most helper classes extend from Mage_Core_Helper_Data directly and then, the original class is used :( For example: class My_Custom_Helper_Class extends Mage_Core_Helper_Data { } If you want to rewrite such a class in all cases, you can use the ugly ...


9

Decided to implement Go! AOP framework in Magento. See Danslo_Aop on github.


9

You can try with app/design/frontend/{Vendor}/{Theme}/web/css/source/lib/_navigation.less Read more: How to override gallery.css


8

You can try this simple module to override \Magento\Catalog\Model\Product class. It 100% works on my local Magento 2 test environment. Base folder: app\code Directory tree: └── Example └── OverrideModel ├── composer.json ├── etc │   ├── frontend │   │   └── di.xml │   └── module.xml ├── Model │   ...


8

Use \Magento\Framework\View\Asset\Repository class to get view file url in block file protected $_assetRepo; public function __construct( ... \Magento\Framework\View\Asset\Repository $assetRepo, ... ) { ... $this->_assetRepo = $assetRepo; ... } Now, you can get image URL by echo $this->_assetRepo->getUrl("Vendor_Module::...


7

It's used by some Magento modules like Authorizenet as a fallback page for iframes. Other uses I have't found for it yet. The actual URL will be set with javascript most likely, the blank html page is just to give it something to initially load.


7

You can use Bootstrap to run Application which will return you response object. Here is official example from index.php file: <?php require __DIR__ . '/app/bootstrap.php'; $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2'; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website'; $bootstrap = \...


7

You Cannot Override Admin Files Directly In Your Theme. You Need Custom Module For Overriding Admin Files OR Use Existing Custom Module. 1) Copy vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml to app/code/Vendor/Module/view/adminhtml/templates/order/view/info.phtml 2) Create sales_order_view.xml at app/code/Vendor/Module/view/...


6

Here are a couple of things to try: Manually delete the var/cache folder contents. Check you don't have compilation enabled Check that you don't have APC enabled Check the App.php still exists under app/code/core/Mage/Core/Model and that you didn't accidentally changed the content. From your error log: Warning: include(): Failed opening 'Mage/Core/Model/...


6

I've implemented the accepted answer with success. On another Magento install I needed to preserve some custom rewrites so I deleted all entries that ended in a - and then a number up to 5 digits long with: DELETE FROM `core_url_rewrite` WHERE `request_path` REGEXP '\\-[0-9]{1,5}$'; This mostly worked but I still get 2 more rows on each re-index. Not sure ...


6

In Magento Enterprise the is a new module for storing url rewrite Enterprise_UrlRewrite. This module contains new tables for storing the rewrites, some layout files for the admin section, a new admin html controller and a new url matcher to name but a few items. To understand when the enterprise system uses the new tables for saving rewrites we can first ...


6

First of all, it's better to have custom helpers than to override core classes. If you use your helper in templates and you don't want to get errors if you disable your module, you should handle your helper calls like this. Let's say your extension is called MyNamespace_MyExtension and you call your helper like this: Mage::helper('myextension')->...


6

Probably the first rule in Magento development : never touch the core You can either: create your own module in app/code/local and add the library in the module folder if that library is already Magento code or if it's pure PHP and not Magento code still create your own module in app/code/local and add the library under the lib folder In both case you ...


Only top voted, non community-wiki answers of a minimum length are eligible