Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help With PHP Sql Modification


VectorSix

Recommended Posts

Posted

I have created a new table called Customers_Price. The fields in the table are Products_ID, Customer_ID, and Products_Price. I want to retrieve the price from this table rather than the Products table.

 

My customers need to be logged in to see price. This being said, their Customer_ID is known. Also, the Products_ID is known. I want the query to look at the new table, if the price is not found for the logged in Customer_ID and Product, I want to select the price for Customer_ID='990010'. This is my default customer.

 

I am sure I could figure it out, but if it would be easy for someone to point me in the right direction, it would be a huge help.

 

TIA,

V6 :thumbsup:

Posted
I have created a new table called Customers_Price. The fields in the table are Products_ID, Customer_ID, and Products_Price. I want to retrieve the price from this table rather than the Products table.

 

My customers need to be logged in to see price. This being said, their Customer_ID is known. Also, the Products_ID is known. I want the query to look at the new table, if the price is not found for the logged in Customer_ID and Product, I want to select the price for Customer_ID='990010'. This is my default customer.

 

I am sure I could figure it out, but if it would be easy for someone to point me in the right direction, it would be a huge help.

 

A better solution to this would be to create a new column in the existing products table.

Insert a new column called logged_in_price.

Then - select this new column into the array every time OSC access the product price.

 

Then - write a loop around the price based on logged in, or not logged in.

 

Much less to modify, much less maintenance. AND - all you have to do is add a single price input field into the new product and edit product on the admin side.

Posted

Yes, however, my situation is such that I am dealing with 4,000+ customers, and, 22k+ SKU's, and thousands of pricing records. All of this is in my ERP system, that as I register customers, I will dump all of their records into a table (this will be automated via a FTP process. So, ust because a customer is logged in, does not mean they get a special price. For example:

 

Customer 1

Product A - $25

 

Customer 2

Product A - $25

Product B - $32

 

Customer 990010

Product A - $30

Product B - $40

Product C - $50

 

If Customer 1 chooses Product B, it will return $35. If Customer 1 chooses Product C, there is no record, so choose customer 990010 for Product C - $50.

 

I Customer 3 chooses Product B, there are no records for Customer 3, so choose Product B for Customer 990010 (last resort pricing record) - $50.

 

Thanks for the input so far.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...