Adding Print Label Button in Admin Orders

  • Posts: 15
  • Thank you received: 0
9 years 3 months ago #210329

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.1
-- PHP version -- : 5.4
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : No error, I need to get a print label button and functionality on the backend in the admin for each order.

Hi,

What's the best way to approach this?
I want to add a "Print Label" button for each order. That button will link to the shipping provider etc etc. I really need to know how to access those sections in the back end.
So maybe when the admin clicks on an order in the backend configuration->order lists. Maybe on the order information display, there will be a "Print Label" button at the top or bottom somewhere.

What's the best way to do this or similar? What functions etc can I use and how do I access those areas?

Thank you so much.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #210346

Hi,

You can edit the file "show" of the view "order" for your backend template via the menu Display>Views.
There you can add your label code at the top of the file and it will display on the order details page in the backend.

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
9 years 3 months ago #210401

Thank you Nicolas,
This is exactly what I needed.

Please Log in or Create an account to join the conversation.

  • Posts: 267
  • Thank you received: 5
4 years 6 months ago #318259

Hi Nicolas,

What could be the shipping label code to add:
Name, Surname, Address with postal code, city, region and country
Telephone and order number.


Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 6 months ago #318270

Hi,

I'm sorry but I don't understand what is your question here ?

Please Log in or Create an account to join the conversation.

  • Posts: 267
  • Thank you received: 5
4 years 6 months ago #318318

Hi Nicolas,
I thought that it is useful for me to print together with the shipping invoice, one more page with the shipping address, adding the following code at the end of the order / invoice view:

_________________________________________________
<div style="page-break-before:always">
<?php if(!empty($this->element->order_shipping_id) && !empty($this->element->shipping_address)){
?>
<fieldset class="adminform" id="htmlfieldset_shipping">
<legend style="background-color: #FFFFFF;"><?php echo JText::_('HIKASHOP_SHIPPING_ADDRESS'); ?></legend>
<?php
if(empty($this->element->override_shipping_address)) {
$addressClass = hikashop_get('class.address');
echo $addressClass->displayAddress($this->element->fields, $this->element->shipping_address, 'order');
} else {
echo $this->element->override_shipping_address;
}
?>
</fieldset>
<?php
}
?></div>
_________________________________________________

But I get both invoice and invoice shipping, also I would like the CIF field and the phone field not to appear.

How can I do it?

Thank you

Attachments:
Last edit: 4 years 6 months ago by dvddvd.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 6 months ago #318327

Hi,

To do it only for the shipping invoice you could add such line before your code:

<?php if($this->invoice_type=='full') return; ?>

If you want to remove some fields from the address display, you can change the "address format" setting of the HikaShop configuration.
Note that this will affect both your code and the address display on the checkout, order and invoice too.
If you want it to affect only your code, you would have to not call displayAddress and directly echo the data of the address from $this->element->shipping_address. For example:
echo $this->element->shipping_address->address_city;

The following user(s) said Thank You: dvddvd

Please Log in or Create an account to join the conversation.

  • Posts: 267
  • Thank you received: 5
4 years 6 months ago #318480

Thanks Nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum