I want to add a custom field in order table.

  • Posts: 6
  • Thank you received: 0
6 years 6 months ago #280837

-- HikaShop version -- : 3.2.0
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.4.16
-- Browser(s) name and version -- : Google Chrome 62.0
-- Error-message(debug-mod must be tuned on) -- : NO error message

Hi there,

I want to have a custom field to store a combination of two product id when the customer is adding a product to a cart.
One is Base Product ID + Finish Product ID.
Here you can check out - www.csiwallpanels.com/store/product/five...-panel-system-fis000
At top its base product and in middle, we have finish products.
I have also attached screenshots.

So when the customer is adding a cart to the product I want to save both product ID's.
Is it possible? I think can be done. But I don't know exactly how it needs to be done.
I am going to buy the Business Edition so, that i can create a custom field in the orders table.

Please help me.

Thank you

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
6 years 6 months ago #280839

Hi,

Storing some extra data in a custom item field is quite easy if you're a developer.
When you create a custom field, you can specify a column name. You also need to turn on the frontend display setting of the custom field.
In the add to cart URL, you can add a parameter like that:
www.hikashop.com/forum/2-general-talk-ab...ct-fields.html#16220
Instead of adding it to the add to cart URL, you can also add a hidden input field in the form with the same name and the value you want for it.
So that means that you'll need some javascript to add these when the customers click on something to select the finish product they want.
I would also recommend to look at that documentation to easily find which view file to edit for your changes:
www.hikashop.com/support/documentation/1...-display.html#layout

Alternatively, on the other forum thread I gave a link to above, you can also find how to add a product to the cart.
And you can find information about the cart API on this page of the documentation if you want to implement a plugin:
www.hikashop.com/support/documentation/6...r-documentation.html

HOWEVER, I'm wondering why you want to go through all that trouble ? Why not simply have a characteristic on the product so that the users can select between the finishes:
www.hikashop.com/support/documentation/2...isplay-by-color.html
That way, you don't need to do any coding.

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
6 years 6 months ago #280866

Thank you for your help and guiding me. Surely this will help me out.
Actually, I have 1000 of products and there are 100s of finishes, and these finishes are applicable for all the product.
So what will you recommend, add them as characteristics or create a custom field to add a column to the table?
I want value like this FIS001+WOO001.
If I go with a custom field in which table should I create it, orders or item?

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
6 years 6 months ago #280868

Hi,

Custom fields are a good idea then. But I still don't understand why you would need any coding ?
Just create a custom field of the table "item", and in the values of the custom field, enter an img tag with the image for each value and select the type "radio".
That way, the customer will be able to choose the finish with that custom item field and it will be stored in the order automatically.

Custom order fields are global to the order. That means that you would have one finish for all the products in the cart if you were using such custom field.

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
6 years 6 months ago #280905

Hi,

I have create the custom field in order table named 'prodid_fincode'
and add to cart url is : <a class="hikashop_html_add_to_cart_link" href=" www.csiwallpanels.com/index.php?option=c...d=83&Itemid=206&data [order][prodid_fincode]=123">Add to cart</a>

this is not populating my custom field.
Please help

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
6 years 6 months ago #280906

Hi,

You had also mentioned about adding input field as type hidden.
How to do that. Can you please tell in detail.

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
6 years 6 months ago #280918

Hi,

I didn't say that you should use a custom order field. First you can't add a custom order field through the URL like you can with a custom item field. That can only work with custom item fields. And you can't have different finish for different products in the cart if you use a custom order field. So that's why I phrased my message to mean that custom order fields are probably not adapted to your needs.
So please try with a custom item field instead and you'll see it will work.

The following user(s) said Thank You: pankaj7645

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum