Changing the new product widget sort order in Magento - magento

I'm using Magento for my webshop and my homepage uses a new products widget. I want to change the sort order for the products within the widget.
I searched for hours but I can't figure it out.

The block for displaying new product is:
app/code/core/Mage/Catalog/Block/Product/New.php
see the function _beforeToHtml()
default sorting is done by start date descending:
->addAttributeToSort('news_from_date', 'desc')
You can copy this block to code/local and replace it with position or the sort order you want... or extend it with a Magento extension.
You might want to search Magento Connect to see if there is any module that would fit your needs.

Related

Magento pre-order list

I hope that somebody can point me in the right direction or has a ready to go solution, but I'm willing to spend time on this myself, but can't figure out where to start. Lets first start what I want to create.
I use magento, and a custom page create in the backend where I set manually a list with pre-order product, but this is time consuming. All pre-order products are already in one particular category and the all have a attribute that states pre-order yes or no.
I would really like to create a page that can retrieve all pre-order product by the custom attribute, or from the category and create a simpel list in html that gives the user the information of comming pre-orders sorted on the attribute date thats also custom.
So for example a list like
product name | release date | Price (clickable that links to the product)
I use a custom theme currently. Do I start with the page creation from magento, do I start with a custom theme that is a copy of my current theme and select that in the category layout? What is the best way to achieve this wanted behavior?
Hopefully somebody will point me the right direction
There are multiple ways of doing something like this. When developing a solution I try to leverage as much native functionality as possible to reduce the amount of custom work involved.
A possible solution:
Create a new category Pre-Orders or use existing
Create new product attribute 'Release Date', add this to the correct attribute set and set the values for the products
Add all pre-order products to this category
Create a new template for the category which will pull the data from the products themselves
Set default template to be the new template for that specific category
The template you will need to create can be created from scratch or you can leverage a page template you already have. Regardless, going forward, all you have to do is make sure the product data is correct and the products are in the correct category.

Magento show empty grouped product

I want tot display the grouped products in magento(version 1.9.1.1) even if they don't have a active simple product attached to them.
It's possible for me to view the grouped product on the frontend if i visit the product by using the direct url, but when I use the search form or check the category page I don't see the product.
If I activate the simple product that is associated to the grouped product the grouped product does appears in the category page and search form.
Thanks in advance!
This is due to a bug in Magento's grouped product price indexer (Mage_Catalog_Model_Resource_Product_Indexer_Price_Grouped).
The indexing process only takes into account grouped products that have simple products associated, see Mage_Catalog_Model_Resource_Product_Indexer_Price_Grouped Line 118:
if (!is_null($entityIds)) {
$select->where('l.product_id IN(?)', $entityIds);
}
This needs to be changed to
if (!is_null($entityIds)) {
$select->where('e.entity_id IN(?)', $entityIds);
}
to make it work. Also, the mass indexing of product prices (via admin interface or via shell) fixes the problem because the reindexAll() function of the named class does not limit to grouped products that have associated simple products either.
Please note that you shouldn't make those changes within the core file but overwrite the class instead.
The issue has also been reported to Magento.

Magento: How to sort product collection?

i have created a list_home.phtml that i call from {{block type="catalog/product_list" category_id="6" template="catalog/product/list_home.phtml"}}The category is very important because i will have 3 tabs in this homepage slider.This is a version of the product list without toolbar to include in a homepage slider, where the user should never be able to change the sorting.
However in the main catalog there is the toolbar. Currently, if the user changes the sorting there and then goes back to the homepage the sort order on the home page will also be affected!
How can i force the $collection to always sort by newest and also filter the category from the frontend's block call?
I am really almost stuck after opening around 50 tabs in the broswer and trying to research, really need some help here please.
Thanks in advance.
On the product collection you can set the order by calling ->setOrder on it.
I'm not sure of the field you would need to order by, but if you wanted to set it by price ascending you would do
->setOrder('price', 'ASC');
To filter the category you need to do this
$productCollection = Mage::getModel('catalog/category')->load($categoryId);
You can then set the sort order

Filter one specific attribute values from products in magento

I'm new in magento, I'm working on http://www.theartworkgallery24.com/stage/ website. Please check beneath flash banner, there are 4 big images that are links to attributes value from which user can directly go to a product.
I need a page that display on one specific attribute values like in case of artist, it should be Gustav Klimt, Leonardo Da Vinci etc. These should be links to actual product related to the attribute values.
Please tell me how to make your own PHTML or PHP file, which code to use and how, and in last how to call your code in your magento website.
Any ideas will be appreciated, thanks.
You please create an attribute (davinchi) in admin side for these functionality. You can create products attributes from catalog->attributes->menu.After that you can see these attribute value in product creation page.You just assign it to different products
After that you can either create a module for this. Otherwise just create a phtml file in catalog/product/ folder.
then enter the below custom collection code in it.
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*');
//filter codition
$collection->addFieldToFilter(array(
array('attribute'=>'davinchi','eq'=>1),
));
This will load products having attribute value davinchi=1.

How to change the product display order in magento

How can I change the product display order in the front end (grid or list) by setting some preferences from back-end? I guess it should be other than best value and name from the default Magento display order property.
I tried by creating a new attribute called display_order, and each product holds a value based on its value the product needs to shown in front end. However, it is not working. Please help me fix this.
You'll need to extend the Mage_Catalog_Block_Product_List block to provide your own functionality for the getProductCollection() method. Probably something along the lines of:
class ... extends Mage_Catalog_Block_Product_List {
function getProductCollection() {
parent::getProductCollection()->addAttributeToSort('display_order', 'ASC')
}
}
Then, of course, you'll have to update you layout xml file on your, presumably, custom controller (unless you want all of the product listing screens to act like this) to use your new block instead of the Magento default of catalog/product_list.
Why don't you use the Magento sorting thing ?
In your category, under Category Product you have the possibility to choose the sorting order in the last column. To do it through php, just make a custom script that you'll need to launch once.
$collection = 'Your product collection';
$result = array();
foreach ($collection as $product) {
$sort = 'Your way of calculating the desired sorting';
$result[$product->getId()]=$sort;
}
Mage::getModel('catalog/category')->load('your category id')->setPostedProducts($result)->save();
And that's it :)
To change the display order , first you need to set the default sort by option to position.This can be done from the magento admin configuration.After that you need to set position for all the products starting with the value 1.
I come across the following module which will make this task very easy, just by drag and drop the products from the manage categories itself.Please check the following extension
http://www.blackqubers.com/extensions/product-sorting-drag-and-drop.html
Hope this will helps you

Resources