Commit 1fa8f2da authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge pull request #7 from farooqaaa/master

Added class field to addon group
parents 8ba8127d 325f8764
......@@ -227,6 +227,7 @@ class Product_Addon_Admin {
$addon_type = $_POST['product_addon_type'];
$addon_position = $_POST['product_addon_position'];
$addon_required = isset( $_POST['product_addon_required'] ) ? $_POST['product_addon_required'] : array();
$addon_class = $_POST['product_addon_class'];
$addon_option_label = $_POST['product_addon_option_label'];
$addon_option_price = $_POST['product_addon_option_price'];
......@@ -269,6 +270,7 @@ class Product_Addon_Admin {
'position' => absint( $addon_position[ $i ] ),
'options' => $addon_options,
'required' => isset( $addon_required[ $i ] ) ? 1 : 0,
'class' => sanitize_text_field( stripslashes( $addon_class[ $i ] ) ),
);
}
}
......
......@@ -36,6 +36,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<textarea cols="20" id="addon_description_<?php echo $loop; ?>" rows="3" name="product_addon_description[<?php echo $loop; ?>]"><?php echo esc_textarea( $addon['description'] ) ?></textarea>
</td>
</tr>
<tr>
<td class="addon_class" width="50%">
<label for="addon_class_<?php echo $loop; ?>"><?php _e( 'Group Class', 'woocommerce-product-addons' ); ?></label>
<input type="text" id="addon_class_<?php echo $loop; ?>" name="product_addon_class[<?php echo $loop; ?>]" value="<?php echo esc_attr( $addon['class'] ) ?>" />
</td>
</tr>
<tr>
<td class="data" colspan="3">
<table cellspacing="0" cellpadding="0">
......
......@@ -145,6 +145,7 @@ class Product_Addon_Display {
'name' => $addon['name'],
'description' => $addon['description'],
'type' => $addon['type'],
'class' => $addon['class'],
), 'woocommerce-product-addons', $this->plugin_path() . '/templates/' );
echo $this->get_addon_html( $addon );
......
<div class="<?php if ( 1 == $required ) echo 'required-product-addon'; ?> product-addon product-addon-<?php echo sanitize_title( $name ); ?>">
<?php
$classes = array();
if ( 1 == $required ) {
$classes[] = 'required-product-addon';
}
$classes[] = 'product-addon product-addon-' . sanitize_title( $name );
$classes[] = $class;
?>
<div class="<?php echo implode(' ', $classes); ?>">
<?php do_action( 'wc_product_addon_start', $addon ); ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment