Monday, 31 December 2018

windows 10internnet issue

There is a known issue with Windows 10 Home: (OS build 17134.112)
The ethernet card was not immediately recognized by Windows 10 operating system.

If this happens, click the windows button + x, and open "Windows PowerShell (Admin)"

Enter the following:
netsh interface ipv4 reset
netsh interface ipv6 reset

Reboot and the ethernet card should now be recognized.

Wednesday, 30 May 2018

Tuesday, 20 February 2018

Add custom fields in Wc Vendors Add product

<?php
/*************************************************************************************************
* WC WENDORS-PRO + WooCommerce
*
* Adding custom fields to the backend (WooCommerce admin) + frontentd (WC Vendors dashboard) + Woo Commerce product page
*
* All custom fields unique ID have to start with “wcv_custom_product_”
* Poids = Weight : wcv_custom_product_poids
* Largeur = Widht : wcv_custom_product_largeur
* Hauteur = Height : wcv_custom_product_hauteur
* Epaisseur = thickness : wcv_custom_product_epaisseur
*
*************************************************************************************************/
/*************************************************************************************************
* STEP 1
* edit product-edit.php template
* Copy the template /plugins/wc-vendors-pro/templates/dashboard/product-edit.php to /themes/your-theme/wc-vendors/dashboard/product-edit.php
*
* see code snippet below
*************************************************************************************************/

<!-- Product Edit Form -->
<form method="post" action="" id="wcv-product-edit" class="wcv-form wcv-formvalidator"> 

 <!-- Basic Product Details -->
 <div class="wcv-product-basic wcv-product"> 
  <!-- Product Title -->
  <?php WCVendors_Pro_Product_Form::title( $object_id, $product_title ); ?>
  <!-- Product Description -->
  <?php WCVendors_Pro_Product_Form::description( $object_id, $product_description );  ?>
  <!-- Product Short Description -->
  <?php WCVendors_Pro_Product_Form::short_description( $object_id, $product_short_description );  ?>
  <!-- Product Categories -->
     <?php WCVendors_Pro_Product_Form::categories( $object_id, true ); ?>
     <!-- Product Tags -->
     <?php WCVendors_Pro_Product_Form::tags( $object_id, true ); ?>

  <!--CUSTOM FIELDS : POIDS  + HAUTEUR + LARGEUR + EPAISSEUR -->
  <?php   //POIDS
    WCVendors_Pro_Form_Helper::input( array(  
    'type'      => 'text',
    'post_id'   => $object_id, 
    'id'     => 'wcv_custom_product_poids', 
    'label'    => __( 'Poids', 'wcvendors-pro' ), 
    'placeholder'   => __( 'Poids', 'wcvendors-pro' ), 
    'desc_tip'    => 'true', 
    'description'   => __( 'Poids de l\'oeuvre en kg', 'wcvendors-pro' ), 
    ) );

    //HAUTEUR  
    WCVendors_Pro_Form_Helper::input( array(  
    'type'      => 'text',
     'post_id'   => $object_id, 
     'id'     => 'wcv_custom_product_hauteur', 
     'label'    => __( 'Hauteur', 'wcvendors-pro' ), 
     'placeholder'   => __( 'Hauteur de l\'oeuvre en cm', 'wcvendors-pro' ), 
     'desc_tip'    => 'true', 
     'description'   => __( 'Hauteur de l\'oeuvre en cm ', 'wcvendors-pro' ), 
     ) );
   
    //LARGEUR
    WCVendors_Pro_Form_Helper::input( array(  
    'type'      => 'text',
     'post_id'   => $object_id, 
     'id'     => 'wcv_custom_product_largeur', 
     'label'    => __( 'Largeur', 'wcvendors-pro' ), 
     'placeholder'   => __( 'Largeur de l\'oeuvre en cm', 'wcvendors-pro' ), 
     'desc_tip'    => 'true', 
     'description'   => __( 'Largeur de l\'oeuvre en cm ', 'wcvendors-pro' ), 
     ) );
     
    //THICKNESS 
    WCVendors_Pro_Form_Helper::input( array(  
    'type'      => 'text',
     'post_id'   => $object_id, 
     'id'     => 'wcv_custom_product_epaisseur', 
     'label'    => __( 'Epaisseur', 'wcvendors-pro' ), 
     'placeholder'   => __( 'Epaisseur de l\'oeuvre en cm', 'wcvendors-pro' ), 
     'desc_tip'    => 'true', 
     'description'   => __( 'Epaisseur de l\'oeuvre en cm ', 'wcvendors-pro' ), 
    ) );
  ?>  
  
 </div>
 
 
 
 
*****************************************************

* STEP 2

* ADDING OUR CUSTOMS FIELDS TO THE BACKEND

* Copy this code to your functions.php file

*************************************************************************************************/
 
function mysocialart_custom_fields_admin() {

 echo '<h4>MY CUSTOM FIELDS</h4>'; // CHANGE TEXT HERE.

 // FIELD Poids
 woocommerce_wp_text_input(
  array(
   'id' => 'wcv_custom_product_poids', 
   'data_type' => 'text', 
   'label' => __('Poids en kg', 'msk'),
   'placeholder' => __('00.00', 'msk'),
   'description' => __('La description peut apparaître dans une infobulle si "desc_tip" est sur "true".', 'msk'),
   'desc_tip' => true // Si "true", la description s'affichera en infobulle
  )
 );

 // FIELD Hauteur
 woocommerce_wp_text_input(
  array(
   'id' => 'wcv_custom_product_hauteur', 
   'data_type' => 'text', 
   'label' => __('Hauteur en cm', 'msk'),
   'placeholder' => __('00.00', 'msk'),
   'description' => __('La description peut apparaître dans une infobulle si "desc_tip" est sur "true".', 'msk'),
   'desc_tip' => true // Si "true", la description s'affichera en infobulle
  )
 );
 
  // FIELD Largeur
 woocommerce_wp_text_input(
  array(
   'id' => 'wcv_custom_product_largeur', 
   'data_type' => 'text', 
   'label' => __('Largeur en cm', 'msk'),
   'placeholder' => __('00.00', 'msk'),
   'description' => __('La description peut apparaître dans une infobulle si "desc_tip" est sur "true".', 'msk'),
   'desc_tip' => true // Si "true", la description s'affichera en infobulle
  )
 );
 
  // FIELD epaisseur
 woocommerce_wp_text_input(
  array(
   'id' => 'wcv_custom_product_epaisseur', 
   'data_type' => 'text', 
   'label' => __('epaisseur en cm', 'msk'),
   'placeholder' => __('00.00', 'msk'),
   'description' => __('La description peut apparaître dans une infobulle si "desc_tip" est sur "true".', 'msk'),
   'desc_tip' => true // Si "true", la description s'affichera en infobulle
  )
 );
 
}
// CUSTOM FIELDS WILL BE ADDED TO THE GENERAL TAB OF THE PRODUCT
add_action('woocommerce_product_options_general_product_data', 'mysocialart_custom_fields_admin');
 
/*************************************************************************************************

* STEP 3

* SAVE OUR CUSTOMS FIELDS WHEN ADD OR EDIT A PRODUCT TO THE BACKEND

* ADD THIS CODE TO YOUR FUNCTIONS.PHP FILE

*************************************************************************************************/
 
function save_mysocialart_custom_fields_admin($product_id, $post, $update) {
 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;

 if ($post->post_type == 'product') {
  
 // save poids
  if (isset($_POST['wcv_custom_product_poids'])) {
   $wcv_custom_product_poids = $_POST['wcv_custom_product_poids'];
   update_post_meta($product_id, 'wcv_custom_product_poids', $wcv_custom_product_poids);
  }
 // save hauteur
  if (isset($_POST['wcv_custom_product_hauteur'])) {
   $wcv_custom_product_hauteur = $_POST['wcv_custom_product_hauteur'];
   update_post_meta($product_id, 'wcv_custom_product_hauteur', $wcv_custom_product_hauteur);
  }
  
  //save largeur
  if (isset($_POST['wcv_custom_product_largeur'])) {
   $wcv_custom_product_largeur = $_POST['wcv_custom_product_largeur'];
   update_post_meta($product_id, 'wcv_custom_product_largeur', $wcv_custom_product_largeur);
  }
  
  //save épaisseur
  if (isset($_POST['wcv_custom_product_epaisseur'])) {
   $wcv_custom_product_epaisseur = $_POST['wcv_custom_product_epaisseur'];
   update_post_meta($product_id, 'wcv_custom_product_epaisseur', $wcv_custom_product_epaisseur);
  }  
  
 }
}
add_action('save_post', 'save_mysocialart_custom_fields_admin', 10, 3);
 
/*************************************************************************************************

* STEP 4

* CREATE A NEW TAB TO DISPLAY OUR CUSTOM FIELDS

* ADD THIS CODE TO YOUR FUNCTIONS.PHP FILE

*************************************************************************************************/
 
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
 
 // Adds the new tab
 
 $tabs['test_tab'] = array(
  'title'  => __( 'Information complémentaire', 'woocommerce' ), // THE NAME OF YOUR TAB.
  'priority'  => 50,
  'callback'  => 'wcv_mysocialart_custom_fields_product_page' // => SEE STEP 5
 );

 return $tabs;

}
 
/*************************************************************************************************

* STEP 5

* DISPLAY OUR CUSTOM FIELDS ON THE PRODUCT PAGE IN OUR CUSTOM TAB

* ADD THIS CODE TO YOUR FUNCTIONS.PHP FILE

*************************************************************************************************/
 
function wcv_mysocialart_custom_fields_product_page() {
 
    $poids = get_post_meta( get_the_ID(), 'wcv_custom_product_poids', true ); 
    echo 'Poids: ' . $poids . ' kg<br>';
 
    $hauteur= get_post_meta( get_the_ID(), 'wcv_custom_product_hauteur', true ); 
    echo 'Hauteur: ' . $hauteur. ' cm<br>';
 
 $largeur= get_post_meta( get_the_ID(), 'wcv_custom_product_largeur', true ); 
    echo 'Largeur: ' . $largeur. ' cm<br>';
 
 $epaisseur = get_post_meta( get_the_ID(), 'wcv_custom_product_epaisseur', true ); 
    echo 'épaisseur: ' . $epaisseur . ' kg<br>';
 }
 
/*************************************************************************************************

* STEP 6

* CHANGE THE TEXT WHEN A PRODUCT IS OUT OF Stock

* ADD THIS CODE TO YOUR FUNCTIONS.PHP FILE

*************************************************************************************************/
 
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
    
    // Change In Stock Text
    if ( $_product->is_in_stock() ) {
        $availability['availability'] = __('Oeuvre disponible!', 'woocommerce');
    }
    // Change Out of Stock Text
    if ( ! $_product->is_in_stock() ) {
        $availability['availability'] = __('Oeuvre vendue', 'woocommerce');
    }
    return $availability;
}     

Saturday, 17 February 2018

Puty codes

cd - change directory

cd ..    - come out of one directory

pwd        -    Path of my current directory

wget - get downloadable data

unzip filename.zip -d /pictures  - for unzip data and -d for directory

unzip -l filename.zip  -  list all files from a .zip file

unzip filename.zip filename.txt  -- extract / unzip certain file from a .zip file

zip -r filename *  -   zip up an entire directory including all sub-directories

zip -r example2.zip *  -  zip all files in current directory

rm -rf *    -    delete all files in directory

rm -rf foldername/  -  To delete a whole folder and its content

mysql -u user_name -p database_name< advomate_pompusalive.sql  ------ for import DB

mysqldump -u username -p  database_to_be_exported > db_file_name.sql  ------   for export DB

yum install zip unzip -y     -   if zip/unzip not working

sudo yum install mysql

find . -name myFile.txt

find . -name "myFile*"