1

Trying to display some featured products on the homepage using widgets. The first product will show up, the other will not. I cannot find anything in the Apache error log, Magento's system.log, nor exception.log. Can anybody help me debug this?

CMS Code

{{widget type="catalog/product_widget_link"
         anchor_text="Product A" 
         template="catalog/product/widget/link/link_block.phtml" 
         id_path="product/223552"}}
{{widget type="catalog/product_widget_link"
         anchor_text="Product B" 
         template="catalog/product/widget/link/link_block.phtml" 
         id_path="product/261339"}}

Some things to note:

  • The order of the widgets does not matter, 223552 always shows up while 261339 does not
  • Flat product table is enabled
    • Both 223552 and 261339 exist in the flat product table
    • I did not notice any missing attributes in 261339 that may be required
  • Both products are enabled and are visible
  • Have cleared cache and full page cache, no effect
  • Have reindexed everything, no effect

1 Answer 1

2

If we look at Mage_Catalog_Block_Widget_Link::_toHtml (which is the class that block extends) we can see that nothing will be output if there is no href. Investigation of getHref in the same class will show that the only way this can return false is:

$urlRewriteResource = Mage::getResourceSingleton('core/url_rewrite');
$href = $urlRewriteResource->getRequestPathByIdPath($this->getData('id_path'), $store);
if (!$href) {
    return false;
}

So best guest would be that if you have a multistore setup, the product isn't associated with the store. Otherwise the value is assumably just not in the table, check your core_rewrite_table for the value product/261339 in the id_path. If it's not there the your url reindex either needs running or is not completing correctly.

1
  • Very helpful. I assumed (incorrectly) that the 'core/url_rewrite' model would be searching the new enterprise_url_rewrite table as well. It is not.
    – nachito
    Dec 14, 2013 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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