Okay
  Public Ticket #3718111
Logo in PDF B2BKing for WCFM
Closed

Comments

  •   Eduardo started the conversation
  •   Eduardo replied privately
  •  2,281
    WebWizards replied

    Hello Eduardo,

    (1) Regarding the logo change, I'm afraid the B2BKing for WCFM add-on does not have this feature directly. 

    I looked into it to see what is possible with custom coding. The way this works is that the PDF generation script searches for a general Logo Image:

    <img id="b2bking_img_logo" class="b2bking_hidden_img" src="<?php echo get_option('b2bking_offers_logo_setting','');?>">
    

    This is a global logo (for all offers). Therefore the only way I see to make it work is the following:

    - A custom script would need to run when the "download pdf" button is clicked for an offer, and change the "src" property of this #b2bking_img_logo image to the src logo of each vendor.

    This is quite complex I'm afraid as it requires work on several thing: displaying a hidden logo for each vendor on the offers page, and then a custom script must make that image change when the download button is used. 


    (2) 

    Regarding:

    1. Change the title to "Cotización".
    2. Include the following vendor details in the document:
      • Vendor Name
      • RUT (custom field)
      • Address
      • Email
      • Phone Number

    By title, do you mean the name of the file? ('offer.pdf' to 'cotizacion.pdf')?


    For the rest of this (name, address, email, phone etc), there are currently snippets to add a custom field to offers PDFs: https://woocommerce-b2b-plugin.com/docs/offers-2/#7-toc-title 

    I believe I can extend these hooks to add a $offerId/$vendorId parameter so that you can use these hooks separately for each vendor / offer. For this, please let me get back to you shortly, as a plugin update has to be made first.


    Kind regards,

    Stefan

  •   Eduardo replied privately
  •  2,281
    WebWizards replied

    Thank you for clarifying,

    -> To change the file name, you can add this snippet to the site:

    add_filter('b2bking_offer_file_name', function($name){
        return 'cotizacion';
    }, 10, 1);
    

    -> Normally these PDF files do not have a center title. You can add a top center text, with this snippet:

    add_filter('b2bking_custom_content_offer_pdf_center_1', function($val){
        return 'Oferta / Cotizacion';
    }, 10, 1);
    

    It will add:

    2024553124.png



    -> For the other values, I made an update to B2BKing Pro on your site. I then added a snippet here to add those:

    https://mercadoproveedor.cl/wp-admin/admin.php?page=edit-snippet&id=33

    I believe this is working as I now see those values displayed:

    7595798026.png



  •   Eduardo replied privately
  • Brittney Garcia replied

    I am trying to customize the header of my Offer PDFs similar to this. Where does the code snippet get added to make it generate the way you have it with info in the top left

  •  2,281
    WebWizards replied

    Hello Brittney,

    To add something to the top left area, you can use the following snippet:

    add_filter('b2bking_custom_content_offer_pdf_left_1', function($val){
        return 'Oferta / Cotizacion';
    }, 10, 1);

    The code snippet can be added to functions.php (of the child theme), or just to any code snippets plugin - we have a guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/