Display specific record number based on selection

6 posts by 4 authors in: Forums > CMS Builder
Last Post: December 10, 2018   (RSS)

By degreesnorth - December 6, 2018

Hi 

How would I add code to the page to SELECT a specific record number based on client requirements.  There are multiple list record pages, one for default, one for club discount prices, one for earlybirds.  I need to insert a specific pricing record in an area depending on the promotional page.  For example, on the club promotion page, it needs to show the club discount prices.  On the normal pages, it needs to display the default prices.  My client may also add more pricing list pages, so it needs to be flexible. I am going around in circles trying to work out how to do this, but ??  Any help would be appreciated.

Thanks

By gkornbluth - December 6, 2018

Hi,

If users need to be logged in to get special promotional rates, you should be able to use a where and/or if to match the category of the customer from their accounts record (normal, club discount, etc)  to a key field in your rates records to determine which record will be displayed.

You could use the website membership plugin to do some of the heavy lifting of determining who is logged in and their account status. (non logged in folks get the normal rates, logged in users would get a rate page based on a fild that lists their account status))

If they don't, if there's is a time dependency (if there's an early bird period then that could be the criteria for matching the $where. If date is greater than a and les than be then $where= 'earlybird' etc.)

If it's just in answer to an email, then pass the value of the promo page in the link matching the key field in the rates records.

Or, it could be a combination of all of the above, (where's can be extremely complex)

In any case I'd set up a master multi record section with list of categories that need to be matched (maybe with a simpler title and a complex coded key field to help to lessen the ability to access the wrong prices) and used that to populate drop downs in the account record, the pricing records or any place else the information is needed, so spellings will always match.

Then use a $where in the list records call to determine the record that's displayed.

There are some recipes in the CMSB cookbook that should be of help with some of the specifics.

Good luck with this, and please share your resulting code if you can so others can learn too.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By degreesnorth - December 9, 2018

Unfortunately, a membership plugin won't work, as the visitors haven't regisered when they see a specific promotional page.  It's the promotional page which is what will hopefully get them to register.

I was looking for something which would work like:

1) there is a multi record section with prices.  One for default, one for Club discounts, one for x, one for y, one for z (etc).  The client can create these records as they require them.

2) there is a multi record section with promotional pages.  The client can create these records as required.  

3) On a specific promotional page (the default is the normal register page with normal prices).  The client can select which pricing table they want to use.  It could be the default pricing, or it could be Club discounts, or it could be Prices X or Prices Y.   I'd like the client to be able to select which pricing table, as they don't have access to the backend/FTP, ie, it needs to be automated.

Is this possible?

Thanks

Carole

By degreesnorth - December 9, 2018

Thank you...   I've done that, but can't work out how to get, for example, price record 2 on promotional page 1 or price record 5 on promotional page 4.I'm sure it's a "where = etc", but I can't work out the code snippet.

Any advice would be gratefully appreciated.


Thank you

By daniel - December 10, 2018

Hi Carole,

A simple way to retrieve a specific record based on its num field, you can use the mysql_get() function like this:

$pricingRecord = mysql_get('pricing', $pricingNum);

You will need to alter this for your specific case; the first argument 'pricing' is the table name of the pricing section, and $pricingNum will be the record number you're trying to select.

Let me know if that helps, or if you have any further questions.

Thanks,

Daniel
Technical Lead
interactivetools.com