Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

URL rewrites malfunctioning
 
Sintax
Member
 
Total Posts:  58
Joined:  2008-02-18
Hungary
 

Hi,

I have a store setup with multiple categories and products. When I view a product from the category it works perfectly, however when this item gets added to the recently viewed list or the cart and I try clicking the URL from there I get the following error:

On 1.1 and 1.0:
“Fatal error: Call to a member function getProductCollection() on a non-object in D:\Projects\Magento\app\code\core\Mage\Catalog\Model\Layer.php on line 41”

This is funny since in case of the catalog the url looks like this:
http://localhost/Magento/main-cat/sub-cat-01/simple-product.html

It gets added to the recently viewed as:
http://localhost/Magento/simple-product.html

which throws the error described above.

How can I resolve this problem?

::Sintax

 
Magento Community Magento Community
Magento Community
Magento Community
 
Consofas
Jr. Member
 
Total Posts:  29
Joined:  2008-05-21
 

i have also found this is happening.

Did you find a solution yet?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Consofas
Jr. Member
 
Total Posts:  29
Joined:  2008-05-21
 

Not entirely sure but I got it working by replacing some of the code in catalog.xml

<!--
Default 
layoutloads most of the pages
-->

    <default>

        <!-- 
Mage_Catalog -->
        <
reference name="top.menu">
            <
block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/>
        </
reference>
        <
reference name="left">
            <
block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml">
                <
action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
                <
action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (800DEMO-NUMBER.</alt></action>
                <
action method="setLinkUrl"><url>checkout/cart</url></action>
            </
block>
        </
reference>
        <
reference name="right">
            <
block type="core/template" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
            <
block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml"/>
        </
reference>
        <
reference name="footer_links">
            <
action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map"><label>Site Map</label><url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
        </
reference>

    </default>


<!--
Category default layout
-->

    <
catalog_category_default>
        <
reference name="left">
            <
block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
        </
reference>
        <
reference name="content">
            <
block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <
block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <!-- 
The following code shows how to set your own pager increments -->
                        <!--
                            <
action method="setDefaultListPerPage"><limit>4</limit></action>
                            <
action method="setDefaultGridPerPage"><limit>9</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                            <
action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                        -->
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
            </
block>
        </
reference>
    </
catalog_category_default>

Hope this helps

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top