Magento Forum

Page 1 of 2
Solve magento 1.4.1 the upgrade problem
 
bzhang
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2009-02-25
Sydney
 

I have to say that the stable version of magento 1.4.1 is not that stable!!
Please release the CE version with checking the unimplemented methods in the core code.
I have found and solve the problem of toolbars display error for the new magento 1.4.1
first of all, for more developers if you want to see the errors prints in the frontend without checking errors using a reference number
do the following in the SSH or use your ftp.

cd errors/
cp local.xml.sample ./local.xml
which means you can just rename the local.xml.sample to local.xml to make all the error message print in the frondend.

Now you may have the errors for the toolbar pager as most of CE user will have their custom theme and the 1.3.2 and older all follow the same theme structure but in 1.4.0+ they change the toolbar class

Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template
which used to be
class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Page_Block_Html_Pager
but now they add a mothed to show the pager which listing the pages in Mage_Catalog_Block_Product_List_Toolbar the toolbar.phtml there is code
<?php echo $this->getPagerHtml() ?>
which call this method
/**
     * Render pagination HTML
     *
     * @return string
     */
    public function getPagerHtml()
    
{
        $pagerBlock 
$this->getChild('product_list_toolbar_pager');

        if (
$pagerBlock instanceof Varien_Object{

            
/* @var $pagerBlock Mage_Page_Block_Html_Pager */
            
$pagerBlock->setAvailableLimit($this->getAvailableLimit());

            
$pagerBlock->setUseContainer(false)
                ->
setShowPerPage(false)
                ->
setShowAmounts(false)
                ->
setLimitVarName($this->getLimitVarName())
                ->
setPageVarName($this->getPageVarName())
                ->
setLimit($this->getLimit())
                ->
setFrameLength(Mage::getStoreConfig('design/pagination/pagination_frame'))
                ->
setJump(Mage::getStoreConfig('design/pagination/pagination_frame_skip'))
                ->
setCollection($this->getCollection());

            return 
$pagerBlock->toHtml();
        
}

        
return '';
    
}
but they have not implement the method of setUseContainer(false) and setShowAmounts(false)
to solve this problem first you need to add a child to toolbar which is too simple in their release note saying “In layout of any custom theme the usage of catalog/product_list_toolbar block should be changed to page/html_pager:
1) Replace the catalog/product/list/toolbar.phtml of your theme by the new one
2) Update catalog.xml layout: <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> should be replaced into <block type="page/html_pager" name="product_list_toolbar_pager"/> “
the correct way should be add this to the catalog.xml
<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 type="page/html_pager" name="product_list_toolbar_pager"/> 
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
            </
block>
        </
reference>
    </
catalog_category_default>
there is 2 place to add <block type="page/html_pager" name="product_list_toolbar_pager"/> within the <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
which can make it as a child of toolbar otherwise you can’t call method of getChild in the toolbar.php
after that you may need to add the method to page/html/pager.php which i will hack the core code as I can handle all the update and even though make a local overwrite class is better but I don’t want any more update as they release all the errors “stable” version I will have to check everything after updated so I prefer hard code it.
class Mage_Page_Block_Html_Pager extends Mage_Core_Block_Template
{
    
protected $_collection null;
    protected 
$_pageVarName    'p';
    protected 
$_limitVarName   'limit';
    protected 
$_availableLimit = array(10=>10,20=>20,50=>50);
    protected 
$_dispersion     3;
    protected 
$_displayPages   5;
    protected 
$_showPerPage    true;
    protected 
$_limit          null;
    protected 
$_outputRequired true;
    protected 
$_showAmount true// added attributes
    
protected $_showContainer true//added attributes
and at the end of the file add
public function setShowAmounts($varName)
    
{
           $this
->_showAmount $varName;
        return 
$this;
    
}
    
public function getShowAmounts()
    
{
        
return $this->_showAmount;
    
}
    
public function setUseContainer($varName)
    
{
           $this
->_showContainer $varName;
        return 
$this;
    
}
    
public function getShowContainer()
    
{
        
return $this->_showContainer;
    
}
then you still need to change the pager.phtml file
<?php
/**
 * Pager template
 *
 * @see Mage_Page_Block_Html_Pager
 */
?>
<?php 
if($this->getCollection()->getSize()): ?>
<?php 
if($this->getShowContainer()): ?>
<div class="pager">  <!-- this is the container -->
<?php endif; ?>
    <?php 
if($this->getShowAmounts()): ?>
    
<class="amount">  <!-- this is the show amounts-->
        
<?php if($this->getLastPageNum()>1): ?>
            <?php 
echo $this->__('Items %s to %s of %s total'$this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
        <?php 
else: ?>
            <?php 
echo $this->__('%s Item(s)'$this->getTotalNum()) ?>
        <?php 
endif; ?>
    
</p>
    
<?php endif; ?>

    <?php 
if($this->getShowPerPage()): ?>
    
<fieldset class="limiter">
        <
label><?php echo $this->__('Show'?></label>
        <
select onchange="setLocation(this.value)">
        
<?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
            
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
                
<?php echo $_limit ?>
            
</option>
        
<?php endforeach; ?>
        
</select<?php echo $this->__('per page'?>
    
</fieldset>
    
<?php endif ?>    

    <?php 
if($this->getLastPageNum()>1): ?>
    
<div class="pages">
        <
strong><?php echo $this->__('Page:'?></strong>
        <
ol>
        
<?php if (!$this->isFirstPage()): ?>
            
<li><a href="<?php echo $this->getPreviousPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/back.png') ?>" alt="<?php echo $this->__('Previous Page') ?>" class="v-middle" /></a></li>
        
<?php endif ?>
        <?php 
foreach ($this->getPages() as $_page): ?>
            <?php 
if ($this->isPageCurrent($_page)): ?>
                
<li><span class="current"><?php echo $_page ?></span></li>
            
<?php else: ?>
                
<li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
            
<?php endif ?>
        <?php 
endforeach;; ?>
        <?php 
if (!$this->isLastPage()): ?>
            
<li><a href="<?php echo $this->getNextPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/next.png') ?>" alt="<?php echo $this->__('Next Page') ?>" class="v-middle" /></a></li>
        
<?php endif ?>
        
</ol>
    </
div>
    
<?php endif; ?>
<?php 
if($this->getShowContainer()): ?>
</div>
<?php endif; ?>
<?php 
endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
STEP_Software
Jr. Member
 
Total Posts:  22
Joined:  2009-01-27
 

Thanks!
After reading hundreds(!) of posts this one solved my problems (no products showing, no “next page”...) with my theme ("Freemagetheme") after installing magento 1.4.
best regards
Patrick

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

Well, I just added <block type="page/html_pager" name="product_list_toolbar_pager"/> after <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> and it solve my problem at categories pages.

The problem of many pages still remains at result search page, I tried to tweak according your thread but nothing happens, that´s the same result as just add the portion of code that I said above.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nic
Jr. Member
 
Total Posts:  5
Joined:  2008-02-13
 

Sounds simple when you say ...

cd errors/
cp local.xml.sample ./local.xml

But I cant even find the errors directory. I am using a hosted server via plesk so I cant just search for it.

Anyone able to give me the full path please

 
Magento Community Magento Community
Magento Community
Magento Community
 
bzhang
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2009-02-25
Sydney
 

Continue for the search result page toolbar template fixed.
As the toolbar using the same toolbar function in product list and the only thing you need to change is the catalogsearch.xml
to update the new changes in 1.4.0.1 as they have modified a little of the template structure.
just look for the code like below in catalogsearch.xml

<catalogsearch_result_index>
        <
remove name="right.reports.product.viewed" />
        <
remove name="left.menu" />
        <
reference name="root">
            <
action method="setTemplate"><template>page/3columns.phtml</template></action>
        </
reference>
        <
reference name="left">
            <
block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
        </
reference>
        <
reference name="content">
            <
block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"></block>
                <
action method="setListOrders"/>
                <
action method="setListModes"/>
                <
action method="setListCollection"/>
            </
block>
        </
reference>
    </
catalogsearch_result_index>
/***
* more codes here
**/
  
<catalogsearch_advanced_result>
        <!-- 
Mage_Catalogsearch -->
        <
reference name="root">
            <
action method="setTemplate"><template>page/3columns.phtml</template></action>
        </
reference>
        <
remove name="left.menu"/>
        <
reference name="left">
            <
block type="catalogsearch/advanced_form" name="left_catalogsearch_advanced_form" before="-" template="catalogsearch/advanced/searchmenu.phtml"/>
        </
reference>
        <
reference name="content">
            <
block type="catalogsearch/advanced_result" name="catalogsearch_advanced_result" template="catalogsearch/advanced/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"></block>
                <
action method="setListOrders"/>
                <
action method="setListModes"/>
                <
action method="setListCollection"/>
            </
block>
        </
reference>
    </
catalogsearch_advanced_result>
you can see there is 2 result page for simple query search and the advanced search, in these pages you may have a problem of showing the result pages, you can’t choose the page to view as the pager is not loaded according to the old version of magento 1.3.2 ot 1.3.4
now all you need to do is to add the following code to both result index reference block
<reference name="content">
            <
block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
                    <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <
block type="page/html_pager" name="product_list_toolbar_pager"/>
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
                <
action method="setListOrders"/>
                <
action method="setListModes"/>
                <
action method="setListCollection"/>
            </
block>
        </
reference>
////// more codes
<reference name="content">
            <
block type="catalogsearch/advanced_result" name="catalogsearch_advanced_result" template="catalogsearch/advanced/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
                    <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <
block type="page/html_pager" name="product_list_toolbar_pager"/>
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
                <
action method="setListOrders"/>
                <
action method="setListModes"/>
                <
action method="setListCollection"/>
            </
block>
        </
reference>
the only thing changed is to add “<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>"
the toolbar block name seems important but I don’t have time to find out the code, and it works perfectly so I don’t care right now.
the more thing you can look at is just to compare your custom theme to the new template of 1.4.0.1 “base” folder, it is all the required base template for magento 1.4 so if any wrong in your theme happens that means you have to change them to something according to the new template in the “base” folder. Hope this will help you guys!

Currently I am still developing the supplier portal of magento which is not supported by either enterprice edition or CE which can allow provider to update and create product themselve. Even though you can use the api they provide, it can be a solution, but you still have to change a lot of api code and it do not support many functions especially the custom option added to the products. But I can do it and making it uses the customer session and make the process all AJAX which is good for load time. Hope I can come up with something.

Free is everything! Support CE

 
Magento Community Magento Community
Magento Community
Magento Community
 
mykkal
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2010-01-29
 
STEP_Software - 25 February 2010 05:48 AM

Thanks!
After reading hundreds(!) of posts this one solved my problems (no products showing, no “next page”...) with my theme ("Freemagetheme") after installing magento 1.4.
best regards
Patrick

I will try this fix. My products aren’t showing either.
How did they miss this? We need an updated installation. I wish I had not!

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

You must reindex all data. Go to “Configuration” -> “Index Managment” and reindex all points. If one of them don’t update that’s it, the reason for no products.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Willbe
Jr. Member
 
Total Posts:  3
Joined:  2009-12-04
 

When adding <block type="page/html_pager" name="product_list_toolbar_pager"/> to catalog.xml, you have to know that there are two “catalog/product_list_toolbar” blocks—under <catalog_category_default> and next section, <catalog_category_layered>. So be sure to add “product_list_toolbar_pager” block into both sections. That helped me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cole Geissinger
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-12-23
Northern California
 

thanks @willbe!! This saved me from my headache.... although, after using @bzhang’s code....nothing happened but now my admin area is completely blank.... It doesn’t even spit out any HTML!!! HELP!! I need to fix this!!!!

Any suggestions? I removed all the code supplie from @bzhang, but the problem is still there!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cole Geissinger
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-12-23
Northern California
 

solved my problem. In the process of that I copied my extensions into the modules folder and found the Fooman Speedster extension was blocking my admin area. Make sure you disable Fooman Speedster!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Togireta Melody
Jr. Member
 
Total Posts:  1
Joined:  2009-10-25
Indonesia
 

Woww!! . it’s works in magento 1.4.0.1, thanks for your tutorial . . . 

Warm regards,

Li

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dorgo
Sr. Member
 
Total Posts:  127
Joined:  2008-12-16
 

thanks bzhang!

Solved most of the problems I was having with the pager. Only thing I did differently was merge pager.phtml with the one from 1.4. Seemed to work better than replacing.

Strangely, all the categories and both searches are working correctly now except for my first category… which still does not show pages in the pager.
I have refreshed all cache and indexes.

any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Erick Paulino
Jr. Member
 
Total Posts:  9
Joined:  2009-10-19
 

Hi there.

I\’m just writing to say thank you. It helped me a lot. I spend the whole night awaken trying to solve the issue of no paginantion in search results, and now, at 7 am, I found this thread, and it solved my problem. Now I can sleep!

 
Magento Community Magento Community
Magento Community
Magento Community
 
vsimon
Jr. Member
 
Total Posts:  14
Joined:  2009-07-06
 

Great work. Solved my entire pager problem in 1.4
You do make it clear, but needs to be restated, that your amendments need to be made on *both* base search and advanced search blocks in catalogsearch.xml

 
Magento Community Magento Community
Magento Community
Magento Community
 
auhoque
Jr. Member
 
Total Posts:  17
Joined:  2009-08-18
Bangladesh
 

Thanks bzhang for your great work and time.

Take care

 
Magento Community Magento Community
Magento Community
Magento Community
 
remie
Jr. Member
 
Total Posts:  17
Joined:  2009-02-13
 

Working with 1.4.1 and this fix doesn’t seem to be working for me.

<!--
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 type="page/html_pager" name="product_list_toolbar_pager"/> 
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
            </
block>
        </
reference>
    </
catalog_category_default>

<!--
Category layered navigation layout
-->

    <
catalog_category_layered>
        <
reference name="left">
            <
block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.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">
                    <!-- <
action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
                    <
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>3</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>
                            <
action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
                            <
action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
                            <
action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
                            <
action method="addPagerLimit"><mode>grid</mode><limit>all</limit><label>All</label></action>
                        -->
                        <
block type="page/html_pager" name="product_list_toolbar_pager"/> 
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
            </
block>
        </
reference>

As you can see, I believe I have the new code addition <block type="page/html_pager" name="product_list_toolbar_pager"/> in the correct place in both places of my catalog.xml file.  I applied this change on my frontend to base, default, and my own store folders’ catalog.xml files and still no effect.

I also went further and applied the changes to my pager.phtml and .php files as was suggested.  I reindexed after everything.  I’m still getting the same error when I visit my categories.

Any help or ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2