Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Can anyone tell me the difference between QTPro & Master Products and which is the best one to use for handling attribute stock?

Thank you..

They are completely different things - which can complement each other.

 

master products allows you to show products, as sub-products on a products page - nothing else.

qtpro allows you to add stock control of options to a product (not the same as sub-products! - you should know options already - as they are in the base OSC)

Share this post


Link to post
Share on other sites
Hi,

 

Have an odd error, I can't see could ever have worked -but I can't figure out to fix it either.. hope you could shed some light on it..

 

PHP Parse error:  parse error, unexpected T_ELSE in /www/customers/linuxpusher2/html/checkout_process.php on line 251

 

and my line 251 looks like this (it's the one with --line251--> in the beginning :)

 

 

Ugh. That's ugly. :'( Its missing line terminators all over the place but not all of them. Weird. Makes it hard to read. Not only that you've go a couple of curly braces missing. The opening brace ({) on the middle line below.

        $all_nonstocked = false;
       }
       if ($all_nonstocked) {

 

And a closing brace (}) is missing at the beginning of your marked line 251. Assuming that the line terminators are OK on your system then adding back in the curly braces should fix it. If it doesn't fix it run a compare program against the original QT Pro source to see what else is mangled.

Share this post


Link to post
Share on other sites

Hopefully someone can point me in the right direction to correct an error - I installed QT Pro over a fresh 2.2 MS2 install. No problem. But when I add new products and then go to the actual product page, the graphic is loading on the left side right on top of the description - the original test products are still formatted correctly. I'm sure it's something simple but I have no idea where to look - thanks for any help.

Share this post


Link to post
Share on other sites
Hopefully someone can point me in the right direction to correct an error - I installed QT Pro over a fresh 2.2 MS2 install.  No problem.  But when I add new products and then go to the actual product page, the graphic is loading on the left side right on top of the description - the original test products are still formatted correctly.  I'm sure it's something simple but I have no idea where to look - thanks for any help.

 

That's a bug in QT Pro 4. See this post for the fix:

 

http://forums.oscommerce.com/index.php?sho...ndpost&p=504873

Share this post


Link to post
Share on other sites
Ugh.  That's ugly.  :'(  [sNIP]

OOPS (thought it worked).

 

I copy'pasted from qtpro4 - but it still complains on the exact same line - so something must be up.. I've put the file here: http://vsen.dk/files/checkout_process.php.txt

it's line 251 as before :(

 

I hope to get my shop ready soon - then I'll start on looking at writing other options, than the "drop-down" - so qtpro4 can be made to support the same as the "option type feature" enables (which does not support qtpro4).

 

If anyone succeedes in adding another "option type" for qtpro (which seems much easier - using Ralph's clever plugin design) I would very much like it if you'd share the code.. with small "intro" how to merge with qtpro4.0.

Edited by fixion

Share this post


Link to post
Share on other sites

I couldn't find that this question has been asked.

But I have a product that has 2 attributes - size and color

If this product is green and only in sizes of xxl or xxxl and I also have this product in blue in sizes xl, xxl, and xxxl how would I get that to work when I do my stock? And when I do my stock it only allows be to select one attribute and color is not one of them.

Actually I had added the attributes for color and size and when I go to stock - it only shows size. If I delete the attributes for size it doesn't show color at all.

Share this post


Link to post
Share on other sites
I couldn't find that this question has been asked.

But I have a product that has 2 attributes - size and color

If this product is green and only in sizes of xxl or xxxl and I also have this product in blue in sizes xl, xxl, and xxxl how would I get that to work when I do my stock? And when I do my stock it only allows be to select one attribute and  color is not one of them.

Actually I had added the attributes for color and size and when I go to stock - it only shows size. If I delete the attributes for size it doesn't show color at all.

 

I think I figured it out. Sorry for posting - I though this may have been a bug...but I think I got it working!!!

:rolleyes:

Share this post


Link to post
Share on other sites

I just tried to simply replace my checkout_process.php with the one included in qtpro4.0 package - and it fails the exact same way. IE. it's a bug in the qtpro4.0 example :(

 

PHP Parse error: parse error, unexpected T_ELSE in /www/customers/linuxpusher2/html/checkout_process.php on line 199

 

(it's line 199 - because it's the original file - no longer my own file).

 

I use php-4.3.10.

 

Anyone have a checkout_process.php file that works for them? I'd like to see it, and compare it to the one in qtpro4.0.

Share this post


Link to post
Share on other sites

It seems I fixed it by adding a } right before this line:

// Update products_ordered (for bestsellers list)

 

I just hope that didn't "screw" with the logic :)

Share this post


Link to post
Share on other sites
It seems I fixed it by adding a } right before this line:

// Update products_ordered (for bestsellers list)

 

I just hope that didn't "screw" with the logic :)

Is this in addition to the } that QTPro 4 already adds at this spot in the code? Here's the working (just retested it) QT Pro 4 checkout_process.php:

 

<?php
/*
     QT Pro Version 4.0 modifications
    
     Copyright (c) 2004 Ralph Day
     Released under the GNU General Public License
 
     Based on prior works released under the GNU General Public License:
       QT Pro prior versions
         Ralph Day, October 2004
         Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman
         FREEZEHELL - 08/11/2003 freezehell@hotmail.com Copyright (c) 2003 IBWO
         Joseph Shain, January 2003
       osCommerce MS2
         Copyright (c) 2003 osCommerce
         
     Modifications made:
       11/2004 - Rename products_options column from special to products_options_track_stock
                 Allow attribute stock to go negative
                 Save products_stock_attributes in order to facilitate remove order & restock
                 Miscellaneous cleanup
 
********************************************************************************
***********

 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce
 
 Amended for Attributes Inventory - FREEZEHELL - 08/11/2003 freezehell@hotmail.com
 Copyright (c) 2003 IBWO


 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
 
 if (!tep_session_is_registered('sendto')) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
   if ($cart->cartID != $cartID) {
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
   }
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
                         'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
                         'customers_company' => $order->customer['company'],
                         'customers_street_address' => $order->customer['street_address'],
                         'customers_suburb' => $order->customer['suburb'],
                         'customers_city' => $order->customer['city'],
                         'customers_postcode' => $order->customer['postcode'], 
                         'customers_state' => $order->customer['state'], 
                         'customers_country' => $order->customer['country']['title'], 
                         'customers_telephone' => $order->customer['telephone'], 
                         'customers_email_address' => $order->customer['email_address'],
                         'customers_address_format_id' => $order->customer['format_id'], 
                         'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
                         'delivery_company' => $order->delivery['company'],
                         'delivery_street_address' => $order->delivery['street_address'], 
                         'delivery_suburb' => $order->delivery['suburb'], 
                         'delivery_city' => $order->delivery['city'], 
                         'delivery_postcode' => $order->delivery['postcode'], 
                         'delivery_state' => $order->delivery['state'], 
                         'delivery_country' => $order->delivery['country']['title'], 
                         'delivery_address_format_id' => $order->delivery['format_id'], 
                         'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
                         'billing_company' => $order->billing['company'],
                         'billing_street_address' => $order->billing['street_address'], 
                         'billing_suburb' => $order->billing['suburb'], 
                         'billing_city' => $order->billing['city'], 
                         'billing_postcode' => $order->billing['postcode'], 
                         'billing_state' => $order->billing['state'], 
                         'billing_country' => $order->billing['country']['title'], 
                         'billing_address_format_id' => $order->billing['format_id'], 
                         'payment_method' => $order->info['payment_method'], 
                         'cc_type' => $order->info['cc_type'], 
                         'cc_owner' => $order->info['cc_owner'], 
                         'cc_number' => $order->info['cc_number'], 
                         'cc_expires' => $order->info['cc_expires'], 
                         'date_purchased' => 'now()', 
                         'orders_status' => $order->info['order_status'], 
                         'currency' => $order->info['currency'], 
                         'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $sql_data_array = array('orders_id' => $insert_id,
                           'title' => $order_totals[$i]['title'],
                           'text' => $order_totals[$i]['text'],
                           'value' => $order_totals[$i]['value'], 
                           'class' => $order_totals[$i]['code'], 
                           'sort_order' => $order_totals[$i]['sort_order']);
   tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
                         'orders_status_id' => $order->info['order_status'], 
                         'date_added' => 'now()', 
                         'customer_notified' => $customer_notification,
                         'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
   if (STOCK_LIMITED == 'true') {
//++++ QT Pro: Begin Changed code
       $products_attributes = $order->products[$i]['attributes'];
//++++ QT Pro: End Changed Code
     if (DOWNLOAD_ENABLED == 'true') {
       $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
                           FROM " . TABLE_PRODUCTS . " p
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                            ON p.products_id=pa.products_id
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                            ON pa.products_attributes_id=pad.products_attributes_id
                           WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
//++++ QT Pro: Begin Changed code
//      $products_attributes = $order->products[$i]['attributes'];
//++++ QT Pro: End Changed Code
       if (is_array($products_attributes)) {
         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
       }
       $stock_query = tep_db_query($stock_query_raw);
//++++ QT Pro: Begin Changed code
           $actual_stock_bought = $order->products[$i]['qty'];
       } else {
           if (is_array($products_attributes)) {
               $all_nonstocked = true;
               $products_stock_attributes_array = array();
               foreach ($products_attributes as $attribute) {
                   if ($attribute['track_stock'] == 1) {
                     $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id'];
                     $all_nonstocked = false;
                   }
               } 
               if ($all_nonstocked) {
                   $actual_stock_bought = $order->products[$i]['qty'];
               }  else {
                 asort($products_stock_attributes_array, SORT_NUMERIC);
                 $products_stock_attributes = implode(",", $products_stock_attributes_array);
                 $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 if (tep_db_num_rows($attributes_stock_query) > 0) {
                     $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
                     $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
                     tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     $actual_stock_bought = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty'];
     } else {
                     $attributes_stock_left = 0 - $order->products[$i]['qty'];
                     tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')");
                     $actual_stock_bought = 0;
                 }
               }
           } else {
               $actual_stock_bought = $order->products[$i]['qty'];
           } 
//++++ QT Pro: End Changed Code
       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
     }
     if (tep_db_num_rows($stock_query) > 0) {
       $stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
       if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
//++++ QT Pro: Begin Changed code
               $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
               tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - '" . $actual_stock_bought . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//++++ QT Pro: End Changed Code
       if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       }
     }
   }
//++++ QT Pro: Begin Changed code
   }
//++++ QT Pro: End Changed Code
// Update products_ordered (for bestsellers list)
   tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

//++++ QT Pro: Begin Changed code
   if (!isset($products_stock_attributes)) $products_stock_attributes=null;
   $sql_data_array = array('orders_id' => $insert_id, 
                           'products_id' => tep_get_prid($order->products[$i]['id']), 
                           'products_model' => $order->products[$i]['model'], 
                           'products_name' => $order->products[$i]['name'], 
                           'products_price' => $order->products[$i]['price'], 
                           'final_price' => $order->products[$i]['final_price'], 
                           'products_tax' => $order->products[$i]['tax'], 
                           'products_quantity' => $order->products[$i]['qty'],
                           'products_stock_attributes' => $products_stock_attributes);
//++++ QT Pro: End Changed Code
   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
   $order_products_id = tep_db_insert_id();

//------insert customer choosen option to order--------
   $attributes_exist = '0';
   $products_ordered_attributes = '';
   if (isset($order->products[$i]['attributes'])) {
     $attributes_exist = '1';
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       if (DOWNLOAD_ENABLED == 'true') {
         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
                              from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                               on pa.products_attributes_id=pad.products_attributes_id
                              where pa.products_id = '" . $order->products[$i]['id'] . "' 
                               and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
                               and pa.options_id = popt.products_options_id 
                               and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
                               and pa.options_values_id = poval.products_options_values_id 
                               and popt.language_id = '" . $languages_id . "' 
                               and poval.language_id = '" . $languages_id . "'";
         $attributes = tep_db_query($attributes_query);
       } else {
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
       }
       $attributes_values = tep_db_fetch_array($attributes);

       $sql_data_array = array('orders_id' => $insert_id, 
                               'orders_products_id' => $order_products_id, 
                               'products_options' => $attributes_values['products_options_name'],
                               'products_options_values' => $attributes_values['products_options_values_name'], 
                               'options_values_price' => $attributes_values['options_values_price'], 
                               'price_prefix' => $attributes_values['price_prefix']);
       tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

       if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
         $sql_data_array = array('orders_id' => $insert_id, 
                                 'orders_products_id' => $order_products_id, 
                                 'orders_products_filename' => $attributes_values['products_attributes_filename'], 
                                 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
                                 'download_count' => $attributes_values['products_attributes_maxcount']);
         tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
       }
       $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
     }
   }
//------insert customer choosen option eof ----
   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
   $total_cost += $total_products_price;

   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                   tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

No, I simply didn't have that one - and for some reason I missed it when I diff'ed for differences :(

Share this post


Link to post
Share on other sites

I have a problem I actually thought QTpro solved, but I can't see how - so I'm going to "throw it outthere" to see if you have any idea how I can solve this :)

 

I have an item which has 2 option types: subscription type, and subscription period. My problem is that, I want the price to differ, depending on both. ie. subscriptiontype1 has a price for a 1 year period and a 2 year period. subscriptiontype2 has a different(!) price for a 1 year period and 2 year period.

 

This means I need some sort of "correlation" between options, and differing in price, depending on which was chosen. Would be no problem if all options were simply shown in 1 dropdown. I know qtpro does it in regards to stock, but how do I do the same (it seems to be the same) with prices on options?

Share this post


Link to post
Share on other sites

How to get order editor work with Qtpro? Is that posible? Update my stock too.. not just show products in order.

<?php
/*
$Id: edit_orders.php,v 1.21 2004/09/18 15:46:00 jrb Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License

Written by Jonathan Hilgeman of SiteCreative.com (osc@sitecreative.com)
- Updated By Jesse Ryan Barrick & Christian Binkert

Version History
---------------------------------------------------------------
04/01/05
1.60 - Huge list of changes;-)

18/09/04
1.58 - Changed Order Edit page to show full Credit Card Number

16/07/04
1.56 - Added a check for missing ot_subtotal on update

08/08/03
1.2a - Fixed a query problem on osC 2.1 stores.

08/08/03
1.2 - Added more recommendations to the instructions.
      Added "Customer" fields for editing on osC 2.2.
      Corrected "Billing" fields so they update correctly.
      Added Company and Suburb Fields.
      Added optional shipping tax variable.
      First (and hopefully last) fix for currency formatting.

08/08/03
1.1 - Added status editing (fixed order status bug from 1.0).
      Added comments editing. (with compatibility for osC 2.1)
      Added customer notifications.
      Added some additional information to the instructions file.
      Fixed bug with product names containing single quotes.

08/07/03      
1.0 - Original Release.

To Do in Version 1.3
---------------------------------------------------------------

Note from the author
---------------------------------------------------------------
This tool was designed and tested on osC 2.2 Milestone 2.2,
but may work for other versions, as well. Most database changes
were minor, so getting it to work on other versions may just
need some tweaking. Hope this helps make your life easier!

- Jonathan Hilgeman, August 7th, 2003  
*/

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

include(DIR_WS_CLASSES . 'order.php');

// START CONFIGURATION ################################

// Optional Tax Rates, e.g. shipping tax of 17.5% is "17.5"
$AddCustomTax = "22.0"; // class "ot_custom", used for all unknown total modules
$AddShippingTax = "20.0"; // class "ot_shippping"
$AddLevelDiscountTax = "7.6"; // class "ot_lev_discount"
$AddCustomerDiscountTax = "7.6"; // class "ot_customer_discount"

// END OF CONFIGURATION ################################


// New "Status History" table has different format.
$OldNewStatusValues = (tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "old_value") && tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "new_value"));
$CommentsWithStatus = tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "comments");
$SeparateBillingFields = tep_field_exists(TABLE_ORDERS, "billing_name");

$orders_statuses = array();
$orders_status_array = array();
$orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");
while ($orders_status = tep_db_fetch_array($orders_status_query)) {
  $orders_statuses[] = array('id' => $orders_status['orders_status_id'],
                             'text' => $orders_status['orders_status_name']);
  $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
}

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : 'edit');

// Update Inventory Quantity
$order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$oID . "'");

if (tep_not_null($action)) {
  switch ($action) {
   
// 1. UPDATE ORDER ################################################################################
###############
case 'update_order':

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
$order = new order($oID);
$status = tep_db_prepare_input($HTTP_POST_VARS['status']);

// 1.1 UPDATE ORDER INFO #####

$UpdateOrders = "update " . TABLE_ORDERS . " set 
 customers_name = '" . tep_db_input(stripslashes($update_customer_name)) . "',
 customers_company = '" . tep_db_input(stripslashes($update_customer_company)) . "',
 customers_street_address = '" . tep_db_input(stripslashes($update_customer_street_address)) . "',
 customers_suburb = '" . tep_db_input(stripslashes($update_customer_suburb)) . "',
 customers_city = '" . tep_db_input(stripslashes($update_customer_city)) . "',
 customers_state = '" . tep_db_input(stripslashes($update_customer_state)) . "',
 customers_postcode = '" . tep_db_input($update_customer_postcode) . "',
 customers_country = '" . tep_db_input(stripslashes($update_customer_country)) . "',
 customers_telephone = '" . tep_db_input($update_customer_telephone) . "',
 customers_email_address = '" . tep_db_input($update_customer_email_address) . "',";

if($SeparateBillingFields) { 
// Original: all database fields point to $update_billing_xxx, now they are updated with the same values as the customer fields
$UpdateOrders .= "billing_name = '" . tep_db_input(stripslashes($update_customer_name)) . "',
 billing_company = '" . tep_db_input(stripslashes($update_customer_company)) . "',
 billing_street_address = '" . tep_db_input(stripslashes($update_customer_street_address)) . "',
 billing_suburb = '" . tep_db_input(stripslashes($update_customer_suburb)) . "',
 billing_city = '" . tep_db_input(stripslashes($update_customer_city)) . "',
 billing_state = '" . tep_db_input(stripslashes($update_customer_state)) . "',
 billing_postcode = '" . tep_db_input($update_customer_postcode) . "',
 billing_country = '" . tep_db_input(stripslashes($update_customer_country)) . "',";
}

$UpdateOrders .= "delivery_name = '" . tep_db_input(stripslashes($update_delivery_name)) . "',
 delivery_company = '" . tep_db_input(stripslashes($update_delivery_company)) . "',
 delivery_street_address = '" . tep_db_input(stripslashes($update_delivery_street_address)) . "',
 delivery_suburb = '" . tep_db_input(stripslashes($update_delivery_suburb)) . "',
 delivery_city = '" . tep_db_input(stripslashes($update_delivery_city)) . "',
 delivery_state = '" . tep_db_input(stripslashes($update_delivery_state)) . "',
 delivery_postcode = '" . tep_db_input($update_delivery_postcode) . "',
 delivery_country = '" . tep_db_input(stripslashes($update_delivery_country)) . "',
 payment_method = '" . tep_db_input($update_info_payment_method) . "',
 cc_type = '" . tep_db_input($update_info_cc_type) . "',
 cc_owner = '" . tep_db_input($update_info_cc_owner) . "',";
 
if(substr($update_info_cc_number,0,8) != "(Last 4)") {
  $UpdateOrders .= "cc_number = '$update_info_cc_number',";
}  
$UpdateOrders .= "cc_expires = '$update_info_cc_expires',
 orders_status = '" . tep_db_input($status) . "'";

if(!$CommentsWithStatus) {
 $UpdateOrders .= ", comments = '" . tep_db_input($comments) . "'";
}
$UpdateOrders .= " where orders_id = '" . tep_db_input($oID) . "';";

tep_db_query($UpdateOrders);
$order_updated = true;

  $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
  $check_status = tep_db_fetch_array($check_status_query);

// 1.2 UPDATE STATUS HISTORY & SEND EMAIL TO CUSTOMER IF NECESSARY #####

if ($order->info['orders_status'] != $status) {

 // Notify Customer
    $customer_notified = '0';
 if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
   $notify_comments = '';
   if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
     $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
   }
   $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
   tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
   $customer_notified = '1';
 }     
          
 // "Status History" table has gone through a few different changes, so here are different versions of the status update. 
 // NOTE: Theoretically, there shouldn't be a orders_status field in the ORDERS table. It should really just use the latest value from this status history table.
 if($CommentsWithStatus) {
 tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " 
  (orders_id, orders_status_id, date_added, customer_notified, comments) 
  values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', now(), " . tep_db_input($customer_notified) . ", '" . tep_db_input($comments)  . "')");
 } else {
  if($OldNewStatusValues) {
    tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " 
   (orders_id, new_value, old_value, date_added, customer_notified) 
   values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', '" . $order->info['orders_status'] . "', now(), " . tep_db_input($customer_notified) . ")");
  } else {
    tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " 
   (orders_id, orders_status_id, date_added, customer_notified) 
   values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', now(), " . tep_db_input($customer_notified) . ")");
  }
 }
}

// 1.3 UPDATE PRODUCTS #####

$RunningSubTotal = 0;
$RunningTax = 0;

  // Do pre-check for subtotal field existence (CWS)
$ot_subtotal_found = false;

  foreach($update_totals as $total_details) {
  extract($total_details,EXTR_PREFIX_ALL,"ot");
 if($ot_class == "ot_subtotal") {
   $ot_subtotal_found = true;
   break;
 }
}
      
// 1.3.1 Update orders_products Table
foreach($update_products as $orders_products_id => $products_details) {

 // 1.3.1.1 Update Inventory Quantity
 $order = tep_db_fetch_array($order_query);
 if ($products_details["qty"] != $order['products_quantity']) {
  $quantity_difference = ($products_details["qty"] - $order['products_quantity']);
   tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'");
 }

 if($products_details["qty"] > 0) { // a.) quantity found --> add to list & sum
 
  $Query = "update " . TABLE_ORDERS_PRODUCTS . " set
   products_model = '" . $products_details["model"] . "',
   products_name = '" . str_replace("'", "'", $products_details["name"]) . "',
   final_price = '" . $products_details["final_price"] . "',
   products_tax = '" . $products_details["tax"] . "',
   products_quantity = '" . $products_details["qty"] . "'
   where orders_products_id = '$orders_products_id';";
  tep_db_query($Query);
                       
    // Update Tax and Subtotals: please choose sum WITH or WITHOUT tax, but activate only ONE version;-)
  $RunningSubTotal += (tep_add_tax(($products_details["qty"] * $products_details["final_price"]), $products_details["tax"])*20)/20; // version WITH tax
    // $RunningSubTotal += $products_details["qty"] * $products_details["final_price"]; // version WITHOUT tax
  $RunningTax += (($products_details["tax"]/100) * ($products_details["qty"] * $products_details["final_price"]));
           
  // Update Any Attributes
  if(IsSet($products_details[attributes]))
  {
   foreach($products_details["attributes"] as $orders_products_attributes_id => $attributes_details)
   {
    $Query = "update " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set
     products_options = '" . $attributes_details["option"] . "',
     products_options_values = '" . $attributes_details["value"] . "'
     where orders_products_attributes_id = '$orders_products_attributes_id';";
    tep_db_query($Query);
   }
  }
  
 } else { // b.) null quantity found --> delete
 
  $Query = "delete from " . TABLE_ORDERS_PRODUCTS . " where orders_products_id = '$orders_products_id';";
  tep_db_query($Query);
  $order = tep_db_fetch_array($order_query);
  
  if ($products_details["qty"] != $order['products_quantity']){
   $quantity_difference = ($products_details["qty"] - $order['products_quantity']);
   tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " where products_id = '" . (int)$order['products_id'] . "'");
  }
  
  $Query = "delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_products_id = '$orders_products_id';";
  tep_db_query($Query);
 }
}

// 1.4. UPDATE SHIPPING, DISCOUNT & CUSTOM TAXES #####
//print $RunningTax."prima <br>";
//print "<pre>";
//print_r($update_totals);
//print "</pre>";

foreach($update_totals as $total_index => $total_details) {
 extract($total_details,EXTR_PREFIX_ALL,"ot");
 
 //print_r($total_details)."<br>";
    
 if ($ot_class == "ot_shipping") {
  $RunningTax += ($ot_value - ($ot_value / (1 + ($AddShippingTax / 100)))); // corrected tax by cb
 //$RunningTax += (($AddShippingTax / 100) * $ot_value);
 }
 elseif ($ot_class == "ot_lev_discount") {
  $RunningTax += ($ot_value - ($ot_value / (1 + ($AddLevelDiscountTax / 100)))); // corrected tax by cb
 // $RunningTax += (($AddLevelDiscountTax / 100) * $ot_value);
 }
 elseif ($ot_class == "ot_customer_discount") {
  $RunningTax += ($ot_value - ($ot_value / (1 + ($AddCustomerDiscountTax / 100)))); // corrected tax by cb
 //  $RunningTax += (($AddCustomerDiscountTax / 100) * $ot_value);
 }
 elseif ($ot_class == "ot_custom") {
  $RunningTax += ($ot_value - ($ot_value / (1 + ($AddCustomTax / 100)))); // corrected tax by cb
 // $RunningTax += (($AddCustomTax / 100) * $ot_value);
 }
 elseif ($ot_class == "ot_cod_fee") {
  $RunningTax += ($ot_value - ($ot_value / (1 + ($AddCustomTax / 100)))); // corrected tax by cb
 // $RunningTax += (($AddCustomTax / 100) * $ot_value);
 }
 
 
 //print $RunningTax."<br>";
}

// exit;
// 1.5 UPDATE TOTALS #####

$RunningTotal = 0;
$sort_order = 0;
 
 // 1.5.1 Do pre-check for Tax field existence
 $ot_tax_found = 0;
 foreach($update_totals as $total_details) {
  extract($total_details,EXTR_PREFIX_ALL,"ot");
  if($ot_class == "ot_tax")
  {
   $ot_tax_found = 1;
   break;
  }
 }
 
 // 1.5.2. Summing up total
 foreach($update_totals as $total_index => $total_details) 
 
 {
 
   // 1.5.2.1 Prepare Tax Insertion   
 extract($total_details,EXTR_PREFIX_ALL,"ot");
 
 // inserisce la tassa se non la trova oppure ??
 if (trim(strtolower($ot_title)) == "iva" || trim(strtolower($ot_title)) == "iva:") 
  {
   if ($ot_class != "ot_tax" && $ot_tax_found == 0) 
   {
    // Inserting Tax
    $ot_class = "ot_tax";
    $ot_value = "x"; // This gets updated in the next step
    $ot_tax_found = 1;
   }
  }
  
   // 1.5.2.2 Update ot_subtotal, ot_tax, and ot_total classes
  if (trim($ot_title) && trim($ot_value)) 
  
  {
  
   $sort_order++;
   if ($ot_class == "ot_subtotal") {
    $ot_value = $RunningSubTotal;
   }      
   if ($ot_class == "ot_tax") {
    $ot_value = $RunningTax;
    // print "ot_value = $ot_value<br>\n";
   }

      // Check for existence of subtotals (CWS)                      
   if ($ot_class == "ot_total") 
    {
            $ot_value = $RunningTotal-$RunningTax;
                       
            if ( !$ot_subtotal_found ) 
            { // There was no subtotal on this order, lets add the running subtotal in.
              //   $ot_value +=  $RunningSubTotal;
            }
         //   print $ot_value;
         //   exit;
           }
       
   // Set $ot_text (display-formatted value)
    // $ot_text = "\$" . number_format($ot_value, 2, '.', ',');
   $order = new order($oID);
   $ot_text = $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']);
    
   if ($ot_class == "ot_total") {
    $ot_text = "<b>" . $ot_text . "</b>";
   }
   
   if($ot_total_id > 0) { // Already in database --> Update
    $Query = 'UPDATE ' . TABLE_ORDERS_TOTAL . ' SET
     title = "' . $ot_title . '",
     text = "' . $ot_text . '",
     value = "' . $ot_value . '",
     sort_order = "' . $sort_order . '"
     WHERE orders_total_id = "' . $ot_total_id . '"';
    tep_db_query($Query);
   } else { // New Insert
    $Query = 'INSERT INTO ' . TABLE_ORDERS_TOTAL . ' SET
     orders_id = "' . $oID . '",
     title = "' . $ot_title . '",
     text = "' . $ot_text . '",
     value = "' . $ot_value . '",
     class = "' . $ot_class . '",
     sort_order = "' . $sort_order . '"';
    tep_db_query($Query);
   }
  $RunningTotal += $ot_value;
    // print $ot_value."<br>";
  }
  
 elseif (($ot_total_id > 0) && ($ot_class != "ot_shipping")) { // Delete Total Piece
  
   $Query = "delete from " . TABLE_ORDERS_TOTAL . " where orders_total_id = '$ot_total_id'";
   tep_db_query($Query);
  }

 }
//   print "Totale ".$RunningTotal;
//   exit;  
// 1.6 SUCCESS MESSAGE #####

if ($order_updated) {
 $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
}

tep_redirect(tep_href_link("edit_orders.php", tep_get_all_get_params(array('action')) . 'action=edit'));

break;

// 2. ADD A PRODUCT ################################################################################
###############
case 'add_product':

if($step == 5)
{
 // 2.1 GET ORDER INFO #####
 
 $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
 $order = new order($oID);

 $AddedOptionsPrice = 0;

 // 2.1.1 Get Product Attribute Info
 if(IsSet($add_product_options))
 {
  foreach($add_product_options as $option_id => $option_value_id)
  {
   $result = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id' and options_id=$option_id and options_values_id=$option_value_id and po.language_id = '" . (int)$languages_id . "' and pov.language_id = '" . (int)$languages_id . "'");
   $row = tep_db_fetch_array($result);
   extract($row, EXTR_PREFIX_ALL, "opt");
   $AddedOptionsPrice += $opt_options_values_price;
   $option_value_details[$option_id][$option_value_id] = array ("options_values_price" => $opt_options_values_price);
   $option_names[$option_id] = $opt_products_options_name;
   $option_values_names[$option_value_id] = $opt_products_options_values_name;
  }
 }

 // 2.1.2 Get Product Info
 $InfoQuery = "select p.products_model,p.products_price,pd.products_name,p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pd.products_id=p.products_id where p.products_id='$add_product_products_id' and pd.language_id = '" . (int)$languages_id . "'";
 $result = tep_db_query($InfoQuery);

 $row = tep_db_fetch_array($result);
 extract($row, EXTR_PREFIX_ALL, "p");
 
 // risolviamo il bug delle offerte
 $rs_offerte = tep_db_query("select * from specials where products_id ='". $add_product_products_id."'");
 $offerte = tep_db_fetch_array($rs_offerte);
 
 
 if ($offerte) 
 {
 $p_products_price = $offerte['specials_new_products_price'];
 }
 
 // Following functions are defined at the bottom of this file
 $CountryID = tep_get_country_id($order->delivery["country"]);
 $ZoneID = tep_get_zone_id($CountryID, $order->delivery["state"]);
 
 $ProductsTax = tep_get_tax_rate($p_products_tax_class_id, $CountryID, $ZoneID);
 
 // 2.2 UPDATE ORDER #####
 
 $Query = "insert into " . TABLE_ORDERS_PRODUCTS . " set
  orders_id = $oID,
  products_id = $add_product_products_id,
  products_model = '$p_products_model',
  products_name = '" . str_replace("'", "'", $p_products_name) . "',
  products_price = '$p_products_price',
  final_price = '" . ($p_products_price + $AddedOptionsPrice) . "',
  products_tax = '$ProductsTax',
  products_quantity = $add_product_quantity;";
 tep_db_query($Query);
 $new_product_id = tep_db_insert_id();
 
 // 2.2.1 Update inventory Quantity
 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $add_product_quantity . ", products_ordered = products_ordered + " . $add_product_quantity . " where products_id = '" . $add_product_products_id . "'");

 if (IsSet($add_product_options)) {
  foreach($add_product_options as $option_id => $option_value_id) {
   $Query = "insert into " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set
    orders_id = $oID,
    orders_products_id = $new_product_id,
    products_options = '" . $option_names[$option_id] . "',
    products_options_values = '" . $option_values_names[$option_value_id] . "',
    options_values_price = '" . $option_value_details[$option_id][$option_value_id]["options_values_price"] . "',
    price_prefix = '+';";
   tep_db_query($Query);
  }
 }
 
 // 2.2.2 Calculate Tax and Sub-Totals
 $order = new order($oID);
 $RunningSubTotal = 0;
 $RunningTax = 0;

 for ($i=0; $i<sizeof($order->products); $i++) {
   $RunningSubTotal += ($order->products[$i]['qty'] * $order->products[$i]['final_price']);
   $RunningTax += (($order->products[$i]['tax'] / 100) * ($order->products[$i]['qty'] * $order->products[$i]['final_price']));   
 }
 
 // 2.2.2.1 Tax
 $Query = "update " . TABLE_ORDERS_TOTAL . " set
  text = '" . number_format($RunningTax, 2, '.', ',') . $order->info['currency'] . "', 
  value = '" . $RunningTax . "'
  where class='ot_tax' and orders_id=$oID";
 tep_db_query($Query);

 // 2.2.2.2 Sub-Total
 $Query = "update " . TABLE_ORDERS_TOTAL . " set
  text = '" . number_format($RunningSubTotal + $RunningTax, 2, '.', ',') . $order->info['currency'] . "',
  value = '" . $RunningSubTotal . "'
  where class='ot_subtotal' and orders_id=$oID";
 tep_db_query($Query);

 // 2.2.2.3 Total
 $Query = "select sum(value) as total_value from " . TABLE_ORDERS_TOTAL . " where class != 'ot_total' and orders_id=$oID";
 $result = tep_db_query($Query);
 $row = tep_db_fetch_array($result);
 $Total = $row["total_value"];

 $Query = "update " . TABLE_ORDERS_TOTAL . " set
  text = '<b>" . number_format($Total, 2, '.', ',') . $order->info['currency'] . "</b>',
  value = '" . $Total . "'
  where class='ot_total' and orders_id=$oID";
 tep_db_query($Query);

 // 2.3 REDIRECTION #####
 
 tep_redirect(tep_href_link("edit_orders.php", tep_get_all_get_params(array('action')) . 'action=edit'));

}

 break;

}
}

if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {
  $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

  $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
  $order_exists = true;
  if (!tep_db_num_rows($orders_query)) {
    $order_exists = false;
    $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');
  }
}
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php
require(DIR_WS_INCLUDES . 'header.php');
?>
<style type="text/css">
.Subtitle {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #FF6600;
}
</style>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
  <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
  </table></td>
<!-- body_text //-->
  <td width="100%" valign="top"><table border="0" width="96%" cellspacing="0" cellpadding="2">

<?php
if (($action == 'edit') && ($order_exists == true)) {
$order = new order($oID);
?>
    <tr>
      <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="pageHeading"><?php echo HEADING_TITLE; ?> (Nr. <?php echo $oID; ?> del <?php echo tep_datetime_short($order->info['date_purchased']); ?>)</td>
          <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
          <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
        </tr>
        <tr>
         <td class="main" colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '1', '1'); ?></td>
        </tr>
        <tr>
          <td class="main" colspan="3"><?php echo HEADING_SUBTITLE; ?></td>
        </tr>
        <tr>
         <td class="main" colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
        </tr>
      </table></td>
    </tr>
   
<!-- Begin Addresses Block -->
    <tr><?php echo tep_draw_form('edit_order', "edit_orders.php", tep_get_all_get_params(array('action','paycc')) . 'action=update_order'); ?>
      <td class="SubTitle"><?php echo MENUE_TITLE_CUSTOMER; ?></td>
 </tr>
    <tr>
     <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '1'); ?></td>
    </tr>   
 <tr>
   <td>
    
<table border="0" class="dataTableRow" cellpadding="2" cellspacing="0">
<tr class="dataTableHeadingRow">
  <td class="dataTableHeadingContent" width="80"></td>
  <td class="dataTableHeadingContent" width="150"><?php echo ENTRY_BILLING_ADDRESS; ?></td>
  <td class="dataTableHeadingContent" width="6"> </td>
  <td class="dataTableHeadingContent" width="150"><?php echo ENTRY_SHIPPING_ADDRESS; ?></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_COMPANY; ?>: </b></td>
  <td><span class="main"><input name="update_customer_company" size="25" value="<?php echo tep_html_quotes($order->customer['company']); ?>"></span></td>
<td> </td>
  <td><span class="main"><input name="update_delivery_company" size="25" value="<?php echo tep_html_quotes($order->delivery['company']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_NAME; ?>: </b></td>
  <td><span class="main"><input name="update_customer_name" size="25" value="<?php echo tep_html_quotes($order->customer['name']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_name" size="25" value="<?php echo tep_html_quotes($order->delivery['name']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_ADDRESS; ?>: </b></td>
  <td><span class="main"><input name="update_customer_street_address" size="25" value="<?php echo tep_html_quotes($order->customer['street_address']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_street_address" size="25" value="<?php echo tep_html_quotes($order->delivery['street_address']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_SUBURB; ?>: </b></td>
  <td><span class="main"><input name="update_customer_suburb" size="25" value="<?php echo tep_html_quotes($order->customer['suburb']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_suburb" size="25" value="<?php echo tep_html_quotes($order->delivery['suburb']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_CITY; ?>: </b></td>
  <td><span class="main"><input name="update_customer_city" size="25" value="<?php echo tep_html_quotes($order->customer['city']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_city" size="25" value="<?php echo tep_html_quotes($order->delivery['city']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_STATE; ?>: </b></td>
  <td><span class="main"><input name="update_customer_state" size="25" value="<?php echo tep_html_quotes($order->customer['state']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_state" size="25" value="<?php echo tep_html_quotes($order->delivery['state']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_POSTCODE; ?>: </b></td>
  <td><span class="main"><input name="update_customer_postcode" size="25" value="<?php echo $order->customer['postcode']; ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_postcode" size="25" value="<?php echo $order->delivery['postcode']; ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_COUNTRY; ?>: </b></td>
  <td><span class="main"><input name="update_customer_country" size="25" value="<?php echo tep_html_quotes($order->customer['country']); ?>"></span></td>
  <td> </td>
  <td><span class="main"><input name="update_delivery_country" size="25" value="<?php echo tep_html_quotes($order->delivery['country']); ?>"></span></td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_PHONE; ?>: </b></td>
  <td><span class="main"><input name="update_customer_telephone" size="25" value="<?php echo $order->customer['telephone']; ?>"></span></td>
  <td> </td>
  <td> </td>
</tr>
<tr>
  <td class="main"><b><?php echo ENTRY_CUSTOMER_EMAIL; ?>: </b></td>
  <td colspan="3"><span class="main"><input name="update_customer_email_address" size="25" value="<?php echo $order->customer['email_address']; ?>"></span></td>
</tr>
</table>

  </td>
 </tr>
<!-- End Addresses Block -->

    <tr>
     <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
    </tr>      

<!-- Begin Payment Block -->
    <tr>
     <td class="SubTitle"><?php echo MENUE_TITLE_PAYMENT; ?></td>
 </tr>
    <tr>
     <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '1'); ?></td>
    </tr>   
    <tr>
     <td>
  
<table border="0" cellspacing="0" cellpadding="2" class="dataTableRow">
<tr class="dataTableHeadingRow">
  <td colspan="2" class="dataTableHeadingContent"><?php echo ENTRY_PAYMENT_METHOD; ?></td>
</tr>
<tr>
 <td colspan="2" class="main"><input name='update_info_payment_method' size='35' value='<?php echo $order->info['payment_method']; ?>'></td>
</tr>

<!-- Begin Credit Card Info Block -->
 <?php if ($order->info['cc_type'] || $order->info['cc_owner'] || $order->info['cc_number'] || $order->info['payment_method'] == "Credit Card" || $order->info['payment_method'] == "Kreditkarte") { ?>
 <tr>
   <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 </tr>
 <tr>
   <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
   <td class="main"><input name='update_info_cc_type' size='10' value='<?php echo $order->info['cc_type']; ?>'></td>
 </tr>
 <tr>
   <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
   <td class="main"><input name='update_info_cc_owner' size='20' value='<?php echo $order->info['cc_owner']; ?>'></td>
 </tr>
 <tr>
   <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
   <td class="main"><input name='update_info_cc_number' size='20' value='<?php echo $order->info['cc_number']; ?>'></td>
 </tr>
 <tr>
   <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
   <td class="main"><input name='update_info_cc_expires' size='4' value='<?php echo $order->info['cc_expires']; ?>' maxlength="4"></td>
 </tr>
<?php } ?>
<!-- End Credit Card Info Block -->

</table>

      </td>
    </tr>
   <?php if ($order->info['payment_method'] != "Credit Card" || $order->info['payment_method'] != "Kreditkarte") { ?>
     <tr>
       <td class="smalltext"></td>
     </tr>
   <?php } ?>
<!-- End Payment Block -->

    <tr>
     <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
    </tr>

<!-- Begin Products Listing Block -->
    <tr>
     <td class="SubTitle"><?php echo MENUE_TITLE_ORDER; ?></td>
 </tr>
    <tr>
     <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '1'); ?></td>
    </tr>   
    <tr>
     <td>
    
<?php
  // Override order.php Class's Field Limitations
$index = 0;
$order->products = array();
$orders_products_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$oID . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$order->products[$index] = array('qty' => $orders_products['products_quantity'],
                                   'name' => str_replace("'", "'", $orders_products['products_name']),
                                   'model' => $orders_products['products_model'],
                                   'tax' => $orders_products['products_tax'],
                                   'price' => $orders_products['products_price'],
                                   'final_price' => $orders_products['final_price'],
                                   'orders_products_id' => $orders_products['orders_products_id']);

$subindex = 0;
$attributes_query_string = "select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'";
$attributes_query = tep_db_query($attributes_query_string);

if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
  $order->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                            'value' => $attributes['products_options_values'],
                                                            'prefix' => $attributes['price_prefix'],
                                                            'price' => $attributes['options_values_price'],
                                                            'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
  $subindex++;
  }
}
$index++;
}

?>

<?php // Version with editable names & prices ?>
<?php /*
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
 <td class="dataTableHeadingContent" width="20"><?php echo TABLE_HEADING_QUANTITY; ?></td>
 <td class="dataTableHeadingContent" width="5"> </td>
 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX; ?></td>
 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_UNIT_PRICE; ?></td>
 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_UNIT_PRICE_TAXED; ?></td>
 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PRICE; ?></td>
 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PRICE_TAXED; ?></td>
</tr>

<?php 
for ($i=0; $i<sizeof($order->products); $i++) {
$orders_products_id = $order->products[$i]['orders_products_id'];
$RowStyle = "dataTableContent";
echo '   <tr class="dataTableRow">' . "\n" .
     '     <td class="' . $RowStyle . '" align="right">' . "<input name='update_products[$orders_products_id][qty]' size='2' value='" . $order->products[$i]['qty&

Share this post


Link to post
Share on other sites
I have a problem I actually thought QTpro solved, but I can't see how - so I'm going to "throw it outthere" to see if you have any idea how I can solve this :)

 

I have an item which has 2 option types: subscription type, and subscription period. My problem is that, I want the price to differ, depending on both. ie. subscriptiontype1 has a price for a 1 year period and a 2 year period. subscriptiontype2 has a different(!) price for a 1 year period and 2 year period.

 

This means I need some sort of "correlation" between options, and differing in price, depending on which was chosen. Would be no problem if all options were simply shown in 1 dropdown. I know qtpro does it in regards to stock, but how do I do the same (it seems to be the same) with prices on options?

osCommerce allows you to specify price deltas for product options when you add them to the product. Its easiest if the price difference between the 1 year and 2 years prices are the same for both subscription types but with QT Pro it can work if they are different.

 

If the 1 year to 2 year difference is the same for both types:

 

Make the product price the first subscription type 1 year subscription price

Add the first subscription type to the product with no price delta.

Add the second subscription type to the product with a +/- price delta from the first subscription type 1 year price to the second subscription type 1 year price.

Add the 1 year subscription option to the product with no price delta.

Add the 1 year subscription option to the product with the price delta between a 1 year and 2 year subscription.

 

If the 1 year to 2 year difference is different for both types then you'll need to add two 2 year options, one for each subscription type. Then set them in stock for only the correct subscription types.

Share this post


Link to post
Share on other sites
How to get order editor work with Qtpro? Is that posible? Update my stock too.. not just show products in order

Its possible. It requires merging code from checkout_process.php for reducing stock and from admin/functions/general.php code for adding it back. This really needs to be broken out into a single stock adjustment module. I'll get there eventually.

 

*forked project mentioned

Edited by 241

Share this post


Link to post
Share on other sites

I have just installed this contribution to my test site and don't know what I've done wrong. Everything is working fine, but my product pages don't look like the screenshots. I have the description of my item, then on the right the image, and then below that to the left, the avaiable options. How do I close the space up between the description and the options. If you want you can take a look, this is a test site, and I hope it's allowed. My Webpage

 

Thanks,

Cyndi


Is it reality or just a dream, for some there is no difference.

Share this post


Link to post
Share on other sites
I have just installed this contribution to my test site and don't know what I've done wrong.  Everything is working fine, but my product pages don't look like the screenshots.  I have the description of my item, then on the right the image, and then below that to the left, the avaiable options.  How do I close the space up between the description and the options. If you want you can take a look, this is a test site, and I hope it's allowed. My Webpage

 

Thanks,

Cyndi

You need to remove a minor change I made to keep long options from bumping into the product image and making them look funny.

 

Remove this from product_info.php:

 

//++++ QT Pro: Begin Changed code
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="smallText">
<?php
//++++ QT Pro: End Changed Code

 

And also remove this from product_info.php:

//++++ QT Pro: Begin Changed code
?>
             </td>
           </tr>
         </table>
<?php
//++++ QT Pro: End Changed Code

Share this post


Link to post
Share on other sites

hello,

i dont find the solution of showing options at a product that doesnt have one.

look here:

 

product_listing

 

look at product: Titan 1

it has two colors: red and black

that isnt correct. if you click on the image the product_info shows the corret options --> none!

the fault appears only if i follow the product_listing and advanced_searchresults.

 

any idea?

Share this post


Link to post
Share on other sites

i think the problem is my changed pad_base.php

but i didnt find a working way.

in the moment i have these changes. in product_listing.php changed this:

 

	if ($products_attributes['total'] > 0) {
	 
	 //++++ QT Pro: Begin Changed code
   $products_id = $listing['products_id'];//(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']); 
      	 require_once(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
      	 $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
      	 $pad = new $class($products_id);
      	 //echo $pad->draw1();
   $lc_text_option1 = $pad->draw1();
   $lc_text_option2 = $pad->draw2();
	 //++++ QT Pro: End Changed Code

 

the last two variables come out with echo in html.

where is my fault?

than i changed the pad_base:

 

 function draw1() {

     //$out=$this->_draw_table_start();

     $out.=$this->_draw_stocked_attributes_name();
     
     $out.=$this->_draw_nonstocked_attributes_name();
   
     //$out.=$this->_draw_table_end();
     
     return $out;
     
   }

function draw2() {

     //$out=$this->_draw_table_start();

     $out.=$this->_draw_stocked_attributes();
     
     $out.=$this->_draw_nonstocked_attributes();
   
     //$out.=$this->_draw_table_end();
     
     return $out;
     
   }

 

first it worked (or seemed to).

Share this post


Link to post
Share on other sites

Hi there,

 

i?ve installed QTpro v4 on my osc2.2-ms2 .

I?ve changed the files by hand, cause i have already other contribs installed.

 

first problem in admin section: on the screenshot of the admin panel there is a link "product information" but that link is not on my admin panel!!

 

second problem on shop: when i open a product, there occurs some errors like that:

 

Warning: main(includes/classes/pad_PRODINFO_ATTRIBUTE_PLUGIN.php): failed to open stream: No such file or directory in /var/www/www.mightyrox.de/htdocs/demo/bhs/product_info.php on line 142

Fatal error: main(): Failed opening required 'includes/classes/pad_PRODINFO_ATTRIBUTE_PLUGIN.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.mightyrox.de/htdocs/demo/bhs/product_info.php on line 142

 

i fixed it with editing the file (catalog/includes/filenames.php) and add that line of code

 

define('PRODINFO_ATTRIBUTE_PLUGIN','single_radioset');

 

but then there are more and more errors .. :'(

 

Warning: constant(): Couldn't find constant PRODINFO_ATTRIBUTE_SHOW_OUT_OF_STOCK in /var/www/www.mightyrox.de/htdocs/demo/bhs/includes/classes/pad_base.php on line 117

Warning: constant(): Couldn't find constant PRODINFO_ATTRIBUTE_MARK_OUT_OF_STOCK in /var/www/www.mightyrox.de/htdocs/demo/bhs/includes/classes/pad_base.php on line 118

Warning: constant(): Couldn't find constant PRODINFO_ATTRIBUTE_OUT_OF_STOCK_MSGLINE in /var/www/www.mightyrox.de/htdocs/demo/bhs/includes/classes/pad_base.php on line 119

Warning: constant(): Couldn't find constant PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK in /var/www/www.mightyrox.de/htdocs/demo/bhs/includes/classes/pad_base.php on line 120

 

i can?t find that constants in my code, nowhere. i uploaded that contrib :

8 Dec 2004 - QT Pro V 4.0 Repost

http://www.oscommerce.com/community/contri...,3/search,qtpro

 

 

someone who can help me ? thanks for your help !

 

greets Enra

Share this post


Link to post
Share on other sites

perhaps it is my changed $products_id...???

 

i changed this:

 

$products_id = (preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);

 

to this in product_listing:

 

$products_id = $listing['products_id'];

 

but how can i get these vars in product_listing?

totally confused :(

Share this post


Link to post
Share on other sites
perhaps it is my changed $products_id...???

 

i changed this:

 

$products_id = (preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);

 

to this in product_listing:

 

$products_id = $listing['products_id'];

 

but how can i get these vars in product_listing?

totally confused  :(

Without seeing all of your code changes I'm guessing you didn't change this line to use $listing['products_id'] instead of $HTTP_GET_VARS['products_id']:

    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

That may cause a call to the plugin even if there weren't any attributes for the product. If your changes to the plugin caused it to output a dropdown even if the product has no attributes then that would explain the problem. I thought your draw1 and draw2 functions starting with $out.= instead of $out= might be doing that but each call to those functions should reinitialize $out so I don't think that's it. In any event, I think if you change the query above it should solve the problem by never calling the plugin if there are no attributes.

Share this post


Link to post
Share on other sites

ralph,

thanks for your answer.

 

the lines you mean where:

 

case 'PRODUCT_LIST_NAME':
          if ($HTTP_GET_VARS['manufacturers_id']) {
            $lc_text_name = tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product')) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id'], 'NONSSL') . '">' . $listing['products_name'] . '</a>';
          } else {
            $lc_text_name = tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product')) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
          }
     $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
	 $products_attributes = tep_db_fetch_array($products_attributes_query);
	 if ($products_attributes['total'] > 0) {
	 
	 //++++ QT Pro: Begin Changed code
   $products_id = $listing['products_id'];//(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']); 
      	 require_once(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
      	 $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
      	 $pad = new $class($products_id);
      	 //echo $pad->draw1();
   $lc_text_option1 = $pad->draw1();
   $lc_text_option2 = $pad->draw2();
	 //++++ QT Pro: End Changed Code
	 
	 }
	 
	 $lc_text_kurz = cut_description(strip_tags($listing['products_description']), 135, $listing['products_id']);
	 break;

 

i changed all. still no running...

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

×