Stop disabled Magento products appearing in Google Content

Since I can remember there have been problems with Magento’s built in Google Merchant Center product submission called google base in your Magento Admin.

Now to align themselves with google’s new api they have released the Google Content API for Shopping extension which seems to work well enough. But like the previous versions it still has the ridiculous quirk of showing your disabled products in when you click “view Available Products.” This is plain daft as to me disabled should be considered unavailable   in this context.

A simple fix requires you edit some core code, so if you plan on doing this make sure you have backups etc etc. It is tested in Magento version 1.5.0.1 with the above extension installed. If you have older versions of Magento have a look at this post on the forums

In your favoured ftp/code editor head to your html folder/app/code/core/Mage/GoogleShopping/Block/adminhtml/items/product.php

find line 141 hit return there to make a little space and add the code below

$this->addColumn('status',
array(
'header'=> Mage::helper('catalog')->__('Status'),
'width' => '70px',
'index' => 'status',
'type'  => 'options',
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
));

This will ad a column on the end called status like below

nice new column

if you then select enabled and hit return you can then “select visible” products and send them to the google merchant center (which you will have to of previously set up of course)

Cheers

18 Responses to Stop disabled Magento products appearing in Google Content

  1. Al says:

    Awesome, thanks for the enhancement! Magento’s Google products feature is not great and full of bugs and missing features. It doesnt help with google changing their requirements every month!

    Still, hope the team can take on board enhancements like yours to make it into a better feature for the future.

  2. Rob says:

    This is great!

    I was trying to add the product visibility in the same way, but not sure where you find the exact names to create that?

    Also, is there any way to add this to the list of product already added to google, so that I can go through items no longer active and delete them, this would reduce errors at google of products not being found.

    Any help would be great!

    Thanks

    • dougal says:

      Hi Rob
      Re if products have already been added to google, I’m not sure off the top of my head (not working much with Magento recently), I would have thought that using the synchronize action may accomplish the same or similar… Will have a quick look at visibility when I get a mo…

      • Rob says:

        I thought the Synchronise would remove them, but I have items that are not being removed, but marked as out of stock. I thought this was fine, but have started getting errors about google not being able to crawl those products.

        So the products do not get listed, but google gets upset and starts talking about suspending the account because of these products.

        With the enhancement you made though, deleting all the products and re-adding the live ones make it much less of an issue (in theory)

  3. Rob says:

    I just worked out the first question, how to get the Visibility on the same page:


    $this->addColumn('visibility', array(
    'header'=> Mage::helper('catalog')->__('Visibility'),
    'width' => '70px',
    'index' => 'visibility',
    'type' => 'options',
    'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
    ));

  4. I add the above code to /app/code/local/Mage/GoogleShopping/Block/Adminhtml/Items/Product.php and now I am getting an error: Call to a member function setStoreId() on a non-object in /app/code/core/Mage/GoogleShopping/Model/Item.php on line 65
    here is the section:
    if (is_null($this->_serviceItem)) {
    $this->_serviceItem = Mage::getModel(‘googleshopping/service_item’)
    ->setStoreId($this->getStoreId());
    }
    return $this->_serviceItem;

      • Sorry, some times I forget that. I am using magento version 1.6.2.0 and Google content version 1.6.0.0. I tried 1.8.1.0 but it was too full of bugs. I have learned to put my modifications in /app/code/local/… , so to turn my Mods off I just rename the /Mage/GoogleShopping to xGoogleShopping. The orginal files are at /app/code/core/Mage/GoogleShopping/Block/Adminhtml/Items/Product.php. Here is more of the file effected:
        class Mage_GoogleShopping_Model_Item extends Mage_Core_Model_Abstract
        {
        /**
        * Regestry keys for caching attributes and types
        *
        * @var string
        */
        const TYPES_REGISTRY_KEY = ‘gcontent_types_registry’;

        /**
        * Service Item Instance
        *
        * @var Mage_GoogleShopping_Model_Service_Item
        */
        protected $_serviceItem = null;

        protected function _construct()
        {
        parent::_construct();
        $this->_init(‘googleshopping/item’);
        }

        /**
        * Return Service Item Instance
        *
        * @return Mage_GoogleShopping_Model_Service_Item
        */
        public function getServiceItem()
        {
        if (is_null($this->_serviceItem)) {
        $this->_serviceItem = Mage::getModel(‘googleshopping/service_item’)
        ->setStoreId($this->getStoreId());
        }
        return $this->_serviceItem;
        }

        /**
        * Set Service Item Instance
        *
        * @param Mage_GoogleShopping_Model_Service_Item $service
        * @return Mage_GoogleShopping_Model_Item
        */
        public function setServiceItem($service)
        {
        $this->_serviceItem = $service;
        return $this;
        }
        It says line 65 but I think the error is a little further up.
        Thank James Niland

Leave a Reply

Your email address will not be published. Required fields are marked *