Magento & Version Control

Please note: This is a working blog post which means I will be continuing to be editing the blog post as I have the time to include more information.

In 2016, we have self driving cars, Chipotle delivers (via postmates), and 1 gigabit internet speeds. If you are not using version control at this point, I am assuming you are a time traveler from the 1990s.

In a nutshell, version control allows you to see code history, easily allows you to bring code from your local machines, to a staging environment, to production. It also allows you to see if anyone has been editing your code on your servers (like a hacker was able to access your server) and so on.

Personally I use git for version control. There are two main companies that developers use. GitHub and BitBucket.

If you are brand new to version control (I am assuming this since you are reading this article), then you will start out simple. You probably will only have 1 or 2 branches (master & develop). You’ll work on the develop branch in your local and staging environments, and when you are happy with all your changes your merge develop into master.

Later on, you’ll create feature branches, hotfixes, etc. I will not go into detail on this, however I urge you to read this article:

I suggest getting started with this tutorial.

How to create custom log files for Magento 1

The standard way for logging is to use

Mage::log(“This will show up in var/log/system.log”);

However, you may want to split these up so specific information goes to the same place. To do this, you simply need to do:

Mage::log(“This will show up in var/log/custom.log”, null, custom.log);

If you need to add a variable you are trying to log, you would use:

Mage::log(“The variable is: ” . $variable, null, custom.log);

Why does Magento have 3 code pools?

app/code/core – Holds modules that are distributed with the base Magento and make up the core functionality.

app/code/community – Holds modules that are developed by third-parties

app/code/local – Holds custom modules you developed, including Mage code overrides.

Why does Magento use multiple code pools for our customization?

It will load local first, community second, and core third. It uses three for organization purposes and to help solve issues when two+ 3rd party extensions are trying to rewrite the same thing. In a example were you have two extensions in app/code/community trying to rewrite the same model, you can simply make a extension in app/code/local and merge the two extensions logic together.

Why doesn’t Magento use single code pool for customization?

It was done this was to try to have some code organization. Also, when you have 3rd party conflicts, the local is great to help solve those issues. The local is also great to have extensions that only that site will ever have.

Magento doesn’t displays group price

The issue:

I have multiple customer groups which have different prices then the standard price on the website. If the standard price is higher then the group price, the group price shows up. If the standard price is lower then the group price, the standard price is only displayed.


This is actually by design.

Magento will show the minimum price, because the retail price should always be higher then the group prices (otherwise, why wouldn’t the customer just not login then attempt to checkout).

This is evident in the following function:

 * Apply group price for product
 * @param Mage_Catalog_Model_Product $product
 * @param float $finalPrice
 * @return float
protected function _applyGroupPrice($product, $finalPrice)
    $groupPrice = $product->getGroupPrice();
    if (is_numeric($groupPrice)) {
        $finalPrice = min($finalPrice, $groupPrice);
    return $finalPrice;

Source: app/code/core/Mage/Catalog/Model/Product/Type/Price.php

So running through you scenario above, using EE 1.13, I logged into a customer account. The regular price of the product was $150. The retailer group price I set as $250, and the wholesale group price I set as $125. The wholesale displayed as $125, however the retailer group price was $150. Again, this is as design, it’s not a bug but a feature.

Backend PricesWholesale PricingRetailer Pricing

You can also try the logic by trying to add a “special price” that is greater then the regular price. The special price won’t show.

Solutions for your needs.

  1. Make sure your regular price is always higher then groups
  2. Possibly create an extension that extends the logic in app/code/core/Mage/Catalog/Model/Product/Type/Price.php (this may not be the only file you need to extend, however it is the file with the majority of the pricing logic).

If you do end up creating your own extension, always remember to never edit core code.

This was from my answer to this StackExchange question: