I was recently asked for help on a Google Checkout problem where the Google Checkout Button on the Magento cart page was disabled with a message saying: “Not available with these items“.
I had a look at the Magento store in question and found a few clues to go on but a
Google search on the subject proved to be of little help unfortunately. The button looks like the one shown in the screenshot below:
The underlying URL for the button is:
<img src="https://checkout.google.com/buttons/checkout.gif?merchant_id=5677186919&w=180&h=46&style=white&variant=disabled&loc=en_US" alt="Fast checkout through Google" /> |
The big clue was the parameter on the Google Checkout button image URL on the problem store. It had variant=disabled
which is generated server side, and so had to be coming from somewhere within Magento. A big fat grep
over the code uncovered a variant='
string fragment in Link.php
.
Here is the code in context you can see that the variant is set to disabled if the getIsDisabled()
returns true
:
public function getImageUrl() { $url = 'https://checkout.google.com/buttons/checkout.gif'; $url .= '?merchant_id='.Mage::getStoreConfig('google/checkout/merchant_id'); $v = $this->getImageStyle(); $url .= '&w='.$v[0].'&h='.$v[1].'&style='.$v[2]; $url .= '&variant='.($this->getIsDisabled() ? 'disabled' : 'text'); $url .= '&loc='.Mage::getStoreConfig('google/checkout/locale'); return $url; } |
Further along in the same class we find:
public function getIsDisabled() { $quote = Mage::getSingleton('checkout/session')->getQuote(); /* @var $quote Mage_Sales_Model_Quote */ foreach ($quote->getAllVisibleItems() as $item) { /* @var $item Mage_Sales_Model_Quote_Item */ if ($item->getProduct()->getDisableGooglecheckout()) { return true; } } return false; } |
So there it is, there is some sort of switch in Magento here which tells a product to either be enabled or disabled for Google Checkout. This is one of my pet peeves with the EAV architecture Magento employs. It’s quite tricky to then find the actual place where this data is stored/defined. Liberal use of grep did uncover what I was looking for in an sql upgrade script:
$installer->addAttribute('catalog_product', 'disable_googlecheckout', array( 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Not available for purchase with Google Checkout', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '0', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => '', 'is_configurable' => false )); |
So now a quick survey of the Product Admin tabs uncovered this on the Price Tab – don’t ask me why this is a price option, but nevertheless that is where it resides:
Here you will find the option drop down, as shown below:
This was a feature introduced in Magento 1.2 to help stores that want to use Google Checkout but have some products which may breach the Google Checkout policies. Great idea.
The question remains, and hopefully we will find out, if somehow the setting has been turned on for the user who posted a comment having difficulty with this disabled Google Checkout button during Magento checkout.
I upgraded and had this issue and had no clue it was a new magento “feature.” I assumed my upgrade was broken. 🙁
Thank you for this detailed post! Saved me hours of debugging. 🙂
Thank you! Exactly what I needed to know.
I just ran into this after upgrading to 1.3.0.
Does this mean that I will have to manually update HUNDREDS of products to “Yes” or is there a global setting somewhere? I’ve searched around and don’t see a global setting but thought perhaps someone else has found it.
Thanks!
You can bulk update magento products by doing this:
1) Go to Catalog -> Manage products
2) Click the ‘select all’ link and it should show ‘X items selected’
3) Under the Actions drop down choose ‘update attributes’ then submit.
4) This takes you to a bulk update page, where you can choose to change the Google Checkout status for all of your products.
If you have 1000’s of products this might time out or crash. In which case let me know because I will write some SQL to do it and post it here. But only if there is a need for it.
Cheers,
Ashley
Much needed SQL update script for this problem. I want to fix the database once and for all, as at present I simply disable this check.
1000’s of products, so yes, Magento WILL crash..
I have written about about how to bulk update your Magento products to enable them for Google Checkout. Let me know how you go.
I have google checkout enabled, but i get the grayed out logo. If you click the logo it takes you to checkout. Am I missing something in your fix. Do I have to manually override it somehow?
That’s really odd, because normally if it is grey you can’t click it. Can you check the URL of the image?
Great post! Just wanted to let you know you have a new subscriber- me!
You could just change the function in /app/code/core/Mage/GoogleCheckout/Block/Link.php to reverse the check:
public function getIsDisabled()
{
$quote = Mage::getSingleton(‘checkout/session’)->getQuote();
/* @var $quote Mage_Sales_Model_Quote */
foreach ($quote->getAllVisibleItems() as $item) {
/* @var $item Mage_Sales_Model_Quote_Item */
if (!$item->getProduct()->getEnableGooglecheckout()) {
return false;
}
}
return true;
}
@Greg Don’t change core files!. Also that might mean that new products (where the boolean is correct) would be disabled instead of enabled? Certainly if you do what Greg suggests, make a local copy of the core file, and test it first before making the change in production.
@Ashley.. You are right, my bad. Although for anyone in my position where I have 90K products and want all of them available via Google Checkout it is an option… The script works, but on that many products it takes a while, and with daily updates it may never end!
Ashley,
Thanks for posting this, I was bitten by the exact same problem. Products->Prices — sneaky place to hide this Google Checkout setting, since pricing has nothing to do with checkout.
greate just what i wanted