magento - default attribute set when making new products - php

i have several attribute sets in my magento store. (v. 1.6.2)
When i make a new product "socks" is the default attribute set. But i would like "clothing" to be the default.
How can i change this?
I hope anyone can help.

Original question didn't seem to get answered here and I was looking for what Ronny also wanted.
Found there has been an extension released that does it simply for you.
http://www.magentocommerce.com/magento-connect/default-attribute-set.html

Unfortunately, it's not possible. You should create new product.

To change an existing product attribute set, you can Create a new Attribute Set that contain all the attributes you need
You can either install this extension (Change Attribute Set) or make the changes in the database (you will need to know the products id and attribute set id)
To manually change (Always backup before making changes):
Go to eav_attribute_set table and look for the attribute_set_id of the newly create attribute set (you could also get this in the admin by look at the url www.xxxx/edit/id/10/key/xxx on Edit Attribute Set 'xxxx' page)
After you have a list of all the product ids and corresponding attribute set ids, then go to the table below and update those fields
Table Name : catalog_product_entity
Field Name : attribute_set_id
Field Name : entity_id // is product_id
Another way is to delete those product and recreate using the new attribute set.

It is possible to accomplish what you want by editing the database directly. Only do this if you are comfortable with MySQL commands or another tool like phpMyAdmin.
To make this change you will need to do two things.
Get the ID of your new attribute set, in this case your "clothing" attribute set. You can locate the id in the eav_attribute_set database table or in the browser URL when editing the attribute set from the Magento admin area. I prefer to just use the database since we need to go in there anyways to make the change.Table Name : eav_attribute_set
Column Name: attribute_set_id
Look for the row in the table that has the name you used when you created the new set - it should be pretty obvious, you'll see all the attribute set names in the column called attribute_set_name
Once you have the preferred attribute set ID you then need to visit the eav_entity_type table and update the value in default_attribute_set_id column for the row whereentity_type_id = 4 and entity_type_code = catalog_product. In a fresh installation of Magento, the value to look for in this column is also 4.
Table Name : eav_entity_type
Column Name: default_attribute_set_id
Done! Once you've changed the id value you will notice your preferred attribute set is the one selected by default the next time you go to create a new product. I believe this is what the question was asking for.
NOTE: This should work for both Magento 1 and 2. At the time of writing this post the current Magento versions are: 1.9.2.4 and 2.0.7

Related

Can Product_ID of products in Opencart be alphanumeric?

I am working on a project where I am trying to check some validations but I find a risk of 'product_id' parameter is not properly sanitized upon submission to the index.php script, which can disclose the software's installation path resulting in a loss of confidentiality.
so after checking the format of product_id of products, its only in numeric but is there any possibility that the format may be alphanumeric and if yes then what exactly will be the behavior.
Don't change it's data type because it's relation exists in 5-6 tables, SO better create a new field for it's alphanumeric Id and control it using php..
The product id is the foriegn key for 5-6 tables eg) product option contains the product id as referance so please dont

Magento, I changed product attribute configuration, now my products are not storing new value of it

I changed configuration of one attribute, "Input Validation" for Store Owner "none" to "decimal". Now all the existing products are not storing new value of it, they show previous value for this attribute, however I indexed my system and tried to save but it get previously inputted value only, the old value is not changing,
Thanks guys for your suggestions, Magento uses EAV, my attribute was text type when i created it but later on, we changed it to decimal so the products which are previously created getting values from catalog_product_entity_text table and storing new value at catalog_product_entity_decimal table, i don't know why it happened.
I removed entries from catalog_product_entity_text table and now its working fine.

Magento: how to retrieve deleted tax_class

i have a slight problem here.
i am using stock in the channel with magento, and there plugin uses magento's default tax_class_id.
but the problem we are facing is we have deleted the default magento tax class id.
we have tried to change the plugin to make it use our custom tax_class_id. but as soon we do that plugin dont work.
we have tried to create the same name tax_class but it dont work as it use the new tax_class_id which is now 11.
can we make magento retrieve the deleted tax_class_id?
I don't use Magento, but it sounds like the problem is you deleted a row of data from the tax_class_id table, and when you try to recreate it you get a different value for the auto incrementing primary key tax_class_id, which if I'm correctly reading what you wrote, is confusingly the name of both the table and one of the columns in that table. Not that it matters what they're called, you can go in the tax_class_id table, create a new row, and then double-click on the tax_class_id column to edit the value there to make it match the original value (provided you know what the original value was, of course, but looking in whatever tables reference that value should give you that answer if you don't know). So basically just create it as you've done, it will automatically assign a new counter ID but you can edit that through phpMyAdmin.
Note that, in general, messing with auto incrementing ID values and changing existing data is a good way to mess up your referential integrity, but as long as you have a good backup and understand what you're doing this should work fine for you.

OpenCart : Extract Orders Details in Database

I know I can extract Sales Order data in OpenCart database, in table shop_order and shop_order_product.
Is it possible to differentiate which user creates the sales order?
I don't think there's an option to identify which admin user created the order. You may need to code it yourself. The below steps may help you.
Add 2 new fields created_user_id and updated_user_id in order table - with default value as 0.
Update the admin/model/sale/order.php to insert values to those fields as $this->user->getId(); (addOrder and editOrder functions ).
Add a new field user_id in order_history table - with default value as 0.
Update the admin/model/sale/order.php to insert value to that field as $this->user->getId(); (function: addOrderHistory).
You can do these by directly modifying the files or using vqmod. If it's done via vqmod then it'll be easier for you to make changes during opencart version upgrade.
Opencart: Vqmod tutorial
Have a nice day!!
By default, there's no way to know which admin an order is created by, or even that the order isn't created by the user (other than the IP would be that of the admin). You could in theory add the user_id to the shop_order table, and pass that to the manual order editor when it creates the orders

Magento System Attribute Missing in a Attribute Set

I've created a new attribute set from "Default" attribute set.But the media_gallery attribute is missing in the new attribute set.So the image uploader is not showing in product edit section.How do I add that system attribute to the set?
This is at least strange. I would suggest trying to re-create an attribute set based on "Default" to check if the problem will happen again.
In any ways, if you want to add a media_gallery attribute to your existing attribute set you have to add a record to eav_entity_attribute table, where relation of EAV entity to attribute set and group is stored:
INSERT INTO eav_entity_attribute
SET entity_type_id = 4,
attribute_set_id = [YOUR_ATTRIBUTE_SET_ID],
attribute_group_id = [YOUR_ATTRIBUTE_GROUP_ID],
attribute_id = [ID_OF_YOUR_MEDIA_GALLERY_ATTRIBUTE by default 82],
sort_order = 4
The ID_OF_YOUR_MEDIA_GALLERY_ATTRIBUTE can be found in eav_attribute table using the following query:
SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'media_gallery'
The YOUR_ATTRIBUTE_SET_ID can be found in eav_attribute_set table using the following query:
SELECT attribute_set_id FROM eav_attribute_set WHERE attribute_set_name = '[GIVEN_NAME_OF_YOUR_ATTRIBUTE_SET]'
And the YOUR_ATTRIBUTE_GROUP_ID can be found in eav_attribute_group table using the following query:
SELECT attribute_group_id FROM eav_attribute_group WHERE attribute_set_id = [YOUR_ATTRIBUTE_SET_ID] AND attribute_group_name = 'Images'
You can also use PHP to assign attributes to attribute sets:
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
$installer->addAttributeToSet(
'catalog_product', $attributeSetName, $groupName, $attributeCode
);
It is not a programming question, rather it is the question about using Magento as an end-user. I think the question will be deleted soon. However, until it is not, at least this answer may help to solve the problem, thus making people happier.
So all you need is just go to Magento's admin panel -> Catalog -> Attributes -> Manage Attribute Sets. Then select your set to open edit page for it. Drag the media_gallery attribute from the "Unassigned Attributes" list to the appropriate group in the "Groups" list. Save the attribute set.
That's all :)

Categories