Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Hi Everyone

 

I am not sure if this is possible but thought i just ask to see if it is possible with this contribution.

 

I like this contribution as i can have customers in different groups. Well I have 5 categories and i have 3 groups.

 

Groups are based on membership fees.

 

Meaning:

 

Group1 has discount specials on Categories 1 and 3

 

Group2 has discount specials on Categories 1 and 2 and 3

 

Group3 has discount specials on all Categories

 

Rather than setting a price for each individual item for each group is it possible to just give percentage discount and anything in that category will automatically get discounted based on the group the customer is from?

 

Also is it possible to show the discount in the different groups to all customers when viewing the product (registered and non-registered) so that they can see the savings and then decide the membership they would like to take?

 

Is it possible and how or are their other contributions i can install along side this to get the result i am after?

 

All help appreciated.

Share this post


Link to post
Share on other sites

Hello,

 

Thanks again for a great contribution, works great. I do need some assistance. I would like in products/categories where cost and price are located to add dealer and distributor pricing. This is what I have for groups currently. I have the below statement in categories.php and I get the Dealers: and Distributors:, but I do not know how to make is show the correct pricing. I figure it will need to associate group id's and their corresponding pricing. Any help would be great.

 

Thanks JR

 

$contents[] = array('text' => '<br>' . TEXT_GROUP_DEALERS . $currencies->format($pInfo->products_cost) . ' ' . '<br>' . TEXT_GROUP_DISTRIBUTORS . ' ' . $currencies->format($pInfo->products_price) . '<br>');

Share this post


Link to post
Share on other sites

Using products_listing_col.php from v4.2.0 one little weird thing happens.

 

When i click on buy now button (in category listing) products that have different prices per group dont get added to the cart like the other products that dont have different prices. Is this how its suppose to be?

Share this post


Link to post
Share on other sites
Using products_listing_col.php from v4.2.0 one little weird thing happens.

 

When i click on buy now button (in category listing) products that have different prices per group dont get added to the cart like the other products that dont have different prices.

I can't reproduce that. Actually, the code does not involve any group stuff so it should either work for both or not at all. The html code does not involve more than a link to the current page, with an action of buy_bow and the products_id like:

	<td align="center" class="class="productListing-data" width="33%""><a href="http://192.168.0.9/cat_sppc_rc1/index.php?cPath=3_11&action=buy_now&products_id=5"><img src="includes/languages/english/images/buttons/button_buy_now.gif" border="0" alt="Buy Now" title=" Buy Now " width="60" height="14" style="padding-top: 5px;"></a> </td>

So check for the index.php?cPath=3_11&action=buy_now&products_id=5

It could be something in your application_top.php for these products too (but why is a mystery).

Share this post


Link to post
Share on other sites
Rather than setting a price for each individual item for each group is it possible to just give percentage discount and anything in that category will automatically get discounted based on the group the customer is from?

No, SPPC doesn't have that. But nothing stops you from using sql to add group prices. For example if those categories are 10 and 11 you could use (assuming you didn't really meant specials but group prices):

insert into products_groups select '2' as customers_group_id, (0.9 * p.products_price) as customers_group_price, p.products_id from products p, products_to_categories p2c where p.products_id = p2c.products_id and p2c.categories_id in (10, 11);

This works as long as products in category 10 are not also present in category 11 otherwise you get a "duplicate key error" trying to do that.

 

Also is it possible to show the discount in the different groups to all customers when viewing the product (registered and non-registered) so that they can see the savings and then decide the membership they would like to take?

I'm sure it is possible to do that with a little extra code/queries to get the prices from the table products_groups. However, that other people/companies get better prices is usually not something you want to communicate with everybody ;)

Share this post


Link to post
Share on other sites
I have this exact same problem.

Retail prices are good (including tax) everywhere in the store, I just want to "split them up" on the Order Confirmation page:

Product Prices --> Excluding Tax

Sub-Total Price --> Excluding Tax

Total Tax displayed seperately

Total price --> Including Tax

 

For Customer Groups having setting "Display without Tax" the above is done correctly.

 

Anyone know a solution (or where to start looking)???

I guess you can change that directly in checkout_confirmation.php.

On somewhere around line 200 that code starts:

	if (sizeof($order->info['tax_groups']) > 1) echo '			<td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

echo '			<td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
	 '		  </tr>' . "\n";
 }

Replacing $order->products[$i]['tax'] with '0' or '' should work (haven't tried it).

 

Probably the sub total will be more problematic. I think you would have to adapt includes/modules/order_total/ot_subtotal.php where it is processed in function process.

Share this post


Link to post
Share on other sites

If the following are stupid questions then just say so and don't waste time answering. Is there some sort of manual that explains the inner-logic of SPPC ? (this thread is getting a little too big)

 

Say I have a product with product_id=208, with a separate price per customer I am begining to have links that look like: product_info.php?products_id=208{6}14

(I am seeing this kind of link in the shopping_cart (in categories links are the same as before SPPC), other products that do not have separate prices per customer have their usual Ultimate Seo url)

 

Now the silly questions, what do the {6} and 14 mean ?

Share this post


Link to post
Share on other sites
If the following are stupid questions then just say so and don't waste time answering. Is there some sort of manual that explains the inner-logic of SPPC ? (this thread is getting a little too big)

 

Say I have a product with product_id=208, with a separate price per customer I am begining to have links that look like: product_info.php?products_id=208{6}14

(I am seeing this kind of link in the shopping_cart (in categories links are the same as before SPPC), other products that do not have separate prices per customer have their usual Ultimate Seo url)

 

Now the silly questions, what do the {6} and 14 mean ?

Those identify the product attributes, say 6 for color, 14 for black. They have nothing to do with SPPC really. Until quite recently SPPC could not even address different pricing for attributes.

 

In product listings you should not see the attributes in the link. Only in the shopping cart and the box in right hand column for stuff you bought earlier you will find links like this.

 

When a product has attributes and you use the buy_now button, the code in application_top.php will redirect you to product_info.php to choose attributes.

 

In those last versions of product_listing_col.php you can (if you choose so in admin) directly choose attributes from the product listing. You will need to add the code from that original product listing contribution to be able to do that.... The directions for that are not included in SPPC, it is just that specific version of the module product_listing_col.php that was added.

Share this post


Link to post
Share on other sites
Replacing $order->products[$i]['tax'] with '0' or '' should work (haven't tried it).

 

Probably the sub total will be more problematic. I think you would have to adapt includes/modules/order_total/ot_subtotal.php where it is processed in function process.

 

Yep, X-actly like you said Jan:

Products are now Displayed without tax, AND the SubTotal is Problematic.

 

I'll go in the Order_Total Functions, and change it there (As I do want it like that for every customer(group))

 

Thanks for the help so far!


Like Eek said... It never hurts to help!
----------------------------------------

Share this post


Link to post
Share on other sites

I found out what the numbers were but you already posted. Really sorry to have wasted your time. Now i remember why I originally disabled attributes alltogether, I dont want links looking like that (not seod).

 

When a product has attributes and you use the buy_now button, the code in application_top.php will redirect you to product_info.php to choose attributes.

... and there was light !

Clearly i am stupid.

 

 

sorry to waste your time :((

Share this post


Link to post
Share on other sites

Hello Jan,

 

Thanks again for all the great help. A few posts back, I see exactly what I was looking for SPPC to do, automatically discount groups by percentage. But, the code below shows for only a certain categories. I just need it for each group. Also with the below code, will it automatically enter amount for each group when a new item is added?

 

Thanks JR

 

 

insert into products_groups select '2' as customers_group_id, (0.9 * p.products_price) as customers_group_price, p.products_id from products p, products_to_categories p2c where p.products_id = p2c.products_id and p2c.categories_id in (10, 11);

Share this post


Link to post
Share on other sites
A few posts back, I see exactly what I was looking for SPPC to do, automatically discount groups by percentage. But, the code below shows for only a certain categories. I just need it for each group.

See this post for that.

Also with the below code, will it automatically enter amount for each group when a new item is added?

No, but it can be done with a little JavaScript (check also the post I linked to). We went over this JavaScript issue before where I gave an example for three groups (retail plus two other customer groups).

Share this post


Link to post
Share on other sites

Hello Jan,

 

Actually the Texmaxx link helps a lot. One question, I now see the java script code mentioned and has to added. Where I am confused is what code sample am I using after, I have three customer groups, retail, but that is fine, just retail pricing, I also have dealer and distributor pricing. I do not understand which example code to use, I have dealers 55% off retail and distributor 60% off retail. So would I use examples that he shows for retail price breaks?

 

Thanks JR

Share this post


Link to post
Share on other sites
So would I use examples that he shows for retail price breaks?

No, those are used in the Quantity Price Break Per Product contribution (for SPPC). You don't have those (I suppose).

Share this post


Link to post
Share on other sites

Hi guys,

 

I found this contribution a few days ago, Select Special

 

And in searching I found someone had done a SPPC version

(I used babelfish.altavista.com to translate)

 

I have it working on my local site, but not live site. The select special page just shows a blank page.

I have looked a few times, but honestly cannot see what's wrong.

 

Here is my select_specials.php

<?php
/*
* $Id$
*
* Copyright © 2004, Felix Schwarz < Felix.Schwarz@grede.de >
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the enclosed file COPYING for license information. If you
* did not receive this file, see [url="http://www.gnu.org/licenses/gpl.txt"]http://www.gnu.org/licenses/gpl.txt[/url].
*/

 require('includes/application_top.php');
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
?>

<!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>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>

</head>


<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- 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="2">
     <tr>
       <td width="100%"><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_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>


     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><br/>

           <?php echo tep_draw_form('search_specials', FILENAME_SELECT_SPECIALS, '', 'post'); ?>
             <table border='0'>
               <tr>
                 <td class='main'><?php echo TEXT_SPECIALS_PRODUCT; ?></td>
                 <td class='main'><?php echo tep_draw_input_field('products_name') ?></td>
               </tr>

               <tr>
                 <td class='main'><?php echo TEXT_SPECIALS_MODEL; ?></td>
                 <td class='main'><?php echo tep_draw_input_field('products_model') ?></td>
               </tr>

               <tr>
                 <td class='main' colspan='2' align='right'><input type='submit' value='<?php echo SUBMIT_SEARCH; ?>'/></td>
               </tr>
             </table>
             </form>

             <?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>

		  <table border="0" width="100%" cellspacing="0" cellpadding="2">
		    <tr class="dataTableHeadingRow">
                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_MODEL; ?></td>
                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td>
                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
               </tr>

<?php
$name = $HTTP_POST_VARS['products_name'];
$model = $HTTP_POST_VARS['products_model'];

if (tep_not_null($name) || tep_not_null($model)) {

	$sql = "select d.products_id, d.products_name, p.products_model, p.products_price, p.products_status from ".TABLE_PRODUCTS_DESCRIPTION." d, ".TABLE_PRODUCTS." p where d.language_id = '" . (int)$languages_id . "' and d.products_id = p.products_id";
	if (tep_not_null($name))  $sql .= " and d.products_name like '%" . tep_db_prepare_input($name) . "%'";
	if (tep_not_null($model))  $sql .= " and p.products_model like '%" . tep_db_prepare_input($model) . "%'";

	$search_query = tep_db_query($sql);
	while ($result = tep_db_fetch_array($search_query)) {
		if ($result['products_status'] == '1')
			$icon = tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10);
		else
			$icon = tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
?>
               <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_SPECIALS, '&prodID=' . $result['products_id'] . '&action=new'); ?>'">
                 <td  class="dataTableContent">
                   <a href="<?php echo tep_href_link(FILENAME_SPECIALS, '&prodID=' . $result['products_id'] . '&action=new'); ?>"><?php echo $result['products_name']; ?></a>
                 </td>
                 <td  class="dataTableContent" align="right"><?php echo $result['products_model']; ?></td>
                 <td  class="dataTableContent" align="right"><?php echo $currencies->format($result['products_price']); ?></td>
                 <td  class="dataTableContent" align="right"><?php echo $icon; ?></td>
               </tr>
<?php
   	} // while ($search_result = tep_db_fetch_array($search_query))
} // if (tep_not_null($name) || tep_not_null($model))
?>

             </table>


           </td>
           <td class="main" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>

     <tr>
       <td class="main" align="center">
         <br><br><br><br><br>
         <?php echo TEXT_ADVERTISING; ?>
       </td>
     </tr>
     </table>

   </td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->


<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Thanks in advance

Edited by stonjie

Share this post


Link to post
Share on other sites
I found this contribution a few days ago, Select Special

 

And in searching I found someone had done a SPPC version

(I used babelfish.altavista.com to translate)

 

I have it working on my local site, but not live site. The select special page just shows a blank page.

I have looked a few times, but honestly cannot see what's wrong.

Perhaps you didn't add the filename to the admin/includes/filenames.php:

// Select Specials Start
 define('FILENAME_SELECT_SPECIALS', 'select_specials.php');
// Select Specials End

You would get a 404 error if you did a search. You are not totally clear on what you mean with "just shows a blank page." After what, if you do what, immediatly when you try to open...?

 

Here is my select_specials.php
Which is exactly the same as the one from the package. So no problem there.

Share this post


Link to post
Share on other sites

I've just completed upgrading, or at least copying new files/code(4.20) to a working version of SPPC 4.15(w/ Hide Product for SPPC) in my heavily modified testing store. The first thing I noticed is I'm missing the tep_hide_session_id() function and it doesnt seem to exist in the functions files in SPPC 4.15 or 4.20. Its not in my functions/sessions.php file either.

 

Where did this come from? Did this enter SPPC between 4.15 and 4.20? If I remember correctly this function is used only in create_account.php and admin/orders.php in SPPC4.20.

 

SPPC4.15 doesnt even edit orders.php and create_account.php has no mention of it.

 

Can someone tell me where this came from and possible post the function and where it goes?

 

TIA


Matt Mika

Installed Contributions: Multi-Stores, QTPro, CCGV(trad), Batch Print, EasyPopulate, Simple Manual Order Entry, Encrypting Credit Card Via Mcrypt, UPSXML, Down for Maintenance, On The Fly GD Thumbs, SPPC, SPPC Hide, and various personal tweaks

Share this post


Link to post
Share on other sites
I'm missing the tep_hide_session_id() function and it doesnt seem to exist in the functions files in SPPC 4.15 or 4.20. Its not in my functions/sessions.php file either.

 

Where did this come from?

This is found close the bottom of admin/includes/functions/html_output.php. Seems to be new for RC1 (between function tep_draw_hidden_field and tep_draw_pull_down_menu):

////
// Hide form elements
 function tep_hide_session_id() {
$string = '';

if (defined('SID') && tep_not_null(SID)) {
  $string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
}

return $string;
 }

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites
This is found close the bottom of admin/includes/functions/html_output.php. Seems to be new for RC1 (between function tep_draw_hidden_field and tep_draw_pull_down_menu):

////
// Hide form elements
 function tep_hide_session_id() {
$string = '';

if (defined('SID') && tep_not_null(SID)) {
  $string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
}

return $string;
 }

 

Yea, I just download RC1 and found it, thanks...


Matt Mika

Installed Contributions: Multi-Stores, QTPro, CCGV(trad), Batch Print, EasyPopulate, Simple Manual Order Entry, Encrypting Credit Card Via Mcrypt, UPSXML, Down for Maintenance, On The Fly GD Thumbs, SPPC, SPPC Hide, and various personal tweaks

Share this post


Link to post
Share on other sites
Perhaps you didn't add the filename to the admin/includes/filenames.php:

// Select Specials Start
 define('FILENAME_SELECT_SPECIALS', 'select_specials.php');
// Select Specials End

You would get a 404 error if you did a search. You are not totally clear on what you mean with "just shows a blank page." After what, if you do what, immediatly when you try to open...?

 

Which is exactly the same as the one from the package. So no problem there.

 

The define is in filenames.php. I followed the instructions both times (local & Live) exactly. I'm just not sure why it doesn't work for the live site.

 

I click on specials, it opens up fine. I click on new special(both in specials.php and in the catalog box), it redirects to select_special.php and shows a blank page. What I mean by blank is Blank. Nothing shows at all; no header, no columns, no error. Nothing at all. Not even anything in source. In generated source, I get <html><head></head><body></body></html> but that is all.

Share this post


Link to post
Share on other sites
The define is in filenames.php. I followed the instructions both times (local & Live) exactly. I'm just not sure why it doesn't work for the live site.

 

I click on specials, it opens up fine. I click on new special(both in specials.php and in the catalog box), it redirects to select_special.php and shows a blank page. What I mean by blank is Blank. Nothing shows at all; no header, no columns, no error. Nothing at all. Not even anything in source. In generated source, I get <html><head></head><body></body></html> but that is all.

What is the link if you hover over the button with your pointer. Something that end with admin/select_specials.php?page=1&action=new. Your file works fine in one of my local test shops by the way.

Share this post


Link to post
Share on other sites
What is the link if you hover over the button with your pointer. Something that end with admin/select_specials.php?page=1&action=new. Your file works fine in one of my local test shops by the way.

 

 

In Specials.php it says /admin/select_specials.php?page=1&action=new

 

in catalog box it says /admin/select_specials.php

 

Both come up blank

 

Uploading a file (as apposed to FTPing) wouldn't change anything would it? I can't currently FTP to my site (Network settings), so I Uploaded using OSCommerce Upload feature, the two files needed for this Contrib. I haven't figured out how, if possible, to CHMOD files through the oscommerce file manager yet.

Edited by stonjie

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

×