Support » Plugin: Zero BS WordPress CRM » how can I get in the code the identifier of the quote and address of customer ?

  • Resolved guillaumeglt

    (@guillaumeglt)


    Hello everyone, how can I get in the code the identifier of the quote and also the address of the customer ? So that I can put them in the model of my quote through the PHP code

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author woodyhayday

    (@woodyhayday)

    Hi

    You’re looking for the Quote ID and contact address?

    What’s the use case here? Are you building something?

    We’ve not had any developer-questions re: quotes/contact retrieval, (perhaps we can add integration functions for you). Could you let us know exactly what you’re looking for in what format and I’ll see what we can do.

    All the best

    Woody

    Ok i found ! i use this code to collect informations from database and to use in my quote template:

    global $wpdb;

    $req_id_quote = $wpdb->get_results(“SELECT * FROM {$wpdb->prefix}postmeta WHERE post_id=”.$_POST[‘zbs_quote_id’].” AND meta_key = ‘zbsid'”) ;
    // Parcours des resultats obtenus

    foreach ($req_id_quote as $post) {
    $id_quote = $post->meta_value;
    }

    $req_id_contact = $wpdb->get_results(“SELECT * FROM {$wpdb->prefix}postmeta WHERE post_id=”.$_POST[‘zbs_quote_id’].” AND meta_key = ‘zbs_customer_quote_customer'”) ;

    foreach ($req_id_contact as $post) {
    $id_contact = $post->meta_value;
    }

    $req_adress_contact = $wpdb->get_results(“SELECT * FROM {$wpdb->prefix}zbs_contacts WHERE ID=”.$id_contact.””) ;

    foreach ($req_adress_contact as $post) {
    $address1 = $post->zbsc_addr1;
    $address2 = $post->zbsc_addr2;
    $city = $post->zbsc_city;
    $country = $post->zbsc_county;
    $postcode = $post->zbsc_postcode;
    }

    $html = str_replace(‘###COUNTRY###’,$city,$html);
    $html = str_replace(‘###CITY###’,$city,$html);

    Plugin Author woodyhayday

    (@woodyhayday)

    Hey – very inventive.

    Great you solved yourself, thanks. In the mid-term we’ll be updating the other database objects to make total sense with the main contact objects (we’re mid moving this from CPT to custom db), so this will stop working then – but it’ll be an easy fix when that comes around.

    Thanks for sharing!

    Woody

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how can I get in the code the identifier of the quote and address of customer ?’ is closed to new replies.