Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

The only thing I can think of is that in products_info.php the variable $customer_group_id is not being initialized (it should get it's value from the session variable $sppc_customer_group_id). The variable $customer_group_id is used in both the what's new box and in product_info.php. If it is not "read" in product_info.php but it is in what's new, nothing wrong... However, when what's new is not included you start seeing the problem.

 

Anyhow, it's still just a possible explanation until you found what is wrong 

 

But I would definitely take a good look at product_info.php.

 

I decided to start from scratch (again, again, again, again)

 

 

I'm trying to install SPPC v4 over a fresh install of osc ms2.2 and now I keep getting this error:

 

Warning: mysql_connect(): Access denied for user: 'petinst_osc1@localhost' (Using password: YES) in /home/petinst/public_html/shop/includes/functions/database.php on line 19

Unable to connect to database server!

 

1. I install osc ms2.2

2. Overwrite with SPPC v4 files, run sppc_v40_install.sql (and not a single thing else)

3. get this error

 

Any suggestions?

Edited by adam71o

Share this post


Link to post
Share on other sites

After careful consideration, I think have discovered the problem - it's between the keyboard & the seat :D


Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Share this post


Link to post
Share on other sites

I just talked to my host, he said its a problem with the "fantastico" installer. He's got it fixed. I don't know if this is a common problem or if "fantastico" is popular.

Share this post


Link to post
Share on other sites

When exactly did osc forums become vehicles for personal attacks? "Lighthearted" I supposed, but an attack none-the-less. That sort of post is unwelcome here.

Share this post


Link to post
Share on other sites
The only thing I can think of is that in products_info.php the variable $customer_group_id is not being initialized (it should get it's value from the session variable $sppc_customer_group_id). The variable $customer_group_id is used in both the what's new box and in product_info.php. If it is not "read" in product_info.php but it is in what's new, nothing wrong... However, when what's new is not included you start seeing the problem.

 

Anyhow, it's still just a possible explanation until you found what is wrong  ;)

 

But I would definitely take a good look at product_info.php.

 

Thanks for the help JanZ, I'm trying to do out what you recommend, by examining product_info.php.

 

Although, I'm not sure exactly how to check if something is being "initialized" or not.

Share this post


Link to post
Share on other sites

It's not a personal attack - it's just that your endless posts might inadvertantly lead people to believe that this contribution is fraught with problems - when actually the multitude of your posts describe problems of your own creation.

 

My concern is that anyone coming through this thread who may be interested in SPP40 is going to see all your posts and assume (incorrectly) that because you have endless problems with everything Separate Price 40 is the reason.

 

When I look back over this thread it's clear that you have had it installed correctly several times. As such, you might want to consider that something else is causing problems when you encounter them.

 

I'm just waiting for you to post that your web browser stopped working - and that it happened after installing Separate Price 40 :rolleyes:


Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Share this post


Link to post
Share on other sites
It's not a personal attack - it's just that your endless posts might inadvertantly lead people to believe that this contribution is fraught with problems - when actually the multitude of your posts describe problems of your own creation.

 

My concern is that anyone coming through this thread who may be interested in SPP40 is going to see all your posts and assume (incorrectly) that because you have endless problems with everything Separate Price 40 is the reason.

 

When I look back over this thread it's clear that you have had it installed correctly several times. As such, you might want to consider that something else is causing problems when you encounter them.

 

I'm just waiting for you to post that your web browser stopped working - and that it happened after installing Separate Price 40  :rolleyes:

 

I understand your concern about people getting the wrong impression about the contribution, but that posts meaning is obvious, and in no way constructive for me, nor any other newcomer to SPPC.

Share this post


Link to post
Share on other sites
I understand your concern about people getting the wrong impression about the contribution.....

 

Then perhaps you would be so kind as to either think before you post or find a better forum for posting in - such as the General Support sections of the board instead of in a forum dedicated to supporting one specific contribution?

 

but that posts meaning is obvious, and in no way constructive for me, nor any other newcomer to SPPC.

 

I've noticed that - you're very selective in what you hear. Perhaps you will ask for a refund next? :D


Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Share this post


Link to post
Share on other sites

I have just installed SPPC 4.0 today. had a few glitches (as you do) and so I went over the entire installation only to find at the very last thing I checked that I forgot to upload one of the two files! *sigh*. took the better part of a day but these things happen.

 

I still have one remaining error that I am unsure of how to go about fixing. The error occurs when I try to search for a customer by name. here is the error message I receive when I try to search for a customer with the name "Fred"

 

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 'where c.customers_lastname like '%fred%' or c.customers_firstna

select count(*) as total from customers c left join address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id, customers_groups cg where c.customers_group_id = cg.customers_group_id where c.customers_lastname like '%fred%' or c.customers_firstname like '%fred%' or c.customers_email_address like '%fred%'

 

I didn't encounter this error message previously, so I am wondering if it is related to the SPPC 4.0 installation? Particularly as it now has the ability to sort customer listings for each information type ie first name, last name, etc. any suggestions on how I might fix this error greatly appreciated.

 

One other problem I did encounter was trying to have the "new product icon" contribution (http://www.oscommerce.com/community/contributions,2690) installed alongside SPPC 4.0. It didn't quite work. removing the "new product icon" contribution fixed that problem. I will ask the author of that contribution to consider revising it to fit with the latest SPPC.

Share this post


Link to post
Share on other sites
where c.customers_group_id = cg.customers_group_id where c.customers_lastname

There are two "were's", the second where should be "and". I will take a look at it to see how we can prevent that from happening.

Share this post


Link to post
Share on other sites

thanks Jan.

 

I have one new question.

 

I use flat rate shipping. Is there any way that I can have a separate shipping fee for my different classes of customer? In other words, a retail shipping charge and a wholesale shipping charge?

Share this post


Link to post
Share on other sites
Is there any way that I can have a separate shipping fee for my different classes of customer?
Working on it. Actually, I already have it working but it hasn't been tested by Marvin yet. The admin/customer_group page is already finished.

Also, I want to enable the same functionality for each customer (not that you want to do that for every one of them) so customers.php has to be changed also.

 

The idea behind it is very simple, whereas in configuration the shipping (and payment) options are stored as a ; delimited string, just put a similar option in the customers and customers_group table and have the classes payment and shipping look for that before using the string from configuration.

 

For different customers you would have to make another table rate, but from TerryK I understood that is very simple.

 

This concept has not been thoroughly tested though.

Share this post


Link to post
Share on other sites

Using the concept I described above, the quick and dirty method would be to change the code in includes/classes/shipping.php:

 

// class constructor
? ?function shipping($module = '') {
? ? ?global $language, $PHP_SELF;

? ? ?if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
? ? ? ?$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

? ? ? ?$include_modules = array();

Quick and dirty fix:

// class constructor
? ?function shipping($module = '') {
? ? ?global $language, $PHP_SELF;

? ? ?if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
// ? ? ? ?$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
?global $sppc_customer_group_id;

if ((int)$sppc_customer_group_id == '0') {
$cust_specific_modules = 'table.php;flat.php';
} elseif ((int)$sppc_customer_group_id == '1') {
$cust_specific_modules = 'table.php;item.php';
} // etcetera
$this->modules = explode(';', $cust_specific_modules);

? ? ? ?$include_modules = array();

I think this all there is to it (for customers_groups, for specific customers you have to wait for the next version of SPPC ;) ). Of course all the modules you specify have to be installed, otherwise you only get error messages.

Edited by JanZ

Share this post


Link to post
Share on other sites

Bugfix #2 for SPPC 4.0, page: admin/customers.php

As ausipodskins/Piquet has found the $customers_query_raw at around line 871 is wrong. It ends with: .... a.address_book_id, customers_groups cg where c.customers_group_id = cg.customers_group_id " . $search . " order by $order";

 

It brings trouble when a search is used because the string $search starts with "where" but I found it is also not giving correct results. Please change it to:

$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_group_id, c.customers_group_ra, a.entry_country_id, a.entry_company, cg.customers_group_name from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id left join customers_groups cg on c.customers_group_id = cg.customers_group_id " . $search . " order by $order";

So:

a.address_book_id, customers_groups cg where c.customers_group_id = cg.customers_group_id changes to:

a.address_book_id left join customers_groups cg on c.customers_group_id = cg.customers_group_id

 

That seems to do the trick.

Share this post


Link to post
Share on other sites

Oh dear, I have a new problem. again, I am assuming that it is related to SPPC 4.0

 

The problem is with adding product to cart.

 

When a customer tries to buy from the category listing page (ie the page that lists ALL the products under a particular category) the customer is taken to the cart contents page but the item is not added. this happens no matter which type of customer they are.

 

If the item is bought from within the item description page, everything works fine - the customer is taken to the cart page and the item is there.

Share this post


Link to post
Share on other sites
When a customer tries to buy from the category listing page
I believe this is code from includes/modules/product_listing.php. Because of the way it now works in the SPPC 4 version all the $listing['whatever'] variables changed to: $listing[$x]['whatever']. If you have your own special version of product_listing and added in code fro SPPC manually, that is something to keep in mind.

 

I can't check it right now, but I don't believe we saw this problem before.

Share this post


Link to post
Share on other sites

thank Jan, you gave me just the right information to find the problem. the error is in the documentation - Marvin ATTENTION!

 

Look at this piece of code near the end of includes/modules/product_listing.php file:

 

break; // EOF Separate Pricing per Customer
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
           break;

 

the "$listing[$x]" is outside the SPPC marker. I missed making that change when I compared and updated files. Because it fell outside the SPPC mod markers (but inside my 'free shipping' mod markers) I ignored the change. I have added the missing "[$x]" and it works perfectly now.

 

thank you again for your help and a great mod.

 

Your beta gamma tester :'(

 

Piquet

Share this post


Link to post
Share on other sites

Hey guys, this mod sounds just what we are looking for.

 

I am new to OSC and as such have a clean install.

I have tried to install this mod but am having a bit of a problem.

 

I have uploaded all the files, then I go to phpMyAdmin and run the query in the file sppc_v40_install, and I get the following message

 

#1060 - Duplicate column name 'customers_group_id'

 

I am probably being a donut somewhere along the line, so feel free to tell me! :thumbsup:

 

Any ideas what I am doing wrong?

Share this post


Link to post
Share on other sites
Any ideas what I am doing wrong?
Perhaps you already run the query once without noticing? Check if that new table customers_groups already exist, then you know it has run for sure. If it is a new install I can't think of a reason why this would happen since in standard osC there is no column customers_group_id anywhere.

Share this post


Link to post
Share on other sites

No table has been created...

 

We are about to move onto a new server, so think I will do a fresh install and install the mod before I touch anything else!! :'(

 

Will come back to you if I have a problem!

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

×