Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6759719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:58:54+00:00 2026-05-26T13:58:54+00:00

I’ll try to provide as much context as possible. Been trying to override Mage_GoogleShopping_Model_Attribute_Link

  • 0

I’ll try to provide as much context as possible.

Been trying to override Mage_GoogleShopping_Model_Attribute_Link for 2 days now but I’m unable to get Magento to pickup my version of the file.

Mage_GoogleShopping_Model_Attribute_Link class is in app/code/core/Mage/GoogleShopping/Model/Attribute/Link.php

I put my class Safoo_Froogle_GoogleShopping_Model_Attribute_Link in /app/code/local/Safoo/Froogle/GoogleShopping/Model/Attribute/Link.php

Then my config.xml:

<global>
...
 <models>
        <safoofroogle>
            <class>Safoo_Froogle_Model</class>
        </safoofroogle>
        <googleshopping>
            <rewrite>
              <attribute_link>Safoo_Froogle_GoogleShopping_Model_Attribute_Link</attribute_link>
            </rewrite>
      </googleshopping>
    </models>
    <helpers>
      <googleshopping>
            <rewrite>
              <price>Safoo_Froogle_GoogleShopping_Helper_Price</price>
            </rewrite>
      </googleshopping>
    </helpers>

(Note the Helper Rewrite above works perfectly.)

I debugged the call to the Link model in Mage_GoogleShopping_Model_Type::_createAttribute

protected function _createAttribute($name)
{
    $modelName = 'googleshopping/attribute_' . $this->_prepareModelName($name);
    $useDefault = false;
###LOGGING###
    Mage::log($modelName); 
    Mage::log(get_class(Mage::getModel($modelName)  )); 
###LOGGING###
    try {
        $attributeModel = Mage::getModel($modelName);
        $useDefault = !$attributeModel;
    } catch (Exception $e) {
        $useDefault = true;
    }
    if ($useDefault) {
        $attributeModel = Mage::getModel('googleshopping/attribute_default');
    }
    $attributeModel->setName($name);

    return $attributeModel;
}

And this is the result of the 2 log statements:

2011-11-01T06:57:17+00:00 DEBUG (7): googleshopping/attribute_Link
2011-11-01T06:57:17+00:00 DEBUG (7): Mage_GoogleShopping_Model_Attribute_Link

So Mage::getModel('googleshopping/attribute_Link') is still fetching Mage_GoogleShopping_Model_Attribute_Link.

The only way I’ve been able to override the class is to copy the Link.php file into the corresponding local directory: app/code/local/Mage/GoogleShopping/Model/Attribute/Link.php but wanted to avoid that.

Just not working. My Helper Overload works. And I thought I should be able to override this class just like shown here:

http://www.magentocommerce.com/boards/viewthread/222046

http://www.magentocommerce.com/boards/viewthread/35787/

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:58:54+00:00Added an answer on May 26, 2026 at 1:58 pm

    You’ve uncovered a bug in the Mage_GoogleShopping_Model_Type class that’s preventing your rewrite from being applied. Based on your debugging, here’s the code that eventually gets called to instantiate a model

    Mage::getModel('googleshopping/attribute_Link')
    

    Although it’s not enforced everywhere in code, it’s a well established guideline that all class aliases ('googleshopping/attribute_Link' is a class alias) should be lowercase. Because of the capital letter L in attribute_Link, when Magento looks for the class name to use in a rewrite, it searches for a node named with a capital L.

    <attribute_Link>Safoo_Froogle_GoogleShopping_Model_Attribute_Link</attribute_Link>
    

    Fortunately, you can work around this. Just make your config.xml rewrite section look like this, and your rewrite should work

    <googleshopping>
        <rewrite>
            <attribute_Link>Safoo_Froogle_GoogleShopping_Model_Attribute_Link</attribute_Link>
            <attribute_link>Safoo_Froogle_GoogleShopping_Model_Attribute_Link</attribute_link>
        </rewrite>
    </googleshopping>
    

    This way you’ll catch instantiations in the form Mage::getModel('googleshopping/attribute_Link') AND in the form Mage::getModel('googleshopping/attribute_link').

    For future reference, when you’re debugging rewrites, the

    Mage_Core_Model_Config::getGroupedClassName
    

    method in

    app/code/core/Mage/Core/Model/Config.php 
    

    is where Magento does its lookup for class rewrites.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
I have been unable to fix a problem with Java Unicode and encoding. The
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.