Simple shopping list

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

By leo - February 5, 2018

Hi Koen,

Not difficult at all. It depends on what you want this list to do after, it can be as simple as just adding a field to the existing section.

You mentioned that you want to generate a list from the database to print or email. You probably just need to add a new checkbox field "favorite" to the section and have a script to get all the ones that are checked.

If you still have questions or need support on it, feel free to respond us!

Thanks,

Leo - PHP Programmer (in training)
interactivetools.com

By kovali - February 5, 2018

Hi Leo,

Thx for your reply.

Let's say I have a page with +100 items for sale, so I would like to click on some of the items to add them to the favorites list. Then, on a seperate "favorites" page I would get an overview of these items with only the name, price and maybe an image... That's it. This page with favorite items could then be printed or e-mailed as a reminder.

I think this list of favorites would only be temporary, as long as the browsersession would last ? But that wouldn't be a problem if so.

Could you provide me with some example code to get me started please ? Thx in advance Leo.

Regards,

Koen

By leo - February 6, 2018

Hi Koen,

Depending on the specific use case, you may use the method I mentioned before or javascript approach. To do it the PHP way, you will need to add a "featured" field to products section, and on your "favorites" page add "where" => "featured = 1" to your getRecords() function. And your "add to favorite list" button should set this featured field the selected product to 1. Note that this method will change the featured value globally meaning other users can also see it. It should be fine if your favorite list is for everybody. If you want everyone who sees the site to have their own favorites list, you will have to use javascript to add selected item's num to the "view favorite list" link as parameters, and in the favorite list page grab all items mentioned in the link by adding "where" => "num IN (1,2,3, ...)" to your getRecords() function.

Hope this gets you started and solve your problem. If you need further support or want us to set it up for you. Feel free to send a request to consulting@interactivetools.com.

Thanks!

Leo - PHP Programmer (in training)
interactivetools.com