cancel
Showing results for 
Search instead for 
Did you mean: 

Sales order: add custom value

Sales order: add custom value

we have 3 stores based in one Magento2.2.1 installation, each store uses own theme but admin part and theme is common.

We need to see some custom value (carrier pickup point) in Sales Order, so we have add this block into vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml

 

<address class="admin__page-section-item-content"><?php /* @escapeNotVerified */ echo $block->getFormattedAddress($_order->getShippingAddress()); ?>
                            <?php if($carrierDepartment): ?>
                                    <br/><?php /* @escapeNotVerified */ echo __('Carrier Department'); ?>:
                                    <?php echo $carrierDepartment; ?>
                            <?php endif; ?>
                            </address>

the problem is that this value reflects only in Sales Order, which has been made in one store (first one). Could you pls advice how to make it transferred into all stores?

7 REPLIES 7

Re: Sales order: add custom value

Hello @rsulym

 

file is use same for all website.

 

Can you please check thing

1) is that value exists for that order check into DB.( as i see you added if condition)

2) enable hint path from admin and check which file is called.

 

Hope it will work for you.

 

If works then give kudos or mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Sales order: add custom value

Hi, thanks your help!

1) Yes, value is present in DB

2) I have enabled hints, but i'm not developer, i cannot understand how it should help me? could you pls give me some tips? Thanks in advance!

Re: Sales order: add custom value

Hello @rsulym

 

https://magecomp.com/blog/enable-template-path-hints-in-magento-2/

 

you need to enable hint path for admin.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Sales order: add custom value

yes i got it, i know how to do that, but i did not see how it should help me?

Re: Sales order: add custom value

Try one more thing

 

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();$order = $objectManager->create('\Magento\Sales\Model\Order')
                           ->load($this->getReuest()->getParam('order_id'));
$carrierDepartment = $order->getData('carrier_department'); // check this attribute name

Let me know if still any issue


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Sales order: add custom value

Sorry Teamviewer going to timeout every 5 mins.

 

I don't know why you are checking quote_address.

 

You need to move quote_address to sales_order_address when order is place.

 

then after you can able to get value.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Sales order: add custom value

Hi, most probably you right, but only quote_address have carrier_department field, which is used in SO page. Again, i'm not the one who wrote this module nor modify SO page, i don't know why it's done this way.

I thing right approach is to hire developer who will do this right way)

Anyway, many thanks for your support!