First, Magento is manage custom layout
using custom_design attribute
which is varchar
attribute and save attibute value at table catalog_product_entity_varchar
First i have check custom_design attibute id and this id 103 using
Step1: get load product eav attribute
$custom_design = Mage::getResourceModel('catalog/product')->getAttribute('custom_design');
step2: get Attibute id using below code $custom_design->getAttributeId()
.
step3: get table of this attribute using code $custom_design->getBackend()->getTable();
Alternative process to get custom_design
attribute id
Get custom_design attibute id using below code:
SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`='custom_design' and `entity_type_id`=4
Just goto admin>Catalog>Attribute>Maange Attribute>
Select attribute custom_design
from grid and click on it and in this attribute view page url you can see attribute id
admin/catalog_product_attribute/edit/attribute_id/
103/key/e88df75c6ef10d0be06f2aa52b99afef/
Now that mean
you update this eav value using below query
update catalog_product_entity_varchar set value ='youdesign template code'
where attribute_id =$custom_design->getAttributeId()
and you will have some fields
1)entity_id
is product id
.You can put product id
at your condition of update query
2) store_id
is import whenever you have multiple store view or website
.As custom_design is store_view scope attibute
How to get list OF templates
Just to open any product at admin
and goto it Design tab inspect custom design drop down
get list of option values of this attribute
From here you will chose your template
like base/default
or default/modern
or rwd/default
Note:You will update value with NULL
that means it always design from your Store current design template and package
.
Most of cases product design
it take from Current store design template
,so it showing NULL
Final Query Look like:
update catalog_product_entity_varchar set value ='your design design template code'
where attribute_id =$custom_design_code