I'm working with the AW Mobile2 extension which works fine more or less. I notice the product image doesn't show up on the product view page. Unfortunately I do not see any related issue in the log files like "exception 'Mage_Core_Exception' with message 'Invalid block type'".
Debugging turned out out that Magento doesn't show the image because of the block type:
app/design/frontend/aw_mobile2/iphone/layout/catalog.xml
[Does not work]
<block type="aw_mobile2/catalog_product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
[Works]
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
app/code/local/AW/Mobile2/etc/config.xml
<global>
<blocks>
<aw_mobile2>
<class>AW_Mobile2_Block</class>
</aw_mobile2>
</blocks>
...
app/code/local/AW/Mobile2/Block/Catalog/Product/View/Media.php
class AW_Mobile2_Block_Catalog_Product_View_Media extends Mage_Catalog_Block_Product_View_Media
{
/**
* @return array|Varien_Data_Collection
*/
public function getGalleryImages()
{
if ($this->_isGalleryDisabled) {
return array();
}
return $this->_getMediaGalleryImages($this->getProduct());
}
/**
* @param Mage_Catalog_Model_Product $product
* @return Varien_Data_Collection
*/
protected function _getMediaGalleryImages($product)
{
if (!$product->hasData('media_gallery_images') && is_array($product->getMediaGallery('images'))) {
$images = new Varien_Data_Collection();
foreach ($product->getMediaGallery('images') as $image) {
if ($image['disabled'] && !$this->_isBaseImage($image, $product)) {
continue;
}
$image['url'] = $product->getMediaConfig()->getMediaUrl($image['file']);
$image['id'] = isset($image['value_id']) ? $image['value_id'] : null;
$image['path'] = $product->getMediaConfig()->getMediaPath($image['file']);
$images->addItem(new Varien_Object($image));
}
$product->setData('media_gallery_images', $images);
}
return $product->getData('media_gallery_images');
}
/**
* @param array $image
* @param Mage_Catalog_Model_Product $product
* @return bool
*/
protected function _isBaseImage($image, $product)
{
return (strcasecmp($product->getImage(), $image['file']) == 0);
}
}
The file permissions are also correct. Sure I could go with the working solution but I'm really wondering why the aw_mobile2 block type doesn't work. This part wasn't modified and should work though.
I stuck and appreciate any hint. Thanks!