Question

Currently my store has around 20000+ products. And each product's short description section contains product title at this moment.

I want to replace every product's short description section with following image instead of product title.

enter image description here

How to bulk replace above image code to magento product Short description section?

Was it helpful?

Solution

You could try setting a default value for the short_description attribute, from the admin panel go to Catalog > Attributes > Manage Attributes. However, you would need to remove all the values set for the existing products. I would do this with a tool called magmi mass importer.

Perhaps a better approach would be to remove the short description from the product view page and create a static block with your content and add this to the product view page.

For this method you first need to create a static block with your content, next add it to your layout xml, you need to find out the layout handle for your product view page, probably either PRODUCT_TYPE_configurable or PRODUCT_TYPE_simple or both? Then use the unset_child action method to remove the short description or you may need to just comment it out from your theme's catalog/product/view.phtml template file if it is not added by layout xml. Then make your recently created static block available to your product page with something like.

<block type="cms/block" name="my_identifier"> <action method="setBlockId"><block_id >my_identifier</block_id></action> </block> 

Finally to add your static block to your product pages use the below code snippet in your phtml template file, next to where the short description was being called.

<?php echo $this->getChildHtml('my_identifier') ?>

I think the second method is best as your content is not a short description of the product but rather useful information about your store and as such this data should not be held in the 'short_description' attribute which may be used elsewhere in the system, I.e. shopping cart, transactional emails etc.

Good luck

OTHER TIPS

Be sure to make a backup of your SQL DB first.

Your task could be done by altering Magento's SQL DB directly.

Since Magento uses the EAV (entity-attribute-value) data model (https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model), you first need to find out which attribute ID your Magento uses to set the corresponding values.

Open your Magento DB with phpMyAdmin or something similar. Check your domain/hosting management tool to get access to it.

Open the table eav_attribute and search for short_description inside the column attribute_code. You can use the search of your SQL management tool or simply run the following SQL query:

SELECT * FROM `eav_attribute` WHERE `attribute_code` = "short_description";

Note the attribute_id from the resulting row.

Now open the table catalog_product_entity_text which holds the text inside the product's short description. Do a search for where attribute_id is your noted id (number), like (in this case 62):

SELECT * FROM `catalog_product_entity_text` WHERE `attribute_id` = 62;

In the column value you'll find the product's short description.

Now you can alter all value fields by using this SQL query:

UPDATE `catalog_product_entity_text`
SET `value` = '<img src="http://domain.com/images/conditions.gif" />'
WHERE `attribute_id` = 62;

If you're using different storeViews (maybe as languages) notice that the column store_id also plays a role.

Be sure to make a backup of your SQL DB first.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top