So I have this flash application that sends price value to eShop Plugin. I wanted to update it dynamically using the following code:
$wpdb->query("update wp_postmeta set meta_value = '".$meta_val."' where meta_id = 1112");
It's working, but when I click the add to cart button, it says Error. That product is not available.
Or is there a function in eshop that could update the price?
Thanks.
The price is stored in a seraliazed array, so you need to retrieve the info, and then update and save. Something like this:
$eshop_product=maybe_unserialize(get_post_meta( $post_id, '_eshop_product',true ));
$numoptions=$eshopoptions['options_num'];
for($i=1;$i<=$numoptions;$i++){
if($_POST['eshop_price_'.$i]=='0') $_POST['eshop_price_'.$i]='0.00';
$eshop_product['products'][$i]['price']=$_POST['eshop_price_'.$i];
}
update_post_meta( $id, '_eshop_product', $eshop_product);
(crude example)
So, changing it straight from the database won't work using $wpdb->query()? :(
Which file can I edit the function?
Thank you so much for the help.
edit what function?
No it can't be done via wpdb->query().
I mean the file where you can update the price using $_POST. Or can it be done on the single.php?
have a look in eshop-product-entry.php