Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add download filename to admin orders


14steve14

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

Link to comment
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.

Link to comment
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.

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...