- Posts: 11
- Thank you received: 0
Custom Field Adding From External PHP Program
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.29
Hi, I am having some problems trying to create a custom field in an external php program and then add it to the hikashop cart. The external php program is creating the field and the cart is being updated but the custom field is not. The external program is doing what I expect - creating letters from the word entered but getting that info into the cart so that it can go to checkout isn't set up properly and I am trying to understand how to do this more easily.
I haven't programmed in a long time. I have read the forums but don't know all of the ins and outs of hikashop programming.
I purchased the commercial version which allows for custom fields. The custom fields have been added into hikashop. But trying to add the field to the cart is causing me problems. The field is called 'word'. It is the total word added when a visitor creates a word from letters.
Thanks for your help.
Please Log in or Create an account to join the conversation.
As I can see, you transform one letter into one product in the cart, what is the custom field information for ?
To specify the code of the image used ?
If it is, so as you said you have to create a custom field in the product table, then when adding a product to the cart, populate the database column with the custom field name with the desired value. Then edit the view "checkout / cart" and for each product display the value of the custom field, you can use code to display an image directly in the cart.
www.hikashop.com/support/support/documen...ize-the-display.html
Please Log in or Create an account to join the conversation.
Thanks
Please Log in or Create an account to join the conversation.
I'll recommend you to use the trigger "onBeforeCartUpdate" and then modify dynamically the item to set the custom field value.
www.hikashop.com/support/support/documen...umentation.html#cart
You can otherwise use other cart triggers and perform a database query to update the custom field value directly in the database (thanks to the cart_product_id or the order_product_id if you're using order triggers).
And the variable is just the namekey of your custom field (so the column name in the database).
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
thanks
Please Log in or Create an account to join the conversation.
Also, if another word is added to the cart before checkout, then that 'word' and those images also need to show in the cart with the associated letters.
Please Log in or Create an account to join the conversation.
I'm sorry but I don't understand your last message and it does not sound as small task for my point of view.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Order and Item custom fields are displayed in emails (if they are configured to be displayed in the front-end).
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You can use the same principle as the donation plugin in order to override the product prices during the checkout:
demo.hikashop.com/index.php/en/hikashop/...t-page/donation-page
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Below is the code that the external php program is using.
<input type="hidden" name="return_url" value="aHR0cDovLzE3My4xOTIuMTg2LjEzMC9%2BZXhwYXovaW5kZXgucGhwL2hpa2FzaG9wLW1lbnUtZm9yLXByb2R1Y3RzLWxpc3RpbmcuaHRtbA%3D%3D">
Thanks
Please Log in or Create an account to join the conversation.
Go on the website www.base64encode.org/ and paste the URL you want in the first textarea and click on the "encode" button.
Then, copy/paste the base64 encode URL in the text area below to the value of your hidden input field.
Please Log in or Create an account to join the conversation.
To return the values to the cart is there a different url I should be connecting to? I am using the below form action in the php program.
<form action="/~expaz/index.php/hikashop-menu-for-products-listing/product/updatecart.html" method="post" name="hikashop_cart_form">
Thanks
Please Log in or Create an account to join the conversation.
In looking more closely at this part of the code there is a if(response.data.callStatus == 'Error') statement. What would cause this error.
Thanks
Please Log in or Create an account to join the conversation.
There is nothing else to look at. It's this parameter where you can put the return URL and it has to be base64 encoded.
If it doesn't go to that URL then you have a problem with your code or the URL you based64ed.
Not knowing your code, I can't say.
And there is no callStatus in the code of HikaShop nor any file called chooseletters.php
So it really seems that the problem comes from your custom code.
Please Log in or Create an account to join the conversation.
1) is there a way to eliminate the reference to VAT and to stop hikashop from adding dollars for VAT. I have looked and don't see where this can be changed. I guess I am just overlooking it. Can you clarify.
2) when returning from chooseletters, the info is going into the cart and checking out properly. i have 2 shipping options which the customer can choose and this shows up properly. However, if after the word is put into the cart, the customer goes back to choose another letter to add to the cart instead of completing the purchase, hikashop requires the customer to choose another shipping option. How do I change this to have the customer choose the shipping once instead of for each item being purchased.
Thanks
Please Log in or Create an account to join the conversation.
1. The VAT is added by HikaShop to your prices based on how you configured the tax rules in the menu System>Taxes. Disable them if you don't want any taxes.
2. HikaShop only has one set of shipping methods for the whole cart, unless the products in the cart are in different warehouses and in that case, there will be one shipping method selection for each warehouse.
So if you have twice the same product in the cart, I don't see why you would have several shipping methods section areas.
Could you do a screenshot of the settings of your shipping methods listing, of your product and provide the instructions in order to reproduce the problem on your website ?
Please Log in or Create an account to join the conversation.