Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Ive installed the QTpro everything works fine as far as setting stock numbers on individual sizes goes, but when a purchase is made the stock never updates(decreases). I am currently using Paypal IPN as my checkout processing...Don't know where to look or what to change to make Paypal communicate to the right setting to deduct an item, please help.

Share this post


Link to post
Share on other sites
Ive installed the QTpro everything works fine as far as setting stock numbers on individual sizes goes, but when a purchase is made the stock never updates(decreases). I am currently using Paypal IPN as my checkout processing...Don't know where to look or what to change to make Paypal communicate to the right setting to deduct an item, please help.

 

After the paypall payment is made do you get the confirmation php. I think the paypall runs before the decrease stock settings.

How did you set your payment status. I have mine on preparing.

Share this post


Link to post
Share on other sites

QT Pro is fantastic. We love it, and use it on a few sites we've built. However, we've run into a new puzzle. We have a customer who sells items in packs of quantities, like 5 pack, 10 pack, 100 pack, 1000 pack.

 

How can we use QT Pro to deal with items of this nature, so, say we have 10,000 of this item, and people order various "packs", they will get dealt with accordingly?

Share this post


Link to post
Share on other sites

problem qtpro+ paypal ipn v1.0

 

try to merge includes\modules\payment\paypal_ipn.php and checkout_process.php

 

where the start is // Stock Update in paypal_ipn

 

I try to work this out tomorrow.

 

Tom

Share this post


Link to post
Share on other sites

Hello

 

Can someone please help me?

Whenever I click on the "Stock Report" in admin/reports I receive the following error:

 

Stock Report	  Friday 21 March, 2008
1146 - Table 'SQLUSER-_ANYDB. TABLE_PRODUCTS_STOCK' doesn't exist

SELECT products_stock_attributes, products_stock_quantity FROM TABLE_PRODUCTS_STOCK WHERE products_id=31 ORDER BY products_stock_attributes

[TEP STOP]

Products 	Model 	Quantity 	Price

 

When I check my db via Phpadmin for example, the table "products_stock" exists.

I even re-ran both the new_install.sql file and "config.sql" files to ensure that the table exists and all properties are populated, here are the sql errors i get when i re-run the sql scripts (duplicate errors)

 

Error

SQL query:

# QT Pro V4.0 Date: 12/04/2004
# Database changes for QT Pro installation to a store that does not have a
# previous version of QT Pro installed
# Add new column to products_options to indicate if stock should be tracked
# for an option
ALTER TABLE products_options ADD products_options_track_stock tinyint( 4 ) default '0' NOT NULL AFTER products_options_name;

MySQL said: Documentation
#1060 - Duplicate column name 'products_options_track_stock'

 

and

 

Error

SQL query:

# QT Pro V4.0 Date: 11/27/2004
# Insert configuration group for Product Information page
INSERT INTO configuration_group( configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible )
VALUES ( 888001, 'Product Information', 'Product Information page configuration options', 8, 1 );

MySQL said: Documentation
#1062 - Duplicate entry '888001' for key 1

 

I checked my "stats_low_stock_attrib.php" and compared them to QTPRO versions 4.3a/b but they are all the same.

I also ensured that the correct table is being called from stats_low_stock_attrib.php:

 

	  $products_stock_query=tep_db_query("SELECT products_stock_attributes, products_stock_quantity 
									  FROM " . TABLE_PRODUCTS_STOCK . " 
									  WHERE products_id=" . $products['products_id'] ." 
									  ORDER BY products_stock_attributes");

 

 

...Please if anyone can tell me why this is occurring - it will be greatly appreciated.

Thanks in advance!!

[Note// I replaced my sql user id and sql db for private purposes :thumbsup: ]

Share this post


Link to post
Share on other sites

Hi!

Does anybody really get this contrib to work?

I have tested to install the new contrib for the new oscommerce but this happens even in a clean oscommerce:

 

I set up QT Pro and can use all the functions except seemingly the most important --> Adding stock to attributes. I can get to the page to enter the quantity for the attributes but when I click "Add" after I enter my quantity, it sends me to https://www.xxxx.com/xxxx/xxx...&action=Add and says the page cannot be found.

 

Any ideas what is going on?

 

Regards Tony

Share this post


Link to post
Share on other sites
qtpro4osC2.2 rc2a

 

I have no experience with that version, but I am working 2.2rc2 on my locaalserver with v4.3b and no problems. On my hoster run rc1 with v4.3b. This evening I try to make the paypal_ipn with qtpro.

Share this post


Link to post
Share on other sites

the problem is solved by Andrew who created the extra contrib. this came on my mail:

Hi Tony

For some reason your stock.php form does not seam to read the php self tag

 

in admin/stock.php

find:

<td><form action="<? echo $PHP_SELF;?>" method=get>

 

Changing it to:

<td><form action="#" method=get>

 

 

Andrew

 

 

Thanks To Andrew problem is gone

 

/Tony

Share this post


Link to post
Share on other sites

any help on the TABLE_PRODUCTS_STOCK' doesn't exist issue i posted earlier please? any suggestions or aid will be greatly appreciated!!

Share this post


Link to post
Share on other sites

Dear Open source friends,

I have now put a great deal of effort into making a new version of this contribution.

Please download it and tell me what you think of it ;)

 

This contribution is for MS2.2 [rc2]/[rc2a]

It includes bugfixes...

 

* Fullfilled Andyy's work to make the contribution rc2 compatible.

* The low stock report will now display products with a quantity < 0

 

... usabillity and cleaning...

 

* The config.sql now first deletes the database entries before adding them.

* Better descriptions in the configuration menu.

* A new manual in HTML + CSS format with new screenshots.

* You can now decide from the admin panel if the attribute prices should be displayed as usually (with perifex and the difference in price) or as the calculated final price for the product (this will only work if you use one attribute option per product in your store).

* In stock.php there are now links back to all the different categories in which the product exists.

* Added Swedish language files.

 

... and a new feature ...

 

* A table with information on whats on stock will be displayed to the customer in the products information page.

This feature can be turned on and off from the admin panel.

 

Tip: Make yourself familliar with the program Beyond Compare!!!

Please, do this! It will make your life easier ;)

 

Good luck with installing and enjoy an new version of QTPro!

 

Best Whishes,

Olof Larsson

 

Download at: http://addons.oscommerce.com/info/888

Share this post


Link to post
Share on other sites

I have a question for you all.

Isn't it a bit strange that if I have QTPro installed and I then go to the admin panel I can alter the quantity for the product through the standard oscommerce page?

 

For example: http://localhost/pretest/admin/categories.php?cPath=1_8&pID=25&action=new_product

 

Lets say that it is a product with no tracked attributes; Then this is allright.

But if that product has tracked attributes; this is all wrong. Only the endstock would be modified and the "real" stock, the one with attributes, would not be modified...

 

Do you see what I mean?

Would it not be a good idea to replace the quantity input field with a link to the stock.php IF the product has any attributes with tracked stock?

 

If this is a good idea I will fix this. :rolleyes:

Share this post


Link to post
Share on other sites

I just found this contribution and it looks perfect for what I need, thank you all that contributed to it.

 

I have a question for you all.

Isn't it a bit strange that if I have QTPro installed and I then go to the admin panel I can alter the quantity for the product through the standard oscommerce page?

 

For example: http://localhost/pretest/admin/categories.php?cPath=1_8&pID=25&action=new_product

 

Lets say that it is a product with no tracked attributes; Then this is allright.

But if that product has tracked attributes; this is all wrong. Only the endstock would be modified and the "real" stock, the one with attributes, would not be modified...

 

Do you see what I mean?

Would it not be a good idea to replace the quantity input field with a link to the stock.php IF the product has any attributes with tracked stock?

 

If this is a good idea I will fix this. :rolleyes:

 

I think that’s a good idea, after all if we have products with attributes we want to know the stock of that attributes not the whole stock, for instance, I can have 2 attributes and 20 products in stock, but all of the 20 belong to the same attribute. I think it’s more useful to know that the attribute A has 20 products in stock and attribute B has none than knowing that I have 20 products in stock.

Share this post


Link to post
Share on other sites
problem qtpro+ paypal ipn v1.0

 

try to merge includes\modules\payment\paypal_ipn.php and checkout_process.php

 

where the start is // Stock Update in paypal_ipn

 

I try to work this out tomorrow.

 

Tom

 

Did you get any where withe the paypal_ipn Tom?

 

Andrew

Share this post


Link to post
Share on other sites

I am able to get most of the function working fine, except:- :-"

 

1. The stats_low_stock_attrib.php show how did not appear in my admin, I have to manually run this report, is this design in this way?

2. This even a bigger issue, after installed, my pricing gone wrong, order one but double the price in order confirmation screen, eg. Product 1 with price tag of $5, when come to order confirmation, it appear $10.00 instead. :'(

a. I have search through the forum on similar issue, such as attributes, value price function, which I initially added, and then now I deleted

b. Currency conversion problem, which I have checked and confirmed no problem at this area as well, where else could affect this?

 

Thanks in advance.

Like this contribution so much, except the minor drawbacks above.

 

Cheers

Share this post


Link to post
Share on other sites
I am able to get most of the function working fine, except:- whistling.gif

 

1. The stats_low_stock_attrib.php show how did not appear in my admin, I have to manually run this report, is this design in this way?

2. This even a bigger issue, after installed, my pricing gone wrong, order one but double the price in order confirmation screen, eg. Product 1 with price tag of $5, when come to order confirmation, it appear $10.00 instead. :'(

a. I have search through the forum on similar issue, such as attributes, value price function, which I initially added, and then now I deleted

b. Currency conversion problem, which I have checked and confirmed no problem at this area as well, where else could affect this?

 

Thanks in advance.

Like this contribution so much, except the minor drawbacks above.

 

Cheers

 

To add the link in admin.

You need to replace this code in your admin>includes>boxes>reports.php

 

<?php
/*
 $Id: reports.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- reports //-->
	  <tr>
		<td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_REPORTS,
				 'link'  => tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, 'selected_box=reports'));

 if ($selected_box == 'reports') {
$contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_STATS_LOW_STOCK_ATTRIB, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_STATS_LOW_STOCK_ATTRIB . '</a>');
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
		</td>
	  </tr>
<!-- reports_eof //-->

Share this post


Link to post
Share on other sites
QT Pro is fantastic. We love it, and use it on a few sites we've built. However, we've run into a new puzzle. We have a customer who sells items in packs of quantities, like 5 pack, 10 pack, 100 pack, 1000 pack.

 

How can we use QT Pro to deal with items of this nature, so, say we have 10,000 of this item, and people order various "packs", they will get dealt with accordingly?

 

Any thoughts on this? I have the same issue/question.

 

Client sells in pkgs 3, 6, 12. Options are Colors. Purchaser should be able to select a color per item in package. So, say Blossom for item 1 in 3-pack, Green for item 2 in 3-pack, White for item 3 in 3-pack.

 

How do I get the stock to track correctly if there are 15 Blossoms in total, 10 Green in total, and 10 White in total in stock? Do we have to set up 9, 36, and 144 combinations?

 

Any help appreciated. Thanks,

Share this post


Link to post
Share on other sites

Hi,

Wondering if anyone can help. I installed QTPro 4.3a on a stock oscommerce 2.2rc2 cart.

 

Everything working, except for one error in admin...

 

when i am inserting a new attribute, as the error message below shows, it's not lifting autoincrement 'products_attributes_id' to put into database.

 

"1366 - Incorrect integer value: '' for column 'products_attributes_id' at row 1

 

insert into products_attributes values ('', '1', '1', '12', '0.0000', '+')

 

[TEP STOP]"

 

 

I can get around it by typing the correct code into the MySQL command line client, but surely there's a better way.

 

Not sure if below is the code that needs altered or not.

 

<?php

$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");

while ($products_values = tep_db_fetch_array($products)) {

echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';

}

?>

 

Thanks for help

Share this post


Link to post
Share on other sites

Issue: QTPro "Track Stock" column not appearing in Product Attribute Page.

 

I have a clothing store and just had QTPro installed.

 

Can anyone help me determine why the "Track Stock?" column is not appearing on my Product Attributes page? I think that this problem may be leading to another problem I'm experiencing: My "Products Stock" page is not showing attibute drop downs to allow me to adjust inventory by attibute. It only allows me adjust inventory by product.

 

Please help! Any advice is greatly appreciated.

Share this post


Link to post
Share on other sites

If your Track Stock not appears look if everything in the admin/ products_attributes.php file and if you imported your sql in the database

Share this post


Link to post
Share on other sites
Issue: QTPro "Track Stock" column not appearing in Product Attribute Page.

 

I have a clothing store and just had QTPro installed.

 

Can anyone help me determine why the "Track Stock?" column is not appearing on my Product Attributes page? I think that this problem may be leading to another problem I'm experiencing: My "Products Stock" page is not showing attibute drop downs to allow me to adjust inventory by attibute. It only allows me adjust inventory by product.

 

Please help! Any advice is greatly appreciated.

 

Replace the code in catalog>admin>product_attributes.php with the code in the next post below.

This will get your Track Stock column working

Edited by Andyy

Share this post


Link to post
Share on other sites

<?php

/*

$Id: products_attributes.php 1776 2008-01-09 20:41:00Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2008 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

$languages = tep_get_languages();

 

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

 

$option_page = (isset($HTTP_GET_VARS['option_page']) && is_numeric($HTTP_GET_VARS['option_page'])) ? $HTTP_GET_VARS['option_page'] : 1;

$value_page = (isset($HTTP_GET_VARS['value_page']) && is_numeric($HTTP_GET_VARS['value_page'])) ? $HTTP_GET_VARS['value_page'] : 1;

$attribute_page = (isset($HTTP_GET_VARS['attribute_page']) && is_numeric($HTTP_GET_VARS['attribute_page'])) ? $HTTP_GET_VARS['attribute_page'] : 1;

 

$page_info = 'option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page;

 

if (tep_not_null($action)) {

switch ($action) {

case 'add_product_options':

$products_options_id = tep_db_prepare_input($HTTP_POST_VARS['products_options_id']);

$option_name_array = $HTTP_POST_VARS['option_name'];

 

for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {

$option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);

//++++ QT Pro: Begin Changed code

$track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;

tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id,products_options_track_stock) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . (int)$track_stock . "')");

//++++ QT Pro: End Changed Code

}

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'add_product_option_values':

$value_name_array = $HTTP_POST_VARS['value_name'];

$value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);

$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

 

for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {

$value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);

 

tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')");

}

 

tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$option_id . "', '" . (int)$value_id . "')");

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'add_product_attributes':

$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);

$values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);

$value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);

$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

 

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");

 

if (DOWNLOAD_ENABLED == 'true') {

$products_attributes_id = tep_db_insert_id();

 

$products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);

$products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);

$products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);

 

if (tep_not_null($products_attributes_filename)) {

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int)$products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')");

}

}

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'update_option_name':

$option_name_array = $HTTP_POST_VARS['option_name'];

$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

 

for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {

$option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);

//++++ QT Pro: Begin Changed code

$track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;

tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_track_stock='" . (int)$track_stock . "',products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

//++++ QT Pro: End Changed Code

}

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'update_value':

$value_name_array = $HTTP_POST_VARS['value_name'];

$value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);

$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

 

for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {

$value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);

 

tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . tep_db_input($value_name) . "' where products_options_values_id = '" . tep_db_input($value_id) . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

}

 

tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " set products_options_id = '" . (int)$option_id . "' where products_options_values_id = '" . (int)$value_id . "'");

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'update_product_attribute':

$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);

$values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);

$value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);

$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

$attribute_id = tep_db_prepare_input($HTTP_POST_VARS['attribute_id']);

 

tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'");

 

if (DOWNLOAD_ENABLED == 'true') {

$products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);

$products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);

$products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);

 

if (tep_not_null($products_attributes_filename)) {

tep_db_query("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_id = '" . (int)$attribute_id . "', products_attributes_filename = '" . tep_db_input($products_attributes_filename) . "', products_attributes_maxdays = '" . tep_db_input($products_attributes_maxdays) . "', products_attributes_maxcount = '" . tep_db_input($products_attributes_maxcount) . "'");

}

}

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'delete_option':

$option_id = tep_db_prepare_input($HTTP_GET_VARS['option_id']);

 

tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$option_id . "'");

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'delete_value':

$value_id = tep_db_prepare_input($HTTP_GET_VARS['value_id']);

 

tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");

tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");

tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . (int)$value_id . "'");

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'delete_attribute':

$attribute_id = tep_db_prepare_input($HTTP_GET_VARS['attribute_id']);

 

tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . (int)$attribute_id . "'");

 

// added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled

tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . (int)$attribute_id . "'");

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

}

}

?>

<!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">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- 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="100%" cellspacing="0" cellpadding="0">

<!-- options and values//-->

<tr>

<td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">

<!-- options //-->

<?php

if ($action == 'delete_product_option') { // delete product option

$options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$HTTP_GET_VARS['option_id'] . "' and language_id = '" . (int)$languages_id . "'");

$options_values = tep_db_fetch_array($options);

?>

<tr>

<td class="pageHeading"> <?php echo $options_values['products_options_name']; ?> </td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<?php

$products = tep_db_query("select p.products_id, pd.products_name, pov.products_options_values_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pov.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_id='" . (int)$HTTP_GET_VARS['option_id'] . "' and pov.products_options_values_id = pa.options_values_id order by pd.products_name");

if (tep_db_num_rows($products)) {

?>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ID; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>

</tr>

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<?php

$rows = 0;

while ($products_values = tep_db_fetch_array($products)) {

$rows++;

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<td align="center" class="smallText"> <?php echo $products_values['products_id']; ?> </td>

<td class="smallText"> <?php echo $products_values['products_name']; ?> </td>

<td class="smallText"> <?php echo $products_values['products_options_values_name']; ?> </td>

</tr>

<?php

}

?>

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<tr>

<td colspan="3" class="main"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>

</tr>

<tr>

<td align="right" colspan="3" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>

</tr>

<?php

} else {

?>

<tr>

<td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>

</tr>

<tr>

<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option&option_id=' . $HTTP_GET_VARS['option_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>

</tr>

<?php

}

?>

</table></td>

</tr>

<?php

} else {

?>

<tr>

<td colspan="3" class="pageHeading"> <?php echo HEADING_TITLE_OPT; ?> </td>

</tr>

<tr>

<td colspan="3" class="smallText" align="right">

<?php

$options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_id";

$options_split = new splitPageResults($option_page, MAX_ROW_LISTS_OPTIONS, $options, $options_query_numrows);

 

echo $options_split->display_links($options_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $option_page, 'value_page=' . $value_page . '&attribute_page=' . $attribute_page, 'option_page');

?>

</td>

</tr>

<tr>

<?php

//++++ QT Pro: Begin Changed code

?>

<td colspan="4"><?php echo tep_black_line(); ?></td>

<?php

//++++ QT Pro: End Changed Code

?>

</tr>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>

 

 

<?php

//++++ QT Pro: Begin Changed code

?>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_TRACK_STOCK; ?> </td>

<?php

//++++ QT Pro: End Changed Code

?>

 

 

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<tr>

<?php

//++++ QT Pro: Begin Changed code

?>

<td colspan="4"><?php echo tep_black_line(); ?></td>

<?php

//++++ QT Pro: End Changed Code

?>

</tr>

<?php

$next_id = 1;

$rows = 0;

$options = tep_db_query($options);

while ($options_values = tep_db_fetch_array($options)) {

$rows++;

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<?php

if (($action == 'update_option') && ($HTTP_GET_VARS['option_id'] == $options_values['products_options_id'])) {

echo '<form name="option" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_name&' . $page_info, 'NONSSL') . '" method="post">';

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

$option_name = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_values['products_options_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");

$option_name = tep_db_fetch_array($option_name);

$inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20" value="' . $option_name['products_options_name'] . '"> <br>';

}

?>

<td align="center" class="smallText"> <?php echo $options_values['products_options_id']; ?><input type="hidden" name="option_id" value="<?php echo $options_values['products_options_id']; ?>"> </td>

<td class="smallText"><?php echo $inputs; ?></td>

 

 

<?php

//++++ QT Pro: Begin Changed code

?>

<td align="center" class="smallText"><input type=checkbox name=track_stock <? echo $options_values['products_options_track_stock']?"checked":""; ?>></td>

<?php

//++++ QT Pro: End Changed Code

?>

 

 

 

<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>

<?php

echo '</form>' . "\n";

} else {

?>

<td align="center" class="smallText"> <?php echo $options_values["products_options_id"]; ?> </td>

<td class="smallText"> <?php echo $options_values["products_options_name"]; ?> </td>

 

<?php

//++++ QT Pro: Begin Changed code

?>

<td align="center" class="smallText"> <?php echo $options_values['products_options_track_stock']?"Yes":"No"; ?></td>

<?php

//++++ QT Pro: End Changed Code

?>

 

<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option&option_id=' . $options_values['products_options_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_option&option_id=' . $options_values['products_options_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>

<?php

}

?>

</tr>

<?php

$max_options_id_query = tep_db_query("select max(products_options_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS);

$max_options_id_values = tep_db_fetch_array($max_options_id_query);

$next_id = $max_options_id_values['next_id'];

}

?>

<tr>

<?php

//++++ QT Pro: Begin Changed code

?>

<td colspan="4"><?php echo tep_black_line(); ?></td>

<?php

//++++ QT Pro: End Changed Code

?>

</tr>

<?php

if ($action != 'update_option') {

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<?php

echo '<form name="options" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_options&' . $page_info, 'NONSSL') . '" method="post"><input type="hidden" name="products_options_id" value="' . $next_id . '">';

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

$inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20"> <br>';

}

?>

<td align="center" class="smallText"> <?php echo $next_id; ?> </td>

<td class="smallText"><?php echo $inputs; ?></td>

 

<?php

//++++ QT Pro: Begin Changed code

?>

<td align="center" ><input type=checkbox name=track_stock></td>

<td align="left" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>

<?php

//++++ QT Pro: End Changed Code

echo '</form>';

?>

</tr>

<tr>

<?php

//++++ QT Pro: Begin Changed code

?>

<td colspan="4"><?php echo tep_black_line(); ?></td>

<?php

//++++ QT Pro: End Changed Code

?>

</tr>

<?php

}

}

?>

</table></td>

<!-- options eof //-->

<td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">

<!-- value //-->

<?php

if ($action == 'delete_option_value') { // delete product option value

$values = tep_db_query("select products_options_values_id, products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$HTTP_GET_VARS['value_id'] . "' and language_id = '" . (int)$languages_id . "'");

$values_values = tep_db_fetch_array($values);

?>

<tr>

<td colspan="3" class="pageHeading"> <?php echo $values_values['products_options_values_name']; ?> </td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<?php

$products = tep_db_query("select p.products_id, pd.products_name, po.products_options_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and po.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_values_id='" . (int)$HTTP_GET_VARS['value_id'] . "' and po.products_options_id = pa.options_id order by pd.products_name");

if (tep_db_num_rows($products)) {

?>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ID; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>

</tr>

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<?php

while ($products_values = tep_db_fetch_array($products)) {

$rows++;

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<td align="center" class="smallText"> <?php echo $products_values['products_id']; ?> </td>

<td class="smallText"> <?php echo $products_values['products_name']; ?> </td>

<td class="smallText"> <?php echo $products_values['products_options_name']; ?> </td>

</tr>

<?php

}

?>

<tr>

<td colspan="3"><?php echo tep_black_line(); ?></td>

</tr>

<tr>

<td class="main" colspan="3"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>

</tr>

<tr>

<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>

</tr>

<?php

} else {

?>

<tr>

<td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>

</tr>

<tr>

<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_value&value_id=' . $HTTP_GET_VARS['value_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>

</tr>

<?php

}

?>

</table></td>

</tr>

<?php

} else {

?>

<tr>

<td colspan="4" class="pageHeading"> <?php echo HEADING_TITLE_VAL; ?> </td>

</tr>

<tr>

<td colspan="4" class="smallText" align="right">

<?php

$values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id where pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_id";

$values_split = new splitPageResults($value_page, MAX_ROW_LISTS_OPTIONS, $values, $values_query_numrows);

 

echo $values_split->display_links($values_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $value_page, 'option_page=' . $option_page . '&attribute_page=' . $attribute_page, 'value_page');

?>

</td>

</tr>

<tr>

<td colspan="4"><?php echo tep_black_line(); ?></td>

</tr>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<tr>

<td colspan="4"><?php echo tep_black_line(); ?></td>

</tr>

<?php

$next_id = 1;

$rows = 0;

$values = tep_db_query($values);

while ($values_values = tep_db_fetch_array($values)) {

$options_name = tep_options_name($values_values['products_options_id']);

$values_name = $values_values['products_options_values_name'];

$rows++;

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<?php

if (($action == 'update_option_value') && ($HTTP_GET_VARS['value_id'] == $values_values['products_options_values_id'])) {

echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_value&' . $page_info, 'NONSSL') . '" method="post">';

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

$value_name = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$values_values['products_options_values_id'] . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

$value_name = tep_db_fetch_array($value_name);

$inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15" value="' . $value_name['products_options_values_name'] . '"> <br>';

}

?>

<td align="center" class="smallText"> <?php echo $values_values['products_options_values_id']; ?><input type="hidden" name="value_id" value="<?php echo $values_values['products_options_values_id']; ?>"> </td>

<td align="center" class="smallText"> <?php echo "\n"; ?><select name="option_id">

<?php

$options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_name");

while ($options_values = tep_db_fetch_array($options)) {

echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '"';

if ($values_values['products_options_id'] == $options_values['products_options_id']) {

echo ' selected';

}

echo '>' . $options_values['products_options_name'] . '</option>';

}

?>

</select> </td>

<td class="smallText"><?php echo $inputs; ?></td>

<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>

<?php

echo '</form>';

} else {

?>

<td align="center" class="smallText"> <?php echo $values_values["products_options_values_id"]; ?> </td>

<td align="center" class="smallText"> <?php echo $options_name; ?> </td>

<td class="smallText"> <?php echo $values_name; ?> </td>

<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_value&value_id=' . $values_values['products_options_values_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option_value&value_id=' . $values_values['products_options_values_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>

<?php

}

$max_values_id_query = tep_db_query("select max(products_options_values_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS_VALUES);

$max_values_id_values = tep_db_fetch_array($max_values_id_query);

$next_id = $max_values_id_values['next_id'];

}

?>

</tr>

<tr>

<td colspan="4"><?php echo tep_black_line(); ?></td>

</tr>

<?php

if ($action != 'update_option_value') {

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<?php

echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_option_values&' . $page_info, 'NONSSL') . '" method="post">';

?>

<td align="center" class="smallText"> <?php echo $next_id; ?> </td>

<td align="center" class="smallText"> <select name="option_id">

<?php

$options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");

while ($options_values = tep_db_fetch_array($options)) {

echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';

}

 

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

$inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15"> <br>';

}

?>

</select> </td>

<td class="smallText"><input type="hidden" name="value_id" value="<?php echo $next_id; ?>"><?php echo $inputs; ?></td>

<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>

<?php

echo '</form>';

?>

</tr>

<tr>

<td colspan="4"><?php echo tep_black_line(); ?></td>

</tr>

<?php

}

}

?>

</table></td>

</tr>

</table></td>

<!-- option value eof //-->

</tr>

<!-- products_attributes //-->

<tr>

<td class="smallText"> </td>

</tr>

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"> <?php echo HEADING_TITLE_ATRIB; ?> </td>

</tr>

</table></td>

</tr>

<tr>

<?php

if ($action == 'update_attribute') {

$form_action = 'update_product_attribute';

} else {

$form_action = 'add_product_attributes';

}

?>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText" align="right">

<?php

$attributes = "select pa.* from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name";

$attributes_split = new splitPageResults($attribute_page, MAX_ROW_LISTS_OPTIONS, $attributes, $attributes_query_numrows);

 

echo $attributes_split->display_links($attributes_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $attribute_page, 'option_page=' . $option_page . '&value_page=' . $value_page, 'attribute_page');

?>

</td>

</tr>

</table>

<form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&' . $page_info); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td colspan="7"><?php echo tep_black_line(); ?></td>

</tr>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>

<td class="dataTableHeadingContent" align="right"> <?php echo TABLE_HEADING_OPT_PRICE; ?> </td>

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?> </td>

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<tr>

<td colspan="7"><?php echo tep_black_line(); ?></td>

</tr>

<?php

$next_id = 1;

$attributes = tep_db_query($attributes);

while ($attributes_values = tep_db_fetch_array($attributes)) {

$products_name_only = tep_get_products_name($attributes_values['products_id']);

$options_name = tep_options_name($attributes_values['options_id']);

$values_name = tep_values_name($attributes_values['options_values_id']);

$rows++;

?>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<?php

if (($action == 'update_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {

?>

<td class="smallText"> <?php echo $attributes_values['products_attributes_id']; ?><input type="hidden" name="attribute_id" value="<?php echo $attributes_values['products_attributes_id']; ?>"> </td>

<td class="smallText"> <select name="products_id">

<?php

$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");

while($products_values = tep_db_fetch_array($products)) {

if ($attributes_values['products_id'] == $products_values['products_id']) {

echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '" SELECTED>' . $products_values['products_name'] . '</option>';

} else {

echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';

}

}

?>

</select> </td>

<td class="smallText"> <select name="options_id">

<?php

$options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");

while($options_values = tep_db_fetch_array($options)) {

if ($attributes_values['options_id'] == $options_values['products_options_id']) {

echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '" SELECTED>' . $options_values['products_options_name'] . '</option>';

} else {

echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';

}

}

?>

</select> </td>

<td class="smallText"> <select name="values_id">

<?php

$values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id ='" . $languages_id . "' order by products_options_values_name");

while($values_values = tep_db_fetch_array($values)) {

if ($attributes_values['options_values_id'] == $values_values['products_options_values_id']) {

echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '" SELECTED>' . $values_values['products_options_values_name'] . '</option>';

} else {

echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';

}

}

?>

</select> </td>

<td align="right" class="smallText"> <input type="text" name="value_price" value="<?php echo $attributes_values['options_values_price']; ?>" size="6"> </td>

<td align="center" class="smallText"> <input type="text" name="price_prefix" value="<?php echo $attributes_values['price_prefix']; ?>" size="2"> </td>

<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>

<?php

if (DOWNLOAD_ENABLED == 'true') {

$download_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount

from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "

where products_attributes_id='" . $attributes_values['products_attributes_id'] . "'";

$download_query = tep_db_query($download_query_raw);

if (tep_db_num_rows($download_query) > 0) {

$download = tep_db_fetch_array($download_query);

$products_attributes_filename = $download['products_attributes_filename'];

$products_attributes_maxdays = $download['products_attributes_maxdays'];

$products_attributes_maxcount = $download['products_attributes_maxcount'];

}

?>

<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">

<td> </td>

<td colspan="5">

<table>

<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?> </td>

</tr>

</table>

</td>

<td> </td>

</tr>

<?php

}

?>

<?php

} elseif (($action == 'delete_product_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {

?>

<td class="smallText"> <b><?php echo $attributes_values["products_attributes_id"]; ?></b> </td>

<td class="smallText"> <b><?php echo $products_name_only; ?></b> </td>

<td class="smallText"> <b><?php echo $options_name; ?></b> </td>

<td class="smallText"> <b><?php echo $values_name; ?></b> </td>

<td align="right" class="smallText"> <b><?php echo $attributes_values["options_values_price"]; ?></b> </td>

<td align="center" class="smallText"> <b><?php echo $attributes_values["price_prefix"]; ?></b> </td>

<td align="center" class="smallText"> <b><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_attribute&attribute_id=' . $HTTP_GET_VARS['attribute_id'] . '&' . $page_info) . '">'; ?><?php echo tep_image_button('button_confirm.gif', IMAGE_CONFIRM); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </b></td>

<?php

} else {

?>

<td class="smallText"> <?php echo $attributes_values["products_attributes_id"]; ?> </td>

<td class="smallText"> <?php echo $products_name_only; ?> </td>

<td class="smallText"> <?php echo $options_name; ?> </td>

<td class="smallText"> <?php echo $values_name; ?> </td>

<td align="right" class="smallText"> <?php echo $attributes_values["options_values_price"]; ?> </td>

<td align="center" class="smallText"> <?php echo $attributes_values["price_prefix"]; ?> </td>

<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>

<?php

}

$max_attributes_id_query = tep_db_query("select max(products_attributes_id) + 1 as next_id from " . TABLE_PRODUCTS_ATTRIBUTES);

$max_attributes_id_values = tep_db_fetch_array($max_attributes_id_query);

$next_id = $max_attributes_id_values['next_id'];

?>

</tr>

<?php

}

if ($action != 'update_attribute') {

?>

<tr>

<td colspan="7"><?php echo tep_black_line(); ?></td>

</tr>

<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">

<td class="smallText"> <?php echo $next_id; ?> </td>

<td class="smallText"> <select name="products_id">

<?php

$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");

while ($products_values = tep_db_fetch_array($products)) {

echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';

}

?>

</select> </td>

<td class="smallText"> <select name="options_id">

<?php

$options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");

while ($options_values = tep_db_fetch_array($options)) {

echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';

}

?>

</select> </td>

<td class="smallText"> <select name="values_id">

<?php

$values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id = '" . $languages_id . "' order by products_options_values_name");

while ($values_values = tep_db_fetch_array($values)) {

echo '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';

}

?>

</select> </td>

<td align="right" class="smallText"> <input type="text" name="value_price" size="6"> </td>

<td align="right" class="smallText"> <input type="text" name="price_prefix" size="2" value="+"> </td>

<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>

</tr>

<?php

if (DOWNLOAD_ENABLED == 'true') {

$products_attributes_maxdays = DOWNLOAD_MAX_DAYS;

$products_attributes_maxcount = DOWNLOAD_MAX_COUNT;

?>

<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">

<td> </td>

<td colspan="5">

<table>

<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?> </td>

<td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>

<td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?> </td>

</tr>

</table>

</td>

<td> </td>

</tr>

<?php

} // end of DOWNLOAD_ENABLED section

?>

<?php

}

?>

<tr>

<td colspan="7"><?php echo tep_black_line(); ?></td>

</tr>

</table></form></td>

</tr>

</table></td>

<!-- products_attributes_eof //-->

</tr>

</table>

<!-- body_text_eof //-->

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

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

Edited by Andyy

Share this post


Link to post
Share on other sites

Thanks for your suggestions Klerk & Andrew.

 

Forgive me, I'm a newbie and I must ask a few questions.

 

I should have stated this earlier but my version is 2.2 rc1 and the QTPro version is 4.1. Will this copy & paste fix work with any version of QTPro?

 

And will this this copy & paste fix work with any version of oscommerce?

Share this post


Link to post
Share on other sites
Thanks for your suggestions Klerk & Andrew.

 

Forgive me, I'm a newbie and I must ask a few questions.

 

I should have stated this earlier but my version is 2.2 rc1 and the QTPro version is 4.1. Will this copy & paste fix work with any version of QTPro?

 

And will this this copy & paste fix work with any version of oscommerce?

 

 

Just for this file - yes it is compatable

Andrew

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

×