<!--فحه محصول-->
<?php
/**
 * Created by mr2app.
 * User: Hani
 * Date: 3/13/2019
 * Time: 2:12 PM
 */

if (!defined( 'ABSPATH' )) exit;

if (isset($_POST['woo2app-admin']) && wp_verify_nonce($_POST['woo2app-admin'], 'woo2app-admin')) {
	$product_setting = array();
	$product_setting = get_option('woo2app_product_page');
	if(!is_array($product_setting)){
		$product_setting = array();
		$product_setting['image'] = true ;
		$product_setting['title'] = true ;
		$product_setting['price'] = true ;
		$product_setting['attribute'] = true ;
		$product_setting['comment'] = true ;
		$product_setting['btn_share'] = true ;
		$product_setting['btn_barcode'] = true ;
		$product_setting['score'] = true ;
		$product_setting['category_name'] = true ;
		$product_setting['author'] = true ;
		$product_setting['sku'] = true ;
		$product_setting['short_description'] = true ;
		$product_setting['full_description'] = true ;
		$product_setting['middle_add_cart'] = true ;
		$product_setting['related_product'] = true ;
		$product_setting['add_cart'] = true ;
		$product_setting['search'] = true ;
		$product_setting['cart'] = true ;
		$product_setting['fav'] = true ;
		$product_setting['show_discount_percent'] = true ;
		update_option('woo2app_product_page' , $product_setting);
	}
	$product_setting = array();
	$product_setting['image'] = (isset($_POST['image']) && $_POST['image'] == 'on' ) ? true : false;
	$product_setting['title'] = (isset($_POST['title']) && $_POST['title'] == 'on' ) ? true : false;
	$product_setting['price'] = (isset($_POST['price']) && $_POST['price'] == 'on' ) ? true : false;
	$product_setting['attribute'] = (isset($_POST['attribute']) && $_POST['attribute'] == 'on' ) ? true : false;
	$product_setting['comment'] = (isset($_POST['comment']) && $_POST['comment'] == 'on' ) ? true : false;
	$product_setting['btn_share'] = (isset($_POST['btn_share']) && $_POST['btn_share'] == 'on' ) ? true : false;
	$product_setting['btn_barcode'] = (isset($_POST['btn_barcode']) && $_POST['btn_barcode'] == 'on' ) ? true : false;
	$product_setting['score'] = (isset($_POST['score']) && $_POST['score'] == 'on' ) ? true : false;
	$product_setting['category_name'] = (isset($_POST['category_name']) && $_POST['category_name'] == 'on' ) ? true : false;
	$product_setting['author'] = (isset($_POST['author']) && $_POST['author'] == 'on' ) ? true : false;
	$product_setting['sku'] = (isset($_POST['sku']) && $_POST['sku'] == 'on' ) ? true : false;
	$product_setting['short_description'] = (isset($_POST['short_description']) && $_POST['short_description'] == 'on' ) ? true : false;
	$product_setting['full_description'] = (isset($_POST['full_description']) && $_POST['full_description'] == 'on' ) ? true : false;
	$product_setting['middle_add_cart'] = (isset($_POST['middle_add_cart']) && $_POST['middle_add_cart'] == 'on' ) ? true : false;
	$product_setting['related_product'] = (isset($_POST['related_product']) && $_POST['related_product'] == 'on' ) ? true : false;
	$product_setting['add_cart'] = (isset($_POST['add_cart']) && $_POST['add_cart'] == 'on' ) ? true : false;
	$product_setting['search'] = (isset($_POST['search']) && $_POST['search'] == 'on' ) ? true : false;
	$product_setting['cart'] = (isset($_POST['cart']) && $_POST['cart'] == 'on' ) ? true : false;
	$product_setting['fav'] = (isset($_POST['fav']) && $_POST['fav'] == 'on' ) ? true : false;
	$product_setting['show_discount_percent'] = (isset($_POST['show_discount_percent']) && $_POST['show_discount_percent'] == 'on' ) ? true : false;
	update_option('woo2app_product_page' , $product_setting);

}


$product_setting = array();
$product_setting = get_option('woo2app_product_page');
if(!is_array($product_setting)){
	$product_setting = array();
	$product_setting['image'] = true ;
	$product_setting['title'] = true ;
	$product_setting['price'] = true ;
	$product_setting['attribute'] = true ;
	$product_setting['comment'] = true ;
	$product_setting['btn_share'] = true ;
	$product_setting['btn_barcode'] = true ;
	$product_setting['score'] = true ;
	$product_setting['category_name'] = true ;
	$product_setting['author'] = true ;
	$product_setting['sku'] = true ;
	$product_setting['short_description'] = true ;
	$product_setting['full_description'] = true ;
	$product_setting['middle_add_cart'] = true ;
	$product_setting['related_product'] = true ;
	$product_setting['add_cart'] = true ;
	$product_setting['search'] = true ;
	$product_setting['cart'] = true ;
	$product_setting['fav'] = true ;
	$product_setting['show_discount_percent'] = true ;
	update_option('woo2app_product_page' , $product_setting);
}

?>

<div class="">
    <form method="post">
        <?php wp_nonce_field('woo2app-admin', 'woo2app-admin'); ?>
        <h3 class="background-color-e5e5e5 padding-7px">
            <?php _e('Product Page Setting', 'woo2app'); ?>
        </h3>
        <p>
            <?php _e('you can show or hide the components of the page.', 'woo2app'); ?>
        </p>
        <hr>
        
        <table class="form-table">
            <tbody>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('1 - Search Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="search" <?= checked($product_setting['search']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('2 - Cart Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="cart" <?= checked($product_setting['cart']  );?> />
                </td>
            </tr>
        
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('3 - Product Image', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="image" <?= checked($product_setting['image']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('4 - Product Title', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="title" <?= checked($product_setting['title']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('5 - Price', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="price" <?= checked($product_setting['price']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('6 - Attributes Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="attribute" <?= checked($product_setting['attribute']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('7 - Comments Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="comment" <?= checked($product_setting['comment']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('8 - Share Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="btn_share" <?= checked($product_setting['btn_share']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('9 - QR Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="btn_barcode" <?= checked($product_setting['btn_barcode']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('10 - Users Rate', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="score" <?= checked($product_setting['score']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('11 - Add To Wishlist', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="fav" <?= checked($product_setting['fav']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('12 - Category Button', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="category_name" <?= checked($product_setting['category_name']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('13 - Store Name', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="author" <?= checked($product_setting['author']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('14 - SKU', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="sku" <?= checked($product_setting['sku']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('15 - Short Description', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="short_description" <?= checked($product_setting['short_description']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('16 - Full Description', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="full_description" <?= checked($product_setting['full_description']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('17 - Add To Cart (middle)', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="middle_add_cart" <?= checked($product_setting['middle_add_cart']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('18 - Related Products', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="related_product" <?= checked($product_setting['related_product']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('19 - Add To Cart (bottom)', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="add_cart" <?= checked($product_setting['add_cart']  );?> />
                </td>
            </tr>
            <tr valign="top" class="" >
                <th scope="row" class="titledesc">
                    <?php _e('20 - Discount Percent', 'woo2app'); ?>
                </th>
                <td class="forminp">
                    <input type="checkbox" name="show_discount_percent" <?= checked($product_setting['show_discount_percent']  );?> />
                </td>
            </tr>
            </tbody>
        </table>
        <br>
        <div class="padding-left-10px">
            <input name="submit_setting" class="button button-primary" value="<?php _e('Save Changes', 'woo2app'); ?>"
                   type="submit">
        </div>
    </form>
</div>

