Es gibt jetzt eine tolle, zufällige Produktanzeige. Das Random Product Plugin von Adam Tootle hat jedoch ein wenig Rework benötigt. Es gab Probleme mit dem Kategorienamen für den Permalink und veraltete Datenbankeinträge kamen zum Vorschein. Durch Austausch der folgenden Teile wird man die Probleme los.
Ersetze dies:
$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 `nice-name` FROM $wpsc_product_categories WHERE `id` = $random_product_id");
$random_product_image = $wpdb->get_var("SELECT image FROM $wpsc_product_image WHERE product_id = $random_product_id");
Durch das hier:
// 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 `nice-name` 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" );
Und während mit der einen Hand gehackt wird, wird mit der anderen ein Schlüsselanhänger geschmiedet:
Character Keyring
That’s how keyrings look like in the gumball machines at The Acidfarm!
Packaged
Approximate character size is 2 cm
Shop Availability:
Nope, only here & now.
Edition:
Unique Item!
Share
