Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

sorry JanZ im a little slow... i replaced everything between

 
//restore cart contents
 $cart->restore_contents();

and

if ($error == true) {
...

with the code you posted:

Ah, but then you removed three "}" between that code and if ($error == true) {

 

You start with:

// restore cart contents
	$cart->restore_contents();

	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	} // this is the end of if/else (sizeof($navigation->snapshot) > 0)
  } // this is the end of if/else (!tep_validate_password($password, $check_customer['customers_password']))
}
 }

 if ($error == true) {

and then we wrap the redirect code in if/elses:

// restore cart contents
	$cart->restore_contents();
// bof sppc
if ($sppc_customer_group_id == '0') {
// eof sppc
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	} // this is the end of if/else (sizeof($navigation->snapshot) > 0)
} // end of if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('windex.php'));
}
  } // this is the end of if/else (!tep_validate_password($password, $check_customer['customers_password']))
}
 }

 if ($error == true) {

Share this post


Link to post
Share on other sites
Ah, but then you removed three "}" between that code and if ($error == true) {

 

You start with:

// restore cart contents
	$cart->restore_contents();

	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	} // this is the end of if/else (sizeof($navigation->snapshot) > 0)
  } // this is the end of if/else (!tep_validate_password($password, $check_customer['customers_password']))
}
 }

 if ($error == true) {

and then we wrap the redirect code in if/elses:

// restore cart contents
	$cart->restore_contents();
// bof sppc
if ($sppc_customer_group_id == '0') {
// eof sppc
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	} // this is the end of if/else (sizeof($navigation->snapshot) > 0)
} // end of if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('windex.php'));
}
  } // this is the end of if/else (!tep_validate_password($password, $check_customer['customers_password']))
}
 }

 if ($error == true) {

ok thanks Janz.. that worked!

umm i thought i could change the message on the main screen here and then i remembered that message is stored in "catalog/includes/languages/english/index.php" (where you can change the welcome messages, etc..). in order to let wholesaler's see a different welcome message, do i even need 2 different "catalog/index.php" files?? Or is there a way i can have 2 different catalog/includes/languages/english/index.php" files? (not the same index as in catalog/)... and also how would i add links to it that only wholesalers can get to? (ie. a wholesaler specials page or a page with a calendar of events that only wholesalers should see)

Edited by herot

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
]

 

Try throwing the stock advanced search file back up there and see if it works. If it does, try merging the two files by hand and see if that works. If it does, let us know.

 

I'm running the same install you are and mine is functional. I'll forward it to you if you like.

 

Iggy

 

 

 

Iggy,

 

The stock file worked... and I had been using WinMerge to view the difference between my file and the advanced_search_result.php-SPPCv415 file.... and there were only cosmetic differences.

 

I finally decided to remove the cosmetic differences and make the two files match. I STILL had the same error.

 

So, I looked at the advanced_search_results.php-SSPCv414 file instead of the v415 file... to see the differences.

 

One thing I noticed was that 415 has an extra line added in right below the section where the SPPC module modifies the $from_str:

 

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

(about line #281 )

 

I commented this out... and my searches now work!

 

Of course, I'm mildly concerned that there's an IF statement ahead of this line, making me wonder if, instead of commenting it out, I should turn it into an ELSE clause.

 

But searches are working now.

 

 

 

Thanks!

 

-= Dave =-

Share this post


Link to post
Share on other sites
umm i thought i could change the message on the main screen here and then i remembered that message is stored in "catalog/includes/languages/english/index.php" (where you can change the welcome messages, etc..). in order to let wholesaler's see a different welcome message, do i even need 2 different "catalog/index.php" files?? Or is there a way i can have 2 different catalog/includes/languages/english/index.php" files? (not the same index as in catalog/)...
One way of doing that would instead of just echo TEXT_MAIN; surround it with if else's and when the customer group is not 0 echo TEXT_MAIN_1 or TEXT_MAIN_2 which you can add to catalog/includes/languages/english/index.php.

 

and also how would i add links to it that only wholesalers can get to? (ie. a wholesaler specials page or a page with a calendar of events that only wholesalers should see)
See how visitors are redirected on pages like checkout_shipping.php when they are not logged-in. You can do the same on your own pages based on being logged-in and being in the right customer group. That should keep the wrong people out.

Share this post


Link to post
Share on other sites

I installed SPPC a couple of months ago, thank you very much for your help with implementing SPPC with other contributions Jan!!

 

I have found another very useful contribution tat has been available since 8 august; fixed prices for different currencies

 

Anyone know if this would be hard to use together with SPPC? Thankful for any suggestions.

Share this post


Link to post
Share on other sites

I know a couple of people have mentioned this error but I can seem to find a solutions any help for pointing in the right direction would be great. Here is the error I get when you try to do the search feature:

 

 

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 '%72%' or p.products_model like '%72%' or m.manufacturers_name like '%72%') )

 

[TEP STOP]

 

 

Thanks in Advance!

Share this post


Link to post
Share on other sites

Sorry just needed another 5 minutes got it working, if anybody has similiar then I commented out line 181 in advance_search_results.php

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

Share this post


Link to post
Share on other sites
One way of doing that would instead of just echo TEXT_MAIN; surround it with if else's and when the customer group is not 0 echo TEXT_MAIN_1 or TEXT_MAIN_2 which you can add to catalog/includes/languages/english/index.php.

 

See how visitors are redirected on pages like checkout_shipping.php when they are not logged-in. You can do the same on your own pages based on being logged-in and being in the right customer group. That should keep the wrong people out.

if ($sppc_customer_group_id == '0') {
define('TEXT_MAIN', 'Welcome to The Pottery!');
else {
define('TEXT_MAIN_W', 'Welcome wholesaler!');
}

define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');
define('TABLE_HEADING_FEATURED_PRODUCTS', 'Featured Products');
define('TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY', 'Featured Products in %s');

something like this?? (i have no idea about programming or php)

this is my english/login.php...

Edited by herot

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
I have found another very useful contribution tat has been available since 8 august; fixed prices for different currencies

 

Anyone know if this would be hard to use together with SPPC? Thankful for any suggestions.

 

Hey Fredrik.r,

 

I'm the one who put the fixed prices contribution on the oscommerce website. We are using it on our oscommerce website that has been highly modified already. I had a feed back from somebody who tried it on another highly modified oscommerce website, and it works well. So, i don't know about SPPC but you should try. There is no reason for it not to work, as it is mostly only adding a new table.

 

I put a new version of fixed prices for different currencies, just removing the comments on VAT (in fact, we are not using VAT in our website but some may use it.).

Edited by wenddy

Share this post


Link to post
Share on other sites

I'm having a problem adding in Chemo's optimize tep tax

 

I've read thru and tried all the suggestions with no luck

 

uploaded tax.php to includes classes and modified it per

http://forums.oscommerce.com/index.php?sho...;p=568499

 

added

// tax class
require('includes/classes/tax.php');
$osC_Tax = new osC_Tax;

to the bottom of includes/application_top.php

 

includes/functions/general.php altered to read:

// Returns the tax rate for a zone / class
// TABLES: tax_rates, zones_to_geo_zones
function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt, $osC_Tax;
return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);
} 


 if(!tep_session_is_registered('sppc_customer_group_tax_exempt')) {
 $customer_group_tax_exempt = '0';
 } else {
 $customer_group_tax_exempt = $sppc_customer_group_tax_exempt;
 }

 if ($customer_group_tax_exempt == '1') {
	 return 0;
 }
// EOF Separate Pricing Per Customer, tax exempt modification
if ( ($country_id == -1) && ($zone_id == -1) ) {
  if (!tep_session_is_registered('customer_id')) {
	$country_id = STORE_COUNTRY;
	$zone_id = STORE_ZONE;
  } else {
	$country_id = $customer_country_id;
	$zone_id = $customer_zone_id;
  }
}

$tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");
if (tep_db_num_rows($tax_query)) {
  $tax_multiplier = 1.0;
  while ($tax = tep_db_fetch_array($tax_query)) {
	$tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
  }
  return ($tax_multiplier - 1.0) * 100;
} else {
  return 0;
}
 }

////
// Return the tax description for a zone / class
// TABLES: tax_rates;
 function tep_get_tax_description($class_id, $country_id, $zone_id) function tep_get_tax_description($class_id, $country_id, $zone_id) {
global $osC_Tax;
return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);
} 

{
$tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");
if (tep_db_num_rows($tax_query)) {
  $tax_description = '';
  while ($tax = tep_db_fetch_array($tax_query)) {
	$tax_description .= $tax['tax_description'] . ' + ';
  }
  $tax_description = substr($tax_description, 0, -3);

  return $tax_description;
} else {
  return TEXT_UNKNOWN_TAX_RATE;
}
 }

 

 

I get this error:

Parse error: syntax error, unexpected '}' in /home/eznails/public_html/ezshop/includes/functions/general.php on line 356

 

Line 356 is that very last "}" I tried commenting that out but then I got:

Parse error: syntax error, unexpected T_FUNCTION, expecting '{' in /home/eznails/public_html/ezshop/includes/functions/general.php on line 361

 

Where did I go wrong here??

 

thanks


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites
Where did I go wrong here??
By not having read a book on PHP in the past months :D

 

That post said:

This worked for me (compare with the file tax.php to see where to put it):
and then you added it to includes/functions/general.php ? So first you should add those changes to includes/classes/tax.php and then follow the directions given for impleting Chemo's tax class and that is replacing these two tax functions with the 3 and 4 line pieces of code:

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt, $osC_Tax;
return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);
} 

////
// Return the tax description for a zone / class
// TABLES: tax_rates;
 function tep_get_tax_description($class_id, $country_id, $zone_id) function tep_get_tax_description($class_id, $country_id, $zone_id) {
global $osC_Tax;
return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);
}

The code in between should either be commented out or deleted (try commenting out first, deleting can wait till you established you didn't comment out a little bit too much).

Share this post


Link to post
Share on other sites
By not having read a book on PHP in the past months :D

 

OK I have taken my due deserved beating.. and thats the type of day I am having here.. I think that when I copied it didn't and I pasted the wrong stuff.. going to pour me a tall one and take another look at this :)


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites
something like this?? (i have no idea about programming or php)
That is not what I said or meant to say. I tried to say to use on product_info.php the different TEXT_MAIN's you can define in the language file:

if ($customer_group_id == '0') {
echo TEXT_MAIN;
} elseif ($customer_group_id == '1') {
echo TEXT_MAIN1;
} elseif ($customer_group_id == '2') {
echo TEXT_MAIN2;
}

Of course it wouldn't hurt to read a little about PHP if you are so inclined to alter code... :)

Share this post


Link to post
Share on other sites

OK I am now blue in the face and I do not get this..

 

includes/application_top.php

 

// tax class
require('includes/classes/tax.php');
$osC_Tax = new osC_Tax;

?>

 

includes/classes/tax.php

<?php
/*
 $Id: tax.php,v 1.1 2003/11/17 16:56:11 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 Mofified by: Chemo
 Purpose: MS2 backward compatibility
 Contact: osc_tax@bdcconcepts.com
 Mofified f?r SPPC by: Infobroker
 Contact: info@cooleshops.de
*/

 class osC_Tax {
var $tax_rates;

// class constructor
function osC_Tax() {
  $this->tax_rates = array();
}

// class methods
function getTaxRate($class_id, $country_id = -1, $zone_id = -1) {
// BOF Separate Pricing Per Customer, tax exempt modification
global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt;
 if(!tep_session_is_registered('sppc_customer_group_tax_exempt')) {
 $customer_group_tax_exempt = '0';
 } else {
 $customer_group_tax_exempt = $sppc_customer_group_tax_exempt;
 }

 if ($customer_group_tax_exempt == '1') {
	 return 0;
 }
// EOF Separate Pricing Per Customer, tax exempt modification


if ( ($country_id == -1) && ($zone_id == -1) ) {
  if (!tep_session_is_registered('customer_id')) {
	$country_id = STORE_COUNTRY;
	$zone_id = STORE_ZONE;
  } else {
	$country_id = $customer_country_id;
	$zone_id = $customer_zone_id;
  }
}

  if (isset($this->tax_rates[$class_id][$country_id][$zone_id]['rate']) == false) {
	$tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");
	if (tep_db_num_rows($tax_query)) {
	  $tax_multiplier = 1.0;
	  while ($tax = tep_db_fetch_array($tax_query)) {
		$tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
	  }

	  $tax_rate = ($tax_multiplier - 1.0) * 100;
	} else {
	  $tax_rate = 0;
	}
	$this->tax_rates[$class_id][$country_id][$zone_id]['rate'] = $tax_rate;
  }

  return $this->tax_rates[$class_id][$country_id][$zone_id]['rate'];
}

function getTaxRateDescription($class_id, $country_id, $zone_id) {
  if (isset($this->tax_rates[$class_id][$country_id][$zone_id]['description']) == false) {
	$tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");
	if (tep_db_num_rows($tax_query)) {
	  $tax_description = '';

	  while ($tax = tep_db_fetch_array($tax_query)) {
		$tax_description .= $tax['tax_description'] . ' + ';
	  }

	  $this->tax_rates[$class_id][$country_id][$zone_id]['description'] = substr($tax_description, 0, -3);
	} else {
	  $this->tax_rates[$class_id][$country_id][$zone_id]['description'] = TEXT_UNKNOWN_TAX_RATE;
	}
  }

  return $this->tax_rates[$class_id][$country_id][$zone_id]['description'];
}
 }
?>

 

 

includes/functions/general.php

////
// Returns the tax rate for a zone / class
// TABLES: tax_rates, zones_to_geo_zones
function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt, $osC_Tax;
return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);
} 

// this is line 328 //

////
// Return the tax description for a zone / class
// TABLES: tax_rates;
 function tep_get_tax_description($class_id, $country_id, $zone_id) function tep_get_tax_description($class_id, $country_id, $zone_id) {
global $osC_Tax;
return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);
} 


////
// Add tax to a products price
 function tep_add_tax($price, $tax) {
global $currencies;

 

 

Help me out Jan please.. I do not see where this is wrong..

 

When I use this code I get an error:

Parse error: syntax error, unexpected T_FUNCTION, expecting '{' in /home/eznails/public_html/ezshop/includes/functions/general.php on line 328

 

Line 328 in general.php is between the 2 functions


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites

Hi,

Could someone please post the necessary code for getting this contribution to work with the "Star Product" contribution. I am a newbie to PHP and have no real idea how to get this working.

 

Thanks

Share this post


Link to post
Share on other sites
Help me out Jan please.. I do not see where this is wrong..

 

When I use this code I get an error:

Line 328 in general.php is between the 2 functions

Two suggestions: check again if you didn't by accident made the changes in the admin/includes/functions/general.php.

 

The other is that might not be anything wrong at all, kind of. Perhaps you cut and pasted this from the forum? I have had weird errors like that when there were (invisible) unicode characters there (as spaces) that do not go well with PHP.

 

If you are on Windows you could open it in Note pad and save it again (Note pad cannot read unicode). If on a Mac you could use BBEdit or TextWrangler and save it as ASCII. With Edit->Text Options->Show Invisibles (under Display) you can see them as bullets. Hope that that solves your problem.

Share this post


Link to post
Share on other sites
Two suggestions: check again if you didn't by accident made the changes in the admin/includes/functions/general.php.

 

The other is that might not be anything wrong at all, kind of. Perhaps you cut and pasted this from the forum? I have had weird errors like that when there were (invisible) unicode characters there (as spaces) that do not go well with PHP.

 

 

Jan.. I checked the local and remote versions of admin/includes/functions/general.php I checked all local copies.. not just the latest.. I am very careful about backing up files when I make these changes.. I searched them all for any reference of $osC_Tax and found nothing..

 

I only work in NoteTabPro and yes I copied/pasted from the forums, but into NoteTabPro so the unicode should not be an issue..I do that all the time..

 

Would you be so kind as to private me your /catalog/includes/functions/general.php and I will do a winmerge compare.. thanks


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites

Special Price not being "passed" to either product_info.php or shopping_cart.php

 

Can someone please explain to me how the following two variables are populate

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

 

in product_info.php

 

Ie how are the values being passed from products_new.php and specials.php

are the value being passed by class, is my problem simple a session thing

 

How do I go about debugging this

 

Can someone take me step by step from products_new.php and specials.php and selecting a product on special to product_info.php to shopping_cart.php - What do I need to test at each stage and where and what debugging code could I write

 

I am at a lost in solving this, my progress on my site has ground to a halt

 

When I am on the new_product.php page and select a product on special to add to shopping cart, the special price is not passed to shopping_chart.php, similar select the product on specials.php, the special price is not being passed to the product_info.php

 

SPPC (4.14) is a great contribution, but the problem I am having with the special price is costing me a lot of time

 

If someone can step me through passing special price - it would be much appreciated

 

Thanking you all in advance

 

Thanking you all in advance

Share this post


Link to post
Share on other sites

Hi there,

 

I seem to have run myself into a wall on a fairly non-critical but annoying error. Since it's late and my eyes are starting to cross I'm hoping you guys might take a look and give some feedback.

 

When duplicating a product I end up with this in the products_groups table if the product doesn't have an SPPC entry.

 

customers_group_id	 customers_group_price	products_id
 	 	1				 1299.0000				  30
 	 	0				 0.0000						 32	 <--------

 

This causes the price to display as 0 in product info. Deleting the entry from products_groups brings the retail price back up in product info.

 

The price is fine in category view (product_listing) and if the product already has a price it's fine as well.

 

Checking it out on an older store (pre nov 11 update) the dup function works fine and no entry is added to products_groups

 

On my dev machine (mysql 5) and production box (mysql 4) using the latest osC update 8.17 I get the 0 entry.

 

So I figure it has to be an issue with the dup function and not the display code in product info and probably not the update.

 

The dup function modded a bit in my /admin/categories.php for UltraImages, an extra prod description field and HTC. Here's what I "think" is the relevant bit

 

		  } 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_tax_class_id, manufacturers_id 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_status, products_tax_class_id, manufacturers_id) 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']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
// BOF MaxiDVD: Modified For Ultimate Images Pack!
		$dup_products_id = tep_db_insert_id();

	   //HTC BOC 
		$description_query = tep_db_query("select language_id, products_name, products_description, products_spec, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, 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_spec, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, 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_spec']) . "', '" . tep_db_input($description['products_head_title_tag']) . "', '" . tep_db_input($description['products_head_desc_tag']) . "', '" . tep_db_input($description['products_head_keywords_tag']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
		}
	   //HTC EOC  

		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 26042006 by Infobroker

$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);

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



}
 // EOF Separate Pricing Per Customer  26042006 by Infobroker

 

Clues, conjecture, pokes with a sharp stick all gladly accepted.

 

Thanks,

Iggy

Edited by Iggy

Everything's funny but nothing's a joke...

Share this post


Link to post
Share on other sites
I seem to have run myself into a wall on a fairly non-critical but annoying error. Since it's late and my eyes are starting to cross I'm hoping you guys might take a look and give some feedback.

 

When duplicating a product I end up with this in the products_groups table if the product doesn't have an SPPC entry.

That duplication code was not totally working correctly. I remember that it had a side-effect like that. I posted my revised version somewhere in the thread, but can't find it myself :'(

 

I have it at home, so if you have a little patience I can post it (again) tonight.

Share this post


Link to post
Share on other sites
How do I go about debugging this
You started a thread earlier with this and explained how to check the session stuff first. You would, but you never posted the results. I'm afraid it is a little too much to ask to learn you PHP here.

Share this post


Link to post
Share on other sites
You started a thread earlier with this and explained how to check the session stuff first

 

Jan I have been using your recommend debugging code in each of programs in question

so far I have not found how the special prices is being pasted between the 3 programs since I added the SPPC contributions

 

Any direction of where what I should be seeing when I place the debug code at various points in the programs ie at this point you should see the special price

 

I will recheck the session coding

 

Todays post was just a cut and paste - just want to add my issue to the SPPC contribution forum

 

Thanking everyone in advance

Share this post


Link to post
Share on other sites
so far I have not found how the special prices is being pasted between the 3 programs since I added the SPPC contributions
In product_info.php the special price is gotten from the function tep_get_products_special_price, which is adapted for SPPC.
Any direction of where what I should be seeing when I place the debug code at various points in the programs ie at this point you should see the special price
You should see a value for sppc_customers_group_id, the correct one of course. When that is missing, all fails.

Share this post


Link to post
Share on other sites

Iggy,

When duplicating a product I end up with this in the products_groups table if the product doesn't have an SPPC entry.
Below my version of that piece of code.

Line 331

**AFTER**

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

**ADD**

// 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

Share this post


Link to post
Share on other sites
That duplication code was not totally working correctly. I remember that it had a side-effect like that. I posted my revised version somewhere in the thread, but can't find it myself :'(

 

I have it at home, so if you have a little patience I can post it (again) tonight.

 

Why that's not even close to a poke with a sharp stick :lol:

 

Thanks Jan! Much appreciated!

 

Iggy


Everything's funny but nothing's a joke...

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

×