Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hi Jan,

 

Perhaps I've misunderstood what the casual visitor is allowed to see, I thought the retail prices would be hidden from them. This is what I have for the whats new module. Over the past 2 days I've changed every 'using' command to an 'on' command as you showed. It still allows all the modules to display all products to a casual visitor. Anyone can see my retail prices.

 

<?php
/*
 $Id: whats_new.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/08/10, Hide products and categories from groups 2008/08/04

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

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/
// BOF Separate Pricing Per Customer
// BOF Hide products and categories from groups
 if ($random_product = tep_random_select("select p.products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES .  " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id  where products_status = '1' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
// EOF Hide products and categories from groups
?>
<!-- whats_new //-->
         <tr>
           <td>
<?php
//    $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
   $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

 if ($customer_group_id !='0') {
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $random_product['products_id'] . "' and customers_group_id =  '" . $customer_group_id . "'");
  if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
    $random_product['products_price'] = $customer_group_price['customers_group_price'];
  }
 }
// EOF Separate Pricing Per Customer

   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

   if (tep_not_null($random_product['specials_new_products_price'])) {
     $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
     $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
   } else {
     $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
   }

   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'center',
                                'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price);

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

Edited by kimm
Link to comment
Share on other sites

Hello

 

I have installed SPPC everything seems to work...except when customers login they get the choice in which group the want to be <_<

This can't be right but I don't see where i'm wrong...

Probably the easiest answer in the world; if anyone can help that would be great !

 

EDIT: new customers (registration after installation of this add-on) don't have this problem...only customers that existed before the installation of this add-on

Edited by Toshke
Link to comment
Share on other sites

Perhaps I've misunderstood what the casual visitor is allowed to see, I thought the retail prices would be hidden from them.

OK, a big misunderstanding then. This "hide products mod" is about hiding the complete product and all references to it. This way you can offer products to certain customer groups that you would not like to show or sell to any other customer. Or do not sell products to wholesale customers that you only want to sell directly.

 

Hiding prices is a whole other thing. To hide prices for visitors I think you are best of with a contribution that hides prices when not logged-in. Something (or close) of that name is in the contribution section.

 

That is compatible with SPPC.

Link to comment
Share on other sites

I have installed SPPC everything seems to work...except when customers login they get the choice in which group the want to be <_<

This can't be right but I don't see where i'm wrong...

Me neither because the only one who should get this choice is the person who's email address has been added to catalog/includes/languages/english/login.php

// BOF Separate Pricing Per Customer
// define the email address that can change customer_group_id on login
define('SPPC_TOGGLE_LOGIN_PASSWORD', 'root@localhost');
// EOF Separate Pricing Per Customer

Any other person would not get the choice.

Link to comment
Share on other sites

I get an error randomly and cannot recreate this ... can someone tell me how to fix this ?

That it is seemlingly randomly I can understand. This is from a functionality that creates a table with customer group prices for (in this case) customer group 1 by first emptying it, than inserting the products_id's and regular product prices in it and then updating it with customer group prices.

 

That only happens when the table is of a certain age (in the order of an hour, don't remember exactly).

 

The updating apparently gives you the error (the query is found in the the function tep_db_check_age_products_group_prices_cg_table($customer_group_id) that is in includes/functions/database.php at the bottom of the file).

 

This function has been in there for many years and you are the first to have an error with it. This was used on MySQL4 and MySQL5 without errors so why now?

 

What version of MySQL are you using?

Link to comment
Share on other sites

Hi,

 

How to make your price break number field to act as a percentage number meaning discount in % ? And the output in the catalog table would be Product price minus % enterted in the input fields of price breaks. This would avoid manual price break corrections if you have set up automatic price updates from some 3rd party system. Specialy if the data base is big.

 

Anyone tried yet ?

 

Thanks for some hints

Edited by suhy
Link to comment
Share on other sites

Here is my server information, All of the tables listed below have no data in them, they are always empty?

 

Table: products_group_prices_cg_1

Table: products_group_prices_cg_3

Table: products_group_prices_cg_4

Table: products_group_prices_cg_5

 

 

 

Server OS: Linux 2.4.21-NIT-1

Database: MySQL 3.23.47

Server Date: 09/11/2008 08:14:18

Datebase Date: 09/11/2008 08:14:18

Server Up Time: 8:14am up 44 days, 23:20, load average: 0.17, 0.20, 0.23

 

HTTP Server: Apache

PHP Version: 4.4.7 (Zend: 1.3.0)

 

 

What do you think I have going on here ?

 

// Larry

Link to comment
Share on other sites

Here is my server information, All of the tables listed below have no data in them, they are always empty?

 

Table: products_group_prices_cg_1

Table: products_group_prices_cg_3

Table: products_group_prices_cg_4

Table: products_group_prices_cg_5

 

 

 

Server OS: Linux 2.4.21-NIT-1

Database: MySQL 3.23.47

Server Date: 09/11/2008 08:14:18

Datebase Date: 09/11/2008 08:14:18

Server Up Time: 8:14am up 44 days, 23:20, load average: 0.17, 0.20, 0.23

 

HTTP Server: Apache

PHP Version: 4.4.7 (Zend: 1.3.0)

 

 

What do you think I have going on here ?

 

// Larry

 

 

You should try the same configuration on a newer version of mySQL ... I suppose it would be the easiest way for a quick test. ..

Edited by suhy
Link to comment
Share on other sites

Hi,

 

How to make your price break number field to act as a percentage number meaning discount in % ? And the output in the catalog table would be Product price minus % enterted in the input fields of price breaks. This would avoid manual price break corrections if you have set up automatic price updates from some 3rd party system. Specialy if the data base is big.

 

Anyone tried yet ?

 

Thanks for some hints

 

Sorry, wrong thread ... I'm all about how to get SPPC + QPBPP working together and I messed up the thread ... sorry

Link to comment
Share on other sites

Hi,

 

I've spent quite some time finding out what is the last stable version of SPPC + QPBPP working together, but I'm still not very sure.

 

Please post some pointers which versions you have installed and working OK using PHP5 and mySQL5.

 

Thanks !

Link to comment
Share on other sites

that is not an option ...

 

Can the query be modified or commented OUT ? <_<

 

 

You could localy install WAMP (http://www.wampserver.com/en/), add a few addons (older versions of PHP & mySQL) and you could try it localy to see if there's a different behaviour.

This should be easy and fast test.

Link to comment
Share on other sites

The server that I am on is locked down and I cannot add/upgrade any applications to it until next year.

 

Where do I go to remove the UPDATE query ? :rolleyes:

 

Can I remove the query ? :rolleyes:

 

All of my data is stored in products_groups with different pricing assigned to each item, so I do not need it to update any of the following tables.

 

THEY ARE EMPTY all the time !!!

 

products_group_prices_cg_1

products_group_prices_cg_3

products_group_prices_cg_4

products_group_prices_cg_5

 

I cannot believe that I am the only one useing 3.23 MYSQL !!!

Link to comment
Share on other sites

Where do I go to remove the UPDATE query ?

Just make the functon tep_db_check_age_products_groups always return true:

  function tep_db_check_age_products_group_prices_cg_table($customer_group_id) {
	  return true;
  $result = tep_db_query("show table status from `" . DB_DATABASE . "`");

Better not use those table at all so make sure $status_need_to_get_prices = false instead of true here in index.php.

	if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
  $status_need_to_get_prices = true; // make it false
  }

THEY ARE EMPTY all the time !!!

Very strange. According to the MySQL documentation there is no indication there that that query shouldn't work.

I cannot believe that I am the only one useing 3.23 MYSQL !!!

You are probably the last one. Version 3.23 is out of support for several years now. Kind of like Windows 98.

Link to comment
Share on other sites

I've spent quite some time finding out what is the last stable version of SPPC + QPBPP working together, but I'm still not very sure.

You need the latest version of the QPBPP for SPPC. From my recollection you will need to download a couple of zips to get the thing complete. A bit confusing to say the least.

 

I'm working on a new version but the latest QPBPP is so different that the whole admin side needs to be rewritten (and the admin side of QPBPP could use a few improvements too). No way to say how that will take.

Link to comment
Share on other sites

You need the latest version of the QPBPP for SPPC. From my recollection you will need to download a couple of zips to get the thing complete. A bit confusing to say the least.

 

I'm working on a new version but the latest QPBPP is so different that the whole admin side needs to be rewritten (and the admin side of QPBPP could use a few improvements too). No way to say how that will take.

 

 

Thanks for some starting pointers ! I hope the version is still more or less compatible with latest SPPC. Or should maybe start with SPPC without integrated Category Discount ? I believe Category discount option if used will need some extra mod ? Any thoughts ?

 

What about the function of SPPC that you are adding QPBPP fields through the admin section ? Wasn't the last QPBPP for SPPC written for hard coded number of fields ?

 

A few more pointers would be really cool now to kick me starting with an idea that will work at the end, lol

 

I'll go manualy step by step, hoping I'll not miss anything :)

Edited by suhy
Link to comment
Share on other sites

I hope the version is still more or less compatible with latest SPPC.

I think it does.

Or should maybe start with SPPC without integrated Category Discount ? I believe Category discount option if used will need some extra mod ?

Discount category is not in the QPBPP for SPPC version. It will be in the new version.

 

What about the function of SPPC that you are adding QPBPP fields through the admin section ? Wasn't the last QPBPP for SPPC written for hard coded number of fields ?

Yes, it is for the "original" version of QPBPP (versions 1.2).

Link to comment
Share on other sites

Jan Zonjee ,

 

 

Do you want me to change this

 

   tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_product_prices_table = true;

 

to this in the index.php file ?

 

function tep_db_check_age_products_group_prices_cg_table($customer_group_id) {
	  return true;
  $result = tep_db_query("show table status from `" . DB_DATABASE . "`");

 

I did change the following to FALSE in the index file!

 

	if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
  // REMOVED because of 3.23 problem
  // $status_need_to_get_prices = true;
  $status_need_to_get_prices = false;
  }

 

As for using 3.23 you are right ... We will be getting a new server next year, I cannot wait!!

 

You are probably the last one. Version 3.23 is out of support for several years now. Kind of like Windows 98.

 

 

Thanks for the HELP !!!

Link to comment
Share on other sites

I think it does.

 

Discount category is not in the QPBPP for SPPC version. It will be in the new version.

 

 

Yes, it is for the "original" version of QPBPP (versions 1.2).

 

 

Thanks :)

 

I'll give it a try and post the results later. As I've seen there has been quite a few posts on these combination use. It will come handy if it works.

Link to comment
Share on other sites

Do you want me to change this

 

   tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_product_prices_table = true;

 

to this in the index.php file ?

 

function tep_db_check_age_products_group_prices_cg_table($customer_group_id) {
	  return true;
  $result = tep_db_query("show table status from `" . DB_DATABASE . "`");

The function is found in includes/functions/database.php, at the bottom of the file.

 

I did change the following to FALSE in the index file!

 

	if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
  // REMOVED because of 3.23 problem
  // $status_need_to_get_prices = true;
  $status_need_to_get_prices = false;
  }

Then the function should not be triggered, but better safe than sorry. Still strange this error...

 

You could try the (apparently) problematic insert query in phpAdmin or the like and see if it triggers an error:

insert into products_group_prices_cg_1 select p.products_id, p.products_price, NULL as specials_new_products_price, NULL as status FROM products p";

Link to comment
Share on other sites

I've installed SPPC to oscommerce 2.2 rc1, it seems it is working well 'cept that mysql queries are not doing their job. My images, and its links are missing.

 

I know someone had fix this before. I hope you can point it out for me, I have been backreading eversince, and I can't find the fix. Using SPPC 4.1.6 so I can use tax_exampt addon.

Link to comment
Share on other sites

I've installed SPPC to oscommerce 2.2 rc1, it seems it is working well 'cept that mysql queries are not doing their job. My images, and its links are missing.

 

I know someone had fix this before. I hope you can point it out for me, I have been backreading eversince, and I can't find the fix. Using SPPC 4.1.6 so I can use tax_exampt addon.

 

 

My bad, i've used the wrong sql schema, the update sql schema, not the new installation sql schema. :blink:

 

 

Now it's working, now I'm trying to install TAX RATES EXEMPTABLE - ADDON TO SPPC 4.1.6 (FIXED). Wish me luck :blush:

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