0

I fear this may be a dumb question, but I can't figure out the answer.

If I have this

{{block type="catalog/product_list" name="home.catalog.product.list.new.arrivals" alias="products_homepage_arrivals" category_id="118" template="catalog/product/list-home.phtml"}}
{{block type="catalog/product_list" name="home.catalog.product.list.top.sellers" alias="products_homepage_sellers" category_id="119" template="catalog/product/list-home.phtml"}}
{{block type="catalog/product_list" name="home.catalog.product.list.most.popular" alias="products_homepage_popular" category_id="120" template="catalog/product/list-home.phtml"}}

embedded in my homepage, and the template is this:

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
    $_id = 'bx-slider-' . time() . uniqid();
?>
<div class="clearer"></div>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products slider-products">
    <ul id="<?php echo $_id ?>" class="products-grid">
    <?php $_collectionSize = $_productCollection->count() ?>
    <?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
        <li class="item">
            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(205,180); ?>" width="205" height="180" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
            <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
            <?php if($_product->getRatingSummary()): ?>
                <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
            <?php endif; ?>
            <?php echo $this->getPriceHtml($_product, true) ?>
        </li>
    <?php endforeach ?>
    </ul>
    <script>
        jQuery('#<?php echo $_id ?>').bxSlider({
              pager: false,
              minSlides: 1,
              maxSlides: 4,
              moveSlides: 1,
              infiniteloop: true,
              slideWidth: 220,
              slideMargin: 0
        });
    </script>
</div>
<?php endif; ?>

What is the recommended way to edit this?

What if I want to customer what qualifies as a new arrival or a most popular?

A lot of this code is referencing functionality that must be defined elsewhere like getLoadedProductCollection().

Do I overwrite it somehow? And where is the source of this and the other functions so I have a template from which I can edit?

1 Answer 1

0

All of the products in category_id="118", category_id="119" and category_id="120" are coming to that block in home page. Any product you assign to these categories will appear in that block.

You can simply assign any new product to those categories and they should show in home page.

getLoadedProductCollection() or any other function you see in that template are coming from Mage_Catalog_Block_Product_List class. This is core class of magento. If you want to modify or add any new function then you should overwrite it. Learn how to overwrite class in magento.

Hope this helps.

5
  • If you could post the relevant code here I can accept it as an answer, it may be bad practice to accept answers that rely heavily on hyperlinks which may or may not be functional in the future. Commented Jan 10, 2017 at 23:55
  • There are lot of links, answers on How to override classes in SE too. This is very basic thing in Magento and will be repetitive to add it here. Feel free to learn from that link, while it's functional now. Commented Jan 11, 2017 at 0:01
  • I'm not seeing how to overwrite a class, but I do see a lot of how to overwrite a model or controller. Commented Jan 16, 2017 at 2:11
  • I was referring class means all models and controllers along with blocks, helpers. For ex., in above link block class Mage_Tag_Block_Product_List is overridden. Commented Jan 16, 2017 at 2:36
  • Hmm okay, I will try that. Commented Jan 16, 2017 at 2:45

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.