<?xml version="1.0" encoding="utf-8"?> 
<rss version="2.0"
  xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
  xmlns:atom="http://www.w3.org/2005/Atom">

<channel>

<title>obukhow’s quick tips</title>
<link>http://quicktips.ru/</link>
<description>Some code recipes and useful scripts</description>
<author>Denis Obukhov</author>
<language>en</language>
<generator>E2 (v3860; Aegea)</generator>

<itunes:owner>
<itunes:name>Denis Obukhov</itunes:name>
<itunes:email></itunes:email>
</itunes:owner>
<itunes:subtitle>Some code recipes and useful scripts</itunes:subtitle>
<itunes:image href="" />
<itunes:explicit></itunes:explicit>

<item>
<title>Run partial reindex process (mview)</title>
<guid isPermaLink="false">18</guid>
<link>http://quicktips.ru/all/run-purtial-reindex-process-mview/</link>
<pubDate>Thu, 30 Jun 2022 09:14:46 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/run-purtial-reindex-process-mview/</comments>
<description>
&lt;p&gt;If you want to force run a partial reindex process, also called mview or materialized view to update only entries collected in a change log table (suffixed with _cl) you can use following command. First you need to find out desired process code with&lt;/p&gt;
&lt;pre&gt;bin/magento indexer:info&lt;/pre&gt;
&lt;p&gt;command. And use it for the&lt;/p&gt;
&lt;pre&gt;$processCode&lt;/pre&gt;
&lt;p&gt;variable value.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;$processCode = 'visual_merchandiser_category';
$collection = $objectManaget-&amp;gt;get(\Magento\Framework\Mview\View\Collection::class);
$item = $collection-&amp;gt;getItemsByColumnValue('view_id', $processCode)[0];
$item-&amp;gt;update();&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Mark index as invalid or invalidate index in Magento 2</title>
<guid isPermaLink="false">17</guid>
<link>http://quicktips.ru/all/mark-index-as-invalid-or-invalidate-index-in-magento-2/</link>
<pubDate>Thu, 12 Aug 2021 14:58:42 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/mark-index-as-invalid-or-invalidate-index-in-magento-2/</comments>
<description>
&lt;p&gt;To programmatically mark on of the indexes as invalid you need help of&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;\Magento\Framework\Indexer\IndexerRegistry&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;. After receiving the indexer instance, you can call&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;invalidate()&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;method.&lt;/p&gt;
&lt;p&gt;Example&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;$this-&amp;gt;indexerRegistry-&amp;gt;get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)-&amp;gt;invalidate();&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Undo Order Cancel  in Magento</title>
<guid isPermaLink="false">16</guid>
<link>http://quicktips.ru/all/un-cancel-magento-order/</link>
<pubDate>Tue, 20 Aug 2019 09:33:42 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/un-cancel-magento-order/</comments>
<description>
&lt;p&gt;If you want to restore canceled order, rollback order cancellation and undo order cancel action in Magento and Magento 2 use the following SQL query. Order will be restored to “Pending” status.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;SET @ORDERID = &amp;quot;41970&amp;quot;;
UPDATE `sales_order`
SET `state` = 'new',
`status` = 'pending',
`base_discount_canceled` = '0',
`base_shipping_canceled` = '0',
`base_subtotal_canceled` = '0',
`base_tax_canceled` = '0',
`base_total_canceled` = '0',
`discount_canceled` = '0',
`shipping_canceled` = '0',
`subtotal_canceled` = '0',
`tax_canceled` = '0',
`total_canceled` = '0'
WHERE `entity_id` = @ORDERID;
UPDATE `sales_order_item`
SET `qty_canceled` = '0',
`tax_canceled` = '0',
`discount_tax_compensation_canceled` = '0'
WHERE (`order_id` = @ORDERID);
DELETE FROM `sales_payment_transaction`
WHERE (`order_id` = @ORDERID) and `txn_type` = 'void';
UPDATE `sales_payment_transaction`
SET `is_closed` = 0
WHERE (`order_id` = @ORDERID) and `txn_type` = 'authorization';&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Find file by name in Linux, macOS in command line</title>
<guid isPermaLink="false">15</guid>
<link>http://quicktips.ru/all/find-file-by-name-in-linux-macos-in-command-line/</link>
<pubDate>Fri, 02 Aug 2019 10:20:36 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/find-file-by-name-in-linux-macos-in-command-line/</comments>
<description>
&lt;p&gt;To find a file by name in Linux (Ubuntu, Centos) or macOS in command line use the following command&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;find /home/username/ -name &amp;quot;*.inc&amp;quot;&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Find Products Without Images</title>
<guid isPermaLink="false">6</guid>
<link>http://quicktips.ru/all/find-products-without-images/</link>
<pubDate>Fri, 26 Apr 2019 13:56:15 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/find-products-without-images/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;SELECT `p`.`sku` FROM `catalog_product_entity` AS `p`
LEFT JOIN `catalog_product_entity_varchar` AS `attr_images`
 ON `attr_images`.`entity_id` = `p`.`entity_id`
 AND `attr_images`.`attribute_id` IN (SELECT `attribute_id` FROM `eav_attribute`
   WHERE `attribute_code` IN ('image', 'small_image', 'thumbnail') AND `entity_type_id` = 4
  )
LEFT JOIN `catalog_product_entity_media_gallery` AS `gallery`
 ON `gallery`.`entity_id` = `p`.`entity_id`

WHERE (`attr_images`.`value` IS NULL OR `attr_images`.`value` = 'no_selection') AND (`gallery`.`value` IS NULL);&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Find file containing specific text on Linux, Mac OS X using command line</title>
<guid isPermaLink="false">14</guid>
<link>http://quicktips.ru/all/find-file-containing-specific-text-on-linux-mac-os-x-using-comma/</link>
<pubDate>Wed, 13 Feb 2019 12:26:59 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/find-file-containing-specific-text-on-linux-mac-os-x-using-comma/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;grep -Ril &amp;quot;text-to-find-here&amp;quot; /&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Clear redis cache</title>
<guid isPermaLink="false">13</guid>
<link>http://quicktips.ru/all/clear-redis-cache/</link>
<pubDate>Mon, 04 Feb 2019 15:37:54 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/clear-redis-cache/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;redis-cli -h &amp;lt;host&amp;gt; -p &amp;lt;port&amp;gt; flushall&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The command will remove all data from client connected (with host and port).&lt;/p&gt;
</description>
</item>

<item>
<title>Generate Self-signed SSL Certificate for nginx</title>
<guid isPermaLink="false">12</guid>
<link>http://quicktips.ru/all/generate-self-signed-ssl-certificate/</link>
<pubDate>Fri, 18 Jan 2019 16:12:15 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/generate-self-signed-ssl-certificate/</comments>
<description>
&lt;p&gt;You can easily generate self-signed SSL certificate for your local machine using openssl this command line tool&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
    -keyout /etc/ssl/private/mylocal.key \
    -out /etc/ssl/certs/mylocal.crt&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now you can change your nginx config to use these certificates. Add the following section&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;server {
    listen               443 ssl;
    ssl_certificate      /etc/ssl/certs/mylocal.crt;
    ssl_certificate_key  /etc/ssl/private/mylocal.key;
    server_name mylocal.local *.mylocal.local;
    set $MAGE_ROOT /projects/mylocal;
    include /projects/mylocal/nginx.conf.sample;
}&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Get locked transactions in MySQL</title>
<guid isPermaLink="false">11</guid>
<link>http://quicktips.ru/all/get-locked-transactions-in-mysql/</link>
<pubDate>Fri, 07 Dec 2018 12:58:17 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/get-locked-transactions-in-mysql/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;SELECT TRX_ID, TRX_REQUESTED_LOCK_ID, TRX_MYSQL_THREAD_ID, TRX_QUERY
FROM INNODB_TRX
WHERE TRX_STATE = 'LOCK WAIT';&lt;/code&gt;&lt;/pre&gt;&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;SELECT
  waiting_trx_id,
  waiting_pid,
  waiting_query,
  blocking_trx_id,
  blocking_pid,
  blocking_query
FROM sys.innodb_lock_waits;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;SELECT
  r.trx_id waiting_trx_id,
  r.trx_mysql_thread_id waiting_thread,
  r.trx_query waiting_query,
  b.trx_id blocking_trx_id,
  b.trx_mysql_thread_id blocking_thread,
  b.trx_query blocking_query
FROM       information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b
  ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r
  ON r.trx_id = w.requesting_trx_id;&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Mac OS email sending log</title>
<guid isPermaLink="false">10</guid>
<link>http://quicktips.ru/all/mac-os-email-sending-log/</link>
<pubDate>Fri, 07 Dec 2018 12:56:47 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/mac-os-email-sending-log/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;log stream --predicate  '(process == &amp;quot;smtpd&amp;quot;) || (process == &amp;quot;smtp&amp;quot;)' --info&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Log Debug Backtrace in Magento 2</title>
<guid isPermaLink="false">9</guid>
<link>http://quicktips.ru/all/log-debug-backtrace-in-magento-2/</link>
<pubDate>Fri, 02 Nov 2018 09:58:05 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/log-debug-backtrace-in-magento-2/</comments>
<description>
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;$obj = \Magento\Framework\App\ObjectManager::getInstance();
$fileHandler = $obj-&amp;gt;create(\Magento\Framework\Logger\Handler\Base::class, ['fileName' =&amp;gt; 'var/log/debug.log']);
$logger = $obj-&amp;gt;create(\Monolog\Logger::class, [
                'name' =&amp;gt; 'save',
                'handlers' =&amp;gt; ['file' =&amp;gt; $fileHandler],
                'processors' =&amp;gt; ['process_id' =&amp;gt; $obj-&amp;gt;get(\Monolog\Processor\ProcessIdProcessor::class)]
            ]);
$logger-&amp;gt;info(var_export(\Magento\Framework\Debug::backtrace(true, false, true), true));&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result could be found in var/log/debug.log&lt;/p&gt;
</description>
</item>

<item>
<title>Delete product duplicate images</title>
<guid isPermaLink="false">8</guid>
<link>http://quicktips.ru/all/delete-product-duplicate-images/</link>
<pubDate>Thu, 25 Feb 2016 15:14:20 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/delete-product-duplicate-images/</comments>
<description>
&lt;p&gt;The following solutions helps to find duplicate image file for each product and to remove it.&lt;br /&gt;
Create file delete.php in Magento base directory, put the following code into the file.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;&amp;lt;?php
include('app/Mage.php');
Mage::app()-&amp;gt;setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
ob_implicit_flush(1);

$mediaApi  = Mage::getModel(&amp;quot;catalog/product_attribute_media_api&amp;quot;);
$_products = Mage::getModel('catalog/product')-&amp;gt;getCollection();
$i         = 0;
$total     = count($_products);
$count     = 0;
foreach ($_products as $_prod) {
    $_product   = Mage::getModel('catalog/product')-&amp;gt;load($_prod-&amp;gt;getId());
    $_md5Values = array();

    //protected base image
    $baseImage = $_product-&amp;gt;getImage();
    if ($baseImage != 'no_selection') {
        $filePath = Mage::getBaseDir('media') . '/catalog/product' . $baseImage;
        if (file_exists($filePath)) {
            $_md5Values[] = md5(file_get_contents($filePath));
        }
    }

    $i++;
    echo &amp;quot;processing product $i of $total &amp;quot; . PHP_EOL;

    // Loop through product images
    $_images = $_product-&amp;gt;getMediaGalleryImages();
    if ($_images) {
        foreach ($_images as $_image) {
            //protected base image
            if ($_image-&amp;gt;getFile() == $baseImage) {
                continue;
            }

            $filePath = Mage::getBaseDir('media') . '/catalog/product' . $_image-&amp;gt;getFile();
            if (!file_exists($filePath)) {
                continue;
            }
            $md5 = md5(file_get_contents($filePath));
            if (in_array($md5, $_md5Values)) {
                $mediaApi-&amp;gt;remove($_product-&amp;gt;getId(), $_image-&amp;gt;getFile());
                echo 'removed duplicate image from ' . $_product-&amp;gt;getSku() . PHP_EOL;
                $count++;
            } else {
                $_md5Values[] = $md5;
            }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To launch the script just launch in terminal&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;&amp;gt;php delete.php&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or visit&lt;/p&gt;
&lt;pre&gt;&lt;a href="http://YourWebsiteURL/delete.php"&gt;http://YourWebsiteURL/delete.php&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;from your browser.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href="http://www.aadil.co/how-to-delete-duplicate-product-images-in-magento/"&gt;Aadil&lt;/a&gt; for a solution.&lt;/p&gt;
</description>
</item>

<item>
<title>Hide all categories without products and show categories with products</title>
<guid isPermaLink="false">7</guid>
<link>http://quicktips.ru/all/hide-all-categories-without-products-and-show-categories-with-pr/</link>
<pubDate>Sat, 20 Feb 2016 14:23:48 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/hide-all-categories-without-products-and-show-categories-with-pr/</comments>
<description>
&lt;p&gt;Reindex category products index at first and then execute following sql-script.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;UPDATE `catalog_category_entity_int` AS `status`
INNER JOIN `eav_attribute` AS `attr` ON `attr`.`attribute_code` = 'is_active'
AND `attr`.`entity_type_id` = 3
AND `status`.`attribute_id` = `attr`.`attribute_id`
SET `status`.`value` = IF((SELECT COUNT(`index`.`product_id`)
 FROM `catalog_category_product_index` AS `index`
 WHERE `index`.`category_id` = `status`.`entity_id` GROUP BY `index`.`category_id`) &amp;gt; 0, 1, 0)
WHERE `status`.`store_id` = 0&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Check Product Is New</title>
<guid isPermaLink="false">5</guid>
<link>http://quicktips.ru/all/check-product-is-new/</link>
<pubDate>Sun, 20 Sep 2015 21:29:20 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/check-product-is-new/</comments>
<description>
&lt;p&gt;Magento has two attributes “Set Product As New From Date” and “Set Product As New To Date” to set a product as new. If both fields are empty the product is not new. If only “Set Product As New To Date” is set, the product will be marked as “new” from current time until “Set Product As New To Date”. And If you set only “Set Product As New From Date” attribute the product will be marked as new from that date until forever. But how to check is product “new” currently?&lt;/p&gt;
&lt;p&gt;Unfortunately Magento doesn’t have special method for this. But in &lt;i&gt;Mage_Core_Model_Locale&lt;/i&gt; model there is a method called &lt;i&gt;isStoreDateInInterval($store, $dateFrom, $dateTo)&lt;/i&gt; which checks is current date in two passed dates interval. But we need additional validation two dates are not empty, otherwise that method will return true. So we can create such method in some helper class:&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;&amp;lt;?php
public function isProductNew(Mage_Catalog_Model_Product $product)
{
    $newsFromDate = $product-&amp;gt;getNewsFromDate();
    $newsToDate   = $product-&amp;gt;getNewsToDate();
    if (!$newsFromDate &amp;amp;&amp;amp; !$newsToDate) {
        return false;
    }
    return Mage::app()-&amp;gt;getLocale()
            -&amp;gt;isStoreDateInInterval($product-&amp;gt;getStoreId(), $newsFromDate, $newsToDate);
}&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Add Admin User Via MySQL</title>
<guid isPermaLink="false">4</guid>
<link>http://quicktips.ru/all/add-admin-user-via-mysql/</link>
<pubDate>Sun, 20 Sep 2015 16:34:51 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/add-admin-user-via-mysql/</comments>
<description>
&lt;p&gt;If you don’t have access to store’s admin panel, but you have access to a database, you can easily add new Magento admin panel user via MySQL script.&lt;/p&gt;
&lt;p&gt;Before you launch the next script, please, be sure your password is 8 symbols length and has at least 1 digit.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;LOCK TABLES `admin_role` WRITE , `admin_user` WRITE;
 
SET @SALT = &amp;quot;mr&amp;quot;;
SET @PASS = CONCAT(MD5(CONCAT( @SALT , &amp;quot;password&amp;quot;) ), CONCAT(&amp;quot;:&amp;quot;, @SALT ));
SELECT @EXTRA := MAX(extra) FROM admin_user WHERE extra IS NOT NULL;
 
INSERT INTO `admin_user` (firstname,lastname,email,username,password,created,lognum,reload_acl_flag,is_active,extra,rp_token_created_at) 
VALUES ('First name','Last name','email@example.com','username',@PASS,NOW(),0,0,1,@EXTRA,NOW());
 
INSERT INTO `admin_role` (parent_id,tree_level,sort_order,role_type,user_id,role_name) 
VALUES (1,2,0,'U',(SELECT user_id FROM admin_user WHERE username = 'username'),'First name');
 
UNLOCK TABLES;&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Make Simple Products of Configurable “Not Visible Individually”</title>
<guid isPermaLink="false">3</guid>
<link>http://quicktips.ru/all/make-simple-products-of-configurable-not-visible-individually/</link>
<pubDate>Fri, 18 Sep 2015 22:16:50 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/make-simple-products-of-configurable-not-visible-individually/</comments>
<description>
&lt;p&gt;If you wan’t automatically make all simple products which are configurable options of configurable products to be hidden in catalog, you have to change their visibility to “Not Visible Individually”.&lt;/p&gt;
&lt;p&gt;Next SQL-query will help you with that task.&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;UPDATE
`catalog_product_entity_int`
SET 
`value` = 1
WHERE
`attribute_id`=(SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'visibility')
AND
`entity_id` IN (SELECT `product_id` FROM `catalog_product_super_link`);&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Change Customers Email Domains</title>
<guid isPermaLink="false">2</guid>
<link>http://quicktips.ru/all/change-customers-email-domains/</link>
<pubDate>Fri, 18 Sep 2015 18:46:17 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/change-customers-email-domains/</comments>
<description>
&lt;p&gt;Sometimes you need to work with a production’s DB dump on a staging or on a dev server. To avoid emails be sent to real customers you should replace their email addresses with safe values. We will use Mailinator service which receives all emails and allows to access them if you know full email address.&lt;/p&gt;
&lt;p&gt;Just execute this SQL-query in your DB&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;UPDATE `customer_entity`
SET `email` = CONCAT(
 SUBSTRING(`email`, 1, locate('@', `email`)),
 'mailinator.com'
);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you need to left your organization domain email addresses unchanged, just add such condition:&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;UPDATE `customer_entity`
SET `email` = CONCAT(
 SUBSTRING(`email`, 1, locate('@', `email`)),
 'mailinator.com'
)
WHERE  SUBSTRING(`email`, locate('@', `email`) + 1) != 'my-organization.com';&lt;/code&gt;&lt;/pre&gt;</description>
</item>

<item>
<title>Change Magento Product Images File Type</title>
<guid isPermaLink="false">1</guid>
<link>http://quicktips.ru/all/change-magento-product-images-file-type/</link>
<pubDate>Fri, 18 Sep 2015 14:06:01 +0300</pubDate>
<author>Denis Obukhov</author>
<comments>http://quicktips.ru/all/change-magento-product-images-file-type/</comments>
<description>
&lt;p&gt;For instance, we need to convert all .gif to .jpg&lt;/p&gt;
&lt;p&gt;Execute next commands in terminal&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;&amp;gt; cd /vaw/www/media/catalog/product/
&amp;gt; for i in $(find $(pwd) -name \*.gif -print); do convert $i $(echo $i.jpg | sed s/.gif//g); done
&amp;gt; rm -r cache/&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, run these SQL-statements in DB&lt;/p&gt;
&lt;pre class="e2-text-code"&gt;&lt;code class=""&gt;UPDATE `catalog_product_entity_varchar`
SET `value` = REPLACE(`value`, '.gif', '.jpg') 
WHERE `attribute_id` IN 
    (SELECT `attribute_id` FROM `eav_attribute`
        WHERE `attribute_code` IN ('image', 'small_image', 'thumbnail') AND `entity_type_id` = 4
    )
; 
UPDATE `catalog_product_entity_media_gallery`
SET `value` = REPLACE(`value`, '.gif', '.jpg');&lt;/code&gt;&lt;/pre&gt;</description>
</item>


</channel>
</rss>