Jump to content
hozone

[contribution] Total B2B

Recommended Posts

This contribution add B2B features to osCommerce.

 

About

This contribution allows to create Customers Groups, and to bind a discount rate
to them.
The administrator can set groups, group's discount, and bind customers to
groups.
This contribution adds a Discount Rate per Customers, the administrator can
easily edit discounts from the administration Customers panel.
Every Customers has it's own discount rate.
It is also possible to select the special prices for customers groups or single
customers.
The products don't have only 1 price, but it is possible to set multiple prices
for products.
The administrator can create groups of users. Every users' group is associated
to one product price.
Every user has its own group associated.
Every products manufacture will have a discount for a groups.
The number of product prices can be set from:
"Configuration / My Store/ Number of prices per product".
Note: trying to reduce this value causes the automatic set of default price
     (price 1) of all those groups for which the reduction has caused an
     inconsistency with the prices.
     For ex.: if a group has price 3 and "Number of prices per product" is set
     to 2, this group will have as a new price the default price (price 1).

Pricing policies:
  temp_product_price =
                  IF the customer is in a group with price X
                     IF price X for selected product exist
          = temp_product_price X
       ELSE
          = temp_product_price 1 (default price)
    ELSE
       = temp_product_price 1 (default price)
  product price = IF exist(customer special price)
                     = customer special price
    ELSE IF exist(customer group special price)
       = customer group special price
    ELSE IF exist(special price)
       = special price
    ELSE IF exist(manufacturer discount for customer)
       = temp_product_price + manufacturer discount
    ELSE IF exist(manufacturer discount for customer's group)
       = temp_product_price + manufacturer discount
    ELSE IF exist(manufacturer discount)
       = temp_product_price + manufacturer discount
    ELSE
                     = temp_product_price + customer discount + customer's group discount

  Prices priority is here visualized. For example suppose that a special price
  "X" is inserted for the product "PRODUCT" only for the customers "PINCO", bind
  to group "GROUP", and also a special price "Y" is insert for the product
  "PRODUCT" only for the group "GROUP". Price for customers "PINCO" of the
  product "PRODUCT" will be "X", not "Y"!.

Other Features:
- every user can see the personalized prices calculated using the
 pricing policies above.
- administrator can:
 . add and set users groups
- every group has:
 . a discount rate (only administrator can set the discount value)
 . if present a special personal price per product
- every customers:
 . a discount rate (only administrator can set the discount value)
 . a group (only administrator can bind customers to groups)
 . if present a special personal price per product
- admin can choose if a default price should be accessible by guests. True/false
 choice for "allow guest to see prices" property in admin >> configuration >> my store.
 prices displayed for guest will not be computed, only "guest discount", from
 admin >> configuration >> my store, will change this prices.


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites

Hi Davide,

 

I downloaded and can't open the file. It seems that the file is corrupted.

May I know this Total B2B is an improvement to CGDiscountSpecials? How do I upgrade from this verion to new one. Thanks for this great contribution. :lol:

Share this post


Link to post
Share on other sites

i can open this file with winrar 3.30

 

> May I know this Total B2B is an improvement to CGDiscountSpecials?

Yes, it is

 

> How do I upgrade from this verion to new one

there are many files to edit :(, you must edit one by one, manually


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites

did you remove the references to the areas which do not work or did you leave them in the code, with comments, perhaps others can 'fix' what doesnt work?


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

Hi

 

Nice contrib - works perfectly

 

But, I have a suggestion/requst.

 

Is it possible to implement price breaks?? EG: if someone orders 1 item they get the price assigned to the group that they are in, but if they order, for example 10+ of an item, they get a lower price -

 

1+ = ?100.00

10+ = ?95.00

20+ = ?90.00

 

etc....

 

There is a contibution that does this but it has to change a few files that Total B2B has already changed....

 

Any chance of this being included in a leter version??

 

Cheers

Share this post


Link to post
Share on other sites
May I know this Total B2B is an improvement to CGDiscountSpecials? How do I upgrade from this verion to new one. Thanks for this great contribution. :lol:

Same question here....is this is improvement on CGI Discount Specials 1.4, or just a Name change so far?

Share this post


Link to post
Share on other sites
did you remove the references to the areas which do not work or did you leave them in the code, with comments, perhaps others can 'fix' what doesnt work?

comments like this

 

//CGDiscountSpecial start --> //TotalB2B start

etc...


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites
May I know this Total B2B is an improvement to CGDiscountSpecials? How do I upgrade from this verion to new one.  Thanks for this great contribution.  :lol:

Same question here....is this is improvement on CGI Discount Specials 1.4, or just a Name change so far?

it is CGDiscountSPecials + XPricesPerProducts + some new features.


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites
Hi

 

Nice contrib - works perfectly

 

But, I have a suggestion/requst.

 

Is it possible to implement price breaks?? EG: if someone orders 1 item they get the price assigned to the group that they are in, but if they order, for example 10+ of an item, they get a lower price -

 

1+ = ?100.00

10+ = ?95.00

20+ = ?90.00

 

etc....

 

There is a contibution that does this but it has to change a few files that Total B2B has already changed....

 

Any chance of this being included in a leter version??

 

Cheers

i suppose it can be done... but now i don't have time :(


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites

I am not sure if this is possible with your contribution(s) but what I would like is a contrib that allows a cost price entered for each product and then any number of per category % added to the cost price that only displays to customers of a certain group.

 

e.g.

 

Cost: $100

 

Group A: cost + 5% = $105

Group B: cost + 10% = $110

 

Each category could have its own seperate percentage applied to it, so category 1 has the percentages of 5%, 10%, 15% applied to it while category 2 has the percentages of 2%, 6% and 10% applied.

 

I know this sounds complicated and I hope I have explained it alright but it is a feature I'd like to add.

Share this post


Link to post
Share on other sites

Hi

 

I upgraded this contrib from CGDiscount and I ran into some problems. I showed my products in columns instead of rows. After upgrading this contrib, all my product price shows $0. I have product_listing_col.php in catalog\includes\modules\ how do I modify product_listing_col.php to accommodate this contrib?

 

The product_listing_col.php is as follows:

 

****** begin *********

<!-- product_listing_col //-->

<?php

 

DEFINE('PRODUCT_LIST_COL_NUM',3);

 

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr><td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

 

$info_box_contents = array();

 

if ($listing_split->number_of_rows > 0) {

 

$row = 0;

$col = 0;

 

$listing = tep_db_query($listing_split->sql_query);

while ($listing_values = tep_db_fetch_array($listing)) {

 

$listing_values['products_name'] = tep_get_products_name($listing_values['products_id']);

 

$lc_text= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a><br>';

 

if ($listing_values['specials_new_products_price']) {

$lc_text .= ' <s>' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span> ';

} else {

$lc_text .= ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';

}

 

if (PRODUCT_LIST_BUY_NOW) {

$lc_text .= '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a> ';

}

 

$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"',

'text' => $lc_text);

 

$col ++;

if ($col > PRODUCT_LIST_COL_NUM-1) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

 

} else {

 

$info_box_contents = array();

 

$info_box_contents[0] = array('params' => 'class="productListing-odd"');

$info_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);

 

new contentBox($info_box_contents);

 

}

 

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

<table width="100%">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

?>

 

******** end *****

 

Can anyone help me? Thanks.

Share this post


Link to post
Share on other sites

Just curious...

 

Does this mod allow for category discounting?

 

Example: You assign all users to the same group (Default). Even guest users. You then assign a discount to one category of say 10%. This would then allow for purchasing of all items at normal pricing, and items of the one category at a 10% discount across the board.

Share this post


Link to post
Share on other sites

Hi hozone,

 

very nice contribution.

But something strange happend in my shop. After installing the contrib all prices in the shop (product listing and info) are 16.00 ?. In cart and on the the checkout... pages they are like they should but without tax. In the admin they are the same as before.

% discount works (e.g. 50% then they are all 8.00 ?) but price 2,3,4... don`t work (still 16.00 ?).

My tax rate is 16, so maybe it took that instead of the price.

Any suggestions where the mistake could be?

Share this post


Link to post
Share on other sites

o.k.

Problem solved, there are two lines of code in product info and listing were not marked as a change to the original code.

 

But now I have two new problems:

 

1. because of this code

GROUP BY p.products_id

in four lines in index.php I lost my Prev/Next Navigation Bar in the product listing. Only

Products: 1 to 1 (of 1 total) Pages: ?1

is left. Should be

Products: 1 to 5 (of 28 total) Pages: ?6

and the navigation of course.

 

2. after moving from my local server to the internet server I got this in the shop:

1064 - You have an error in your SQL syntax near 'inner join customers c on g.customers_groups_id = c.customers_groups_id and c.c' at line 1

 

select g.customers_groups_price from customers_groups g inner join customers c on g.customers_groups_id = c.customers_groups_id and c.customers_id = ''

 

Only known difference is an older MySQL version (3.22.32) instead of 4.0.15 on the local server.

Share this post


Link to post
Share on other sites
Does this mod allow for category discounting?

 

Just an idea:

If you do not use a manufacture you can give each categorie a "manufacture" with a manufacture discount.

Share this post


Link to post
Share on other sites
2. after moving from my local server to the internet server I got this in the shop:

 

QUOTE

 

1064 - You have an error in your SQL syntax near 'inner join customers c on g.customers_groups_id = c.customers_groups_id and c.c' at line 1

 

select g.customers_groups_price from customers_groups g inner join customers c on g.customers_groups_id = c.customers_groups_id and c.customers_id = ''

 

 

Only known difference is an older MySQL version (3.22.32) instead of 4.0.15 on the local server.

 

"inner join" needs MySQL minimum version 3.23.17

Share this post


Link to post
Share on other sites

My two pennies to make things a little more complicated; Option to allow discount based on Category and Quantity is something I am definitely looking for, But to take it a step (or two) further with my wishful thinking a bunch of features/possibilities can be added with the following structure.

Every Customer is associated with 1 Group and each group could have one or more records in the following lookup table.

 

Group_Coupon_ID,

Category_ID,

Mfg._ID,

Qty,

Products_ID,

Bought_With_Products_ID,

Discount_%,

Start_Date,

End_Date

 

Bought

Group With

Coupon Category Mfg_ID Qty Products Products Discount Start End

ID ID ID ID % Date Date

 

1 4 0 5 0 0 5.67 5/5/2004 7/31/2004

1 0 0 5 456 0 6.765 5/5/2004 7/31/2004

1 0 34 0 0 0 10 5/5/2004 7/31/2004

1 4 0 0 0 0 7.5 7/31/2004 8/30/2004

65432 23 0 0 0 0 5 5/25/2004 7/15/2004

 

(A value of ?0? in Category_ID or Mfg_ID or product_ID or Qty would read as ANY)

 

I think this structure can accommodate Category Discount, Manufacturers Discount, Coupons Discount, Product Discount, Quantity discount (down to product level), Product Discount, Discount if bought with related product, and can also include Option Discount by adding another column to the table. Also can control when the discount starts and when it ends.

Obivously a lot of coding is involved, I guess Davide would know the implication and amount of coding involved

 

(please align text to view data in correct columns)

Share this post


Link to post
Share on other sites

Still having problems.

 

I took a really fresh 2.2MS2 installation and replaced the files with the TotalB2B v1.1b files.

Only change: I reduced the "Maximum Value" of "Search Results" in the konfiguration to 5.

If I go to DVD Movies ->?Action?(9) I can see the first 5 movies. The Prev/Next Navigation Bar looks like this:

Displaying 1 to 1 (of 1 products)

Result Pages: ?1

with no navigation.

 

Am I the only one with this problem around here?

Share this post


Link to post
Share on other sites

Ok, problem solved:

 

There are four changes in catalog/index.php

GROUP BY p.products_id

added.

 

After changing to

group by p.products_id

(just small characters) it works.

 

But why? Nobody else had this problem.

Share this post


Link to post
Share on other sites

Yep , i had the same problem for which i asked help , but got none.

 

I searched for my error and stumbled on yours, which seemed to have the same problem.

Tried your solution and changed all instances of the: GROUP BY to group by and then it worked again :)

 

Does anyone know why this happened and why it makes such a BIG difference [i am not a programmer at all, but am very curious ]

Share this post


Link to post
Share on other sites

I installed the 1.1 version of B2B over a clean MS2 installation patched with multi stores 1.4.

 

I am running on a curious problem. First of all, all prices in the catalog show as 0. Regardless, I get this error in the "What's new" box:

 

Warning: Missing argument 3 for display_price() in E:\Miata\dividi\includes\classes\currencies.php on line 72

 

Line 72 is

 

    function display_price($products_id, $products_price, $products_tax, $quantity = 1) {

 

Any ideas?

Share this post


Link to post
Share on other sites

This seems to be a difficult (complicated perhaps.....)contribution, so i would like to ask....

 

1. Does it "let me to set different discount prices at the same time?

 

say, example... $150= 10%discount or minus an amount of 10 % of $150....

$300= 20%discount or minus an amount of 20 % of $300....

 

2. I would like to create a group of people to have a life time membership discount...can i do it with this mod?? ;)

 

 

Sorry for these stupid questions tho :( :P


OS-commerce is great, but with other magical contributions, that is just so "COOL"!

Share this post


Link to post
Share on other sites

I've just installed the script and its running well and is really useful! :) however, just a suggestion, i think it'll be good if it allows customers to enter a discount code when they check out..instead of just categorizing into groups...:)


You live, you learn. :)

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

×