Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter helldog2004

    (@helldog2004)

    I tried this, didn’t work out for me:

    function set_noindex_when_pdf(){
    	$supportedTypes = array( 'application/pdf' );
    	$fileType = $_FILES['type'][0];
    	$fileArray = wp_check_filetype( basename( $_FILES['name'][0] ) );
    	if( in_array( $fileArray['type'], $supportedTypes ) ) {
    		add_action( 'wpseo_saved_postdata', function() use ( $post_id ) { 
         	update_post_meta( $post_id, '_yoast_wpseo_meta-robots-noindex', '1' );
         	}, 999 );
    		}
    	}
    add_action( 'save_post', 'set_noindex_when_pdf' );
    Thread Starter helldog2004

    (@helldog2004)

    @wisdmlabs
    thanks for the message, I figured the plug-in you are providing is not what I am searching for, although I did found the form to PDF plug-in which I am very interested in for the same purpose.

    I figured something like ‘UpiCRM – Free WordPress CRM and Lead Management’ is doing what I want.
    We need a lead generating form (probably Gravity Forms) which will be auto-assigned to multiple users/groups (companies). These companies can find the information back in their own profile, change their profile, change filters and download their invoices.

    Thanks for the help.

    @a2hostinglk
    I know I can find plug-ins and themes, I was asking for tips regarding plug-ins and themes which are doing what I am wishing for.

    Thread Starter helldog2004

    (@helldog2004)

    Als ik de pagina bekijk in debugging dan komt deze terug met een error zodra ik het kenteken wil opzoeken.
    De error is als volgt:
    Warning: preg_grep() expects parameter 2 to be array, string given in /www/htdocs/hgtrfdjhiuy/wp-content/plugins/open-rdw-kenteken-voertuiginformatie/includes/class-open-rdw-kenteken-voertuiginformatie-api.php on line 51

    Als ik dan het bestand bekijk dan zit hier het probleem in:
    $sidecalls = preg_grep(‘/https:\/\/opendata.rdw.nl\/resource\/(\w+)/’, $response);

    Nogmaals, heeft dit te maken met de verouderde PHP? Of is dit op een andere manier op te lossen?

    Forum: Fixing WordPress
    In reply to: Multiple orders
    Thread Starter helldog2004

    (@helldog2004)

    Okay, currently I recreated the select dropdown again to make it custom instead of adding it to the billing section. I am now able to get the value of a single select dropdown, but once I get a load of select dropdowns compaired with my database it stops working.

    This is how I added the select dropdown:

    add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
    
    function my_custom_checkout_field( $checkout ) {
    global $current_user;
    get_currentuserinfo();
    $i = 0;
    global $wpdb;
    $queries25 = $wpdb->prepare("SELECT * FROM kdEksID_affiliates WHERE display_name='$current_user->display_name' ORDER BY display_name+0 ASC", GID);
    $Finished25 = $wpdb->get_results($queries25);
    echo '<div class="my_custom_checkout_field"><h2>' . __('SELECT SHIPPING ADDRESSES') .'</h2>';
    foreach ( $Finished25 as $finish25 ) {
    
    woocommerce_form_field( 'affiliate['.$finish25->id.']', array(
       'type' => 'select',
       'label'      => __('Send products to ' . $finish25->company_name, 'woocommerce'),
       'placeholder'   => _x('affiliate', 'placeholder', 'woocommerce'),
       'required'   => false,
       'class'      => array('form-row-wide'),
       'clear'     => true,
       'options' => array($finish25->id => 'YES', 'No ' . $finish25->company_name => 'NO'),
           ), $checkout->get_value( 'affiliate['.$finish25->id.']' ));
    }
    echo '</div>';
    }
    
    add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );
    
    function my_custom_checkout_field_update_order_meta( $order_id ) {
    
       if ( ! empty( $_POST['affiliate['.$finish25->id.']'] ) ) {
           update_post_meta( $order_id, 'affiliate['.$finish25->id.']', $_POST['affiliate['.$finish25->id.']'] );
       }
    }

    As you can see all names of these select dropdowns have their own id captured from the database this is working perfectly. But now I am trying to get the data by the following code:

    <?php 	global $current_user;
    			get_currentuserinfo();
    			global $wpdb;
    			$queries26 = $wpdb->prepare("SELECT * FROM kdEksID_affiliates WHERE display_name='$current_user->display_name' ORDER BY display_name+0 ASC", GID);
    			$Finished26 = $wpdb->get_results($queries26);
    			foreach ( $Finished26 as $finish25 ) { ?>
        			<tr><th>Send to <?php echo $finish25->company_name;?>:</th><td><?php echo get_post_meta( $order->id, 'affiliate['.$finish25->id.']', true ); ?> </td></tr>
    			<?php }?>

    It is adding two rows inside my table, it also shows the two companies added for this account, but it ain’t getting the selected values from the two selected dropdowns earlier.
    How do I make this work? Got any idea?

    Forum: Fixing WordPress
    In reply to: Multiple orders
    Thread Starter helldog2004

    (@helldog2004)

    Hi bcworkz,

    sorry for the late reply, got a bit caught up.
    Your replies have helped me realy far, but I decided to change a small factor on how we gather the information. At first we used the checkbox options, well, we changed it to a dropdown selection (for each affiliate create one selection).

    We applied this to the functions.php file instead of hardcoded inside the Woocommerce templates.
    Code looks like:

    add_filter( 'woocommerce_checkout_fields' , 'dropdown' );
    			
    			function dropdown( $fields ) {
    					global $current_user;
          				get_currentuserinfo();
    					$i = 0;
    					global $wpdb;
    					$queries25 = $wpdb->prepare("SELECT * FROM kdEksID_affiliates WHERE display_name='$current_user->display_name' ORDER BY display_name+0 ASC", GID);
    					$Finished25 = $wpdb->get_results($queries25);
    			foreach ( $Finished25 as $finish25 ) {
         			$fields['billing']['dropdown-' . $i++ . ''] = array(
            		'label'     => __('Send products to affiliate '.$finish25->company_name  . '', 'woocommerce'),
        			'placeholder'   => _x('dropdown', 'placeholder', 'woocommerce'),
        			'required'  => false,
        			'class'     => array('form-row-wide'),
        			'clear'     => true,
        			'type'      => 'select',
         				'options'     => array(
            				$finish25->company_name.' - yes' => __('YES', 'woocommerce' ),
            				$finish25->company_name.' - no' => __('NO', 'woocommerce' )
            			)//end of options
         			);
    			}
    
         		return $fields;
    			}

    But how can I add this data to the order page in backend and add it to the emails being send to our client?
    Also would like to send an email for each affiliate selected as YES, how can I make this happen. Probably by disabling the standard email and create an after_submit hook?

    Thanks for the great support.

    • This reply was modified 7 years, 11 months ago by helldog2004. Reason: typo 'dropbox' to 'checkbox'
    Forum: Fixing WordPress
    In reply to: Multiple orders
    Thread Starter helldog2004

    (@helldog2004)

    Good morning bcworkz and thank you for replying,

    currently I have created a start:
    1. In the back-end all created users will be called in a seperate page with a link to an ID. In here back-end moderators can add affiliate companies to the users.
    2. Once a user is logged in, they can choose all their added affiliates as billing addresses in the checkout page of WooCommerce.

    What should happen now?
    1. I should make the checkbox required (at least 1 should be selected).
    2. For each checkbox their should be a different order + email (different addresses, same products). Emails are sent to the same person, because he is the one ordering for all affiliates so name and email are all the same over the process, just address / zipcode / city and company name are different.

    This is all I should have in the beginning, the duplicate orders for each checkout can be done later. This is done for administration purposes. Thanks for assisting.

    I added images to:
    Image 1
    Image 2
    Image 3

    Final solution for everyone who want to solve these messages:

    Open up woocommerce-extra-charges-option-to-payment-gateways-std.php en comment out line
    wp_enqueue_script( 'wc-add-extra-charges', $this->plugin_url() . '/assets/app.js', array('wc-checkout'), false, true );

    and add the following code above class WC_PaymentGateway_Add_extra_std_Charges{

    function __construct(){
    	$this -> current_gateway_title = '';
    	$this -> current_gateway_extra_charges = '';
    	add_action('admin_head', array($this, 'add_form_fields'));
        add_action( 'woocommerce_calculate_totals', array( $this, 'calculate_totals' ), 10, 1 );
    	wp_register_script('app12', $this->plugin_url() . '/assets/app.js', array( 'jquery' ));
    	wp_enqueue_script('app12');
    	}

    Cheers

    Okay the following solution worked for me, its a bit of a work-around but workable.

    remove line 41 from woocommerce-extra-charges-option-to-payment-std.php or comment it out with //
    Then add the following code inside your themes functions.php

    function extra_charge(){
    	wp_register_script('app12', 'https://www.localhost/piaffe/wp-content/woocommerce-extra-charges-to-payment-gateways/assets/app.js', array( 'jquery' ));
    	wp_enqueue_script('app12');
    	}
    
    add_action( 'wp_enqueue_scripts', 'extra_charge' );

    Of course, don’t forget to edit your own url.
    Let me know if this solves it for ya.

    Also this error is being thrown out by your plug-in:

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in D:\xampp\htdocs\piaffe\wp-includes\functions.php on line 3792

    This notice was shown after activating this plug-in.
    Thanks.

    I installed the same plugin on my local WordPress environment with the same error. I also updated my WooCommerce to version 2.5.5

    Request a fix for this please, updating stuff that does not fix and hiding bugs are not realy helpful.

    Thread Starter helldog2004

    (@helldog2004)

    Nevermind, solved my problem by using (this)child inside my jQuery and added a display: none in CSS.
    Here is the code snippet (HTML & PHP didn’t change at all)

    <script>
    jQuery(document).ready(function() {

    jQuery(“.post-type-archive-product .product-type-simple, .archive.tax-product-cat .product-type-simple”).hover(function() {
    jQuery(this).children(“.popup-product-custom”).toggle();
    });
    });
    </script>

    And for the CSS I used the following two lines:

    .post-type-archive-product .popup-product-custom {display: none;}
    .archive.tax-product_cat .popup-product-custom {display: none;}

    That solved my problem.
    Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)