Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OsCommerce Variable List


graphicore

Recommended Posts

Does anyone knows where I can get a list of the variables used on OsCommerce???

 

I am getting tired of trying to install without success the Downloads_Controller. Too many problems with the latest upload and the latest one made by the original developer is crowded with extra not needed crap.

 

So I just need to add a line of code to the download.php so the download link does not get activated unless the order status has passed processing.

 

Something like:

 

// Die if time expired (maxdays = 0 means no time limit)

if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) die;

// Die if remaining count is <=0

if ($downloads['download_count'] <= 0) die;

// Die if file is not there

if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die;

// Link desactivated if not approved.

if ($order_status <= 1) die;

 

 

But because I do not know PHP programming (While I can figure out things) I still need to know which is the variable for the order status.

 

Can anyone help here?

Link to comment
Share on other sites

hello mate,

 

i'm not quite sure what you're looking for but the $order_status variable is sitting in:

 

orders.php file which is located around /includes/classes/order.php

 

 

 

i hope that helps.

 

leo

Link to comment
Share on other sites

hello mate,

 

i'm not quite sure what you're looking for but the $order_status variable is sitting in:

 

orders.php file which is located around /includes/classes/order.php

i hope that helps.

 

leo

 

Thanks for the reply... but actually I want to modify this line of code on the download.php:

 

if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {

 

The code is missing another && condition which is IF status_id is >1.... I just do not know what is the variable to be added into this code to make the link DISABLE if the status is not above pending, neither do know the php syntax.

 

I just wish some of the developers where around just to fix this simple line of code. (So noone has to deal with the Downloads_Controller Crappy Code)

Link to comment
Share on other sites

I've done something similar to a site of mine. It's a little different in that I have both free and paid downloads, but the idea should be similar for you - actually probably a little simpler. The downloads.php file checks the order and if it's either paid or complete (id #2 or #3) or the file is free then the link is wrapped in an <a href tag. Otherwise it's just output without the link so it cannot be downloaded.

 

I don't remember if I changed this or not, but this query needs to include o.status so if yours doesn't, add it to the query.

// Now get all downloadable products in that order
 $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays, o.orders_status, op.products_price from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");
 if (tep_db_num_rows($downloads_query) > 0) {

 

This is a modification of the code that creates the link if there are still downloads remaining. I just added the final (order_status>1 || products_price==0) part to catch those that I needed.

if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) && ($downloads['orders_status']>1 || $downloads['products_price']==0) ) {
	echo '			<td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "\n";
  } else {
	echo '			<td class="main">' . $downloads['products_name'] . '</td>' . "\n";
  }

Link to comment
Share on other sites

I've done something similar to a site of mine. It's a little different in that I have both free and paid downloads, but the idea should be similar for you - actually probably a little simpler. The downloads.php file checks the order and if it's either paid or complete (id #2 or #3) or the file is free then the link is wrapped in an <a href tag. Otherwise it's just output without the link so it cannot be downloaded.

 

I don't remember if I changed this or not, but this query needs to include o.status so if yours doesn't, add it to the query.

// Now get all downloadable products in that order
 $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays, o.orders_status, op.products_price from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");
 if (tep_db_num_rows($downloads_query) > 0) {

 

This is a modification of the code that creates the link if there are still downloads remaining. I just added the final (order_status>1 || products_price==0) part to catch those that I needed.

if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) && ($downloads['orders_status']>1 || $downloads['products_price']==0) ) {
	echo '			<td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "\n";
  } else {
	echo '			<td class="main">' . $downloads['products_name'] . '</td>' . "\n";
  }

 

PERFECT!!!!

Thanks....

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...