Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Iggy,

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

 

You sir, are a magic man :thumbsup:

 

Thank you very much! Works like a charm.

 

Iggy

 

Some keywords for future searches:

['copy_as'] == 'duplicate'), zero price, null, products_groups, dupe product

Edited by Iggy

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

Link to comment
Share on other sites

In product_info.php the special price is gotten from the function tep_get_products_special_price, which is adapted for SPPC.

You should see a value for sppc_customers_group_id, the correct one of course. When that is missing, all fails.

 

Thank you for your reply Jan - we will get to the cause

 

My debbugging shows function tep_get_products_special_price returning null

 

sppc_customers_group_id shows as having value 0

Link to comment
Share on other sites

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;
}

Where do i put this code? in catalog/product_info.php OR catalog/includes/languages/english/product_info.php? (other?)

and tell where in said file please..

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

Link to comment
Share on other sites

Yes, it has come up a number of times in this thread. The drop-down menu can be found in this post but that is not all that need to be done. The post variable that that drop-down creates should be evaluated (in the top of the file around line 34) and added to $sql_data_array (on this moment the code expects MySQL to add the default value of 0 in the field customers_group_id on insertion). That should happen above:

	  // BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only alert when a tax_id number has been given
 //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
  $sql_data_array['customers_group_ra'] = '1';
  }
  // EOF Separate Pricing Per Customer
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

It also needs some adapted code for the create_account.php page because so far it depended on always having retail as the default after creating an account. For the upcoming version 4.20 I wrote the following instructions:

Line 233-235 ?

**AFTER**

  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

**ADD**

// BOF Separate Pricing Per Customer
// register SPPC session variables for the new customer
// if there is code above that puts new customers directly into another customer group (default is retail)
// then the below code need not be changed, it uses the newly inserted customer group
  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];
// EOF Separate Pricing Per Customer


Line 254

**AFTER**

  tep_session_register('customer_zone_id');

**ADD**

// BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

JanZ, can this be done without the drop down menu? i have added 2 extra fields to my "create account" page... "company name" and "tax id" ... i would like for it to add the customer to the wholesale group as long as they input values in these two fields... i also need to display these two fields on the customers order...

(so when i print it out customer service can check to make sure its valid...

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

-David Gilmour

Link to comment
Share on other sites

Where do i put this code? in catalog/product_info.php OR catalog/includes/languages/english/product_info.php? (other?)

and tell where in said file please..

If you suffer from this... I have read a new therapy is in a testing phase.

 

You don't remember what you asked?

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/)...
Link to comment
Share on other sites

JanZ, can this be done without the drop down menu? i have added 2 extra fields to my "create account" page... "company name" and "tax id" ... i would like for it to add the customer to the wholesale group as long as they input values in these two fields... i also need to display these two fields on the customers order...

(so when i print it out customer service can check to make sure its valid...

This has been discussed before. Around line 185 in create_account.php change it e.g. to:

	  if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
// BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only alert when a tax_id number has been given
 //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) && tep_not_null($company) ) {
  $sql_data_array['customers_group_ra'] = '1';
  }
  // EOF Separate Pricing Per Customer
  if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

I don't know what you mean with adding two extra fields, this is standard issue in SPPC when you enable to show "Company" in the admin (configuration->Customer Details->Company->true)

Link to comment
Share on other sites

G'day all,

 

Quick question please, am using current version oscommerce, have installed separate pricing per customer 4.15.

 

All has gone smoothly with just one slight smallish problem - in the customer section admin customer group is no where to be found - nor are the mods for new customers signing in..

 

Curious if anyone else has experienced this as well.

 

Regards

 

Steve

Link to comment
Share on other sites

Hi Everyone!

 

I am hoping to find a way to have a separate product_weight for wholesale customers, a product_weight_wholesale.

 

I've been reading and reading and reading, and I still don't have a clear idea of how to go about this.

 

Can I get some thoughts, ideas, a nudge in the right direction from anyone here?

 

Anything would be appreciated!

 

TR

Link to comment
Share on other sites

I am hoping to find a way to have a separate product_weight for wholesale customers, a product_weight_wholesale.

 

I've been reading and reading and reading, and I still don't have a clear idea of how to go about this.

A product that has a different weight depending on the buyer? Magic.

 

You can add that new column to the table products and copy the code for product_weight in the page admin/categories.php (and rename variables of course) to take care of the admin side. And then you can do with it what you want (add it to the queries that need it e.g.).

Link to comment
Share on other sites

A product that has a different weight depending on the buyer? Magic.

 

You can add that new column to the table products and copy the code for product_weight in the page admin/categories.php (and rename variables of course) to take care of the admin side. And then you can do with it what you want (add it to the queries that need it e.g.).

 

Thanks for responding JanZ!

 

Not depending on the buyer, but on the sppc group!

 

What I am trying to accomplish is to be able to offer free shipping for individual random products of my choosing to retail cusomers, while maintaining the correct shipping costs to wholesale customers, or visa versa.

 

So, for products that are being offered free shipping temporarily or otherwise, to retail customers, the weight must be 0.00, while remaining the actual weight for the wholesale customers!

 

I have thought as you suggested, but my experience is somewhat limited. So, I thought I'd ask here for some advice, to perhaps save me from going off in the wrong direction all together!

 

From reading this forum, I know that since the suggestion is coming from you, it is probably the best direction towards going about this.

 

Thanks for the nudge JanZ!

 

TR

Link to comment
Share on other sites

My debbugging shows function tep_get_products_special_price returning null

 

sppc_customers_group_id shows as having value 0

 

Jan - since I am get function tep_get_products_special_price returning null in product_info.php

 

where next should I be looking - are the values I am seeing highlighting the possible program code I should be double checking

 

Thanking you in advance

Link to comment
Share on other sites

Yes, it has come up a number of times in this thread. The drop-down menu can be found in this post but that is not all that need to be done. The post variable that that drop-down creates should be evaluated (in the top of the file around line 34) and added to $sql_data_array (on this moment the code expects MySQL to add the default value of 0 in the field customers_group_id on insertion). That should happen above:

	  // BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only alert when a tax_id number has been given
 //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
  $sql_data_array['customers_group_ra'] = '1';
  }
  // EOF Separate Pricing Per Customer
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

It also needs some adapted code for the create_account.php page because so far it depended on always having retail as the default after creating an account. For the upcoming version 4.20 I wrote the following instructions:

Line 233-235 ?

**AFTER**

  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

**ADD**

// BOF Separate Pricing Per Customer
// register SPPC session variables for the new customer
// if there is code above that puts new customers directly into another customer group (default is retail)
// then the below code need not be changed, it uses the newly inserted customer group
  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];
// EOF Separate Pricing Per Customer


Line 254

**AFTER**

  tep_session_register('customer_zone_id');

**ADD**

// BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

 

Hi Jan

I've probably done something wrong but it's not working automatically, ie, putting the customer in the correct group in admin automatically, they always in 'retail' (I have 2 groups 'retail' and 'asofia').

 

Here's the bits of code from create_account.php I've changed...

 

line 30

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

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

if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);

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

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

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

 

 

 

line 241

// BOF Separate Pricing Per Customer

// register SPPC session variables for the new customer

// if there is code above that puts new customers directly into another customer group (default is retail)

// then the below code need not be changed, it uses the newly inserted customer group

$check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");

$customer_group_info = tep_db_fetch_array($check_customer_group_info);

$sppc_customer_group_id = $customer_group_info['customers_group_id'];

$sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];

$sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];

// EOF Separate Pricing Per Customer

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

$customer_country_id = $country;

$customer_zone_id = $zone_id;

tep_session_register('customer_id');

tep_session_register('customer_first_name');

tep_session_register('customer_default_address_id');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

// BOF Separate Pricing Per Customer

tep_session_register('sppc_customer_group_id');

tep_session_register('sppc_customer_group_show_tax');

tep_session_register('sppc_customer_group_tax_exempt');

// EOF Separate Pricing Per Customer

 

line 284

// BOF Separate Pricing Per Customer: alert shop owner of account created by a company

// if you would like to have an email when either a company name has been entered in

// the appropriate field or a tax id number, or both then uncomment the next line and comment the default

// setting: only email when a tax_id number has been given

// if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {

/* if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) {

$alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account.";

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

} */

if ( $_POST['request_cg'] != 'retail' ) {

$alert_email_text = "Please note that " . $firstname . " " . $lastname . " has created an account and applied for a " . tep_db_prepare_input($_POST['request_cg']). " account.";

$request_subject = tep_db_prepare_input($_POST['request_cg']). " account created";

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $request_subject, $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

}

// EOF Separate Pricing Per Customer: alert shop owner of account created by a company

 

 

line 424

<!-- BOF Separate Pricing Per Customer: drop-down menu for authorization request -->

<tr>

<td class="main"><?php define('ENTRY_REQUEST_CUSTOMER_GROUP', 'Are you a member of<br> ASOFIA, ASGA or ISP? ');

echo ENTRY_REQUEST_CUSTOMER_GROUP; ?></td>

<td class="main"><?php

$request_cg_array[] = array('id' => 'retail', 'text' => 'not a member');

$request_cg_array[] = array('id' => 'asofia', 'text' => 'yes I am a member');

echo tep_draw_pull_down_menu('request_cg', $request_cg_array) ?></td>

</tr>

<!-- EOF Separate Pricing Per Customer: drop-down menu for authorization request -->

 

 

My groups are called 'retail' and 'asofia' in admin.

Any ideas about what's wrong?

 

Thanks

mary

Link to comment
Share on other sites

Hi Again!

 

Just cannot get this to work:

if ($customer_group_id == '0') {
THIS
} else if ($customer_group_id != '0') {
THAT
}

or this to work:

if ($customer_group_id == '0') {
THIS
} else {
THAT
}

in either includes/application_top.php, or includes/classes/shopping_cart.php!

 

Have tried with several variations, and several placement variations of:

if(!tep_session_is_registered('sppc_customer_group_id')) { 
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
}

Need to be able to do this in at least one of these two files (includes/application_top.php OR includes/classes/shopping_cart.php)!

 

JanZ, another nudge in the right direction? Anyone else, any ideas?

 

Thanks,

 

TR

Link to comment
Share on other sites

Hi Jan

I've probably done something wrong but it's not working automatically, ie, putting the customer in the correct group in admin automatically, they always in 'retail' (I have 2 groups 'retail' and 'asofia').

 

...

My groups are called 'retail' and 'asofia' in admin.

Any ideas about what's wrong?

 

Thanks

mary

yes, perhaps detailed instructions from the begining, in a single post would help

:)

it takes what it takes

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

Link to comment
Share on other sites

I've probably done something wrong but it's not working automatically, ie, putting the customer in the correct group in admin automatically, they always in 'retail' (I have 2 groups 'retail' and 'asofia').

The last part is fine:

line 424
<!-- BOF Separate Pricing Per Customer: drop-down menu for authorization request -->
		  <tr>
			<td class="main"><?php define('ENTRY_REQUEST_CUSTOMER_GROUP', 'Are you a member of<br> ASOFIA, ASGA or ISP? ');
							echo ENTRY_REQUEST_CUSTOMER_GROUP; ?></td>
			<td class="main"><?php 
							$request_cg_array[] = array('id' => 'retail', 'text' => 'not a member');
							$request_cg_array[] = array('id' => 'asofia', 'text' => 'yes I am a member');
							echo tep_draw_pull_down_menu('request_cg', $request_cg_array) ?></td>
		  </tr>
<!-- EOF Separate Pricing Per Customer: drop-down menu for authorization request -->

Upon submit (providing this is placed between the opening and closing form tag) this pull down menu will result in a POST value that will have the name request_cg (so the name that comes in the opening select tag) and as value the id of the option that was chosen. So if "yes I am a member" is chosen the POST variable will be: $_POST['request_cg'] = asofia.

 

Asofia is not the customers_group_id so we have to process that $_POST variable to be able to insert the correct customers_group_id in the table customers.

 

line 30
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
// this is not correct:
// $retail = tep_db_prepare_input($HTTP_POST_VARS['retail']);
// $asofia = tep_db_prepare_input($HTTP_POST_VARS['asofia']);
if ($_POST['request_cg'] == 'asofia') {
$customers_group_id = '1'; // assuming asofia has that id
} else { // everything else is retail
$customers_group_id = '0';
}

Now above where the insert in the table customers is done (the last line of these three, somewhere around line 194):

	  // EOF Separate Pricing Per Customer
  if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

we have to make sure that $customers_group_id is added to that $sql_data_array.

 

We best add it to the lines above that:

	if ($error == false) {
  $sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,
						  'customers_email_address' => $email_address,
						  'customers_telephone' => $telephone,
						  'customers_fax' => $fax,
// add $customers_group_id
						 'customers_group_id => $customers_group_id,
						  'customers_newsletter' => $newsletter,
						  'customers_password' => tep_encrypt_password($password));

The new code for version 4.2 (see below) will make sure the correct values for sppc_customer_group_id, $sppc_group_show_tax and $sppc_tax_exempt are added to the SESSION variables after the insert is done and the customer put in the customer group he/she choose when creating an account (which is not the default behaviour, that is putting them in retail and having them manually added by the admin to another group).

line 241
// BOF Separate Pricing Per Customer
// register SPPC session variables for the new customer
// if there is code above that puts new customers directly into another customer group (default is retail)
// then the below code need not be changed, it uses the newly inserted customer group
  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];
// EOF Separate Pricing Per Customer
  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');
  // BOF Separate Pricing Per Customer
  tep_session_register('sppc_customer_group_id');
  tep_session_register('sppc_customer_group_show_tax');
  tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing Per Customer

Link to comment
Share on other sites

since I am get function tep_get_products_special_price returning null in product_info.php

 

where next should I be looking - are the values I am seeing highlighting the possible program code I should be double checking

If it returns null it means there the query for a special for that products_id for the particular customer group that the function has available did not yield a result. So it all depends on what it should have been. Make it echo the customer group id in that function?

 

You were logged-in as retail last time you checked (customer group id = 0) but is there indeed a special for that customer group, for that products_id, does it still have status = '1' (so not expired).

Link to comment
Share on other sites

Just cannot get this to work:

if ($customer_group_id == '0') {
THIS
} else if ($customer_group_id != '0') {
THAT
}

The last three lines of that above could be simply:

} else {
THAT
}

because you have code for when it is 0 so the else can be anything else.

That aside, why don't you try using the session variable directly.

if (isset($_SESSION['sppc_customer_group_id']) &&  $_SESSION['sppc_customer_group_id'] == '0') {
THIS
} else {
THAT
}

Link to comment
Share on other sites

Tegan,

Would you be able to recommend both a php book, and a mysql book?
I recommend "SAMS Teach yourself PHP in 24 hours" by Matt Zandstra for PHP. I learnt MySQL and what a database is from "MySQL" by Paul DuBois. It is thick, but the first 4 chapters (about 180 pages) are what you need. The rest is either specialized (working with Perl e.g.) or reference material (all the different functions in MySQL, comes handy once in a while).

 

Other people recommend "Build Your Own Database Driven Website Using PHP & MySQL" by Kevin Yank. I have it and I have nothing bad to say about it but after having read the two above books (and a pile of not so good books :P ) and (admittedly) having made a small application myself it had little new for me. But I might have known too much by then.

 

I'm sure there are other good books, but I don't know of them.

Link to comment
Share on other sites

I recommend "SAMS Teach yourself PHP in 24 hours" by Matt Zandstra for PHP. I learnt MySQL and what a database is from "MySQL" by Paul DuBois.

JanZ,

 

After reading through most of this forum (had to skim through some parts, it's just so long), I knew I'd like to know what you in particular, would recommend.

 

Thank you for the recommendations, and thank you for all that you give to this community.

 

TR

Link to comment
Share on other sites

Dear JanZ,

 

Automatic SPPC 4.1.5 installation on new installation of Milestone 2.2 (with french & dutch language packs added) ran into the following error messages after uploading the included files and the successfully executed SQL-query. Can you please advise what is going on and how to go further?

 

Many many thanks in advance and especially thanks for the very promising SPPC!

 

On .../catalog/admin/ :

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

 

s_values'); define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS', 'products_options_values_to_products_options'); define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories'); define('TABLE_REVIEWS', 'reviews'); define('TABLE_REVIEWS_DESCRIPTION', 'reviews_description'); define('TABLE_SESSIONS', 'sessions'); define('TABLE_SPECIALS', 'specials'); define('TABLE_TAX_CLASS', 'tax_class'); define('TABLE_TAX_RATES', 'tax_rates'); define('TABLE_GEO_ZONES', 'geo_zones'); define('TABLE_ZONES_TO_GEO_ZONES', 'zones_to_geo_zones'); define('TABLE_WHOS_ONLINE', 'whos_online'); define('TABLE_ZONES', 'zones'); // BOF Separate Pricing per Customer define('TABLE_PRODUCTS_GROUPS', 'products_groups'); define('TABLE_CUSTOMERS_GROUPS', 'customers_groups'); // EOF Separate Pricing per Customer ?> s_status_name']); } return tep_draw_pull_down_menu($name, $statuses_array, $order_status_id); } function tep_get_order_status_name($order_status_id, $language_id = '') { global $languages_id; if ($order_status_id < 1) return TEXT_DEFAULT; if (!is_numeric($language_id)) $language_id = $languages_id; $status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int)$order_status_id . "' and language_id = '" . (int)$language_id . "'"); $status = tep_db_fetch_array($status_query); return $status['orders_status_name']; } //// // Return a random value function tep_rand($min = null, $max = null) { static $seeded; if (!$seeded) { mt_srand((double)microtime()*1000000); $seeded = true; } if (isset($min) && isset($max)) { if ($min >= $max) { return $min; } else { return mt_rand($min, $max); } } else { return mt_rand(); } } // nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n) function tep_convert_linefeeds($from, $to, $string) { if ((PHP_VERSION < "4.0.5") && is_array($from)) { return ereg_replace('(' . implode('|', $from) . ')', $to, $string); } else { return str_replace($from, $to, $string); } } function tep_string_to_int($string) { return (int)$string; } //// // Parse and secure the cPath parameter values function tep_parse_category_path($cPath) { // make sure the category IDs are integers $cPath_array = array_map('tep_string_to_int', explode('_', $cPath)); // make sure no duplicate category IDs exist which could lock the server in a loop $tmp_array = array(); $n = sizeof($cPath_array); for ($i=0; $i<$n; $i++) { if (!in_array($cPath_array[$i], $tmp_array)) { $tmp_array[] = $cPath_array[$i]; } } return $tmp_array; } ?>

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/nlfr/www/fleursensoie/catalog/admin/includes/database_tables.php:66) in /home/nlfr/www/fleursensoie/catalog/admin/includes/functions/sessions.php on line 67

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/nlfr/www/fleursensoie/catalog/admin/includes/database_tables.php:66) in /home/nlfr/www/fleursensoie/catalog/admin/includes/functions/sessions.php on line 67

_DISPLAY_NUMBER_OF_ZONES', 'Displaying %d to %d (of %d zones)'); define('PREVNEXT_BUTTON_PREV', '<<'); define('PREVNEXT_BUTTON_NEXT', '>>'); define('TEXT_DEFAULT', 'default'); define('TEXT_SET_DEFAULT', 'Set as default'); define('TEXT_FIELD_REQUIRED', ' * Required'); define('ERROR_NO_DEFAULT_CURRENCY_DEFINED', 'Error: There is currently no default currency set. Please set one at: Administration Tool->Localization->Currencies'); define('TEXT_CACHE_CATEGORIES', 'Categories Box'); define('TEXT_CACHE_MANUFACTURERS', 'Manufacturers Box'); define('TEXT_CACHE_ALSO_PURCHASED', 'Also Purchased Module'); define('TEXT_NONE', '--none--'); define('TEXT_TOP', 'Top'); define('ERROR_DESTINATION_DOES_NOT_EXIST', 'Error: Destination does not exist.'); define('ERROR_DESTINATION_NOT_WRITEABLE', 'Error: Destination not writeable.'); define('ERROR_FILE_NOT_SAVED', 'Error: File upload not saved.'); define('ERROR_FILETYPE_NOT_ALLOWED', 'Error: File upload type not allowed.'); define('SUCCESS_FILE_SAVED_SUCCESSFULLY', 'Success: File upload saved successfully.'); define('WARNING_NO_FILE_UPLOADED', 'Warning: No file uploaded.'); define('WARNING_FILE_UPLOADS_DISABLED', 'Warning: File uploads are disabled in the php.ini configuration file.'); ?>

 

 

And on .../catalog/ :

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

 

Parse error: syntax error, unexpected '}' in /home/nlfr/www/fleursensoie/catalog/index.php on line 424

Link to comment
Share on other sites

Automatic SPPC 4.1.5 installation on new installation of Milestone 2.2 (with french & dutch language packs added) ran into the following error messages after uploading the included files and the successfully executed SQL-query. Can you please advise what is going on and how to go further?
I don't get the "automatic" but this is the strangest error I have ever seen. Since it starts with outputting code that is in admin/includes/database_tables.php I would take a good look there to see if there is anything wrong there.
Link to comment
Share on other sites

Hello Again!

 

JanZ,

 

In: includes/classes/shopping_cart.php

// Free Shipping Per Product - For SPPC
 if (isset($_SESSION['sppc_customer_group_id']) &&  $_SESSION['sppc_customer_group_id'] == '0') {
	  $products_weight = $product['products_weight'];
 } else { // sppc_customer_group_id
	  $products_weight_wholesale = $product['products_weight_wholesale'];
 } // sppc_customer_group_id
// /Free Shipping Per Product - For SPPC

works.

 

So that there can be a choice for the Free Shipping to apply only to NATIONAL and not INTERNATIONAL orders, or visa versa, or both, I made still one more weight: products_weight_international.

 

Using an example "product actual weight" of 5.00 lbs. - For Free Shipping Retail Only:

 

products_weight = 0.00

products_weight_wholesale = 5.00

products_weight_international = 5.00

 

International weight always having products actual weight (unless international shipping is free).

 

My thinking was like this:

// Free Shipping Per Product - For SPPC
if ($order->delivery['country_id'] != STORE_COUNTRY) {
	  $products_weight_international = $product['products_weight_international'];
} else { // country_id
 if (isset($_SESSION['sppc_customer_group_id']) &&  $_SESSION['sppc_customer_group_id'] == '0') {
	  $products_weight = $product['products_weight'];
 } else { // sppc_customer_group_id
	  $products_weight_wholesale = $product['products_weight_wholesale'];
 } // sppc_customer_group_id
} // country_id
// /Free Shipping Per Product - For SPPC

only it does not work, nor does any other variation of it that I could think of.

 

What do you think - any idea of what might work?

 

Thanks,

 

TR

Link to comment
Share on other sites

My thinking was like this:

// Free Shipping Per Product - For SPPC
if ($order->delivery['country_id'] != STORE_COUNTRY) {

only it does not work, nor does any other variation of it that I could think of.

If this is inside a function, try declaring "global $order" as one of the first lines in that function (if you didn't do that already).
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.
Note: Your post will require moderator approval before it will be visible.

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