Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter kocosh

    (@kocosh)

    Hey Janis, thanks a lot for such a prompt response.

    Oh, believe me I know it is not an “easy peasy” job ?? That said, thanks to the underlying complexity, I think you could add quite some value and get paid for that! ??

    Anyway, you’ll see, I would be really glad to see it. With a lean php script, I’d probably use it on every client site to improve the UX for the editors a bit.

    Take care,
    Jan

    Thread Starter kocosh

    (@kocosh)

    Hey, any news? Is that a bug or solvable otherwise?

    I’m still struggling with explaining that to my client.

    Thanks a lot
    Jan

    Thread Starter kocosh

    (@kocosh)

    Hello, any update on this? ?? Perhaps dev team’s response?

    So far I haven’t found a way to get around those…

    Thanks again!
    Jan

    Thread Starter kocosh

    (@kocosh)

    Hi, thanks for a prompt response.

    I have stared my investigation on the translations page, but I can’t find any strings from the calendar.

    Here’s an example – the “Multi-Day” button in the bottom right corner of the calendar. No results…

    On the other hand, the months for example are translated, but do not show up properly.

    I don’t think it is a problem with translation – I think it is rather problem in the code. The Gutenberg Date Time Block does not get localized properly (in my case anyway).

    I try to be more elaborate and list the bugs I see:
    – the date format shown in the Date Time block does not correspond to the format set in plugin options (both when datepicker active and inactive)
    – the separator of date and time does not correspond to the value that has been set in plugin options (when datepicker active)
    – the datepicker regional settings do not correspond to the WP admin language (or I am missing an option to set the regional formatting – at least I haven’t found it)
    – the Multi-Day btn string is not translatable

    Screenshot here

    Could you please go through these and let me know how that can be solved?

    Thanks a lot,
    Jan

    Thread Starter kocosh

    (@kocosh)

    Yes please, that would be awesome!

    For the future reference, here’s a quick and dirty solution I came up with…

    /**
    * Sets minimum wordcount to $wpm to avoid showing "< 1 min"
    */
    function set_minimum_wordcount( $count ) {
      $wpm = get_option( 'rt_reading_time_options' )['wpm'];
    
      if ( $count < $wpm ) return $wpm;
      return $count;
    }
    add_filter('rtwp_filter_wordcount', 'set_minimum_wordcount');
    Thread Starter kocosh

    (@kocosh)

    Oh, that’s fast ??

    That does indeed help, thank you!

    In that case I just misunderstood the docs, I thought it would skip certain object permanently… sorry.

    Thread Starter kocosh

    (@kocosh)

    So I solved it by deleting the Account mapping (keeping the Voucher) and creating the Account object manually instead.

    For the future reference, here’s my quick and dirty solution:

    Using object_sync_for_salesforce_push_params_modify filter…

    add_filter('object_sync_for_salesforce_push_params_modify', 'before_push_to_sf', 10, 6);
    
    function before_push_to_sf($params, $mapping, $object, $sf_sync_trigger, $use_soap, $is_new) {

    Getting Voucher ID, WC Order ID…

      $wp_id = $object['ID'];
      $wc_id = $object['_order_id'];
      $sf_id = '';

    Manually pushing Account…

      $salesforce = Object_Sync_Salesforce::get_instance();
      $salesforce_api = $salesforce->salesforce['sfapi'];
    
    	if (is_object($salesforce_api)) {
        $accountParams = array(
          'LastName' => get_post_meta($wc_id, '_billing_last_name', true),
          'FirstName' => get_post_meta($wc_id, '_billing_first_name', true),
          'PersonEmail' => get_post_meta($wp_id, '_purchaser_email', true),
          'PersonMobilePhone' => get_post_meta($wc_id, '_billing_phone', true),
    
          'BillingStreet' => get_post_meta($wc_id, '_billing_address_1', true),
          'BillingCity' => get_post_meta($wc_id, '_billing_city', true),
          'BillingPostalCode' => get_post_meta($wc_id, '_billing_postcode', true)
        );
    
        if(!get_post_meta($wp_id, '_sf_account_id', true)) {
          $result = $salesforce_api->object_create('Account', $accountParams);
    
          if($result['data']['id']) {
            $sf_id = $result['data']['id'];
            // SAVE PURCHASER ACCOUNT'S ID AS META
            add_post_meta($wp_id, '_sf_account_id', $sf_id, true);
          } else {
            // SOMETHING WENT WRONG
          }
    
        } else {
          $sf_id = get_post_meta($wp_id, '_sf_account_id', true);
          $result = $salesforce_api->object_upsert('Account', 'Id', $sf_id, $accountParams);
    
          if($result['data']['success'] == 1) {
            // ALL GOOD
          } else {
            // SOMETHING WENT WRONG
          }
        }
    	}

    And using ID of the newly created SF object for the relationship field like this…

    $params['Customer__c'] = $sf_id;

    • This reply was modified 6 years, 10 months ago by kocosh.
    • This reply was modified 6 years, 10 months ago by kocosh.
    Thread Starter kocosh

    (@kocosh)

    Thanks for such a prompt response… I thought so ??

    One more question then, could I use the object_sync_for_salesforce_push_success action after the “Contact” was successfully created and before the “Voucher” will be created?

    …Is the action triggered separately for each mapping? Can I make sure that the mapping happens in the “right” order?

    So that I could grab the object id returned from the first fieldmapping and modify the data for the second..?

    Thank you once again!

    • This reply was modified 6 years, 10 months ago by kocosh.
Viewing 9 replies - 1 through 9 (of 9 total)