WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP e-Commerce] Unable to mass update prices (3 posts)

  1. Zealousd
    Member
    Posted 1 year ago #

    SELECT meta_key, meta_value
                                FROM wp_postmeta
                                WHERE meta_key = "_wpsc_price"
                                SET meta_value = meta_value * 2.0
                                ORDER BY meta_value

    this is all i got so far but still not working, i am just about over it all and this is the last major thing left before i can open up again.

    I have taken the CSV file and updated my site with products and everything is sitting there quite nice, but the prices are sitting at wholesale and so i need to update 5000 products with a x2 multiplier so i can make money off my sales otherwise there is no point in doing this.

    Currant version 3.8.8.5 WP e-Commerce

    any help would be much appreciated with a SQL update code for the plugin.

  2. Zealousd
    Member
    Posted 1 year ago #

    WWWWWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

    I am a champion

    the person who made that last SQL update script, changed it before giving control over so it was pointing to a non existing table. After a little consultation and looking around the SQL.

    Found that wp_postmeta contained the data then changed the meta_value x2/double price where _wpsc_price was found in meta keys. Changed all 4200 products prices in half a second.

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    [code]UPDATE wp_postmeta
    SET meta_value = meta_value * 2.0
    WHERE meta_value = meta_value AND meta_key = "_wpsc_price";[/code]
    
    then to top it off you can add this into a php update script to make life easy and don't have to login to Mysql. Just upload run ONCE! and delete when done.
    
    I have been looking at this problem for a while now and i am ssoo happy i got it sorted :) also hopes this post helps others and i could not find much information on this what so ever.
    [code]
    <?php
    $con = mysql_connect("localhost","db_user","db_pwd");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("database_select", $con);
    
    $result = mysql_query('UPDATE wp_postmeta
    								SET meta_value = meta_value * 2.0
    								WHERE meta_value = meta_value AND meta_key = "_wpsc_price";');
    
    echo "<table border='1'>
    <tr>
    <th>meta_key</th>
    <th>meta_value</th>
    </tr>";
    
    while($row = mysql_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . $row['meta_key'] . "</td>";
      echo "<td>" . $row['meta_value'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";
    
    mysql_close($con);
    ?> [/code]
  3. baseball1
    Member
    Posted 1 year ago #

    Is there a way to update my product list (WITH ALPHANUMERIC SKU#)to a discount price 5% below the base price? Note: I have many products with Variations in product criteria.

Topic Closed

This topic has been closed to new replies.

About this Topic