hello friends, all of you know today in market so many e-commerce site is available, and may be you also have developed e-commerce, using wordpress we can make very nice ecommerce site and that all of you know, and in this article i will explain you that how to add custom code in e-commerce plugin of wordpress.
suppose may be one product page is exist in wordpress ecommerce site and if you want to add custom code something like color box you want to add or anything you want to add inside e-commerce’s product page than easily you can add that code inside that plugin, so i will show you how to do that and in which file you have to add that code.
for getting this above link first of all you have to installed wordpress’s wp-e-commerce plugin and that plugin you can find in wordpress site. so download from their and installed in your site.
after than whatever link i gave open that and find function
add_meta_box( 'wpsc_product_color_forms', __('Product color and Type', 'wpsc'), 'wpsc_product_color_forms1', $pagename, 'normal', 'high' );
in this above function name wpsc_meta_boxes already exist in admin.php so you have to just insert one line of code on that function. i.e line add_meta_box….. that i have added in above that function.
Now, after that open this file http://yoursiteurl/wp-content/wp-admin/plugins/wp-e-commerce/wpsc-admin/includes/display-item-functions.php
global $post, $wpdb, $wpsc_product_defaults;
$product_data = get_post_custom( $post->ID );
$product_data['meta'] = maybe_unserialize( $product_data );
My Color:<input type="text" name="meta[_my_color]" id="my_color" value="<?php echo $smitcky_color; ?>" />
that’s it you have to add only this two things than after check what happen. in wp-e-commerce’s product page you can see My color: <textbox display here> and enter any value on that textbox and click on publish or update any product that value automatically stored in wordpress’s wp-postmeta table.
try once above code, so like this you can add custom metabox in your site of wp-e-commerce plugin, and this is very easy trick. i hope you will like this simple trick.