- Posts: 11
- Thank you received: 0
Add product to cart based on custom field
13 years 1 month ago #124776
by Jeroen
Add product to cart based on custom field was created by Jeroen
-- url of the page with the problem -- : n/a yet
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.1.5
-- PHP version -- : 5.3.13
Hi,
I am building a site to sell cards, where the visitor is able to add a personal message to a cart. However, the personal message comes with a price, which I want to add to the cart. From my point of view the steps would be the following:
1. User selects a product
2. On the product page, the user adds additional options (small gifts)
3. The user selects if he wants to add a personal message
3a. In case yes, a text field appears
3b. In case no, nothing happens
4. When clicking the order-button:
On the shopping cart, the specifc product appears, the selected options and an additional product for the cost of the personal message
Currently I have tried to accomplish this:
1. by adding two options to the product page, but unfortunately I cannot show the custom text box in that case when the user selects yes for the personal message. The product will appear on the cart
2. by creating two custom fields, one for the selection and one for the text box, but unfortunately then I cannot add the additional product to the cart.
Hope somebody can help me out.
Thanks in advance,
Jeroen
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.1.5
-- PHP version -- : 5.3.13
Hi,
I am building a site to sell cards, where the visitor is able to add a personal message to a cart. However, the personal message comes with a price, which I want to add to the cart. From my point of view the steps would be the following:
1. User selects a product
2. On the product page, the user adds additional options (small gifts)
3. The user selects if he wants to add a personal message
3a. In case yes, a text field appears
3b. In case no, nothing happens
4. When clicking the order-button:
On the shopping cart, the specifc product appears, the selected options and an additional product for the cost of the personal message
Currently I have tried to accomplish this:
1. by adding two options to the product page, but unfortunately I cannot show the custom text box in that case when the user selects yes for the personal message. The product will appear on the cart
2. by creating two custom fields, one for the selection and one for the text box, but unfortunately then I cannot add the additional product to the cart.
Hope somebody can help me out.
Thanks in advance,
Jeroen
Please Log in or Create an account to join the conversation.
13 years 1 month ago #124818
by Xavier
Replied by Xavier on topic Add product to cart based on custom field
Hi,
The best way is to use a plugin which will increase the price of the product if the text field is not empty.
Thanks to create two custom fields, one which will be the input for the text named "customtext" and one named "amount" to set the price when the text field is filled. The second one have to be a product type custom field.
Then thanks to try the following plugin:
The best way is to use a plugin which will increase the price of the product if the text field is not empty.
Thanks to create two custom fields, one which will be the input for the text named "customtext" and one named "amount" to set the price when the text field is filled. The second one have to be a product type custom field.
Then thanks to try the following plugin:
This attachment is hidden for guests.
Please log in or register to see it.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125254
by Jeroen
Replied by Jeroen on topic Add product to cart based on custom field
Hi Xavier,
thanks for the swift reply! I have installed the plugin (btw, I had to update it for Joomla 3.1) and this was succesful.
Additionally I created two new fields:
1. field name: customtext, table: item, type: text
2. field name: amount, table: product, type: text, default value 2.5
Now when I order, I can see the the customtext. However, when I proceed with the order I do not see any price increase of my product.
What am I doing wrong?
Regards,
Jeroen
thanks for the swift reply! I have installed the plugin (btw, I had to update it for Joomla 3.1) and this was succesful.
Additionally I created two new fields:
1. field name: customtext, table: item, type: text
2. field name: amount, table: product, type: text, default value 2.5
Now when I order, I can see the the customtext. However, when I proceed with the order I do not see any price increase of my product.
What am I doing wrong?
Regards,
Jeroen
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125327
by Xavier
Replied by Xavier on topic Add product to cart based on custom field
Hi,
I just tried on my end, and it's working fine.
Have you save again your products after adding the custom field amount ?
Because, the field is created, but it don't change the product values.
I just tried on my end, and it's working fine.
Have you save again your products after adding the custom field amount ?
Because, the field is created, but it don't change the product values.
The following user(s) said Thank You: Jeroen
Please Log in or Create an account to join the conversation.
13 years 1 month ago - 13 years 1 month ago #125392
by Jeroen
Replied by Jeroen on topic Add product to cart based on custom field
Hi Xavier,
Strange, because I can't get it to work on my end. I now have the following settings:
The plugin is enabled and of the type: system.
I have not made any changes to the plugin or in the ordering steps in Joomla except for some css changes.
Regards,
Jeroen
ps. Unofrtunately it seems I can't attach the screenshots or upload the word document.
Strange, because I can't get it to work on my end. I now have the following settings:
| customtext Label: Text Table: item Column name: customtext Field type: text Published: Yes Categories: All (incl. sub) | amount Label: amount Table: product Column name: amount Field type: text (also tried other types via phpmyadmin) Default value: 2 Published: Yes Categories: All (incl. sub) |
The plugin is enabled and of the type: system.
I have not made any changes to the plugin or in the ordering steps in Joomla except for some css changes.
Regards,
Jeroen
ps. Unofrtunately it seems I can't attach the screenshots or upload the word document.
Last edit: 13 years 1 month ago by Jeroen.
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125421
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Add product to cart based on custom field
Hi,
You have to edit the product in the HikaShop backend and specify a value for the amount.
Even if you set a default value, it does not fill the value in the database for all products.
Regards,
You have to edit the product in the HikaShop backend and specify a value for the amount.
Even if you set a default value, it does not fill the value in the database for all products.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125454
by Jeroen
Replied by Jeroen on topic Add product to cart based on custom field
Hi Jerome,
I have actually done so, also checked the database table itself and for the specific product the amount is filled. Any clue on how I could debug this?
Regards,
Jeroen
I have actually done so, also checked the database table itself and for the specific product the amount is filled. Any clue on how I could debug this?
Regards,
Jeroen
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125473
by Jeroen
Replied by Jeroen on topic Add product to cart based on custom field
Allright, I just made a completely clean installation of Joomla and Hikashop. created a new product, added the fields, etc. All working great. The only difference I see now between the two is the ordering of the plugin. Any idea how I could debug this?
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125535
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Add product to cart based on custom field
Hi,
Well, if the only difference is the plugin ordering. I will suggest you to make a little modification in the plugin (to display something) and see if the function is right called.
This is really strange and I am wondering how this plugin ordering could affect the process.
Regards,
Well, if the only difference is the plugin ordering. I will suggest you to make a little modification in the plugin (to display something) and see if the function is right called.
This is really strange and I am wondering how this plugin ordering could affect the process.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: Jeroen
Please Log in or Create an account to join the conversation.
13 years 1 month ago #125755
by Jeroen
Replied by Jeroen on topic Add product to cart based on custom field
Hi Jerome and Xavier,
Thanks for the support! I finally found the issue. Mistake from my side, topic can be closed. I didn't realize that I had to add the amount to the variants of the products as well. So, I only added the additional amount to the main product, as a result no succes.
After some debugging I finally realized the amount had to be added to the variants of the characteristics as well.
All working fine now. just a few steps away of bringing my shop live!
Regards,
Jeroen
Thanks for the support! I finally found the issue. Mistake from my side, topic can be closed. I didn't realize that I had to add the amount to the variants of the products as well. So, I only added the additional amount to the main product, as a result no succes.
After some debugging I finally realized the amount had to be added to the variants of the characteristics as well.
All working fine now. just a few steps away of bringing my shop live!
Regards,
Jeroen
Please Log in or Create an account to join the conversation.
Time to create page: 0.125 seconds