Jump to content

How to create property for the client to fill ?


Sonia Margollé
 Share

Recommended Posts

Hi, 
In the shop I'm working on, for one type of product (gift card) I need to be able to ask the client to write the name of the recepient of the gift card. 
For another maybe ask If the user has some additional remarks...
 

How can I do that ?  by creating a property with no value and hooking somewhere to store the value of my input as the property value ?
Is the property with dimensions ect is implemented yet ? I can't find an exemple with it even in the demo site.

Thanks !
 

Link to comment
Share on other sites

  • Sonia Margollé changed the title to How to create property for the client to fill ?

Hi @Sonia Margollé,

Currently, Padloper does not have a Gift Card feature. However, there are a number of ways you can implement this feature yourself. A gift card can be thought of as a special product. Hence, you can use a product as a gift card. The main challenge in this regard is you will need a single product per gift card, since gift cards need to be unique and cannot be reused. 

2 hours ago, Sonia Margollé said:

I need to be able to ask the client to write the name of the recepient of the gift card. 

By client here I assume you mean the shop owner/admin?

2 hours ago, Sonia Margollé said:

For another maybe ask If the user has some additional remarks...

I am sorry I don't understand this statement. Who is the user here? The shop owner/admin or a frontend customer?

2 hours ago, Sonia Margollé said:

How can I do that ?  by creating a property with no value and hooking somewhere to store the value of my input as the property value ?

Yes, this approach might work. Below, I discuss this and other possible approaches.

Property Approach

It would mean, perhaps, creating a property called 'Gift' and a dimension called 'Worth'. You can then add these to a product as a property as illustrated below.

 

gift-card-property-idea.thumb.jpg.ffefafebf43ad4333639231194f28ac6.jpg

The main challenge with this idea is it can be confusing to the shop admin since they'll have to add this as a property. In addition, it is possible to add more than one property which might confuse the shop admin even more. However, you might want to add more properties for other aspects of the gift card, e.g. a unique number.

Custom Field(s)

Since Padloper products are also pages, it is possible to add extra field(s) to a product page template. Once you retrieve the Padloper page, you are able to access that/those field(s) as any other field. This approach is very versatile. You can use existing ProcessWire fields such as integers, texts, etc but can also create a custom field to store and edit your gift card information.

One issue with this approach is that if you have products that are not gift cards, they will also have the gift card field(s) added to them even if they don't need them. This can confuse shop admins.

Custom Addon

A third approach is to use the new Padloper feature for Addons. This is probably the most powerful of these approaches and gives you complete freedom whilst still allowing you to utilise (hidden) pages and (custom) fields. 

I have some questions:

  1. Are these gift cards redeemable in the same shop or other shops or both? I.e., is your client selling gift cards or offering them for free to customers?
  2. Are the gift cards partly redeemable or need to be used once?
3 hours ago, Sonia Margollé said:

Is the property with dimensions ect is implemented yet ?

Yes, they are already implemented. Are you not able to add properties to your products?

3 hours ago, Sonia Margollé said:

I can't find an exemple with it even in the demo site.

Currently these are not displayed in the demo site, although properties do exist. I can give you access to the backend of the demo site if that will be helpful.

Thanks.

 

Link to comment
Share on other sites

Thanks,

Sorry I realise I wasn't clear at all, the product sold is cards for photoshoots. Like couple photoshoot, maternity photoshoot ect ..
The photographers wants them to be customizable in case they are purchased as a gift.

By client here I assume you mean the shop owner/admin?
->  Here the client is the actual client. 

It's like the product was a t-shirt that can be customize with a name stiched on it. And you need to add a field to ask for that name. 

I think the best would probably be by using a custom field, I "just" need to find what hooks to use to have it save in the cart and the order 

Link to comment
Share on other sites

I think I have a partial idea !
I still don't know the best and cleaner way to add the input field inside the form on the product page, but ...

1. Maybe I can hook the __addproduct function to alter the cart sql table to add like a "custom" field. And I modify the insert sql to populate the custom field

2. I add to the order template a tablefield field with columns like "product name", "custom field name", "value"

3. I hook the __ordersaved function to populate the tablefield field with the values of the "custom" field int the cart sql data. 

Still need to think of how to recuperate the value of the "custom" field. I need to create a function for that.

?

Link to comment
Share on other sites

4 hours ago, Sonia Margollé said:

It's like the product was a t-shirt that can be customize with a name stiched on it. And you need to add a field to ask for that name. 

This is much clearer now. So, you need to collect this information from the customer in the frontend when they make their purchase. I have some ideas which I talk about below.

 

I see three parts to this challenge:

  1. Collecting extra information from the customer in the frontend.
  2. Processing the customer information in #1 so that it is in sync with the cart and the order.
  3. Storing and accessing the customer information from #2 when order is finalised.

Product versus Order versus Order Line Items

Given that what a customer may want to be customised is unique for that purchase, I don't think customising it at the product level is a good idea. The product needs to remain generic, e.g. a 'blank t-shirt'. Similarly, customising it at the order-level also doesn't make sense since an order is a collection of one or more products (line items) that have been purchased. Hence, customising at the order-level is too broad. I think the best place to customise the purchased product is at the Order Line Item level. An order line item is just a product that has been purchased. However, doesn't change post-purchase. 

I'll get back to this when we get to #2 above. 

#1 Collecting Extra Information from Customer

This is the easy bit. You would have to use custom form for your checkout. At this stage, you will have access to the order items and you have several ways of gathering the details from the customer. You can loop through each item in the cart to find out which ones offer customisation and display extra inputs/text fields for each of them. 

#2 Processing Extra Information Collected from Customer

Here you will have to hook into a checkout process method. I'll have a look at which one is best and make it hookable if it isn't already. Ideally you should hook after the order and order line items have been created (given my argument in product vs order vs order line items above). This will then give you the chance of storing the 'custom' information for each order line item in the order.

#3 Storing and Accessing Extra Information Collected from Customer

Here, I have two thoughts with respect to storing the extra information.

  • Alternative 1: Adding a custom field to the order line item template. Use that information to store the 'custom extra information' from the customer. This could b a typical text field to something more complex.
  • Alternative 2: Using the Notes feature of an Order. All orders store notes. This alternative means you already have somewhere to store the extra customer information. You would need to ensure that such a note is clear as to which line item (bought product) it is referring to in case there are multiple items in the order.

Viewing the information in the shop admin could be a bit tricky. If notes, then that is already built in. If using alternative #1, then it will need a bit more work. I can make the order dashboard hookable so you can display extra information. Or you might be able to hook into Page Edit Form for order template and even insert an extra tab there for customisation.

Please let me know if this is the sort of thing you were referring to.

Thanks.

 

Link to comment
Share on other sites

Hi @Sonia Margollé,

Please have a look at this (demo-2) starter site/demo for an example of hooking into checkout and other order processing in order to collect, process, save and display product customisation details from customers. It also shows how to hook into and amend product weight during checkout (per your question here). If the READMEs are not clear, please let me know. 

Please use your download link to get the latest Padloper 003 files with some new/improved hookable methods.

Thanks.

Link to comment
Share on other sites

On 7/14/2022 at 11:37 AM, Sonia Margollé said:

I hook the __ordersaved function

Please note that I have augmented this method to take two more arguments, $orderLineItemsPages and $orderLineItems. You could always get these two from the first argument, $orderPage, but this change makes your work easier.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...