Add a column to Sales View in Backend

  • Posts: 1
  • Thank you received: 0
12 years 5 months ago #53045

I am looking for a way to add a users last name to the sales view in the backend. I do not use user registration, so I am trying to pull the users shipping last name in the backend. Customers call up all the time, and they usually don't have their invoice number.

I tried editing the sales view file in the views menu

Even when I fully deleted that file, the sales view was unchanged. How can I add a column to the sales view in the backend?

Thanks!
Jesse
RageHats.com

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

  • Posts: 13201
  • Thank you received: 2322
12 years 5 months ago #53132

Hi RageHats,

You can d oit by editing the view order / listing.php in HikaShop > Display > Views.

Then add:

$address_id = $row->order_shipping_address_id;
$fieldClass = hikashop_get('class.field');
$addressClass = hikashop_get('class.address');
$order->fields = $fieldClass->getData('backend','address');
if(!empty($address_id)){
	$order->name=$addressClass->get($address_id);
}

After:
$target = '';
if($this->popup)
	$target = '" target="_top';
$k = 0;
for($i = 0,$a = count($this->rows);$i<$a;$i++){
	$row =& $this->rows[$i];

And add a column with the value:
<?php echo $order->name->address_lastname; ?>

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #66533

how I can replace the column "method of payment" for "product code" and that at the top:


echo $ this-> payment-> display ("filter_payment", $ this-> PageInfo-> filter-> filter_payment, false);


To output the filter by "Product Code" instead of "payment method".

thanks

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 months ago #66566

Hi dvddvd,

Can you explain in more details what you need ?

A sale have many products, so we can't add a filter on the product code in the listing of the sales.

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #66603

Sorry, in my case only allows one product per order

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 months ago #66609

Ok so in your case, you can edit the file: "yourSite/administrator/components/com_hikashop/views/order/show.html.php

And add the line:

$tables = ' INNER JOIN '.hikashop_table('order_product').' AS d ON b.order_id = d.order_id';
Just before:
$query = ' FROM '.hikashop_table('order').' AS b LEFT JOIN '.hikashop_table('user').' AS a ON b.order_user_id=a.user_id LEFT JOIN '.hikashop_table('users',false).' AS c ON a.user_cms_id=c.id '.$tables.$filters.$order;

Then in HikaShop > Display > Views, edit the view "order / listing"
And replace the title "Payment method" by "Product code", and replace:
						<?php if(!empty($row->order_payment_method)){
							if(!empty($this->payments[$row->order_payment_method])){
								echo $this->payments[$row->order_payment_method]->payment_name;
							}else{
								echo $row->order_payment_method;
							}
						} ?>
By:
<?php echo $row->order_product_code; ?>

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #66633

Hello Xavier thank you very much for your help

I made ​​the following changes

1) add the following code:

$tables = ' INNER JOIN '.hikashop_table('order_product').' AS d ON b.order_id = d.order_id';


Just before of:
$query = ' FROM '.hikashop_table('order').' AS b LEFT JOIN '.hikashop_table('user').' AS a ON b.order_user_id=a.user_id LEFT JOIN '.hikashop_table('users',false).' AS c ON a.user_cms_id=c.id '.$tables.$filters.$order;

Being the "/ administrator / components / com_hikashop / views / order / view.html.php" so:
code removed by the administrator.
Please do not paste entire files here

and also by changing the title and replacing the code that you show me, being so "listing.php"
code removed by the administrator.
Please do not paste entire files here

But I only get the code column empty and the upper flange as before.



Thanks

Last edit: 12 years 2 months ago by dvddvd.

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #66643

Sorry for paste entire files.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 months ago #66644

Oh I forgot one thing, , you need to add ",d.*" like this:

$database->setQuery('SELECT a.*,b.*,c.*,d.*'.$query,(int)$pageInfo->limit->start,(int)$pageInfo->limit->value);
in the file: "yourSite/administrator/components/com_hikashop/views/order/view.html.php and in the function listing().

Add "d.order_product_code" in the searchmap:
$searchMap = array('c.id','c.username','c.name','a.user_email','b.order_user_id','b.order_number','b.order_id','b.order_full_price','d.order_product_code');

And then you can filter by product code in the filter field on the left.

Last edit: 12 years 2 months ago by Xavier.

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #66658

thank you very much now all right !!!!

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

  • Posts: 267
  • Thank you received: 5
12 years 2 months ago #67111

Hello again,

I'm trying to replace the 'id column' by 'telephone', following the steps you've RageHats indicated earlier in this post, but I just get the blank column.

thnaks

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 months ago #67137

Hi dvddvd,

You need to display "echo $order->name->address_telephone;" instead of "echo $order->name->address_lastname" like I said to RageHats.

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
12 years 2 months ago #67143

ok operates correctly. Thank you very much

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

  • Posts: 267
  • Thank you received: 5
11 years 3 months ago #120712

Hello Xavier,
We use HikaShop for university courses. We deleted all the orders last year and since then, the field added to order / listing is blank.
I was using "echo $ order-> name-> address_telephone;?".
What is the new command I use to take that data table address and field address_telephone ?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
11 years 3 months ago #120716

It's still the same.
Are you sure that it's not because the address_telephone has been unpublished or something like that ?

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
11 years 2 months ago #120731

Thanks Xavier. I see that to enlist new orders from the administration and assign a customer, goes blank the form to the right which is where the data takes. Because if I put the phone there, if it appears

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
11 years 2 months ago #120736

I'm not following you. Could you maybe give more information on the problem ? Maybe screenshots ?

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

  • Posts: 267
  • Thank you received: 5
11 years 2 months ago #120743



In the screenshot I show you what I mean:

1. - I have assigned the customer Dulce Pascual.
2. - Load data into Student form
3. - Form STUDENT DATA - Billing, left blank

I think in this last form, in the field where it takes the data phone address_telephone.

So I do not go out, to call it from <td class="hikashop_order_id_value">
             <? php echo $ order-> name-> address_telephone;?>
           </ td>

Attachments:
Last edit: 11 years 2 months ago by dvddvd.

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

  • Posts: 267
  • Thank you received: 5
11 years 2 months ago #120753

I only needed to change $ address_id = $ row-> order_shipping_address_id, for $ address_id = $ row-> order_billing_address_id, in <? php
         $ target ='';
         if ($ this-> popup)
           $ target = "" target = "_top";
         $ k = 0;
         for ($ i = 0, $ a = count ($ this-> rows); $ i <$ a, $ i + +) {
           $ row = & $ this-> rows [$ i];
        $ address_id = $ row-> order_billing_address_id;
        $ fieldClass = hikashop_get ('class.field');
        $ AddressClass = hikashop_get ('class.address');
        $ order-> fields = $ fieldClass-> getData ('backend', 'address');
        if (! empty ($ address_id)) {
        $ order-> name = $ AddressClass-> get ($ address_id);
        }
       ?>

Thank very much Xavier

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

  • Posts: 267
  • Thank you received: 5
9 years 9 months ago #188640

Hi Xavier,
I just upgrade to HikaShop bussiness. This modification we do not work anymore.
In the country where the product code was to appear, is now blank.
It could appear again in the updated version of the product code in this field.
Thank You

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

Time to create page: 0.116 seconds
Powered by Kunena Forum