Okay
  Public Ticket #3103616
Shortcodes for making a distance selling contract
Closed

Comments

  •  9
    karaca11 started the conversation

    Dear Manager; I need the following shortcodes to make a distance sales contract. I hope you will be helpful, best regards.

    Marketplace Vendor(s) Name Surname
    Marketplace Vendor(s) Company Name
    Marketplace Vendor(s) Address
    Marketplace Vendor(s) Phone
    Marketplace Vendor(s) Email

    Orderer Name Surname
    Ordering Phone
    Ordering E-Mail
    Ordering Company Name (if any):(post=22839)
    Ordering Company Group (b2bking_group)
    Ordering delivery address
    Orderer billing address
    Orderer Payment Method
    Order date
    Website

    Purchased Product/s
    Amount of Product/s Purchased
    Purchased Product/s Total Price

  •  2,218
    WebWizards replied

    Hi there,

    Can you give us more details about how you are creating this contract? Are you using a plugin?

    Can you use PHP code? or only shortcodes?

    Do you have an $order_id variable you can use? or how can the shortcode know which order it is.


    Kind regards,

    Stefan

  •  9
    karaca11 replied

    Hi there,

    I am not using a plugin for Distance Selling Agreement. I want to enter variables manually. If you have a different method suggestion, I would like to consider it. The link is attached;

    https://guvenlikkd.com/mesafeli-satis-sozlesmesi/


    Kind regards


  •  2,218
    WebWizards replied

    You can set those directly in PHP with the following functions and code:

    ////////
    $order_id = 123;
    ////////
    $order = wc_get_order($order_id);
    $customer_id = $order->get_customer_id();
    $vendor_id = marketking()->get_order_vendor($order_id);
    $userdata = get_userdata($vendor_id);
    // Marketplace Vendor(s) Name Surname
    $name = $userdata->first_name.' '.$userdata->last_name;
    // Marketplace Vendor(s) Company Name
    $company = get_user_meta($vendor_id,'billing_company', true);
    // Marketplace Vendor(s) Address
    $address = get_user_meta($vendor_id,'billing_address_1', true);
    // Marketplace Vendor(s) Phone
    $phone = get_user_meta($vendor_id,'billing_phone', true);
    // Marketplace Vendor(s) Email
    $email = $userdata->user_email;
    // Orderer Name Surname
    $name = $order->get_billing_last_name().' '.$order->get_billing_first_name();
    // Ordering Phone
    $phone = $order->get_billing_phone();
    // Ordering E-Mail
    $email = $order->get_billing_email();
    // Ordering Company Name (if any):(post=22839)
    $company = $order->get_billing_company();
    // Ordering Company Group (b2bking_group)
    $group_name = get_the_title(get_user_meta($customer_id,'b2bking_customergroup', true));
    // Ordering delivery address
    $address = $order->get_shipping_address_1().' '.$order->get_shipping_address_2();
    // Orderer billing address
    $address = $order->get_billing_address_1().' '.$order->get_billing_address_2();
    // Orderer Payment Method
    $method = $order->get_payment_method();
    // Order date
    $date = $order->get_date_created();
    // Website
    /* Not clear what this is - isn't the site https://guvenlikkd.com/ ? */
    // Purchased Product/s
    $order_items = $order->get_items();
    // Amount of Product/s Purchased
    $total_quantity = 0; // Initializing
    foreach ( $order->get_items() as $item_id => $item ) {
        $total_quantity += $item->get_quantity();
    }
    // Purchased Product/s Total Price
    $total = $order->get_total();
    

    The only thing that is needed is that you need the $order_id variable first. Everything else starts from the order_id variable. Above I set it to 123 which is just an example.