How to join wp_posts and wp_postmeta in wordpress ecommerce plugin retrieving only product title, product description and price?
I'm using wp-ecommerce plugin for my own online ordering bakeshop (http://www.kingsbakery.mpkproducts.com/)
I don't want the way how customer开发者_开发技巧s made an order. I want similar order form like this (https://www.ssfamousdeli.com/order_ship.aspx).
I run a custom query in Mysql and I can only retrieve the product title and description. I use this sql statement:
<?php
$sql = "SELECT * FROM wp_posts WHERE
post_type like 'wpsc_product' AND
post_status like 'publish'
ORDER BY ID Asc";
$query = mysql_query($sql);
?>
I only stop there coz I don't know how to join wp_postmeta to select the price.
Please help. Thanks
<?php
$sql = "SELECT wp_p.*, wp_pm.meta_value FROM wp_posts wp_p, wp_postmeta wp_pm WHERE
wp_p.post_type like 'wpsc_product' AND
wp_p.post_status like 'publish' AND
wp_p.ID = wp_pm.post_id
wp_pm.key = 'Price' --This should be the meta key
ORDER BY wp_p.ID Asc";
$query = mysql_query($sql);
?>
Hope this will be of help.
精彩评论