- Posts: 62
- Thank you received: 0
"Customise" product in checkout process....
15 years 4 months ago #16605
by TheEdge
"Customise" product in checkout process.... was created by TheEdge
G'Day,
I am selling gift vouchers. If a user selects 2 gift vouchers I want to be able to capture some information for *each* voucher eg. Email Address, Name. So for example:
Voucher 1
- john@there.com
- John Smith
Voucher 2
- bob@there.com
- Bob Brown
Can you please get me started on how I go about implementing this?
I am selling gift vouchers. If a user selects 2 gift vouchers I want to be able to capture some information for *each* voucher eg. Email Address, Name. So for example:
Voucher 1
- john@there.com
- John Smith
Voucher 2
- bob@there.com
- Bob Brown
Can you please get me started on how I go about implementing this?
Please Log in or Create an account to join the conversation.
15 years 4 months ago #16607
by nicolas
Replied by nicolas on topic Re: "Customise" product in checkout process....
In the Business edition, you can go in the menu Display->Custom fields and create custom fields of the table "item" of the type text.
They will appear on the product page so that the user can enter the information before adding the product to the cart.
They will appear on the product page so that the user can enter the information before adding the product to the cart.
Please Log in or Create an account to join the conversation.
15 years 4 months ago #16611
by TheEdge
Replied by TheEdge on topic Re: "Customise" product in checkout process....
Hi Nicolas,
I have upgraded to Business edition and it does as you describe. However I have a couple of additional requirements:
1) I only want the newly added item to appear on selected products instead of all of them. How do I achieve that?
2) How do I add validation to the data input. In my case I am requesting an email address. I need to make sure it is a valid email address and ultimately does not exist within the Joomla! user list.
3) I want to enter the email address for each product so if someone orders 6 of the product I want them to enter 6 email addresses. (In preference I don't want to have the user need to add 6 instances of the product)
I have upgraded to Business edition and it does as you describe. However I have a couple of additional requirements:
1) I only want the newly added item to appear on selected products instead of all of them. How do I achieve that?
2) How do I add validation to the data input. In my case I am requesting an email address. I need to make sure it is a valid email address and ultimately does not exist within the Joomla! user list.
3) I want to enter the email address for each product so if someone orders 6 of the product I want them to enter 6 email addresses. (In preference I don't want to have the user need to add 6 instances of the product)
Please Log in or Create an account to join the conversation.
15 years 4 months ago #16625
by nicolas
Replied by nicolas on topic Re: "Customise" product in checkout process....
1. There is no option for that, however, you can modify the file "show" of the view "product" to hide the item lines you don't need on some products. Here is a thread which talks about that:
www.hikashop.com/en/support/forum/4-how-...uct-in-checkout.html
2. If you need javascript validation, what you can do is override the hikashopCheckChangeForm javascript function located in media/com_hikashop/js/hikashop.js in a js file of your template loaded AFTER that file and change the regex in it so that it checks for the format. If you need also to check for the fact that the user exists, you will have to do an AJAX request in that function to a new controller's task you would create which would check the email in the jos_users table.
3. I would indeed have proposed to remove the quantity box via the corresponding option of the configuration and only allow the user to add them one by one. But then, if you want to do all that, I would suggest an alternative:
Instead of creating custom item fields, you could create custom order fields. These are displayed during the checkout. Then, you could edit the file "fields" of the view "checkout" where you could add some code to only display as much fields as products in the cart. You could then do the check of the email in that view file more easily (or another one of the checkout, it depends how you setup your checkout workflow option of the configuration) than with the other solution.
2. If you need javascript validation, what you can do is override the hikashopCheckChangeForm javascript function located in media/com_hikashop/js/hikashop.js in a js file of your template loaded AFTER that file and change the regex in it so that it checks for the format. If you need also to check for the fact that the user exists, you will have to do an AJAX request in that function to a new controller's task you would create which would check the email in the jos_users table.
3. I would indeed have proposed to remove the quantity box via the corresponding option of the configuration and only allow the user to add them one by one. But then, if you want to do all that, I would suggest an alternative:
Instead of creating custom item fields, you could create custom order fields. These are displayed during the checkout. Then, you could edit the file "fields" of the view "checkout" where you could add some code to only display as much fields as products in the cart. You could then do the check of the email in that view file more easily (or another one of the checkout, it depends how you setup your checkout workflow option of the configuration) than with the other solution.
Please Log in or Create an account to join the conversation.
15 years 4 months ago #16677
by TheEdge
Replied by TheEdge on topic Re: "Customise" product in checkout process....
Hi Nicolas,
I prefer your solution #3. I have added the field into the "order" view and can see how that will work. Will read the API to see how I display the correct number of that field. However as that is a single field in the database are you proposing that I encode the data in the field based on the quantity of the prodduct? So if I have a quantity of 3 I would have to do something like first@there.com.au;second@there.com.au;third@there.com.au as this is a single record for the order?
The second thing I cannot find is how to "remove the quantity box via the corresponding option of the configuration". I am assuming this is in the System > Configuration? If so I don't want to turn off quantities for all products. Only for this one.
I prefer your solution #3. I have added the field into the "order" view and can see how that will work. Will read the API to see how I display the correct number of that field. However as that is a single field in the database are you proposing that I encode the data in the field based on the quantity of the prodduct? So if I have a quantity of 3 I would have to do something like first@there.com.au;second@there.com.au;third@there.com.au as this is a single record for the order?
The second thing I cannot find is how to "remove the quantity box via the corresponding option of the configuration". I am assuming this is in the System > Configuration? If so I don't want to turn off quantities for all products. Only for this one.
Please Log in or Create an account to join the conversation.
15 years 4 months ago #16679
by nicolas
Replied by nicolas on topic Re: "Customise" product in checkout process....
1. That could be a possibility indeed. You could also have 20 fields created and just display as much fields as you need based on the quantity ordered...
2. It's indeed in the configuration, under the tab display with the option called "Display the quantity field on the product page". However, that has an effect on all the products. An alternative to that option would then be to edit the file "show" of the view "product" via the menu Display->Views and change that option on the fly for the product where you don't want to show it:
if($this->element->product_code=="my_product"){
$this->params->set('show_quantity_field', 2);
}
2. It's indeed in the configuration, under the tab display with the option called "Display the quantity field on the product page". However, that has an effect on all the products. An alternative to that option would then be to edit the file "show" of the view "product" via the menu Display->Views and change that option on the fly for the product where you don't want to show it:
if($this->element->product_code=="my_product"){
$this->params->set('show_quantity_field', 2);
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.181 seconds