Add customer's Company Name to Orders view

  • Posts: 17
  • Thank you received: 0
8 years 6 months ago #240364

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5.34

I would like to add the Customer's company name to the Orders view, either by:

  • Adding it above the customer name in the customer column
  • Or adding the company name as a separate column
Whichever is easier. I tried adding the company name above the customer name (see 1st screenshot)by going to order > listing.php around line 140:
<td class="hikashop_order_customer_value">
						ECHO COMPANY NAME HERE
						<?php
						 echo $row->hikashop_name;
						 if(!empty($row->username)){
						 	echo ' ( '.$row->username.' )';
						 }
						 echo '<br/>';
						 if(!empty($row->user_id)){
							 $url = hikashop_completeLink('user&task=edit&cid[]='.$row->user_id);
							 $config =& hikashop_config();
							 if(hikashop_isAllowed($config->get('acl_user_manage','all'))) echo $row->user_email.'<a href="'.$url.$target.'"><img src="'.HIKASHOP_IMAGES.'edit.png" alt="edit"/></a>';
						 }elseif(!empty($row->user_email)){
						 	echo $row->user_email;
						 }
						 ?>
					</td>

Using the custom field parameter address_company (see 2nd screenshot) but I don't think I had the correct syntax. Also I don't know if this would make the column sortable by the company name.

If that's too complicated to do, how can I override the layout for order/listing.php to simply include a separate column for the company name? Is there a similar example I can refer to (I've searched but haven't found one yet) and is address_company the correct parameter to call?

Thank you for your assistance!

Attachments:

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 6 months ago #240367

Hi,

It should be quite easy to add. Try with that code:
<?php echo $row->address_company; ?>

The following user(s) said Thank You: thirdhatch

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

  • Posts: 17
  • Thank you received: 0
8 years 6 months ago #240499

Thank you for the quick response Nicolas!

It should be quite easy to add. Try with that code:
<?php echo $row->address_company; ?>


This is what I originally added. this but the company name does not display. :(

I tried both
<td class="hikashop_order_customer_value">
	<?php echo $row->address_company; ?>
	<?php
	 echo $row->hikashop_name;
	 if(!empty($row->username)){
	 	echo ' ( '.$row->username.' )';
	 }
	 echo '<br/>';
	 if(!empty($row->user_id)){
		 $url = hikashop_completeLink('user&task=edit&cid[]='.$row->user_id);
		 $config =& hikashop_config();
		 if(hikashop_isAllowed($config->get('acl_user_manage','all'))) echo $row->user_email.'<a href="'.$url.$target.'"><img src="'.HIKASHOP_IMAGES.'edit.png" alt="edit"/></a>';
	 }elseif(!empty($row->user_email)){
	 	echo $row->user_email;
	 }
	 ?>
</td>
and
<td class="hikashop_order_customer_value">
	<?php echo $row->address_company; 
	 echo $row->hikashop_name;
	 if(!empty($row->username)){
	 	echo ' ( '.$row->username.' )';
	 }
	 echo '<br/>';
	 if(!empty($row->user_id)){
		 $url = hikashop_completeLink('user&task=edit&cid[]='.$row->user_id);
		 $config =& hikashop_config();
		 if(hikashop_isAllowed($config->get('acl_user_manage','all'))) echo $row->user_email.'<a href="'.$url.$target.'"><img src="'.HIKASHOP_IMAGES.'edit.png" alt="edit"/></a>';
	 }elseif(!empty($row->user_email)){
	 	echo $row->user_email;
	 }
	 ?>
</td>
Any thoughts on why the address_company is not being displayed?

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 6 months ago #240512

Hi,

Then it might be because you have an old version of HikaShop.
I think that we've added the loading of the billing address data in $row only in recent versions of HikaShop.
So updating should make it work, at least it works on my end and I don't see any other reason why it wouldn't.

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

  • Posts: 17
  • Thank you received: 0
8 years 6 months ago #240996

I think that we've added the loading of the billing address data in $row only in recent versions of HikaShop.

Can you please confirm with certainty that these changes were added to Hikashop Business between v2.4.0 and v2.6.3? I don't want to purchase a new version of Hikashop if this is not the case. Thanks!

Last edit: 8 years 6 months ago by thirdhatch.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 6 months ago #241009

Hi,

I confirm that this was added later and that the code I gave earlier is working with recent versions of HikaShop (I(ve just tested it myself).

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

Time to create page: 0.064 seconds
Powered by Kunena Forum