Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Conditional Pricing... in a related table... via PHP?


This topic is 5846 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

In order to have more flexibility over pricing (different pricing for... different clients, different web sites, coupons, etc...), I plan to move pricing to a related table rather than in the same table as products.

Price Codes attached to clients, orders, and invoices would relate down to the correct price.

To view prices in a product list, I'd just set a global to the priceCode and base a relationship on that. but that isn't going to work with PHP since it doesn't support globals in that way (right?).

So what would be my options for implementing this or another flexible pricing model using PHP?

Posted

I'm still a little fuzzy on what you're trying to do.

I'm assuming a Table called Products related via ProductID to a table called Pricing. I'm also assuming that price_code will be retrieved elsewhere. Say from a Customer table or a Coupons table and passed (or sessioned) to the Products.php page with your list of products.

Given that; this should work.

Put a portal to pricing in the products layout, and make sure that the price_code field present along with the other information you want to use / display.

Grab all prices for a product from FMP then use PHP to filter out the correct one based on the supplied $price_code variable.

  • 2 weeks later...
Posted

Ran into the same problem with a customers/contacts setup. I thought about doing as Baloo suggested, but to grab all the contacts for me would have meant 20000 records to get from the DB, then I had to filter them.

I chose to use use AJAX to do the same thing. It was easier than I thought. Using AJAX i only queried the DB for the records that pertained to the customer selected.

Don't know if you get the FileMaker Advisor magazine, but I used Jonathan Starks method( http://my.advisor.com/doc/19445 )

  • 2 weeks later...
Posted

Yeah limiting the number of records returned is a requirement for reasonable page load times. AJAX is a great way to go. I've been using it and have gotten some decent millage out of six fried rice's JSON converter

http://sixfriedrice.com/wp/products/filemaker-to-json-converter/

it works for eval but if you want to use PHP's json_decode() function with the result you'll need to replace the single quote field:value delimiters with double quotes

I don't have access to Stark's article so no comment there. If anyone else doesn't and want's to start laying around but googling "ajax" and "json" should get you all the information you need to get started.

If you don't want to use AJAX and you have too may records in your related set you could also perform a second query to the pricing table based on the results from your Products table.

This topic is 5846 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.