gs-df Posted December 2, 2022 Share Posted December 2, 2022 Hello @kongondo have u any tips for adding the feature voucher/coupon? Which files i have to look into for this feature? Thx for your help ? Link to comment Share on other sites More sharing options...
kongondo Posted December 2, 2022 Share Posted December 2, 2022 Hi @gs-df 5 hours ago, gs-df said: Which files i have to look into for this feature? Coupons/Vouchers are not currently supported so there are no files to look at ?. 5 hours ago, gs-df said: have u any tips for adding the feature voucher/coupon? Some quick thoughts... I see three main components: Creating coupons Managing them (editing, etc) Using the coupons in the frontend and expiring them in the backend. Creating Coupons There's are a number of approaches. a. Coupons as a special type of product Add a custom text field to products template. Create coupons as products. Hide these 'special products' from the frontend. Advantages Easy to create. Not much coding needed; you can use the Padloper and ProcessWire APIs. Disadvantages Not intuitive; can confuse editors. Lots of unused fields relevant to product but not to coupons. Extra code to hide coupons from being displayed in the frontend as products. b. Coupons as dedicated ProcessWire pages Let coupons be dedicated ProcessWire pages. Could use own custom dedicated template (i.e. non-Padloper template). Can either hide these pages under admin or have them live under Padloper main parent page or have them as usual pages. Add custom fields to hold coupon details such as valid date(s), expiry, usage, number, etc. Alternatively, create a custom Fieldtype for coupons. Advantages Straightforward and easy to manage as separate pages. Not much coding needed; you can use the ProcessWire APIs. Disadvantages Extra code to hide manage coupons c. Coupons as items in a custom database table Create a custom database table dedicated to holding coupons data. Use $database to CRUD coupons. Advantages Straightforward and relatively easy to manage as separate records. Scalable. Disadvantages Knowledge of working with custom tables needed. Extra code for CRUD. Managing Coupons Depending on your chosen route above, you could directly edit the coupons as ProcessWire pages, or create a Process Module (not great as will be outside the Padloper 'environment') or use the Padloper addons and addons API. The latter is my preferred method as it gives you near unlimited ways to manage your coupons in a dashboard. You could use this dashboard to manually send coupons to customers. You could also automate the process. Using Coupons This is the easy bit. You will need to use a custom checkout form to add fields you need to capture details about the coupon details that the customer has provided. You can then use a hook(s) to process coupon details entered by customer (e.g. validate, etc). See demo 2 and demo 3 on how to use and hook into the order checkout to process custom form details. Hope this helps. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now