2

I have 2 custom themes in magento. One is in default package and second is in SEPARATE package.Just like Below

  • default
    • iphone
    • default
  • magma
    • default

Now using design exception i want to use the default of magma.Can anyone help me how can i achieve that?

2

Go to:

System -> Configuration -> Design

If you click on the "Add Exception" you could define a new regular-expression followed by the package-name. As an example, a valid expression could be:

iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini

There is already a conversion about design-regex`s here.

If you want more infos just take a look at the method where the magic happens ;-) Mage_Core_Model_Design_Package::getPackageByUserAgent

 /**
 * Return package name based on design exception rules
 *
 * @param array $rules - design exception rules
 * @param string $regexpsConfigPath
 * @return bool|string
 */
public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = 'path_mock')
{
    foreach ($rules as $rule) {
        if (!empty(self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']])) {
            self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value'];
            return $rule['value'];
        }

        $regexp = '/' . trim($rule['regexp'], '/') . '/';

        if (@preg_match($regexp, $_SERVER['HTTP_USER_AGENT'])) {
            self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']] = true;
            self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value'];
            return $rule['value'];
        }
    }

    return false;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.