Mass Update Magento Field to "Use Default Value" - magento

Is there a way that I can reset a bunch of magento products for a particular store view back to "Use Default Value" It seems once you set the store specific data there is no easy way to unset so that it receives the default data. This is causing me to have to do multiple imports.

I know you want to change "a bunch of products" ...
Just for the usecase someone want to get rid of the store-view-specific values for ALL products:
Just cycle the scope of the attribute from 'Store View' to 'Global' an back to 'Store View' again.

Just remove record from product_entity_[attirubte_type] for the product_id, attribute_id and store_id.

You can use:
core_block_abstract_to_html_before adminhtml event to add the required checkboxes for every attribute in admin mass update form;
then catalog_product_attribute_update_before event to delete the values from the EAV tables for a specific store view, only for those attributes that have the checkbox you injected earlier with core_block_abstract_to_html_before set as checked.
Original answer: https://magento.stackexchange.com/a/45229/16724

Related

Magento - How to untick "Use Default Value" on a Super product attribute programmatically?

Here's the super product attributes for a configurable product in Magento:
I'd really like all the "Use Default Value" checkboxes to be unticked for all store views all the time, like the bottom one in the screenshot.
I've written some code to change the price for all of these options programmatically in a store view, but this doesn't do anything on the front end if "Use Default Value" is ticked in the backend. Having some code that unticks this box would save me going back over all the configurable products (and all the store views) to untick them manually, and would prevent mistakes in the future with new products.
I can't see where this is managed in the database though, and I can't find any code to manage this checkbox. Can you help?
When changing attribute values programmatically setting the store id and attribute value should work. The Use Default Vaule checkbox will be unticked for the specified store.
To set it back to use the default value setData('attribute_code', null) can be used.

How to add attribute default value to pre existing products?

How to add attribute default value to pre existing products?
I created a Global Text area attribute and i added a default value into the text field. The problem that im running into is that the default value that i added is not showing up in the products that i created before i created this attribute.
The text field shows up in the previously created listings, but the default information is not showing up..
YES, this attribute has been added into a attribute set.
I have cleared all the cache
Unique Value No
Values Required yes
Input Validation for Store Owner none
Apply To all products
Use in Quick Search no
Use in Advanced Search no
Comparable on Front-end no
Use In Layered Navigation no
Use In Search Results Layered Navigation no
Use for Promo Rule Conditions no
Position 0
Enable WYSIWYG yes
Visible on Product View Page on Front-end yes
Used in Product Listing no
Used for Sorting in Product Listing no
Any suggestions?
Like i said at the beginning, i have already added the attribute set. Anyways, i found a solution to the problem..
Inside manage products, there is a action called “Update Attributes”. Select all the products that you want to update and then select Update Attributes and add all the new information in.

Remove attributes from a configurable product in Magento

Is there any way to remove an attribute from a configurable product once it’s already been created? I tried to remove an attribute from an attribute set but Magento won’t allow you to if it’s already been assigned to a product. The only way I’ve seen to remove attributes from products is directly in the database (catalog_product_super_attribute table).
You can use this model to get a collection of the catalog_product_super_attribute attribute and proceed to delete the record.
Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')
Be ware, there is an _afterSave method that tries to save the label on another table on Mage_Catalog_Model_Product_Type_Configurable_Attribute, which will cause an exception when deleting.

magento product attributes and removing them from backend

I want a hidden attribute, or completely not there in backend for some attributes im using to tie to a special product type I created.
I believe I need the attribute assigned to the attribute set in order to be able to use it.. but correct me if I am wrong!
Now that I think about this, I am probably doing this wrong. There is probably a way to add an attribute to PRODUCT_TYPE (my custom product type is "voucher") instead of PRODUCT.
Not sure though.. Hints?
I believe I need the attribute assigned to the attribute set in order to be able to use it
Your attribute needs to be assigned to an attribute set if you want to be able to edit/view the attribute in the Magento Admin area. It sounds like you do not want your attribute visible there, so the simple solution is to: create your attribute without assigning it to an attribute set. You can still assign/edit/view your attribute through database manipulation or by loading the product model and using the magic get & set methods.
$product = Mage::getModel('catalog/product')->load($id);
$product->setFoo('hidden attribute value');
echo $product->getFoo();
Another way is to set the visibility of your attributes by database, have a look here:
Magento - Product Attribute which is not visible/editable in administration
You can also lock attributes and make them readonly for your backend users by using a observer:
Magento read-only and hidden product attributes

Adding additional information on product page in magento

I want to add information in the additional information tab of the product page, but can't figure out from where it picks the data.
Check out the product attributes in the backend. You can configure existing and/or new product attributes and make them (optionally) show up in this section. Make sure the attributes have "Visible on Product View Page on Front-end" set to Yes.
1)First create the attribute as per your requirement
2)Assign this to default attribute set then save.
3)go to attribute and make visible(from drop down) your recently created attribute.
4)fill some value in the attribute(you created) for your selected product .
5)Again go to the attributes select your attribute then select yes or no to " Visible on Product View Page on Front-end " and "Used in Product Listing" depending your need.
If you need more help please inform..

Resources