• The random product widget on my page’s sidebar is selecting old (deleted) pictures from my products-page permalink. I’ve gone into pages and updated the “products-page” there, but the random product widget is still selecting these old pictures. I’ve deleted the pics from the Media library as well. I don’t know where this widget is targeting to get these pics. Any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • and the plugin you are using is?

    I had problems with the category name for the permalink and old database entries (for the pics). Setup was: WordPress 2.8.4, WP Shopping Cart 3.7.4, Random Product 1.2.

    Solved it by replacing this:

    $random_product_id = rand(1, end($product_count));
    while(!$random_product){
    $random_product = $wpdb->get_row("SELECT * FROM $wpsc_product_list WHERE id = $random_product_id");
    }
    $random_product_category = $wpdb->get_var("SELECT category_id FROM $wpsc_product_order WHERE product_id = $random_product_id");
    $random_product_category_nice_name = $wpdb->get_var("SELECT <code>nice-name</code> FROM $wpsc_product_categories WHERE <code>id</code> = $random_product_id");
    $random_product_image = $wpdb->get_var("SELECT image FROM $wpsc_product_image WHERE product_id = $random_product_id");

    with this:

    // the.acidfarm.org
    // Basti Rotamente solution begin
    $res = $wpdb->get_col("SELECT id FROM $wpsc_product_list WHERE active = 1 AND publish = 1");
    $random_pos = rand(0, count($res)-1);
    $random_product_id = $res[$random_pos];
    $random_product = $wpdb->get_row("SELECT * FROM $wpsc_product_list WHERE id = $random_product_id");
    $random_product_category_nice_name = $wpdb->get_var("SELECT <code>nice-name</code> FROM $wpsc_product_categories LEFT JOIN $wpsc_product_order ON $wpsc_product_order.category_id = $wpsc_product_categories.id WHERE $wpsc_product_order.product_id = $random_product_id AND active = 1");
    // Basti Rotamente solution end
    // letztes foto
    $random_product_image = $wpdb->get_var("SELECT image FROM $wpsc_product_image WHERE product_id = $random_product_id ORDER BY image_order DESC" );

    Then the plugin will use the last of multiple pics. Sometimes I needed to add the thumbnails manually (depending on how pics are added and arranged to the product).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Random Product Widget Selecting Old Pics from Store’ is closed to new replies.