Chú ý khi nâng cấp lên Magento 1.4

Thảo luận trong 'Hướng dẫn nâng cấp' bắt đầu bởi admin, 26 Tháng hai 2010.

  1. admin

    admin Mai Văn Hải Staff Member

    Có một thay đổi nhỏ cho phiên bản Magento 1.4.0. khi bạn nâng cấp nhưng vẫn dùng template cũ sẽ bị lỗi về phần đếm trang khi xem catalog, khi đó bạn làm như sau:
    1. Mởi file catalog.xml trong template của bạn, sau đó tìm đến dòng:
    Mã:
    <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
    Thêm vào bên dưới đoạn sau:
    Mã:
    <block type="page/html_pager" name="product_list_toolbar_pager"/>
    2. Sau đó mở file app/design/frontend/default/YOUR_THEME/template/catalog/product/list/toolbar.phtml và pass đè đoạn code sau:
    Mã:
    <?php
    /**
     * Product list toolbar
     *
     * @see Mage_Catalog_Block_Product_List_Toolbar
     */
    ?>
    <?php if($this->getCollection()->getSize()): ?>
    <div class="toolbar">
        <div class="pager">
            <p class="amount">
                <?php if($this->getLastPageNum()>1): ?>
                    <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
                <?php else: ?>
                    <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
                <?php endif; ?>
            </p>
    
            <div 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') ?>
            </div>
    
            <?php echo $this->getPagerHtml() ?>
    
        </div>
    
        <?php if( $this->isExpanded() ): ?>
        <div class="sorter">
            <?php if( $this->isEnabledViewSwitcher() ): ?>
            <p class="view-mode">
                <?php $_modes = $this->getModes(); ?>
                <?php if($_modes && count($_modes)>1): ?>
                <label><?php echo $this->__('View as') ?>:</label>
                <?php foreach ($this->getModes() as $_code=>$_label): ?>
                    <?php if($this->isModeActive($_code)): ?>
                        <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
                    <?php else: ?>
                        <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
                    <?php endif; ?>
                <?php endforeach; ?>
                <?php endif; ?>
            </p>
            <?php endif; ?>
        
            <div class="sort-by">
                <label><?php echo $this->__('Sort by') ?></label>
                <select onchange="setLocation(this.value)">
                <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
                    <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                        <?php echo $_order ?>
                    </option>
                <?php endforeach; ?>
                </select>
                <?php if($this->getCurrentDirection() == 'desc'): ?>
                    <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
                <?php else: ?>
                    <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
                <?php endif; ?>
            </div>
        </div>
        <?php endif; ?>
    </div>
    <?php endif ?>
    
  2. kira145

    kira145 New Member

    Cám ơn anh Hải ^^e đã làm được, a chỉ chi tiết quá^^

Chia sẻ trang này