Hi ropu-

This question relates to a workaround to the current lack support for instant downloads. Regards to the script you provided to test if a product is a virtual product, and if it is then print a warning message on the product description page.

I can see your code works fine on the login and shopping cart pages. That is, when a non-physical product is added to the shopping cart, then a message "Some download products in your cart are currently not available via Google Checkout" displays below the disabled Google Checkout button.

Have you had an opportunity to test the code you provided on tpl_product_info_display.php?

Unfortunately I cannot get it to work. It appears the script is tied to the contents of the shopping cart session? (e.g. ['cart']) which does not apply to what I'm attempting to do. I've attempted to adapt your code for my described purpose but so far have been unsuccessful.

Here again is what I'm trying to do:
1. View product_info_display page for a specific product.
2. Display a warning message if product is a download product.

I see three files are of concern here:
1. a template file (tpl_product_info_display.php) which calls an include;
2. an include which first loads application_top;
3. a class file with a function;

And the 'products' table contains two relevant columns: 'products_id' and 'products_virtual'

So I created my own includes and class files below. But I'm havnig some issues as described below. Could you please take a look to see if the ideas should work.

The function gets the value of 'products_virtual' for a specific 'products_id'. If it contains a "1" then "virtual" should be returned. Otherwise return "physical".

I think my problem is passing the 'products_id' (for the product description page which is currently displayed) from the template file to the includes file and to the class/function. And then how do I return the value evaluated by the class/function file back to the includes and template files?

1. Template: /includes/templates/MY_TEMPLATE/templates/tpl_product_info_display.php
Insert this code snippet somewhere:
PHP Code:
<?php
include('download_type_include_for_gc.php');

$download_type $_GET['products_id']->get_download_type(); 

if ( 
MODULE_PAYMENT_GOOGLECHECKOUT_VIRTUAL_GOODS == 'True' && $download_type != 'physical' ) {
    echo 
'<p class="productGeneral">This download product is currently not available via Google Checkout. However it is available through regular shopping cart checkout.</p><br />';
      }
?>
2. Includes: file /download_type_include_for_gc.php
PHP Code:
<?php
/*
 * download_type_include_for_gc.php
 * to display download_type on product description pages for Google Checkout
 *
 */

include_once('includes/application_top.php');
//print_r($_GET['products_id']->get_download_type());

?>
3. Class/function: /includes/classes/get_download_type.php
PHP Code:
<?php
/**
 * get_download_type.php class
 */

class get_download_type {

    function 
get_download_type() {
        global 
$db;
    
        
$download_check $db->Execute("select products_virtual 
                    from " 
TABLE_PRODUCTS 
                    where products_id = '" 
zen_get_prid($products_id) . "'");
    
        if (
$download_check->fields['products_virtual'] == '1') {
            
$this->download_type 'virtual';
                } else {
            
$this->download_type 'physical';
            } 
    
        return 
$this->download_type;
    }
}
?>
However the product description page stops rendering when arriving at the template snippet code above.
Error in error log is:

[error] [error] PHP Fatal error: Call to a member function get_download_type() on a non-object in /home/MY_ACCOUNT/public_html/MY_SHOP/includes/templates/MY_TEMPLATE/templates/tpl_product_info_display.php on line 134
What to I do to make it "unknown"? Do I have to register the class file or something special? Or do I put the class file in a special directory?

Or is there something wrng with this:
PHP Code:
$_GET['products_id']->get_download_type() 
Am I getting close or am I completely off on a wrong roller coaster track?

Thanks for any pointers,
Woody