Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

In the current version, one can still post the URL and get a hidden category...

 

As well it would be great to have a possibility to switch all products in one category at once on / off for a customergroup.

If I hide a category, I must hide the products in it as well, otherwise all other boxes (products_new.php, product_listing.php, best_sellers.php...) still show the products.

Link to comment
Share on other sites

G?tz,

In the current version, one can still post the URL and get a hidden category...
Yes, that is right.
As well it would be great to have a possibility to switch all products in one category at once on / off for a customergroup.

If I hide a category, I must hide the products in it as well, otherwise all other boxes (products_new.php, product_listing.php, best_sellers.php...) still show the products.

That is the idea, but it means going through all the files and make the changes similar to enable/disable categories and the hide products mod. Then documenting them in an install file, try it on a fresh SPPC install old version. Then do it again on the November 13 update and put a package together with update instructions for the old version and for a new install. It takes a bit of time :D

 

I took your code for the buttons. It is a nice touch (although it means you cannot really install only the categories hide code otherwise the hide column when you see the products in a category does not make sense anymore). I did change to another icon (downloaded one from a website), a black tick in a box because I think the red button will be confusing. The alt and title text of the image will say the groups the product or category is hidden from. Also a nice touch I thought.

Link to comment
Share on other sites

I'm not sure this has to do with SPPC, but when inserting and modifying products in admin it shows a price of 0 in "Categories / Products" (under the product picture in the right column) and in "preview mode". Prices are ok in products page in admin though. I'm only using one group (retail) at the moment.

 

I think the prices gets 0 in the shop _sometimes_ too.. strange.

Edited by Fredrik.r
Link to comment
Share on other sites

Has anyone reworked the "Quick Stock Updater" Contribution to include the additional groups set up with SPPC?

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

Hi great contribution thanks.

 

One question?

 

Is it possible to have two groups - members and non-members, but with a twist. I want to have some products just available for the members group only and not available to the non-members group.

 

Is this possible?

 

TIA

Link to comment
Share on other sites

Hey guys,

I installed SPPC V413 and it seemed to all go smoothly. I used Compare and Edit and all the MAJOR parts are functioning. However in playing with things I've noticed I've got errors when I do a couple things. I'm thinking it's something simple I mixed up and was hoping for some insight. When I try to select a manufacturer to see products I get the following error:

 

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '13'

 

[TEP STOP]

 

When searching using Quick Find for say the brand Antec, I get:

 

1066 - Not unique table/alias: 'pd'

 

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%antec%' or p.products_model like '%antec%' or m.manufacturers_name like '%antec%') )

 

[TEP STOP]

 

And I also get a similar error when using the advanced search. Any ideas? I'd be happy to post code if I knew where the source of the problem was.

Link to comment
Share on other sites

When I try to select a manufacturer to see products I get the following error:

 

1054 - Unknown column 'p.products_id' in 'on clause'

I'm quite certain that it is a MySQL 5 thing. SPPC hasn't been upgraded yet to the November 13 update.

 

From my experiments with MySQL 5, that I upgraded to recently I think the listing_sql's on index.php need to be changed to (starts around line 205):

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// BOF Separate Pricing Per Customer
if ($status_product_prices_table == true) { // ok in mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd , " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";		
} else { // either retail or no need to get correct special prices -- changed for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
  } else {
// We show them all
// BOF Separate Pricing Per Customer
	if ($status_product_prices_table == true) { // ok in mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";	
} else { // either retail or no need to get correct special prices -- changed for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory;  
// BOF Separate Pricing Per Customer
	if ($status_product_prices_table == true) { // ok for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";	
	} else { // either retail or no need to get correct special prices -- ok in mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	} // end else { // either retail...
// EOF Separate Pricing Per Customer
  } else {
// We show them all
// BOF Separate Pricing Per Customer --last query changed for mysql 5 compatibility
	if ($status_product_prices_table == true) {
// original, no need to change for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	} else { // either retail or no need to get correct special prices -- changed for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; 
  } // end else { // either retail...
// EOF Separate Pricing per Customer

and the advanced_search_result.php (starts around 258) from:

	  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";		  
  }
 // EOF Separate Pricing Per Customer
 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

to:

	  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";		  
  }
 // EOF Separate Pricing Per Customer
 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }
 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

Link to comment
Share on other sites

I did that, now I'm able to use the manufacturers box but the quick find and advanced search are still acting up. When I quick find I get:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1

 

from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20

 

[TEP STOP]

 

 

Array

(

[0] => Array

(

[file] => C:\web\catalog\includes\functions\database.php

[line] => 45

[function] => tep_db_error

[args] => Array

(

[0] => from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20

[1] => 1064

[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1

)

 

)

 

[1] => Array

(

[file] => C:\web\catalog\includes\modules\product_listing.php

[line] => 77

[function] => tep_db_query

[args] => Array

(

[0] => from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20

)

 

)

 

[2] => Array

(

[file] => C:\web\catalog\advanced_search_result.php

[line] => 391

[args] => Array

(

[0] => C:\web\catalog\includes\modules\product_listing.php

)

 

[function] => require

)

 

)

 

the error on advanced search is the same. Do I have something that needs to be added to the SQL database?

 

I'm quite certain that it is a MySQL 5 thing. SPPC hasn't been upgraded yet to the November 13 update.

 

From my experiments with MySQL 5, that I upgraded to recently I think the listing_sql's on index.php need to be changed to (starts around line 205):

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// BOF Separate Pricing Per Customer
if ($status_product_prices_table == true) { // ok in mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd , " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";		
} else { // either retail or no need to get correct special prices -- changed for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
  } else {
// We show them all
// BOF Separate Pricing Per Customer
	if ($status_product_prices_table == true) { // ok in mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";	
} else { // either retail or no need to get correct special prices -- changed for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory;  
// BOF Separate Pricing Per Customer
	if ($status_product_prices_table == true) { // ok for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";	
	} else { // either retail or no need to get correct special prices -- ok in mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	} // end else { // either retail...
// EOF Separate Pricing Per Customer
  } else {
// We show them all
// BOF Separate Pricing Per Customer --last query changed for mysql 5 compatibility
	if ($status_product_prices_table == true) {
// original, no need to change for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
	} else { // either retail or no need to get correct special prices -- changed for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; 
  } // end else { // either retail...
// EOF Separate Pricing per Customer

and the advanced_search_result.php (starts around 258) from:

	  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";		  
  }
 // EOF Separate Pricing Per Customer
 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

to:

	  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";		  
  }
 // EOF Separate Pricing Per Customer
 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }
 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

Link to comment
Share on other sites

I did that, now I'm able to use the manufacturers box but the quick find and advanced search are still acting up. When I quick find I get:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1

 

from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%benq%' or p.products_model like '%benq%' or m.manufacturers_name like '%benq%') ) order by pd.products_name limit 0, 20

Haven't you replaced a bit too much code in advanced_search_results.php with the new code? I miss the whole select
Link to comment
Share on other sites

DOH, makes much more sense the morning after. Thanks Janz, you are my hero!

 

 

Haven't you replaced a bit too much code in advanced_search_results.php with the new code? I miss the whole select
  1. : "
select blah blah from products p left join manufacturers m blah blah" in the error message.
Link to comment
Share on other sites

Hi, I have read this problem elsewhere, regarding when, in the admin console, I want to change the status of the customer from, for example 'retail' to wholesale' (in the customer.php file). I get the error message:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in.....admin/includes/functions/database.php on line 99

 

is there any way in which I can get a more detailed error message? From what I have read, this error comes about when a table is maybe misspelt, etc. I cant for the life of me see where the problem is.

 

This has kept me up for about 3 hours and now I have given in. I dont normally post problems and I normally solve them, but this has got me. Please, can anyone help me?

 

Thanks,

Luke

ps off to bed now by leave a message here and i will get back to it after me brain has 'slept on it'

Link to comment
Share on other sites

Look for line 99 in admin/includes/functions/database.php and let us know what is there.

 

this is what comes up:

 

return mysql_fetch_array($db_query, MYSQL_ASSOC);

 

any clues???

 

Thanks, Luke Ray

Link to comment
Share on other sites

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in.....admin/includes/functions/database.php on line 99
IMHO this is an error caused by code outputting results of a query, where the query hasn't been executed. Did you manually add the SPPC code to customers.php? Else try the one from the package. If you have other contributions added to customers.php it might be faster to add them to the SPPC one from the package.
Link to comment
Share on other sites

Hello Again!

 

Thought I would give this problem one more kick at the cat. The error is:

 

The first error is this one,

1062 - Duplicate entry '2-0' for key 1

 

insert into products_groups (customers_group_id, customers_group_price, products_id) values ('2', '5488.7100', '0')

 

[TEP STOP]

It occurs when I try to copy.

 

 

The problem is that the only way I can copy a product is to do the following:

 

1) Successfully copy 1 product.

2) open the database and alter table_products_to_catagories by giving the new listing a products_id number manually, otherwise it will be "0". Then I go to the products_groups and change the products_id there from "0" to the manually assigned number I gave it in the other table e.g. 184.

3) Then I can go back to the catagories in admin and copy another product. And so on and so on and so on.

 

This is becoming a bit much.

 

The problem then is that the store writes a product id of "0" to the two tables used with SPPC. Any thoughts, I know I posted a similar topic earlier, but it is starting to hurt without a fix.

 

Rod

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

The problem is that the only way I can copy a product is to do the following:

 

1) Successfully copy 1 product.

2) open the database and alter table_products_to_catagories by giving the new listing a products_id number manually, otherwise it will be "0". Then I go to the products_groups and change the products_id there from "0" to the manually assigned number I gave it in the other table e.g. 184.

3) Then I can go back to the catagories in admin and copy another product. And so on and so on and so on.

 

This is becoming a bit much.

 

The problem then is that the store writes a product id of "0" to the two tables used with SPPC. Any thoughts, I know I posted a similar topic earlier, but it is starting to hurt without a fix.

Well, I'm almost 100% sure it has totally nothing to do with SPPC because before Infobroker added some code in that part it wasn't touched by SPPC. Judging from the debug info you gave it looks like the insertion of code into the table products goes without problems (you don't mention that, I hope the number you add manually is the products_id of the copied product). You also don't mention whether or not the insertion of the description goes well or not (it uses the new products_id: $dup_products_id = tep_db_insert_id(); also). And then suddenly (?) the tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')"); uses a products_id of zero. That's not logical.

 

You probably did something wrong when you added the code for that other contribution, but unless you post of the code of "case 'copy_to_confirm':" (starts around line 304 till about line 360, "case 'new_product_preview':") we are left to mind-reading or telepathy to get an inkling of what you did wrong. Alas, I'm capable of neither (and I assume most people on this forum).

Link to comment
Share on other sites

Well, I'm almost 100% sure it has totally nothing to do with SPPC because before Infobroker added some code in that part it wasn't touched by SPPC. Judging from the debug info you gave it looks like the insertion of code into the table products goes without problems (you don't mention that, I hope the number you add manually is the products_id of the copied product). You also don't mention whether or not the insertion of the description goes well or not (it uses the new products_id: $dup_products_id = tep_db_insert_id(); also). And then suddenly (?) the tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')"); uses a products_id of zero. That's not logical.

 

You probably did something wrong when you added the code for that other contribution, but unless you post of the code of "case 'copy_to_confirm':" (starts around line 304 till about line 360, "case 'new_product_preview':") we are left to mind-reading or telepathy to get an inkling of what you did wrong. Alas, I'm capable of neither (and I assume most people on this forum).

 

Sorry, I posted very late in the night. Was to tired to post right.

If I may...

 

I believe the problem is because of the contribution Mass Move & Copy, the file I downloaded was called "multiple_categories_0_5_1.zip", it puts changes in the area we are discussing in(Admin>catagories.php). I also have changes for "Bundled Products" in the same spot and SPPC as well. I guess I have messed it up.

 

Here is the peice of code as I have it now;

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

$products_id = tep_db_insert_id();

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

} elseif ($action == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

//#delete categories saved in the tables

tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'");

}

 

//# create loop here to insert rows for multiple categories

$selected_catids = $HTTP_POST_VARS['categories_ids'];

if ($selected_catids)

{

foreach ($selected_catids as $current_category_id)

{

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");

}

}

 

 

// BOF Separate Pricing Per Customer

$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");

while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups

{

$attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");

$attributes = tep_db_fetch_array($attributes_query);

if (tep_db_num_rows($attributes_query) > 0) {

if ($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked

if ( ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] <> $attributes['customers_group_price']) && ($attributes['customers_group_id'] == $customers_group['customers_group_id']) ) {

tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " set customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "' where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

elseif (($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] == $attributes['customers_group_price'])) {

$attributes = tep_db_fetch_array($attributes_query);

}

}

else {

tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customers_group['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

}

elseif (($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) && ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] != '')) {

tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (products_id, customers_group_id, customers_group_price) values ('" . $products_id . "', '" . $customers_group['customers_group_id'] . "', '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "')");

$attributes = tep_db_fetch_array($attributes_query);

}

 

}

// EOF Separate Pricing Per Customer

 

// update bundle contents

if ($HTTP_POST_VARS['products_bundle'] == "yes") {

tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'");

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

if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) {

tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')");

}

}

}

 

$languages = tep_get_languages();

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

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_id' => $products_id,

'language_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_product') {

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

The Bundles contribution had asked me to do the following to admin>catagories.php;

(The result is included in the code above)

 

--In /catalog/admin/categories.php

582 <tr>

583 <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>

584 <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>

585 </tr>

--after line 585

<!-- start bundle mod -->

<tr bgcolor="#EEEEEE">

<td class="main" valign="top">

<?php echo TEXT_PRODUCTS_BUNDLE; ?>

</td>

<td class="main" valign="top">

<table>

<tr>

<td class="main" valign="top">

<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . tep_draw_input_field('products_bundle', $pInfo->products_bundle) . '<br>("yes" or blank)'; ?>

</td>

<td class="main" valign="top">

<script language="javascript"><!--

function fillCodes() {

for (var n=0;n<6;n++) {

var this_subproduct_id = eval("document.new_product.subproduct_" + n + "_id")

var this_subproduct_name = eval("document.new_product.subproduct_" + n + "_name")

var this_subproduct_qty = eval("document.new_product.subproduct_" + n + "_qty")

if (this_subproduct_id.value == "") {

this_subproduct_id.value = document.new_product.subproduct_selector.value

this_subproduct_qty.value = "1"

var name = document.new_product.subproduct_selector[document.new_product.subproduct_selecto

r.selectedIndex].name

this_subproduct_name.value = name

document.returnValue = true;

return true;

}

}

}

 

function clearSubproduct(n) {

var this_subproduct_id = eval("document.new_product.subproduct_" + n + "_id");

var this_subproduct_name = eval("document.new_product.subproduct_" + n + "_name");

var this_subproduct_qty = eval("document.new_product.subproduct_" + n + "_qty");

this_subproduct_id.value = "";

this_subproduct_name.value = "";

this_subproduct_qty.value = "";

}

//--></script>

<?php

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

echo "\n" . '<input type="text" size="30" name="subproduct_' . $i . '_name" value="' . $bundle_array[$i]['name'] . '">';

echo "\n" . '<input type="text" size="3" name="subproduct_' . $i . '_id" value="' . $bundle_array[$i]['id'] . '">';

echo "\n" . '<input type="text" size="2" name="subproduct_' . $i . '_qty" value="' . $bundle_array[$i]['qty'] . '">';

echo "\n" . '<a href="java script:clearSubproduct(' . $i . ')">[x]</a><br>';

}

echo 'add : <select name="subproduct_selector" onChange="fillCodes()">';

echo '<option name="null" value="" SELECTED></option>';

$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 . "' and p.products_id <> '" . $HTTP_GET_VARS['pID'] . "' order by pd.products_name");

 

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

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

}

echo '</select>';

?>

</td>

</tr>

</table>

</td>

</tr>

<!-- end bundle mod -->

----------------------------------------------

--replace this section beginning at line 377

377 if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {

378 $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

379 $product = tep_db_fetch_array($product_query);

380

381 $pInfo->objectInfo($product);

382 } elseif (tep_not_null($HTTP_POST_VARS)) {

383 $pInfo->objectInfo($HTTP_POST_VARS);

384 $products_name = $HTTP_POST_VARS['products_name'];

385 $products_description = $HTTP_POST_VARS['products_description'];

386 $products_url = $HTTP_POST_VARS['products_url'];

387 }

--with:

if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {

$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_bundle from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product = tep_db_fetch_array($product_query);

$pInfo->objectInfo($product);

} elseif (tep_not_null($HTTP_POST_VARS)) {

$pInfo->objectInfo($HTTP_POST_VARS);

$products_name = $HTTP_POST_VARS['products_name'];

$products_description = $HTTP_POST_VARS['products_description'];

$products_url = $HTTP_POST_VARS['products_url'];

}

if (isset($pInfo->products_bundle) && $pInfo->products_bundle == "yes") {

// this product is a bundle so get contents data

$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, pd.products_name FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd INNER JOIN " . TABLE_PRODUCTS_BUNDLES . " pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = '" . $HTTP_GET_VARS['pID'] . "' and language_id = '" . (int)$languages_id . "'");

while ($bundle_contents = tep_db_fetch_array($bundle_query)) {

$bundle_array[] = array('id' => $bundle_contents['subproduct_id'],

'qty' => $bundle_contents['subproduct_qty'],

'name' => $bundle_contents['products_name']);

}

}

----------------------------------------------

--and

358 $parameters = array('products_name' => '',

--after line 358 insert:

'products_bundle' => '',

----------------------------------------------

242 tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

243 }

--after line 243 insert:

// update bundle contents

if ($HTTP_POST_VARS['products_bundle'] == "yes") {

tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'");

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

if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) {

tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')");

}

}

}

----------------------------------------------

215 $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

--after line 215 insert:

'products_bundle' => tep_db_prepare_input($HTTP_POST_VARS['products_bundle']),

******************************************************

 

Then the Mass Move & Copy contribution asked me to do the following to it. This is where I think I messed it up;

 

1. catalog/admin/categories.php

###############################

 

# 1.

# After:

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

$products_id = tep_db_insert_id();

 

 

# Delete:

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

 

# 2.

# Replace:

} elseif ($action == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

}

# With:

} elseif ($action == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

#delete categories saved in the tables

tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'");

}

 

# create loop here to insert rows for multiple categories

$selected_catids = $HTTP_POST_VARS['categories_ids'];

if ($selected_catids)

{

foreach ($selected_catids as $current_category_id)

{

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");

}

}

 

# 3.

# Add:

# get selected categories

$categories_query_selected = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $HTTP_GET_VARS['pID'] . "'");

$categories_array_selected = array(array('id' => ''));

while ($categories = tep_db_fetch_array($categories_query_selected)) {

$categories_array_selected[] = array('id' => $categories['categories_id']);

}

 

$categories_array = array(array('id' => '', 'text' => TEXT_NONE));

#Categories list displays only for one languge (Deafault is English)

$language_id = 1;

$categories_array = tep_get_category_tree();

 

# After:

$manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {

$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],

'text' => $manufacturers['manufacturers_name']);

}

 

# 4.

# Add:

<tr>

<td class="main" valign="top"><?php echo TEXT_CATEGORIES; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_mselect_menu('categories_ids[]', $categories_array, $categories_array_selected, 'size=10'); ?></td>

</tr>

# After:

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>

</tr>

 

# 5.

# Add.

$selected_catids = $HTTP_POST_VARS['categories_ids'];

if ($selected_catids){

foreach($selected_catids as $selected_catid) {

echo tep_draw_hidden_field('categories_ids[]', $selected_catid);

}

}

 

# After:

$form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product';

 

echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

So there it is, for all the world to see. I hope it is salvagable.

 

This last segment of code contains the two areas you noted so pointedly (sorry), and the whole area in question. I hope I did this post right.

 

Rod

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

$products_id = tep_db_insert_id();

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

} elseif ($action == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

//#delete categories saved in the tables

tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'");

}

 

//# create loop here to insert rows for multiple categories

$selected_catids = $HTTP_POST_VARS['categories_ids'];

if ($selected_catids)

{

foreach ($selected_catids as $current_category_id)

{

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");

}

}

 

 

// BOF Separate Pricing Per Customer

$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");

while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups

{

$attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");

$attributes = tep_db_fetch_array($attributes_query);

if (tep_db_num_rows($attributes_query) > 0) {

if ($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked

if ( ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] <> $attributes['customers_group_price']) && ($attributes['customers_group_id'] == $customers_group['customers_group_id']) ) {

tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " set customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "' where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

elseif (($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] == $attributes['customers_group_price'])) {

$attributes = tep_db_fetch_array($attributes_query);

}

}

else {

tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customers_group['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

}

elseif (($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) && ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] != '')) {

tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (products_id, customers_group_id, customers_group_price) values ('" . $products_id . "', '" . $customers_group['customers_group_id'] . "', '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "')");

$attributes = tep_db_fetch_array($attributes_query);

}

 

}

// EOF Separate Pricing Per Customer

 

// update bundle contents

if ($HTTP_POST_VARS['products_bundle'] == "yes") {

tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'");

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

if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) {

tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')");

}

}

}

 

$languages = tep_get_languages();

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

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_id' => $products_id,

'language_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_product') {

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

}

break;

case 'copy_to_confirm':

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

 

 

// BOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker

 

$cg_price_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' order by customers_group_id");

 

// insert customer group prices in table products_groups when there are any for the copied product

if (tep_db_num_rows($cg_price_query) > 0) {

while ( $cg_prices = tep_db_fetch_array($cg_price_query)) {

tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (customers_group_id, customers_group_price, products_id) values ('" . (int)$cg_prices['customers_group_id'] . "', '" . tep_db_input($cg_prices['customers_group_price']) . "', '" . (int)$dup_products_id . "')");

} // end while ( $cg_prices = tep_db_fetch_array($cg_price_query))

} // end if (tep_db_num_rows($cg_price_query) > 0)

 

// EOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker

if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {

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

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

 

if ($HTTP_POST_VARS['copy_as'] == 'link') {

if ($categories_id != $current_category_id) {

$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");

}

} else {

$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');

}

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

// BOF MaxiDVD: Modified For Ultimate Images Pack!

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_tax_class_id, manufacturers_id, products_sort_order from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$product = tep_db_fetch_array($product_query);

 

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6,products_price, products_date_added, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id, products_sort_order) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '" . tep_db_input($product['products_dim_type']) . "', '" . tep_db_input($product['products_weight_type']) . "', '" . tep_db_input($product['products_length']) . "', '" . tep_db_input($product['products_width']) . "', '" . tep_db_input($product['products_height']) . "', '" . tep_db_input($product['products_ready_to_ship']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "', '" . (int)$product['products_sort_order'] . "')");

// BOF MaxiDVD: Modified For Ultimate Images Pack!

$dup_products_id = tep_db_insert_id();

 

$description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

while ($description = tep_db_fetch_array($description_query)) {

tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

}

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

$products_id = $dup_products_id;

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));

break;

 

// BOF MaxiDVD: Modified For Ultimate Images Pack!

case 'new_product_preview':

// copy image only if modified

if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {

$products_image = '';

$products_image_name = '';

} elseif (WYSIWYG_USE_PHP_IMAGE_MANAGER == 'Disable') {

$products_image = new upload('products_image');

$products_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_image->parse() && $products_image->save()) {

$products_image_name = $products_image->filename;

} else {

$products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

}

} else {

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

$products_image_name = $HTTP_POST_VARS['products_image'];

} else {

$products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

}

}

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

Forgot to add; those products I added manually where not the copied products_id, I made up some new ones, 184-190. I guess that was bad to. Will I need to redo them? They seem to show up in the store view OK, but they problably won't work right when I go live,.....right?

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

Forgot to add; those products I added manually where not the copied products_id, I made up some new ones, 184-190. I guess that was bad to. Will I need to redo them? They seem to show up in the store view OK, but they problably won't work right when I go live,.....right?
Perhaps you were lucky, but the idea of a database is that you store information in different tables (Excel spreadsheets if you like) and you pull information from them by connecting those tables. So if you have information on prices in one table for a product that has products_id 184 and a description of it in another table and the information on which category this product belongs to in yet another it is vital that the products_id in all those tables is the same. How else do you know how to get information on a certain product from all these different tables?

 

I looked at that mess you made of putting all those contributions in your categories.php (Mass Move & Copy wasn't one of them by the way) and saw you moved code that was on the bottom (the insertion in products_to_categories) to the top. Hence the products_id zero. This is how it should have been:

case 'copy_to_confirm':
if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

if ($HTTP_POST_VARS['copy_as'] == 'link') {
if ($categories_id != $current_category_id) {
$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
$check = tep_db_fetch_array($check_query);
if ($check['total'] < '1') {
tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
}
} else {
$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
}
} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
// BOF MaxiDVD: Modified For Ultimate Images Pack!
$product_query = tep_db_query("select products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_tax_class_id, manufacturers_id, products_sort_order from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6,products_price, products_date_added, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id, products_sort_order) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '" . tep_db_input($product['products_dim_type']) . "', '" . tep_db_input($product['products_weight_type']) . "', '" . tep_db_input($product['products_length']) . "', '" . tep_db_input($product['products_width']) . "', '" . tep_db_input($product['products_height']) . "', '" . tep_db_input($product['products_ready_to_ship']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "', '" . (int)$product['products_sort_order'] . "')");
// BOF MaxiDVD: Modified For Ultimate Images Pack!
$dup_products_id = tep_db_insert_id();

$description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
while ($description = tep_db_fetch_array($description_query)) {
tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
}

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

// BOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker
  $cg_price_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' order by customers_group_id");

// insert customer group prices in table products_groups when there are any for the copied product
if (tep_db_num_rows($cg_price_query) > 0) {
  while ( $cg_prices = tep_db_fetch_array($cg_price_query)) {
	tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (customers_group_id, customers_group_price, products_id) values ('" . (int)$cg_prices['customers_group_id'] . "', '" . tep_db_input($cg_prices['customers_group_price']) . "', '" . (int)$dup_products_id . "')");
  } // end while ( $cg_prices = tep_db_fetch_array($cg_price_query))
} // end if (tep_db_num_rows($cg_price_query) > 0)

// EOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker
$products_id = $dup_products_id;
}

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
}
}

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
break;

// BOF MaxiDVD: Modified For Ultimate Images Pack!

Do yourself a big favor and read a beginners book on PHP and MySQL. This adding in contributions without a clue about PHP and MySQL is going to bite you big time. It will be well worth the investment.

Link to comment
Share on other sites

Do yourself a big favor and read a beginners book on PHP and MySQL. This adding in contributions without a clue about PHP and MySQL is going to bite you big time. It will be well worth the investment.

 

 

 

Thanks JanZ, I just hired somebody to fix all my other problems. I will read the books while he fixes things. Sorry for the time you had taken out on my newbieness (not a real word).

 

 

 

Very greatful for your support,

 

Rod

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

:blush: ......and,

 

 

 

I installed your code changes and it worked nicely.

 

 

 

Hat in hands,

 

Thank-you,

 

Rod

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

Hi,

I am having some difficulties to apply changes of SPPC to new_products.php. This file is not like the default osc file. Here's my new_products.php:

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

*/
?>
<!-- new_products //-->

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => TABLE_HEADING_NEW_PRODUCTS);
  new infoBoxHeadingProduct($info_box_contents,true,true,100);

//  new contentBoxHeading($info_box_contents);
?>
<?php 
 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 65);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

if  ( ($col == 1 && $row == 0) || ($col == 1 && $row == 2) ){
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'width="1" height="100%" valign="middle"',
									   'text' => '<table height="115" width="100%" background="'.DIR_WS_IMAGES .'m_vert.jpg" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td><div style="width:1px"></div></td>
 </tr>
</table>');
}
elseif (($col == 0 && $row == 1) || ($col == 2 && $row == 1)) {
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'height="1"',
									   'text' => '<table width="90%" background="'.DIR_WS_IMAGES .'m_horizontal.jpg" border="0" cellspacing="0" cellpadding="0" >
 <tr>
<td></td>
 </tr>
</table>');
}
elseif ($col == 1 && $row == 1) {
$info_box_contents[$row][$col] = array('align' => '',
									   'params' => '',
									   'text' => '?');
}
else {	

  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'width="50%" class="main" valign="top"',
									   'text' => '
									   <table width=100% cellpadding=0 cellspacing=0 border=0>
														 <tr>
																 <td height="19px">'.$new_products['products_name'].'</td>
														 </tr>
											<tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%">
														   <tr><td>
												 <a href="'. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) .'">'. tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="center"') . '
												 </a>
															 </td></tr>
															 <tr><td>
																	 <span style="font:bold 13px Tahoma, Verdana, Arial, Helvetica, sans-serif;color:red; border-top:7px solid #ffffff; border-bottom:7px solid #ffffff;">'. $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'
																	 </span>
															 </td>

															 </tr>
															 <tr><td colspan="2" class="main" valign="top">
																	 <table width="90%"  border="0" cellspacing="0" cellpadding="0" valign="bottom">
																				  <tr>
																					<td align="CENTER">
																						<div>'.tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'
																						  <a class="buy" href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'" style="text-decoration:none;">
																							 Details
																						  </a><img src="images/razdelitel.gif">
																						  '. tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('add_to_cart.gif', IMAGE_BUTTON_IN_CART) .'</form>
																						</div>
																					</td>
																				  </tr>
																				</table></form>
															 </td></tr>
												 </table>
											</td></tr>
											</table>

				</div>');			}						   

$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}

 }?>
 <div style="border-left:2px solid #96BB46;border-right:2px solid #96BB46; height:376px;"><div style="width:100%; height:3px;"></div><?php new contentBox($info_box_contents, 0);?></div>
<?php new infoBoxFooterProduct();
?>

<!-- new_products_eof //-->

 

 

I've tried to change it ..but it changes the original look.

 

Thx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...