Jump to content

how to add the customer messages in the delivery slip


Freddykhoury

Recommended Posts

@Freddykhoury

The address is generate from this class /1.7.7.0/classes/AddressFormat.php. line 440 , you will notice i have print the first name and last name text in the invoice.

You need to check the condition what you like in this function and show first name and lass name if billing address is missing.

    public static function generateAddress(Address $address, $patternRules = [], $newLine = self::FORMAT_NEW_LINE, $separator = ' ', $style = [])
    {
        $addressFields = AddressFormat::getOrderedAddressFields($address->id_country);
        $addressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($address, $addressFields);

        $addressText = '';
        foreach ($addressFields as $line) {
            if (($patternsList = preg_split(self::_CLEANING_REGEX_, $line, -1, PREG_SPLIT_NO_EMPTY))) {
                $tmpText = '';
                foreach ($patternsList as $pattern) {
                    if ((!array_key_exists('avoid', $patternRules)) ||
                                (is_array($patternRules) && array_key_exists('avoid', $patternRules) && !in_array($pattern, $patternRules['avoid']))) {
                        $tmpText .= (isset($addressFormatedValues[$pattern]) && !empty($addressFormatedValues[$pattern])) ?
                                (((isset($style[$pattern])) ?
                                    (sprintf($style[$pattern], $addressFormatedValues[$pattern])) :
                                    $addressFormatedValues[$pattern]) . $separator) : '';
                    }
                }
                $tmpText = trim($tmpText);
                $addressText .= (!empty($tmpText)) ? $tmpText . $newLine : '';
            }
        }

        $addressText = preg_replace('/' . preg_quote($newLine, '/') . '$/i', '', $addressText);
        $addressText = rtrim($addressText, $separator);

        return "this is first name and last name";
        return $addressText;
    }

 

Thank you

Link to comment
Share on other sites

I just discussed with the team and they need the customer name in both cases, so no conditon to display this info.

I have to display the first name and last name on top of the page above the addresses even if there is a billing address

Thank you for your quick response

Link to comment
Share on other sites

  • 3 years later...
On 8/12/2021 at 7:05 PM, Freddykhoury said:

Thank you 

it worked like a charm

I have another request :)

i need to add the user first name and last name in the delivery slip if there is no billing address 

thank you 

 

Were you able to add the order messages in the delivery slip? Can you tell me how you did it? Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...