Seperate Pricing Per Customer v3.5
#41
Posted 26 August 2003 - 06:04 PM
How can I combin default_specials(fix default_specials) into this one.
<?php
/*
$Id: default_specials.php,v 2.0 2003/06/13
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
?>
<!-- default_specials //-->
<tr>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_DEFAULT_SPECIALS, strftime('%B')));
new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));
$new = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit " . MAX_DISPLAY_SPECIAL_PRODUCTS);
$info_box_contents = array();
$row = 0;
$col = 0;
while ($default_specials = tep_db_fetch_array($new)) {
$default_specials['products_name'] = tep_get_products_name($default_specials['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $default_specials['products_image'], $default_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . $default_specials['products_name'] . '</a><br><s>' . $currencies->display_price($default_specials['products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($default_specials['specials_new_products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</span>');
$col ++;
if ($col > 2) {
$col = 0;
$row ++;
}
}
new contentBox($info_box_contents);
?>
<!-- default_specials_eof //-->
anybody can help me,thank you.
#42
Posted 27 August 2003 - 09:17 AM
#43
Posted 28 August 2003 - 04:11 PM
I inserted all code as described, and I get various Prices for e΄very gruop.
If I then go and buy, the Prices are changed to the original price.
I guess that any customer will become quite angry if I do not maintain the actual prices.
As well the product price is changed but in the new_product the price is not displayed correct
Please let me know how to handle
Thanks very much
Thomas
1... 2.. 3.. buy
#44
Posted 01 September 2003 - 12:45 PM
#45
Posted 08 September 2003 - 04:52 AM
One:
catlog/products_new.php
find code and replace:
$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
i can not find this line of code any where.
Two:
where is the database_table.php file located at. i looked everywhere. the readme file says to look here
catalog/includes/database_tables.php
and i can't find it anywhere.
Three:
same as above
where is the database_table.php file located at. i looked everywhere. the readme file says to look here
Admin/includes/database_tables.php
and i can't find it anywhere.
#46
Posted 08 September 2003 - 05:39 AM
of you do not find it there your system will ton run.
pull down all of your internet files - you will find it there
the code, or a very similar code is in
products_new.php
cant believe you do not find it.
#47
Posted 08 September 2003 - 06:55 AM
catalog/products_new.php
and i still can not find the bit of code. This is what i am looking at maybe you can point out the bit of code that needs to be replaced
<?php
/*
$Id: products_new.php,v 1.24 2003/02/13 04:23:23 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td>
<?php
$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' order by p.products_date_added DESC, pd.products_name";
$products_new_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_PRODUCTS_NEW, $products_new_query_raw, $products_new_numrows);
$products_new_query = tep_db_query($products_new_query_raw);
while ($products_new = tep_db_fetch_array($products_new_query)) {
$products_new_array[] = array('id' => $products_new['products_id'],
'name' => $products_new['products_name'],
'image' => $products_new['products_image'],
'price' => $products_new['products_price'],
'specials_price' => $products_new['specials_new_products_price'],
'tax_class_id' => $products_new['products_tax_class_id'],
'date_added' => tep_date_long($products_new['products_date_added']),
'manufacturer' => $products_new['manufacturers_name']);
}
require(DIR_WS_MODULES . 'products_new.php');
?>
</td>
</tr>
<?php
if (($products_new_numrows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
<tr>
<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo $products_new_split->display_count($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $products_new_split->display_links($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table></td>
</tr>
<?php
}
?>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
last thing I have downloaded the whole oscommerce and I still can not find the database_tables.php file maybe you can give me better instructions on how to find the file
#48
Posted 08 September 2003 - 07:11 AM
look in line 84, of products_new.php
there you shold find it.
otherwise i can send you this file and as well the orig database_tables.php
1... 2.. 3.. buy
#49
Posted 08 September 2003 - 04:58 PM
<tr>
<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo $products_new_split->display_count($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $products_new_split->display_links($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table></td>
</tr>
and i still can find the database_tables.php files
thank you so much for taking your time.
#50
Posted 08 September 2003 - 07:04 PM
-- Jen
#51
Posted 08 September 2003 - 08:47 PM
I am currently using the 2.2MS2, but I do not have a catalog/inlcudes/database_tables.php file??? Therefore I can't make necessary changes.
Is it possible that I am missisng a modification?
Any help would be appreciated.
Thanks,
TC
#52
Posted 09 September 2003 - 09:10 AM
Quote
Isn't there anyone who have "prepared" files for a fresh installation? Many other communites are overthing such files for those, who are new to the project. Can be fasten up adding a contribute that is so complex like this one. Anyone out there? thx
#53
Posted 09 September 2003 - 09:28 PM
Here, Clement itemized the bugs you're talking about the best...
Quote
Here are some problems that I found into 3.5 version for different specials for each new group:
A. In the install instructions
------------------------------------
1. At catalog/specials.php changes:
Around line 80
After
$row = 0;
$specials_query = tep_db_query($specials_split->sql_query);
while ($specials = tep_db_fetch_array($specials_query)) {
$row++;
Add
$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
$customer_group = tep_db_fetch_array($customer_group_query);
$row = 0;
$specials_query = tep_db_query($specials_split->sql_query);
while ($specials = tep_db_fetch_array($specials_query)) {
$row++;
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $specials['products_id'] . "' and customers_group_id = '" . $customer_group['customers_group_id'] . "'");
if ( $customer_group['customers_group_id'] != 0)
if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))
$specials['products_price']= $customer_group_price['customers_group_price'];
I think there must be "replace" and not "add" because if I just add the seccond part of code then I've got an arror into specials.php file.
2. For catalog/includes/functions/general.php changes the instructions say that :
Around 200 After $select_string .= '>'; Add .......
But "$select_string .= '>';" is only in admin/includes/functions/general.php , so I think at this point all changes must be swiched to the admin/functions/general.php
A. Runing the script
------------------------------------
3. The special prices for "Resellers" - not the default group - arn't displayed from the catalog/includes/modules/new_products.php
4. If I setup a special price for "Reseller" as percent, then the special price is calculated based on the default group price not as a percent from the "reseller" price.
Thank you very much for this contribution,
Hope this helps, of course all thanks should be directed towards Clement.
#54
Posted 09 September 2003 - 09:49 PM
I've been working with this contribution (which is awesome, let me say first thing), for a day or so and I've found a few, I'm hesitant to say "bugs", hey they could be features
The main thing is, it seems that if Retail doesn't have a customers_group_id of 0, then there are discrepancies in prices between surfers browsing the site and people logged in as "Retail". Changing a customers_group_id number is simple... Let's say you have two customers, one Retail and one Reseller. Now go and change the Retail customer's group to "Temp Group". Notice that the "Retail" group has been dropped all together. If you add Retail back, since the customers_group_id number is generated by the database dynamically, it will never be 0 again. So in order to fix the problem, you have to do it manually through the database. Not a problem for me, but I imagine that my clients won't be able to figure this out, and knowing the nature of clients, it's inevitable that they will find this problem in no time.
Another little problem is that if you edit a "Special" not add, but edit, it doesn't allow you to choose a new group for that special. This was relatively easy to fix, and if anyone wants the fix, I'll give it to them.
Anyway, I'm wondering if anyone else has run into these problems and if anyone has found a way around them. I'm currently designing a way to fix the first problem I mentioned, and I think that the best way would be a seperate "Group Editor" added to the list of tools on the Admin side. I'll post it, when I finish it, but in the mean time I'd like to get some feedback on the issues I mentioned.
Maybe it's just me
insectis
#55
Posted 10 September 2003 - 01:14 AM
#56
Posted 10 September 2003 - 03:56 AM
Using 2.2-ms2
S.P.P.C v3.5
Did the install as best I could, hit the button to go to Customers, got this message in customers.php
" Parse error: parse error in /home/someuser/public_html/catalog/admin/customers.php on line 229 "
Went and looked at the file in PHP expert (not me, the program) and got the error
" Parse error: parse error, unexpected T_CASE in customers.php on line 229 "
Here is the code for that area ----- line 229 is numbered as such
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");
tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id));
} else if ($error == true) {
$cInfo = new objectInfo($HTTP_POST_VARS);
$processed = true;
}
break;
229 case 'deleteconfirm':
$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
if (isset($HTTP_POST_VARS['delete_reviews']) && ($HTTP_POST_VARS['delete_reviews'] == 'on')) {
$reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'");
Would appreciate assistance to let me know how to fix this sucker, I am NOT PHP literate, so any help would be greatly appreciated.
Respects for the time taken to look
admin-monkey
__________________________________________________
No monkeys were harmed in this admission of ignorance
#57
Posted 10 September 2003 - 03:50 PM
....if i click the seperate categories i only see the normal prices ...not the "reseller" ...if i click on the product details ...the price is reseller again...
someone an idea ? i installed it now several times...nothing changed....
please help
#58
Posted 10 September 2003 - 03:50 PM
....if i click the seperate categories i only see the normal prices ...not the "reseller" ...if i click on the product details ...the price is reseller again...
someone an idea ? i installed it now several times...nothing changed....
please help
#59
Posted 11 September 2003 - 04:25 PM
My Basics:
Version:
- osC 2.2 MS2
Contributions:
- Separate_Pricing_Per_Customer_v3.5
(PriceModInstall_v3.5.txt 08/03/2003)
- quick_stockupdate
Settings:
TABLE_CUSTOMERS
customersgroup_name Default Standard
Groups
- Standard
- Retail
- Friends
All groups have different prices for the products:
T-Shirt (no group) 25.00
T-Shirt for Standard 25.00
T-Shirt for Friends 17.24
T-Shirt for Retail 14.10
This Contribution works fine so long. But there is one Problem that I can't figure out why or where.
I want give different specials for the three groups concerning the same product:
T-Shirt for Standard 25.00
T-Shirt for Friends 16.00
T-Shirt for Retail 12.00
Every Group or anybody (no group) has their correct price but
in the Categories product-listing I can see the same product (always with the correct price) as often as I made specials for that product (but for the different groups).
Looks like (for "Friends"):
T-Shirt M Longsleeves K03M-2 25,00 - (no special)
T-Shirt M Sleeveless K03M-4 20,00 18,56 - (special)
T-Shirt M Sleeveless K03M-4 20,00 18,56 - (special)
T-Shirt M Sleeveless K03M-4 20,00 18,56 - (special)
I wonder if this caused in the
catalog/includes/modules/product_listing.php (around line 78):
if ($listing_split->number_of_rows > 0) {
$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
$rows++;
// contr: start separate_pricing_per_customer
$listing['specials_new_products_price']=tep_get_products_special_price($listing['products_id']);
// contr: end separate_pricing_per_customer
if (($rows/2) == floor($rows/2)) {
$list_box_contents[] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[] = array('params' => 'class="productListing-odd"');
}
or around line 110
break;
case 'PRODUCT_LIST_PRICE':
$lc_align = 'right';
// contr: start separate_pricing_per_customer
$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
$customer_group = tep_db_fetch_array($customer_group_query);
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $listing['products_id'] . "' and customers_group_id = '" . $customer_group['customers_group_id'] . "'");
if ( $customer_group['customers_group_id'] != 0) {
if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
$listing['products_price'] = $customer_group_price['customers_group_price'];
}
}
// contr: end separate_pricing_per_customer
if (tep_not_null($listing['specials_new_products_price'])) {
$lc_text = ' <s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
} else {
$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
}
break;
case 'PRODUCT_LIST_QUANTITY':
Any help is appreciated
Thank you in advance
Haegar
#60
Posted 11 September 2003 - 06:27 PM
Quote
Tiffany cox:
am new at this so please forgive my lack of knowledge.
I am currently using the 2.2MS2, but I do not have a catalog/inlcudes/database_tables.php file??? Therefore I can't make necessary changes.
Is it possible that I am missing a modification?
Any help would be appreciated.
Thanks,
TC
Ok so I was having the same problem and I could not figure out issue at all. But for the past few days I have been looking into the problem. It looks like our version of oscommerce "2.2ms2" has some changes.
First change:
database_tables.php does not exist they moved the list of tables to the catalog/includes/application_top.php
Ok the next thing that was changes is the products_new.php. What they did was move some of the functions so that it can be used by other files but I am not sure about that yet. So to make the changes is catalog/includes/modules/products_new.php there you will find the line
$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));I found it on line 26
Ok on the last change is the same as the catalog side but it is for the admin side same location
admin/includes/application_top.php
This is where you make the change
Quote
Around line 57
After:
define('TABLE_WHOS_ONLINE', 'whos_online');
define('TABLE_ZONES', 'zones');
Add:
define('TABLE_PRODUCTS_GROUPS', 'products_groups');
That is it I hope this helps you out and other people as well









