I am trying to parse data into a serialized array but can't figure it out and it errors out. What I am trying to do is utilize update_post_meta to fill in the serialized array with values that will be parsed to it.
example output of the array:
get_post_meta('840', '_eshop_product',true );
(
[sku] => 1234567885
[products] =>
Array
(
[1] => Array
(
[option] => Retail
[price] => 3.99
[tax] => 1
[saleprice] =>
)
)
[description] => Astonishing X-men
[shiprate] => A
[featured] => Yes
[sale] => yes
[cart_radio] => 0
[optset] =>
)
All i can find for resources is examples of get_post_meta and I'm trying to utilize update_post_meta to parse new data into these fields. Here's the code:
$meta2 = update_post_meta($post_id, '_eshop_product', true);
$meta3 = update_post_meta;
$meta3($post_id, '_eshop_stock', true); //works
$meta2['sku']=htmlspecialchars($_POST['eshop_sku']); //this is line 90
if($meta2['sku']=''){update_post_meta($meta2['_sku'], "{$id}");} //this is line 91
$numoptions=$eshopoptions['options_num'];
for($i=1;$i<=$numoptions;$i++)
{
$meta2['products'][$i]['option']=htmlspecialchars($_POST['eshop_option_'.$i]); //this is line 96
if($_POST['eshop_price_'.$i]='0'){update_post_meta($meta2($_POST['eshop_price_'.$i]), "{pricing_high}");}
if($_POST['eshop_tax_'.$i]='No'){update_post_meta($meta2($_POST['eshop_tax_'.$i]), 'band 1');} //this is line 99
}
$meta2['description']=htmlspecialchars($_POST['eshop_product_description']);
if($meta2['description']==''){update_post_meta($meta2['description'], 'singles');}
$meta2['shiprate']=$_POST['eshop_shipping_rate'];
if($meta2['shiprate']='F'){update_post_data($meta2['_Shipping Rate'], 'A');}
if($_POST['eshop_sale_product']=='No'){update_post_meta( $id, '_eshop_sale', 'yes');}
And these are the errors that I get:
Warning: Cannot use a scalar value as an array in /home/***/public_html/wp-content/themes/***/mtgpage.php on line 90
Warning: Cannot use a scalar value as an array in /home/***/public_html/wp-content/themes/***/mtgpage.php on line 91
Warning: Cannot use a scalar value as an array in /home/***/public_html/wp-content/themes/***/mtgpage.php on line 96
Fatal error: Function name must be a string in /home/***/public_html/wp-content/themes/***/mtgpage.php on line 99
When I edit the product also in wordpress where the custom data would be located under the editor - there is an error and the custom fields will not display:
Fatal error: Cannot use string offset as an array in /home/***/public_html/wp-content/plugins/eshop/eshop-product-entry.php on line 44