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 show more than 5 new products
 
sunburst
Jr. Member
 
Total Posts:  14
Joined:  2007-09-04
UK
 

I’ve seen some posts on how to show more than 5 new products, however, these post seem to rely on hacks. Is there no way of showing more than 5 new products or i’m i missing something here? thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

+1
same problem here.

it’s on my todo list, though…

 
Magento Community Magento Community
Magento Community
Magento Community
 
sunburst
Jr. Member
 
Total Posts:  14
Joined:  2007-09-04
UK
 

The way i did it was by changing the file: design/frontend/{your template folder}/template/catalog/product/new.phtml

This file is the template for the new products. I recommend removing the HTML tables and use CSS if you are going to show more products.

find line 25:

<?php if ($i>5): continue; endif; ?>

change it to

<?php if ($i>15): continue; endif; ?>

to show 15 new products

Also change line 53 to:

<?php for($i;$i&#x15;!=0;$i++): ?>

I think there was also another file (a core file) to modify but can’t remember.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

yeah, i know this.

but it’s still relying on hacks.

btw, when you do this code, are you able to show up all 15 new products altogether ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
sunburst
Jr. Member
 
Total Posts:  14
Joined:  2007-09-04
UK
 

Yes, i was able to show all my products. As for it being a hack, i don’t consider it to be a hack since it is only changing the template. A bad hack would be having to hack the core files to get the system to function the way you want it which will defeat it’s purpose.

Personally, i feel it would be much easier to manage if theses blocks have settings in the admin backend to configure. Much like what you get in Virtuemart (modules).

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I think you should re-think the ‘dynamic’ and ‘upgrade compatibility’.

Don’t know about the future release, but right now you are given a ‘container’ that can hold up 5 gallon of water for the new ‘whatever-that-is’. But Magento is highly flexible, customizable, it doesn’t limit you to put 6 gallon water, or 60 gallon - it’s totally up to you, with the basic principle that you go find extra ‘container’ or modify the container that is given to you so that it can hold up extra water.  You can do whatever you like, it’s up to you. You want 6 gallon water? That is your choice, nobody is going to stop you, and that is a DESIGN DECISION, not the system issue.  In my view, editing a PHTML file is a design choice, not a hack. Simple that is.

Perhaps you should consider to make your skin and theme if you don’t already done so, so that each upgrade won’t override your customized files.

Hack! I’d never built a site that I don’t need to customize or write my code

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

I think there’s kinda misunderstanding about “hack” here.

We often used “hack” to say : swimming deep into the core and modify the code, not from the surface (back panel) edit it.

as for the dynamic , if we manually change the number there , it’s already becoming static right? i mean… limited…

@chinesedream: cool down, mate !

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Yoke Lee: just out of curiosity, how do you decide what is hack and what is not?

as for the dynamic , if we manually change the number there , it’s already becoming static right? i mean… limited…

Is it different from changing any part of the template?
Or any change to a template would consider to be a hack, because “it’s already becoming static”?
Could you please also expand on what you mean by “static”?

Again, i’m just curious to understand your meaning of the difference between hack and design change, to better my communication on these boards.

Thanks smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

I’m deeply sorry if this “hack” word sounds a bit provocative…

I read some threads in this forum, and got understanding that this “hack” phrase being used to abbr. or to express “changing any part of the template”.
i dunno why they used it.  often seen in snippets of codes.

as for the dynamic , if we manually change the number there , it’s already becoming static right? i mean… limited… ==> what i mean is for that part of code, if we manually change the number ... if there’s any change in future, it’s not gonna be flexible anymore. or some professor say, not becoming modular.

does that make any sense to you?

apparently, i have to avoid using this taboo word.  oh oh

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Yoke Lee: We have tried to make as much as possible of magento customizable, modular and dynamic, meaning that functionality could be altered by addition of code and configuration, as oppose to changing core files, which might prevent upgrades and customization backups.

Thus, we refer to changing core files as “hacking”, unsupported changes, that will break future compatibility and generally being frown upon.

Templates are files that by design considered to be specific for each store owner, and kept in separate directory for each theme.

It would be not possible to have configuration for each little possible deviation from stock functionality, so creating your own user interface (templates, layouts) is not considered to be “hacking”, but “customization”.

Hope this clears up matters smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

@Moshe:

Thank you for explaining this to me. Allow me to confirm some matters though, so there won’t be any misunderstanding again in the future.

changing core files here does it mean changing any files in app\code\core?
but in case need to modify content in some files in app\code\core, is it actually allowed or not?
i never done any hack before. i don’t want to. downer

creating your own user interface (templates, layouts) , separate directory for each theme ==> you mean frontend right?
btw, should i want to make frontend/myinterface/mytheme , how actually do i do that? copy paste frontend/default/default and make changes with the clone?
or just make wanted changes and save new files only in frontend/myinterface/mytheme ?

Thank you very much.

Just out of curiosity, Moshe. i once sent you pm, but no reply. i wonder if you ever received it. thanks.

Yoke.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Yoke Lee: I can not find your message in my PM box, is it possible you had different nick name?

For core models customizations: http://www.magentocommerce.com/wiki/how-to/customize_part_of_configuration

For interface and theme customizations: http://www.magentocommerce.com/design_guide

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yoke Lee
Sr. Member
 
Avatar
Total Posts:  80
Joined:  2008-05-08
China - Singapore
 

Oh, I’m sorry. It was emailed to you. LOL

Thank you for the URLs, I’ve read them once though, maybe I have to read them twice and slowly.  red face

 
Magento Community Magento Community
Magento Community
Magento Community
 
AngelaF
Jr. Member
 
Total Posts:  18
Joined:  2008-04-09
 

I asked this question again, not realising that this post was here - sorry folks!. 

Kimura gave me this reply :

Have you tried changing this line in \app\code\core\Mage\Catalog\Block\Product\New.php
$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);
Change 5 to whatever you want.

This change passes the required number of New Products to the template (template/catalog/product/new.phtml) and then the changes outlined in the rest of this topic will work.

Just posting this for completeness.

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