0

I try to add a product rather than as a new product but still be accessible from other pages such as categories or related products. In the admin panel, Set Product as New from Date and Set Product as New to Date has been filled in correctly. But the product still exists in the block of new products on the home page.

EDITED.

File edited from public_html/app/code/core/Mage/Catalog/Block/Product/New.php

This the code :

$collection = Mage::getResourceModel("catalog/product_collection');
$collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
        $collection = $this->_addProductAttributesAndPrices($collection)
            ->addStoreFilter()
            // this is the code i've edited
            ->addAttributeToFilter('is_new_product', array('eq' => 1)) 
            ->addAttributeToSort('news_from_date', 'asc')
            ->setPageSize($this->getProductsCount())
            ->setCurPage(1);

Can someone please explain?

  • You need to supply how your new products block is workin, more specifically how you get the collection of said products. – ProxiBlue May 3 '16 at 2:10
  • Provide more info about your new products block – Anil Suthar May 3 '16 at 9:43
0

You can create a new product attribute (Yes/No type) like is_from_new_product_block to differentiate/filter product from others.

You can use this attribute to get product collection as new product block, like:

$collection = Mage::getModel('catalog/product')
            ->getCollection()
            ->addAttributeToFilter('is_from_new_product_block',1)
            ->addAttributeToFilter('status', array('eq' => 1))

Also you can filter this collection (for from and to dates, etc...) as per you requirement as a new product block

|improve this answer|||||
  • thank's for reply.. Can you tell me which files can be edited? – Ugy Astro May 3 '16 at 9:36
0

Here you can assign product to a Category which is not displayed on front end.

And Product will be visible in New Products.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.