title: Magento Tier Price Bulk Change
body: <p>I need a little bit a help here-down is sample og php code for price update in Magento, can someone please give me a hint how to put relation in this code.</p>
  
  <p>For example, i need this: if price is >=500 then tier= 1.8
  Code below increases all prices but i need only increase price for products equal or expensive then 500 USD.</p>
  
  <pre><code>&lt;?php
  
  $server     = "localhost";
  $database   = "";
  $user       = "";
  $password   = "";
  
  $myConn = mysql_connect( $server, $user, $password ); 
  $select = mysql_select_db( $database, $myConn );
  
  $query = "SELECT
              value_id, value
          FROM
              catalog_product_entity_decimal
          ORDER BY
              value_id
          ASC";
  
  $result = mysql_query($query) or die(mysql_error()); 
  
  // 1.04 = 4% (duh) ovdje idu postavke marze
  $tier   = 1.04;
  $i      = 0;
  
  while( $row = mysql_fetch_array($result) )
  {
      if( $row["value"] != NULL )
      {
          $value          = 0;
          $value          = $row["value"];
  
          $value          = round( $value * $tier );
  
  
          $updQuery = "UPDATE
                          catalog_product_entity_decimal
                      SET
                          value = ".$value."
                      WHERE
                          value_id = ".$row["value_id"];
  
          $updResult = mysql_query($updQuery) or die(mysql_error());
  
          $i++;
  
          print "value_id: ".$row["value_id"]." | ";
          print "old price: ".$row["value"]." -&gt; ";
          print "new price: ".$value."&lt;br/&gt;";
      }
  
  }
  
  print "&lt;br/&gt;&lt;br/&gt;&lt;hr&gt;&lt;br/&gt;&lt;b&gt;".$i."&lt;/b&gt; records updated.&lt;br/&gt;&lt;br/&gt;Now go to system -&gt; index management -&gt; and reindex everything";
  </code></pre>
  
  <p>?></p>