Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Do i need to replace those catalog files from the downloaded file or change the codes manually?

 

* catalog/admin/includes/boxes/customers.php

* catalog/admin/includes/functions/general.php

* catalog/admin/includes/languages/english/attributes_groups.php (upload)

* catalog/admin/includes/languages/english/categories.php (German and Spanish versions in their respective directories)

* catalog/admin/includes/languages/english/customers.php

* catalog/admin/includes/languages/english/customers_groups.php (upload, German and Spanish versions in their respective directories)

* catalog/admin/includes/languages/english/orders.php

* catalog/admin/includes/languages/english/products_attributes.php

* catalog/admin/includes/languages/english/specials.php

* catalog/admin/includes/languages/english.php

* catalog/admin/includes/database_tables.php

* catalog/admin/includes/filenames.php

* catalog/admin/attributes_groups.php (upload)

* catalog/admin/customers_groups.php (upload)

* catalog/admin/categories.php

* catalog/admin/customers.php

* catalog/admin/includes/classes/order.php (optional)

* catalog/admin/orders.php (optional)

* catalog/admin/product_attributes.php

* catalog/admin/specials.php

* catalog/includes/database_tables.php

* catalog/includes/boxes/specials.php

* catalog/includes/boxes/whats_new.php

* catalog/includes/classes/order.php

* catalog/includes/classes/order_total.php

* catalog/includes/classes/payment.php

* catalog/includes/classes/shipping.php

* catalog/includes/classes/shopping_cart.php

* catalog/includes/functions/database.php

* catalog/includes/functions/general.php

* catalog/includes/languages/english/login.php

* catalog/includes/languages/english.php (for german.php and espanol.php see files)

* catalog/includes/modules/new_products.php

* catalog/includes/modules/product_listing.php

* catalog/advanced_search_result.php

* catalog/create_account.php

* catalog/account_edit.php

* catalog/checkout_process.php

* catalog/index.php

* catalog/login.php

* catalog/logoff.php

* catalog/product_info.php

* catalog/product_reviews.php

* catalog/product_reviews_info.php

* catalog/product_reviews_write.php

* catalog/products_new.php

* catalog/specials.php

* catalog/admin/includes/languages/english/mail.php (optional)

* catalog/admin/includes/languages/english/newsletters.php (optional)

* catalog/admin/mail.php (optional)

* catalog/admin/newsletters.php (optional)

* catalog/admin/includes/modules/newsletters/newsletter.php (optional)

* catalog/admin/includes/modules/newsletters/product_notification.php (optional)

Share this post


Link to post
Share on other sites
Do i need to replace those catalog files from the downloaded file or change the codes manually?

See separate_price_422/new_installations/install.html, first chapter after the introduction: Installation scenarios.

Share this post


Link to post
Share on other sites

I am seriously stuck on my "great idea" to have a promotion wherein the customer is allowed to type in what price they want to pay for an item. I started a thread here http://forums.oscommerce.com/index.php?showtopic=311558 "Name Your Price" but alas lots of views but no joy. I'm posting here since all my stuck points appear to lead back to dealing with the price issue and that means dealing with sppc and $pf and "final_price". After 10 days, I feel like I'm just going around in circles, and every day I find a new file that deals with price, that may or may not need modded. [And every day, I have a new appreciation for the SPPC contrib gang. whoa.]

 

I've got some bits and pieces put together. What I would like is a coding buddy to help untangle the thicket for me so I can do the work. I'm not (yet) seeing the path from putting an input field for price on the product_info page to getting that price to end up in the basket, then the order. Seems like every time a file is called, the price is recalculated all over again from the "products" dB. Anybody interested in working on this with me?

 

Perhaps there is a "flow chart" somewhere that shows how the files all relate to each other?

 

As Always, TIA


Toward Continued Success - - > Carol Hawkey - - > KidsLearnToSew.com - - > Wyoming, USA

Mods Installed - - > Authnet AIM2 - Bundled Products 1.4 - Fancier Invoice 6.1 - Email_HTML_Order_Link_Fixed - Header Tags Controller - Login aLa Amazon - JustOneAttribute - Article Manager - SPPC w/PB - spiders.txt - Dangling Carrot/Olive - Printable Catalog - CCGV(trad)

Planned Mods - - > Purchase Without Account - USPS Label - Ultimate SEO

Share this post


Link to post
Share on other sites
Perhaps there is a "flow chart" somewhere that shows how the files all relate to each other?

Not that I know of but if you follow the trail of the products_groups table in the checkout process (search your files for TABLE_PRODUCTS_GROUPS) then it should become clear.

 

This is not something you would put together on a rainy Sunday afternoon but personally I would start with a table that just contains the products_id's you would want to have your Make your price feature on active (or products_id and a minimum price?). Then a table that contains the customers_id, products_id and inputted price.

 

Naturally, when a customer is not logged-in yet you would have to keep the inputted price in the session and use that for the shopping_cart. You would run into all kinds of things, like to have to shut off buying that product from the product listing, showing something else instead of a price in all kinds of boxes and who knows what (admin part...?).

Share this post


Link to post
Share on other sites

Hi Jan,

 

I have loaded V2.2 RC2 of OSC and SPPC 4.22 (direct file replacements with no other mods) php version is 4.4.7.

When I attempt to log into any group but Retail I get the following error on all pages in the right column where shopping cart, best sellers and specials should be. Any suggestions as to what I can do?

 

 

 

1052 - Column 'products_id' in from clause is ambiguous

 

select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s LEFT JOIN products_groups pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' and s.customers_group_id= '2' order by s.specials_date_added desc limit 10

 

[TEP STOP]

Share this post


Link to post
Share on other sites
I have loaded V2.2 RC2 of OSC and SPPC 4.22 (direct file replacements with no other mods) php version is 4.4.7.

When I attempt to log into any group but Retail I get the following error on all pages in the right column where shopping cart, best sellers and specials should be. Any suggestions as to what I can do?

Actually, it has more to do with your MySQL version that IMO has a stupid bug about that products_id being ambiguous. So I guess you are using MySQL version 4.

I found that there are at least two other versions for the trouble query (that at least work in MySQL 5). The first is the simplest change (this is in catalog/includes/boxes/specials.php):

  } else { // $sppc_customer_group_id is in the session variables, so must be set
  $random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as 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 LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg on pg.products_id = s.products_id and pg.customers_group_id = s.products_id where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);
}

Depending on your MySQL version (this uses subselects which is supposed to be standard in 4.1 and newer) this might work too:

  } else { // $sppc_customer_group_id is in the session variables, so must be set
$random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, (select products_id, specials_new_products_price, specials_date_added from " . TABLE_SPECIALS . " where customers_group_id = '" . $customer_group_id . "' and status = '1') as s LEFT JOIN (select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customer_group_id . "') pg on s.products_id = pg.products_id where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS); 
}

If they both don't work the first query (for retail should be rewritten to use the customers_group_id instead of '0' and then a second query done for the groups price and if there is one replace the products price with the groups price.

Share this post


Link to post
Share on other sites
Actually, it has more to do with your MySQL version that IMO has a stupid bug about that products_id being ambiguous. So I guess you are using MySQL version 4.

I found that there are at least two other versions for the trouble query (that at least work in MySQL 5). The first is the simplest change (this is in catalog/includes/boxes/specials.php):

  } else { // $sppc_customer_group_id is in the session variables, so must be set
  $random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as 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 LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg on pg.products_id = s.products_id and pg.customers_group_id = s.products_id where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);
}

Depending on your MySQL version (this uses subselects which is supposed to be standard in 4.1 and newer) this might work too:

  } else { // $sppc_customer_group_id is in the session variables, so must be set
$random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, (select products_id, specials_new_products_price, specials_date_added from " . TABLE_SPECIALS . " where customers_group_id = '" . $customer_group_id . "' and status = '1') as s LEFT JOIN (select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customer_group_id . "') pg on s.products_id = pg.products_id where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS); 
}

If they both don't work the first query (for retail should be rewritten to use the customers_group_id instead of '0' and then a second query done for the groups price and if there is one replace the products price with the groups price.

 

Hi Jan,

 

I used the first code segment and made the mod and it seems to be working fine. Thank you for the assistance.

Edited by kimm

Share this post


Link to post
Share on other sites

Hello!

 

I have a problem when installing SPPC.

I've made a search but found nothing about this error in SPPC, so I have to ask it.

 

Fatal error: Call to a member function add_current_page() on a non-object in /home/avsnsi/public_html/shop/catalog/includes/application_top.php on line 312

 

What is this all about?

 

Code from line 301 to 314:

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

// Shopping cart actions

Share this post


Link to post
Share on other sites
I have a problem when installing SPPC.

I've made a search but found nothing about this error in SPPC, so I have to ask it.

 

Fatal error: Call to a member function add_current_page() on a non-object in /home/avsnsi/public_html/shop/catalog/includes/application_top.php on line 312

 

What is this all about?

Nothing serious: see here for a very simple solution (nothing to do with SPPC by the way).

Share this post


Link to post
Share on other sites

i have installed this contribution on my store and working perfectly. But need something else. Let say I assign a group called dealer and want to set that minimum order quantity is 100pcs and only applicable for that group. How to make it ? Thanks ~

Share this post


Link to post
Share on other sites
i have installed this contribution on my store and working perfectly. But need something else. Let say I assign a group called dealer and want to set that minimum order quantity is 100pcs and only applicable for that group. How to make it ? Thanks ~

Take a look at contribution 2982 (Minimum Order Quantity Per Product). It adds this column to the table products:

ALTER TABLE `products` ADD `products_min_order_qty` INT( 4 ) DEFAULT '1' NOT NULL;

You would also need to add that to products_groups for the groups and change the PHP code for the groups of course.

 

At the moment I'm looking into that for the Quantity Price Break Per Product contribution (for SPPC also). Combining the two is not that difficult though it needs a lot of code changes.

Share this post


Link to post
Share on other sites
Take a look at contribution 2982 (Minimum Order Quantity Per Product). It adds this column to the table products:

ALTER TABLE `products` ADD `products_min_order_qty` INT( 4 ) DEFAULT '1' NOT NULL;

You would also need to add that to products_groups for the groups and change the PHP code for the groups of course.

 

At the moment I'm looking into that for the Quantity Price Break Per Product contribution (for SPPC also). Combining the two is not that difficult though it needs a lot of code changes.

 

Thanks. But I need minimum on TOTAL quantity, not per product. I try to install a new module for total order and set it to that customer under SPPC in admin, but it seems to apply to all customer even though I only select it for that customer for that module.

Share this post


Link to post
Share on other sites
Thanks. But I need minimum on TOTAL quantity, not per product. I try to install a new module for total order and set it to that customer under SPPC in admin, but it seems to apply to all customer even though I only select it for that customer for that module.

 

I think I manage to made it now....install new total order module and assign to that particular customer group!

Share this post


Link to post
Share on other sites
Thanks. But I need minimum on TOTAL quantity, not per product. I try to install a new module for total order and set it to that customer under SPPC in admin, but it seems to apply to all customer even though I only select it for that customer for that module.

The ones I seen used a value in configuration like TOTAL_ORDER. "Just" append the customer group id to it, add the values in the table configuration like TOTAL_ORDER0, TOTAL_ORDER1 and when you look for the value in your code make sure you cast it a constant: constant('TOTAL_ORDER' . $customer_group_id) before making a comparison/evaluation against the cart total.

Share this post


Link to post
Share on other sites

I have just installed SPPC into a new OsCommerce store and am getting the following error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0, 20' at line 1

 

limit 0, 20

 

[TEP STOP]

 

I have searched the support thread for a solution, and have found similar issues but not a solution to this one. Any ideas on how to fix this?

 

The only other mod that I have installed is Purchase without Account, not sure if it could be a conflict with that.

Share this post


Link to post
Share on other sites

Has anyone installed this on a heavily modified consumer web site?

 

About 25 contributions installed.

 

Thanks.

Share this post


Link to post
Share on other sites

Hi Jan,

 

I need help again ... for the hide products and categories for sppc. I have installed the latest version of both contribs and everything is working for hiding the products and categories, however, my reviews, best sellers, new products and what's new are all showings.

 

I've reinstalled this 3 times (first 2 times the above boxes showed not image for a browser but when you logged in there were still no images or access to the info).

 

The latest install shows everything all the time.

 

Any idea where I am going wrong?

 

BYW: how's it coming with Qty breaks?

 

Thank you

Kim

Share this post


Link to post
Share on other sites
The latest install shows everything all the time.

 

Any idea where I am going wrong?

No, but since these are usually complete modules or boxes you can take the ones from the package and use those instead of trying to update them manually?

 

BYW: how's it coming with Qty breaks?

Slow. Finished the admin side for the discount categories (can be different for groups) and was playing around with adding a min order quantity. Since the latest verrsion of QPBPP is quite different a lot of code needs amending (and worse: a lot of documentation).

Share this post


Link to post
Share on other sites

Hi there !

 

In my new version of osComm I have decided to include also SPPC to add some b2b functionality .. Also Price Break per Quantity would come in reall action here where the wholesale is going on ...

And I'm just wondering if anyone tried to install QPBPP on top of SPPC in new version 2.2RC2a. I noticed that the contribution date of QPBPP for SPPC is rather old now ...

Any feedback is appriciated in order to safe some time :)

 

Thanks,

Gregor

Share this post


Link to post
Share on other sites
No, but since these are usually complete modules or boxes you can take the ones from the package and use those instead of trying to update them manually?

 

 

Slow. Finished the admin side for the discount categories (can be different for groups) and was playing around with adding a min order quantity. Since the latest verrsion of QPBPP is quite different a lot of code needs amending (and worse: a lot of documentation).

 

 

Hi Jan.

 

OK direct replacement on the whats new, new products etc cause "1052 - Column 'products_id' in from clause is ambiguous". If I change using(products_id) to on p.products_id = p2c.products_id the program runs but it isn't working the way you intended. Can you give me an example of the change code necessary for the new_products box and I think I can modify the rest from that. As you mentioned in a prior post I am on Mysql 4 something not 5.

 

Kim

Share this post


Link to post
Share on other sites

Hi Jan,

please can you help me,

I found here your code for SCROLLING special products in the box.

 

	
$rp_query = 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 p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = '0' order by s.specials_date_added desc");
} else { // $sppc_customer_group_id is in the session variables, so must be set
 $rp_query = tep_db_query("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as 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 LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' order by s.specials_date_added desc");

 

How to change it for display NEW PRODUCTS with SCROLLING?

I trying alredy 2 days, but no luck.

I change first $rp_query to:

 $rp_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where products_status = '1' and p.products_id not in (select products_id from " . TABLE_SPECIALS . " where status = 1) and pd.language_id = '" . (int)$languages_id . "' and p.customers_group_id = '0' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

It's scroll new products when not log in.

But how to change the second part for display correct prices (sppc) when log in?

Thanks in advance.

Share this post


Link to post
Share on other sites
But how to change the second part for display correct prices (sppc) when log in?

This seems to do the trick for customer group id 2. Of course this needs to be rewritten to use TABLE_PRODUCTS instead of products etcetera.

select p.products_id, p.products_image, p.products_tax_class_id, IF(gp.customers_group_price IS NOT NULL, gp.customers_group_price, p.products_price) as products_price, pd.products_name from products p left join products_description pd on p.products_id = pd.products_id left join (select products_id, customers_group_price from products_groups where customers_group_id = '2') as gp on p.products_id = gp.products_id where products_status = '1' and p.products_id not in (select products_id from specials where status = 1 and customers_group_id = '2') and pd.language_id = '1'  order by p.products_date_added desc limit 30

Share this post


Link to post
Share on other sites
OK direct replacement on the whats new, new products etc cause "1052 - Column 'products_id' in from clause is ambiguous". If I change using(products_id) to on p.products_id = p2c.products_id the program runs but it isn't working the way you intended. Can you give me an example of the change code necessary for the new_products box and I think I can modify the rest from that. As you mentioned in a prior post I am on Mysql 4 something not 5.

If you mean the whats_new.php file in includes/boxes/whats_new.php try this:

// BOF Hide products and categories from groups
 if ($random_product = tep_random_select("select p.products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES .  " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id  where products_status = '1' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
// EOF Hide products and categories from groups

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

×