WordPress.org

Ready to get started?Download WordPress

Forums

WP Order Cart
Add custom fields (1 post)

  1. Smat Placid
    Member
    Posted 7 months ago #

    I needed besides SKU and PRICE more fields.

    ATTENTION: after update the plugin the changes are gone - editing core files!

    Anyone who else needs this, follow this instructions:

    Open the file [PLUGIN-PATH -> wp-order-cart -> wpordercart.php]
    Go to line ~89 "function add_products_metaboxes()" and duplicate a "add_meta_box" and change bold-entries:

    add_meta_box('wpordercart_products_fabrikat', 'Hersteller', array($this, 'wpordercart_products_fabrikat_gethtml'), 'products', 'normal', 'high');

    Then go to line ~97 "function wpordercart_products_price_gethtml()" and duplicate the whole function - change 3 times "price" and the _e label '<label for="price" >'; _e("Preis "'

    Then go to line ~152 "$products_meta['price'] = $_POST['price'];" and duplucate this, taking ur own values (in this case change 2 times "price")

    Now, if u refresh the backend and make all correct, u see under the content ur new field. To output that field, goto [PLUNING_DIR -> Templates -> product.php] (for single view) and add:

    <?php $my_value = get_post_meta($post->ID, "my-fieldname", true); if ($my_value != "") { echo " <tr> <td style='font-weight:bold;' >Label: </td> <td colspan='2' >" . $my_value . "</td> </tr> "; } ?>

    Feel free to ask.

    http://wordpress.org/plugins/wp-order-cart/

Reply

You must log in to post.

About this Plugin

About this Topic