Jump to content
14steve14

Add download filename to admin orders

Recommended Posts

My current live store is using a version of Edge so it's old and due an update, but a customer brought up a good comment about the description and name of download files in the orders section or the invoice. He was having problems downloading files and remembering which ones he had done. All he could find was a written description and not the actual file name. The model number is close, but that model is the same for different scale downloads, which does not really help him.

Is there away of adding the download file name to the  page somehow that could later be transferred to a Phoenix site. See image below for where to add file name.

I hope this sort of makes sense.

 

add-in.jpg


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Note, I refer to Phoenix but older Frozen etc should be similar.

That data is not grabbed by the Class; https://github.com/gburton/CE-Phoenix/blob/master/admin/includes/classes/order.php#L121-L124

The available data is option, value, prefix, price.  That data comes from orders_products_attributes, so we look at that DB table to see if the download is stored there; https://github.com/gburton/CE-Phoenix/blob/master/install/phoenix.sql#L393-L403

It is not stored.  It is stored in orders_products_download; https://github.com/gburton/CE-Phoenix/blob/master/install/phoenix.sql#L406

Therefore...you need to join the two tables

  • orders_products_attributes
  • orders_products_download

You have an available join, orders_id.  You therefore have to (in Frozen) manipulate the SQL in the class file; https://github.com/gburton/CE-Phoenix/blob/master/admin/includes/classes/order.php#L118 to join those two tables and then output the filename in the array.  Then manipulate invoice.php to output that extra piece of data.   No other way around it. 

Same for Phoenix, but in Phoenix...there is a new different option;

You could Hook into the invoice and show the download details at the bottom of the invoice, using this Hook https://github.com/gburton/CE-Phoenix/blob/master/admin/invoice.php#L106 in a nice table, you could even show how many times customer downloaded it etc.


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites
20 minutes ago, burt said:

You have an available join, orders_id.  You therefore have to (in Frozen) manipulate the SQL in the class file; https://github.com/gburton/CE-Phoenix/blob/master/admin/includes/classes/order.php#L118 to join those two tables and then output the filename in the array.  Then manipulate invoice.php to output that extra piece of data.   No other way around it.

I think that we should put the orders_products_id in the products array in the order.  Then it wouldn't be necessary to override the order file for this customization or redo the orders_products part of the query.  It could just load the data for the downloads directly and add it to the order object. 

SELECT * FROM orders_products_download WHERE orders_id = 
while ($download = tep_db_fetch_array($downloads_query)) {
  foreach ($order->products as &$product) {
    if ($download['orders_products_id'] === $product['orders_products_id']) {
      $product['download_filename'] = $download['orders_products_filename'];
    }
  }
  unset($product);
}

And that could be done in a hook with no core modification (other than the one that we'd make to pull in the orders_products_id). 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@burt @ecartz Thanks for the help but you may as well be speaking with forked tongue. I think its something that will be put on the list of things to do when the new site is uploaded in the next few months. I can then look into this again, so sorry Gary its on the to-do list that may be aiming your way one day.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
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

×