[Skip to main content](#vessel-content)

#   Add to cart link and custom product fields.

##

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 5 months ago [\#16216](#16216) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  *[Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#16216 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")* was created by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")*

In the product screen there is the *Add to Cart button* which gives displays the following code: Code:

&lt;a class="hikashop_html_add_to_cart_link" href="http://myshop.com/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product_id=887"&gt; Add to cart&lt;/a&gt;

Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the *cart\_product* and *order\_product* tables.

The requirement is to be able to associate the ordered product with the context where the *Add to Cart* button was clicked. This would be used during post order processing.

The link would then look something like this: Code:

&lt;a class="hikashop_html_add_to_cart_link" href="http://myshop.com/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product_id=887&amp;tracking_id=123456"&gt; Add to cart&lt;/a&gt;

The following user(s) said Thank You: [pankaj7645](/forum/user/53139-pankaj7645 "View pankaj7645's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

15 years 5 months ago -  8 years 5 months ago [\#16220](#16220) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#16220 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

In the Business edition of HikaShop, you have custom fields of the table "item". You could create one called tracking_id. Then you could have the URL: Code:

http://myshop.com/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;quantity=1&amp;checkout=1&amp;product_id=887&amp;data[item][tracking_id]=123456

The system would then automatically insert the tracking_id in both tables.

Last edit: 8 years 5 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

The following user(s) said Thank You: [sadaf3d](/forum/user/46256-sadaf3d "View sadaf3d's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 5 months ago [\#16221](#16221) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#16221 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Great, thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ethanhunt123](/forum/user/2145-ethanhunt123 "View ethanhunt123's Profile")**
- [![ethanhunt123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/2145-ethanhunt123 "View ethanhunt123's Profile")
- [ Offline](/forum/user/2145-ethanhunt123)

Less More

- Posts: 9
- Thank you received: 0
-
-

15 years 4 months ago [\#18105](#18105) by [ethanhunt123](/forum/user/2145-ethanhunt123 "View ethanhunt123's Profile")  Replied by *[ethanhunt123](/forum/user/2145-ethanhunt123 "View ethanhunt123's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#18105 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Am I understanding this correctly. By adding the &amp;[item][custom_item_value_field_name]=Test to the end of the url of the add to cart button it will add the specified value items custom field, and then add that item to the cart?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

15 years 4 months ago [\#18109](#18109) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#18109 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

It's &amp;data[item][custom_item_value_field_name]=Test and yes.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 4 months ago [\#19188](#19188) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19188 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

(a) Could multiple products be added from an HTML form using arrays like below?
Note that the quantity could be 0 in some cases!
Code:

&lt;form action="http://myshop.com/index.php" method="post"&gt; &lt;input type="hidden" name="option" value="com_hikashop" /&gt; &lt;input type="hidden" name="ctrl" value="product" /&gt; &lt;input type="hidden" name="task" value="updatecart" /&gt; &lt;input type="hidden" name="product_id[]" value="887" /&gt; &lt;input type="hidden" name="quantity[]" value="1" /&gt; &lt;input type="hidden" name="data[][item][tracking_id]" value="123" /&gt; &lt;input type="hidden" name="product_id[]" value="887" /&gt; &lt;input type="hidden" name="quantity[]" value="1" /&gt; &lt;input type="hidden" name="data[][item][tracking_id]" value="456" /&gt; &lt;input type="hidden" name="product_id[]" value="887" /&gt; &lt;input type="hidden" name="quantity[]" value="0" /&gt; &lt;input type="hidden" name="data[][item][tracking_id]" value="789" /&gt; &lt;input type="hidden" name="product_id[]" value="887" /&gt; &lt;input type="hidden" name="quantity[]" value="1" /&gt; &lt;input type="hidden" name="data[][item][tracking_id]" value="012" /&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt;

(b) Is there / could there be a Hikashop helper function so that my own code could add products to the cart?
Something like this: Code:

$items = array(); $items['tracking_id'] = '123'; $product_id = 887; $quantity = 1; hikashopHelper::addToCart($product_id, $quantity, $items);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

15 years 4 months ago [\#19192](#19192) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19192 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

a/ It's not possible. You could always add that but it's already quite complex code in the updatecart functions...

b/ Sure. You can use the function update of the file administrator/components/com_hikashop/classes/cart.php

But since the items data is taken directly from the request, you will have to set it dynamically in it... Something like that:
$data=array('item'=&gt;$items);
JRequest::setVar('data',$data);
$class = hikashop::get('class.cart');
$class-&gt;update($product_id, $quantity);

It's not tested so you might have to adapt that a bit...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#19870](#19870) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19870 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Works if just one item is being added: Code:

require_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'); $items = array(); $items['tracking_id'] = 123; $data=array('item'=&gt;$items); JRequest::setVar('data',$data); $class = hikashop::get('class.cart'); $class-&gt;update(23, 1);

Does not work if 2 items are being added (e.g. driven from a foreach() loop): Code:

require_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'); $items = array(); $items['tracking_id'] = 123; $data=array('item'=&gt;$items); JRequest::setVar('data',$data); $class = hikashop::get('class.cart'); $class-&gt;update(23, 1); $items = array(); $items['tracking_id'] = 456; $data=array('item'=&gt;$items); JRequest::setVar('data',$data); $class = hikashop::get('class.cart'); $class-&gt;update(23, 1);

To get it to work with Hikashop v1.5.1 I found I had to comment out the following lines of code:
(a) *classes/field.php* in *getInput()* lines 234 and 236 *(if(!isset($formData))*
(b) *classes/cart.php* in *updateEntry()* line 356 *$already\_done2 = true;*

I have not tested the rest of the shop functionality so I don't know what might get broken by these changes.

Is it possible to provide a proper long term fix for this please?
E.G. An optional *force* parameter passed into *$class-&gt;update()* which achieves the same result.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

15 years 3 months ago [\#19873](#19873) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19873 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

We tested that and indeed that's the correct modifications to do in order to override the system. That's a good idea as I'm sure other developers will want to use it. We'll add a new force parameter to the update function for next release:
function update($product_id,$quantity=1,$add=0,$type='product',$resetCartWhenUpdate=true,$force=false){

We'll keep it to false by default in order to not alter anything else in HikaShop as the statics in place currently are used to avoid inserting custom item fields data to the options of a product.

The following user(s) said Thank You: [mumu11](/forum/user/33422-mumu11 "View mumu11's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#19874](#19874) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19874 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Great, thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#19923](#19923) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19923 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Above code populates my custom tracking_id column in the jos_hikashop_cart_product table.

However, when I create/complete the order it does not get copied through to the corresponding column in the jos_hikashop_order_product table

As a result the onAfterOrderUpdate() and onAfterOrderCreate() triggers in my plug-in cannot see it.

The custom item has *Front-End* disabled in its definition (I don't want the customer to see it at checkout).
If I change it to enabled then it works fine.

Is this a bug or design feature?
Could it be changed please so that these items allows get copied across to the jos_hikashop_order_product table.
There might also be additional issues with hiding these values in emails, invoices and customer order listings.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

15 years 3 months ago [\#19928](#19928) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19928 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

You should keep it published on the front end and use CSS to hide it.
You should be able to hide it everywhere with CSS and/or view edition.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#19929](#19929) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#19929 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Will do, thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[peteo](/forum/user/33887-peteo "View peteo's Profile")**
- [![peteo's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33887-peteo "View peteo's Profile")
- [ Offline](/forum/user/33887-peteo)

Less More

- Posts: 114
- Thank you received: 4
-
-

9 years 4 months ago [\#270377](#270377) by [peteo](/forum/user/33887-peteo "View peteo's Profile")  Replied by *[peteo](/forum/user/33887-peteo "View peteo's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#270377 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

How do I add multiple parameters? Would it look like this?
&amp;data[item][custom_item_value_field_name]=Test&amp;data[item][custom_item_value_field_name2]=Test2

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86286
- Thank you received: 14263
-
-

9 years 4 months ago [\#270382](#270382) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Add to cart link and custom product fields.](/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-product-fields#270382 "In the product screen there is the Add to Cart button which gives displays the following code:  Would it be possible to enhance this add to cart link to accept a custom parameter which then gets passed through the checkout process and stored in the cart&#95;product and order&#95;product tables.  The requirement is to be able to associate the ordered product with the context where the Add to Cart button was clicked. This would be used during post order processing.  The link would then look something like this:")*

Hi,

Yes, exactly.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzE2MjE2LWFkZC10by1jYXJ0LWxpbmstYW5kLWN1c3RvbS1wcm9kdWN0LWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.386 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
