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

How to make a new block type
 
shopi
Member
 
Total Posts:  46
Joined:  2008-02-16
 

i have my latest products on the main page

{{block type="catalog/product_new" template="catalog/product/xxx.phtml""}}

i changed the new .php file so that i can see now all comming soon product.

now i want to make it into a new template commingsoon.phtml

the problem is i dont know ho to make a new block type (like product_coming soon)
i also dont know where is the definition of all the block type

 
Magento Community Magento Community
Magento Community
Magento Community
 
shopi
Member
 
Total Posts:  46
Joined:  2008-02-16
 

ok got it

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andrea, Argentina
Sr. Member
 
Total Posts:  164
Joined:  2007-12-05
Buenos Aires, Argentina
 

Can you share the steps to do it with the community?
It’s very interesting what you are doing!!!

Thanks and good luck
Andrea
(from Argentina)

 
Magento Community Magento Community
Magento Community
Magento Community
 
shopi
Member
 
Total Posts:  46
Joined:  2008-02-16
 

first of all my code style is not very good

here in the forum i found a posting
where someone provides hompage.html and hompage .php
i think with the serch function you can find it.

with this code on the main page (can finde it an the admin area CMS)
{{block type="catalog/product_new" template="catalog/product/homepage.phtml""}}

products are seen which are set as “new products” (inside the product description)

if i understand it right
catalog/product_new means
inside the Template folder
in catalog/products/ and the filename is new.php

my new file was newCS.php so the new code for the mainpage is

{{block type="catalog/product_newCS" template="catalog/product/homepage.phtml""}}
my mistake was first that i wrote newcs not newCS

im not sure if newCS depends on the filname newCS.php
or on the classname

here the code
class Mage_Catalog_Block_Product_NewCS extends Mage_Catalog_Block_Product_Abstract
{
public function __construct()
{
parent::__construct();

$storeId = Mage::app()->getStore()->getId();

$product = Mage::getModel(’catalog/product’);
/* @var $product Mage_Catalog_Model_Product */
$todayDate = $product->getResource()->formatDate(time());
$products = $product->setStoreId($storeId)->getCollection()
->addAttributeToFilter(’relaese’, array(’date’=>true, ‘from’=> $todayDate))
->addAttributeToSelect(array(’name’, ‘price’, ‘small_image’), ‘inner’)
->addAttributeToSelect(array(’special_price’, ‘special_from_date’, ‘special_to_date’), ‘left’)
;
/* @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */

Mage::getSingleton(’catalog/product_status’)->addVisibleFilterToCollection($products);
Mage::getSingleton(’catalog/product_visibility’)->addVisibleInCatalogFilterToCollection($products);

$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);

$this->setProductCollection($products);
}
}

i dont understand everything

->addAttributeToFilter(’relaese’, array(’date’=>true, ‘from’=> $todayDate))

this line means products date from todayDate

->addAttributeToSelect(array(’name’, ‘price’, ‘small_image’), ‘inner’)
->addAttributeToSelect(array(’special_price’, ‘special_from_date’, ‘special_to_date’), ‘left’)

here what attribute are selected

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andrea, Argentina
Sr. Member
 
Total Posts:  164
Joined:  2007-12-05
Buenos Aires, Argentina
 

Shopi, thank you very much for this post… but really I couldn’t understand because I’m not a programmer and I haven’t got the blocks and phtml files enough to follow your explanation.

I know it’s difficult to explain these type of things to people with low knowledge. Nobody has to be forced to give a guide. Maybe the Magento team should give it. Because there are many users as me that need help to start.

Thank you again.
Andrea

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