6

Ok I am in the process of updating a theme in Magento 1.8 and have everything set except the products are still showing the old theme. The store has about 1800 products and would take me forever to change the theme for every one manually. Is there a query to change them on all of the products at once?

The setting can be found in the admin panel: Catalog -> Manage products -> select product -> design -> custom design dropdown (see image below)

default from old template is chosen

what I would like to change it to, you can see from the image below

new template that I would like to change default to

Any help with this will be greatly appreciated. Thanks in advance, jmituzas

  • Couldn't you just run an import of those products? And if you want to speed it up with something like Magmi? – chaoticgeek Oct 9 '14 at 21:16
  • Please answer if you have saticfied – Amit Bera Oct 15 '14 at 11:19
10
+25

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()

enter image description here 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

enter image description here

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
  • This answer is what I was looking for! Thanx very much – jmituzas Oct 21 '14 at 3:48
5

Actually, you only want some particular products to use old theme, that's very easy and you don't need to touch any sql or query. Three Steps:

  1. Go product management
  2. Search the products you want to change. If you want to change all of them, skip this step.
  3. Click "Select all", this will select all products matching your search (not only the products on the page you are seeing)

    Select all

  4. Select change attributes in action then submit.

  5. Find attribute Custom Design tick change and select your old theme, then save.

done! :) happy and enjoy using Magento

  • This actually worked like a charm and I learned something new in the process, even though it wasn't what I was looking for, this worked out – jmituzas Oct 21 '14 at 3:50
1

Make a backup before you do this, but if I'm reading your use case right (and you don't want anything else set to mtbrave/default - because this will change everything - then you should be able to safely run the below SQL:

UPDATE catalog_product_entity_varchar
SET `value`='default/MAG090172'
WHERE `value`='mtbrave/default'

You could also probably set the value to NULL so that it's the default, but you'd have to make sure you knew which attribute_id was correct. To figure this out, I did the following:

Search the eav_attribute table for the attribute_code of custom_design. My instance returned two ids: 58 and 103. The attribute type here was varchar

I then searched my catalog_product_entity_varchar table for these ids (WHERE attribute_id IN(58,103) and they all returned with attribute_id=103 (and I had set a single item to custom, that being default/iphone - which showed up in this list - the rest showed up as NULL).

But in theory the above SQL query should work.

protected by Amit Bera Apr 27 '15 at 19:54

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.