Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Debbie,

I'm not getting the mail sent to the wholesale people when I approve them.. was that not going to happen??? Can it happen??
I don't think I totally understand your problem. I checked this and confirmed it does send out an email to the wholesale customer. Do you want a copy of that email, is that what you want? (just add another tep_mail(....) right after the one to the wholesale customer with a mail to yourself in that case).

 

I can't allow the consumer to purchase the items they should not get their hands on (chemicals in my case for nail and hair professionals)  When I do not log in and go to the products with zero or blank for retail pricing it shows the product but with a $0.00 cost!!

For this you can use the Hide Price if $0 contribution.
Link to comment
Share on other sites

This is my bestsellers file:

This looks like it is working OK.

<?php
/*
$Id: best_sellers.php,v 1.19 2002/06/05 20:59:08 dgw_ Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com]http://www.oscommerce.com
Copyright (c) 2001 osCommerce
Released under the GNU General Public License
*/
/* <!-- best_sellers //--> */ 
if ($cPath) {
$best_sellers_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, p.products_ordered from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and (c.categories_id = '" . $current_category_id . "' OR c.parent_id = '" . $current_category_id . "') order by p.products_ordered DESC, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
} else {
$best_sellers_query = tep_db_query("select p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, p.products_ordered from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by p.products_ordered DESC, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
}
if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
 
  // global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
 
 while ($_best_sellers = tep_db_fetch_array($best_sellers_query)) {
  $best_sellers[] = $_best_sellers;
  $list_of_product_ids[] = $_best_sellers['products_id']; // populate array of product id's
 } // end while ($_best_sellers = tep_db_fetch_array($best_sellers_query))
 $listing_of_prdct_ids = implode(",", $list_of_product_ids);// create comma separated list of product id's
 
// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id in (". $listing_of_prdct_ids .") and pg.customers_group_id = '".$customer_group_id."'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_bestseller_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price']);
}

  for ($x = 0; $x < count($best_sellers); $x++) {
// replace products prices with those from customers_group table
       if(!empty($new_bestseller_prices)) {
    for ($i = 0; $i < count($new_bestseller_prices); $i++) {
     if( $best_sellers[$x]['products_id'] == $new_bestseller_prices[$i]['products_id'] ) {
	 $best_sellers[$x]['products_price'] = $new_bestseller_prices[$i]['products_price'];
     }
    }
} // end if(!empty($new_bestseller_prices)
  } // end for ($x = 0; $x < count($best_sellers); $x++)
} // end if ($customer_group_id != '0')
?>
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);
new infoBoxHeadingBoxen($info_box_contents, false, true);
$rows = 0;
$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
// next line original code
// while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
for ($x = 0; $x < count($best_sellers); $x++) { 
// change all $best_sellers['db_field'] to $best_sellers[$x]['db_field']
$rows++;
$bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers[$x]['products_id']) . '">' . $best_sellers[$x]['products_name'] . '</a><b><br>' . $currencies->display_price($best_sellers[$x]['products_price'], tep_get_tax_rate($best_sellers[$x]['products_tax_class_id'] . '</b></td></tr>'));
} // end for ($x = 0; $x < count($best_sellers); $x++)
$bestsellers_list .= '</table>';
$info_box_contents = array();
$info_box_contents[] = array('text' => $bestsellers_list);
new infoBox($info_box_contents);
?>
</td>
</tr>
<?php } 
/* <!-- best_sellers_eof //--> */ 
?>

Link to comment
Share on other sites

Hi all.

 

I've searched all 68 pages in this post but can't find/missed my particular problem.

 

I'm not 100% sure this is related to this contribution but this is what happens.

 

When an order is placed, the shipping charge in the total INCLUDES VAT whereas it should not, VAT should be added afterwards in the total.

 

Have I missed a mod or has this not been addressed yet?

 

Great contribution BTW.

 

Ken.

Link to comment
Share on other sites

Ken,

When an order is placed, the shipping charge in the total INCLUDES VAT whereas it should not, VAT should be added afterwards in the total.

 

Have I missed a mod or has this not been addressed yet?

SPPC doesn't do that, even the SPPC code that is in the class order.php should/can be taken out. It has done its job before you go to checkout (not completely true, since you can change what groups are exempt from tax, and what payment and shipping modules to use).

 

I have seen a contribution mentioned that makes an osC site fit for the UK. Might that contribution address that?

Link to comment
Share on other sites

Thanks JanZ

 

I already have the UK contribution installed. The problem was, shipping was not being taken into account for VAT purposes so I hunted around, realised in the admin that I had not made shipping = VAT Taxable goods so it could not be calculated for tax. Changed that, now it shows shipping as including VAT but not having VAT calculated on the total.

 

Doing my head in :)

 

Let me explain fully, sorry this will be a little long. I'll describe the Retail Customers process first then wholesale customers.

 

Retail Customers (Customer Group 1):

Because of EU directives, we have to display the total price including VAT at 17.5%. This goes from product -> checkout confirmation. What we get is

product page = Retail Price - (1056.33)

shopping basket = Retail Price - (1056.33)

checkout shipping = Shipping Price - (94.00 shipping price inc VAT)

checkout payment = No price (fine no probs)

 

now it gets confusing for retail customers on checkout confirmation;

 

Sub-Total = 1056.33

Shipping = 94.00

VAT = 171.33

Total = 1150.33

 

It LOOKS like the VAT is included in the Total but it is not. The Total price is correct, it just looks confusing.

What should be displayed is:

 

Sub-Total = 899.00

Shipping = 80.00

VAT = 171.33

Total = 1150.33

 

 

 

Now to Wholesale Customers (Customer Group 2):

product page = Wholesale Price - (699.00)

shopping basket = Wholesale Price - (699.00)

checkout shipping = Shipping Price - (80.00 shipping price exc VAT) <---- Right

checkout payment = No price (fine no probs)

 

When we get to checkout confirmation we get:

 

Sub-Total = 699.00

Shipping = 94.00 <---- WRONG

VAT = 136.33

Total = 915.33

 

Note that the Shipping cost is wrong, it includes VAT whereas it should not but in the previous step (Delivery Information - checkout shipping) it displays correctly.

 

It should be:

 

Sub-Total = 699.00

Shipping = 80.00 <---- Right

VAT = 136.33

Total = 915.33

 

 

Sorry if I am missing something fundemental here, but it just *seems* to me that SPPC should be affecting the final prices and the way they are displayed on checkout confirmation as well as everywhere else pertaining to Customer Groups?

 

Also, just a preference, is it possible to have the final totals formatted this way:

 

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

Product Price (Ex VAT) VAT Sub-Total

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

widget 899.00 157.33 1056.33

Shipping 80.00 14.00 94.00

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

Totals: 979.00 171.33 1150.33

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

 

This clearly displays each product price before VAT, the VAT, the sub-total for each item

and then the totals. Bit much to ask??? :) I would modify it myself as I am fine with php,

just classes I have a problem with ;) Keep telling myself I must learn how to use classes

properly.

 

Sorry it is so long and even sorrier if my problem is not part of this excellent contribution.

 

 

Best Regards

 

 

Ken.

Link to comment
Share on other sites

now it gets confusing for retail customers on checkout confirmation;

 

Sub-Total = 1056.33

Shipping = 94.00

VAT = 171.33

Total = 1150.33

 

It LOOKS like the VAT is included in the Total but it is not. The Total price is correct, it just looks confusing.

In my opinion it is the way osC works (the standard way). You are right, it is confusing. Maybe less confusing would be to make it VAT included = 171.33 ?
When we get to checkout confirmation we get:

 

Sub-Total = 699.00

Shipping = 94.00 <---- WRONG

VAT = 136.33

Total = 915.33

 

Note that the Shipping cost is wrong, it includes VAT whereas it should not but in the previous step (Delivery Information - checkout shipping) it displays correctly.

 

It should be:

 

Sub-Total = 699.00

Shipping = 80.00 <---- Right

VAT = 136.33

Total = 915.33

Sorry if I am missing something fundamental here, but it just *seems* to me that SPPC should be affecting the final prices and the way they are displayed on checkout confirmation as well as everywhere else pertaining to Customer Groups?

Nothing is ever perfect and there are a lot of combinations possible ...

 

To me it looks like this shipping cost is coded in another way than "regular". For prices this function in includes/functions/general.php was hacked:

// Add tax to a products price
 function tep_add_tax($price, $tax) {
   global $currencies;
// BOF Separate Pricing Per Customer, show_tax modification
// next line was original code
//    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
   global $sppc_customer_group_show_tax;
   global $sppc_customer_group_tax_exempt;
    if(!tep_session_is_registered('sppc_customer_group_show_tax')) { 
    $customer_group_show_tax = '1';
    } else {
    $customer_group_show_tax = $sppc_customer_group_show_tax;
    }
    
//    echo '<br>cg_tax_exempt: ';
//    echo $sppc_customer_group_tax_exempt;
    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) && ($customer_group_show_tax == '1')) {
// EOF Separate Pricing Per Customer, show_tax modification

etc.

My educated guess it that you need to hack this part in includes/modules/order_total/ot_shipping.php in a similar way (around line 74-75):

 

          if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

Also, just a preference, is it possible to have the final totals formatted this way:

I am convinced that that is possible but do you mind if I pass on that one ;)
Link to comment
Share on other sites

Debbie,

I don't think I totally understand your problem. I checked this and confirmed it does send out an email to the wholesale customer. Do you want a copy of that email, is that what you want? (just add another tep_mail(....) right after the one to the wholesale customer with a mail to yourself in that case).

MO I was hoping it would send a email when the wholesale person was vaidated in the office but I think I recall you said that wasn;t going to happen.. it's not like there will be loards of them :) so the office can send it directly.

 

For this you can use the Hide Price if $0 contribution.

 

OK I thought that was what I would have to do.

 

Hum but I read that and the item will stil show bu with no price.. thats not what I want to accomplsih.. I do not want the retail people to see the professioanl products at all..

Edited by wkdwich

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

Link to comment
Share on other sites

Debbie,

MO I was hoping it would send a email when the wholesale person was vaidated in the office but I think I recall you said that wasn;t going to happen..
I don't know why it doesn't work for you, it works fine in my test site.
I do not want the retail people to see the professioanl products at all..

For that you can use Hide products from customer groups for SPPC.
Link to comment
Share on other sites

HI friend:

 

can make a full packing for the last ver. ?

why did when i run the price-break_1113_sppc.sql then the phpmyadmin show me like follow:

 

#1060 - Duplicate column name 'products_qty_blocks'

 

but when i check the produts tables , all of the Sql info was add inside !

 

did that need run in products table ?

 

 

what's problem for this !

 

 

BR.,

 

Denis

Link to comment
Share on other sites

and in the admin product/catalog

 

show me:

 

Categories / Products Status Action

 

1054 - Unknown column 'p.products_price1' in 'field list'

 

select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by pd.products_name

 

 

why?

and sloution here ?

 

BR.,

 

Denis

Link to comment
Share on other sites

Denis,

when i run the price-break_1113_sppc.sql then the phpmyadmin show me like follow:

 

#1060 - Duplicate column name 'products_qty_blocks'

 

but when i check the produts tables , all of the Sql info was add inside !

Your next post:

1054 - Unknown column 'p.products_price1' in 'field list'
is in contradiction to what you said there. Since the sql gave an error I have to assume it didn't run and didn't do anything to your table.

 

If there is already a column named 'products_qty_blocks' in your table products (and therefore you get an error) you will have to make a decision on what contribution you want to use (or in which one it is the easiest to change to change the column name so can you use both) or whether you can just use the info in that column for this contribution. In the last case you just change the end of the sql on the table products (using a text editor of course) to not add the column products_qty_blocks.

.
.
.
add column products_price8_qty int not null default 0,
add column products_price8_qty int not null default 0;

alter table products_groups
add column products_price1 decimal(15,4) not null default 0.0,
etcetera

 

The sql runs both on the table products as well as products_groups. The sql on the table products is the same as for the "regular" quantity price breaks contribution.

Link to comment
Share on other sites

Debbie,

I don't know why it doesn't work for you, it works fine in my test site.

The email was sent then they signed up for the wholesale account, but nothing was sent when I went in turned off the alert light and actually moved them from retail to wholesale.. I'll have to test and see what notice they did receive when originally registering.. i it was the generic retial or the special wholesale "hang on while we check you out"

 

OK great thats what I thought.. that one looks involved need to clear the head before starting this one :)

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

Link to comment
Share on other sites

OK, I've got a good one for y'all...

 

I'm using SPPC with Master Products.

 

I would like create attributes for a six-pack and twelve-pack option for my Retail customers only. Can I create attributes that are only available to the Retail group?

 

Thanks,

Mark

Link to comment
Share on other sites

I'm using SPPC with Master Products.

 

I would like create attributes for a six-pack and twelve-pack option for my Retail customers only. Can I create attributes that are only available to the Retail group?

You are sure about attributes? I mean, you are using Master Products which I personally use instead of attributes.
Link to comment
Share on other sites

You are sure about attributes? I mean, you are using Master Products which I personally use instead of attributes.

I think so. Attributes/options.

 

I'm an artist. My master product is the artwork. My slaves are note cards, magnets, t-shirts, etc. I want to create, for example, an attribute (bundle) with options (6-pack, 12-pack), but only for retail customers. Wholesale customers will already be purchasing in quantity.

 

Isn't that why there is an 'option' column in the slave table?

 

Thanks.

Link to comment
Share on other sites

Isn't that why there is an 'option' column in the slave table?

No clue what you are talking about. The master.sql of Master Products version 1.1.5 only makes changes to the table products:
ALTER TABLE products ADD products_master int(11) NOT NULL default '0';
ALTER TABLE products ADD products_master_status tinyint(2) NOT NULL default '0';
ALTER TABLE products ADD products_listing_status tinyint(2) NOT NULL default '1';

I only added products_to_master myself, to assign products to several masters, but that is a hack that was described in the thread a long time ago and I don't think it ever went into the Master Products contribution (there is no admin part for it, I do that manually with phpMyAdmin).

 

I thought I had found a way to hide attributes for groups but since you seem to have a very different table structure I won't bother you with it.

Link to comment
Share on other sites

No clue what you are talking about. The master.sql of Master Products version 1.1.5 only makes changes to the table products

Thanks again for your help in the Master Products forum.

 

Here is a product page on my site. I am referring to to the option column in the slave table. Isn't that where attributes/options created in admin would show up? If so, can I display that column only for Retail customers? I hope I'm being clear.

Link to comment
Share on other sites

I am referring to to the option column in the slave table. Isn't that where attributes/options created in admin would show up? If so, can I display that column only for Retail customers? I hope I'm being clear.

OK, now I understand what you mean. I was reading table as in MySQL table and you as HTML table. Sure I guess you could do that (master_listing.php I think?) but I checked your site and there is a way around it: add it to the shopping cart and then follow the link back to the individual product. Then you can choose the options again.

 

My angle was to add a column to the table products_attributes and using the technique used in Hide Products from customer groups for SPPC. Since options are only shown on product_info.php as far as I know you would not need change other pages than that one. However.... if you add a product from a product listing in a category application_top will send you to the product_info page to choose the attributes, even if you hid them from this group so it needs changes in the function tep_has_product_attributes in includes/functions/general.php too.

 

OK, this is my approach (no admin part to this, phpMyAdmin to add groups to hide this attribute: @,0 for retail; @,0,1 for retail and customer group 1 etc).

 

Backup, backup, backup and then run an sql query:

ALTER TABLE products_attributes ADD attributes_hide_from_groups VARCHAR(255) DEFAULT '@' NOT NULL;

 

Change product_info.php, starts around line 193, just below the echo'ing of the product description:

          <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
/*   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); */
// BOF Hide attributes from customer groups
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
/*      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); */
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
/*        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); */
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
// EOF Hide attributes from customer groups
       while ($products_options = tep_db_fetch_array($products_options_query)) {

Changes in tep_has_product_attributes (includes/functions/general.php, around line 1025):

// Check if product has attributes
 function tep_has_product_attributes($products_id) {
// BOF Hide attributes from customer groups (SPPC hack)
 global $sppc_customer_group_id;
 
 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
    $customer_group_id = $sppc_customer_group_id;
 }
   $attributes_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
// EOF Hide attributes from customer groups (SPPC hack)    
   $attributes = tep_db_fetch_array($attributes_query);

Link to comment
Share on other sites

Hi,

 

I want wholesaleprices being displayed excl. tax and retailprices incl. tax.

That works fine just by switching the setting in the customergroup.

 

But: during checkout, the taxes were not calculated correct as the shop setting DISPLAY_PRICE_WITH_TAX in my case is true, but the setting $customer_group_show_tax for the wholesale group is false and was not recognized.

 

I did this modification to catalog/includes/classes/order.php:

 

BEFORE

      for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

ADD CODE

// BOF SPPC
     global $sppc_customer_group_show_tax;
     global $sppc_customer_group_tax_exempt;
     if(!tep_session_is_registered('sppc_customer_group_show_tax')) {
        $customer_group_show_tax = '1';
     } else {
        $customer_group_show_tax = $sppc_customer_group_show_tax;
     }
// EOF SPPC

 

REPLACE CODE (you will find this twice, replace both)

        if (DISPLAY_PRICE_WITH_TAX == 'true')  {

 

WITH

        if ((DISPLAY_PRICE_WITH_TAX == 'true') && ($customer_group_show_tax == '1')) { // MOD SPPC

 

Now it works correct.

I'm not a professional programmer, so (Janz) please let me know, if this is the right way.

 

BTW, Thank you very much for all your support!

I have got SPPC to work with hiding, pricebreaks, attributes, qtpro... only because of this thread and your input!

Thanks again!

 

Regards, G?tz

Link to comment
Share on other sites

G?tz/texmaxx,

I did this modification to catalog/includes/classes/order.php:
You did an excellent job, actually better than I did. I am a bit confused though, since similar code (yours is shorter) should have been present in that class. I don't know where things went wrong there.

 

Note that you are right: this is the only modification to catalog/includes/classes/order.php that is needed. The rest of the SPPC code in that file (from the package) can safely be omitted (would be disastrous if it worked even).

 

It was mentioned a couple of days ago (see my post and the ones before that) that something else goes wrong with VAT and shipping. In the class includes/modules/order_total/ot_shipping.php there is also a mention of DISPLAY_PRICE_WITH_TAX. This might be another flaw in SPPC.

Link to comment
Share on other sites

JanZ

 

Yes, I have found out a few little tweaks to tune things in shipping and totals:

 

I'm in Germany, we need to have nettotal on our invoice, which is only needed in the retailshop, as in the wholesale we have no tax included in the price and therefor no need of this module.

 

So I did this:

In catalog/includes/modules/order_total/ot_netto.php to hide this module if wholesale is on.

    function ot_netto() {
     global $sppc_customer_group_show_tax;
     if(!tep_session_is_registered('sppc_customer_group_show_tax')) {
     $customer_group_show_tax = '1';
     } else {
     $customer_group_show_tax = $sppc_customer_group_show_tax;
     }
     $this->code = 'ot_netto';
     $this->title = MODULE_ORDER_TOTAL_NETTO_TITLE;
     $this->description = MODULE_ORDER_TOTAL_NETTO_DESCRIPTION;
     if ($customer_group_show_tax == '1'){
       $this->enabled = ((MODULE_ORDER_TOTAL_NETTO_STATUS == 'true') ? true : false);
     }

 

In catalog/includes/modules/order_total/ot_tax.php I changed the value of $key to get language support and switch between "included tax" for retail and "tax" for wholesale. $key is set as description in the taxsettings of the shop and is "16%" in my case. The constants MWST_ENTHALTEN and MWST_TEXT have to be defined in the languagefiles in catalog/includes/languages/*.php

    function process() {
     global $order, $currencies;
     global $sppc_customer_group_show_tax;
     if(!tep_session_is_registered('sppc_customer_group_show_tax')) {
     $customer_group_show_tax = '1';
     } else {
     $customer_group_show_tax = $sppc_customer_group_show_tax;
     }

     reset($order->info['tax_groups']);
     while (list($key, $value) = each($order->info['tax_groups'])) {
       if ($customer_group_show_tax == '1'){
         $key= MWST_ENTHALTEN . MWST_TEXT . $key;
       } else {
         $key= MWST_TEXT . $key;
       }
       if ($value > 0) {
         $this->output[] = array('title' => $key . ':',
                                 'text' => $currencies->format($value, true, $order->info['currency'], $order->info['currency_value']),
                                 'value' => $value);
       }
     }
   }

 

 

In catalog/includes/modules/order_total/ot_shipping.php I switch between adding tax to the shippingcosts for retail and net for wholesale, as tax is than added after on the whole.

 

function process() {

global $order, $currencies;

global $sppc_customer_group_show_tax;

if(!tep_session_is_registered('sppc_customer_group_show_tax')) {

$customer_group_show_tax = '1';

} else {

$customer_group_show_tax = $sppc_customer_group_show_tax;

}

if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {

switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {

case 'national':

if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;

case 'international':

if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;

case 'both':

$pass = true; break;

default:

$pass = false; break;

}

 

if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {

$order->info['shipping_method'] = $this->title;

$order->info['total'] -= $order->info['shipping_cost'];

$order->info['shipping_cost'] = 0;

}

}

 

$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));

 

if (tep_not_null($order->info['shipping_method'])) {

if ($GLOBALS[$module]->tax_class > 0) {

$shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

 

$order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

$order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

$order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

if ((DISPLAY_PRICE_WITH_TAX == 'true') && ($customer_group_show_tax == '1')) $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

}

 

$this->output[] = array('title' => $order->info['shipping_method'] . ':',

'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),

'value' => $order->info['shipping_cost']);

}

}

 

 

Best regards

G?tz

Link to comment
Share on other sites

Hiding Categories for SPPC

 

JanZ has allready provided some code to do this, I have done this now in that way that you can enter the categories IDs in a field in your configuration table.

It might be possible to extend this, so we can hide cats individually from different customergroups...

 

 

ADD THIS column to your databasetable configuration, you will find it later in your admin configuration productlisting (GroupID 8):

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )
VALUES (
'', 'Hide Categories (SPPC)', 'HIDING_CATEGORIES', '', 'Enter the categories IDs, which you want to hide from retailcustomers.<br>Seperate the IDs by kommas (example: 1,4,7)', '8', '4', '', '', NULL , NULL
);

 

 

In catalog/includes/boxes/categories.php

 

AFTER

  new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '';
 $tree = array();

 

ADD

// BOF Hide certain categories for specific customer groups
 global $sppc_customer_group_id;
 if (!tep_session_is_registered('sppc_customer_group_id')) {
   $customer_group_id = '0';
 } else {
   $customer_group_id = $sppc_customer_group_id;
 }

 if ($customer_group_id == '0') {
   $additional_constraint = " and c.categories_id NOT IN (" . HIDING_CATEGORIES . ") ";
 } else {
   $additional_constraint = '';
 }

 

 

REPLACE the next line:

  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

 

WITH

  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name");

 

 

REPLACE

      unset($parent_id);
     unset($first_id);
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

 

WITH

      unset($parent_id);
     unset($first_id);
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name");

 

 

For those of you who use the coolmenu contrib, you have to change the function tep_get_categories in catalog/includes/functions/general.php

 

REPLACE the function WITH

  function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {
   global $languages_id;
   global $sppc_customer_group_id;
   if (!tep_session_is_registered('sppc_customer_group_id')) {
     $customer_group_id = '0';
   } else {
     $customer_group_id = $sppc_customer_group_id;
   }

   if ($customer_group_id == '0') {
     $additional_constraint = " and c.categories_id NOT IN (" . HIDING_CATEGORIES . ") ";
   } else {
     $additional_constraint = '';
   }

   if (!is_array($categories_array)) $categories_array = array();

   $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id ."' " . $additional_constraint . " order by sort_order, cd.categories_name");
   while ($categories = tep_db_fetch_array($categories_query)) {
     $categories_array[] = array('id' => $categories['categories_id'],
                                 'text' => $indent . $categories['categories_name']);

     if ($categories['categories_id'] != $parent_id) {
       $categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . '  ');
     }
   }

   return $categories_array;
 }

 

Thats it!

Just enter the IDs in your admin and the cats are hidden.

 

Best regards

G?tz

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