is it possible to edit Magento creation date? and how? - magento

hey there? I have a problem and I need to edit product's creation date on magento to arrange my products to the right order, but I just cannot find out how to do it? can anyone here help me? thanks

It depends if you are wishing to do this via the admin section or programmatically in some sort of script. The created_at field is a core field found in the "catalog_product_entity" table. Programmatically you could do it along these lines:
$productId = 123; //use your own product id here
$myProduct = Mage::getModel('catalog/product')->load($productId);
$myProduct->setCreatedAt(strtotime("now"))->save();
// I put strtotime("now") as an example - use whatever date you need to.
$myProduct->unset();
However, you could reconsider using a different attribute to order by. There is a "position" field, or use a custom order attribute. The created_at is useful to keep as a proper point of reference to when the product was actually entered into the system.
To use the position attribute, you can order your products in the admin by going to "categories" and then choosing the "category products" tab. You should see the position field as one of the columns. Set this for each product with the lowest number you want to appear at the top.

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 attribute default order on config products

Anyone knows how Magento sorts attributes order in config products frontend?
I.e.: I have two attribute "size" and "color" applied to 2000 configurable products.
On frontend it show first size then color: I want to change this default order without updating all products..
Already tried changing attribute name and attribute order field in db: nothing..
You need to given sort order to product attribute
Please refer snapshot
The only way I could manage to work is to change the attribute id: in fact seems that Magento default attributes order is by attribute ID.
For others looking for a solution (You can do this in magento admin)
Go to the configurable product, go to the tab where u connect it to simpel products.
In the box labeled "Super product attributes configuration" you can drag and drop the position of the attribute (if you have more than 1)

Display products against attributes in magento

I am working on custom module in magento.
I create two new attributes (combo box) make and location. After that I add values for these attributes using custom code against specific product. Like I add make "Sony" and location is "Australia" against product 1 (1 is id for product).
Now on admin side i want to display this product with attributes values like make is Sony and location is Australia and product is 1.
I found some tables where these values are linked like (catalog_product_entity_int,eav_attribute,eav_attribute_option,eav_attribute_option_value), but I am unable to query such records. The page where I want to display data I have attribute id and attribute code.
Can anyone knows how I can figure it out?
Very simple Dude.
inside your _prepareCollection() method of your custom module grid
Load the product collection and select these two attribute... If there is a need to filter it by these two attributes then do it.

is it possible to show custom attributes of associated products under a grouped product in front end? (Magento)

I have a typical condition in my magento Grouped product.
Is it possible to show Custom attribute (color dropdown) of associated product under Grouped products in the fronted.. as shown below
Consider the sample blanket product
Let me know if i am not clear.
Thanks
It's not clear your question but I would give you a small example to get text field, multiple select or drop-down listbox value.
First, we should load the product collection :
<?php
// load the product that id 125, then show attributes of the product
$product = Mage::getModel('catalog/product')->load($this->getProduct()->getId(125));
echo $product->getCustomAttribute();
// lets say your custom attributes name is "size" and type is text field
echo $product->getSize();
// lets assume your custom attributes name is "product_size then
echo $product->getProductSize();
// lets assume your attribute type is drop-down, this will get array of attribute options instead of value that you selected
echo $product->getAttributeText(product_size);
// to get drop-down value that you selected
$attribute = $product->getAttributes();
$productSize = $attribute['product_size']->getFrontend()->getValue($product);
let me know if it's not meet your request.
I have found a solution for this, 3 edited files.
But these files are edited for a previous version of Magento, I don't know which version.
I have uploaded this 3 files on my Magento 1.7 and it works but when add the product to the cart it give's a error with app/code/core/Mage/Sales/Model/Quote.php
This file: Quote.php is one of the edited files, when i upload the original Quote.php it works.
Look at this pic: http://s8.postimage.org/g8bvbth0z/Naamloos.png
But maybe i get more errors in the future, i don't have any ideas..
I am a noob with this, if someone can look at the edited files and chek how they have do this and compare this with the newest files for Magento 1.7 maybe we can help to many peoples with this problem.

Magento seasonal products

I'm looking for an easy way to set up a product in the Magento catalog so that it appears on a date that I specify and only until a date I specify. This would operate similarly to the current sale_from and sale_to dates, but hide the products entirely outside the given date range. For reference, this is for holiday products that are only relevant until a given date. Anyone?
Thanks,
Joe
You could create two attributes, and if one of them is set, set the visibility accordingly use an event right before the save (using an event observer)...

Resources